Skip to content

Commit 238e52a

Browse files
committed
firebase packaging update (#5348)
1 parent c0ae7f4 commit 238e52a

File tree

31 files changed

+160
-178
lines changed

31 files changed

+160
-178
lines changed
+3-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
{
22
"name": "firebase/analytics",
3-
"main": "dist/index.cjs",
3+
"main": "dist/index.cjs.js",
44
"browser": "dist/index.esm.js",
5-
"module": "dist/index.esm.js",
6-
"typings": "dist/analytics/index.d.ts",
7-
"type": "module"
5+
"module": "dist/index.mjs",
6+
"typings": "dist/analytics/index.d.ts"
87
}
+3-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
{
22
"name": "firebase/app-check",
3-
"main": "dist/index.cjs",
3+
"main": "dist/index.cjs.js",
44
"browser": "dist/index.esm.js",
5-
"module": "dist/index.esm.js",
6-
"typings": "dist/app-check/index.d.ts",
7-
"type": "module"
5+
"module": "dist/index.mjs",
6+
"typings": "dist/app-check/index.d.ts"
87
}

packages/firebase/app/package.json

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
{
22
"name": "firebase/app",
3-
"main": "dist/index.cjs",
3+
"main": "dist/index.cjs.js",
44
"browser": "dist/index.esm.js",
5-
"module": "dist/index.esm.js",
6-
"typings": "dist/app/index.d.ts",
7-
"type": "module"
5+
"module": "dist/index.mjs",
6+
"typings": "dist/app/index.d.ts"
87
}
+3-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
{
22
"name": "firebase/auth/cordova",
3-
"main": "dist/index.cjs",
3+
"main": "dist/index.cjs.js",
44
"browser": "dist/index.esm.js",
5-
"module": "dist/index.esm.js",
6-
"typings": "dist/auth/cordova/index.d.ts",
7-
"type": "module"
5+
"module": "dist/index.mjs",
6+
"typings": "dist/auth/cordova/index.d.ts"
87
}

packages/firebase/auth/package.json

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
{
22
"name": "firebase/auth",
3-
"main": "dist/index.cjs",
3+
"main": "dist/index.cjs.js",
44
"browser": "dist/index.esm.js",
5-
"module": "dist/index.esm.js",
6-
"typings": "dist/auth/index.d.ts",
7-
"type": "module"
5+
"module": "dist/index.mjs",
6+
"typings": "dist/auth/index.d.ts"
87
}
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
{
22
"name": "firebase/auth/react-native",
3-
"main": "dist/index.cjs",
3+
"main": "dist/index.cjs.js",
44
"browser": "dist/index.esm.js",
5-
"module": "dist/index.esm.js",
6-
"typings": "dist/auth/react-native/index.d.ts",
7-
"type": "module"
5+
"module": "dist/index.mjs",
6+
"typings": "dist/auth/react-native/index.d.ts"
87
}
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
{
22
"name": "firebase/compat/analytics",
3-
"main": "dist/index.cjs",
3+
"main": "dist/index.cjs.js",
44
"browser": "dist/index.esm.js",
5-
"module": "dist/index.esm.js",
6-
"typings": "dist/compat/analytics/index.d.ts",
7-
"type": "module"
5+
"module": "dist/index.mjs",
6+
"typings": "dist/compat/analytics/index.d.ts"
87
}
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
{
22
"name": "firebase/compat/app-check",
3-
"main": "dist/index.cjs",
3+
"main": "dist/index.cjs.js",
44
"browser": "dist/index.esm.js",
5-
"module": "dist/index.esm.js",
6-
"typings": "dist/compat/app-check/index.d.ts",
7-
"type": "module"
5+
"module": "dist/index.mjs",
6+
"typings": "dist/compat/app-check/index.d.ts"
87
}
+3-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
{
22
"name": "firebase/compat/app",
3-
"main": "dist/index.cjs",
3+
"main": "dist/index.cjs.js",
44
"browser": "dist/index.esm.js",
5-
"module": "dist/index.esm.js",
6-
"typings": "../index.d.ts",
7-
"type": "module"
5+
"module": "dist/index.mjs",
6+
"typings": "../index.d.ts"
87
}
+3-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
{
22
"name": "firebase/compat/auth",
3-
"main": "dist/index.cjs",
3+
"main": "dist/index.cjs.js",
44
"browser": "dist/index.esm.js",
5-
"module": "dist/index.esm.js",
6-
"typings": "dist/compat/auth/index.d.ts",
7-
"type": "module"
5+
"module": "dist/index.mjs",
6+
"typings": "dist/compat/auth/index.d.ts"
87
}
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
{
22
"name": "firebase/compat/database",
3-
"main": "dist/index.cjs",
3+
"main": "dist/index.cjs.js",
44
"browser": "dist/index.esm.js",
5-
"module": "dist/index.esm.js",
6-
"typings": "dist/compat/database/index.d.ts",
7-
"type": "module"
5+
"module": "dist/index.mjs",
6+
"typings": "dist/compat/database/index.d.ts"
87
}
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
{
22
"name": "firebase/compat/firestore",
3-
"main": "dist/index.cjs",
3+
"main": "dist/index.cjs.js",
44
"browser": "dist/index.esm.js",
5-
"module": "dist/index.esm.js",
6-
"typings": "dist/compat/firestore/index.d.ts",
7-
"type": "module"
5+
"module": "dist/index.mjs",
6+
"typings": "dist/compat/firestore/index.d.ts"
87
}
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
{
22
"name": "firebase/compat/functions",
3-
"main": "dist/index.cjs",
3+
"main": "dist/index.cjs.js",
44
"browser": "dist/index.esm.js",
5-
"module": "dist/index.esm.js",
6-
"typings": "dist/compat/functions/index.d.ts",
7-
"type": "module"
5+
"module": "dist/index.mjs",
6+
"typings": "dist/compat/functions/index.d.ts"
87
}
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
{
22
"name": "firebase/compat/messaging",
3-
"main": "dist/index.cjs",
3+
"main": "dist/index.cjs.js",
44
"browser": "dist/index.esm.js",
5-
"module": "dist/index.esm.js",
6-
"typings": "dist/compat/messaging/index.d.ts",
7-
"type": "module"
5+
"module": "dist/index.mjs",
6+
"typings": "dist/compat/messaging/index.d.ts"
87
}

packages/firebase/compat/package.json

+2-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "firebase/compat",
33
"main": "dist/index.node.cjs",
44
"browser": "dist/index.esm.js",
5-
"module": "dist/index.esm.js",
5+
"module": "dist/index.mjs",
66
"react-native": "dist/index.rn.cjs.js",
77
"typings": "index.d.ts",
88
"components": [
@@ -17,6 +17,5 @@
1717
"firestore",
1818
"storage",
1919
"database"
20-
],
21-
"type": "module"
20+
]
2221
}
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
{
22
"name": "firebase/compat/performance",
3-
"main": "dist/index.cjs",
3+
"main": "dist/index.cjs.js",
44
"browser": "dist/index.esm.js",
5-
"module": "dist/index.esm.js",
6-
"typings": "dist/compat/performance/index.d.ts",
7-
"type": "module"
5+
"module": "dist/index.mjs",
6+
"typings": "dist/compat/performance/index.d.ts"
87
}
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
{
22
"name": "firebase/compat/remote-config",
3-
"main": "dist/index.cjs",
3+
"main": "dist/index.cjs.js",
44
"browser": "dist/index.esm.js",
5-
"module": "dist/index.esm.js",
6-
"typings": "dist/compat/remote-config/index.d.ts",
7-
"type": "module"
5+
"module": "dist/index.mjs",
6+
"typings": "dist/compat/remote-config/index.d.ts"
87
}

