Skip to content

Commit

Permalink
use esm2017 builds by default (#5539)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Feiyang1 committed Sep 24, 2021
1 parent dfe65ff commit a99943f
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 18 deletions.
7 changes: 7 additions & 0 deletions .changeset/heavy-books-mate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@firebase/logger": minor
"@firebase/util": minor
"@firebase/webchannel-wrapper": minor
---

Use esm2017 builds by default
5 changes: 5 additions & 0 deletions .changeset/wet-queens-tell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@firebase/firestore": patch
---

use `constructor.name` for Object type
2 changes: 1 addition & 1 deletion config/webpack.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ module.exports = {
options: {
compilerOptions: {
module: 'commonjs',
target: 'es5',
target: 'es2017',
downlevelIteration: true,
resolveJsonModule: true
}
Expand Down
8 changes: 2 additions & 6 deletions packages/firestore/src/util/input_validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions packages/logger/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"description": "A logger package for use in the Firebase JS SDK",
"author": "Firebase <firebase-support@google.com> (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'",
Expand Down
4 changes: 2 additions & 2 deletions packages/logger/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}/`))
Expand All @@ -62,7 +62,7 @@ const es2017Builds = [
{
input: 'index.ts',
output: {
file: pkg.esm2017,
file: pkg.module,
format: 'es',
sourcemap: true
},
Expand Down
6 changes: 3 additions & 3 deletions packages/util/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"description": "",
"author": "Firebase <firebase-support@google.com> (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"
],
Expand Down
4 changes: 2 additions & 2 deletions packages/util/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}/`))
},
Expand Down Expand Up @@ -72,7 +72,7 @@ const es2017Builds = [
{
input: 'index.ts',
output: {
file: pkg.esm2017,
file: pkg.module,
format: 'es',
sourcemap: true
},
Expand Down
4 changes: 2 additions & 2 deletions packages/webchannel-wrapper/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"description": "A wrapper of the webchannel packages from closure-library for use outside of a closure compiled application",
"author": "Firebase <firebase-support@google.com> (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"
],
Expand Down

0 comments on commit a99943f

Please sign in to comment.