Skip to content

Commit 4f9707d

Browse files
authored
Merge cca3da7 into 8dbf020
2 parents 8dbf020 + cca3da7 commit 4f9707d

24 files changed

+534
-640
lines changed

integration/firestore/firebase_export.ts

+1-12
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,5 @@ const Timestamp = firebase.firestore.Timestamp;
5555
const GeoPoint = firebase.firestore.GeoPoint;
5656
const FieldValue = firebase.firestore.FieldValue;
5757
const Blob = firebase.firestore.Blob;
58-
const loadBundle = firebase.firestore.loadBundle;
59-
const namedQuery = firebase.firestore.namedQuery;
6058

61-
export {
62-
Firestore,
63-
FieldValue,
64-
FieldPath,
65-
Timestamp,
66-
Blob,
67-
GeoPoint,
68-
loadBundle,
69-
namedQuery
70-
};
59+
export { Firestore, FieldValue, FieldPath, Timestamp, Blob, GeoPoint };

integration/firestore/firebase_export_memory.ts

+1-12
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,5 @@ const Timestamp = firebase.firestore.Timestamp;
5555
const GeoPoint = firebase.firestore.GeoPoint;
5656
const FieldValue = firebase.firestore.FieldValue;
5757
const Blob = firebase.firestore.Blob;
58-
const loadBundle = firebase.firestore.loadBundle;
59-
const namedQuery = firebase.firestore.namedQuery;
6058

61-
export {
62-
Firestore,
63-
FieldValue,
64-
FieldPath,
65-
Timestamp,
66-
Blob,
67-
GeoPoint,
68-
loadBundle,
69-
namedQuery
70-
};
59+
export { Firestore, FieldValue, FieldPath, Timestamp, Blob, GeoPoint };
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"name": "@firebase/firestore/bundle",
3+
"description": "Firestore bundle",
4+
"main": "../dist/node-cjs/bundle.js",
5+
"main-esm2017": "../dist/node-esm2017/bundle.js",
6+
"react-native": "../dist/rn/bundle.js",
7+
"browser": "../dist/esm5/bundle.js",
8+
"module": "../dist/esm5/bundle.js",
9+
"esm2017": "../dist/esm2017/bundle.js"
10+
}

packages/firestore/exp/test/shim.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,11 @@ import {
5151
DocumentSnapshot,
5252
QuerySnapshot,
5353
wrapObserver,
54-
extractSnapshotOptions,
55-
loadBundle,
56-
namedQuery
54+
extractSnapshotOptions
5755
} from '../../src/api/database';
5856

5957
export { GeoPoint, Timestamp } from '../index';
60-
export { loadBundle, namedQuery };
58+
export { loadBundle, namedQuery } from '../../src/api/bundle';
6159

6260
/* eslint-disable @typescript-eslint/no-explicit-any */
6361

packages/firestore/index.bundle.ts

+8-6
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,25 @@
1515
* limitations under the License.
1616
*/
1717

18-
import * as firestore from '@firebase/firestore-types';
19-
import { loadBundle, namedQuery } from './src/api/database';
18+
import { Firestore } from './src/api/database';
19+
import { loadBundle, namedQuery } from './src/api/bundle';
2020

