From a5509e1e70d501aa31cc30fadccb810cbe6a57bd Mon Sep 17 00:00:00 2001 From: Feiyang1 Date: Thu, 23 Sep 2021 15:58:55 -0700 Subject: [PATCH 1/6] use esm2017 builds by default for util libs --- packages/logger/package.json | 4 ++-- packages/logger/rollup.config.js | 4 ++-- packages/util/package.json | 6 +++--- packages/util/rollup.config.js | 4 ++-- packages/webchannel-wrapper/package.json | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/logger/package.json b/packages/logger/package.json index 983fbdd862c..64b0a34a611 100644 --- a/packages/logger/package.json +++ b/packages/logger/package.json @@ -4,8 +4,8 @@ "description": "A logger package for use in the Firebase JS SDK", "author": "Firebase (https://firebase.google.com/)", "main": "dist/index.cjs.js", - "module": "dist/index.esm.js", - "esm2017": "dist/index.esm2017.js", + "module": "dist/index.esm2017.js", + "esm5": "dist/index.esm5.js", "files": ["dist"], "scripts": { "lint": "eslint -c .eslintrc.js '**/*.ts' --ignore-path '../../.gitignore'", diff --git a/packages/logger/rollup.config.js b/packages/logger/rollup.config.js index bfc324e9977..cdc6e860118 100644 --- a/packages/logger/rollup.config.js +++ b/packages/logger/rollup.config.js @@ -37,7 +37,7 @@ const es5Builds = [ input: 'index.ts', output: [ { file: pkg.main, format: 'cjs', sourcemap: true }, - { file: pkg.module, format: 'es', sourcemap: true } + { file: pkg.esm5, format: 'es', sourcemap: true } ], plugins: es5BuildPlugins, external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)) @@ -62,7 +62,7 @@ const es2017Builds = [ { input: 'index.ts', output: { - file: pkg.esm2017, + file: pkg.module, format: 'es', sourcemap: true }, diff --git a/packages/util/package.json b/packages/util/package.json index 4d6cf52107b..0ce4233196c 100644 --- a/packages/util/package.json +++ b/packages/util/package.json @@ -4,9 +4,9 @@ "description": "", "author": "Firebase (https://firebase.google.com/)", "main": "dist/index.node.cjs.js", - "browser": "dist/index.esm.js", - "module": "dist/index.esm.js", - "esm2017": "dist/index.esm2017.js", + "browser": "dist/index.esm2017.js", + "module": "dist/index.esm2017.js", + "esm5": "dist/index.esm5.js", "files": [ "dist" ], diff --git a/packages/util/rollup.config.js b/packages/util/rollup.config.js index 0ae738eebf1..f34ae0ee74a 100644 --- a/packages/util/rollup.config.js +++ b/packages/util/rollup.config.js @@ -39,7 +39,7 @@ const es5Builds = [ */ { input: 'index.ts', - output: [{ file: pkg.module, format: 'es', sourcemap: true }], + output: [{ file: pkg.esm5, format: 'es', sourcemap: true }], plugins: es5BuildPlugins, external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)) }, @@ -72,7 +72,7 @@ const es2017Builds = [ { input: 'index.ts', output: { - file: pkg.esm2017, + file: pkg.module, format: 'es', sourcemap: true }, diff --git a/packages/webchannel-wrapper/package.json b/packages/webchannel-wrapper/package.json index b2e8e8e7da4..b71886feb0a 100644 --- a/packages/webchannel-wrapper/package.json +++ b/packages/webchannel-wrapper/package.json @@ -4,8 +4,8 @@ "description": "A wrapper of the webchannel packages from closure-library for use outside of a closure compiled application", "author": "Firebase (https://firebase.google.com/)", "main": "dist/index.js", - "module": "dist/index.esm.js", - "esm2017": "dist/index.esm2017.js", + "module": "dist/index.esm2017.js", + "esm5": "dist/index.esm.js", "files": [ "dist" ], From d5954b52ef3f520fb51f18f96979f0f2c927d386 Mon Sep 17 00:00:00 2001 From: Feiyang Date: Thu, 23 Sep 2021 16:00:49 -0700 Subject: [PATCH 2/6] Create heavy-books-mate.md --- .changeset/heavy-books-mate.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .changeset/heavy-books-mate.md diff --git a/.changeset/heavy-books-mate.md b/.changeset/heavy-books-mate.md new file mode 100644 index 00000000000..be19948321f --- /dev/null +++ b/.changeset/heavy-books-mate.md @@ -0,0 +1,7 @@ +--- +"@firebase/logger": minor +"@firebase/util": minor +"@firebase/webchannel-wrapper": minor +--- + +Use esm2017 builds by default From 03d9d9ffadfa577c2d42cb42eb8178d222bacc1b Mon Sep 17 00:00:00 2001 From: Feiyang1 Date: Thu, 23 Sep 2021 22:55:39 -0700 Subject: [PATCH 3/6] fix tests --- config/webpack.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/webpack.test.js b/config/webpack.test.js index 3612cc3db21..dd1e5dbf188 100644 --- a/config/webpack.test.js +++ b/config/webpack.test.js @@ -38,7 +38,7 @@ module.exports = { options: { compilerOptions: { module: 'commonjs', - target: 'es5', + target: 'es2017', downlevelIteration: true, resolveJsonModule: true } From d6aea9ed7e5c51b2338daac57ea8222a3c68f573 Mon Sep 17 00:00:00 2001 From: Feiyang1 Date: Fri, 24 Sep 2021 11:16:36 -0700 Subject: [PATCH 4/6] get function name properly --- packages/firestore/src/util/input_validation.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/packages/firestore/src/util/input_validation.ts b/packages/firestore/src/util/input_validation.ts index 47289823f27..37e349ce910 100644 --- a/packages/firestore/src/util/input_validation.ts +++ b/packages/firestore/src/util/input_validation.ts @@ -132,14 +132,10 @@ export function valueDescription(input: unknown): string { } } -/** Hacky method to try to get the constructor name for an object. */ +/** try to get the constructor name for an object. */ export function tryGetCustomObjectType(input: object): string | null { if (input.constructor) { - const funcNameRegex = /function\s+([^\s(]+)\s*\(/; - const results = funcNameRegex.exec(input.constructor.toString()); - if (results && results.length > 1) { - return results[1]; - } + return input.constructor.name; } return null; } From df926e76e6e00b05c443d8d6a5e1faaf1155fe67 Mon Sep 17 00:00:00 2001 From: Feiyang Date: Fri, 24 Sep 2021 11:24:48 -0700 Subject: [PATCH 5/6] Create wet-queens-tell.md --- .changeset/wet-queens-tell.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/wet-queens-tell.md diff --git a/.changeset/wet-queens-tell.md b/.changeset/wet-queens-tell.md new file mode 100644 index 00000000000..694ec9f20fe --- /dev/null +++ b/.changeset/wet-queens-tell.md @@ -0,0 +1,5 @@ +--- +"@firebase/firestore": patch +--- + +use `constructor.name` for Object name From 4cd11cf67beccb7425dafa7403b3b34beeb96112 Mon Sep 17 00:00:00 2001 From: Feiyang1 Date: Fri, 24 Sep 2021 11:26:05 -0700 Subject: [PATCH 6/6] update --- .changeset/wet-queens-tell.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/wet-queens-tell.md b/.changeset/wet-queens-tell.md index 694ec9f20fe..1aad1815019 100644 --- a/.changeset/wet-queens-tell.md +++ b/.changeset/wet-queens-tell.md @@ -2,4 +2,4 @@ "@firebase/firestore": patch --- -use `constructor.name` for Object name +use `constructor.name` for Object type