Skip to content

Commit 471f1f2

Browse files
authored
chore: Upgrade Angular (to 13) and related dependencies (#6063)
Upgrade Angular to version 13 and related dependencies appropriately. See: https://update.angular.io/?l=3&v=12.0-13.0 See: https://medium.com/ngrx/announcing-ngrx-version-13-ivy-builds-feature-creators-improved-selectors-and-more-6a1a4c52c824 Highlights: * Upgrade the following set of dependencies: * `@angular/*`: 13.3.X * `@ngrx/*`: 13.2.X * `rxjs`: 7.4.X * `zone.js` 0.11.6 or higher * `ngx-color-picker`: 12.0.1 * Some build tooling was previously upgraded in preparation for this change: * #6036 * #6049 * Some tests were previously cleaned up in preparation for this change: * #6056 * No longer need ngcc as a post install step. All Angular-related dependencies come with partially-compiled binaries. * The tensorboard:dev Angular binary now includes the runtime JIT compiler and no longer relies on AOT compilation. Googlers, see http://go/tb-oss-bundling for justification. * We can get rid of some of the patches to Angular build tooling that we needed while we used an old version of @angular/compiler-cli. * Impact on binaries and performance: * There isn't much impact on production binary sizes. The '//tensorboard' tb_webapp_binary.js shrinks slightly from 2,574,467 bytes to 2,559,890 bytes. * The '//tensorboard:dev' tb_webapp_binary.js grows an entire 1MB, from 6,074,186 bytes to 7,005,529, likely because it now includes the Angular compiler. It now relies on JIT compilation but there does not seem to be noticeable impact on runtime performance. The development experience is still relatively smooth.
1 parent cd3fa72 commit 471f1f2

File tree

6 files changed

+344
-302
lines changed

6 files changed

+344
-302
lines changed

.bazelrc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
# Use the Angular Ivy compiler
2-
# See https://github.com/angular/angular/blob/master/docs/BAZEL.md#various-flags-used-for-tests
3-
build --define=angular_ivy_enabled=True
4-
51
common --experimental_repo_remote_exec # from TensorFlow
62

73
# Use C++ backing implementations for Python proto parsing and deserialization,

package.json

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"doc": "docs"
88
},
99
"scripts": {
10-
"postinstall": "ngcc && patch-package",
10+
"postinstall": "patch-package",
1111
"build": "bazel build //...",
1212
"test": "ibazel test //...",
1313
"lint": "prettier --check 'tensorboard/**/*.'{css,html,js,ts,scss} .github/**/*.yml",
@@ -30,9 +30,9 @@
3030
"devDependencies": {
3131
"@angular-devkit/build-angular": "14.0.0-next.3",
3232
"@angular/build-tooling": "https://github.com/angular/dev-infra-private-build-tooling-builds.git#fb42478534df7d48ec23a6834fea94a776cb89a0",
33-
"@angular/cli": "^12.2.0",
34-
"@angular/compiler": "^12.2.0",
35-
"@angular/compiler-cli": "^12.2.0",
33+
"@angular/cli": "^13.3.0",
34+
"@angular/compiler": "^13.3.0",
35+
"@angular/compiler-cli": "^13.3.0",
3636
"@babel/core": "^7.16.12",
3737
"@bazel/concatjs": "5.7.0",
3838
"@bazel/esbuild": "5.7.0",
@@ -65,18 +65,18 @@
6565
"yarn-deduplicate": "^5.0.0"
6666
},
6767
"dependencies": {
68-
"@angular/animations": "^12.2.0",
69-
"@angular/cdk": "^12.2.0",
70-
"@angular/common": "^12.2.0",
71-
"@angular/core": "^12.2.0",
72-
"@angular/forms": "^12.2.0",
73-
"@angular/localize": "^12.2.0",
74-
"@angular/material": "^12.2.3",
75-
"@angular/platform-browser": "^12.2.0",
76-
"@angular/platform-browser-dynamic": "^12.2.0",
77-
"@angular/router": "^12.2.0",
78-
"@ngrx/effects": "^12.3.0",
79-
"@ngrx/store": "^12.3.0",
68+
"@angular/animations": "^13.3.0",
69+
"@angular/cdk": "^13.3.0",
70+
"@angular/common": "^13.3.0",
71+
"@angular/core": "^13.3.0",
72+
"@angular/forms": "^13.3.0",
73+
"@angular/localize": "^13.3.0",
74+
"@angular/material": "^13.3.0",
75+
"@angular/platform-browser": "^13.3.0",
76+
"@angular/platform-browser-dynamic": "^13.3.0",
77+
"@angular/router": "^13.3.0",
78+
"@ngrx/effects": "^13.2.0",
79+
"@ngrx/store": "^13.2.0",
8080
"@polymer/decorators": "^3.0.0",
8181
"@polymer/iron-behaviors": "^3.0.1",
8282
"@polymer/iron-collapse": "^3.0.1",
@@ -123,14 +123,14 @@
123123
"marked": "^4.0.10",
124124
"monaco-editor-core": "^0.26.0",
125125
"monaco-languages": "^2.6.0",
126-
"ngx-color-picker": "^11.0.0",
126+
"ngx-color-picker": "12.0.1",
127127
"numeric": "^1.2.6",
128128
"plottable": "^3.9.0",
129129
"postinstall-postinstall": "^2.1.0",
130-
"rxjs": "^7.3.0",
130+
"rxjs": "^7.4.0",
131131
"three": "~0.137.0",
132132
"umap-js": "^1.3.2",
133133
"web-animations-js": "^2.3.2",
134-
"zone.js": "^0.11.4"
134+
"zone.js": "^0.11.6"
135135
}
136136
}