2121
/**
2222
* Registers the memory-only Firestore build with the components framework.
2323
*/
24-
export function registerBundle(
25-
instance: typeof firestore.FirebaseFirestore
26-
): void {
24+
export function registerBundle(instance: typeof Firestore): void {
2725
instance.prototype.loadBundle = function (
2826
data: ArrayBuffer | ReadableStream<Uint8Array> | string
2927
) {
28+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
3029
return loadBundle(this as any, data);
3130
};
3231
instance.prototype.namedQuery = function (queryName: string) {
32+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
3333
return namedQuery(this as any, queryName);
3434
};
35+
36+
//TODO: add loadBundle and namedQuery to the firestore namespace
3537
}
3638

37-
registerBundle(firestore.FirebaseFirestore);
39+
registerBundle(Firestore);
+6-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"name": "@firebase/firestore/memory",
33
"description": "A memory-only build of the Cloud Firestore JS SDK.",
4-
"main": "../dist/index.memory.node.cjs.js",
5-
"main-esm2017": "../dist/index.memory.node.esm2017.js",
6-
"react-native": "../dist/index.memory.rn.esm2017.js",
7-
"browser": "../dist/index.memory.esm.js",
8-
"module": "../dist/index.memory.esm.js",
9-
"esm2017": "../dist/index.memory.esm2017.js",
4+
"main": "../dist/node-cjs/memory.js",
5+
"main-esm2017": "../dist/node-esm2017/memory.js",
6+
"react-native": "../dist/rn/memory.js",
7+
"browser": "../dist/esm5/memory.js",
8+
"module": "../dist/esm5/memory.js",
9+
"esm2017": "../dist/esm2017/memory.js",
1010
"typings": "../dist/index.d.ts"
1111
}

packages/firestore/package.json

