Skip to content

Commit

Permalink
Remove ES5 Support (#8509)
Browse files Browse the repository at this point in the history
  • Loading branch information
dlarocque authored Sep 25, 2024
1 parent 3fe4f4f commit 36cb017
Show file tree
Hide file tree
Showing 101 changed files with 609 additions and 1,353 deletions.
36 changes: 36 additions & 0 deletions .changeset/little-cows-tie.md
Original file line number Diff line number Diff line change
@@ -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.
14 changes: 3 additions & 11 deletions config/tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
],
Expand Down
2 changes: 1 addition & 1 deletion e2e/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ module.exports = function (config) {
'resolveJsonModule': true,
'esModuleInterop': true,
'sourceMap': true,
'target': 'es5',
'target': 'es2017',
'importHelpers': true,
'noEmitOnError': true
}
Expand Down
2 changes: 1 addition & 1 deletion integration/compat-interop/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"moduleResolution": "node",
"noImplicitAny": true,
"outDir": "dist",
"target": "ES5",
"target": "es2017",
"sourceMap": true,
"esModuleInterop": true
},
Expand Down
2 changes: 1 addition & 1 deletion integration/firebase/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"moduleResolution": "node",
"noImplicitAny": true,
"outDir": "dist",
"target": "ES5",
"target": "es2017",
"sourceMap": true,
"esModuleInterop": true
},
Expand Down
2 changes: 0 additions & 2 deletions packages/analytics-compat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
60 changes: 21 additions & 39 deletions packages/analytics-compat/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
2 changes: 0 additions & 2 deletions packages/analytics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
36 changes: 9 additions & 27 deletions packages/analytics/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,39 +27,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 })
];

/**
* 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: {
Expand All @@ -69,7 +47,7 @@ const esmBuilds = [
},
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`)),
plugins: [
...es2017BuildPlugins,
...buildPlugins,
replace(generateBuildTargetReplaceConfig('esm', 2017)),
emitModulePackageFile()
]
Expand All @@ -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))
]
}
];
Expand Down
2 changes: 1 addition & 1 deletion packages/analytics/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 0 additions & 2 deletions packages/app-check-compat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
30 changes: 8 additions & 22 deletions packages/app-check-compat/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -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
}
];

Expand Down
2 changes: 0 additions & 2 deletions packages/app-check/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Loading

0 comments on commit 36cb017

Please sign in to comment.