refactor: update packages/core:{core,src} to ts_project (#61335)

Updates `packages/core:core` and `packages/core/src/...` to `ts_project`
of `rules_js`.

PR Close #61335
This commit is contained in:
Paul Gschwendtner
2025-05-12 12:21:05 +00:00
committed by Alex Rickabaugh
parent 5c1d2eb262
commit 063c3ad281
21 changed files with 93 additions and 46 deletions
+17 -5
View File
@@ -1,7 +1,8 @@
load("@aspect_bazel_lib//lib:copy_to_bin.bzl", "copy_to_bin")
load("@aspect_rules_ts//ts:defs.bzl", rules_js_tsconfig = "ts_config")
load("//:packages.bzl", "DOCS_ENTRYPOINTS")
load("//tools:defaults.bzl", "ts_config", "ts_library")
load("//tools:defaults.bzl", "ts_config")
load("//tools:defaults2.bzl", "ts_project")
package(default_visibility = ["//visibility:public"])
@@ -15,12 +16,23 @@ copy_to_bin(
srcs = ["package.json"],
)
ts_library(
ts_project(
name = "goog_types",
srcs = ["goog.d.ts"],
)
ts_project(
name = "types",
srcs = glob(["*.ts"]),
deps = [
srcs = glob(
["*.ts"],
exclude = ["goog.d.ts"],
),
interop_deps = [
"//packages/zone.js/lib:zone_d_ts",
"@npm//@types/hammerjs",
],
deps = [
":goog_types_rjs",
"//:node_modules/@types/hammerjs",
],
)
+2 -1
View File
@@ -21,7 +21,8 @@ ts_library(
# .d.ts files (by default, jasmine_node_test would get the .js files).
filegroup(
name = "angular_core",
srcs = ["//packages/core"],
srcs = ["//packages/core:core_rjs"],
output_group = "types",
)
jasmine_node_test(
+14 -11
View File
@@ -1,7 +1,8 @@
load("@build_bazel_rules_nodejs//:index.bzl", "generated_file_test")
load("//adev/shared-docs/pipeline/api-gen:generate_api_docs.bzl", "generate_api_docs")
load("//packages/common/locales:index.bzl", "generate_base_locale_file")
load("//tools:defaults.bzl", "api_golden_test", "api_golden_test_npm_package", "ng_module", "ng_package", "tsec_test")
load("//tools:defaults.bzl", "api_golden_test", "api_golden_test_npm_package", "ng_package", "tsec_test")
load("//tools:defaults2.bzl", "ng_project")
package(default_visibility = ["//visibility:public"])
@@ -20,7 +21,7 @@ generated_file_test(
generated = ":base_locale_file_generated",
)
ng_module(
ng_project(
name = "core",
srcs = glob(
[
@@ -28,19 +29,21 @@ ng_module(
"src/**/*.ts",
],
),
deps = [
"//packages:types",
interop_deps = [
"//packages/core/primitives/di",
"//packages/core/primitives/dom-navigation",
"//packages/core/primitives/event-dispatch",
"//packages/core/primitives/signals",
"//packages/core/src/compiler",
"//packages/core/src/di/interface",
"//packages/core/src/interface",
"//packages/core/src/reflection",
"//packages/core/src/util",
"//packages/zone.js/lib:zone_d_ts",
"@npm//rxjs",
],
deps = [
"//:node_modules/rxjs",
"//packages:goog_types_rjs",
"//packages/core/primitives/signals:signals_rjs",
"//packages/core/src/compiler:compiler_rjs",
"//packages/core/src/di/interface:interface_rjs",
"//packages/core/src/interface:interface_rjs",
"//packages/core/src/reflection:reflection_rjs",
"//packages/core/src/util:util_rjs",
],
)
+4 -5
View File
@@ -6,10 +6,9 @@
* found in the LICENSE file at https://angular.dev/license
*/
/* This file is not used to build this module. It is only used during editing
* by the TypeScript language service and during build for verification. `ngc`
* replaces this file with production index.ts when it rewrites private symbol
* names.
*/
// Note: This is needed so that dependent compilations relying on inferred types properly
// emit module names instead of relative imports. Previously, Bazel auto-inserted this.
// TODO: Consider removing this and enforcing proper explicit types.
/// <amd-module name="@angular/core" />
export * from './public_api';
+3 -2
View File
@@ -1,4 +1,5 @@
load("//tools:defaults.bzl", "ts_library", "tsec_test")
load("//tools:defaults.bzl", "tsec_test")
load("//tools:defaults2.bzl", "ts_project")
package(default_visibility = [
"//packages:__pkg__",
@@ -7,7 +8,7 @@ package(default_visibility = [
"//tools/public_api_guard:__pkg__",
])
ts_library(
ts_project(
name = "signals",
srcs = glob(
[
+4 -3
View File
@@ -1,4 +1,5 @@
load("//tools:defaults.bzl", "ts_library", "tsec_test")
load("//tools:defaults.bzl", "tsec_test")
load("//tools:defaults2.bzl", "ts_project")
package(default_visibility = [
"//packages:__pkg__",
@@ -7,7 +8,7 @@ package(default_visibility = [
"//tools/public_api_guard:__pkg__",
])
ts_library(
ts_project(
name = "compiler",
srcs = glob(
[
@@ -15,7 +16,7 @@ ts_library(
],
),
deps = [
"//packages/core/src/util",
"//packages/core/src/util:util_rjs",
],
)
+6 -5
View File
@@ -1,4 +1,5 @@
load("//tools:defaults.bzl", "ts_library", "tsec_test")
load("//tools:defaults.bzl", "tsec_test")
load("//tools:defaults2.bzl", "ts_project")
package(default_visibility = [
"//devtools:__subpackages__",
@@ -7,7 +8,7 @@ package(default_visibility = [
"//tools/public_api_guard:__pkg__",
])
ts_library(
ts_project(
name = "interface",
srcs = glob(
[
@@ -15,9 +16,9 @@ ts_library(
],
),
deps = [
"//packages/core/src/interface",
"//packages/core/src/util",
"@npm//rxjs",
"//:node_modules/rxjs",
"//packages/core/src/interface:interface_rjs",
"//packages/core/src/util:util_rjs",
],
)
+2
View File
@@ -6,6 +6,8 @@
* found in the LICENSE file at https://angular.dev/license
*/
/// <reference path="../../../goog.d.ts" />
import {InjectionToken} from '../di/injection_token';
import {inject} from '../di/injector_compatibility';
+3 -2
View File
@@ -1,4 +1,5 @@
load("//tools:defaults.bzl", "ts_library", "tsec_test")
load("//tools:defaults.bzl", "tsec_test")
load("//tools:defaults2.bzl", "ts_project")
package(default_visibility = [
"//packages:__pkg__",
@@ -6,7 +7,7 @@ package(default_visibility = [
"//tools/public_api_guard:__pkg__",
])
ts_library(
ts_project(
name = "interface",
srcs = glob(
[
+5 -4
View File
@@ -1,4 +1,5 @@
load("//tools:defaults.bzl", "ts_library", "tsec_test")
load("//tools:defaults.bzl", "tsec_test")
load("//tools:defaults2.bzl", "ts_project")
package(default_visibility = [
"//packages:__pkg__",
@@ -6,7 +7,7 @@ package(default_visibility = [
"//tools/public_api_guard:__pkg__",
])
ts_library(
ts_project(
name = "reflection",
srcs = glob(
[
@@ -14,8 +15,8 @@ ts_library(
],
),
deps = [
"//packages/core/src/interface",
"//packages/core/src/util",
"//packages/core/src/interface:interface_rjs",
"//packages/core/src/util:util_rjs",
],
)
@@ -5,6 +5,9 @@
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
/// <reference path="../../../../goog.d.ts" />
import {assertDefined} from '../../util/assert';
import {global} from '../../util/global';
import {setupFrameworkInjectorProfiler} from '../debug/framework_injector_profiler';
+7 -7
View File
@@ -1,4 +1,5 @@
load("//tools:defaults.bzl", "ts_library", "tsec_test")
load("//tools:defaults.bzl", "tsec_test")
load("//tools:defaults2.bzl", "ts_project")
package(default_visibility = [
"//devtools:__subpackages__",
@@ -7,7 +8,7 @@ package(default_visibility = [
"//tools/public_api_guard:__pkg__",
])
ts_library(
ts_project(
name = "util",
srcs = glob(
[
@@ -15,11 +16,10 @@ ts_library(
],
),
deps = [
"//packages:types",
"//packages/core/primitives/signals",
"//packages/core/src/interface",
"//packages/zone.js/lib:zone_d_ts",
"@npm//rxjs",
"//:node_modules/rxjs",
"//packages:goog_types_rjs",
"//packages/core/primitives/signals:signals_rjs",
"//packages/core/src/interface:interface_rjs",
],
)
@@ -6,6 +6,8 @@
* found in the LICENSE file at https://angular.dev/license
*/
/// <reference path="../../../goog.d.ts" />
import {global} from './global';
declare global {
+3
View File
@@ -6,6 +6,9 @@
* found in the LICENSE file at https://angular.dev/license
*/
// Needed for the global `Zone` ambient types to be available.
import type {} from 'zone.js';
import {SCHEDULE_IN_ROOT_ZONE_DEFAULT} from '../change_detection/scheduling/flags';
import {RuntimeError, RuntimeErrorCode} from '../errors';
import {EventEmitter} from '../event_emitter';
@@ -14,6 +14,14 @@ ts_library(
],
)
filegroup(
name = "package_types",
srcs = [
"//packages/core:core_rjs",
],
output_group = "types",
)
jasmine_node_test(
name = "legacy",
data = [
@@ -23,8 +31,8 @@ jasmine_node_test(
# npm_package. Ivy does not currently produce flat dts, so we might
# as well just depend on the outputs of ng_module.
"//packages/common",
"//packages/core",
"//packages/forms",
":package_types",
":project",
],
deps = [
+2
View File
@@ -6,5 +6,7 @@
* found in the LICENSE file at https://angular.dev/license
*/
// TODO(devversion): Remove this file during `rules_js` migration.
/** Dummy typings for systemjs. */
declare var System: any;
+1
View File
@@ -31,6 +31,7 @@
"inlineSources": true,
"importHelpers": true,
"paths": {
"zone.js": ["./zone.js/lib/zone"],
"@angular/*": ["./*/index"]
}
},
+1
View File
@@ -24,6 +24,7 @@
"selenium-webdriver": ["./node_modules/@types/selenium-webdriver/index.d.ts"],
"rxjs/*": ["./node_modules/rxjs/*"],
"@angular/*": ["./packages/*"],
"zone.js": ["./packages/zone.js/lib/zone"],
"zone.js/*": ["./packages/zone.js/*"],
"angular-in-memory-web-api": ["./packages/misc/angular-in-memory-web-api/index.ts"]
},
+2
View File
@@ -6,6 +6,8 @@
* found in the LICENSE file at https://angular.dev/license
*/
// TODO(devversion): Remove this file during `rules_js` migration.
// This file contains all ambient imports needed to compile the packages/ source code
/// <reference types="hammerjs" />
+2
View File
@@ -14,6 +14,8 @@ ts_library(
":zone.ts",
":zone-impl.ts",
],
module_name = "zone.js",
module_root = "zone.d.ts",
deps = [
"@npm//@types/node",
],
+1
View File
@@ -73,6 +73,7 @@ jasmine_node_test(
name = "fail_bootstrap_test",
srcs = ["fail.spec.js"],
bootstrap = ["//tools/testing:node"],
data = ["//packages:package_json"],
# While we force the termination of the process with an exitCode of 55 in fail.spec.js. Jasmine force it to 4.
# see: https://github.com/jasmine/jasmine-npm/blob/eea8b26efe29176ecbb26ce3f1c4990f8bede685/lib/jasmine.js#L213
expected_exit_code = 4,