From 36cb0178cded40b80024d5bdad6432c7a30a6a89 Mon Sep 17 00:00:00 2001 From: Daniel La Rocque Date: Wed, 25 Sep 2024 10:55:29 -0400 Subject: [PATCH] Remove ES5 Support (#8509) --- .changeset/little-cows-tie.md | 36 +++++++ config/tsconfig.base.json | 14 +-- e2e/karma.conf.js | 2 +- integration/compat-interop/tsconfig.json | 2 +- integration/firebase/tsconfig.json | 2 +- packages/analytics-compat/package.json | 2 - packages/analytics-compat/rollup.config.js | 60 ++++-------- packages/analytics/package.json | 2 - packages/analytics/rollup.config.js | 36 ++----- packages/analytics/src/index.ts | 2 +- packages/app-check-compat/package.json | 2 - packages/app-check-compat/rollup.config.js | 30 ++---- packages/app-check/package.json | 2 - packages/app-check/rollup.config.js | 30 ++---- packages/app-compat/package.json | 4 - packages/app-compat/rollup.config.js | 47 ++------- packages/app/package.json | 2 - packages/app/rollup.config.js | 43 ++------- packages/app/src/registerCoreComponents.ts | 2 +- packages/auth-compat/package.json | 2 - packages/auth-compat/rollup.config.js | 49 +++------- packages/auth/api-extractor.json | 2 +- packages/auth/cordova/demo/rollup.config.js | 33 ++----- packages/auth/demo/rollup.config.js | 38 ++++---- packages/auth/demo/src/worker/tsconfig.json | 4 +- packages/auth/internal/package.json | 3 +- packages/auth/package.json | 7 +- packages/auth/rollup.config.js | 75 +++++---------- packages/auth/src/core/auth/register.ts | 2 +- packages/component/package.json | 2 - packages/component/rollup.config.js | 59 ++++-------- packages/database-compat/package.json | 2 - packages/database-compat/rollup.config.js | 41 ++------ packages/database/package.json | 2 - packages/database/rollup.config.js | 52 +++------- packages/database/src/register.ts | 2 +- packages/firebase/compat/rollup.config.js | 31 +----- packages/firestore-compat/package.json | 2 - packages/firestore-compat/rollup.config.js | 20 ---- packages/firestore/lite/package.json | 1 - packages/firestore/package.json | 3 - packages/firestore/rollup.config.js | 95 +++++++------------ packages/firestore/rollup.config.lite.js | 82 +++++----------- packages/firestore/rollup.shared.js | 71 +------------- packages/firestore/src/register.ts | 2 +- .../test/unit/specs/spec_rpc_error.ts | 3 +- packages/functions-compat/package.json | 2 - packages/functions-compat/rollup.config.js | 24 +---- packages/functions/package.json | 2 - packages/functions/rollup.config.js | 27 +----- packages/functions/src/config.ts | 2 +- packages/installations-compat/package.json | 2 - .../installations-compat/rollup.config.js | 56 +++++------ packages/installations/package.json | 2 - packages/installations/rollup.config.js | 75 ++++++--------- packages/installations/src/index.ts | 2 +- .../src/testing/compare-headers.ts | 1 + packages/logger/package.json | 2 - packages/logger/rollup.config.js | 63 ++++-------- packages/messaging-compat/package.json | 2 - packages/messaging-compat/rollup.config.js | 60 ++++-------- packages/messaging/package.json | 2 - packages/messaging/rollup.config.js | 49 ++++------ packages/messaging/src/helpers/register.ts | 2 +- .../messaging/src/testing/compare-headers.ts | 1 + packages/performance-compat/package.json | 2 - packages/performance-compat/rollup.config.js | 55 ++++------- packages/performance/package.json | 2 - packages/performance/rollup.config.js | 68 +++++-------- packages/performance/src/index.ts | 2 +- packages/remote-config-compat/package.json | 2 - .../remote-config-compat/rollup.config.js | 55 ++++------- packages/remote-config/package.json | 2 - packages/remote-config/rollup.config.js | 88 +++++++---------- packages/remote-config/src/register.ts | 2 +- packages/rules-unit-testing/rollup.config.js | 31 +++--- .../src/impl/test_environment.ts | 2 +- packages/storage-compat/package.json | 2 - packages/storage-compat/rollup.config.js | 65 ++++--------- packages/storage/package.json | 2 - packages/storage/rollup.config.js | 41 ++------ packages/storage/src/index.ts | 2 +- packages/template/package.json | 2 - packages/template/rollup.config.js | 45 +++------ packages/util/package.json | 2 - packages/util/rollup.config.js | 45 +++------ packages/util/src/crypt.ts | 1 + packages/util/src/errors.ts | 2 + packages/vertexai/rollup.config.js | 23 ++--- packages/vertexai/src/errors.ts | 2 + packages/vertexai/src/index.ts | 2 +- .../bloom-blob/package.json | 1 - packages/webchannel-wrapper/package.json | 2 - packages/webchannel-wrapper/rollup.config.js | 6 +- .../webchannel-blob/package.json | 1 - .../changelog-generator/tsconfig.json | 2 +- repo-scripts/size-analysis/rollup.config.js | 4 +- scripts/ci-test/check-paths.ts | 1 - scripts/docgen/docgen.ts | 10 +- scripts/size_report/report_binary_size.ts | 5 +- scripts/tsconfig.json | 2 +- 101 files changed, 609 insertions(+), 1353 deletions(-) create mode 100644 .changeset/little-cows-tie.md diff --git a/.changeset/little-cows-tie.md b/.changeset/little-cows-tie.md new file mode 100644 index 00000000000..988329e2f0e --- /dev/null +++ b/.changeset/little-cows-tie.md @@ -0,0 +1,36 @@ +--- +'@firebase/installations-compat': patch +'@firebase/remote-config-compat': patch +'@firebase/performance-compat': patch +'@firebase/rules-unit-testing': patch +'@firebase/webchannel-wrapper': patch +'@firebase/analytics-compat': patch +'@firebase/app-check-compat': patch +'@firebase/firestore-compat': patch +'@firebase/functions-compat': patch +'@firebase/messaging-compat': patch +'@firebase/database-compat': patch +'@firebase/storage-compat': patch +'@firebase/installations': patch +'@firebase/remote-config': patch +'@firebase/auth-compat': patch +'@firebase/performance': patch +'@firebase/app-compat': patch +'@firebase/analytics': patch +'@firebase/app-check': patch +'@firebase/component': patch +'@firebase/firestore': patch +'@firebase/functions': patch +'@firebase/messaging': patch +'@firebase/database': patch +'firebase': patch +'@firebase/template': patch +'@firebase/vertexai-preview': patch +'@firebase/storage': patch +'@firebase/logger': patch +'@firebase/auth': patch +'@firebase/util': patch +'@firebase/app': patch +--- + +Remove ES5 bundles. The minimum required ES version is now ES2017. diff --git a/config/tsconfig.base.json b/config/tsconfig.base.json index 0bfe24208a8..adbd2e44072 100644 --- a/config/tsconfig.base.json +++ b/config/tsconfig.base.json @@ -5,24 +5,16 @@ "importHelpers": true, "strict": true, "lib": [ - "es5", "dom", - "es2015.promise", - "es2015.symbol", - "es2015.iterable", - "es2015.collection", - "es2015.symbol.wellknown", - "es2015.core", - "es2017.object", - "es2017.string", - "ESNext.WeakRef", + "es2017", + "esnext.WeakRef", ], "module": "ES2015", "moduleResolution": "node", "resolveJsonModule": true, "esModuleInterop": true, "sourceMap": true, - "target": "es5", + "target": "es2017", "typeRoots": [ "../node_modules/@types" ], diff --git a/e2e/karma.conf.js b/e2e/karma.conf.js index 80824d6d548..fb2474f3beb 100644 --- a/e2e/karma.conf.js +++ b/e2e/karma.conf.js @@ -82,7 +82,7 @@ module.exports = function (config) { 'resolveJsonModule': true, 'esModuleInterop': true, 'sourceMap': true, - 'target': 'es5', + 'target': 'es2017', 'importHelpers': true, 'noEmitOnError': true } diff --git a/integration/compat-interop/tsconfig.json b/integration/compat-interop/tsconfig.json index 4da78214594..735f3df7fbd 100644 --- a/integration/compat-interop/tsconfig.json +++ b/integration/compat-interop/tsconfig.json @@ -8,7 +8,7 @@ "moduleResolution": "node", "noImplicitAny": true, "outDir": "dist", - "target": "ES5", + "target": "es2017", "sourceMap": true, "esModuleInterop": true }, diff --git a/integration/firebase/tsconfig.json b/integration/firebase/tsconfig.json index 4da78214594..735f3df7fbd 100644 --- a/integration/firebase/tsconfig.json +++ b/integration/firebase/tsconfig.json @@ -8,7 +8,7 @@ "moduleResolution": "node", "noImplicitAny": true, "outDir": "dist", - "target": "ES5", + "target": "es2017", "sourceMap": true, "esModuleInterop": true }, diff --git a/packages/analytics-compat/package.json b/packages/analytics-compat/package.json index 861e5baf519..62fa41c2029 100644 --- a/packages/analytics-compat/package.json +++ b/packages/analytics-compat/package.json @@ -6,12 +6,10 @@ "main": "dist/index.cjs.js", "browser": "dist/esm/index.esm2017.js", "module": "dist/esm/index.esm2017.js", - "esm5": "dist/esm/index.esm.js", "exports": { ".": { "types": "./dist/src/index.d.ts", "require": "./dist/index.cjs.js", - "esm5": "./dist/esm/index.esm.js", "default": "./dist/esm/index.esm2017.js" }, "./package.json": "./package.json" diff --git a/packages/analytics-compat/rollup.config.js b/packages/analytics-compat/rollup.config.js index 0fccfa7a26c..49b8ac0d21e 100644 --- a/packages/analytics-compat/rollup.config.js +++ b/packages/analytics-compat/rollup.config.js @@ -25,51 +25,33 @@ const deps = Object.keys( Object.assign({}, pkg.peerDependencies, pkg.dependencies) ); -const es5BuildPlugins = [ +const buildPlugins = [ typescriptPlugin({ typescript }), - json() -]; - -const es2017BuildPlugins = [ - typescriptPlugin({ - typescript, - tsconfigOverride: { - compilerOptions: { - target: 'es2017' - } - } - }), json({ preferConst: true }) ]; -const esmBuilds = [ - { - input: 'src/index.ts', - output: { - file: pkg.browser, - format: 'es', - sourcemap: true - }, - external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)), - plugins: [...es2017BuildPlugins, emitModulePackageFile()] +const esmBuild = { + input: 'src/index.ts', + output: { + file: pkg.browser, + format: 'es', + sourcemap: true }, - { - input: 'src/index.ts', - output: { file: pkg.esm5, format: 'es', sourcemap: true }, - external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)), - plugins: [...es5BuildPlugins, emitModulePackageFile()] - } -]; + external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)), + plugins: [...buildPlugins, emitModulePackageFile()] +}; -const cjsBuilds = [ - { - input: 'src/index.ts', - output: { file: pkg.main, format: 'cjs', sourcemap: true }, - external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)), - plugins: es5BuildPlugins - } -]; +const cjsBuild = { + input: 'src/index.ts', + output: { + file: pkg.main, + format: 'cjs', + sourcemap: true + }, + external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)), + plugins: buildPlugins +}; -export default [...esmBuilds, ...cjsBuilds]; +export default [esmBuild, cjsBuild]; diff --git a/packages/analytics/package.json b/packages/analytics/package.json index 590ba9c6640..57b08f0e84a 100644 --- a/packages/analytics/package.json +++ b/packages/analytics/package.json @@ -6,12 +6,10 @@ "main": "dist/index.cjs.js", "browser": "dist/esm/index.esm2017.js", "module": "dist/esm/index.esm2017.js", - "esm5": "dist/esm/index.esm.js", "exports": { ".": { "types": "./dist/analytics-public.d.ts", "require": "./dist/index.cjs.js", - "esm5": "./dist/esm/index.esm.js", "default": "./dist/esm/index.esm2017.js" }, "./package.json": "./package.json" diff --git a/packages/analytics/rollup.config.js b/packages/analytics/rollup.config.js index 509b9690c5e..6acafe03b5d 100644 --- a/packages/analytics/rollup.config.js +++ b/packages/analytics/rollup.config.js @@ -27,22 +27,10 @@ const deps = [ ...Object.keys(Object.assign({}, pkg.peerDependencies, pkg.dependencies)) ]; -const es5BuildPlugins = [ +const buildPlugins = [ typescriptPlugin({ typescript }), - json() -]; - -const es2017BuildPlugins = [ - typescriptPlugin({ - typescript, - tsconfigOverride: { - compilerOptions: { - target: 'es2017' - } - } - }), json({ preferConst: true }) ]; @@ -50,16 +38,6 @@ const es2017BuildPlugins = [ * ESM builds */ const esmBuilds = [ - { - input: 'src/index.ts', - output: [{ file: pkg.esm5, format: 'es', sourcemap: true }], - external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)), - plugins: [ - ...es5BuildPlugins, - replace(generateBuildTargetReplaceConfig('esm', 5)), - emitModulePackageFile() - ] - }, { input: 'src/index.ts', output: { @@ -69,7 +47,7 @@ const esmBuilds = [ }, external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)), plugins: [ - ...es2017BuildPlugins, + ...buildPlugins, replace(generateBuildTargetReplaceConfig('esm', 2017)), emitModulePackageFile() ] @@ -82,11 +60,15 @@ const esmBuilds = [ const cjsBuilds = [ { input: 'src/index.ts', - output: [{ file: pkg.main, format: 'cjs', sourcemap: true }], + output: { + file: pkg.main, + format: 'cjs', + sourcemap: true + }, external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)), plugins: [ - ...es5BuildPlugins, - replace(generateBuildTargetReplaceConfig('cjs', 5)) + ...buildPlugins, + replace(generateBuildTargetReplaceConfig('cjs', 2017)) ] } ]; diff --git a/packages/analytics/src/index.ts b/packages/analytics/src/index.ts index ed785fba94b..f79725db7bd 100644 --- a/packages/analytics/src/index.ts +++ b/packages/analytics/src/index.ts @@ -66,7 +66,7 @@ function registerAnalytics(): void { ); registerVersion(name, version); - // BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation + // BUILD_TARGET will be replaced by values like esm2017, cjs2017, etc during the compilation registerVersion(name, version, '__BUILD_TARGET__'); function internalFactory( diff --git a/packages/app-check-compat/package.json b/packages/app-check-compat/package.json index bbb8f2f9798..464f9e36c25 100644 --- a/packages/app-check-compat/package.json +++ b/packages/app-check-compat/package.json @@ -6,12 +6,10 @@ "main": "dist/index.cjs.js", "browser": "dist/esm/index.esm2017.js", "module": "dist/esm/index.esm2017.js", - "esm5": "dist/esm/index.esm.js", "exports": { ".": { "types": "./dist/src/index.d.ts", "require": "./dist/index.cjs.js", - "esm5": "./dist/esm/index.esm.js", "default": "./dist/esm/index.esm2017.js" }, "./package.json": "./package.json" diff --git a/packages/app-check-compat/rollup.config.js b/packages/app-check-compat/rollup.config.js index e3cc4ea55de..137f3a27fad 100644 --- a/packages/app-check-compat/rollup.config.js +++ b/packages/app-check-compat/rollup.config.js @@ -25,32 +25,14 @@ const deps = Object.keys( Object.assign({}, pkg.peerDependencies, pkg.dependencies) ); -const es5BuildPlugins = [ +const buildPlugins = [ typescriptPlugin({ typescript }), - json() -]; - -const es2017BuildPlugins = [ - typescriptPlugin({ - typescript, - tsconfigOverride: { - compilerOptions: { - target: 'es2017' - } - } - }), json({ preferConst: true }) ]; const esmBuilds = [ - { - input: 'src/index.ts', - output: { file: pkg.esm5, format: 'es', sourcemap: true }, - external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)), - plugins: [...es5BuildPlugins, emitModulePackageFile()] - }, { input: 'src/index.ts', output: { @@ -59,16 +41,20 @@ const esmBuilds = [ sourcemap: true }, external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)), - plugins: [...es2017BuildPlugins, emitModulePackageFile()] + plugins: [...buildPlugins, emitModulePackageFile()] } ]; const cjsBuilds = [ { input: 'src/index.ts', - output: { file: pkg.main, format: 'cjs', sourcemap: true }, + output: { + file: pkg.main, + format: 'cjs', + sourcemap: true + }, external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)), - plugins: es5BuildPlugins + plugins: buildPlugins } ]; diff --git a/packages/app-check/package.json b/packages/app-check/package.json index f107eb81df9..d74ec9843df 100644 --- a/packages/app-check/package.json +++ b/packages/app-check/package.json @@ -6,12 +6,10 @@ "main": "dist/index.cjs.js", "browser": "dist/esm/index.esm2017.js", "module": "dist/esm/index.esm2017.js", - "esm5": "dist/esm/index.esm.js", "exports": { ".": { "types": "./dist/app-check-public.d.ts", "require": "./dist/index.cjs.js", - "esm5": "./dist/esm/index.esm.js", "default": "./dist/esm/index.esm2017.js" }, "./package.json": "./package.json" diff --git a/packages/app-check/rollup.config.js b/packages/app-check/rollup.config.js index e3cc4ea55de..137f3a27fad 100644 --- a/packages/app-check/rollup.config.js +++ b/packages/app-check/rollup.config.js @@ -25,32 +25,14 @@ const deps = Object.keys( Object.assign({}, pkg.peerDependencies, pkg.dependencies) ); -const es5BuildPlugins = [ +const buildPlugins = [ typescriptPlugin({ typescript }), - json() -]; - -const es2017BuildPlugins = [ - typescriptPlugin({ - typescript, - tsconfigOverride: { - compilerOptions: { - target: 'es2017' - } - } - }), json({ preferConst: true }) ]; const esmBuilds = [ - { - input: 'src/index.ts', - output: { file: pkg.esm5, format: 'es', sourcemap: true }, - external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)), - plugins: [...es5BuildPlugins, emitModulePackageFile()] - }, { input: 'src/index.ts', output: { @@ -59,16 +41,20 @@ const esmBuilds = [ sourcemap: true }, external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)), - plugins: [...es2017BuildPlugins, emitModulePackageFile()] + plugins: [...buildPlugins, emitModulePackageFile()] } ]; const cjsBuilds = [ { input: 'src/index.ts', - output: { file: pkg.main, format: 'cjs', sourcemap: true }, + output: { + file: pkg.main, + format: 'cjs', + sourcemap: true + }, external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)), - plugins: es5BuildPlugins + plugins: buildPlugins } ]; diff --git a/packages/app-compat/package.json b/packages/app-compat/package.json index e7691b2e66e..8a8b39eca7a 100644 --- a/packages/app-compat/package.json +++ b/packages/app-compat/package.json @@ -6,16 +6,12 @@ "main": "dist/index.cjs.js", "browser": "dist/esm/index.esm2017.js", "module": "dist/esm/index.esm2017.js", - "esm5": "dist/esm/index.esm5.js", "lite": "dist/index.lite.js", - "liteesm5": "dist/index.lite.esm5.js", "exports": { ".": { "types": "./dist/app-compat-public.d.ts", "require": "./dist/index.cjs.js", - "esm5": "./dist/esm/index.esm5.js", "lite": "./dist/index.lite.js", - "liteesm5": "./dist/index.lite.esm5.js", "default": "./dist/esm/index.esm2017.js" }, "./package.json": "./package.json" diff --git a/packages/app-compat/rollup.config.js b/packages/app-compat/rollup.config.js index 055b75f3836..5bc1c799aa2 100644 --- a/packages/app-compat/rollup.config.js +++ b/packages/app-compat/rollup.config.js @@ -25,46 +25,15 @@ const deps = Object.keys( Object.assign({}, pkg.peerDependencies, pkg.dependencies) ); -const es5BuildPlugins = [ +const buildPlugins = [ typescriptPlugin({ typescript, abortOnError: false }), - json() -]; - -const es2017BuildPlugins = [ - typescriptPlugin({ - typescript, - abortOnError: false, - tsconfigOverride: { - compilerOptions: { - target: 'es2017' - } - } - }), - json({ - preferConst: true - }) + json({ preferConst: true }) ]; const esmBuilds = [ - { - input: 'src/index.ts', - output: { file: pkg.esm5, format: 'es', sourcemap: true }, - plugins: [...es5BuildPlugins, emitModulePackageFile()], - external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)) - }, - { - input: 'src/index.lite.ts', - output: { - file: pkg['liteesm5'], - format: 'es', - sourcemap: true - }, - plugins: es5BuildPlugins, - external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)) - }, { input: 'src/index.ts', output: { @@ -72,7 +41,7 @@ const esmBuilds = [ format: 'es', sourcemap: true }, - plugins: [...es2017BuildPlugins, emitModulePackageFile()], + plugins: [...buildPlugins, emitModulePackageFile()], external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)) }, { @@ -82,7 +51,7 @@ const esmBuilds = [ format: 'es', sourcemap: true }, - plugins: es2017BuildPlugins, + plugins: buildPlugins, external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)) } ]; @@ -90,8 +59,12 @@ const esmBuilds = [ const cjsBuilds = [ { input: 'src/index.ts', - output: { file: pkg.main, format: 'cjs', sourcemap: true }, - plugins: es5BuildPlugins, + output: { + file: pkg.main, + format: 'cjs', + sourcemap: true + }, + plugins: buildPlugins, external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)) } ]; diff --git a/packages/app/package.json b/packages/app/package.json index abb6fad7648..2cb10dbcbeb 100644 --- a/packages/app/package.json +++ b/packages/app/package.json @@ -6,12 +6,10 @@ "main": "dist/index.cjs.js", "browser": "dist/esm/index.esm2017.js", "module": "dist/esm/index.esm2017.js", - "esm5": "dist/esm/index.esm5.js", "exports": { ".": { "types": "./dist/app-public.d.ts", "require": "./dist/index.cjs.js", - "esm5": "./dist/esm/index.esm5.js", "default": "./dist/esm/index.esm2017.js" }, "./package.json": "./package.json" diff --git a/packages/app/rollup.config.js b/packages/app/rollup.config.js index 6900b5f0f4a..ec5a279a1c2 100644 --- a/packages/app/rollup.config.js +++ b/packages/app/rollup.config.js @@ -28,44 +28,17 @@ const deps = Object.keys( Object.assign({}, pkg.peerDependencies, pkg.dependencies) ); -const es5BuildPlugins = [ +const buildPlugins = [ typescriptPlugin({ typescript }), - json() -]; - -const es2017BuildPlugins = [ - typescriptPlugin({ - typescript, - tsconfigOverride: { - compilerOptions: { - target: 'es2017' - } - } - }), - json({ - preferConst: true - }) + json({ preferConst: true }) ]; const esmBuilds = [ /** * Browser Builds */ - { - input: 'src/index.ts', - output: [{ file: pkg.esm5, format: 'es', sourcemap: true }], - external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)), - plugins: [ - ...es5BuildPlugins, - replace({ - ...generateBuildTargetReplaceConfig('esm', 5), - '__RUNTIME_ENV__': '' - }), - emitModulePackageFile() - ] - }, { input: 'src/index.ts', output: { @@ -75,7 +48,7 @@ const esmBuilds = [ }, external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)), plugins: [ - ...es2017BuildPlugins, + ...buildPlugins, replace({ ...generateBuildTargetReplaceConfig('esm', 2017), '__RUNTIME_ENV__': '' @@ -88,12 +61,16 @@ const esmBuilds = [ const cjsBuilds = [ { input: 'src/index.ts', - output: [{ file: pkg.main, format: 'cjs', sourcemap: true }], + output: { + file: pkg.main, + format: 'cjs', + sourcemap: true + }, external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)), plugins: [ - ...es5BuildPlugins, + ...buildPlugins, replace({ - ...generateBuildTargetReplaceConfig('cjs', 5), + ...generateBuildTargetReplaceConfig('cjs', 2017), '__RUNTIME_ENV__': 'node' }) ] diff --git a/packages/app/src/registerCoreComponents.ts b/packages/app/src/registerCoreComponents.ts index 744b916e4c0..f0141dbf155 100644 --- a/packages/app/src/registerCoreComponents.ts +++ b/packages/app/src/registerCoreComponents.ts @@ -40,7 +40,7 @@ export function registerCoreComponents(variant?: string): void { // Register `app` package. registerVersion(name, version, variant); - // BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation + // BUILD_TARGET will be replaced by values like esm2017, cjs2017, etc during the compilation registerVersion(name, version, '__BUILD_TARGET__'); // Register platform SDK identifier (no version). registerVersion('fire-js', ''); diff --git a/packages/auth-compat/package.json b/packages/auth-compat/package.json index dbbaa86f0f1..b6366b2f725 100644 --- a/packages/auth-compat/package.json +++ b/packages/auth-compat/package.json @@ -6,7 +6,6 @@ "main": "dist/index.node.cjs.js", "browser": "dist/index.esm2017.js", "module": "dist/index.esm2017.js", - "esm5": "dist/index.esm.js", "exports": { ".": { "types": "./dist/auth-compat/index.d.ts", @@ -15,7 +14,6 @@ "import": "./dist/esm/index.node.esm.js", "require": "./dist/index.node.cjs.js" }, - "esm5": "./dist/index.esm.js", "browser": { "require": "./dist/index.cjs.js", "import": "./dist/index.esm2017.js" diff --git a/packages/auth-compat/rollup.config.js b/packages/auth-compat/rollup.config.js index cb3491541c4..b2872f977fd 100644 --- a/packages/auth-compat/rollup.config.js +++ b/packages/auth-compat/rollup.config.js @@ -27,40 +27,9 @@ const deps = Object.keys( Object.assign({}, pkg.peerDependencies, pkg.dependencies) ); -/** - * Common plugins for all builds - */ -const commonPlugins = [json(), resolve()]; - -const es5BuildPlugins = [ - ...commonPlugins, - typescriptPlugin({ - typescript - }) -]; - -const es2017BuildPlugins = [ - ...commonPlugins, - typescriptPlugin({ - typescript, - tsconfigOverride: { - compilerOptions: { - target: 'es2017' - } - } - }) -]; +const buildPlugins = [json(), resolve(), typescriptPlugin({ typescript })]; const browserBuilds = [ - { - input: 'index.ts', - output: [{ file: pkg.esm5, format: 'es', sourcemap: true }], - plugins: es5BuildPlugins, - external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)), - treeshake: { - moduleSideEffects: false - } - }, { input: 'index.ts', output: { @@ -68,7 +37,7 @@ const browserBuilds = [ format: 'es', sourcemap: true }, - plugins: es2017BuildPlugins, + plugins: buildPlugins, external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)), treeshake: { moduleSideEffects: false @@ -81,7 +50,7 @@ const browserBuilds = [ format: 'cjs', sourcemap: true }, - plugins: es2017BuildPlugins, + plugins: buildPlugins, external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)), treeshake: { moduleSideEffects: false @@ -92,8 +61,12 @@ const browserBuilds = [ const nodeBuilds = [ { input: 'index.node.ts', - output: [{ file: pkg.main, format: 'cjs', sourcemap: true }], - plugins: es5BuildPlugins, + output: { + file: pkg.main, + format: 'cjs', + sourcemap: true + }, + plugins: buildPlugins, external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)), treeshake: { moduleSideEffects: true @@ -104,7 +77,7 @@ const nodeBuilds = [ output: [ { file: pkg.exports['.'].node.import, format: 'es', sourcemap: true } ], - plugins: [...es2017BuildPlugins, emitModulePackageFile()], + plugins: [...buildPlugins, emitModulePackageFile()], external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)), treeshake: { moduleSideEffects: true @@ -144,7 +117,7 @@ const umdBuild = { ); }` }, - plugins: [...es5BuildPlugins, uglify()], + plugins: [...buildPlugins, uglify()], external: ['@firebase/app-compat', '@firebase/app'] }; diff --git a/packages/auth/api-extractor.json b/packages/auth/api-extractor.json index ca7e1ee6983..f7279fcac15 100644 --- a/packages/auth/api-extractor.json +++ b/packages/auth/api-extractor.json @@ -1,6 +1,6 @@ { "extends": "../../config/api-extractor.json", - "mainEntryPointFilePath": "/dist/esm5/index.d.ts", + "mainEntryPointFilePath": "/dist/esm2017/index.d.ts", "dtsRollup": { "enabled": true, "untrimmedFilePath": "/dist/.d.ts", diff --git a/packages/auth/cordova/demo/rollup.config.js b/packages/auth/cordova/demo/rollup.config.js index 252e2e6b622..21654b783d2 100644 --- a/packages/auth/cordova/demo/rollup.config.js +++ b/packages/auth/cordova/demo/rollup.config.js @@ -18,28 +18,15 @@ import resolve from '@rollup/plugin-node-resolve'; import strip from '@rollup/plugin-strip'; /** - * Common plugins for all builds + * Browser Build */ -const commonPlugins = [ - strip({ - functions: ['debugAssert.*'] - }) -]; +const esmBuild = { + input: 'src/index.js', + output: [{ file: 'www/dist/bundle.js', format: 'esm', sourcemap: true }], + plugins: [ + strip({ functions: ['debugAssert.*'] }), + resolve({ mainFields: ['module', 'main'] }) + ] +}; -const es5Builds = [ - /** - * Browser Builds - */ - { - input: 'src/index.js', - output: [{ file: 'www/dist/bundle.js', format: 'esm', sourcemap: true }], - plugins: [ - ...commonPlugins, - resolve({ - mainFields: ['module', 'main'] - }) - ] - } -]; - -export default [...es5Builds]; +export default esmBuild; diff --git a/packages/auth/demo/rollup.config.js b/packages/auth/demo/rollup.config.js index 49aff45b419..ce6a2893210 100644 --- a/packages/auth/demo/rollup.config.js +++ b/packages/auth/demo/rollup.config.js @@ -21,17 +21,8 @@ import typescript from 'typescript'; import pkg from './package.json'; -/** - * Common plugins for all builds - */ -const commonPlugins = [ - strip({ - functions: ['debugAssert.*'] - }) -]; - const workerPlugins = [ - ...commonPlugins, + strip({ functions: ['debugAssert.*'] }), resolve({ mainFields: ['webworker', 'module', 'main'] }), @@ -44,7 +35,7 @@ const workerPlugins = [ lib: [ // TODO: remove this 'dom', - 'es2015', + 'es2017', 'webworker' ] } @@ -52,30 +43,33 @@ const workerPlugins = [ }) ]; -const es5Builds = [ - /** - * Browser Builds - */ +const esmBuilds = [ { input: 'src/index.js', output: [{ file: pkg.browser, format: 'esm', sourcemap: true }], plugins: [ - ...commonPlugins, - resolve({ - mainFields: ['module', 'main'] - }) + strip({ functions: ['debugAssert.*'] }), + resolve({ mainFields: ['module', 'main'] }) ] }, { input: 'src/worker/web-worker.ts', - output: [{ file: pkg.webworker, format: 'esm', sourcemap: true }], + output: { + file: pkg.webworker, + format: 'esm', + sourcemap: true + }, plugins: workerPlugins }, { input: 'src/worker/service-worker.ts', - output: [{ file: pkg.serviceworker, format: 'esm', sourcemap: true }], + output: { + file: pkg.serviceworker, + format: 'esm', + sourcemap: true + }, plugins: workerPlugins } ]; -export default [...es5Builds]; +export default [...esmBuilds]; diff --git a/packages/auth/demo/src/worker/tsconfig.json b/packages/auth/demo/src/worker/tsconfig.json index e160c5c6b47..1081b12233f 100644 --- a/packages/auth/demo/src/worker/tsconfig.json +++ b/packages/auth/demo/src/worker/tsconfig.json @@ -2,9 +2,9 @@ "extends": "../../../config/tsconfig.base.json", "compilerOptions": { "outDir": "dist", - "target": "es2015", + "target": "es2017", "lib": [ - "es2015", + "es2017", "webworker" ] }, diff --git a/packages/auth/internal/package.json b/packages/auth/internal/package.json index 41b63d2c841..4ecfdccbd20 100644 --- a/packages/auth/internal/package.json +++ b/packages/auth/internal/package.json @@ -4,8 +4,7 @@ "main": "../dist/node/internal.js", "module": "../dist/esm2017/internal.js", "browser": "../dist/esm2017/internal.js", - "esm5": "../dist/esm5/internal.js", - "typings": "../dist/esm5/internal/index.d.ts", + "typings": "../dist/esm2017/internal/index.d.ts", "private": true, "engines": { "node": ">=18.0.0" diff --git a/packages/auth/package.json b/packages/auth/package.json index 42616cd4f0f..e30312d4b68 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -9,8 +9,7 @@ "module": "dist/esm2017/index.js", "cordova": "dist/cordova/index.js", "web-extension": "dist/web-extension-esm2017/index.js", - "webworker": "dist/index.webworker.esm5.js", - "esm5": "dist/esm5/index.js", + "webworker": "dist/index.webworker.js", "exports": { ".": { "types": "./dist/auth-public.d.ts", @@ -29,9 +28,8 @@ }, "webworker": { "types": "./dist/index.webworker.d.ts", - "default": "./dist/index.webworker.esm5.js" + "default": "./dist/index.webworker.js" }, - "esm5": "./dist/esm5/index.js", "browser": { "require": "./dist/browser-cjs/index.js", "import": "./dist/esm2017/index.js" @@ -63,7 +61,6 @@ "types": "./dist/cordova/internal/index.d.ts", "default": "./dist/cordova/internal.js" }, - "esm5": "./dist/esm5/internal.js", "browser": { "require": "./dist/browser-cjs/internal.js", "import": "./dist/esm2017/internal.js" diff --git a/packages/auth/rollup.config.js b/packages/auth/rollup.config.js index 46d3ee0380d..6af229962bd 100644 --- a/packages/auth/rollup.config.js +++ b/packages/auth/rollup.config.js @@ -44,44 +44,13 @@ const nodeAliasPlugin = alias({ ] }); -const es5BuildPlugins = [ +const buildPlugins = [ json(), - strip({ - functions: ['debugAssert.*'] - }), - typescriptPlugin({ - typescript - }) -]; - -const es2017BuildPlugins = [ - json(), - strip({ - functions: ['debugAssert.*'] - }), - typescriptPlugin({ - typescript, - tsconfigOverride: { - compilerOptions: { - target: 'es2017' - } - } - }) + strip({ functions: ['debugAssert.*'] }), + typescriptPlugin({ typescript }) ]; const browserBuilds = [ - { - input: { - index: 'index.ts', - internal: 'internal/index.ts' - }, - output: [{ dir: 'dist/esm5', format: 'es', sourcemap: true }], - plugins: [ - ...es5BuildPlugins, - replace(generateBuildTargetReplaceConfig('esm', 5)) - ], - external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)) - }, { input: { index: 'index.ts', @@ -93,7 +62,7 @@ const browserBuilds = [ sourcemap: true }, plugins: [ - ...es2017BuildPlugins, + ...buildPlugins, replace(generateBuildTargetReplaceConfig('esm', 2017)) ], external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)) @@ -105,7 +74,7 @@ const browserBuilds = [ }, output: [{ dir: 'dist/browser-cjs', format: 'cjs', sourcemap: true }], plugins: [ - ...es2017BuildPlugins, + ...buildPlugins, replace(generateBuildTargetReplaceConfig('cjs', 2017)) ], external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)) @@ -124,7 +93,7 @@ const browserWebExtensionBuilds = [ sourcemap: true }, plugins: [ - ...es2017BuildPlugins, + ...buildPlugins, replace(generateBuildTargetReplaceConfig('esm', 2017)), emitModulePackageFile() ], @@ -137,7 +106,7 @@ const browserWebExtensionBuilds = [ }, output: [{ dir: 'dist/web-extension-cjs', format: 'cjs', sourcemap: true }], plugins: [ - ...es2017BuildPlugins, + ...buildPlugins, replace(generateBuildTargetReplaceConfig('cjs', 2017)) ], external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)) @@ -153,8 +122,8 @@ const nodeBuilds = [ output: [{ dir: 'dist/node', format: 'cjs', sourcemap: true }], plugins: [ nodeAliasPlugin, - ...es5BuildPlugins, - replace(generateBuildTargetReplaceConfig('cjs', 5)) + ...buildPlugins, + replace(generateBuildTargetReplaceConfig('cjs', 2017)) ], external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)) }, @@ -166,7 +135,7 @@ const nodeBuilds = [ output: [{ dir: 'dist/node-esm', format: 'es', sourcemap: true }], plugins: [ nodeAliasPlugin, - ...es2017BuildPlugins, + ...buildPlugins, replace(generateBuildTargetReplaceConfig('esm', 2017)), emitModulePackageFile() ], @@ -179,10 +148,14 @@ const cordovaBuild = { index: 'index.cordova.ts', internal: 'internal/index.ts' }, - output: [{ dir: 'dist/cordova', format: 'es', sourcemap: true }], + output: { + dir: 'dist/cordova', + format: 'es', + sourcemap: true + }, plugins: [ - ...es5BuildPlugins, - replace(generateBuildTargetReplaceConfig('esm', 5)) + ...buildPlugins, + replace(generateBuildTargetReplaceConfig('esm', 2017)) ], external: id => [...deps, 'cordova'].some(dep => id === dep || id.startsWith(`${dep}/`)) @@ -195,8 +168,8 @@ const rnBuild = { }, output: [{ dir: 'dist/rn', format: 'cjs', sourcemap: true }], plugins: [ - ...es5BuildPlugins, - replace(generateBuildTargetReplaceConfig('cjs', 5)) + ...buildPlugins, + replace(generateBuildTargetReplaceConfig('cjs', 2017)) ], external: id => [...deps, 'react-native'].some( @@ -206,7 +179,11 @@ const rnBuild = { const webWorkerBuild = { input: 'index.webworker.ts', - output: [{ file: pkg.webworker, format: 'es', sourcemap: true }], + output: { + file: pkg.webworker, + format: 'es', + sourcemap: true + }, plugins: [ json(), strip({ @@ -218,12 +195,12 @@ const webWorkerBuild = { lib: [ // Remove dom after we figure out why navigator stuff doesn't exist 'dom', - 'es2015', + 'es2017', 'webworker' ] } }), - replace(generateBuildTargetReplaceConfig('esm', 5)) + replace(generateBuildTargetReplaceConfig('esm', 2017)) ], external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)) }; diff --git a/packages/auth/src/core/auth/register.ts b/packages/auth/src/core/auth/register.ts index 4b891618d3a..9d0d6b4559d 100644 --- a/packages/auth/src/core/auth/register.ts +++ b/packages/auth/src/core/auth/register.ts @@ -130,6 +130,6 @@ export function registerAuth(clientPlatform: ClientPlatform): void { ); registerVersion(name, version, getVersionForPlatform(clientPlatform)); - // BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation + // BUILD_TARGET will be replaced by values like esm2017, cjs2017, etc during the compilation registerVersion(name, version, '__BUILD_TARGET__'); } diff --git a/packages/component/package.json b/packages/component/package.json index 46f7a83720d..1f3b8ad51a8 100644 --- a/packages/component/package.json +++ b/packages/component/package.json @@ -6,12 +6,10 @@ "main": "dist/index.cjs.js", "browser": "dist/esm/index.esm2017.js", "module": "dist/esm/index.esm2017.js", - "esm5": "dist/esm/index.esm5.js", "exports": { ".": { "types": "./dist/index.d.ts", "require": "./dist/index.cjs.js", - "esm5": "./dist/esm/index.esm5.js", "default": "./dist/esm/index.esm2017.js" }, "./package.json": "./package.json" diff --git a/packages/component/rollup.config.js b/packages/component/rollup.config.js index f0cc1a84e98..11d18692c8c 100644 --- a/packages/component/rollup.config.js +++ b/packages/component/rollup.config.js @@ -24,49 +24,24 @@ const deps = Object.keys( Object.assign({}, pkg.peerDependencies, pkg.dependencies) ); -const es5BuildPlugins = [ - typescriptPlugin({ - typescript - }) -]; +const buildPlugins = [typescriptPlugin({ typescript })]; -const es2017BuildPlugins = [ - typescriptPlugin({ - typescript, - tsconfigOverride: { - compilerOptions: { - target: 'es2017' - } - } - }) -]; +const esmBuild = { + input: 'index.ts', + output: { file: pkg.module, format: 'es', sourcemap: true }, + plugins: [...buildPlugins, emitModulePackageFile()], + external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)) +}; -const esmBuilds = [ - { - input: 'index.ts', - output: { file: pkg.module, format: 'es', sourcemap: true }, - plugins: [...es2017BuildPlugins, emitModulePackageFile()], - external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)) +const cjsBuild = { + input: 'index.ts', + output: { + file: pkg.main, + format: 'cjs', + sourcemap: true }, - { - input: 'index.ts', - output: { - file: pkg.esm5, - format: 'es', - sourcemap: true - }, - plugins: [...es5BuildPlugins, emitModulePackageFile()], - external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)) - } -]; + plugins: buildPlugins, + external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)) +}; -const cjsBuilds = [ - { - input: 'index.ts', - output: { file: pkg.main, format: 'cjs', sourcemap: true }, - plugins: es5BuildPlugins, - external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)) - } -]; - -export default [...esmBuilds, ...cjsBuilds]; +export default [esmBuild, cjsBuild]; diff --git a/packages/database-compat/package.json b/packages/database-compat/package.json index 36769537e9c..be50b28f6fa 100644 --- a/packages/database-compat/package.json +++ b/packages/database-compat/package.json @@ -6,7 +6,6 @@ "main": "dist/index.js", "browser": "dist/index.esm2017.js", "module": "dist/index.esm2017.js", - "esm5": "dist/index.esm5.js", "license": "Apache-2.0", "typings": "dist/database-compat/src/index.d.ts", "files": [ @@ -21,7 +20,6 @@ "import": "./dist/node-esm/index.js", "require": "./dist/index.js" }, - "esm5": "./dist/index.esm5.js", "browser": { "require": "./dist/index.js", "import": "./dist/index.esm2017.js" diff --git a/packages/database-compat/rollup.config.js b/packages/database-compat/rollup.config.js index bba2fba3c44..57ec9aee2ba 100644 --- a/packages/database-compat/rollup.config.js +++ b/packages/database-compat/rollup.config.js @@ -34,24 +34,11 @@ function onWarn(warning, defaultWarn) { defaultWarn(warning); } -const es5BuildPlugins = [ +const buildPlugins = [ typescriptPlugin({ typescript, abortOnError: false }), - json() -]; - -const es2017BuildPlugins = [ - typescriptPlugin({ - typescript, - tsconfigOverride: { - compilerOptions: { - target: 'es2017' - } - }, - abortOnError: false - }), json({ preferConst: true }) ]; @@ -68,7 +55,7 @@ const esmBuilds = [ sourcemap: true } ], - plugins: [...es2017BuildPlugins, emitModulePackageFile()], + plugins: [...buildPlugins, emitModulePackageFile()], treeshake: { moduleSideEffects: false }, @@ -76,24 +63,8 @@ const esmBuilds = [ onwarn: onWarn }, /** - * Browser Builds + * Browser Build */ - { - input: 'src/index.ts', - output: [ - { - file: pkg.esm5, - format: 'es', - sourcemap: true - } - ], - plugins: es5BuildPlugins, - treeshake: { - moduleSideEffects: false - }, - external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)), - onwarn: onWarn - }, { input: 'src/index.ts', output: [ @@ -103,7 +74,7 @@ const esmBuilds = [ sourcemap: true } ], - plugins: es2017BuildPlugins, + plugins: buildPlugins, treeshake: { moduleSideEffects: false }, @@ -125,7 +96,7 @@ const cjsBuilds = [ sourcemap: true } ], - plugins: es5BuildPlugins, + plugins: buildPlugins, treeshake: { moduleSideEffects: false }, @@ -146,7 +117,7 @@ const cjsBuilds = [ } ], plugins: [ - ...es5BuildPlugins, + ...buildPlugins, resolveModule({ exportConditions: ['standalone'], preferBuiltins: true diff --git a/packages/database/package.json b/packages/database/package.json index 05ff943e675..14f30231f17 100644 --- a/packages/database/package.json +++ b/packages/database/package.json @@ -6,7 +6,6 @@ "main": "dist/index.node.cjs.js", "browser": "dist/index.esm2017.js", "module": "dist/index.esm2017.js", - "esm5": "dist/index.esm5.js", "standalone": "dist/index.standalone.js", "exports": { ".": { @@ -15,7 +14,6 @@ "import": "./dist/node-esm/index.node.esm.js", "require": "./dist/index.node.cjs.js" }, - "esm5": "./dist/index.esm5.js", "standalone": "./dist/index.standalone.js", "browser": { "require": "./dist/index.cjs.js", diff --git a/packages/database/rollup.config.js b/packages/database/rollup.config.js index 886a177e4d9..293eaf06811 100644 --- a/packages/database/rollup.config.js +++ b/packages/database/rollup.config.js @@ -35,47 +35,15 @@ function onWarn(warning, defaultWarn) { defaultWarn(warning); } -const es5BuildPlugins = [ +const buildPlugins = [ typescriptPlugin({ typescript, abortOnError: false }), - json() -]; - -const es2017BuildPlugins = [ - typescriptPlugin({ - typescript, - tsconfigOverride: { - compilerOptions: { - target: 'es2017' - } - }, - abortOnError: false - }), json({ preferConst: true }) ]; const browserBuilds = [ - { - input: 'src/index.ts', - output: [ - { - file: pkg.esm5, - format: 'es', - sourcemap: true - } - ], - plugins: [ - ...es5BuildPlugins, - replace(generateBuildTargetReplaceConfig('esm', 5)) - ], - treeshake: { - moduleSideEffects: false - }, - external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)), - onwarn: onWarn - }, { input: 'src/index.ts', output: [ @@ -86,7 +54,7 @@ const browserBuilds = [ } ], plugins: [ - ...es2017BuildPlugins, + ...buildPlugins, replace(generateBuildTargetReplaceConfig('esm', 2017)) ], treeshake: { @@ -105,7 +73,7 @@ const browserBuilds = [ } ], plugins: [ - ...es2017BuildPlugins, + ...buildPlugins, replace(generateBuildTargetReplaceConfig('cjs', 2017)) ], treeshake: { @@ -119,10 +87,14 @@ const browserBuilds = [ const nodeBuilds = [ { input: 'src/index.node.ts', - output: { file: pkg.main, format: 'cjs', sourcemap: true }, + output: { + file: pkg.main, + format: 'cjs', + sourcemap: true + }, plugins: [ - ...es5BuildPlugins, - replace(generateBuildTargetReplaceConfig('cjs', 5)) + ...buildPlugins, + replace(generateBuildTargetReplaceConfig('cjs', 2017)) ], treeshake: { moduleSideEffects: false @@ -138,7 +110,7 @@ const nodeBuilds = [ sourcemap: true }, plugins: [ - ...es2017BuildPlugins, + ...buildPlugins, replace(generateBuildTargetReplaceConfig('esm', 2017)), emitModulePackageFile() ], @@ -154,7 +126,7 @@ const nodeBuilds = [ { input: 'src/index.standalone.ts', output: [{ file: pkg.standalone, format: 'cjs', sourcemap: true }], - plugins: es5BuildPlugins, + plugins: buildPlugins, treeshake: { moduleSideEffects: false }, diff --git a/packages/database/src/register.ts b/packages/database/src/register.ts index cd2be0aaa7e..9322368526b 100644 --- a/packages/database/src/register.ts +++ b/packages/database/src/register.ts @@ -47,6 +47,6 @@ export function registerDatabase(variant?: string): void { ).setMultipleInstances(true) ); registerVersion(name, version, variant); - // BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation + // BUILD_TARGET will be replaced by values like esm2017, cjs2017, etc during the compilation registerVersion(name, version, '__BUILD_TARGET__'); } diff --git a/packages/firebase/compat/rollup.config.js b/packages/firebase/compat/rollup.config.js index 4b481b93b1f..1f850011b13 100644 --- a/packages/firebase/compat/rollup.config.js +++ b/packages/firebase/compat/rollup.config.js @@ -284,43 +284,16 @@ const completeBuilds = [ }, plugins: [ sourcemaps(), - resolveModule({ - exportConditions: ['liteesm5', 'esm5'] - }), - typescriptPluginCDN, - json(), - commonjs(), - uglify(uglifyOptions) - ] - }, - /** - * Performance script Build in ES2017 - */ - { - input: `${__dirname}/index.perf.ts`, - output: { - file: 'firebase-performance-standalone-compat.es2017.js', - format: 'umd', - sourcemap: true, - name: GLOBAL_NAME - }, - plugins: [ - sourcemaps(), - resolveModule({ - exportConditions: ['lite'] - }), + resolveModule({ exportConditions: ['lite'] }), rollupTypescriptPlugin({ typescript, tsconfigOverride: { compilerOptions: { - target: 'es2017', declaration: false } } }), - json({ - preferConst: true - }), + json({ preferConst: true }), commonjs(), terser() ] diff --git a/packages/firestore-compat/package.json b/packages/firestore-compat/package.json index cef35d62ce4..2994067a633 100644 --- a/packages/firestore-compat/package.json +++ b/packages/firestore-compat/package.json @@ -7,7 +7,6 @@ "react-native": "dist/index.rn.js", "browser": "dist/index.esm2017.js", "module": "dist/index.esm2017.js", - "esm5": "dist/index.esm5.js", "exports": { ".": { "types": "./dist/src/index.d.ts", @@ -16,7 +15,6 @@ "require": "./dist/index.node.cjs.js" }, "react-native": "./dist/index.rn.js", - "esm5": "./dist/index.esm5.js", "browser": { "require": "./dist/index.cjs.js", "import": "./dist/index.esm2017.js" diff --git a/packages/firestore-compat/rollup.config.js b/packages/firestore-compat/rollup.config.js index ecf6d42ca91..c85af11225f 100644 --- a/packages/firestore-compat/rollup.config.js +++ b/packages/firestore-compat/rollup.config.js @@ -38,14 +38,6 @@ const es2017Plugins = [ json({ preferConst: true }) ]; -const es5Plugins = [ - typescriptPlugin({ - typescript, - transformers: [util.removeAssertTransformer] - }), - json({ preferConst: true }) -]; - const browserBuilds = [ { input: './src/index.ts', @@ -57,18 +49,6 @@ const browserBuilds = [ plugins: es2017Plugins, external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)) }, - { - input: './src/index.ts', - output: [ - { - file: pkg.esm5, - format: 'es', - sourcemap: true - } - ], - plugins: es5Plugins, - external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)) - }, { input: './src/index.ts', output: [ diff --git a/packages/firestore/lite/package.json b/packages/firestore/lite/package.json index b36ddf80218..ef362535fdb 100644 --- a/packages/firestore/lite/package.json +++ b/packages/firestore/lite/package.json @@ -6,7 +6,6 @@ "module": "../dist/lite/index.browser.esm2017.js", "browser": "../dist/lite/index.browser.esm2017.js", "react-native": "../dist/lite/index.rn.esm2017.js", - "esm5": "../dist/lite/index.browser.esm5.js", "typings": "../dist/lite/index.d.ts", "private": true, "engines": { diff --git a/packages/firestore/package.json b/packages/firestore/package.json index f15127ae499..5268cad97cb 100644 --- a/packages/firestore/package.json +++ b/packages/firestore/package.json @@ -62,7 +62,6 @@ "import": "./dist/index.node.mjs" }, "react-native": "./dist/index.rn.js", - "esm5": "./dist/index.esm5.js", "browser": { "require": "./dist/index.cjs.js", "import": "./dist/index.esm2017.js" @@ -76,7 +75,6 @@ "import": "./dist/lite/index.node.mjs" }, "react-native": "./dist/lite/index.rn.esm2017.js", - "esm5": "./dist/lite/index.browser.esm5.js", "browser": { "require": "./dist/lite/index.cjs.js", "import": "./dist/lite/index.browser.esm2017.js" @@ -90,7 +88,6 @@ "react-native": "dist/index.rn.js", "browser": "dist/index.esm2017.js", "module": "dist/index.esm2017.js", - "esm5": "dist/index.esm5.js", "license": "Apache-2.0", "files": [ "dist", diff --git a/packages/firestore/rollup.config.js b/packages/firestore/rollup.config.js index 0f6a42205fd..c9604fee55d 100644 --- a/packages/firestore/rollup.config.js +++ b/packages/firestore/rollup.config.js @@ -32,43 +32,29 @@ import pkg from './package.json'; const sourcemaps = require('rollup-plugin-sourcemaps'); const util = require('./rollup.shared'); -const nodePlugins = function () { - return [ - typescriptPlugin({ - typescript, - tsconfigOverride: { - compilerOptions: { - target: 'es2017' - } - }, - cacheDir: tmp.dirSync(), - abortOnError: true, - transformers: [util.removeAssertTransformer] - }), - json({ preferConst: true }), - replace({ - '__GRPC_VERSION__': grpcVersion - }) - ]; -}; +const nodePlugins = [ + typescriptPlugin({ + typescript, + cacheDir: tmp.dirSync(), + abortOnError: true, + transformers: [util.removeAssertTransformer] + }), + json({ preferConst: true }), + replace({ + '__GRPC_VERSION__': grpcVersion + }) +]; -const browserPlugins = function () { - return [ - typescriptPlugin({ - typescript, - tsconfigOverride: { - compilerOptions: { - target: 'es2017' - } - }, - cacheDir: tmp.dirSync(), - abortOnError: true, - transformers: [util.removeAssertAndPrefixInternalTransformer] - }), - json({ preferConst: true }), - terser(util.manglePrivatePropertiesOptions) - ]; -}; +const browserPlugins = [ + typescriptPlugin({ + typescript, + cacheDir: tmp.dirSync(), + abortOnError: true, + transformers: [util.removeAssertAndPrefixInternalTransformer] + }), + json({ preferConst: true }), + terser(util.manglePrivatePropertiesOptions) +]; const allBuilds = [ // Intermediate Node ESM build without build target reporting @@ -81,7 +67,7 @@ const allBuilds = [ format: 'es', sourcemap: true }, - plugins: [alias(util.generateAliasConfig('node')), ...nodePlugins()], + plugins: [alias(util.generateAliasConfig('node')), ...nodePlugins], external: util.resolveNodeExterns, treeshake: { moduleSideEffects: false @@ -97,7 +83,17 @@ const allBuilds = [ sourcemap: true }, plugins: [ - ...util.es2017ToEs5Plugins(/* mangled= */ false), + typescriptPlugin({ + typescript, + tsconfigOverride: { + compilerOptions: { + allowJs: true + } + }, + include: ['dist/**/*.js'], + cacheDir: tmp.dirSync() + }), + sourcemaps(), replace(generateBuildTargetReplaceConfig('cjs', 2017)) ], external: util.resolveNodeExterns, @@ -132,26 +128,7 @@ const allBuilds = [ format: 'es', sourcemap: true }, - plugins: [alias(util.generateAliasConfig('browser')), ...browserPlugins()], - external: util.resolveBrowserExterns, - treeshake: { - moduleSideEffects: false - } - }, - // Convert es2017 build to ES5 - { - input: pkg['browser'], - output: [ - { - file: pkg['esm5'], - format: 'es', - sourcemap: true - } - ], - plugins: [ - ...util.es2017ToEs5Plugins(/* mangled= */ true), - replace(generateBuildTargetReplaceConfig('esm', 5)) - ], + plugins: [alias(util.generateAliasConfig('browser')), ...browserPlugins], external: util.resolveBrowserExterns, treeshake: { moduleSideEffects: false @@ -205,7 +182,7 @@ const allBuilds = [ }, plugins: [ alias(util.generateAliasConfig('rn')), - ...browserPlugins(), + ...browserPlugins, replace(generateBuildTargetReplaceConfig('esm', 2017)) ], external: util.resolveBrowserExterns, diff --git a/packages/firestore/rollup.config.lite.js b/packages/firestore/rollup.config.lite.js index 369a9210262..25209966fe8 100644 --- a/packages/firestore/rollup.config.lite.js +++ b/packages/firestore/rollup.config.lite.js @@ -30,40 +30,26 @@ import { generateBuildTargetReplaceConfig } from '../../scripts/build/rollup_rep const util = require('./rollup.shared'); -const nodePlugins = function () { - return [ - typescriptPlugin({ - typescript, - tsconfigOverride: { - compilerOptions: { - target: 'es2017' - } - }, - cacheDir: tmp.dirSync(), - abortOnError: true, - transformers: [util.removeAssertTransformer] - }), - json({ preferConst: true }) - ]; -}; +const nodePlugins = [ + typescriptPlugin({ + typescript, + cacheDir: tmp.dirSync(), + abortOnError: true, + transformers: [util.removeAssertTransformer] + }), + json({ preferConst: true }) +]; -const browserPlugins = function () { - return [ - typescriptPlugin({ - typescript, - tsconfigOverride: { - compilerOptions: { - target: 'es2017' - } - }, - cacheDir: tmp.dirSync(), - abortOnError: true, - transformers: [util.removeAssertAndPrefixInternalTransformer] - }), - json({ preferConst: true }), - terser(util.manglePrivatePropertiesOptions) - ]; -}; +const browserPlugins = [ + typescriptPlugin({ + typescript, + cacheDir: tmp.dirSync(), + abortOnError: true, + transformers: [util.removeAssertAndPrefixInternalTransformer] + }), + json({ preferConst: true }), + terser(util.manglePrivatePropertiesOptions) +]; const allBuilds = [ // Intermediate Node ESM build without build target reporting @@ -78,7 +64,7 @@ const allBuilds = [ }, plugins: [ alias(util.generateAliasConfig('node_lite')), - ...nodePlugins(), + ...nodePlugins, replace({ '__RUNTIME_ENV__': 'node' }) @@ -101,14 +87,13 @@ const allBuilds = [ typescriptPlugin({ typescript, compilerOptions: { - allowJs: true, - target: 'es5' + allowJs: true }, include: ['dist/lite/*.js'] }), json(), sourcemaps(), - replace(generateBuildTargetReplaceConfig('cjs', 5)) + replace(generateBuildTargetReplaceConfig('cjs', 2017)) ], external: util.resolveNodeExterns, treeshake: { @@ -144,7 +129,7 @@ const allBuilds = [ }, plugins: [ alias(util.generateAliasConfig('browser_lite')), - ...browserPlugins(), + ...browserPlugins, // setting it to empty string because browser is the default env replace({ '__RUNTIME_ENV__': '' @@ -155,25 +140,6 @@ const allBuilds = [ moduleSideEffects: false } }, - // Convert es2017 build to ES5 - { - input: path.resolve('./lite', pkg.browser), - output: [ - { - file: path.resolve('./lite', pkg.esm5), - format: 'es', - sourcemap: true - } - ], - plugins: [ - ...util.es2017ToEs5Plugins(/* mangled= */ true), - replace(generateBuildTargetReplaceConfig('esm', 5)) - ], - external: util.resolveBrowserExterns, - treeshake: { - moduleSideEffects: false - } - }, // Convert es2017 build to CJS { input: path.resolve('./lite', pkg.browser), @@ -222,7 +188,7 @@ const allBuilds = [ }, plugins: [ alias(util.generateAliasConfig('rn_lite')), - ...browserPlugins(), + ...browserPlugins, replace({ ...generateBuildTargetReplaceConfig('esm', 2017), '__RUNTIME_ENV__': 'rn' diff --git a/packages/firestore/rollup.shared.js b/packages/firestore/rollup.shared.js index 44253d24d38..1b33ddf0b1b 100644 --- a/packages/firestore/rollup.shared.js +++ b/packages/firestore/rollup.shared.js @@ -34,10 +34,9 @@ const pkg = require('./package.json'); // This file contains shared utilities for Firestore's rollup builds. // Firestore is released in a number of different build configurations: -// - Browser builds that support persistence in ES5 CJS and ES5 ESM formats and -// ES2017 in ESM format. -// - In-memory Browser builds that support persistence in ES5 CJS and ES5 ESM -// formats and ES2017 in ESM format. +// - Browser builds that support persistence in ES2017 CJS and ESM formats. +// - In-memory Browser builds that support persistence in ES2017 CJS and ESM +// formats. // - A NodeJS build that supports persistence (to be used with an IndexedDb // shim) // - A in-memory only NodeJS build @@ -248,11 +247,6 @@ exports.es2017Plugins = function (platform, mangled = false) { alias(generateAliasConfig(platform)), typescriptPlugin({ typescript, - tsconfigOverride: { - compilerOptions: { - target: 'es2017' - } - }, cacheDir: tmp.dirSync(), transformers: [removeAssertAndPrefixInternalTransformer] }), @@ -264,11 +258,6 @@ exports.es2017Plugins = function (platform, mangled = false) { alias(generateAliasConfig(platform)), typescriptPlugin({ typescript, - tsconfigOverride: { - compilerOptions: { - target: 'es2017' - } - }, cacheDir: tmp.dirSync(), transformers: [removeAssertTransformer] }), @@ -277,50 +266,6 @@ exports.es2017Plugins = function (platform, mangled = false) { } }; -exports.es2017ToEs5Plugins = function (mangled = false) { - if (mangled) { - return [ - typescriptPlugin({ - typescript, - tsconfigOverride: { - compilerOptions: { - allowJs: true - } - }, - include: ['dist/**/*.js'], - cacheDir: tmp.dirSync() - }), - terser({ - output: { - comments: 'all', - beautify: true - }, - // See comment above `manglePrivatePropertiesOptions`. This build did - // not have the identical variable name issue but we should be - // consistent. - mangle: { - reserved: ['_getProvider'] - } - }), - sourcemaps() - ]; - } else { - return [ - typescriptPlugin({ - typescript, - tsconfigOverride: { - compilerOptions: { - allowJs: true - } - }, - include: ['dist/**/*.js'], - cacheDir: tmp.dirSync() - }), - sourcemaps() - ]; - } -}; - exports.es2017PluginsCompat = function ( platform, pathTransformer, @@ -331,11 +276,6 @@ exports.es2017PluginsCompat = function ( alias(generateAliasConfig(platform)), typescriptPlugin({ typescript, - tsconfigOverride: { - compilerOptions: { - target: 'es2017' - } - }, cacheDir: tmp.dirSync(), abortOnError: true, transformers: [ @@ -351,11 +291,6 @@ exports.es2017PluginsCompat = function ( alias(generateAliasConfig(platform)), typescriptPlugin({ typescript, - tsconfigOverride: { - compilerOptions: { - target: 'es2017' - } - }, cacheDir: tmp.dirSync(), abortOnError: true, transformers: [removeAssertTransformer, pathTransformer] diff --git a/packages/firestore/src/register.ts b/packages/firestore/src/register.ts index 3abb38c9d86..573ac6f2020 100644 --- a/packages/firestore/src/register.ts +++ b/packages/firestore/src/register.ts @@ -60,6 +60,6 @@ export function registerFirestore( ).setMultipleInstances(true) ); registerVersion(name, version, variant); - // BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation + // BUILD_TARGET will be replaced by values like esm2017, cjs2017, etc during the compilation registerVersion(name, version, '__BUILD_TARGET__'); } diff --git a/packages/firestore/test/unit/specs/spec_rpc_error.ts b/packages/firestore/test/unit/specs/spec_rpc_error.ts index 8d4a7073861..0560bdd65db 100644 --- a/packages/firestore/test/unit/specs/spec_rpc_error.ts +++ b/packages/firestore/test/unit/specs/spec_rpc_error.ts @@ -33,7 +33,8 @@ export class RpcError extends Error { this.code = mapRpcCodeFromCode(code); } - // TODO(mikelehen): Error is a function not a class in ES5 so extending it + // TODO(dlarocque): Improve this since we no longer target ES5. + // Error is a function not a class in ES5 so extending it // doesn't really work without hackery. Just manually set .message for now. this.message = message; } diff --git a/packages/functions-compat/package.json b/packages/functions-compat/package.json index d30a085e30b..484df1c5a70 100644 --- a/packages/functions-compat/package.json +++ b/packages/functions-compat/package.json @@ -6,7 +6,6 @@ "main": "dist/index.cjs.js", "browser": "dist/index.esm2017.js", "module": "dist/index.esm2017.js", - "esm5": "dist/index.esm5.js", "exports": { ".": { "types": "./dist/src/index.d.ts", @@ -14,7 +13,6 @@ "require": "./dist/index.cjs.js", "import": "./dist/index.esm2017.js" }, - "esm5": "./dist/index.esm5.js", "browser": { "require": "./dist/index.cjs.js", "import": "./dist/index.esm2017.js" diff --git a/packages/functions-compat/rollup.config.js b/packages/functions-compat/rollup.config.js index 53aad50475a..6ac98783eae 100644 --- a/packages/functions-compat/rollup.config.js +++ b/packages/functions-compat/rollup.config.js @@ -25,32 +25,14 @@ const deps = Object.keys( Object.assign({}, pkg.peerDependencies, pkg.dependencies) ); -const es5BuildPlugins = [ +const buildPlugins = [ typescriptPlugin({ typescript }), - json() -]; - -const es2017BuildPlugins = [ - typescriptPlugin({ - typescript, - tsconfigOverride: { - compilerOptions: { - target: 'es2017' - } - } - }), json({ preferConst: true }) ]; const browserBuilds = [ - { - input: 'src/index.ts', - output: { file: pkg.esm5, format: 'es', sourcemap: true }, - plugins: es5BuildPlugins, - external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)) - }, { input: 'src/index.ts', output: { @@ -58,7 +40,7 @@ const browserBuilds = [ format: 'es', sourcemap: true }, - plugins: es2017BuildPlugins, + plugins: buildPlugins, external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)) }, { @@ -68,7 +50,7 @@ const browserBuilds = [ format: 'cjs', sourcemap: true }, - plugins: es2017BuildPlugins, + plugins: buildPlugins, external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)) } ]; diff --git a/packages/functions/package.json b/packages/functions/package.json index 084bd1b28db..33cf52bfbb2 100644 --- a/packages/functions/package.json +++ b/packages/functions/package.json @@ -6,7 +6,6 @@ "main": "dist/index.cjs.js", "browser": "dist/index.esm2017.js", "module": "dist/index.esm2017.js", - "esm5": "dist/index.esm.js", "exports": { ".": { "types": "./dist/functions-public.d.ts", @@ -14,7 +13,6 @@ "import": "./dist/index.esm2017.js", "require": "./dist/index.cjs.js" }, - "esm5": "./dist/index.esm.js", "browser": { "require": "./dist/index.cjs.js", "import": "./dist/index.esm2017.js" diff --git a/packages/functions/rollup.config.js b/packages/functions/rollup.config.js index 4bc7f73d869..bb950655646 100644 --- a/packages/functions/rollup.config.js +++ b/packages/functions/rollup.config.js @@ -27,35 +27,14 @@ const deps = Object.keys( Object.assign({}, pkg.peerDependencies, pkg.dependencies) ); -const es5BuildPlugins = [ +const buildPlugins = [ typescriptPlugin({ typescript }), - json() -]; - -const es2017BuildPlugins = [ - typescriptPlugin({ - typescript, - tsconfigOverride: { - compilerOptions: { - target: 'es2017' - } - } - }), json({ preferConst: true }) ]; const browserBuilds = [ - { - input: 'src/index.ts', - output: [{ file: pkg.esm5, format: 'es', sourcemap: true }], - external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)), - plugins: [ - ...es5BuildPlugins, - replace(generateBuildTargetReplaceConfig('esm', 5)) - ] - }, { input: 'src/index.ts', output: { @@ -65,7 +44,7 @@ const browserBuilds = [ }, external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)), plugins: [ - ...es2017BuildPlugins, + ...buildPlugins, replace(generateBuildTargetReplaceConfig('esm', 2017)) ] }, @@ -78,7 +57,7 @@ const browserBuilds = [ }, external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)), plugins: [ - ...es2017BuildPlugins, + ...buildPlugins, replace(generateBuildTargetReplaceConfig('cjs', 2017)) ] } diff --git a/packages/functions/src/config.ts b/packages/functions/src/config.ts index 656158da10d..8dfadb52b54 100644 --- a/packages/functions/src/config.ts +++ b/packages/functions/src/config.ts @@ -65,6 +65,6 @@ export function registerFunctions(variant?: string): void { ); registerVersion(name, version, variant); - // BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation + // BUILD_TARGET will be replaced by values like esm2017, cjs2017, etc during the compilation registerVersion(name, version, '__BUILD_TARGET__'); } diff --git a/packages/installations-compat/package.json b/packages/installations-compat/package.json index bc663d6f2ce..44115221348 100644 --- a/packages/installations-compat/package.json +++ b/packages/installations-compat/package.json @@ -5,12 +5,10 @@ "main": "dist/index.cjs.js", "module": "dist/esm/index.esm2017.js", "browser": "dist/esm/index.esm2017.js", - "esm5": "dist/esm/index.esm.js", "exports": { ".": { "types": "./dist/src/index.d.ts", "require": "./dist/index.cjs.js", - "esm5": "./dist/esm/index.esm.js", "default": "./dist/esm/index.esm2017.js" }, "./package.json": "./package.json" diff --git a/packages/installations-compat/rollup.config.js b/packages/installations-compat/rollup.config.js index dff41008688..839c66d4413 100644 --- a/packages/installations-compat/rollup.config.js +++ b/packages/installations-compat/rollup.config.js @@ -23,45 +23,33 @@ import { emitModulePackageFile } from '../../scripts/build/rollup_emit_module_pa const deps = Object.keys({ ...pkg.peerDependencies, ...pkg.dependencies }); -const es5BuildPlugins = [typescriptPlugin({ typescript }), json()]; -const es2017BuildPlugins = [ +const buildPlugins = [ typescriptPlugin({ - typescript, - tsconfigOverride: { - compilerOptions: { - target: 'es2017' - } - } + typescript }), json({ preferConst: true }) ]; -const esmBuilds = [ - { - input: 'src/index.ts', - output: { file: pkg.esm5, format: 'es', sourcemap: true }, - external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)), - plugins: [...es5BuildPlugins, emitModulePackageFile()] +const esmBuild = { + input: 'src/index.ts', + output: { + file: pkg.browser, + format: 'es', + sourcemap: true }, - { - input: 'src/index.ts', - output: { - file: pkg.browser, - format: 'es', - sourcemap: true - }, - external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)), - plugins: [...es2017BuildPlugins, emitModulePackageFile()] - } -]; + external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)), + plugins: [...buildPlugins, emitModulePackageFile()] +}; -const cjsBuilds = [ - { - input: 'src/index.ts', - output: { file: pkg.main, format: 'cjs', sourcemap: true }, - external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)), - plugins: es5BuildPlugins - } -]; +const cjsBuild = { + input: 'src/index.ts', + output: { + file: pkg.main, + format: 'cjs', + sourcemap: true + }, + external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)), + plugins: buildPlugins +}; -export default [...esmBuilds, ...cjsBuilds]; +export default [esmBuild, cjsBuild]; diff --git a/packages/installations/package.json b/packages/installations/package.json index ff6c74bd23d..e6093c759d6 100644 --- a/packages/installations/package.json +++ b/packages/installations/package.json @@ -5,12 +5,10 @@ "main": "dist/index.cjs.js", "module": "dist/esm/index.esm2017.js", "browser": "dist/esm/index.esm2017.js", - "esm5": "dist/esm/index.esm.js", "exports": { ".": { "types": "./dist/installations-public.d.ts", "require": "./dist/index.cjs.js", - "esm5": "./dist/esm/index.esm.js", "default": "./dist/esm/index.esm2017.js" }, "./package.json": "./package.json" diff --git a/packages/installations/rollup.config.js b/packages/installations/rollup.config.js index 70628504fdb..7d083c63320 100644 --- a/packages/installations/rollup.config.js +++ b/packages/installations/rollup.config.js @@ -25,57 +25,40 @@ import { emitModulePackageFile } from '../../scripts/build/rollup_emit_module_pa const deps = [...Object.keys({ ...pkg.peerDependencies, ...pkg.dependencies })]; -const es5BuildPlugins = [typescriptPlugin({ typescript }), json()]; - -const es2017BuildPlugins = [ +const buildPlugins = [ typescriptPlugin({ - typescript, - tsconfigOverride: { - compilerOptions: { - target: 'es2017' - } - } + typescript }), json({ preferConst: true }) ]; -const esmBuilds = [ - { - input: 'src/index.ts', - output: [{ file: pkg.esm5, format: 'es', sourcemap: true }], - external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)), - plugins: [ - ...es5BuildPlugins, - replace(generateBuildTargetReplaceConfig('esm', 5)), - emitModulePackageFile() - ] +const esmBuild = { + input: 'src/index.ts', + output: { + file: pkg.browser, + format: 'es', + sourcemap: true }, - { - input: 'src/index.ts', - output: { - file: pkg.browser, - format: 'es', - sourcemap: true - }, - external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)), - plugins: [ - ...es2017BuildPlugins, - replace(generateBuildTargetReplaceConfig('esm', 2017)), - emitModulePackageFile() - ] - } -]; + external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)), + plugins: [ + ...buildPlugins, + replace(generateBuildTargetReplaceConfig('esm', 2017)), + emitModulePackageFile() + ] +}; -const cjsBuilds = [ - { - input: 'src/index.ts', - output: [{ file: pkg.main, format: 'cjs', sourcemap: true }], - external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)), - plugins: [ - ...es5BuildPlugins, - replace(generateBuildTargetReplaceConfig('cjs', 5)) - ] - } -]; +const cjsBuild = { + input: 'src/index.ts', + output: { + file: pkg.main, + format: 'cjs', + sourcemap: true + }, + external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)), + plugins: [ + ...buildPlugins, + replace(generateBuildTargetReplaceConfig('cjs', 2017)) + ] +}; -export default [...esmBuilds, ...cjsBuilds]; +export default [esmBuild, cjsBuild]; diff --git a/packages/installations/src/index.ts b/packages/installations/src/index.ts index c16abc2b0b1..5a70ef10846 100644 --- a/packages/installations/src/index.ts +++ b/packages/installations/src/index.ts @@ -31,5 +31,5 @@ export * from './interfaces/public-types'; registerInstallations(); registerVersion(name, version); -// BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation +// BUILD_TARGET will be replaced by values like esm2017, cjs2017, etc during the compilation registerVersion(name, version, '__BUILD_TARGET__'); diff --git a/packages/installations/src/testing/compare-headers.ts b/packages/installations/src/testing/compare-headers.ts index 5b93c14933e..6c3681b3ca0 100644 --- a/packages/installations/src/testing/compare-headers.ts +++ b/packages/installations/src/testing/compare-headers.ts @@ -18,6 +18,7 @@ import { AssertionError, expect } from 'chai'; // Trick TS since it's set to target ES5. +// TODO(dlarocque): Improve this since we no longer target ES5. declare class HeadersWithEntries extends Headers { entries?(): Iterable<[string, string]>; } diff --git a/packages/logger/package.json b/packages/logger/package.json index 36131004285..14131f73258 100644 --- a/packages/logger/package.json +++ b/packages/logger/package.json @@ -5,12 +5,10 @@ "author": "Firebase (https://firebase.google.com/)", "main": "dist/index.cjs.js", "module": "dist/esm/index.esm2017.js", - "esm5": "dist/esm/index.esm5.js", "exports": { ".": { "types": "./dist/index.d.ts", "require": "./dist/index.cjs.js", - "esm5": "./dist/esm/index.esm5.js", "default": "./dist/esm/index.esm2017.js" }, "./package.json": "./package.json" diff --git a/packages/logger/rollup.config.js b/packages/logger/rollup.config.js index e6bfbb4efe5..0089b01c801 100644 --- a/packages/logger/rollup.config.js +++ b/packages/logger/rollup.config.js @@ -20,53 +20,32 @@ import typescript from 'typescript'; import pkg from './package.json'; import { emitModulePackageFile } from '../../scripts/build/rollup_emit_module_package_file'; -const es5BuildPlugins = [ - typescriptPlugin({ - typescript - }) -]; - -const es2017BuildPlugins = [ - typescriptPlugin({ - typescript, - tsconfigOverride: { - compilerOptions: { - target: 'es2017' - } - } - }) -]; +const buildPlugins = [typescriptPlugin({ typescript })]; const deps = Object.keys( Object.assign({}, pkg.peerDependencies, pkg.dependencies) ); -const esmBuilds = [ - { - input: 'index.ts', - output: { file: pkg.esm5, format: 'es', sourcemap: true }, - plugins: [...es5BuildPlugins, emitModulePackageFile()], - external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)) +const esmBuild = { + input: 'index.ts', + output: { + file: pkg.module, + format: 'es', + sourcemap: true }, - { - input: 'index.ts', - output: { - file: pkg.module, - format: 'es', - sourcemap: true - }, - plugins: [...es2017BuildPlugins, emitModulePackageFile()], - external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)) - } -]; + plugins: [...buildPlugins, emitModulePackageFile()], + external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)) +}; -const cjsBuilds = [ - { - input: 'index.ts', - output: { file: pkg.main, format: 'cjs', sourcemap: true }, - plugins: es5BuildPlugins, - external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)) - } -]; +const cjsBuild = { + input: 'index.ts', + output: { + file: pkg.main, + format: 'cjs', + sourcemap: true + }, + plugins: buildPlugins, + external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)) +}; -export default [...esmBuilds, ...cjsBuilds]; +export default [esmBuild, cjsBuild]; diff --git a/packages/messaging-compat/package.json b/packages/messaging-compat/package.json index 3d529a8eb5b..628d5801668 100644 --- a/packages/messaging-compat/package.json +++ b/packages/messaging-compat/package.json @@ -7,12 +7,10 @@ "main": "dist/index.cjs.js", "browser": "dist/esm/index.esm2017.js", "module": "dist/esm/index.esm2017.js", - "esm5": "dist/esm/index.esm.js", "exports": { ".": { "types": "./dist/src/index.d.ts", "require": "./dist/index.cjs.js", - "esm5": "./dist/esm/index.esm.js", "default": "./dist/esm/index.esm2017.js" }, "./package.json": "./package.json" diff --git a/packages/messaging-compat/rollup.config.js b/packages/messaging-compat/rollup.config.js index 2bc0cecded0..b8a320641fc 100644 --- a/packages/messaging-compat/rollup.config.js +++ b/packages/messaging-compat/rollup.config.js @@ -25,51 +25,33 @@ const deps = Object.keys( Object.assign({}, pkg.peerDependencies, pkg.dependencies) ); -const es5BuildPlugins = [ +const buildPlugins = [ typescriptPlugin({ typescript }), - json() -]; - -const es2017BuildPlugins = [ - typescriptPlugin({ - typescript, - tsconfigOverride: { - compilerOptions: { - target: 'es2017' - } - } - }), json({ preferConst: true }) ]; -const esmBuilds = [ - { - input: 'src/index.ts', - output: { file: pkg.esm5, format: 'es', sourcemap: true }, - plugins: [...es5BuildPlugins, emitModulePackageFile()], - external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)) +const esmBuild = { + input: 'src/index.ts', + output: { + file: pkg.browser, + format: 'es', + sourcemap: true }, - { - input: 'src/index.ts', - output: { - file: pkg.browser, - format: 'es', - sourcemap: true - }, - plugins: [...es2017BuildPlugins, emitModulePackageFile()], - external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)) - } -]; + plugins: [...buildPlugins, emitModulePackageFile()], + external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)) +}; -const cjsBuilds = [ - { - input: 'src/index.ts', - output: { file: pkg.main, format: 'cjs', sourcemap: true }, - plugins: es5BuildPlugins, - external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)) - } -]; +const cjsBuild = { + input: 'src/index.ts', + output: { + file: pkg.main, + format: 'cjs', + sourcemap: true + }, + plugins: buildPlugins, + external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)) +}; -export default [...esmBuilds, ...cjsBuilds]; +export default [esmBuild, cjsBuild]; diff --git a/packages/messaging/package.json b/packages/messaging/package.json index 674b2feb246..e191118271f 100644 --- a/packages/messaging/package.json +++ b/packages/messaging/package.json @@ -8,13 +8,11 @@ "module": "dist/esm/index.esm2017.js", "sw": "dist/esm/index.sw.esm2017.js", "sw-main": "dist/index.sw.cjs", - "esm5": "dist/esm/index.esm.js", "exports": { ".": { "types": "./dist/index-public.d.ts", "require": "./dist/index.cjs.js", "module": "./dist/esm/index.esm2017.js", - "esm5": "./dist/esm/index.esm.js", "default": "./dist/esm/index.esm2017.js" }, "./sw": { diff --git a/packages/messaging/rollup.config.js b/packages/messaging/rollup.config.js index 297dc00c46f..506f0d30261 100644 --- a/packages/messaging/rollup.config.js +++ b/packages/messaging/rollup.config.js @@ -27,36 +27,14 @@ const deps = Object.keys( Object.assign({}, pkg.peerDependencies, pkg.dependencies) ); -const es5BuildPlugins = [ +const buildPlugins = [ typescriptPlugin({ typescript }), - json() -]; - -const es2017BuildPlugins = [ - typescriptPlugin({ - typescript, - tsconfigOverride: { - compilerOptions: { - target: 'es2017' - } - } - }), json({ preferConst: true }) ]; const esmBuilds = [ - { - input: 'src/index.ts', - output: { file: pkg.esm5, format: 'es', sourcemap: true }, - plugins: [ - ...es5BuildPlugins, - replace(generateBuildTargetReplaceConfig('esm', 5)), - emitModulePackageFile() - ], - external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)) - }, { input: 'src/index.ts', output: { @@ -65,7 +43,7 @@ const esmBuilds = [ sourcemap: true }, plugins: [ - ...es2017BuildPlugins, + ...buildPlugins, replace(generateBuildTargetReplaceConfig('esm', 2017)), emitModulePackageFile() ], @@ -74,8 +52,12 @@ const esmBuilds = [ // sw builds { input: 'src/index.sw.ts', - output: { file: pkg.sw, format: 'es', sourcemap: true }, - plugins: es2017BuildPlugins, + output: { + file: pkg.sw, + format: 'es', + sourcemap: true + }, + plugins: buildPlugins, external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)) } ]; @@ -83,10 +65,14 @@ const esmBuilds = [ const cjsBuilds = [ { input: 'src/index.ts', - output: [{ file: pkg.main, format: 'cjs', sourcemap: true }], + output: { + file: pkg.main, + format: 'cjs', + sourcemap: true + }, plugins: [ - ...es5BuildPlugins, - replace(generateBuildTargetReplaceConfig('cjs', 5)) + ...buildPlugins, + replace(generateBuildTargetReplaceConfig('cjs', 2017)) ], external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)) }, @@ -95,12 +81,13 @@ const cjsBuilds = [ // builds (contingent on updating the `idb` dependency). When we add // ESM Node builds, test with Nuxt and other SSR frameworks to see if // this can then be removed. + // TODO(dlarocque): ask Christina about this { input: 'src/index.sw.ts', output: { file: pkg['sw-main'], format: 'cjs', sourcemap: true }, plugins: [ - ...es5BuildPlugins, - replace(generateBuildTargetReplaceConfig('cjs', 5)) + ...buildPlugins, + replace(generateBuildTargetReplaceConfig('cjs', 2017)) ], external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)) } diff --git a/packages/messaging/src/helpers/register.ts b/packages/messaging/src/helpers/register.ts index 7a9176f96d2..ef28cd2edad 100644 --- a/packages/messaging/src/helpers/register.ts +++ b/packages/messaging/src/helpers/register.ts @@ -104,7 +104,7 @@ export function registerMessagingInWindow(): void { ); registerVersion(name, version); - // BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation + // BUILD_TARGET will be replaced by values like esm2017, cjs2017, etc during the compilation registerVersion(name, version, '__BUILD_TARGET__'); } diff --git a/packages/messaging/src/testing/compare-headers.ts b/packages/messaging/src/testing/compare-headers.ts index 6f760caf32d..4e6ea3e489d 100644 --- a/packages/messaging/src/testing/compare-headers.ts +++ b/packages/messaging/src/testing/compare-headers.ts @@ -20,6 +20,7 @@ import './setup'; import { expect } from 'chai'; // Trick TS since it's set to target ES5. +// TODO(dlarocque): Improve this since we no longer target ES5. declare class HeadersWithEntries extends Headers { entries?(): Iterable<[string, string]>; } diff --git a/packages/performance-compat/package.json b/packages/performance-compat/package.json index 72a12d37042..0e657021ff6 100644 --- a/packages/performance-compat/package.json +++ b/packages/performance-compat/package.json @@ -6,12 +6,10 @@ "main": "dist/index.cjs.js", "browser": "dist/esm/index.esm2017.js", "module": "dist/esm/index.esm2017.js", - "esm5": "dist/esm/index.esm5.js", "exports": { ".": { "types": "./dist/src/index.d.ts", "require": "./dist/index.cjs.js", - "esm5": "./dist/esm/index.esm5.js", "default": "./dist/esm/index.esm2017.js" }, "./package.json": "./package.json" diff --git a/packages/performance-compat/rollup.config.js b/packages/performance-compat/rollup.config.js index d64b7bb89e5..e52495c401e 100644 --- a/packages/performance-compat/rollup.config.js +++ b/packages/performance-compat/rollup.config.js @@ -25,14 +25,7 @@ const deps = Object.keys( Object.assign({}, pkg.peerDependencies, pkg.dependencies) ); -const es5BuildPlugins = [ - typescriptPlugin({ - typescript - }), - json() -]; - -const es2017BuildPlugins = [ +const buildPlugins = [ typescriptPlugin({ typescript, tsconfigOverride: { @@ -46,32 +39,26 @@ const es2017BuildPlugins = [ }) ]; -const esmBuilds = [ - { - input: 'src/index.ts', - output: { file: pkg.esm5, format: 'es', sourcemap: true }, - external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)), - plugins: [...es5BuildPlugins, emitModulePackageFile()] +const esmBuild = { + input: 'src/index.ts', + output: { + file: pkg.browser, + format: 'es', + sourcemap: true }, - { - input: 'src/index.ts', - output: { - file: pkg.browser, - format: 'es', - sourcemap: true - }, - external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)), - plugins: [...es2017BuildPlugins, emitModulePackageFile()] - } -]; + external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)), + plugins: [...buildPlugins, emitModulePackageFile()] +}; -const cjsBuilds = [ - { - input: 'src/index.ts', - output: { file: pkg.main, format: 'cjs', sourcemap: true }, - external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)), - plugins: es5BuildPlugins - } -]; +const cjsBuild = { + input: 'src/index.ts', + output: { + file: pkg.main, + format: 'cjs', + sourcemap: true + }, + external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)), + plugins: buildPlugins +}; -export default [...esmBuilds, ...cjsBuilds]; +export default [esmBuild, cjsBuild]; diff --git a/packages/performance/package.json b/packages/performance/package.json index de60407f2d4..7748cf3d3aa 100644 --- a/packages/performance/package.json +++ b/packages/performance/package.json @@ -6,12 +6,10 @@ "main": "dist/index.cjs.js", "browser": "dist/esm/index.esm2017.js", "module": "dist/esm/index.esm2017.js", - "esm5": "dist/esm/index.esm.js", "exports": { ".": { "types": "./dist/src/index.d.ts", "require": "./dist/index.cjs.js", - "esm5": "./dist/esm/index.esm.js", "default": "./dist/esm/index.esm2017.js" }, "./package.json": "./package.json" diff --git a/packages/performance/rollup.config.js b/packages/performance/rollup.config.js index 4816210933d..4752b5cfc02 100644 --- a/packages/performance/rollup.config.js +++ b/packages/performance/rollup.config.js @@ -27,52 +27,36 @@ const deps = Object.keys( Object.assign({}, pkg.peerDependencies, pkg.dependencies) ); -const es5BuildPlugins = [typescriptPlugin({ typescript }), json()]; -const es2017BuildPlugins = [ +const buildPlugins = [ typescriptPlugin({ - typescript, - tsconfigOverride: { - compilerOptions: { - target: 'es2017' - } - } + typescript }), json({ preferConst: true }) ]; -const esmBuilds = [ - { - input: 'src/index.ts', - output: [{ file: pkg.esm5, format: 'es', sourcemap: true }], - external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)), - plugins: [ - ...es5BuildPlugins, - replace(generateBuildTargetReplaceConfig('esm', 5)), - emitModulePackageFile() - ] - }, - { - input: 'src/index.ts', - output: [{ file: pkg.browser, format: 'es', sourcemap: true }], - external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)), - plugins: [ - ...es2017BuildPlugins, - replace(generateBuildTargetReplaceConfig('esm', 2017)), - emitModulePackageFile() - ] - } -]; +const esmBuild = { + input: 'src/index.ts', + output: [{ file: pkg.browser, format: 'es', sourcemap: true }], + external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)), + plugins: [ + ...buildPlugins, + replace(generateBuildTargetReplaceConfig('esm', 2017)), + emitModulePackageFile() + ] +}; -const cjsBuilds = [ - { - input: 'src/index.ts', - output: [{ file: pkg.main, format: 'cjs', sourcemap: true }], - external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)), - plugins: [ - ...es5BuildPlugins, - replace(generateBuildTargetReplaceConfig('cjs', 5)) - ] - } -]; +const cjsBuild = { + input: 'src/index.ts', + output: { + file: pkg.main, + format: 'cjs', + sourcemap: true + }, + external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)), + plugins: [ + ...buildPlugins, + replace(generateBuildTargetReplaceConfig('cjs', 5)) + ] +}; -export default [...esmBuilds, ...cjsBuilds]; +export default [esmBuild, cjsBuild]; diff --git a/packages/performance/src/index.ts b/packages/performance/src/index.ts index 4d3713f0614..4ccb499b368 100644 --- a/packages/performance/src/index.ts +++ b/packages/performance/src/index.ts @@ -137,7 +137,7 @@ function registerPerformance(): void { new Component('performance', factory, ComponentType.PUBLIC) ); registerVersion(name, version); - // BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation + // BUILD_TARGET will be replaced by values like esm2017, cjs2017, etc during the compilation registerVersion(name, version, '__BUILD_TARGET__'); } diff --git a/packages/remote-config-compat/package.json b/packages/remote-config-compat/package.json index 1ea2ed030d5..40c7bd6fc9c 100644 --- a/packages/remote-config-compat/package.json +++ b/packages/remote-config-compat/package.json @@ -6,12 +6,10 @@ "main": "dist/index.cjs.js", "browser": "dist/esm/index.esm2017.js", "module": "dist/esm/index.esm2017.js", - "esm5": "dist/esm/index.esm5.js", "exports": { ".": { "types": "./dist/src/index.d.ts", "require": "./dist/index.cjs.js", - "esm5": "./dist/esm/index.esm5.js", "default": "./dist/esm/index.esm2017.js" }, "./package.json": "./package.json" diff --git a/packages/remote-config-compat/rollup.config.js b/packages/remote-config-compat/rollup.config.js index d64b7bb89e5..e52495c401e 100644 --- a/packages/remote-config-compat/rollup.config.js +++ b/packages/remote-config-compat/rollup.config.js @@ -25,14 +25,7 @@ const deps = Object.keys( Object.assign({}, pkg.peerDependencies, pkg.dependencies) ); -const es5BuildPlugins = [ - typescriptPlugin({ - typescript - }), - json() -]; - -const es2017BuildPlugins = [ +const buildPlugins = [ typescriptPlugin({ typescript, tsconfigOverride: { @@ -46,32 +39,26 @@ const es2017BuildPlugins = [ }) ]; -const esmBuilds = [ - { - input: 'src/index.ts', - output: { file: pkg.esm5, format: 'es', sourcemap: true }, - external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)), - plugins: [...es5BuildPlugins, emitModulePackageFile()] +const esmBuild = { + input: 'src/index.ts', + output: { + file: pkg.browser, + format: 'es', + sourcemap: true }, - { - input: 'src/index.ts', - output: { - file: pkg.browser, - format: 'es', - sourcemap: true - }, - external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)), - plugins: [...es2017BuildPlugins, emitModulePackageFile()] - } -]; + external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)), + plugins: [...buildPlugins, emitModulePackageFile()] +}; -const cjsBuilds = [ - { - input: 'src/index.ts', - output: { file: pkg.main, format: 'cjs', sourcemap: true }, - external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)), - plugins: es5BuildPlugins - } -]; +const cjsBuild = { + input: 'src/index.ts', + output: { + file: pkg.main, + format: 'cjs', + sourcemap: true + }, + external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)), + plugins: buildPlugins +}; -export default [...esmBuilds, ...cjsBuilds]; +export default [esmBuild, cjsBuild]; diff --git a/packages/remote-config/package.json b/packages/remote-config/package.json index c38dbc0ef26..f089e972b49 100644 --- a/packages/remote-config/package.json +++ b/packages/remote-config/package.json @@ -6,12 +6,10 @@ "main": "dist/index.cjs.js", "browser": "dist/esm/index.esm2017.js", "module": "dist/esm/index.esm2017.js", - "esm5": "dist/esm/index.esm.js", "exports": { ".": { "types": "./dist/remote-config-public.d.ts", "require": "./dist/index.cjs.js", - "esm5": "./dist/esm/index.esm.js", "default": "./dist/esm/index.esm2017.js" }, "./package.json": "./package.json" diff --git a/packages/remote-config/rollup.config.js b/packages/remote-config/rollup.config.js index dba933fa417..a7209c67e09 100644 --- a/packages/remote-config/rollup.config.js +++ b/packages/remote-config/rollup.config.js @@ -26,68 +26,44 @@ import pkg from './package.json'; const deps = Object.keys( Object.assign({}, pkg.peerDependencies, pkg.dependencies) ); -/** - * ES5 Builds - */ -const es5BuildPlugins = [ - typescriptPlugin({ - typescript - }), - json() -]; -const es2017BuildPlugins = [ +const buildPlugins = [ typescriptPlugin({ - typescript, - tsconfigOverride: { - compilerOptions: { - target: 'es2017' - } - } + typescript }), json({ preferConst: true }) ]; -const esmBuilds = [ - { - input: 'src/index.ts', - output: [{ file: pkg.esm5, format: 'es', sourcemap: true }], - external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)), - plugins: [ - ...es5BuildPlugins, - replace(generateBuildTargetReplaceConfig('esm', 5)), - emitModulePackageFile() - ] +const esmBuild = { + /** + * Browser Build + */ + input: 'src/index.ts', + output: { + file: pkg.browser, + format: 'es', + sourcemap: true }, - { - /** - * Browser Build - */ - input: 'src/index.ts', - output: { - file: pkg.browser, - format: 'es', - sourcemap: true - }, - external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)), - plugins: [ - ...es2017BuildPlugins, - replace(generateBuildTargetReplaceConfig('esm', 2017)), - emitModulePackageFile() - ] - } -]; + external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)), + plugins: [ + ...buildPlugins, + replace(generateBuildTargetReplaceConfig('esm', 2017)), + emitModulePackageFile() + ] +}; -const cjsBuilds = [ - { - input: 'src/index.ts', - output: [{ file: pkg.main, format: 'cjs', sourcemap: true }], - external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)), - plugins: [ - ...es5BuildPlugins, - replace(generateBuildTargetReplaceConfig('cjs', 5)) - ] - } -]; +const cjsBuild = { + input: 'src/index.ts', + output: { + file: pkg.main, + format: 'cjs', + sourcemap: true + }, + external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)), + plugins: [ + ...buildPlugins, + replace(generateBuildTargetReplaceConfig('cjs', 2017)) + ] +}; -export default [...esmBuilds, ...cjsBuilds]; +export default [esmBuild, cjsBuild]; diff --git a/packages/remote-config/src/register.ts b/packages/remote-config/src/register.ts index ac8a8aae755..ff83e761888 100644 --- a/packages/remote-config/src/register.ts +++ b/packages/remote-config/src/register.ts @@ -52,7 +52,7 @@ export function registerRemoteConfig(): void { ); registerVersion(packageName, version); - // BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation + // BUILD_TARGET will be replaced by values like esm2017, cjs2017, etc during the compilation registerVersion(packageName, version, '__BUILD_TARGET__'); function remoteConfigFactory( diff --git a/packages/rules-unit-testing/rollup.config.js b/packages/rules-unit-testing/rollup.config.js index bd56861015b..5811401fb74 100644 --- a/packages/rules-unit-testing/rollup.config.js +++ b/packages/rules-unit-testing/rollup.config.js @@ -20,23 +20,12 @@ import pkg from './package.json'; import typescript from 'typescript'; import { emitModulePackageFile } from '../../scripts/build/rollup_emit_module_package_file'; -const plugins = [ +const buildPlugins = [ typescriptPlugin({ typescript }) ]; -const es2017BuildPlugins = [ - typescriptPlugin({ - typescript, - tsconfigOverride: { - compilerOptions: { - target: 'es2017' - } - } - }) -]; - const deps = Object.keys( Object.assign({}, pkg.peerDependencies, pkg.dependencies) ); @@ -44,16 +33,22 @@ const deps = Object.keys( export default [ { input: 'index.ts', - output: [{ file: pkg.main, format: 'cjs', sourcemap: true }], - plugins: [...plugins], + output: { + file: pkg.main, + format: 'cjs', + sourcemap: true + }, + plugins: [...buildPlugins], external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)) }, { input: 'index.ts', - output: [ - { file: pkg.exports['.'].node.import, format: 'es', sourcemap: true } - ], - plugins: [...es2017BuildPlugins, emitModulePackageFile()], + output: { + file: pkg.exports['.'].node.import, + format: 'es', + sourcemap: true + }, + plugins: [...buildPlugins, emitModulePackageFile()], external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)) } ]; diff --git a/packages/rules-unit-testing/src/impl/test_environment.ts b/packages/rules-unit-testing/src/impl/test_environment.ts index 5e0f4c613fe..eaafee85060 100644 --- a/packages/rules-unit-testing/src/impl/test_environment.ts +++ b/packages/rules-unit-testing/src/impl/test_environment.ts @@ -125,7 +125,7 @@ export class RulesTestEnvironmentImpl implements RulesTestEnvironment { return this.withSecurityRulesDisabled(async context => { const { items } = await context.storage().ref().listAll(); await Promise.all( - items.map(item => { + items.map((item: { delete: () => any }) => { return item.delete(); }) ); diff --git a/packages/storage-compat/package.json b/packages/storage-compat/package.json index 1ebccb8f29d..35bb7d57f9a 100644 --- a/packages/storage-compat/package.json +++ b/packages/storage-compat/package.json @@ -6,12 +6,10 @@ "main": "./dist/index.cjs.js", "browser": "./dist/esm/index.esm2017.js", "module": "./dist/esm/index.esm2017.js", - "esm5": "./dist/esm/index.esm5.js", "exports": { ".": { "types": "./dist/src/index.d.ts", "require": "./dist/index.cjs.js", - "esm5": "./dist/esm/index.esm5.js", "default": "./dist/esm/index.esm2017.js" }, "./package.json": "./package.json" diff --git a/packages/storage-compat/rollup.config.js b/packages/storage-compat/rollup.config.js index 5aad0883255..59f6282bf5e 100644 --- a/packages/storage-compat/rollup.config.js +++ b/packages/storage-compat/rollup.config.js @@ -25,15 +25,7 @@ const deps = Object.keys( Object.assign({}, pkg.peerDependencies, pkg.dependencies) ); -const es5BuildPlugins = [ - typescriptPlugin({ - typescript, - abortOnError: false - }), - json() -]; - -const es2017BuildPlugins = [ +const buildPlugins = [ typescriptPlugin({ typescript, abortOnError: false, @@ -46,41 +38,26 @@ const es2017BuildPlugins = [ json({ preferConst: true }) ]; -const esmBuilds = [ - { - input: './src/index.ts', - output: { - file: pkg.esm5, - format: 'es', - sourcemap: true - }, - plugins: [...es5BuildPlugins, emitModulePackageFile()], - external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)) +const esmBuild = { + input: './src/index.ts', + output: { + file: pkg.browser, + format: 'es', + sourcemap: true }, - { - input: './src/index.ts', - output: { - file: pkg.browser, - format: 'es', - sourcemap: true - }, - plugins: [...es2017BuildPlugins, emitModulePackageFile()], - external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)) - } -]; + plugins: [...buildPlugins, emitModulePackageFile()], + external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)) +}; -const cjsBuilds = [ - { - input: './src/index.ts', - output: { - file: pkg.main, - format: 'cjs', - sourcemap: true - }, - plugins: [...es5BuildPlugins], - external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)) - } -]; +const cjsBuild = { + input: './src/index.ts', + output: { + file: pkg.main, + format: 'cjs', + sourcemap: true + }, + plugins: buildPlugins, + external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)) +}; -// eslint-disable-next-line import/no-default-export -export default [...esmBuilds, ...cjsBuilds]; +export default [esmBuild, cjsBuild]; diff --git a/packages/storage/package.json b/packages/storage/package.json index bf262e820be..2ca5f2fff12 100644 --- a/packages/storage/package.json +++ b/packages/storage/package.json @@ -6,7 +6,6 @@ "main": "dist/index.node.cjs.js", "module": "dist/index.esm2017.js", "browser": "dist/index.esm2017.js", - "esm5": "dist/index.esm5.js", "exports": { ".": { "types": "./dist/storage-public.d.ts", @@ -14,7 +13,6 @@ "import": "./dist/node-esm/index.node.esm.js", "default": "./dist/index.node.cjs.js" }, - "esm5": "./dist/index.esm5.js", "browser": { "require": "./dist/index.cjs.js", "import": "./dist/index.esm2017.js" diff --git a/packages/storage/rollup.config.js b/packages/storage/rollup.config.js index 73c9d7561aa..21431d1a2a3 100644 --- a/packages/storage/rollup.config.js +++ b/packages/storage/rollup.config.js @@ -41,44 +41,15 @@ const deps = Object.keys( const nodeDeps = [...deps, 'util']; -const es5Plugins = [ +const buildPlugins = [ typescriptPlugin({ typescript, abortOnError: false }), - json() -]; - -const es2017Plugins = [ - typescriptPlugin({ - typescript, - tsconfigOverride: { - compilerOptions: { - target: 'es2017' - } - }, - abortOnError: false - }), json({ preferConst: true }) ]; const browserBuilds = [ - { - input: './src/index.ts', - output: { file: pkg.esm5, format: 'es', sourcemap: true }, - plugins: [ - alias(generateAliasConfig('browser')), - ...es5Plugins, - replace({ - ...generateBuildTargetReplaceConfig('esm', 5), - '__RUNTIME_ENV__': '' - }) - ], - external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)), - treeshake: { - moduleSideEffects: false - } - }, { input: './src/index.ts', output: { @@ -88,7 +59,7 @@ const browserBuilds = [ }, plugins: [ alias(generateAliasConfig('browser')), - ...es2017Plugins, + ...buildPlugins, replace({ ...generateBuildTargetReplaceConfig('esm', 2017), '__RUNTIME_ENV__': '' @@ -108,7 +79,7 @@ const browserBuilds = [ }, plugins: [ alias(generateAliasConfig('browser')), - ...es2017Plugins, + ...buildPlugins, replace({ ...generateBuildTargetReplaceConfig('cjs', 2017), '__RUNTIME_ENV__': '' @@ -127,7 +98,7 @@ const browserBuilds = [ ], plugins: [ alias(generateAliasConfig('browser')), - ...es5Plugins, + ...buildPlugins, replace({ ...generateBuildTargetReplaceConfig('cjs', 5), '__RUNTIME_ENV__': '' @@ -150,7 +121,7 @@ const nodeBuilds = [ }, plugins: [ alias(generateAliasConfig('node')), - ...es2017Plugins, + ...buildPlugins, replace({ ...generateBuildTargetReplaceConfig('cjs', 2017), '__RUNTIME_ENV__': 'node' @@ -171,7 +142,7 @@ const nodeBuilds = [ }, plugins: [ alias(generateAliasConfig('node')), - ...es2017Plugins, + ...buildPlugins, replace({ ...generateBuildTargetReplaceConfig('esm', 2017), '__RUNTIME_ENV__': 'node' diff --git a/packages/storage/src/index.ts b/packages/storage/src/index.ts index 1e19f5bf6eb..733a39c9ad8 100644 --- a/packages/storage/src/index.ts +++ b/packages/storage/src/index.ts @@ -70,7 +70,7 @@ function registerStorage(): void { ); //RUNTIME_ENV will be replaced during the compilation to "node" for nodejs and an empty string for browser registerVersion(name, version, '__RUNTIME_ENV__'); - // BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation + // BUILD_TARGET will be replaced by values like esm2017, cjs2017, etc during the compilation registerVersion(name, version, '__BUILD_TARGET__'); } diff --git a/packages/template/package.json b/packages/template/package.json index 9f797e78984..4c4e0b017ea 100644 --- a/packages/template/package.json +++ b/packages/template/package.json @@ -7,7 +7,6 @@ "main": "dist/index.node.cjs.js", "browser": "dist/index.esm2017.js", "module": "dist/index.esm2017.js", - "esm5": "dist/index.esm5.js", "exports": { ".": { "types": "./dist/index.d.ts", @@ -15,7 +14,6 @@ "import": "./dist/node-esm/index.node.esm.js", "require": "./dist/index.node.cjs.js" }, - "esm5": "./dist/index.esm5.js", "browser": { "require": "./dist/index.cjs.js", "import": "./dist/index.esm2017.js" diff --git a/packages/template/rollup.config.js b/packages/template/rollup.config.js index 0417ac2a28d..18ee720efeb 100644 --- a/packages/template/rollup.config.js +++ b/packages/template/rollup.config.js @@ -24,30 +24,9 @@ const deps = Object.keys( Object.assign({}, pkg.peerDependencies, pkg.dependencies) ); -const es5BuildPlugins = [ - typescriptPlugin({ - typescript - }) -]; - -const es2017BuildPlugins = [ - typescriptPlugin({ - typescript, - tsconfigOverride: { - compilerOptions: { - target: 'es2017' - } - } - }) -]; +const buildPlugins = [typescriptPlugin({ typescript })]; const browserBuilds = [ - { - input: 'index.ts', - output: [{ file: pkg.esm5, format: 'es', sourcemap: true }], - plugins: es5BuildPlugins, - external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)) - }, { input: 'index.ts', output: { @@ -55,7 +34,7 @@ const browserBuilds = [ format: 'es', sourcemap: true }, - plugins: es2017BuildPlugins, + plugins: buildPlugins, external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)) }, { @@ -65,7 +44,7 @@ const browserBuilds = [ format: 'cjs', sourcemap: true }, - plugins: es2017BuildPlugins, + plugins: buildPlugins, external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)) } ]; @@ -73,16 +52,22 @@ const browserBuilds = [ const nodeBuilds = [ { input: 'index.node.ts', - output: [{ file: pkg.main, format: 'cjs', sourcemap: true }], - plugins: es2017BuildPlugins, + output: { + file: pkg.main, + format: 'cjs', + sourcemap: true + }, + plugins: buildPlugins, external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)) }, { input: 'index.node.ts', - output: [ - { file: pkg.exports['.'].node.import, format: 'es', sourcemap: true } - ], - plugins: [...es2017BuildPlugins, emitModulePackageFile()], + output: { + file: pkg.exports['.'].node.import, + format: 'es', + sourcemap: true + }, + plugins: [...buildPlugins, emitModulePackageFile()], external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)) } ]; diff --git a/packages/util/package.json b/packages/util/package.json index d9ee2bf3a2e..fa30ebd15d9 100644 --- a/packages/util/package.json +++ b/packages/util/package.json @@ -6,7 +6,6 @@ "main": "dist/index.node.cjs.js", "browser": "dist/index.esm2017.js", "module": "dist/index.esm2017.js", - "esm5": "dist/index.esm5.js", "exports": { ".": { "types": "./dist/util-public.d.ts", @@ -14,7 +13,6 @@ "import": "./dist/node-esm/index.node.esm.js", "require": "./dist/index.node.cjs.js" }, - "esm5": "./dist/index.esm5.js", "browser": { "require": "./dist/index.cjs.js", "import": "./dist/index.esm2017.js" diff --git a/packages/util/rollup.config.js b/packages/util/rollup.config.js index 8f0d1312bfa..d428092d8ee 100644 --- a/packages/util/rollup.config.js +++ b/packages/util/rollup.config.js @@ -24,30 +24,9 @@ const deps = Object.keys( Object.assign({}, pkg.peerDependencies, pkg.dependencies) ); -const es5BuildPlugins = [ - typescriptPlugin({ - typescript - }) -]; - -const es2017BuildPlugins = [ - typescriptPlugin({ - typescript, - tsconfigOverride: { - compilerOptions: { - target: 'es2017' - } - } - }) -]; +const buildPlugins = [typescriptPlugin({ typescript })]; const browserBuilds = [ - { - input: 'index.ts', - output: [{ file: pkg.esm5, format: 'es', sourcemap: true }], - plugins: es5BuildPlugins, - external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)) - }, { input: 'index.ts', output: { @@ -55,7 +34,7 @@ const browserBuilds = [ format: 'es', sourcemap: true }, - plugins: es2017BuildPlugins, + plugins: buildPlugins, external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)) }, { @@ -65,7 +44,7 @@ const browserBuilds = [ format: 'cjs', sourcemap: true }, - plugins: es2017BuildPlugins, + plugins: buildPlugins, external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)) } ]; @@ -73,16 +52,22 @@ const browserBuilds = [ const nodeBuilds = [ { input: 'index.node.ts', - output: [{ file: pkg.main, format: 'cjs', sourcemap: true }], - plugins: es5BuildPlugins, + output: { + file: pkg.main, + format: 'cjs', + sourcemap: true + }, + plugins: buildPlugins, external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)) }, { input: 'index.node.ts', - output: [ - { file: pkg.exports['.'].node.import, format: 'es', sourcemap: true } - ], - plugins: [...es2017BuildPlugins, emitModulePackageFile()], + output: { + file: pkg.exports['.'].node.import, + format: 'es', + sourcemap: true + }, + plugins: [...buildPlugins, emitModulePackageFile()], external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)) } ]; diff --git a/packages/util/src/crypt.ts b/packages/util/src/crypt.ts index 7cd32125043..bec79d5304d 100644 --- a/packages/util/src/crypt.ts +++ b/packages/util/src/crypt.ts @@ -104,6 +104,7 @@ interface Base64 { // We define it as an object literal instead of a class because a class compiled down to es5 can't // be treeshaked. https://github.com/rollup/rollup/issues/1691 // Static lookup maps, lazily populated by init_() +// TODO(dlarocque): Define this as a class, since we no longer target ES5. export const base64: Base64 = { /** * Maps bytes to characters. diff --git a/packages/util/src/errors.ts b/packages/util/src/errors.ts index 7946d706ea3..fdf9a71f719 100644 --- a/packages/util/src/errors.ts +++ b/packages/util/src/errors.ts @@ -86,6 +86,8 @@ export class FirebaseError extends Error { // Fix For ES5 // https://github.com/Microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work + // TODO(dlarocque): Replace this with `new.target`: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html#support-for-newtarget + // which we can now use since we no longer target ES5. Object.setPrototypeOf(this, FirebaseError.prototype); // Maintains proper stack trace for where our error was thrown. diff --git a/packages/vertexai/rollup.config.js b/packages/vertexai/rollup.config.js index 6e99c03e913..3a1313a6bff 100644 --- a/packages/vertexai/rollup.config.js +++ b/packages/vertexai/rollup.config.js @@ -27,14 +27,7 @@ const deps = Object.keys( Object.assign({}, pkg.peerDependencies, pkg.dependencies) ); -const es5BuildPlugins = [ - typescriptPlugin({ - typescript - }), - json() -]; - -const es2017BuildPlugins = [ +const buildPlugins = [ typescriptPlugin({ typescript, tsconfigOverride: { @@ -55,7 +48,7 @@ const browserBuilds = [ sourcemap: true }, plugins: [ - ...es2017BuildPlugins, + ...buildPlugins, replace({ ...generateBuildTargetReplaceConfig('esm', 2017), __PACKAGE_VERSION__: pkg.version @@ -72,7 +65,7 @@ const browserBuilds = [ sourcemap: true }, plugins: [ - ...es2017BuildPlugins, + ...buildPlugins, replace({ ...generateBuildTargetReplaceConfig('cjs', 2017), __PACKAGE_VERSION__: pkg.version @@ -85,8 +78,12 @@ const browserBuilds = [ // const nodeBuilds = [ // { // input: 'index.node.ts', -// output: [{ file: pkg.main, format: 'cjs', sourcemap: true }], -// plugins: es2017BuildPlugins, +// output: { +// file: pkg.main, +// format: 'cjs', +// sourcemap: true +// }, +// plugins: buildPlugins, // external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)) // }, // { @@ -94,7 +91,7 @@ const browserBuilds = [ // output: [ // { file: pkg.exports['.'].node.import, format: 'es', sourcemap: true } // ], -// plugins: [...es2017BuildPlugins, emitModulePackageFile()], +// plugins: [...buildPlugins, emitModulePackageFile()], // external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)) // } // ]; diff --git a/packages/vertexai/src/errors.ts b/packages/vertexai/src/errors.ts index b0b5d9f25ec..ad3f9b72f5a 100644 --- a/packages/vertexai/src/errors.ts +++ b/packages/vertexai/src/errors.ts @@ -56,6 +56,8 @@ export class VertexAIError extends FirebaseError { // Allows instanceof VertexAIError in ES5/ES6 // https://github.com/Microsoft/TypeScript-wiki/blob/master/Breaking-Changes.md#extending-built-ins-like-error-array-and-map-may-no-longer-work + // TODO(dlarocque): Replace this with `new.target`: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-2.html#support-for-newtarget + // which we can now use since we no longer target ES5. Object.setPrototypeOf(this, VertexAIError.prototype); // Since Error is an interface, we don't inherit toString and so we define it ourselves. diff --git a/packages/vertexai/src/index.ts b/packages/vertexai/src/index.ts index c8f798ff3c5..5d646e8d9d0 100644 --- a/packages/vertexai/src/index.ts +++ b/packages/vertexai/src/index.ts @@ -49,7 +49,7 @@ function registerVertex(): void { ); registerVersion(name, version); - // BUILD_TARGET will be replaced by values like esm5, esm2017, cjs5, etc during the compilation + // BUILD_TARGET will be replaced by values like esm2017, cjs2017, etc during the compilation registerVersion(name, version, '__BUILD_TARGET__'); } diff --git a/packages/webchannel-wrapper/bloom-blob/package.json b/packages/webchannel-wrapper/bloom-blob/package.json index 956333e7cf2..21b0b0e4800 100644 --- a/packages/webchannel-wrapper/bloom-blob/package.json +++ b/packages/webchannel-wrapper/bloom-blob/package.json @@ -4,6 +4,5 @@ "main": "../dist/bloom-blob/bloom_blob_es2018.js", "browser": "../dist/bloom-blob/esm/bloom_blob_es2018.js", "module": "../dist/bloom-blob/esm/bloom_blob_es2018.js", - "esm5": "../dist/bloom-blob/bloom_blob_es5.js", "typings": "../dist/bloom-blob/bloom_blob_types.d.ts" } diff --git a/packages/webchannel-wrapper/package.json b/packages/webchannel-wrapper/package.json index ddc849bcce6..5e483417c95 100644 --- a/packages/webchannel-wrapper/package.json +++ b/packages/webchannel-wrapper/package.json @@ -8,13 +8,11 @@ "./webchannel-blob": { "types": "./dist/webchannel-blob/webchannel_blob_types.d.ts", "require": "./dist/webchannel-blob/webchannel_blob_es2018.js", - "esm5": "./dist/webchannel-blob/webchannel_blob_es5.js", "default": "./dist/webchannel-blob/esm/webchannel_blob_es2018.js" }, "./bloom-blob": { "types": "./dist/bloom-blob/bloom_blob_types.d.ts", "require": "./dist/bloom-blob/bloom_blob_es2018.js", - "esm5": "./dist/bloom-blob/bloom_blob_es5.js", "default": "./dist/bloom-blob/esm/bloom_blob_es2018.js" }, "./package.json": "./package.json" diff --git a/packages/webchannel-wrapper/rollup.config.js b/packages/webchannel-wrapper/rollup.config.js index 77c29ecb4ac..ae80c831396 100644 --- a/packages/webchannel-wrapper/rollup.config.js +++ b/packages/webchannel-wrapper/rollup.config.js @@ -25,7 +25,7 @@ import pkg from './package.json'; const closureBlobsDir = '../../node_modules/closure-net/firebase/'; -const es2017BuildPlugins = [ +const buildPlugins = [ copy({ targets: [ { @@ -57,7 +57,7 @@ const esm2017Builds = [ format: 'es', sourcemap: true }, - plugins: [...es2017BuildPlugins, emitModulePackageFile()] + plugins: [...buildPlugins, emitModulePackageFile()] }, { input: join(closureBlobsDir, 'bloom_blob_es2018.js'), @@ -66,7 +66,7 @@ const esm2017Builds = [ format: 'es', sourcemap: true }, - plugins: [...es2017BuildPlugins, emitModulePackageFile()] + plugins: [...buildPlugins, emitModulePackageFile()] } ]; diff --git a/packages/webchannel-wrapper/webchannel-blob/package.json b/packages/webchannel-wrapper/webchannel-blob/package.json index cb339b82557..312b9d9f2a2 100644 --- a/packages/webchannel-wrapper/webchannel-blob/package.json +++ b/packages/webchannel-wrapper/webchannel-blob/package.json @@ -4,6 +4,5 @@ "main": "../dist/webchannel-blob/webchannel_blob_es2018.js", "browser": "../dist/webchannel-blob/esm/webchannel_blob_es2018.js", "module": "../dist/webchannel-blob/esm/webchannel_blob_es2018.js", - "esm5": "../dist/webchannel-blob/webchannel_blob_es5.js", "typings": "../dist/webchannel-blob/webchannel_blob_types.d.ts" } diff --git a/repo-scripts/changelog-generator/tsconfig.json b/repo-scripts/changelog-generator/tsconfig.json index 5c910fcca64..38bdb7035e4 100644 --- a/repo-scripts/changelog-generator/tsconfig.json +++ b/repo-scripts/changelog-generator/tsconfig.json @@ -9,6 +9,6 @@ "moduleResolution": "node", "esModuleInterop": true, "resolveJsonModule": true, - "target": "es5" + "target": "es2017" } } \ No newline at end of file diff --git a/repo-scripts/size-analysis/rollup.config.js b/repo-scripts/size-analysis/rollup.config.js index 505596e3d2e..2796accc3a9 100644 --- a/repo-scripts/size-analysis/rollup.config.js +++ b/repo-scripts/size-analysis/rollup.config.js @@ -42,7 +42,7 @@ export default [ tsconfigOverride: { compilerOptions: { target: 'es2017', - module: 'es2015' + module: 'es2017' } } }), @@ -67,7 +67,7 @@ export default [ tsconfigOverride: { compilerOptions: { target: 'es2017', - module: 'es2015' + module: 'es2017' } } }), diff --git a/scripts/ci-test/check-paths.ts b/scripts/ci-test/check-paths.ts index 236e63d310f..d3af878f286 100644 --- a/scripts/ci-test/check-paths.ts +++ b/scripts/ci-test/check-paths.ts @@ -31,7 +31,6 @@ const TOP_LEVEL_FIELDS = [ 'typings', 'react-native', 'cordova', - 'esm5', 'webworker', 'main-esm' ]; diff --git a/scripts/docgen/docgen.ts b/scripts/docgen/docgen.ts index 8e9dfa87cab..ab335256145 100644 --- a/scripts/docgen/docgen.ts +++ b/scripts/docgen/docgen.ts @@ -58,6 +58,9 @@ const PREFERRED_PARAMS = [ 'vertexAI' ]; +let authApiReportOriginal: string; +let authApiConfigOriginal: string; + yargs .command( '$0', @@ -93,9 +96,6 @@ yargs process.on('exit', cleanup); process.on('SIGINT', cleanup); -let authApiReportOriginal: string; -let authApiConfigOriginal: string; - function cleanup() { try { // Restore original auth api-extractor.json contents. @@ -189,8 +189,8 @@ async function generateDocs( 'utf8' ); const authApiConfigModified = authApiConfigOriginal.replace( - `"mainEntryPointFilePath": "/dist/esm5/index.d.ts"`, - `"mainEntryPointFilePath": "/dist/esm5/index.doc.d.ts"` + `"mainEntryPointFilePath": "/dist/esm2017/index.d.ts"`, + `"mainEntryPointFilePath": "/dist/esm2017/index.doc.d.ts"` ); try { diff --git a/scripts/size_report/report_binary_size.ts b/scripts/size_report/report_binary_size.ts index 444e45dd978..da1ad166702 100644 --- a/scripts/size_report/report_binary_size.ts +++ b/scripts/size_report/report_binary_size.ts @@ -49,7 +49,6 @@ function generateReportForCDNScripts(): Report[] { const compatPkgJson = require(`${firebaseRoot}/compat/package.json`); const special_files = [ - 'firebase-performance-standalone-compat.es2017.js', 'firebase-performance-standalone-compat.js', 'firebase-compat.js' ]; @@ -118,11 +117,9 @@ async function collectBinarySize(pkg: string): Promise { 'main', 'module', 'browser', - 'esm5', 'react-native', 'cordova', - 'lite', - 'lite-esm5' + 'lite' ]; const json = require(pkg); for (const field of fields) { diff --git a/scripts/tsconfig.json b/scripts/tsconfig.json index 826691796fc..75f1741329a 100644 --- a/scripts/tsconfig.json +++ b/scripts/tsconfig.json @@ -8,7 +8,7 @@ "moduleResolution": "node", "esModuleInterop": true, "resolveJsonModule": true, - "target": "es5", + "target": "es2017", "typeRoots": [ "../node_modules/@types" ],