Skip to content

Commit 2269e2a

Browse files
committed
a02e270 build: properly compile tests in core with Angular compiler (#60268)
1 parent ab69a3e commit 2269e2a

26 files changed

+88
-77
lines changed

BUILD_INFO

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
Thu Mar 6 22:40:34 UTC 2025
2-
aa1ab41e6ce7196ef5f08f928a3dcedd94c1f945
1+
Fri Mar 7 19:06:35 UTC 2025
2+
a02e270fcb84892a7b1a678c0724e3ce0daacbb9

bundles/chunk-4725IYUA.js.map

Lines changed: 0 additions & 6 deletions
This file was deleted.

bundles/chunk-FL3TJEGV.js renamed to bundles/chunk-47SXTUZW.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
File renamed without changes.

bundles/chunk-WGLG3BER.js renamed to bundles/chunk-DDUEHMXH.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
File renamed without changes.

bundles/chunk-4725IYUA.js renamed to bundles/chunk-PM64MB27.js

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@ function toR3Reference(origin, ref, context, refEmitter) {
103103
function isAngularCore(decorator) {
104104
return decorator.import !== null && decorator.import.from === CORE_MODULE;
105105
}
106-
function isAngularCoreReference(reference, symbolName) {
107-
return reference.ownedByModuleGuess === CORE_MODULE && reference.debugName === symbolName;
106+
function isAngularCoreReference(reference, symbolName, isCore) {
107+
return (reference.ownedByModuleGuess === CORE_MODULE || isCore) && reference.debugName === symbolName;
108108
}
109109
function findAngularDecorator(decorators, name, isCore) {
110110
return decorators.find((decorator) => isAngularDecorator(decorator, name, isCore));
@@ -171,17 +171,19 @@ function tryUnwrapForwardRef(node, reflector) {
171171
}
172172
return expr;
173173
}
174-
var forwardRefResolver = (fn, callExpr, resolve, unresolvable) => {
175-
if (!isAngularCoreReference(fn, "forwardRef") || callExpr.arguments.length !== 1) {
176-
return unresolvable;
177-
}
178-
const expanded = expandForwardRef(callExpr.arguments[0]);
179-
if (expanded !== null) {
180-
return resolve(expanded);
181-
} else {
182-
return unresolvable;
183-
}
184-
};
174+
function createForwardRefResolver(isCore) {
175+
return (fn, callExpr, resolve, unresolvable) => {
176+
if (!isAngularCoreReference(fn, "forwardRef", isCore) || callExpr.arguments.length !== 1) {
177+
return unresolvable;
178+
}
179+
const expanded = expandForwardRef(callExpr.arguments[0]);
180+
if (expanded !== null) {
181+
return resolve(expanded);
182+
} else {
183+
return unresolvable;
184+
}
185+
};
186+
}
185187
function combineResolvers(resolvers) {
186188
return (fn, callExpr, resolve, unresolvable) => {
187189
for (const resolver of resolvers) {
@@ -3515,12 +3517,12 @@ function assertLocalCompilationUnresolvedConst(compilationMode, value, nodeToHig
35153517
// bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/annotations/common/src/evaluation.mjs
35163518
import { ViewEncapsulation } from "@angular/compiler";
35173519
import ts13 from "typescript";
3518-
function resolveEnumValue(evaluator, metadata, field, enumSymbolName) {
3520+
function resolveEnumValue(evaluator, metadata, field, enumSymbolName, isCore) {
35193521
let resolved = null;
35203522
if (metadata.has(field)) {
35213523
const expr = metadata.get(field);
35223524
const value = evaluator.evaluate(expr);
3523-
if (value instanceof EnumValue && isAngularCoreReference(value.enumRef, enumSymbolName)) {
3525+
if (value instanceof EnumValue && isAngularCoreReference(value.enumRef, enumSymbolName, isCore)) {
35243526
resolved = value.resolved;
35253527
} else {
35263528
throw createValueHasWrongTypeError(expr, value, `${field} must be a member of ${enumSymbolName} enum from @angular/core`);
@@ -5007,7 +5009,7 @@ function extractDirectiveMetadata(clazz, decorator, reflector, importTracker, ev
50075009
const sourceFile = clazz.getSourceFile();
50085010
const type = wrapTypeReference(reflector, clazz);
50095011
const rawHostDirectives = directive.get("hostDirectives") || null;
5010-
const hostDirectives = rawHostDirectives === null ? null : extractHostDirectives(rawHostDirectives, evaluator, compilationMode);
5012+
const hostDirectives = rawHostDirectives === null ? null : extractHostDirectives(rawHostDirectives, evaluator, compilationMode, createForwardRefResolver(isCore));
50115013
if (compilationMode !== CompilationMode.LOCAL && hostDirectives !== null) {
50125014
referencesRegistry.add(clazz, ...hostDirectives.map((hostDir) => {
50135015
if (!isHostDirectiveMetaForGlobalMode(hostDir)) {
@@ -5644,7 +5646,7 @@ function getHostBindingErrorNode(error, hostExpr) {
56445646
}
56455647
return hostExpr;
56465648
}
5647-
function extractHostDirectives(rawHostDirectives, evaluator, compilationMode) {
5649+
function extractHostDirectives(rawHostDirectives, evaluator, compilationMode, forwardRefResolver) {
56485650
const resolved = evaluator.evaluate(rawHostDirectives, forwardRefResolver);
56495651
if (!Array.isArray(resolved)) {
56505652
throw createValueHasWrongTypeError(rawHostDirectives, resolved, "hostDirectives must be an array");
@@ -6240,6 +6242,7 @@ var NgModuleDecoratorHandler = class {
62406242
this.jitDeclarationRegistry.jitDeclarations.add(node);
62416243
return {};
62426244
}
6245+
const forwardRefResolver = createForwardRefResolver(this.isCore);
62436246
const moduleResolvers = combineResolvers([
62446247
createModuleWithProvidersResolver(this.reflector, this.isCore),
62456248
forwardRefResolver
@@ -14155,10 +14158,10 @@ var ComponentDecoratorHandler = class {
1415514158
return {};
1415614159
}
1415714160
const { decorator: component, metadata, inputs, outputs, hostDirectives, rawHostDirectives } = directiveResult;
14158-
const encapsulation = (_a = this.compilationMode !== CompilationMode.LOCAL ? resolveEnumValue(this.evaluator, component, "encapsulation", "ViewEncapsulation") : resolveEncapsulationEnumValueLocally(component.get("encapsulation"))) != null ? _a : ViewEncapsulation2.Emulated;
14161+
const encapsulation = (_a = this.compilationMode !== CompilationMode.LOCAL ? resolveEnumValue(this.evaluator, component, "encapsulation", "ViewEncapsulation", this.isCore) : resolveEncapsulationEnumValueLocally(component.get("encapsulation"))) != null ? _a : ViewEncapsulation2.Emulated;
1415914162
let changeDetection = null;
1416014163
if (this.compilationMode !== CompilationMode.LOCAL) {
14161-
changeDetection = resolveEnumValue(this.evaluator, component, "changeDetection", "ChangeDetectionStrategy");
14164+
changeDetection = resolveEnumValue(this.evaluator, component, "changeDetection", "ChangeDetectionStrategy", this.isCore);
1416214165
} else if (component.has("changeDetection")) {
1416314166
changeDetection = new o4.WrappedNodeExpr(component.get("changeDetection"));
1416414167
}
@@ -14206,7 +14209,7 @@ var ComponentDecoratorHandler = class {
1420614209
} else if (this.compilationMode !== CompilationMode.LOCAL && (rawImports || rawDeferredImports)) {
1420714210
const importResolvers = combineResolvers([
1420814211
createModuleWithProvidersResolver(this.reflector, this.isCore),
14209-
forwardRefResolver
14212+
createForwardRefResolver(this.isCore)
1421014213
]);
1421114214
const importDiagnostics = [];
1421214215
if (rawImports) {
@@ -15554,7 +15557,7 @@ var PipeDecoratorHandler = class {
1555415557
export {
1555515558
isAngularDecorator,
1555615559
getAngularDecorators,
15557-
forwardRefResolver,
15560+
createForwardRefResolver,
1555815561
MetaKind,
1555915562
CompoundMetadataReader,
1556015563
DtsMetadataReader,
@@ -15624,4 +15627,4 @@ export {
1562415627
* Use of this source code is governed by an MIT-style license that can be
1562515628
* found in the LICENSE file at https://angular.dev/license
1562615629
*/
15627-
//# sourceMappingURL=chunk-4725IYUA.js.map
15630+
//# sourceMappingURL=chunk-PM64MB27.js.map

bundles/chunk-PM64MB27.js.map

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bundles/chunk-D52HDHKW.js renamed to bundles/chunk-Q4CENXML.js

Lines changed: 11 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)