-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Angular upgrade from version 16 to 17 #7085
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
base: master
Are you sure you want to change the base?
Changes from all commits
794dfb9
e90e20c
c20ef0e
8ed2af5
61fe3ad
b8484fc
c6db333
57d7905
0a2e84c
9979700
778eed5
42077b7
2386b7b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| diff --git a/node_modules/@angular/build-tooling/shared-scripts/angular-optimization/BUILD.bazel b/node_modules/@angular/build-tooling/shared-scripts/angular-optimization/BUILD.bazel | ||
| index d5a8645..4b57378 100755 | ||
| index 870da1b..3f1e5c5 100755 | ||
| --- a/node_modules/@angular/build-tooling/shared-scripts/angular-optimization/BUILD.bazel | ||
| +++ b/node_modules/@angular/build-tooling/shared-scripts/angular-optimization/BUILD.bazel | ||
| @@ -23,6 +23,7 @@ js_library( | ||
|
|
@@ -9,24 +9,24 @@ index d5a8645..4b57378 100755 | |
| + "@npm//@babel/helper-split-export-declaration", | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated for the Angular 17 version of build-tooling, adding the missing Babel dependency |
||
| ], | ||
| ) | ||
|
|
||
| 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 | ||
| index 57cd2b9..2e5eaf1 100755 | ||
| index 6d5ec3f..ad4b529 100755 | ||
| --- 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 | ||
| @@ -43,9 +43,12 @@ export function createEsbuildAngularOptimizePlugin( | ||
|
|
||
| // If the current file is denoted as explicit side effect free, add the pure | ||
| // top-level functions optimization plugin for this file. | ||
| - if (isSideEffectFreeFn !== null && isSideEffectFreeFn(args.path)) { | ||
| - plugins.push(pureToplevelFunctionsPlugin); | ||
| - } | ||
| + // For TensorBoard: This plugin aggressively culls symbols in a way that | ||
| + // is incompatible with TensorBoard source. Remove it. The binary is | ||
| + // bigger than it otherwise could be but the bundle also happens faster. | ||
| + //if (isSideEffectFreeFn !== null && isSideEffectFreeFn(args.path)) { | ||
| + // plugins.push(pureToplevelFunctionsPlugin); | ||
| + //} | ||
|
|
||
| const {code} = await babel.transformAsync(content, { | ||
| filename: filePath, | ||
| @@ -86,11 +86,10 @@ export async function createEsbuildAngularOptimizePlugin(opts, additionalBabelPl | ||
| devkitOptimizePlugins.adjustTypeScriptEnumsPlugin, | ||
| ); | ||
|
|
||
| - // If the current file is denoted as explicit side effect free, add the pure | ||
| - // top-level functions optimization plugin for this file. | ||
| - if (opts.optimize.isSideEffectFree && opts.optimize.isSideEffectFree(args.path)) { | ||
| - plugins.push(devkitOptimizePlugins.pureToplevelFunctionsPlugin); | ||
| - } | ||
| + // Disabled: breaks TensorBoard by removing code that is still used. | ||
| + //if (opts.optimize.isSideEffectFree && opts.optimize.isSideEffectFree(args.path)) { | ||
| + // plugins.push(devkitOptimizePlugins.pureToplevelFunctionsPlugin); | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Disables an optimization plugin that incorrectly removes function calls that Tensorboard depends on runtime |
||
| + //} | ||
| } | ||
|
|
||
| const shouldRunLinker = | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,24 +28,17 @@ index fed787a..377915a 100755 | |
| return struct( | ||
| closure_js = closure_js_files, | ||
| devmode_js = devmode_js_files, | ||
| diff --git a/node_modules/@bazel/concatjs/web_test/karma.conf.js b/node_modules/@bazel/concatjs/web_test/karma.conf.js | ||
| index 90a03ef..28778c9 100755 | ||
| --- a/node_modules/@bazel/concatjs/web_test/karma.conf.js | ||
| +++ b/node_modules/@bazel/concatjs/web_test/karma.conf.js | ||
| @@ -384,7 +384,15 @@ try { | ||
| conf.browsers.push(launcher); | ||
| } else { | ||
| const launcher = 'CustomChrome'; | ||
| - conf.customLaunchers = {[launcher]: {base: browser, flags: additionalArgs}}; | ||
| + // For TensorBoard: Patch the CustomChrome launcher so that even it | ||
| + // specifies the --no-sandbox flag. This is to workaround | ||
| + // incompatibilities with some environments. | ||
| + // | ||
| + // Specifically we were seeing errors like: | ||
| + // [WARNING:gpu_process_host.cc(1228)] The GPU process has crashed 6 time(s) | ||
| + // [FATAL:gpu_data_manager_impl_private.cc(439)] GPU process isn't usable. Goodbye. | ||
| + conf.customLaunchers = | ||
| + {[launcher]: {base: browser, flags: ['--no-sandbox', ...additionalArgs]}}; | ||
| conf.browsers.push(launcher); | ||
| } | ||
| } | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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 |
||
| diff --git a/node_modules/@bazel/concatjs/package.json b/node_modules/@bazel/concatjs/package.json | ||
| index 1234567..abcdefg 100755 | ||
| --- a/node_modules/@bazel/concatjs/package.json | ||
| +++ b/node_modules/@bazel/concatjs/package.json | ||
| @@ -24,7 +24,8 @@ | ||
| "dependencies": { | ||
| "protobufjs": "6.8.8", | ||
| "source-map-support": "0.5.9", | ||
| - "tsutils": "3.21.0" | ||
| + "tsutils": "3.21.0", | ||
| + "typescript": "5.2.2" | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added typescript as a direct dependency because the Bazel sandbox can't find it otherwise. 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 |
||
| }, | ||
| "peerDependencies": { | ||
| "karma": ">=4.0.0", | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -140,6 +140,19 @@ tf_ts_library( | |
|
|
||
| tf_ng_web_test_suite( | ||
| name = "vz_projector_test", | ||
| # Exclude Node.js-only packages from the browser bundle. | ||
| # These come from @tensorflow/tfjs-core -> node-fetch. | ||
| external = [ | ||
| "node-fetch", | ||
| "stream", | ||
| "http", | ||
| "https", | ||
| "url", | ||
| "zlib", | ||
| "buffer", | ||
| "punycode", | ||
| "string_decoder", | ||
| ], | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This vz_projector plugin depends on @tensorflow/tfjs library.
When esbuild bundles everything for the browser, it tries to include |
||
| deps = [ | ||
| ":vz_projector_test_lib", | ||
| ], | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,7 +13,7 @@ See the License for the specific language governing permissions and | |
| limitations under the License. | ||
| ==============================================================================*/ | ||
| import {OverlayContainer} from '@angular/cdk/overlay'; | ||
| import {TestBed} from '@angular/core/testing'; | ||
| import {fakeAsync, flush, TestBed} from '@angular/core/testing'; | ||
| import {MatButtonModule} from '@angular/material/button'; | ||
| import {MatSnackBar, MatSnackBarModule} from '@angular/material/snack-bar'; | ||
| import {NoopAnimationsModule} from '@angular/platform-browser/animations'; | ||
|
|
@@ -130,7 +130,7 @@ describe('alert snackbar', () => { | |
| }); | ||
| }); | ||
|
|
||
| it('closes the snackbar on click', async () => { | ||
| it('closes the snackbar on click', fakeAsync(() => { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Replaced |
||
| const fixture = TestBed.createComponent(AlertSnackbarContainer); | ||
| fixture.detectChanges(); | ||
| store.overrideSelector(selectors.getLatestAlert, { | ||
|
|
@@ -144,14 +144,13 @@ describe('alert snackbar', () => { | |
| .querySelector(Selectors.DISMISS_BUTTON); | ||
| expect(dismissEl).toBeTruthy(); | ||
| (dismissEl as HTMLButtonElement).click(); | ||
| fixture.detectChanges(); | ||
| await fixture.whenStable(); | ||
| flush(); | ||
|
|
||
| const snackbarAfterEl = overlayContainer | ||
| .getContainerElement() | ||
| .querySelector(Selectors.SNACKBAR); | ||
| expect(snackbarAfterEl).not.toBeTruthy(); | ||
| }); | ||
| })); | ||
|
|
||
| it('shows the followup action if needed', () => { | ||
| const fixture = TestBed.createComponent(AlertSnackbarContainer); | ||
|
|
@@ -188,7 +187,7 @@ describe('alert snackbar', () => { | |
| expect(followupEl).not.toBeTruthy(); | ||
| }); | ||
|
|
||
| it('dispatches a followup action and closes', async () => { | ||
| it('dispatches a followup action and closes', fakeAsync(() => { | ||
| const fixture = TestBed.createComponent(AlertSnackbarContainer); | ||
| fixture.detectChanges(); | ||
| store.overrideSelector(selectors.getLatestAlert, { | ||
|
|
@@ -205,17 +204,16 @@ describe('alert snackbar', () => { | |
| .getContainerElement() | ||
| .querySelector(Selectors.FOLLOWUP_BUTTON); | ||
| (followupEl as HTMLButtonElement).click(); | ||
| fixture.detectChanges(); | ||
| await fixture.whenStable(); | ||
| flush(); | ||
|
|
||
| expect(recordedActions).toEqual([testAction()]); | ||
| const snackbarAfterEl = overlayContainer | ||
| .getContainerElement() | ||
| .querySelector(Selectors.SNACKBAR); | ||
| expect(snackbarAfterEl).not.toBeTruthy(); | ||
| }); | ||
| })); | ||
|
|
||
| it('dispatches a followup action with payload and closes', async () => { | ||
| it('dispatches a followup action with payload and closes', fakeAsync(() => { | ||
| const fixture = TestBed.createComponent(AlertSnackbarContainer); | ||
| fixture.detectChanges(); | ||
| store.overrideSelector(selectors.getLatestAlert, { | ||
|
|
@@ -232,13 +230,12 @@ describe('alert snackbar', () => { | |
| .getContainerElement() | ||
| .querySelector(Selectors.FOLLOWUP_BUTTON); | ||
| (followupEl as HTMLButtonElement).click(); | ||
| fixture.detectChanges(); | ||
| await fixture.whenStable(); | ||
| flush(); | ||
|
|
||
| expect(recordedActions).toEqual([testActionWithProps({foo: true})]); | ||
| const snackbarAfterEl = overlayContainer | ||
| .getContainerElement() | ||
| .querySelector(Selectors.SNACKBAR); | ||
| expect(snackbarAfterEl).not.toBeTruthy(); | ||
| }); | ||
| })); | ||
| }); | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Angular v17 supports node.js versions: v18.13.0 and newer