Skip to content

Commit

Permalink
Actually creates firebase/firestore/bundle package.json
Browse files Browse the repository at this point in the history
  • Loading branch information
wu-hui committed Dec 5, 2020
1 parent aae9956 commit 6898afe
Show file tree
Hide file tree
Showing 9 changed files with 168 additions and 4 deletions.
18 changes: 18 additions & 0 deletions packages/firebase/firestore/bundle/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import '@firebase/firestore/bundle';
7 changes: 7 additions & 0 deletions packages/firebase/firestore/bundle/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "firebase/firestore/bundle",
"description": "The bundle loading feature of the Cloud Firestore component.",
"main": "dist/index.cjs.js",
"module": "dist/index.esm.js",
"typings": "../empty-import.d.ts"
}
19 changes: 19 additions & 0 deletions packages/firebase/firestore/index.cdn.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import '@firebase/firestore';
import '@firebase/firestore/bundle';
1 change: 0 additions & 1 deletion packages/firebase/firestore/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,3 @@
*/

import '@firebase/firestore';
import '@firebase/firestore/bundle';
23 changes: 23 additions & 0 deletions packages/firebase/firestore/memory/bundle/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* This file serves as the public entrypoint for users that import
* `firebase/firestore/memory`.
*/

import '@firebase/firestore/memory-bundle';
7 changes: 7 additions & 0 deletions packages/firebase/firestore/memory/bundle/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "firebase/firestore/memory",
"description": "A memory-only build of the Cloud Firestore JS SDK.",
"main": "dist/index.node.cjs.js",
"module": "dist/index.esm.js",
"typings": "../../empty-import.d.ts"
}
24 changes: 24 additions & 0 deletions packages/firebase/firestore/memory/index.cdn.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/**
* @license
* Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* This file serves as the public entrypoint for users that import
* `firebase/firestore/memory`.
*/

import '@firebase/firestore/memory';
import '@firebase/firestore/memory-bundle';
1 change: 0 additions & 1 deletion packages/firebase/firestore/memory/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,3 @@
*/

import '@firebase/firestore/memory';
import '@firebase/firestore/memory-bundle';
72 changes: 70 additions & 2 deletions packages/firebase/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ const appBuilds = [

const componentBuilds = pkg.components
// The "app" component is treated differently because it doesn't depend on itself.
.filter(component => component !== 'app')
.filter(component => component !== 'app' && component !== 'firestore')
.map(component => {
const pkg = require(`./${component}/package.json`);
return [
Expand Down Expand Up @@ -149,6 +149,56 @@ const componentBuilds = pkg.components
})
.reduce((a, b) => a.concat(b), []);

const firestoreBuilds = [
{
input: `firestore/index.ts`,
output: [
{
file: resolve('firestore', pkg.main),
format: 'cjs',
sourcemap: true
},
{
file: resolve('firestore', pkg.module),
format: 'es',
sourcemap: true
}
],
plugins,
external
},
{
input: `firestore/bundle/index.ts`,
output: [
{
file: resolve('firestore/bundle', pkg.main),
format: 'cjs',
sourcemap: true
},
{
file: resolve('firestore/bundle', pkg.module),
format: 'es',
sourcemap: true
}
],
plugins,
external
},
{
input: `firestore/index.cdn.ts`,
output: createUmdOutputConfig(`firebase-firestore.js`),
plugins: [
...plugins,
uglify({
output: {
ascii_only: true // escape unicode chars
}
})
],
external: ['@firebase/app']
}
];

const firestoreMemoryBuilds = [
{
input: `firestore/memory/index.ts`,
Expand All @@ -168,7 +218,24 @@ const firestoreMemoryBuilds = [
external
},
{
input: `firestore/memory/index.ts`,
input: `firestore/memory/bundle/index.ts`,
output: [
{
file: resolve('firestore/memory/bundle', pkg.main),
format: 'cjs',
sourcemap: true
},
{
file: resolve('firestore/memory/bundle', pkg.module),
format: 'es',
sourcemap: true
}
],
plugins,
external
},
{
input: `firestore/memory/index.cdn.ts`,
output: createUmdOutputConfig(`firebase-firestore.memory.js`),
plugins: [...plugins, uglify()],
external: ['@firebase/app']
Expand Down Expand Up @@ -276,6 +343,7 @@ const completeBuilds = [
export default [
...appBuilds,
...componentBuilds,
...firestoreBuilds,
...firestoreMemoryBuilds,
...completeBuilds
];

0 comments on commit 6898afe

Please sign in to comment.