-
Notifications
You must be signed in to change notification settings - Fork 943
A few fixes for Firestore bundle sdk builds #4177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
6898afe
116cd82
2c91fd1
0941918
dee1ef0
f9e8bf5
74e0a16
ca061e9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/** | ||
* @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. | ||
*/ | ||
|
||
import '@firebase/firestore/bundle'; |
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.node.cjs.js", | ||
"module": "dist/index.esm.js", | ||
"typings": "../empty-import.d.ts" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/** | ||
* @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. | ||
*/ | ||
|
||
import '@firebase/firestore'; | ||
import '@firebase/firestore/bundle'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,4 +16,3 @@ | |
*/ | ||
|
||
import '@firebase/firestore'; | ||
import '@firebase/firestore/bundle'; |
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'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"name": "firebase/firestore/memory", | ||
"description": "The bundle loading feature for the 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" | ||
} |
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'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,4 +21,3 @@ | |
*/ | ||
|
||
import '@firebase/firestore/memory'; | ||
import '@firebase/firestore/memory-bundle'; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"name": "firebase/firestore", | ||
"description": "The Cloud Firestore component of the Firebase JS SDK.", | ||
"main": "dist/index.cjs.js", | ||
"main": "dist/index.node.cjs.js", | ||
"module": "dist/index.esm.js", | ||
"typings": "../empty-import.d.ts" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,12 @@ import pkg from './package.json'; | |
|
||
import appPkg from './app/package.json'; | ||
|
||
import firestorePkg from './firestore/package.json'; | ||
import firestoreBundlePkg from './firestore/bundle/package.json'; | ||
|
||
import firestoreMemoryPkg from './firestore/memory/package.json'; | ||
import firestoreMemoryBundlePkg from './firestore/memory/bundle/package.json'; | ||
|
||
function createUmdOutputConfig(output) { | ||
return { | ||
file: output, | ||
|
@@ -111,7 +117,9 @@ const appBuilds = [ | |
|
||
const componentBuilds = pkg.components | ||
// The "app" component is treated differently because it doesn't depend on itself. | ||
.filter(component => component !== 'app') | ||
// The "firestore" component is treated differently because it contains multiple | ||
// sub components for different builds. | ||
.filter(component => component !== 'app' && component !== 'firestore') | ||
.map(component => { | ||
const pkg = require(`./${component}/package.json`); | ||
return [ | ||
|
@@ -149,17 +157,67 @@ const componentBuilds = pkg.components | |
}) | ||
.reduce((a, b) => a.concat(b), []); | ||
|
||
const firestoreBuilds = [ | ||
{ | ||
input: `firestore/index.ts`, | ||
output: [ | ||
{ | ||
file: resolve('firestore', firestorePkg.main), | ||
format: 'cjs', | ||
sourcemap: true | ||
}, | ||
{ | ||
file: resolve('firestore', firestorePkg.module), | ||
format: 'es', | ||
sourcemap: true | ||
} | ||
], | ||
plugins, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we not need
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The index.ts is just |
||
external | ||
}, | ||
{ | ||
input: `firestore/bundle/index.ts`, | ||
output: [ | ||
{ | ||
file: resolve('firestore/bundle', firestoreBundlePkg.main), | ||
format: 'cjs', | ||
sourcemap: true | ||
}, | ||
{ | ||
file: resolve('firestore/bundle', firestoreBundlePkg.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`, | ||
output: [ | ||
{ | ||
file: resolve('firestore/memory', pkg.main), | ||
file: resolve('firestore/memory', firestoreMemoryPkg.main), | ||
format: 'cjs', | ||
sourcemap: true | ||
}, | ||
{ | ||
file: resolve('firestore/memory', pkg.module), | ||
file: resolve('firestore/memory', firestoreMemoryPkg.module), | ||
format: 'es', | ||
sourcemap: true | ||
} | ||
|
@@ -168,7 +226,27 @@ const firestoreMemoryBuilds = [ | |
external | ||
}, | ||
{ | ||
input: `firestore/memory/index.ts`, | ||
input: `firestore/memory/bundle/index.ts`, | ||
output: [ | ||
{ | ||
file: resolve('firestore/memory/bundle', firestoreMemoryBundlePkg.main), | ||
format: 'cjs', | ||
sourcemap: true | ||
}, | ||
{ | ||
file: resolve( | ||
'firestore/memory/bundle', | ||
firestoreMemoryBundlePkg.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'] | ||
|
@@ -276,6 +354,7 @@ const completeBuilds = [ | |
export default [ | ||
...appBuilds, | ||
...componentBuilds, | ||
...firestoreBuilds, | ||
...firestoreMemoryBuilds, | ||
...completeBuilds | ||
]; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,7 @@ import '../database'; | |
// `atob`). We should provide a RN build that works out of the box. | ||
import '../storage'; | ||
import '../firestore'; | ||
import '../firestore/bundle'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The React Nativce build of the main Firestore package splits up bundles and non-bundled code. I think we should do the same here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is for "complete" build, which include everything (except memory only builds) on other platforms. |
||
|
||
firebase.registerVersion(name, version, 'rn'); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.