-
Notifications
You must be signed in to change notification settings - Fork 982
Unify Pipelines and Firestore classic in CDN and g3 builds #9323
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
base: console
Are you sure you want to change the base?
Changes from all commits
a11ea79
d175049
5fb6ebe
d705208
31535d9
a78b761
cdfc931
54a17c6
81698f9
6251400
637027a
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,21 @@ | ||
| /** | ||
| * @license | ||
| * Copyright 2024 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. | ||
| */ | ||
|
|
||
| export * from '@firebase/firestore'; | ||
|
|
||
| import * as pipelines from '@firebase/firestore/pipelines'; | ||
| export { pipelines }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -59,6 +59,35 @@ const browserPlugins = [ | |
| terser(util.manglePrivatePropertiesOptions) | ||
| ]; | ||
|
|
||
| // TODO - update the implementation to match all content in the declare module block. | ||
| function declareModuleReplacePlugin() { | ||
| // The regex we created earlier | ||
| const moduleToReplace = | ||
| /declare module '\.\/\S+' \{\s+interface Firestore \{\s+pipeline\(\): PipelineSource<Pipeline>;\s+}\s*}/gm; | ||
|
|
||
| // What to replace it with (an empty string to remove it) | ||
|
Comment on lines
+64
to
+68
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. These comments seem out of date. Can you update them? |
||
| const replacement = | ||
| 'interface Firestore {pipeline(): PipelineSource<Pipeline>;}'; | ||
|
|
||
| return { | ||
| name: 'declare-module-replace', | ||
| generateBundle(options, bundle) { | ||
| const outputFileName = 'global_index.d.ts'; | ||
| if (!bundle[outputFileName]) { | ||
| console.warn( | ||
| `[regexReplacePlugin] File not found in bundle: ${outputFileName}` | ||
| ); | ||
| return; | ||
| } | ||
|
|
||
| const chunk = bundle[outputFileName]; | ||
| if (chunk.type === 'chunk') { | ||
| chunk.code = chunk.code.replace(moduleToReplace, replacement); | ||
| } | ||
| } | ||
| }; | ||
| } | ||
|
|
||
| const allBuilds = [ | ||
| // Intermediate Node ESM build without build target reporting | ||
| // this is an intermediate build used to generate the actual esm and cjs builds | ||
|
|
@@ -214,15 +243,17 @@ const allBuilds = [ | |
| } | ||
| }, | ||
| { | ||
| input: 'dist/firestore/src/index.d.ts', | ||
| input: 'dist/firestore/src/global.d.ts', | ||
| output: { | ||
| file: 'dist/firestore/src/global_index.d.ts', | ||
| format: 'es' | ||
| }, | ||
| plugins: [ | ||
| dts({ | ||
| respectExternal: true | ||
| }) | ||
| }), | ||
|
|
||
| declareModuleReplacePlugin() | ||
|
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. It's not obvious why this plugin is necessary. Can you add comments explaining the problem this solves? |
||
| ] | ||
| } | ||
| ]; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -146,7 +146,11 @@ export class FirestoreClient { | |
| * an async I/O to complete). | ||
| */ | ||
| public asyncQueue: AsyncQueue, | ||
| private databaseInfo: DatabaseInfo, | ||
| /** | ||
| * @internal | ||
|
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. I don't think |
||
| * Exposed for testing | ||
| */ | ||
| public _databaseInfo: DatabaseInfo, | ||
| componentProvider?: { | ||
| _offline: OfflineComponentProvider; | ||
| _online: OnlineComponentProvider; | ||
|
|
@@ -167,7 +171,7 @@ export class FirestoreClient { | |
| get configuration(): ComponentConfiguration { | ||
| return { | ||
| asyncQueue: this.asyncQueue, | ||
| databaseInfo: this.databaseInfo, | ||
| databaseInfo: this._databaseInfo, | ||
| clientId: this.clientId, | ||
| authCredentials: this.authCredentials, | ||
| appCheckCredentials: this.appCheckCredentials, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| /** | ||
| * @license | ||
| * Copyright 2025 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 supports a special internal build that includes the entire | ||
| // Firestore classic and pipeline api surface in one bundle. | ||
|
|
||
| import * as pipelines from './api_pipelines'; | ||
| export * from './api'; | ||
| export { pipelines }; |
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.
All our custom rollup plugins exist in
scripts/build. Can you move this plugin to a new file in that directory?