packages/firebase/compat/rollup.config.js

+10
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,11 @@ const appBuilds = [
102102
file: resolve(__dirname, 'app', appPkg.module),
103103
format: 'es',
104104
sourcemap: true
105+
},
106+
{
107+
file: resolve(__dirname, 'app', appPkg.browser),
108+
format: 'es',
109+
sourcemap: true
105110
}
106111
],
107112
plugins: [...plugins, typescriptPlugin],
@@ -140,6 +145,11 @@ const componentBuilds = compatPkg.components
140145
file: resolve(__dirname, component, pkg.module),
141146
format: 'es',
142147
sourcemap: true
148+
},
149+
{
150+
file: resolve(__dirname, component, pkg.browser),
151+
format: 'es',
152+
sourcemap: true
143153
}
144154
],
145155
plugins: [...plugins, typescriptPlugin],
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
{
22
"name": "firebase/compat/storage",
3-
"main": "dist/index.cjs",
3+
"main": "dist/index.cjs.js",
44
"browser": "dist/index.esm.js",
5-
"module": "dist/index.esm.js",
6-
"typings": "dist/compat/storage/index.d.ts",
7-
"type": "module"
5+
"module": "dist/index.mjs",
6+
"typings": "dist/compat/storage/index.d.ts"
87
}
+3-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
{
22
"name": "firebase/database",
3-
"main": "dist/index.cjs",
3+
"main": "dist/index.cjs.js",
44
"browser": "dist/index.esm.js",
5-
"module": "dist/index.esm.js",
6-
"typings": "dist/database/index.d.ts",
7-
"type": "module"
5+
"module": "dist/index.mjs",
6+
"typings": "dist/database/index.d.ts"
87
}
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
{
22
"name": "firebase/firestore/lite",
3-
"main": "dist/index.cjs",
3+
"main": "dist/index.cjs.js",
44
"browser": "dist/index.esm.js",
5-
"module": "dist/index.esm.js",
6-
"typings": "dist/firestore/lite/index.d.ts",
7-
"type": "module"
5+
"module": "dist/index.mjs",
6+
"typings": "dist/firestore/lite/index.d.ts"
87
}
+3-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
{
22
"name": "firebase/firestore",
3-
"main": "dist/index.cjs",
3+
"main": "dist/index.cjs.js",
44
"browser": "dist/index.esm.js",
5-
"module": "dist/index.esm.js",
6-
"typings": "dist/firestore/index.d.ts",
7-
"type": "module"
5+
"module": "dist/index.mjs",
6+
"typings": "dist/firestore/index.d.ts"
87
}
+3-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
{
22
"name": "firebase/functions",
3-
"main": "dist/index.cjs",
3+
"main": "dist/index.cjs.js",
44
"browser": "dist/index.esm.js",
5-
"module": "dist/index.esm.js",
6-
"typings": "dist/functions/index.d.ts",
7-
"type": "module"
5+
"module": "dist/index.mjs",
6+
"typings": "dist/functions/index.d.ts"
87
}

