Skip to content

Commit

Permalink
infra: update JS dependencies. (tensorflow#4874)
Browse files Browse the repository at this point in the history
This change upgrade:                                                                
- Angular                                                                                                   
- Rxjs                                                                              
- rules_nodejs                                                                      
- rules_sass                                                                        
- @bazel/*                                                                          
- @bazel/karma -> @bazel/concatjs                                                   
- Added dependencies in package.json for things that we have bazel dependency       
  on new toolchain started to do the right thing and used Bazel's visibility        
  for tagging implicit dependencies as private and now throws the error              
  correctly. We had to make some changes accordingly.                               
                                                                                    
This change does not include upgrade to @ngrx/* as their 11+ broke the build as     
their es module-d file gets included as part of the named modules and gets          
included in our requirejs builds (:dev and :karma targets).                         
                                                                                    
Do note that with the toolchain upgrade, we now have to specify the return          
types of `JSON.parse` more strictly causing larger changes than intended.
  • Loading branch information
stephanwlee authored Apr 15, 2021
1 parent 95fea92 commit 1465f31
Show file tree
Hide file tree
Showing 8 changed files with 1,059 additions and 1,040 deletions.
26 changes: 10 additions & 16 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "io_bazel_rules_webtesting",
sha256 = "f89ca8e91ac53b3c61da356c685bf03e927f23b97b086cc593db8edc088c143f",
sha256 = "9bb461d5ef08e850025480bab185fd269242d4e533bca75bfb748001ceb343c3",
urls = [
# tag 0.3.1 resolves to commit afa8c4435ed8fd832046dab807ef998a26779ecb (2019-04-03 14:10:32 -0700)
"http://mirror.tensorflow.org/github.com/bazelbuild/rules_webtesting/releases/download/0.3.1/rules_webtesting.tar.gz",
"https://github.com/bazelbuild/rules_webtesting/releases/download/0.3.1/rules_webtesting.tar.gz",
"http://mirror.tensorflow.org/github.com/bazelbuild/rules_webtesting/releases/download/0.3.3/rules_webtesting.tar.gz",
"https://github.com/bazelbuild/rules_webtesting/releases/download/0.3.3/rules_webtesting.tar.gz",
],
)

Expand Down Expand Up @@ -40,10 +39,10 @@ rules_closure_dependencies(

http_archive(
name = "build_bazel_rules_nodejs",
sha256 = "4952ef879704ab4ad6729a29007e7094aef213ea79e9f2e94cbe1c9a753e63ef",
sha256 = "1134ec9b7baee008f1d54f0483049a97e53a57cd3913ec9d6db625549c98395a",
urls = [
"http://mirror.tensorflow.org/github.com/bazelbuild/rules_nodejs/releases/download/2.2.0/rules_nodejs-2.2.0.tar.gz",
"https://github.com/bazelbuild/rules_nodejs/releases/download/2.2.0/rules_nodejs-2.2.0.tar.gz",
"http://mirror.tensorflow.org/github.com/bazelbuild/rules_nodejs/releases/download/3.4.0/rules_nodejs-3.4.0.tar.gz",
"https://github.com/bazelbuild/rules_nodejs/releases/download/3.4.0/rules_nodejs-3.4.0.tar.gz",
],
)

Expand All @@ -62,11 +61,11 @@ yarn_install(

http_archive(
name = "io_bazel_rules_sass",
sha256 = "9dcfba04e4af896626f4760d866f895ea4291bc30bf7287887cefcf4707b6a62",
strip_prefix = "rules_sass-1.26.3",
sha256 = "9ad74e6e75a86939f4349b31d43bb1db4279e4f2a139c5ebaf56cf99feea1faa",
strip_prefix = "rules_sass-1.32.8",
urls = [
"http://mirror.tensorflow.org/github.com/bazelbuild/rules_sass/archive/1.26.3.zip",
"https://github.com/bazelbuild/rules_sass/archive/1.26.3.zip",
"http://mirror.tensorflow.org/github.com/bazelbuild/rules_sass/archive/1.32.8.zip",
"https://github.com/bazelbuild/rules_sass/archive/1.32.8.zip",
],
)

Expand All @@ -75,11 +74,6 @@ load("@npm//@bazel/protractor:package.bzl", "npm_bazel_protractor_dependencies")

npm_bazel_protractor_dependencies()

# Load @bazel/karma dependencies
load("@npm//@bazel/karma:package.bzl", "npm_bazel_karma_dependencies")

npm_bazel_karma_dependencies()

http_archive(
name = "org_tensorflow",
# NOTE: when updating this, MAKE SURE to also update the protobuf_js runtime version
Expand Down
47 changes: 26 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@
},
"homepage": "https://github.com/tensorflow/tensorboard#readme",
"devDependencies": {
"@angular/bazel": "10.2.3",
"@angular/cli": "^10.1.1",
"@angular/compiler": "^10.1.2",
"@angular/compiler-cli": "^10.1.2",
"@bazel/ibazel": "^0.14.0",
"@bazel/jasmine": "^2.3.0",
"@bazel/karma": "^2.3.0",
"@bazel/protractor": "^2.3.0",
"@bazel/rollup": "^2.3.0",
"@bazel/terser": "^2.3.0",
"@bazel/typescript": "^2.3.0",
"@angular/bazel": "11.2.9",
"@angular/cli": "^11.2.8",
"@angular/compiler": "^11.2.9",
"@angular/compiler-cli": "^11.2.9",
"@bazel/concatjs": "^3.4.0",
"@bazel/ibazel": "^0.15.9",
"@bazel/jasmine": "^3.4.0",
"@bazel/protractor": "^3.4.0",
"@bazel/rollup": "^3.4.0",
"@bazel/terser": "^3.4.0",
"@bazel/typescript": "^3.4.0",
"@rollup/plugin-commonjs": "^16.0.0",
"@rollup/plugin-node-resolve": "^10.0.0",
"@types/d3": "5.7.2",
Expand All @@ -63,16 +63,16 @@
"typescript": "4.0.5"
},
"dependencies": {
"@angular/animations": "^10.1.2",
"@angular/cdk": "^10.2.1",
"@angular/common": "^10.1.2",
"@angular/core": "^10.1.2",
"@angular/forms": "^10.1.2",
"@angular/localize": "^10.1.2",
"@angular/material": "^10.2.1",
"@angular/platform-browser": "^10.1.2",
"@angular/platform-browser-dynamic": "^10.1.2",
"@angular/router": "^10.1.2",
"@angular/animations": "^11.2.9",
"@angular/cdk": "^11.2.8",
"@angular/common": "^11.2.9",
"@angular/core": "^11.2.9",
"@angular/forms": "^11.2.9",
"@angular/localize": "^11.2.9",
"@angular/material": "^11.2.8",
"@angular/platform-browser": "^11.2.9",
"@angular/platform-browser-dynamic": "^11.2.9",
"@angular/router": "^11.2.9",
"@ngrx/effects": "^9.2.0",
"@ngrx/store": "^9.2.0",
"@polymer/decorators": "^3.0.0",
Expand All @@ -84,6 +84,8 @@
"@polymer/iron-iconset-svg": "^3.0.1",
"@polymer/iron-list": "^3.1.0",
"@polymer/iron-pages": "^3.0.1",
"@polymer/iron-resizable-behavior": "^3.0.1",
"@polymer/paper-behaviors": "^3.0.1",
"@polymer/paper-button": "^3.0.1",
"@polymer/paper-checkbox": "^3.1.0",
"@polymer/paper-dialog": "^3.0.1",
Expand All @@ -109,6 +111,9 @@
"@polymer/paper-tooltip": "^3.0.1",
"@polymer/polymer": "^3.4.1",
"@tensorflow/tfjs": "^2.3.0",
"@tensorflow/tfjs-backend-cpu": "^3.4.0",
"@tensorflow/tfjs-backend-webgl": "^3.4.0",
"@tensorflow/tfjs-core": "^3.4.0",
"@vaadin/vaadin-grid": "^5.6.6",
"d3": "5.7.0",
"dagre": "^0.8.5",
Expand Down
2 changes: 1 addition & 1 deletion tensorboard/components/tf_backend/requestManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ export class RequestManager {
);
req.onload = function () {
if (req.status === 200) {
resolve(JSON.parse(req.responseText));
resolve(JSON.parse(req.responseText) as any);
} else {
reject(new RequestNetworkError(req, url));
}
Expand Down
2 changes: 1 addition & 1 deletion tensorboard/components/tf_storage/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export const {
getObserver: getObjectObserver,
disposeBinding: disposeObjectBinding,
} = makeBindings(
(s) => JSON.parse(atob(s)),
(s) => JSON.parse(atob(s)) as Record<string, string>,
(o) => btoa(JSON.stringify(o))
);
export interface StorageOptions<T> {
Expand Down
9 changes: 2 additions & 7 deletions tensorboard/defs/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"""External-only delegates for various BUILD rules."""

load("@npm//@bazel/rollup:index.bzl", "rollup_bundle")
load("@npm//@bazel/karma:index.bzl", "karma_web_test_suite")
load("@npm//@bazel/typescript:index.bzl", "ts_config", "ts_devserver", "ts_library")
load("@npm//@bazel/concatjs:index.bzl", "karma_web_test_suite")
load("@npm//@bazel/typescript:index.bzl", "ts_config", "ts_library")
load("@io_bazel_rules_sass//:defs.bzl", "sass_binary", "sass_library")
load("@npm//@bazel/terser:index.bzl", "terser_minified")
load("//tensorboard/defs/internal:js.bzl", _tf_dev_js_binary = "tf_dev_js_binary")
Expand Down Expand Up @@ -104,11 +104,6 @@ def tf_ts_library(strict_checks = True, **kwargs):

ts_library(tsconfig = tsconfig, supports_workers = True, **kwargs)

def tf_ts_devserver(**kwargs):
"""TensorBoard wrapper for the rule for a TypeScript dev server."""

ts_devserver(**kwargs)

def tf_ng_web_test_suite(runtime_deps = [], bootstrap = [], deps = [], **kwargs):
"""TensorBoard wrapper for the rule for a Karma web test suite.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ class TfHparamsSessionGroupDetails extends mixinBehaviors(
// of sessions is at most the size of the palette.
// Note that this method is called every time the user moves
// over the metric plot, so it needs to be reasonably fast.
const sessionName = JSON.parse(seriesName)[1];
const sessionName = (JSON.parse(seriesName) as any[])[1];
const sessionIndex = this._indexOfSession.get(sessionName);
const palette = tf_color_scale.standard;
return palette[
Expand Down
2 changes: 1 addition & 1 deletion tensorboard/plugins/mesh/tf_mesh_dashboard/mesh-viewer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ export class MeshViewer extends THREE.EventDispatcher {
updateScene(currentStep, domElement) {
let config = {};
if ('config' in currentStep && currentStep.config) {
config = JSON.parse(currentStep.config);
config = JSON.parse(currentStep.config) as {};
}
// This event is an opportunity for UI-responsible component (parent) to set
// proper canvas size.
Expand Down
Loading

0 comments on commit 1465f31

Please sign in to comment.