Skip to content

Commit 0ac8bfc

Browse files
authored
Angular 21 upgrade (#7143)
## Motivation for features / changes Upgrades Angular 20 → 21 (with matching NgRx, Material, TypeScript, Node.js, and Bazel-toolchain updates), and fixes the karma test regressions that surfaced from that upgrade. Following official steps https://angular.dev/update-guide?v=20.0-21.0&l=3 ## Technical description of changes 1. Upgraded `@angular/* core, cdk, material, forms, router, animations, localize, platform-browser(-dynamic), cli, compiler, compiler-cli, build, build-angular` and @ngrx/* (store, effects) from 20 to 21 and TypeScript 5.8.3 to 5.9.3. 2. Upgrade `Node.js 22.23.1 to 24.18.0` in WORKSPACE, updated the pinned GitHub Actions (checkout, setup-python, setup-node, cache, upload-artifact) in ci.yml to match and avoid CI checks errors. 3. `tsconfig.json`: switch moduleResolution from node to bundler, required by Angular 21, disable `@bazel/tsetse` lint rules that crash under TS 5.9 against concatjs's harcoded tsutils@3.21.0. 4. Patch `@bazel/concatjs` to map each Angular/CDK/NgRx package new folder structure: types/*.d.ts layout, so Bazel's TS rules can still resolve type declarations. 5. `app_module.ts`: explicitly add provideZoneChangeDetection(), no longer implicit in Angular 21. 6. `column_selector_component.ts`: drop the unused ['$event'] arg from three @HostListener decorators. 7. Test fixes for Angular 21 regressions: - testing/initialize_testbed.ts, register provideZoneChangeDetection() globally for TestBed, working around a confirmed Angular 21 regression (angular/angular-cli#32047) - header_test.ts, scalar_card_test.ts, scalar_card_line_chart_test.ts: update hardcoded date-string assertions for DatePipe's new U+202F, before AM/PM for Angular 21 updated CLDR data. - testing/material.ts, filter_input_test.ts: query document.body instead of OverlayContainer.getContainerElement() for autocomplete options since Angular Material's overlay panel now renders in a separate cdk-overlay-connected-position-bounding-box. ## Screenshots of UI changes (or N/A) ## Detailed steps to verify changes work correctly (as executed by you) ## Alternate designs / implementations considered (or N/A)
1 parent 1b86d2d commit 0ac8bfc

18 files changed

Lines changed: 1108 additions & 1296 deletions

.github/workflows/ci.yml

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,17 @@ jobs:
4242
# Other workflows are likely ok to use standard GH runners for now.
4343
# Googlers, see b/460874304.
4444
runs-on: linux-x86-n2-32
45-
container: us-docker.pkg.dev/ml-oss-artifacts-published/ml-public-container/ml-build:latest
45+
# Pinned to a digest because zizmor's unpinned-images check rejects tags.
46+
# To refresh: crane digest <image>:latest
47+
container: us-docker.pkg.dev/ml-oss-artifacts-published/ml-public-container/ml-build@sha256:5544b5920fb9773007a2d61400dc70ba24ef03339cc521ac5ce89abc59b40eb7
4648
needs: lint-python-flake8 # fail fast in case of "undefined variable" errors
4749
strategy:
4850
fail-fast: false
4951
matrix:
5052
tf_version_id: ['tf', 'notf']
5153
python_version: ['3.10']
5254
steps:
53-
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
55+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
5456
# Use the container's system Python installation path instead of
5557
# actions/setup-python so Bazel's @system_python repo sees a standard
5658
# interpreter/header layout.
@@ -163,7 +165,7 @@ jobs:
163165
# file(s) to be unique per workflow run, so make sure that the name is unique for each
164166
# "matrix" combination for which this is executed.
165167
if: matrix.tf_version_id == 'tf' && github.repository == 'tensorflow/tensorboard' && github.ref == 'refs/heads/master'
166-
uses: actions/upload-artifact@v4
168+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
167169
with:
168170
name: tb-nightly_py${{ matrix.python_version }}
169171
path: /tmp/tb_nightly_pip_package/*
@@ -181,14 +183,14 @@ jobs:
181183
platform: 'ubuntu-22.04'
182184
rust_version: '1.65.0'
183185
steps:
184-
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
185-
- uses: actions/setup-python@13ae5bb136fac2878aff31522b9efb785519f984 # v4.3.0
186+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
187+
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
186188
with:
187189
python-version: '3.9'
188190
architecture: 'x64'
189191
- name: 'Cache Cargo artifacts'
190192
if: matrix.mode == 'native'
191-
uses: actions/cache@v4
193+
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
192194
with:
193195
path: |
194196
tensorboard/data/server/target/
@@ -239,7 +241,7 @@ jobs:
239241
--out-dir /tmp/pip_package \
240242
;
241243
- name: 'Upload'
242-
uses: actions/upload-artifact@v4
244+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
243245
with:
244246
name: tensorboard-data-server_${{ matrix.mode }}_${{ matrix.platform }}_${{ matrix.rust_version }}
245247
path: /tmp/pip_package/*
@@ -254,8 +256,8 @@ jobs:
254256
# changes, and we want to catch them all.
255257
python_version: ['3.9', '3.10', '3.11']
256258
steps:
257-
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
258-
- uses: actions/setup-python@13ae5bb136fac2878aff31522b9efb785519f984 # v4.3.0
259+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
260+
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
259261
with:
260262
python-version: ${{ matrix.python_version }}
261263
architecture: 'x64'
@@ -272,8 +274,8 @@ jobs:
272274
lint-python-yaml-docs:
273275
runs-on: ubuntu-22.04
274276
steps:
275-
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
276-
- uses: actions/setup-python@13ae5bb136fac2878aff31522b9efb785519f984 # v4.3.0
277+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
278+
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
277279
with:
278280
python-version: '3.10'
279281
architecture: 'x64'
@@ -305,9 +307,9 @@ jobs:
305307
rust_version: ['1.65.0']
306308
cargo_raze_version: ['0.16.1']
307309
steps:
308-
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
310+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
309311
- name: 'Cache Cargo artifacts'
310-
uses: actions/cache@v4
312+
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
311313
with:
312314
path: |
313315
tensorboard/data/server/target/
@@ -343,11 +345,11 @@ jobs:
343345
lint-frontend:
344346
runs-on: ubuntu-22.04
345347
steps:
346-
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
347-
- uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0
348+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
349+
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
348350
with:
349-
# Angular 19 supports Node.js 18, 20, or 22.
350-
node-version: 22
351+
# Angular 21 supports Node.js 20.19+, 22.12+, or 24+.
352+
node-version: 24
351353
- run: yarn install --ignore-engines
352354
# You can run `yarn fix-lint` to fix all Prettier complaints, although at this point this will try to fix too many things.
353355
# To fix only the files changed in this PR, see the command below.
@@ -375,7 +377,7 @@ jobs:
375377
lint-misc: # build, protos, etc.
376378
runs-on: ubuntu-22.04
377379
steps:
378-
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
380+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
379381
- name: 'Set up Buildifier'
380382
run: |
381383
ci/download_buildifier.sh "${BUILDTOOLS_VERSION}" "${BUILDIFIER_SHA256SUM}" ~/buildifier

WORKSPACE

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -217,17 +217,17 @@ build_bazel_rules_nodejs_dependencies()
217217

218218
load("@build_bazel_rules_nodejs//:index.bzl", "node_repositories", "yarn_install")
219219

220-
# Angular 19 supports Node.js 18, 20, or 22. rules_nodejs 5.8.1
221-
# doesn't bundle Node 22, so we add it here manually.
220+
# Angular 21 supports Node.js 20.19+, 22.12+, or 24+. rules_nodejs 5.8.1
221+
# doesn't bundle Node 24, so we add it here manually.
222222
node_repositories(
223223
node_repositories = {
224-
"22.23.1-darwin_arm64": ("node-v22.23.1-darwin-arm64.tar.gz", "node-v22.23.1-darwin-arm64", "ef28d8fab2c0e4314522d4bb1b7173270aa3937e93b92cb7de79c112ac1fa953"),
225-
"22.23.1-darwin_amd64": ("node-v22.23.1-darwin-x64.tar.gz", "node-v22.23.1-darwin-x64", "b8da981b8a0b1241b70249204916da76c63573ddf5814dbd2d1e41069105cb81"),
226-
"22.23.1-linux_arm64": ("node-v22.23.1-linux-arm64.tar.xz", "node-v22.23.1-linux-arm64", "0294e8b915ab75f92c7513d2fcb830ae06e10684e6c603e99a87dbf8835389c1"),
227-
"22.23.1-linux_amd64": ("node-v22.23.1-linux-x64.tar.xz", "node-v22.23.1-linux-x64", "9749e988f437343b7fa832c69ded82a312e41a03116d766797ac14f6f9eee578"),
228-
"22.23.1-windows_amd64": ("node-v22.23.1-win-x64.zip", "node-v22.23.1-win-x64", "7df0bc9375723f4a86b3aa1b7cc73342423d9677a8df4538aca31a049e309c29"),
224+
"24.18.0-darwin_arm64": ("node-v24.18.0-darwin-arm64.tar.gz", "node-v24.18.0-darwin-arm64", "e1a97e14c99c803e96c7339403282ea05a499c32f8d83defe9ef5ec66f979ed1"),
225+
"24.18.0-darwin_amd64": ("node-v24.18.0-darwin-x64.tar.gz", "node-v24.18.0-darwin-x64", "dfd0dbd3e721503434df7b7205e719f61b3a3a31b2bcf9729b8b91fea240f080"),
226+
"24.18.0-linux_arm64": ("node-v24.18.0-linux-arm64.tar.xz", "node-v24.18.0-linux-arm64", "58c9520501f6ae2b52d5b210444e24b9d0c029a58c5011b797bc1fe7105886f6"),
227+
"24.18.0-linux_amd64": ("node-v24.18.0-linux-x64.tar.xz", "node-v24.18.0-linux-x64", "55aa7153f9d88f28d765fcdad5ae6945b5c0f98a36881703817e4c450fa76742"),
228+
"24.18.0-windows_amd64": ("node-v24.18.0-win-x64.zip", "node-v24.18.0-win-x64", "0ae68406b42d7725661da979b1403ec9926da205c6770827f33aac9d8f26e821"),
229229
},
230-
node_version = "22.23.1",
230+
node_version = "24.18.0",
231231
)
232232

233233
yarn_install(

package.json

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@
2828
},
2929
"homepage": "https://github.com/tensorflow/tensorboard#readme",
3030
"devDependencies": {
31-
"@angular-devkit/build-angular": "^20.0.0",
32-
"@angular/build": "^20.0.0",
31+
"@angular-devkit/build-angular": "^21.0.0",
32+
"@angular/build": "^21.0.0",
3333
"@angular/build-tooling": "https://github.com/angular/dev-infra-private-build-tooling-builds.git#b87de6c1190eb38a74ce72a530331f2f184fe918",
34-
"@angular/cli": "^20.0.0",
35-
"@angular/compiler": "20.3.25",
36-
"@angular/compiler-cli": "^20.0.0",
34+
"@angular/cli": "^21.0.0",
35+
"@angular/compiler": "21.2.18",
36+
"@angular/compiler-cli": "^21.0.0",
3737
"@babel/core": "^7.16.12",
3838
"@bazel/concatjs": "5.8.1",
3939
"@bazel/esbuild": "5.8.1",
@@ -62,22 +62,22 @@
6262
"prettier-plugin-organize-imports": "2.3.4",
6363
"requirejs": "^2.3.7",
6464
"tslib": "^2.3.0",
65-
"typescript": "5.8.3",
65+
"typescript": "5.9.3",
6666
"yarn-deduplicate": "^5.0.0"
6767
},
6868
"dependencies": {
69-
"@angular/animations": "^20.0.0",
70-
"@angular/cdk": "^20.0.0",
71-
"@angular/common": "20.3.25",
72-
"@angular/core": "^20.0.0",
73-
"@angular/forms": "^20.0.0",
74-
"@angular/localize": "^20.0.0",
75-
"@angular/material": "^20.0.0",
76-
"@angular/platform-browser": "^20.0.0",
77-
"@angular/platform-browser-dynamic": "^20.0.0",
78-
"@angular/router": "^20.0.0",
79-
"@ngrx/effects": "^20.0.0",
80-
"@ngrx/store": "^20.0.0",
69+
"@angular/animations": "^21.0.0",
70+
"@angular/cdk": "^21.0.0",
71+
"@angular/common": "21.2.18",
72+
"@angular/core": "^21.0.0",
73+
"@angular/forms": "^21.0.0",
74+
"@angular/localize": "^21.0.0",
75+
"@angular/material": "^21.0.0",
76+
"@angular/platform-browser": "^21.0.0",
77+
"@angular/platform-browser-dynamic": "^21.0.0",
78+
"@angular/router": "^21.0.0",
79+
"@ngrx/effects": "^21.0.0",
80+
"@ngrx/store": "^21.0.0",
8181
"@polymer/decorators": "^3.0.0",
8282
"@polymer/iron-behaviors": "^3.0.1",
8383
"@polymer/iron-collapse": "^3.0.1",

patches/@bazel+concatjs+5.8.1.patch

Lines changed: 56 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ index fed787a..377915a 100755
55
@@ -160,25 +160,11 @@ def _outputs(ctx, label, srcs_files = []):
66
closure_js_file = ctx.actions.declare_file(basename + ".mjs")
77
closure_js_files.append(closure_js_file)
8-
8+
99
- # Temporary until all imports of ngfactory/ngsummary files are removed
1010
- # TODO(alexeagle): clean up after Ivy launch
1111
- if getattr(ctx.attr, "use_angular_plugin", False):
@@ -28,8 +28,61 @@ index fed787a..377915a 100755
2828
return struct(
2929
closure_js = closure_js_files,
3030
devmode_js = devmode_js_files,
31+
diff --git a/node_modules/@bazel/concatjs/internal/common/tsconfig.bzl b/node_modules/@bazel/concatjs/internal/common/tsconfig.bzl
32+
index b01c999..86d61d4 100755
33+
--- a/node_modules/@bazel/concatjs/internal/common/tsconfig.bzl
34+
+++ b/node_modules/@bazel/concatjs/internal/common/tsconfig.bzl
35+
@@ -110,6 +110,48 @@ def create_tsconfig(
36+
"*": node_modules_mappings,
37+
ctx.workspace_name + "/*": base_path_mappings,
38+
}
39+
+
40+
+ # Starting with Angular 21, the definition files (*.d.ts) were moved into
41+
+ # one folder, "types/<name>.d.ts", per package; before, we found each one
42+
+ # in its own corresponding folder. These are now resolved only via
43+
+ # package.json "exports", which Bazel's node_modules mapping can't find,
44+
+ # so below we map each package to their corresponding definition files.
45+
+ #
46+
+ # TODO: This patch is planned for removal. These mappings should move
47+
+ # into a TensorBoard-owned ts_library rule under tensorboard/defs.
48+
+ if node_modules_root:
49+
+ for pkg in [
50+
+ "@angular/cdk",
51+
+ "@angular/common",
52+
+ "@angular/core",
53+
+ "@angular/material",
54+
+ "@angular/platform-browser",
55+
+ "@angular/platform-browser-dynamic",
56+
+ ]:
57+
+ module_roots[pkg + "/*"] = [
58+
+ "/".join([node_modules_root, pkg, "types/*.d.ts"]),
59+
+ "/".join([node_modules_root, pkg, "*"]),
60+
+ ]
61+
+ for entry_point, types_file in {
62+
+ "@angular/cdk/testing/testbed": "testing-testbed",
63+
+ "@angular/common/http/testing": "http-testing",
64+
+ "@angular/material/checkbox/testing": "checkbox-testing",
65+
+ "@angular/material/chips/testing": "chips-testing",
66+
+ "@angular/material/core/testing": "core-testing",
67+
+ "@angular/material/dialog/testing": "dialog-testing",
68+
+ "@angular/material/form-field/testing/control": "form-field-testing-control",
69+
+ "@angular/material/icon/testing": "icon-testing",
70+
+ "@angular/material/menu/testing": "menu-testing",
71+
+ "@angular/material/select/testing": "select-testing",
72+
+ # @ngrx/* uses a package-name-prefixed types filename instead
73+
+ # of the plain "types/<entry-point>.d.ts" Angular packages use.
74+
+ "@ngrx/store/testing": "ngrx-store-testing",
75+
+ "@ngrx/effects/testing": "ngrx-effects-testing",
76+
+ }.items():
77+
+ pkg = "/".join(entry_point.split("/")[:2])
78+
+ module_roots[entry_point] = [
79+
+ "/".join([node_modules_root, pkg, "types", types_file + ".d.ts"]),
80+
+ ]
81+
module_mappings = get_module_mappings(ctx.label, ctx.attr, srcs = srcs)
82+
83+
# To determine the path for auto-imports, TypeScript's language service
3184
diff --git a/node_modules/@bazel/concatjs/package.json b/node_modules/@bazel/concatjs/package.json
32-
index 1234567..abcdefg 100755
85+
index dbc7cee..1129289 100755
3386
--- a/node_modules/@bazel/concatjs/package.json
3487
+++ b/node_modules/@bazel/concatjs/package.json
3588
@@ -24,7 +24,8 @@
@@ -38,7 +91,7 @@ index 1234567..abcdefg 100755
3891
"source-map-support": "0.5.9",
3992
- "tsutils": "3.21.0"
4093
+ "tsutils": "3.21.0",
41-
+ "typescript": "5.2.2"
94+
+ "typescript": "5.9.3"
4295
},
4396
"peerDependencies": {
4497
"karma": ">=4.0.0",

patches/README.md

Lines changed: 48 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,39 +13,76 @@ After creating or updating a patch, ensure there is no trailing whitespace on
1313
any line (CI runs `./tensorboard/tools/whitespace_hygiene_test.py`). You can
1414
strip it with `sed -i '' 's/[[:space:]]*$//' patches/<patch-file>.patch`.
1515

16+
**Important:** `patch-package` defaults to `--exclude '/package\.json$/'`, so a
17+
plain `yarn patch-package "<pkg>"` silently drops any changes to the package's
18+
`package.json`. Pass `--exclude '^$'` whenever the patch needs to modify that
19+
file, and always review `git diff patches/` after regenerating to confirm no
20+
hunk disappeared.
21+
1622
## `@bazel+concatjs+5.8.1.patch`
1723

1824
**Modified files:**
19-
- `node_modules/@bazel/concatjs/internal/common/compilation.bzl`
20-
- `node_modules/@bazel/concatjs/package.json`
25+
* `node_modules/@bazel/concatjs/internal/common/compilation.bzl`
26+
* `node_modules/@bazel/concatjs/internal/common/tsconfig.bzl`
27+
* `node_modules/@bazel/concatjs/package.json`
2128

2229
**What it does:**
23-
Updated patch from 5.7.0 to 5.8.1. This version already includes the TypeScript 5.x fix and Chrome sandbox fix that we had to patch manually in 5.7.0.
24-
Added typescript as a direct dependency because the Bazel sandbox can't find it otherwise.
30+
Three independent changes:
31+
32+
1. `compilation.bzl` stops declaring `*.ngfactory.*` and `*.ngsummary.*` outputs
33+
when `use_angular_plugin = True`. Ivy no longer emits those files, so Bazel
34+
failed with "declared output was not created".
35+
2. `tsconfig.bzl` adds `module_roots` entries mapping each Angular, Material,
36+
CDK and NgRx entry point to its `types/<name>.d.ts` file. Starting with
37+
Angular 21, APF packaging exposes type definitions only through
38+
`package.json` `"exports"`, which the Bazel `node_modules` path mapping
39+
cannot resolve.
40+
3. `package.json` adds `typescript` as a direct dependency because the Bazel
41+
sandbox cannot find it otherwise.
42+
43+
Note that putting the mappings from (2) in the workspace `tsconfig.json` does not
44+
work: the tsconfig Bazel generates does `extends` the workspace one, but it also
45+
writes its own `compilerOptions.paths`, and TypeScript replaces `paths` wholesale
46+
instead of merging it.
2547

2648
Why 5.8.1 and not 6.x: rules_nodejs 6.x removed most of the build rules we depend on (concatjs, esbuild, typescript, etc.) and moved them to a separate project (rules_js). This effort will be done in future upgrades.
2749

50+
Removal is planned. `@bazel/concatjs` 5.8.1 is the last published version and
51+
rules_nodejs is archived, so no upstream fix is coming. The near-term plan is to
52+
move the `tsconfig.bzl` mappings and the `compilation.bzl` outputs override into
53+
a TensorBoard-owned `ts_library` rule under `tensorboard/defs`, which reuses
54+
concatjs `compile_ts` without patching it. See the `TODO` in the `tsconfig.bzl`
55+
hunk.
2856

2957
To regenerate:
3058
* `vi node_modules/@bazel/concatjs/internal/common/compilation.bzl`
59+
* `vi node_modules/@bazel/concatjs/internal/common/tsconfig.bzl`
3160
* `vi node_modules/@bazel/concatjs/package.json`
3261
* make edits
33-
* `yarn patch-package "@bazel/concatjs"`
62+
* `yarn patch-package "@bazel/concatjs" --exclude '^$'` (the `--exclude` is
63+
required, otherwise the `package.json` hunk is dropped)
3464
* update the WORKSPACE file with the name of the new patch file
3565

3666

37-
## `@angular+build-tooling+0.0.0-2113cd7f66a089ac0208ea84eee672b2529f4f6c.patch`
67+
## `@angular+build-tooling+0.0.0-98b30ab5fdeeb1df3278f5257b9a8f07abb76941.patch`
3868

3969
**Modified files:**
40-
- `node_modules/@angular/build-tooling/shared-scripts/angular-optimization/BUILD.bazel`
41-
- `node_modules/@angular/build-tooling/shared-scripts/angular-optimization/esbuild-plugin.mjs`
70+
* `node_modules/@angular/build-tooling/shared-scripts/angular-optimization/esbuild-plugin.mjs`
4271

4372
**What it does:**
44-
Updated for the Angular 17 version of build-tooling, adding the missing Babel dependency and
45-
Disables an optimization plugin that incorrectly removes function calls that Tensorboard depends on runtime.
73+
Disables the `markTopLevelPure` optimization plugin, which culls top-level
74+
function calls that TensorBoard depends on at runtime. Without this, the app
75+
bundles to a blank page with no console error. The resulting bundle is larger.
76+
77+
Note the patch file name tracks the pinned `@angular/build-tooling` commit, so it
78+
has to be renamed (and the WORKSPACE reference updated) whenever that dependency
79+
is bumped.
80+
81+
Removal is planned along with the concatjs patch. `@angular/build-tooling` is
82+
frozen upstream, and both patches only go away once the frontend build moves off
83+
rules_nodejs.
4684

4785
To regenerate:
48-
* `vi node_modules/@angular/build-tooling/shared-scripts/angular-optimization/BUILD.bazel`
4986
* `vi node_modules/@angular/build-tooling/shared-scripts/angular-optimization/esbuild-plugin.mjs`
5087
* make edits
5188
* `yarn patch-package "@angular/build-tooling"`

tensorboard/tools/whitespace_hygiene_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
exceptions = frozenset(
3131
[
3232
"patches/protobuf_6_31_1_java_export.patch",
33+
"patches/@bazel+concatjs+5.8.1.patch",
3334
]
3435
)
3536

tensorboard/webapp/app_module.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
See the License for the specific language governing permissions and
1313
limitations under the License.
1414
==============================================================================*/
15-
import {NgModule} from '@angular/core';
15+
import {NgModule, provideZoneChangeDetection} from '@angular/core';
1616
import {BrowserModule} from '@angular/platform-browser';
1717
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
1818
import {PluginApiHostModule} from '../components/experimental/plugin_util/plugin_api_host_module';
@@ -71,6 +71,7 @@ import {TensorBoardWrapperModule} from './tb_wrapper/tb_wrapper_module';
7171
StoreModule,
7272
OssPluginsModule,
7373
],
74+
providers: [provideZoneChangeDetection()],
7475
bootstrap: [AppContainer],
7576
})
7677
export class AppModule {}

tensorboard/webapp/header/header_test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ describe('header test', () => {
195195
By.css('app-header-reload button')
196196
);
197197
expect(button.properties['title']).toBe(
198-
'Last Updated: Jan 1, 2000, 12:00:00 AM'
198+
'Last Updated: Jan 1, 2000, 12:00:00AM'
199199
);
200200
});
201201

0 commit comments

Comments
 (0)