packages/firebase/gulpfile.js

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

1818
var gulp = require('gulp');
19-
var concat = require('gulp-concat');
2019
var sourcemaps = require('gulp-sourcemaps');
20+
const replace = require('gulp-replace');
2121

22-
const OUTPUT_FILE = 'firebase.js';
2322
const pkgJson = require('./package.json');
2423
const files = pkgJson.components.map(component => {
2524
const componentName = component.replace('/', '-');
2625
return `firebase-${componentName}.js`;
2726
});
27+
const FIREBASE_APP_URL = `https://www.gstatic.com/firebasejs/${pkgJson.version}/firebase-app.js`;
2828

29-
gulp.task('firebase-js', function () {
29+
gulp.task('cdn-type-module-path', function () {
3030
return gulp
3131
.src(files)
3232
.pipe(sourcemaps.init({ loadMaps: true }))
33-
.pipe(concat(OUTPUT_FILE))
33+
// gulp-replace doesn't work with gulp-sourcemaps, so no change is made to the existing sourcemap.
34+
// Therefore the sourcemap become slightly inaccurate
35+
.pipe(replace('@firebase/app', FIREBASE_APP_URL))
3436
.pipe(sourcemaps.write('.'))
3537
.pipe(gulp.dest('.'));
3638
});
+3-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
{
22
"name": "firebase/messaging",
3-
"main": "dist/index.cjs",
3+
"main": "dist/index.cjs.js",
44
"browser": "dist/index.esm.js",
5-
"module": "dist/index.esm.js",
6-
"typings": "dist/messaging/index.d.ts",
7-
"type": "module"
5+
"module": "dist/index.mjs",
6+
"typings": "dist/messaging/index.d.ts"
87
}
+3-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
{
22
"name": "firebase/messaging/sw",
3-
"main": "dist/index.cjs",
3+
"main": "dist/index.cjs.js",
44
"browser": "dist/index.esm.js",
5-
"module": "dist/index.esm.js",
6-
"typings": "dist/messaging/sw/index.d.ts",
7-
"type": "module"
5+
"module": "dist/index.mjs",
6+
"typings": "dist/messaging/sw/index.d.ts"
87
}

0 commit comments

Comments
 (0)