Skip to content

Commit e23ecfb

Browse files
committed
Multiple entry points for main package.
1 parent a9a0b82 commit e23ecfb

File tree

18 files changed

+2096
-1937
lines changed

18 files changed

+2096
-1937
lines changed

common/api-review/firestore-pipelines.api.md

Lines changed: 1751 additions & 0 deletions
Large diffs are not rendered by default.

common/api-review/firestore.api.md

Lines changed: 6 additions & 1736 deletions
Large diffs are not rendered by default.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/**
2+
* @license
3+
* Copyright 2024 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
export * from '@firebase/firestore/pipelines';
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"name": "firebase/firestore/pipelines",
3+
"main": "dist/pipelines.cjs.js",
4+
"browser": "dist/esm/pipelines.esm.js",
5+
"module": "dist/esm/pipelines.esm.js",
6+
"typings": "dist/firestore/lite/pipelines.d.ts"
7+
}

packages/firebase/package.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,18 @@
131131
},
132132
"default": "./firestore/dist/esm/index.esm.js"
133133
},
134+
"./firestore/pipelines": {
135+
"types": "./firestore/dist/firestore/pipelines.d.ts",
136+
"node": {
137+
"require": "./firestore/dist/pipelines.cjs.js",
138+
"import": "./firestore/dist/pipelines.mjs"
139+
},
140+
"browser": {
141+
"require": "./firestore/dist/pipelines.cjs.js",
142+
"import": "./firestore/dist/esm/pipelines.esm.js"
143+
},
144+
"default": "./firestore/dist/esm/pipelines.esm.js"
145+
},
134146
"./firestore/lite": {
135147
"types": "./firestore/lite/dist/firestore/lite/index.d.ts",
136148
"node": {

packages/firestore/package.json

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,14 @@
4747
"test:travis": "ts-node --compiler-options='{\"module\":\"commonjs\"}' ../../scripts/emulator-testing/firestore-test-runner.ts",
4848
"test:minified": "(cd ../../integration/firestore ; yarn test)",
4949
"trusted-type-check": "tsec -p tsconfig.json --noEmit",
50-
"api-report:main": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' ts-node ../../repo-scripts/prune-dts/extract-public-api.ts --package firestore --packageRoot . --typescriptDts ./dist/firestore/src/index.d.ts --rollupDts ./dist/private.d.ts --untrimmedRollupDts ./dist/internal.d.ts --publicDts ./dist/index.d.ts",
51-
"api-report:lite": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' ts-node ../../repo-scripts/prune-dts/extract-public-api.ts --package firestore-lite --packageRoot . --typescriptDts ./dist/firestore/lite/index.d.ts --rollupDts ./dist/lite/private.d.ts --untrimmedRollupDts ./dist/lite/internal.d.ts --publicDts ./dist/lite/index.d.ts",
50+
"api-report:main": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' ts-node ../../repo-scripts/prune-dts/extract-public-api.ts --package firestore --packageRoot . --typescriptDts ./dist/firestore/src/index.d.ts --rollupDts ./dist/private.d.ts --untrimmedRollupDts ./dist/internal.d.ts --publicDts ./dist/index.d.ts",
51+
"api-report:all-packages": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' ts-node ../../repo-scripts/prune-dts/extract-public-api.ts --package firestore --packageRoot . --typescriptDts ./dist/firestore/src/all_packages.d.ts --rollupDts ./dist/private.all_packages.d.ts --untrimmedRollupDts ./dist/internal.all_packages.d.ts --publicDts ./dist/all_packages.d.ts",
52+
"api-report:pipelines": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' ts-node ../../repo-scripts/prune-dts/extract-public-api.ts --package firestore-pipelines --packageRoot . --typescriptDts ./dist/firestore/src/pipelines.d.ts --rollupDts ./dist/private.pipelines.d.ts --untrimmedRollupDts ./dist/internal.pipelines.d.ts --publicDts ./dist/pipelines.d.ts --otherExportsPublicDtsFiles ./dist/index.d.ts",
53+
"api-report:lite": "TS_NODE_COMPILER_OPTIONS='{\"module\":\"commonjs\"}' ts-node ../../repo-scripts/prune-dts/extract-public-api.ts --package firestore-lite --packageRoot . --typescriptDts ./dist/firestore/lite/index.d.ts --rollupDts ./dist/lite/private.d.ts --untrimmedRollupDts ./dist/lite/internal.d.ts --publicDts ./dist/lite/index.d.ts",
5254
"api-report:api-json": "rm -rf temp && api-extractor run --local --verbose",
53-
"api-report": "run-s --npm-path npm api-report:main api-report:lite && yarn api-report:api-json",
55+
"api-report": "run-s --npm-path npm api-report:main api-report:pipelines api-report:lite && yarn api-report:api-json",
5456
"doc": "api-documenter markdown --input temp --output docs",
55-
"typings:public": "node ../../scripts/build/use_typings.js ./dist/index.d.ts"
57+
"typings:public": "node ../../scripts/build/use_typings.js ./dist/all-packages.d.ts"
5658
},
5759
"exports": {
5860
".": {
@@ -76,11 +78,37 @@
7678
},
7779
"react-native": "./dist/lite/index.rn.esm2017.js",
7880
"browser": {
79-
"require": "./dist/lite/index.cjs.js",
81+
"require": "./dist/lite/index.browser.cjs.js",
8082
"import": "./dist/lite/index.browser.esm2017.js"
8183
},
8284
"default": "./dist/lite/index.browser.esm2017.js"
8385
},
86+
"./lite/pipelines": {
87+
"types": "./dist/lite/pipelines.d.ts",
88+
"node": {
89+
"require": "./dist/lite/pipelines.node.cjs.js",
90+
"import": "./dist/lite/pipelines.node.mjs"
91+
},
92+
"react-native": "./dist/lite/pipelines.rn.esm2017.js",
93+
"browser": {
94+
"require": "./dist/lite/pipelines.browser.cjs.js",
95+
"import": "./dist/lite/pipelines.browser.esm2017.js"
96+
},
97+
"default": "./dist/lite/pipelines.browser.esm2017.js"
98+
},
99+
"./pipelines": {
100+
"types": "./dist/pipelines.d.ts",
101+
"node": {
102+
"require": "./dist/pipelines.node.cjs.js",
103+
"import": "./dist/pipelines.node.mjs"
104+
},
105+
"react-native": "./dist/index.rn.esm2017.js",
106+
"browser": {
107+
"require": "./dist/pipelines.cjs.js",
108+
"import": "./dist/pipelines.esm2017.js"
109+
},
110+
"default": "./dist/pipelines.esm2017.js"
111+
},
84112
"./package.json": "./package.json"
85113
},
86114
"main": "dist/index.node.cjs.js",
@@ -135,7 +163,7 @@
135163
"bugs": {
136164
"url": "https://github.com/firebase/firebase-js-sdk/issues"
137165
},
138-
"typings": "dist/firestore/src/index.d.ts",
166+
"types": "dist/all_packages.d.ts",
139167
"nyc": {
140168
"extension": [
141169
".ts"
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "@firebase/firestore/pipelines",
3+
"description": "pipelines",
4+
"main": "../dist/pipelines.node.cjs.js",
5+
"main-esm": "../dist/pipelines.node.mjs",
6+
"module": "../dist/pipelines.browser.esm2017.js",
7+
"browser": "../dist/pipelines.browser.esm2017.js",
8+
"react-native": "../dist/pipelines.rn.esm2017.js",
9+
"typings": "../dist/pipelines.d.ts",
10+
"private": true,
11+
"engines": {
12+
"node": ">=18.0.0"
13+
}
14+
}

packages/firestore/rollup.config.js

Lines changed: 33 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ const browserPlugins = [
5151
cacheDir: tmp.dirSync(),
5252
abortOnError: true,
5353
transformers: [util.removeAssertAndPrefixInternalTransformer]
54+
//transformers: [util.removeAssertTransformer]
5455
}),
5556
json({ preferConst: true }),
5657
terser(util.manglePrivatePropertiesOptions)
@@ -61,9 +62,11 @@ const allBuilds = [
6162
// this is an intermediate build used to generate the actual esm and cjs builds
6263
// which add build target reporting
6364
{
64-
input: './src/index.node.ts',
65+
input: ['./src/index.node.ts', './src/pipelines.node.ts'],
6566
output: {
66-
file: pkg['main-esm'],
67+
dir: 'dist/intermediate',
68+
entryFileNames: '[name].mjs',
69+
chunkFileNames: 'common-[hash].node.mjs',
6770
format: 'es',
6871
sourcemap: true
6972
},
@@ -76,9 +79,11 @@ const allBuilds = [
7679
},
7780
// Node CJS build
7881
{
79-
input: pkg['main-esm'],
82+
input: ['dist/intermediate/index.node.mjs', 'dist/intermediate/pipelines.node.mjs'],
8083
output: {
81-
file: pkg.main,
84+
dir: 'dist/',
85+
entryFileNames: '[name].cjs.js',
86+
chunkFileNames: 'common-[hash].node.cjs.js',
8287
format: 'cjs',
8388
sourcemap: true
8489
},
@@ -103,9 +108,11 @@ const allBuilds = [
103108
},
104109
// Node ESM build with build target reporting
105110
{
106-
input: pkg['main-esm'],
111+
input: ['dist/intermediate/index.node.mjs', 'dist/intermediate/pipelines.node.mjs'],
107112
output: {
108-
file: pkg['main-esm'],
113+
dir: 'dist/',
114+
entryFileNames: '[name].mjs',
115+
chunkFileNames: 'common-[hash].node.mjs',
109116
format: 'es',
110117
sourcemap: true
111118
},
@@ -122,24 +129,31 @@ const allBuilds = [
122129
// this is an intermediate build used to generate the actual esm and cjs builds
123130
// which add build target reporting
124131
{
125-
input: './src/index.ts',
132+
input: ['./src/index.ts', './src/pipelines.ts'],
126133
output: {
127-
file: pkg.browser,
134+
dir: 'dist/intermediate',
135+
entryFileNames: '[name].js',
136+
chunkFileNames: 'common-[hash].js',
128137
format: 'es',
129138
sourcemap: true
130139
},
131-
plugins: [alias(util.generateAliasConfig('browser')), ...browserPlugins],
140+
plugins: [
141+
alias(util.generateAliasConfig('browser')),
142+
...browserPlugins
143+
],
132144
external: util.resolveBrowserExterns,
133145
treeshake: {
134146
moduleSideEffects: false
135147
}
136148
},
137149
// Convert es2017 build to cjs
138150
{
139-
input: pkg['browser'],
151+
input: ['dist/intermediate/index.js', 'dist/intermediate/pipelines.js'],
140152
output: [
141153
{
142-
file: './dist/index.cjs.js',
154+
dir: 'dist/',
155+
entryFileNames: '[name].cjs.js',
156+
chunkFileNames: 'common-[hash].cjs.js',
143157
format: 'cjs',
144158
sourcemap: true
145159
}
@@ -155,10 +169,12 @@ const allBuilds = [
155169
},
156170
// es2017 build with build target reporting
157171
{
158-
input: pkg['browser'],
172+
input: ['dist/intermediate/index.js', 'dist/intermediate/pipelines.js'],
159173
output: [
160174
{
161-
file: pkg['browser'],
175+
dir: 'dist/',
176+
entryFileNames: '[name].esm2017.js',
177+
chunkFileNames: 'common-[hash].esm2017.js',
162178
format: 'es',
163179
sourcemap: true
164180
}
@@ -174,9 +190,11 @@ const allBuilds = [
174190
},
175191
// RN build
176192
{
177-
input: './src/index.rn.ts',
193+
input: ['./src/index.rn.ts', './src/pipelines.rn.ts',],
178194
output: {
179-
file: pkg['react-native'],
195+
dir: 'dist/',
196+
entryFileNames: '[name].js',
197+
chunkFileNames: 'common-[hash].rn.js',
180198
format: 'es',
181199
sourcemap: true
182200
},

packages/firestore/rollup.shared.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ const publicIdentifiers = extractPublicIdentifiers(externsPaths);
108108
// manually add `_delegate` because we don't have typings for the compat package
109109
publicIdentifiers.add('_delegate');
110110

111+
112+
console.log(`==== publicIdentifiers`)
113+
console.log(JSON.stringify(publicIdentifiers, null, 2))
114+
111115
/**
112116
* Transformers that remove calls to `debugAssert` and messages for 'fail` and
113117
* `hardAssert`.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/**
2+
* Cloud Firestore
3+
*
4+
* @packageDocumentation
5+
*/
6+
7+
/**
8+
* @license
9+
* Copyright 2024 Google LLC
10+
*
11+
* Licensed under the Apache License, Version 2.0 (the "License");
12+
* you may not use this file except in compliance with the License.
13+
* You may obtain a copy of the License at
14+
*
15+
* http://www.apache.org/licenses/LICENSE-2.0
16+
*
17+
* Unless required by applicable law or agreed to in writing, software
18+
* distributed under the License is distributed on an "AS IS" BASIS,
19+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20+
* See the License for the specific language governing permissions and
21+
* limitations under the License.
22+
*/
23+
24+
export * from './api';
25+
export * from './api_pipelines';

0 commit comments

Comments
 (0)