File tree Expand file tree Collapse file tree 2 files changed +33
-2
lines changed Expand file tree Collapse file tree 2 files changed +33
-2
lines changed Original file line number Diff line number Diff line change @@ -59,6 +59,35 @@ const browserPlugins = [
5959 terser ( util . manglePrivatePropertiesOptions )
6060] ;
6161
62+ // TODO - update the implementation to match all content in the declare module block.
63+ function declareModuleReplacePlugin ( ) {
64+ // The regex we created earlier
65+ const moduleToReplace =
66+ / d e c l a r e m o d u l e ' \. \/ \S + ' \{ \s + i n t e r f a c e F i r e s t o r e \{ \s + p i p e l i n e \( \) : P i p e l i n e S o u r c e < P i p e l i n e > ; \s + } \s * } / gm;
67+
68+ // What to replace it with (an empty string to remove it)
69+ const replacement =
70+ 'interface Firestore {pipeline(): PipelineSource<Pipeline>;}' ;
71+
72+ return {
73+ name : 'declare-module-replace' ,
74+ generateBundle ( options , bundle ) {
75+ const outputFileName = 'global_index.d.ts' ;
76+ if ( ! bundle [ outputFileName ] ) {
77+ console . warn (
78+ `[regexReplacePlugin] File not found in bundle: ${ outputFileName } `
79+ ) ;
80+ return ;
81+ }
82+
83+ const chunk = bundle [ outputFileName ] ;
84+ if ( chunk . type === 'chunk' ) {
85+ chunk . code = chunk . code . replace ( moduleToReplace , replacement ) ;
86+ }
87+ }
88+ } ;
89+ }
90+
6291const allBuilds = [
6392 // Intermediate Node ESM build without build target reporting
6493 // this is an intermediate build used to generate the actual esm and cjs builds
@@ -222,7 +251,9 @@ const allBuilds = [
222251 plugins : [
223252 dts ( {
224253 respectExternal : true
225- } )
254+ } ) ,
255+
256+ declareModuleReplacePlugin ( )
226257 ]
227258 }
228259] ;
Original file line number Diff line number Diff line change 1818// This file supports a special internal build that includes the entire
1919// Firestore classic and pipeline api surface in one bundle.
2020
21+ import * as pipelines from './api_pipelines' ;
2122export * from './api' ;
22- import * as pipelines from '../pipelines/pipelines' ;
2323export { pipelines } ;
You can’t perform that action at this time.
0 commit comments