From 016d4937e001efac2ad790203eeb1cab27586410 Mon Sep 17 00:00:00 2001 From: Alan Agius <17563226+alan-agius4@users.noreply.github.com> Date: Fri, 13 Mar 2026 07:42:36 +0000 Subject: [PATCH 1/2] fix(bazel/rules_angular): fix 'NgtscCompilerHost' type incompatibility This change fixes an issue where the 'NgtscCompilerHost' was not assignable to 'CompilerHost' due to incompatible 'SourceFile' types from different TypeScript versions. The fix involves ensuring that the Angular compiler worker uses the user-configured TypeScript dependency instead of a potentially different version from the root. As part of this, the 'typescript-local' dependency alias is renamed to 'typescript' and the symlinking logic is moved to the worker package. --- MODULE.bazel.lock | 4 ++-- bazel/rules/rules_angular/BUILD.bazel | 8 -------- bazel/rules/rules_angular/MODULE.bazel | 2 +- bazel/rules/rules_angular/MODULE.bazel.lock | 4 ++-- bazel/rules/rules_angular/package.json | 2 +- bazel/rules/rules_angular/pnpm-lock.yaml | 6 +++--- bazel/rules/rules_angular/src/worker/BUILD.bazel | 10 ++++++++-- bazel/rules/rules_browsers/MODULE.bazel.lock | 4 ++-- bazel/rules/rules_browsers/test/MODULE.bazel.lock | 4 ++-- bazel/rules/rules_sass/MODULE.bazel.lock | 4 ++-- 10 files changed, 23 insertions(+), 25 deletions(-) diff --git a/MODULE.bazel.lock b/MODULE.bazel.lock index 77ff0410f..0f2bc1a80 100644 --- a/MODULE.bazel.lock +++ b/MODULE.bazel.lock @@ -547,7 +547,7 @@ "@@rules_angular+//setup:extensions.bzl%rules_angular": { "general": { "bzlTransitiveDigest": "fkaH7HMicL3g7/NDaFzlq39kcLopMyQ3KdbDn+5CRzA=", - "usagesDigest": "7iXpy97hRtKmmBzd+nMFAwTGsF2in10kXImaLMA/Muk=", + "usagesDigest": "wMUO8eqom13wkxWLavnqCGJ4zFZmKs0oe11W4sSbEBw=", "recordedFileInputs": {}, "recordedDirentsInputs": {}, "envVariables": {}, @@ -563,7 +563,7 @@ "repoRuleId": "@@rules_angular+//setup:repositories.bzl%configurable_deps_repo", "attributes": { "angular_compiler_cli": "@@rules_angular+//:node_modules/@angular/compiler-cli", - "typescript": "@@rules_angular+//:node_modules/typescript-local" + "typescript": "@@rules_angular+//:node_modules/typescript" } } }, diff --git a/bazel/rules/rules_angular/BUILD.bazel b/bazel/rules/rules_angular/BUILD.bazel index f715b0f4e..802c1b6ad 100644 --- a/bazel/rules/rules_angular/BUILD.bazel +++ b/bazel/rules/rules_angular/BUILD.bazel @@ -1,11 +1,3 @@ load("@rules_angular_npm//:defs.bzl", "npm_link_all_packages") -load("//src/private:symlink_package.bzl", "symlink_package") - -package(default_visibility = ["//visibility:public"]) npm_link_all_packages() - -symlink_package( - name = "node_modules/typescript", - src = "@rules_angular_configurable_deps//:typescript", -) diff --git a/bazel/rules/rules_angular/MODULE.bazel b/bazel/rules/rules_angular/MODULE.bazel index f7b32f308..17e1fa5d8 100644 --- a/bazel/rules/rules_angular/MODULE.bazel +++ b/bazel/rules/rules_angular/MODULE.bazel @@ -75,6 +75,6 @@ use_repo(npm, "rules_angular_npm") rules_angular = use_extension("//setup:extensions.bzl", "rules_angular") rules_angular.setup( angular_compiler_cli = "//:node_modules/@angular/compiler-cli", - typescript = "//:node_modules/typescript-local", + typescript = "//:node_modules/typescript", ) use_repo(rules_angular, "rules_angular_configurable_deps") diff --git a/bazel/rules/rules_angular/MODULE.bazel.lock b/bazel/rules/rules_angular/MODULE.bazel.lock index cacafac42..887980201 100644 --- a/bazel/rules/rules_angular/MODULE.bazel.lock +++ b/bazel/rules/rules_angular/MODULE.bazel.lock @@ -210,7 +210,7 @@ "//setup:extensions.bzl%rules_angular": { "general": { "bzlTransitiveDigest": "fkaH7HMicL3g7/NDaFzlq39kcLopMyQ3KdbDn+5CRzA=", - "usagesDigest": "jkYG7pVwv9AUzkvnnZz9u6hli0yfOwImvAzrkQK2DTY=", + "usagesDigest": "HEQ4Gmf3EPxCgnf3Tqa2HODnSVNDmEWlFWcP/XnMRbU=", "recordedFileInputs": {}, "recordedDirentsInputs": {}, "envVariables": {}, @@ -219,7 +219,7 @@ "repoRuleId": "@@//setup:repositories.bzl%configurable_deps_repo", "attributes": { "angular_compiler_cli": "@@//:node_modules/@angular/compiler-cli", - "typescript": "@@//:node_modules/typescript-local" + "typescript": "@@//:node_modules/typescript" } }, "dev_infra_rules_angular_configurable_deps": { diff --git a/bazel/rules/rules_angular/package.json b/bazel/rules/rules_angular/package.json index f234295ac..cc34b2bb0 100644 --- a/bazel/rules/rules_angular/package.json +++ b/bazel/rules/rules_angular/package.json @@ -26,7 +26,7 @@ }, "dependencies": { "@angular/compiler-cli": "22.0.0-next.3", - "typescript-local": "npm:typescript@5.9.3" + "typescript": "5.9.3" }, "devDependencies": { "@angular/build": "22.0.0-next.1", diff --git a/bazel/rules/rules_angular/pnpm-lock.yaml b/bazel/rules/rules_angular/pnpm-lock.yaml index 729bc6672..4dbadf554 100644 --- a/bazel/rules/rules_angular/pnpm-lock.yaml +++ b/bazel/rules/rules_angular/pnpm-lock.yaml @@ -13,9 +13,9 @@ importers: '@angular/compiler-cli': specifier: 22.0.0-next.3 version: 22.0.0-next.3(@angular/compiler@22.0.0-next.3)(typescript@5.9.3) - typescript-local: - specifier: npm:typescript@5.9.3 - version: typescript@5.9.3 + typescript: + specifier: 5.9.3 + version: 5.9.3 devDependencies: '@angular/build': specifier: 22.0.0-next.1 diff --git a/bazel/rules/rules_angular/src/worker/BUILD.bazel b/bazel/rules/rules_angular/src/worker/BUILD.bazel index bef6d3fca..4dab72be8 100644 --- a/bazel/rules/rules_angular/src/worker/BUILD.bazel +++ b/bazel/rules/rules_angular/src/worker/BUILD.bazel @@ -5,11 +5,17 @@ load("//src/private:symlink_package.bzl", "symlink_package") package(default_visibility = ["//visibility:public"]) +# User configured dependencies symlink_package( name = "node_modules/@angular/compiler-cli", src = "@rules_angular_configurable_deps//:angular_compiler_cli", ) +symlink_package( + name = "node_modules/typescript", + src = "@rules_angular_configurable_deps//:typescript", +) + # --- copy_file( @@ -40,13 +46,13 @@ ts_project( declaration = True, tsconfig = "tsconfig", deps = [ - "//:node_modules/typescript", "//:node_modules/json-stable-stringify", "//:node_modules/lru-cache", "//:node_modules/memfs", # NOTE: The Angular compiler in this target is not affecting any compilation # output, but it's still necessary for some foundational utils like virtual FS. "//:node_modules/@angular/compiler-cli", # compiler from npm. + "//:node_modules/typescript", # typescript from npm. ], ) @@ -62,10 +68,10 @@ ts_project( tsconfig = "tsconfig", deps = [ ":node_modules/@angular/compiler-cli", # user-configured compiler + ":node_modules/typescript", # user-configured typescript "//:node_modules/json-stable-stringify", "//:node_modules/lru-cache", "//:node_modules/memfs", - "//:node_modules/typescript", ], ) diff --git a/bazel/rules/rules_browsers/MODULE.bazel.lock b/bazel/rules/rules_browsers/MODULE.bazel.lock index a7a887502..ebea70f0f 100644 --- a/bazel/rules/rules_browsers/MODULE.bazel.lock +++ b/bazel/rules/rules_browsers/MODULE.bazel.lock @@ -759,7 +759,7 @@ "@@rules_angular+//setup:extensions.bzl%rules_angular": { "general": { "bzlTransitiveDigest": "fkaH7HMicL3g7/NDaFzlq39kcLopMyQ3KdbDn+5CRzA=", - "usagesDigest": "817oO2TO7X12eqL/1sLolLEMte0KVWIlmCGYKTKpY7A=", + "usagesDigest": "bW3NjO5IwkrQn0yIQPRNd4Lb077vl5Gu8AOzyN+zmCw=", "recordedFileInputs": {}, "recordedDirentsInputs": {}, "envVariables": {}, @@ -768,7 +768,7 @@ "repoRuleId": "@@rules_angular+//setup:repositories.bzl%configurable_deps_repo", "attributes": { "angular_compiler_cli": "@@rules_angular+//:node_modules/@angular/compiler-cli", - "typescript": "@@rules_angular+//:node_modules/typescript-local" + "typescript": "@@rules_angular+//:node_modules/typescript" } }, "dev_infra_rules_angular_configurable_deps": { diff --git a/bazel/rules/rules_browsers/test/MODULE.bazel.lock b/bazel/rules/rules_browsers/test/MODULE.bazel.lock index a97257b89..674622dc1 100644 --- a/bazel/rules/rules_browsers/test/MODULE.bazel.lock +++ b/bazel/rules/rules_browsers/test/MODULE.bazel.lock @@ -547,7 +547,7 @@ "@@rules_angular+//setup:extensions.bzl%rules_angular": { "general": { "bzlTransitiveDigest": "fkaH7HMicL3g7/NDaFzlq39kcLopMyQ3KdbDn+5CRzA=", - "usagesDigest": "817oO2TO7X12eqL/1sLolLEMte0KVWIlmCGYKTKpY7A=", + "usagesDigest": "bW3NjO5IwkrQn0yIQPRNd4Lb077vl5Gu8AOzyN+zmCw=", "recordedFileInputs": {}, "recordedDirentsInputs": {}, "envVariables": {}, @@ -556,7 +556,7 @@ "repoRuleId": "@@rules_angular+//setup:repositories.bzl%configurable_deps_repo", "attributes": { "angular_compiler_cli": "@@rules_angular+//:node_modules/@angular/compiler-cli", - "typescript": "@@rules_angular+//:node_modules/typescript-local" + "typescript": "@@rules_angular+//:node_modules/typescript" } }, "dev_infra_rules_angular_configurable_deps": { diff --git a/bazel/rules/rules_sass/MODULE.bazel.lock b/bazel/rules/rules_sass/MODULE.bazel.lock index d339f47bb..e20d1e156 100644 --- a/bazel/rules/rules_sass/MODULE.bazel.lock +++ b/bazel/rules/rules_sass/MODULE.bazel.lock @@ -603,7 +603,7 @@ "@@rules_angular+//setup:extensions.bzl%rules_angular": { "general": { "bzlTransitiveDigest": "fkaH7HMicL3g7/NDaFzlq39kcLopMyQ3KdbDn+5CRzA=", - "usagesDigest": "817oO2TO7X12eqL/1sLolLEMte0KVWIlmCGYKTKpY7A=", + "usagesDigest": "bW3NjO5IwkrQn0yIQPRNd4Lb077vl5Gu8AOzyN+zmCw=", "recordedFileInputs": {}, "recordedDirentsInputs": {}, "envVariables": {}, @@ -612,7 +612,7 @@ "repoRuleId": "@@rules_angular+//setup:repositories.bzl%configurable_deps_repo", "attributes": { "angular_compiler_cli": "@@rules_angular+//:node_modules/@angular/compiler-cli", - "typescript": "@@rules_angular+//:node_modules/typescript-local" + "typescript": "@@rules_angular+//:node_modules/typescript" } }, "dev_infra_rules_angular_configurable_deps": { From 315b182ee8eb8aacc33cf77db2e862712e750ea7 Mon Sep 17 00:00:00 2001 From: Alan Agius <17563226+alan-agius4@users.noreply.github.com> Date: Fri, 13 Mar 2026 07:43:46 +0000 Subject: [PATCH 2/2] refactor(ng-dev): remove 'typescript-local' support from 'sync-module-bazel' Removes the logic and interface definitions for handling the 'typescript-local' dependency alias, as it is no longer used. --- ng-dev/misc/sync-module-bazel/cli.ts | 5 +---- ng-dev/misc/sync-module-bazel/sync-module-bazel.ts | 1 - 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/ng-dev/misc/sync-module-bazel/cli.ts b/ng-dev/misc/sync-module-bazel/cli.ts index 7c74a6ee9..54cc3b198 100644 --- a/ng-dev/misc/sync-module-bazel/cli.ts +++ b/ng-dev/misc/sync-module-bazel/cli.ts @@ -34,10 +34,7 @@ async function handler() { // Read package.json const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8')) as PackageJson; const pnpmVersion = packageJson.engines?.pnpm; - const tsVersion = - packageJson.dependencies?.typescript || - packageJson.devDependencies?.typescript || - packageJson.dependencies?.['typescript-local']?.replace('npm:typescript@', ''); + const tsVersion = packageJson.dependencies?.typescript || packageJson.devDependencies?.typescript; // Read .nvmrc let nvmrcVersion: string | undefined; diff --git a/ng-dev/misc/sync-module-bazel/sync-module-bazel.ts b/ng-dev/misc/sync-module-bazel/sync-module-bazel.ts index e13e13276..c611fcbfe 100644 --- a/ng-dev/misc/sync-module-bazel/sync-module-bazel.ts +++ b/ng-dev/misc/sync-module-bazel/sync-module-bazel.ts @@ -15,7 +15,6 @@ export interface PackageJson { }; dependencies?: { typescript?: string; - 'typescript-local'?: string; }; devDependencies?: { typescript?: string;