Skip to content

build!: update build targets to ES2020 #9101

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions config/tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
"strict": true,
"lib": [
"dom",
"es2017",
"es2020",
"esnext.WeakRef",
],
"module": "ES2015",
"moduleResolution": "node",
"resolveJsonModule": true,
"esModuleInterop": true,
"sourceMap": true,
"target": "es2017",
"target": "es2020",
"typeRoots": [
"../node_modules/@types"
],
Expand Down
11 changes: 1 addition & 10 deletions config/webpack.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ module.exports = {
options: {
compilerOptions: {
module: 'commonjs',
target: 'es2017',
target: 'es2020',
downlevelIteration: true,
resolveJsonModule: true
}
Expand All @@ -56,15 +56,6 @@ module.exports = {
use: 'source-map-loader',
enforce: 'pre'
},
{
test: /\.tsx?$/,
use: {
loader: 'istanbul-instrumenter-loader',
options: { esModules: true }
},
enforce: 'post',
exclude: [/\.test\.ts$/, /\btest(ing)?\//]
},
{
test: /\.js$/,
include: [/node_modules\/chai-as-promised/],
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": "es2017",
"target": "es2020",
"sourceMap": true,
"esModuleInterop": true
},
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@
"http-server": "14.1.1",
"indexeddbshim": "10.1.0",
"inquirer": "8.2.6",
"istanbul-instrumenter-loader": "3.0.1",
"js-yaml": "4.1.0",
"karma": "6.4.4",
"karma-chrome-launcher": "3.2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/ai/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const buildPlugins = [
'integration'
],
compilerOptions: {
target: 'es2017'
target: 'es2020'
}
}
}),
Expand Down
6 changes: 4 additions & 2 deletions packages/app/src/heartbeatService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,10 @@ describe('HeartbeatServiceImpl', () => {
expect(emptyHeaders).to.equal('');
});
it(`triggerHeartbeat() doesn't throw even if code errors`, async () => {
//@ts-expect-error Ensure this doesn't match
heartbeatService._heartbeatsCache?.lastSentHeartbeatDate = 50;
if (heartbeatService._heartbeatsCache) {
//@ts-expect-error Ensure this doesn't match
heartbeatService._heartbeatsCache.lastSentHeartbeatDate = 50;
}
//@ts-expect-error Ensure you can't .push() to this
heartbeatService._heartbeatsCache.heartbeats = 50;
const warnStub = stub(console, 'warn');
Expand Down
4 changes: 2 additions & 2 deletions packages/auth/demo/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ const workerPlugins = [
tsconfigOverride: {
compilerOptions: {
declaration: false,
target: 'es2017',
target: 'es2020',
lib: [
// TODO: remove this
'dom',
'es2017',
'es2020',
'webworker'
]
}
Expand Down
4 changes: 2 additions & 2 deletions packages/auth/demo/src/worker/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"extends": "../../../config/tsconfig.base.json",
"compilerOptions": {
"outDir": "dist",
"target": "es2017",
"target": "es2020",
"lib": [
"es2017",
"es2020",
"webworker"
]
},
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ const webWorkerBuild = {
lib: [
// Remove dom after we figure out why navigator stuff doesn't exist
'dom',
'es2017',
'es2020',
'webworker'
]
}
Expand Down
14 changes: 7 additions & 7 deletions packages/firestore-compat/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ const util = require('../firestore/rollup.shared');

const deps = Object.keys({ ...pkg.peerDependencies, ...pkg.dependencies });

const es2017Plugins = [
const es2020Plugins = [
typescriptPlugin({
typescript,
tsconfigOverride: {
compilerOptions: {
target: 'es2017'
target: 'es2020'
}
},
transformers: [util.removeAssertTransformer]
Expand All @@ -46,7 +46,7 @@ const browserBuilds = [
format: 'es',
sourcemap: true
},
plugins: es2017Plugins,
plugins: es2020Plugins,
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`))
},
{
Expand All @@ -58,7 +58,7 @@ const browserBuilds = [
sourcemap: true
}
],
plugins: es2017Plugins,
plugins: es2020Plugins,
external: id => deps.some(dep => id === dep || id.startsWith(`${dep}/`))
}
];
Expand All @@ -71,7 +71,7 @@ const nodeBuilds = [
format: 'cjs',
sourcemap: true
},
plugins: es2017Plugins,
plugins: es2020Plugins,
external: deps
},
{
Expand All @@ -81,7 +81,7 @@ const nodeBuilds = [
format: 'es',
sourcemap: true
},
plugins: [...es2017Plugins, emitModulePackageFile()],
plugins: [...es2020Plugins, emitModulePackageFile()],
external: deps
}
];
Expand All @@ -94,7 +94,7 @@ const rnBuilds = [
format: 'es',
sourcemap: true
},
plugins: es2017Plugins,
plugins: es2020Plugins,
external: deps
}
];
Expand Down
2 changes: 1 addition & 1 deletion packages/firestore/rollup.config.debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const browserPlugins = function () {
typescript,
tsconfigOverride: {
compilerOptions: {
target: 'es2017'
target: 'es2020'
}
},
cacheDir: tmp.dirSync(),
Expand Down
14 changes: 7 additions & 7 deletions packages/firestore/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ const allBuilds = [
cacheDir: tmp.dirSync()
}),
sourcemaps(),
replace(generateBuildTargetReplaceConfig('cjs', 2017))
replace(generateBuildTargetReplaceConfig('cjs', 2020))
],
external: util.resolveNodeExterns,
treeshake: {
Expand All @@ -114,7 +114,7 @@ const allBuilds = [
},
plugins: [
sourcemaps(),
replace(generateBuildTargetReplaceConfig('esm', 2017))
replace(generateBuildTargetReplaceConfig('esm', 2020))
],
external: util.resolveNodeExterns,
treeshake: {
Expand All @@ -137,7 +137,7 @@ const allBuilds = [
moduleSideEffects: false
}
},
// Convert es2017 build to cjs
// Convert es2020 build to cjs
{
input: pkg['browser'],
output: [
Expand All @@ -149,14 +149,14 @@ const allBuilds = [
],
plugins: [
sourcemaps(),
replace(generateBuildTargetReplaceConfig('cjs', 2017))
replace(generateBuildTargetReplaceConfig('cjs', 2020))
],
external: util.resolveBrowserExterns,
treeshake: {
moduleSideEffects: false
}
},
// es2017 build with build target reporting
// es2020 build with build target reporting
{
input: pkg['browser'],
output: [
Expand All @@ -168,7 +168,7 @@ const allBuilds = [
],
plugins: [
sourcemaps(),
replace(generateBuildTargetReplaceConfig('esm', 2017))
replace(generateBuildTargetReplaceConfig('esm', 2020))
],
external: util.resolveBrowserExterns,
treeshake: {
Expand All @@ -186,7 +186,7 @@ const allBuilds = [
plugins: [
alias(util.generateAliasConfig('rn')),
...browserPlugins,
replace(generateBuildTargetReplaceConfig('esm', 2017))
replace(generateBuildTargetReplaceConfig('esm', 2020))
],
external: util.resolveBrowserExterns,
treeshake: {
Expand Down
4 changes: 2 additions & 2 deletions packages/firestore/rollup.config.lite.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ const allBuilds = [
moduleSideEffects: false
}
},
// Convert es2017 build to CJS
// Convert es2020 build to CJS
{
input: path.resolve('./lite', pkg.browser),
output: [
Expand All @@ -159,7 +159,7 @@ const allBuilds = [
moduleSideEffects: false
}
},
// Browser es2017 build
// Browser es2020 build
{
input: path.resolve('./lite', pkg.browser),
output: [
Expand Down
10 changes: 5 additions & 5 deletions packages/firestore/rollup.shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ 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 ES2017 CJS and ESM formats.
// - In-memory Browser builds that support persistence in ES2017 CJS and ESM
// - Browser builds that support persistence in ES2020 CJS and ESM formats.
// - In-memory Browser builds that support persistence in ES2020 CJS and ESM
// formats.
// - A NodeJS build that supports persistence (to be used with an IndexedDb
// shim)
Expand All @@ -46,7 +46,7 @@ const pkg = require('./package.json');
// We use two different rollup pipelines to take advantage of tree shaking,
// as Rollup does not support tree shaking for TypeScript classes transpiled
// down to ES5 (see https://bit.ly/340P23U). The build pipeline in this file
// produces tree-shaken ES2017 builds that are consumed by the ES5 builds in
// produces tree-shaken ES2020 builds that are consumed by the ES5 builds in
// `rollup.config.es.js`.
//
// All browser builds rely on Terser's property name mangling to reduce code
Expand Down Expand Up @@ -240,7 +240,7 @@ exports.applyPrebuilt = function (name = 'prebuilt.js') {
});
};

exports.es2017Plugins = function (platform, mangled = false) {
exports.es2020Plugins = function (platform, mangled = false) {
if (mangled) {
return [
alias(generateAliasConfig(platform)),
Expand All @@ -265,7 +265,7 @@ exports.es2017Plugins = function (platform, mangled = false) {
}
};

exports.es2017PluginsCompat = function (
exports.es2020PluginsCompat = function (
platform,
pathTransformer,
mangled = false
Expand Down
2 changes: 1 addition & 1 deletion packages/firestore/scripts/build-bundle.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/firestore/scripts/build-bundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ async function buildBundle(input: string, output: string): Promise<void> {
typescriptPlugin({
tsconfigOverride: {
compilerOptions: {
target: 'es2017'
target: 'es2020'
}
},
transformers: [util.removeAssertTransformer]
Expand Down
2 changes: 1 addition & 1 deletion packages/messaging-compat/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"compilerOptions": {
"outDir": "dist",
"noUnusedLocals": true,
"lib": ["dom", "es2017"],
"lib": ["dom", "es2020"],
"downlevelIteration": true
},
"exclude": ["dist/**/*"]
Expand Down
2 changes: 1 addition & 1 deletion packages/messaging/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"compilerOptions": {
"outDir": "dist",
"noUnusedLocals": true,
"lib": ["dom", "es2017"],
"lib": ["dom", "es2020"],
"downlevelIteration": true
},
"exclude": ["dist/**/*"]
Expand Down
2 changes: 1 addition & 1 deletion packages/performance-compat/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const buildPlugins = [
typescript,
tsconfigOverride: {
compilerOptions: {
target: 'es2017'
target: 'es2020'
}
}
}),
Expand Down
2 changes: 1 addition & 1 deletion packages/remote-config-compat/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const buildPlugins = [
typescript,
tsconfigOverride: {
compilerOptions: {
target: 'es2017'
target: 'es2020'
}
}
}),
Expand Down
2 changes: 1 addition & 1 deletion packages/storage-compat/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const buildPlugins = [
abortOnError: false,
tsconfigOverride: {
compilerOptions: {
target: 'es2017'
target: 'es2020'
}
}
}),
Expand Down
2 changes: 1 addition & 1 deletion packages/webchannel-wrapper/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const buildPlugins = [
typescript,
tsconfigOverride: {
compilerOptions: {
target: 'es2017'
target: 'es2020'
}
}
}),
Expand Down
2 changes: 1 addition & 1 deletion repo-scripts/changelog-generator/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
"moduleResolution": "node",
"esModuleInterop": true,
"resolveJsonModule": true,
"target": "es2017"
"target": "es2020"
}
}
2 changes: 1 addition & 1 deletion repo-scripts/prune-dts/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"module": "commonjs",
"moduleResolution": "node",
"resolveJsonModule": true,
"target": "es2017",
"target": "es2020",
"esModuleInterop": true,
"declaration": true,
"strict": true,
Expand Down
Loading
Loading