+11-12
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
"author": "Firebase <[email protected]> (https://firebase.google.com/)",
99
"scripts": {
1010
"bundle": "rollup -c",
11-
"build": "run-p 'bundle rollup.config.browser.js' 'bundle rollup.config.browser.memory.js' 'bundle rollup.config.node.js' 'bundle rollup.config.node.memory.js' 'bundle rollup.config.rn.js' 'bundle rollup.config.rn.memory.js' build:lite build:exp",
11+
"build": "run-p 'bundle rollup.config.browser.js' 'bundle rollup.config.node.js' 'bundle rollup.config.rn.js' build:lite build:exp",
1212
"build:scripts": "tsc -moduleResolution node --module commonjs scripts/*.ts && ls scripts/*.js | xargs -I % sh -c 'terser % -o %'",
13-
"build:release": "run-p 'bundle rollup.config.browser.js' 'bundle rollup.config.browser.memory.js' 'bundle rollup.config.node.js' 'bundle rollup.config.node.memory.js' 'bundle rollup.config.rn.js' 'bundle rollup.config.rn.memory.js'",
13+
"build:release": "run-p 'bundle rollup.config.browser.js' 'bundle rollup.config.node.js' 'bundle rollup.config.rn.js'",
1414
"build:deps": "lerna run --scope @firebase/firestore --include-dependencies build",
1515
"build:console": "node tools/console.build.js",
1616
"build:exp": "rollup -c rollup.config.exp.js",
@@ -52,18 +52,17 @@
5252
"predoc": "node ../../scripts/exp/remove-exp.js temp",
5353
"doc": "api-documenter markdown --input temp --output docs"
5454
},
55-
"main": "dist/index.node.cjs.js",
56-
"main-esm2017": "dist/index.node.esm2017.js",
57-
"react-native": "dist/index.rn.esm2017.js",
58-
"browser": "dist/index.esm.js",
59-
"module": "dist/index.esm.js",
60-
"esm2017": "dist/index.esm2017.js",
61-
"bundle": "dist/index.bundle.js",
62-
"bundleModule": "dist/index.bundle.module.js",
55+
"main": "dist/node-cjs/index.js",
56+
"main-esm2017": "dist/node-esm2017/index.js",
57+
"react-native": "dist/rn/index.js",
58+
"browser": "dist/esm5/index.js",
59+
"module": "dist/esm5/index.js",
60+
"esm2017": "dist/esm2017/index.js",
6361
"license": "Apache-2.0",
6462
"files": [
6563
"dist",
66-
"memory/package.json"
64+
"memory/package.json",
65+
"bundle/package.json"
6766
],
6867
"dependencies": {
6968
"@firebase/component": "0.1.21",
@@ -87,7 +86,7 @@
8786
"json-stable-stringify": "1.0.1",
8887
"protobufjs": "6.10.1",
8988
"rollup": "2.33.1",
90-
"rollup-plugin-copy-assets": "1.1.0",
89+
"rollup-plugin-copy-assets": "2.0.3",
9190
"@rollup/plugin-json": "4.1.0",
9291
"@rollup/plugin-node-resolve": "9.0.0",
9392
"rollup-plugin-replace": "2.2.0",

packages/firestore/rollup.config.browser.js

+19-4
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,21 @@
1616
*/
1717

1818
import pkg from './package.json';
19+
import bundlePkg from './bundle/package.json';
20+
import memoryPkg from './memory/package.json';
21+
import path from 'path';
1922

2023
const util = require('./rollup.shared');
2124

2225
export default [
2326
{
24-
input: 'index.ts',
27+
input: {
28+
index: 'index.ts',
29+
memory: 'index.memory.ts',
30+
bundle: 'index.bundle.ts'
31+
},
2532
output: {
26-
file: pkg.esm2017,
33+
dir: 'dist/esm2017',
2734
format: 'es',
2835
sourcemap: true
2936
},
@@ -34,8 +41,16 @@ export default [
3441
}
3542
},
3643
{
37-
input: pkg.esm2017,
38-
output: { file: pkg.module, format: 'es', sourcemap: true },
44+
input: {
45+
index: pkg.esm2017,
46+
memory: path.resolve('./memory', memoryPkg.esm2017),
47+
bundle: path.resolve('./bundle', bundlePkg.esm2017)
48+
},
49+
output: {
50+
dir: 'dist/esm5',
51+
format: 'es',
52+
sourcemap: true
53+
},
3954
plugins: util.es2017ToEs5Plugins(/* mangled= */ true),
4055
external: util.resolveBrowserExterns,
4156
treeshake: {

packages/firestore/rollup.config.browser.memory.js

-50
This file was deleted.

packages/firestore/rollup.config.bundle.js

-45
This file was deleted.

packages/firestore/rollup.config.node.js

+24-8
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,31 @@
1818
import replace from 'rollup-plugin-replace';
1919
import copy from 'rollup-plugin-copy-assets';
2020
import pkg from './package.json';
21+
import bundlePkg from './bundle/package.json';
22+
import memoryPkg from './memory/package.json';
23+
import path from 'path';
2124

2225
const util = require('./rollup.shared');
2326

2427
export default [
2528
{
26-
input: 'index.node.ts',
29+
input: {
30+
index: 'index.node.ts',
31+
memory: 'index.node.memory.ts',
32+
bundle: 'index.bundle.ts'
33+
},
2734
output: {
28-
file: pkg['main-esm2017'],
35+
dir: 'dist/node-esm2017',
2936
format: 'es',
3037
sourcemap: true
3138
},
3239
plugins: [
3340
...util.es2017Plugins('node'),
34-
// Needed as we also use the *.proto files
35-
copy({
36-
assets: ['./src/protos']
37-
}),
3841
replace({
3942
'process.env.FIRESTORE_PROTO_ROOT': JSON.stringify('src/protos')
43+
}),
44+
copy({
45+
assets: ['./src/protos']
4046
})
4147
],
4248
external: util.resolveNodeExterns,
@@ -45,8 +51,18 @@ export default [
4551
}
4652
},
4753
{
48-
input: pkg['main-esm2017'],
49-
output: [{ file: pkg.main, format: 'cjs', sourcemap: true }],
54+
input: {
55+
index: pkg['main-esm2017'],
56+
memory: path.resolve('./memory', memoryPkg['main-esm2017']),
57+
bundle: path.resolve('./bundle', bundlePkg['main-esm2017'])
58+
},
59+
output: [
60+
{
61+
dir: 'dist/node-cjs',
62+
format: 'cjs',
63+
sourcemap: true
64+
}
65+
],
5066
plugins: util.es2017ToEs5Plugins(),
5167
external: util.resolveNodeExterns,
5268
treeshake: {

0 commit comments

Comments
 (0)