Skip to content

Commit

Permalink
build: switch devmode output to es2015 (#44505)
Browse files Browse the repository at this point in the history
To make our test output i.e. devmode output more aligned
with what we produce in the NPM packages, or to be more
aligned with what Angular applications will usually consume,
the devmode output is switched from ES5 to ES2015.

Additionally various tsconfigs (outside of Bazel) have been
updated to match with the other parts of the build. The rules
are:

ES2015 for test configurations, ES2020 for actual code that will
end up being shipped (this includes the IDE-only tsconfigs).

PR Close #44505
  • Loading branch information
devversion authored and atscott committed Jan 5, 2022
1 parent 8388151 commit c46d533
Show file tree
Hide file tree
Showing 87 changed files with 134 additions and 250 deletions.
2 changes: 1 addition & 1 deletion packages/animations/browser/test/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ ts_library(

jasmine_node_test(
name = "test",
bootstrap = ["//tools/testing:node_es5"],
bootstrap = ["//tools/testing:node_es2015"],
deps = [
":test_lib",
],
Expand Down
2 changes: 1 addition & 1 deletion packages/animations/test/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ ts_library(

jasmine_node_test(
name = "test",
bootstrap = ["//tools/testing:node_es5"],
bootstrap = ["//tools/testing:node_es2015"],
deps = [
":test_lib",
],
Expand Down
4 changes: 4 additions & 0 deletions packages/bazel/src/ng_module/ng_module.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,10 @@ def _ngc_tsconfig(ctx, files, srcs, **kwargs):
if not is_devmode:
# Note: Keep in sync with the `prodmode_target` for `ts_library` in `tools/defaults.bzl`
tsconfig["compilerOptions"]["target"] = "es2020"
else:
# For devmode output, we use ES2015 to match with what `ts_library` produces by default.
# https://github.com/bazelbuild/rules_nodejs/blob/9b36274dba34204625579463e3da054a9f42cb47/packages/typescript/internal/build_defs.bzl#L83.
tsconfig["compilerOptions"]["target"] = "es2015"

return tsconfig

Expand Down
2 changes: 1 addition & 1 deletion packages/bazel/src/ngc-wrapped/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"lib": ["es5", "es2015.collection", "es2015.core"],
"lib": ["es2015"],
"types": ["node"],
"esModuleInterop": true,
"downlevelIteration": true
Expand Down
2 changes: 1 addition & 1 deletion packages/bazel/test/ngc-wrapped/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"compilerOptions": {
"lib": ["es5", "es2015.collection", "es2015.core"],
"lib": ["es2015"],
"types": ["node", "jasmine"],
"esModuleInterop": true
}
Expand Down
2 changes: 1 addition & 1 deletion packages/benchpress/test/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ ts_library(

jasmine_node_test(
name = "test",
bootstrap = ["//tools/testing:node_es5"],
bootstrap = ["//tools/testing:node_es2015"],
deps = [
":test_lib",
"//packages/benchpress",
Expand Down
2 changes: 1 addition & 1 deletion packages/common/http/test/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ ts_library(

jasmine_node_test(
name = "test",
bootstrap = ["//tools/testing:node_es5"],
bootstrap = ["//tools/testing:node_es2015"],
deps = [
":test_lib",
],
Expand Down
2 changes: 1 addition & 1 deletion packages/common/http/testing/test/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ ts_library(

jasmine_node_test(
name = "test",
bootstrap = ["//tools/testing:node_es5"],
bootstrap = ["//tools/testing:node_es2015"],
deps = [
":test_lib",
],
Expand Down
2 changes: 1 addition & 1 deletion packages/common/test/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ ts_library(

jasmine_node_test(
name = "test",
bootstrap = ["//tools/testing:node_es5"],
bootstrap = ["//tools/testing:node_es2015"],
deps = [
":test_lib",
],
Expand Down
2 changes: 1 addition & 1 deletion packages/common/upgrade/test/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ ts_library(

jasmine_node_test(
name = "test",
bootstrap = ["//tools/testing:node_es5"],
bootstrap = ["//tools/testing:node_es2015"],
deps = [
":test_lib",
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ ts_library(

jasmine_node_test(
name = "test",
bootstrap = ["//tools/testing:node_es5"],
bootstrap = ["//tools/testing:node_es2015"],
deps = [
":test_lib",
"//packages/platform-server",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ ts_library(

jasmine_node_test(
name = "test",
bootstrap = ["//tools/testing:node_es5"],
bootstrap = ["//tools/testing:node_es2015"],
deps = [
":test_lib",
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
"baseUrl": ".",
"declaration": true,
"experimentalDecorators": true,
"lib": ["es6", "dom"],
"lib": ["es2015", "dom"],
"moduleResolution": "node",
"noImplicitAny": true,
"outDir": "../node_modules/flat_module",
"rootDir": "",
"target": "es5",
"target": "es2015",
"typeRoots": ["../node_modules/@types"]
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
"baseUrl": ".",
"declaration": true,
"experimentalDecorators": true,
"lib": ["es6", "dom"],
"lib": ["es2015", "dom"],
"moduleResolution": "node",
"noImplicitAny": true,
"rootDir": "",
"target": "es5",
"target": "es2015",
"types": []
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
"baseUrl": ".",
"declaration": true,
"experimentalDecorators": true,
"lib": ["es6", "dom"],
"lib": ["es2015", "dom"],
"moduleResolution": "node",
"noImplicitAny": true,
"outDir": "../node_modules/third_party",
"rootDir": "",
"target": "es5",
"target": "es2015",
"typeRoots": ["../node_modules/@types"]
}
}
4 changes: 2 additions & 2 deletions packages/compiler-cli/integrationtest/tsconfig-build.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"baseUrl": ".",
"declaration": true,
"experimentalDecorators": true,
"lib": ["es6", "dom"],
"lib": ["es2015", "dom"],
"moduleResolution": "node",
"noImplicitAny": true,
"noUnusedLocals": true,
Expand All @@ -23,7 +23,7 @@
// compatible with the option. Disabled until the integration test support the strict flag.
// TODO(devversion): this has been enabled without the integration test code being
"strictPropertyInitialization": false,
"target": "es5",
"target": "es2015",
"typeRoots": ["node_modules/@types"]
},

Expand Down
4 changes: 2 additions & 2 deletions packages/compiler-cli/integrationtest/tsconfig-xi18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
"baseUrl": ".",
"declaration": true,
"experimentalDecorators": true,
"lib": ["es6", "dom"],
"lib": ["es2015", "dom"],
"moduleResolution": "node",
"noImplicitAny": true,
"outDir": "./xi18n-out",
"rootDir": "",
"skipLibCheck": true,
"target": "es5",
"target": "es2015",
"typeRoots": ["node_modules/@types"]
},

Expand Down
2 changes: 1 addition & 1 deletion packages/compiler-cli/linker/babel/test/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ ts_library(

jasmine_node_test(
name = "test",
bootstrap = ["//tools/testing:node_no_angular_es5"],
bootstrap = ["//tools/testing:node_no_angular_es2015"],
deps = [
":test_lib",
],
Expand Down
2 changes: 1 addition & 1 deletion packages/compiler-cli/linker/test/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ ts_library(

jasmine_node_test(
name = "test",
bootstrap = ["//tools/testing:node_no_angular_es5"],
bootstrap = ["//tools/testing:node_no_angular_es2015"],
deps = [
":test_lib",
],
Expand Down
4 changes: 2 additions & 2 deletions packages/compiler-cli/ngcc/test/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ ts_library(

jasmine_node_test(
name = "test",
bootstrap = ["//tools/testing:node_no_angular_es5"],
bootstrap = ["//tools/testing:node_no_angular_es2015"],
data = [
"//packages/compiler-cli/src/ngtsc/testing/fake_core:npm_package",
],
Expand Down Expand Up @@ -90,7 +90,7 @@ babel(
jasmine_node_test(
name = "integration",
timeout = "long",
bootstrap = ["//tools/testing:node_no_angular_es5"],
bootstrap = ["//tools/testing:node_no_angular_es2015"],
data = [
":fesm5_angular_core",
"@npm//@angular/common-12",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ ts_library(

jasmine_node_test(
name = "test",
bootstrap = ["//tools/testing:node_no_angular_es5"],
bootstrap = ["//tools/testing:node_no_angular_es2015"],
deps = [
":test_lib",
],
Expand Down
2 changes: 1 addition & 1 deletion packages/compiler-cli/src/ngtsc/core/test/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ ts_library(

jasmine_node_test(
name = "test",
bootstrap = ["//tools/testing:node_no_angular_es5"],
bootstrap = ["//tools/testing:node_no_angular_es2015"],
deps = [
":test_lib",
],
Expand Down
6 changes: 3 additions & 3 deletions packages/compiler-cli/src/ngtsc/cycles/test/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package(default_visibility = ["//visibility:public"])

load("//tools:defaults.bzl", "jasmine_node_test", "ts_library")

package(default_visibility = ["//visibility:public"])

ts_library(
name = "test_lib",
testonly = True,
Expand All @@ -21,7 +21,7 @@ ts_library(

jasmine_node_test(
name = "test",
bootstrap = ["//tools/testing:node_no_angular_es5"],
bootstrap = ["//tools/testing:node_no_angular_es2015"],
deps = [
":test_lib",
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ ts_library(

jasmine_node_test(
name = "test",
bootstrap = ["//tools/testing:node_no_angular_es5"],
bootstrap = ["//tools/testing:node_no_angular_es2015"],
deps = [
":test_lib",
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ ts_library(

jasmine_node_test(
name = "test",
bootstrap = ["//tools/testing:node_no_angular_es5"],
bootstrap = ["//tools/testing:node_no_angular_es2015"],
deps = [
":test_lib",
],
Expand Down
2 changes: 1 addition & 1 deletion packages/compiler-cli/src/ngtsc/imports/test/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ ts_library(

jasmine_node_test(
name = "test",
bootstrap = ["//tools/testing:node_no_angular_es5"],
bootstrap = ["//tools/testing:node_no_angular_es2015"],
deps = [
":test_lib",
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ ts_library(

jasmine_node_test(
name = "test",
bootstrap = ["//tools/testing:node_no_angular_es5"],
bootstrap = ["//tools/testing:node_no_angular_es2015"],
deps = [
":test_lib",
],
Expand Down
2 changes: 1 addition & 1 deletion packages/compiler-cli/src/ngtsc/indexer/test/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ ts_library(

jasmine_node_test(
name = "test",
bootstrap = ["//tools/testing:node_no_angular_es5"],
bootstrap = ["//tools/testing:node_no_angular_es2015"],
deps = [
":test_lib",
],
Expand Down
2 changes: 1 addition & 1 deletion packages/compiler-cli/src/ngtsc/logging/test/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ ts_library(

jasmine_node_test(
name = "test",
bootstrap = ["//tools/testing:node_no_angular_es5"],
bootstrap = ["//tools/testing:node_no_angular_es2015"],
deps = [
":test_lib",
],
Expand Down
2 changes: 1 addition & 1 deletion packages/compiler-cli/src/ngtsc/metadata/test/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ ts_library(

jasmine_node_test(
name = "test",
bootstrap = ["//tools/testing:node_no_angular_es5"],
bootstrap = ["//tools/testing:node_no_angular_es2015"],
data = [
"//packages/compiler-cli/src/ngtsc/testing/fake_core:npm_package",
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ ts_library(

jasmine_node_test(
name = "test",
bootstrap = ["//tools/testing:node_no_angular_es5"],
bootstrap = ["//tools/testing:node_no_angular_es2015"],
deps = [
":test_lib",
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ ts_library(

jasmine_node_test(
name = "test",
bootstrap = ["//tools/testing:node_no_angular_es5"],
bootstrap = ["//tools/testing:node_no_angular_es2015"],
deps = [
":test_lib",
],
Expand Down
6 changes: 3 additions & 3 deletions packages/compiler-cli/src/ngtsc/scope/test/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package(default_visibility = ["//visibility:public"])

load("//tools:defaults.bzl", "jasmine_node_test", "ts_library")

package(default_visibility = ["//visibility:public"])

ts_library(
name = "test_lib",
testonly = True,
Expand All @@ -25,7 +25,7 @@ ts_library(

jasmine_node_test(
name = "test",
bootstrap = ["//tools/testing:node_no_angular_es5"],
bootstrap = ["//tools/testing:node_no_angular_es2015"],
deps = [
":test_lib",
],
Expand Down
2 changes: 1 addition & 1 deletion packages/compiler-cli/src/ngtsc/shims/test/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ ts_library(

jasmine_node_test(
name = "test",
bootstrap = ["//tools/testing:node_no_angular_es5"],
bootstrap = ["//tools/testing:node_no_angular_es2015"],
deps = [
":test_lib",
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ ts_library(

jasmine_node_test(
name = "test",
bootstrap = ["//tools/testing:node_no_angular_es5"],
bootstrap = ["//tools/testing:node_no_angular_es2015"],
deps = [
":test_lib",
],
Expand Down
2 changes: 1 addition & 1 deletion packages/compiler-cli/src/ngtsc/transform/test/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ ts_library(

jasmine_node_test(
name = "test",
bootstrap = ["//tools/testing:node_no_angular_es5"],
bootstrap = ["//tools/testing:node_no_angular_es2015"],
deps = [
":test_lib",
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ ts_library(

jasmine_node_test(
name = "test",
bootstrap = ["//tools/testing:node_no_angular_es5"],
bootstrap = ["//tools/testing:node_no_angular_es2015"],
deps = [
":test_lib",
],
Expand Down

0 comments on commit c46d533

Please sign in to comment.