Skip to content

Commit a99943f

Browse files
authored
use esm2017 builds by default (#5539)
* use esm2017 builds by default for util libs * Create heavy-books-mate.md * fix tests * get function name properly * Create wet-queens-tell.md * update
1 parent dfe65ff commit a99943f

File tree

9 files changed

+26
-18
lines changed

9 files changed

+26
-18
lines changed

.changeset/heavy-books-mate.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"@firebase/logger": minor
3+
"@firebase/util": minor
4+
"@firebase/webchannel-wrapper": minor
5+
---
6+
7+
Use esm2017 builds by default

.changeset/wet-queens-tell.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@firebase/firestore": patch
3+
---
4+
5+
use `constructor.name` for Object type

config/webpack.test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ module.exports = {
3838
options: {
3939
compilerOptions: {
4040
module: 'commonjs',
41-
target: 'es5',
41+
target: 'es2017',
4242
downlevelIteration: true,
4343
resolveJsonModule: true
4444
}

packages/firestore/src/util/input_validation.ts

+2-6
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,10 @@ export function valueDescription(input: unknown): string {
132132
}
133133
}
134134

135-
/** Hacky method to try to get the constructor name for an object. */
135+
/** try to get the constructor name for an object. */
136136
export function tryGetCustomObjectType(input: object): string | null {
137137
if (input.constructor) {
138-
const funcNameRegex = /function\s+([^\s(]+)\s*\(/;
139-
const results = funcNameRegex.exec(input.constructor.toString());
140-
if (results && results.length > 1) {
141-
return results[1];
142-
}
138+
return input.constructor.name;
143139
}
144140
return null;
145141
}

packages/logger/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
"description": "A logger package for use in the Firebase JS SDK",
55
"author": "Firebase <[email protected]> (https://firebase.google.com/)",
66
"main": "dist/index.cjs.js",
7-
"module": "dist/index.esm.js",
8-
"esm2017": "dist/index.esm2017.js",
7+
"module": "dist/index.esm2017.js",
8+
"esm5": "dist/index.esm5.js",
99
"files": ["dist"],
1010
"scripts": {
1111
"lint": "eslint -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'",

packages/logger/rollup.config.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const es5Builds = [
3737
input: 'index.ts',
3838
output: [
3939
{ file: pkg.main, format: 'cjs', sourcemap: true },
40-
{ file: pkg.module, format: 'es', sourcemap: true }
40+
{ file: pkg.esm5, format: 'es', sourcemap: true }
4141
],
4242
plugins: es5BuildPlugins,
4343
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`))
@@ -62,7 +62,7 @@ const es2017Builds = [
6262
{
6363
input: 'index.ts',
6464
output: {
65-
file: pkg.esm2017,
65+
file: pkg.module,
6666
format: 'es',
6767
sourcemap: true
6868
},

packages/util/package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
"description": "",
55
"author": "Firebase <[email protected]> (https://firebase.google.com/)",
66
"main": "dist/index.node.cjs.js",
7-
"browser": "dist/index.esm.js",
8-
"module": "dist/index.esm.js",
9-
"esm2017": "dist/index.esm2017.js",
7+
"browser": "dist/index.esm2017.js",
8+
"module": "dist/index.esm2017.js",
9+
"esm5": "dist/index.esm5.js",
1010
"files": [
1111
"dist"
1212
],

packages/util/rollup.config.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const es5Builds = [
3939
*/
4040
{
4141
input: 'index.ts',
42-
output: [{ file: pkg.module, format: 'es', sourcemap: true }],
42+
output: [{ file: pkg.esm5, format: 'es', sourcemap: true }],
4343
plugins: es5BuildPlugins,
4444
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`))
4545
},
@@ -72,7 +72,7 @@ const es2017Builds = [
7272
{
7373
input: 'index.ts',
7474
output: {
75-
file: pkg.esm2017,
75+
file: pkg.module,
7676
format: 'es',
7777
sourcemap: true
7878
},

packages/webchannel-wrapper/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
"description": "A wrapper of the webchannel packages from closure-library for use outside of a closure compiled application",
55
"author": "Firebase <[email protected]> (https://firebase.google.com/)",
66
"main": "dist/index.js",
7-
"module": "dist/index.esm.js",
8-
"esm2017": "dist/index.esm2017.js",
7+
"module": "dist/index.esm2017.js",
8+
"esm5": "dist/index.esm.js",
99
"files": [
1010
"dist"
1111
],

0 commit comments

Comments
 (0)