Upgrade npm bazel rules to latest

Later than v2, rollup_bundle needs additional configuration to find
workspace files. It also no longer minifies, so needed to add an
additional post-bundle step to maintain api.

We had to rename the `Object` class to `ObjectGenerated` in the
flatbuffers TypeScript generator. This lets us avoid name clashes with
the builtin `Object` class.
Upstream issue: https://github.com/google/flatbuffers/issues/6994

Change-Id: I45ab717bfc9ff8ef24aa05644fb845879cc09d98
Signed-off-by: Philipp Schrader <philipp.schrader@gmail.com>
diff --git a/y2019/vision/server/BUILD b/y2019/vision/server/BUILD
index 3952676..93172b4 100644
--- a/y2019/vision/server/BUILD
+++ b/y2019/vision/server/BUILD
@@ -1,7 +1,7 @@
 load("//aos/seasocks:gen_embedded.bzl", "gen_embedded")
 load("@com_google_protobuf//:protobuf.bzl", "cc_proto_library")
 load("//frc971/downloader:downloader.bzl", "aos_downloader_dir")
-load("@npm_bazel_typescript//:defs.bzl", "ts_library")
+load("@npm//@bazel/typescript:index.bzl", "ts_library")
 
 ts_library(
     name = "demo",
diff --git a/y2019/vision/server/www/BUILD b/y2019/vision/server/www/BUILD
index 62c1f13..7c40eaa 100644
--- a/y2019/vision/server/www/BUILD
+++ b/y2019/vision/server/www/BUILD
@@ -1,5 +1,5 @@
-load("@npm_bazel_typescript//:defs.bzl", "ts_library")
-load("@build_bazel_rules_nodejs//:defs.bzl", "rollup_bundle")
+load("@npm//@bazel/typescript:index.bzl", "ts_library")
+load("//tools/build_rules:js.bzl", "rollup_bundle")
 
 package(default_visibility = ["//visibility:public"])
 
@@ -35,7 +35,6 @@
 
 rollup_bundle(
     name = "visualizer_bundle",
-    enable_code_splitting = False,
     entry_point = "main.ts",
     target_compatible_with = ["@platforms//os:linux"],
     deps = [
diff --git a/y2019/vision/server/www/main.ts b/y2019/vision/server/www/main.ts
index 9e90563..0b2937c 100644
--- a/y2019/vision/server/www/main.ts
+++ b/y2019/vision/server/www/main.ts
@@ -51,7 +51,8 @@
     const socket = new WebSocket(`ws://${server}/ws`);
 
     socket.addEventListener('message', (event) => {
-      const j = JSON.parse(event.data);
+      // data is a proto which we don't currently have TS support for.
+      const j = JSON.parse(event.data) as any;
       this.x = j.robotPose.x;
       this.y = j.robotPose.y;
       this.theta = j.robotPose.theta;