patches/@angular+build-tooling+0.0.0-7d103b83a07f132629592fc9918ce17d42a5e382.patch

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,3 @@
1-
diff --git a/node_modules/@angular/build-tooling/bazel/app-bundling/esbuild.config-tmpl.mjs b/node_modules/@angular/build-tooling/bazel/app-bundling/esbuild.config-tmpl.mjs
2-
index 618bbc5..05a112f 100755
3-
--- a/node_modules/@angular/build-tooling/bazel/app-bundling/esbuild.config-tmpl.mjs
4-
+++ b/node_modules/@angular/build-tooling/bazel/app-bundling/esbuild.config-tmpl.mjs
5-
@@ -9,9 +9,18 @@
6-
import * as path from 'path';
7-
8-
import {createEsbuildAngularOptimizePlugin} from '@angular/build-tooling/shared-scripts/angular-optimization/esbuild-plugin.mjs';
9-
-import {createEs2015LinkerPlugin} from '@angular/compiler-cli/linker/babel';
10-
-import {ConsoleLogger, NodeJSFileSystem, LogLevel} from '@angular/compiler-cli';
11-
-import {GLOBAL_DEFS_FOR_TERSER_WITH_AOT} from '@angular/compiler-cli/private/tooling';
12-
+// For TensorBoard: Patch the esbuild config template so that imports are
13-
+// grabbed from the correct places. This is just the consequence of some
14-
+// skew using pre-13.X @angular/compiler-cli binaries. This should be resolved
15-
+// once we upgrade to Angular 13+.
16-
+//import {createEs2015LinkerPlugin} from '@angular/compiler-cli/linker/babel';
17-
+import {createEs2015LinkerPlugin} from '@angular/compiler-cli/linker/babel/index.js';
18-
+//import {ConsoleLogger, NodeJSFileSystem, LogLevel} from '@angular/compiler-cli';
19-
+import {NodeJSFileSystem} from '@angular/compiler-cli/src/ngtsc/file_system/src/node_js_file_system.js';
20-
+import {LogLevel} from '@angular/compiler-cli/src/ngtsc/logging/index.js';
21-
+import {ConsoleLogger} from '@angular/compiler-cli/src/ngtsc/logging/src/console_logger.js';
22-
+//import {GLOBAL_DEFS_FOR_TERSER_WITH_AOT} from '@angular/compiler-cli/private/tooling';
23-
+import {GLOBAL_DEFS_FOR_TERSER_WITH_AOT} from '@angular/compiler-cli/src/tooling.js';
24-
25-
/** Root path pointing to the app bundle source entry-point file. */
26-
const entryPointSourceRootPath = path.normalize(`TMPL_ENTRY_POINT_ROOTPATH`);
271
diff --git a/node_modules/@angular/build-tooling/shared-scripts/angular-optimization/esbuild-plugin.mjs b/node_modules/@angular/build-tooling/shared-scripts/angular-optimization/esbuild-plugin.mjs
282
index 57cd2b9..2e5eaf1 100755
293
--- a/node_modules/@angular/build-tooling/shared-scripts/angular-optimization/esbuild-plugin.mjs

tensorboard/webapp/dev_assets/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ tf_ng_module(
2020
],
2121
deps = [
2222
"//tensorboard/webapp:ng_main",
23+
"@npm//@angular/compiler",
2324
"@npm//@angular/localize",
2425
],
2526
)

tensorboard/webapp/dev_assets/main_dev.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ 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 '@angular/compiler';
1516
import '../bootstrap';

0 commit comments

Comments
 (0)