@angular/compiler 20.0.0-next.2 → 20.0.0-next.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/compiler.mjs +48 -18
- package/fesm2022/compiler.mjs.map +1 -1
- package/index.d.ts +16 -138
- package/package.json +1 -9
package/fesm2022/compiler.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v20.0.0-next.
|
|
2
|
+
* @license Angular v20.0.0-next.3
|
|
3
3
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -5476,6 +5476,28 @@ let Icu$1 = class Icu {
|
|
|
5476
5476
|
return visitor.visitIcu(this);
|
|
5477
5477
|
}
|
|
5478
5478
|
};
|
|
5479
|
+
/**
|
|
5480
|
+
* AST node that represents the host element of a directive.
|
|
5481
|
+
* This node is used only for type checking purposes and cannot be produced from a user's template.
|
|
5482
|
+
*/
|
|
5483
|
+
class HostElement {
|
|
5484
|
+
tagNames;
|
|
5485
|
+
bindings;
|
|
5486
|
+
listeners;
|
|
5487
|
+
sourceSpan;
|
|
5488
|
+
constructor(tagNames, bindings, listeners, sourceSpan) {
|
|
5489
|
+
this.tagNames = tagNames;
|
|
5490
|
+
this.bindings = bindings;
|
|
5491
|
+
this.listeners = listeners;
|
|
5492
|
+
this.sourceSpan = sourceSpan;
|
|
5493
|
+
if (tagNames.length === 0) {
|
|
5494
|
+
throw new Error('HostElement must have at least one tag name.');
|
|
5495
|
+
}
|
|
5496
|
+
}
|
|
5497
|
+
visit() {
|
|
5498
|
+
throw new Error(`HostElement cannot be visited`);
|
|
5499
|
+
}
|
|
5500
|
+
}
|
|
5479
5501
|
let RecursiveVisitor$1 = class RecursiveVisitor {
|
|
5480
5502
|
visitElement(element) {
|
|
5481
5503
|
visitAll$1(this, element.attributes);
|
|
@@ -22665,7 +22687,6 @@ function enableBindings() {
|
|
|
22665
22687
|
function listener(name, handlerFn, eventTargetResolver, syntheticHost, sourceSpan) {
|
|
22666
22688
|
const args = [literal(name), handlerFn];
|
|
22667
22689
|
if (eventTargetResolver !== null) {
|
|
22668
|
-
args.push(literal(false)); // `useCapture` flag, defaults to `false`
|
|
22669
22690
|
args.push(importExpr(eventTargetResolver));
|
|
22670
22691
|
}
|
|
22671
22692
|
return call(syntheticHost ? Identifiers.syntheticHostListener : Identifiers.listener, args, sourceSpan);
|
|
@@ -29661,7 +29682,7 @@ class R3TargetBinder {
|
|
|
29661
29682
|
* metadata about the types referenced in the template.
|
|
29662
29683
|
*/
|
|
29663
29684
|
bind(target) {
|
|
29664
|
-
if (!target.template) {
|
|
29685
|
+
if (!target.template && !target.host) {
|
|
29665
29686
|
throw new Error('Empty bound targets are not supported');
|
|
29666
29687
|
}
|
|
29667
29688
|
const directives = new Map();
|
|
@@ -29691,6 +29712,11 @@ class R3TargetBinder {
|
|
|
29691
29712
|
// template. This extracts all the metadata that doesn't depend on directive matching.
|
|
29692
29713
|
TemplateBinder.applyWithScope(target.template, scope, expressions, symbols, nestingLevel, usedPipes, eagerPipes, deferBlocks);
|
|
29693
29714
|
}
|
|
29715
|
+
// Bind the host element in a separate scope. Note that it only uses the
|
|
29716
|
+
// `TemplateBinder` since directives don't apply inside a host context.
|
|
29717
|
+
if (target.host) {
|
|
29718
|
+
TemplateBinder.applyWithScope(target.host, Scope.apply(target.host), expressions, symbols, nestingLevel, usedPipes, eagerPipes, deferBlocks);
|
|
29719
|
+
}
|
|
29694
29720
|
return new R3BoundTarget(target, directives, eagerDirectives, bindings, references, expressions, symbols, nestingLevel, scopedNodeEntities, usedPipes, eagerPipes, deferBlocks);
|
|
29695
29721
|
}
|
|
29696
29722
|
}
|
|
@@ -29766,7 +29792,7 @@ class Scope {
|
|
|
29766
29792
|
nodeOrNodes instanceof Content) {
|
|
29767
29793
|
nodeOrNodes.children.forEach((node) => node.visit(this));
|
|
29768
29794
|
}
|
|
29769
|
-
else {
|
|
29795
|
+
else if (!(nodeOrNodes instanceof HostElement)) {
|
|
29770
29796
|
// No overarching `Template` instance, so process the nodes directly.
|
|
29771
29797
|
nodeOrNodes.forEach((node) => node.visit(this));
|
|
29772
29798
|
}
|
|
@@ -30095,7 +30121,7 @@ class TemplateBinder extends RecursiveAstVisitor {
|
|
|
30095
30121
|
/**
|
|
30096
30122
|
* Process a template and extract metadata about expressions and symbols within.
|
|
30097
30123
|
*
|
|
30098
|
-
* @param
|
|
30124
|
+
* @param nodeOrNodes the nodes of the template to process
|
|
30099
30125
|
* @param scope the `Scope` of the template being processed.
|
|
30100
30126
|
* @returns three maps which contain metadata about the template: `expressions` which interprets
|
|
30101
30127
|
* special `AST` nodes in expressions as pointing to references or variables declared within the
|
|
@@ -30104,11 +30130,11 @@ class TemplateBinder extends RecursiveAstVisitor {
|
|
|
30104
30130
|
* nesting level (how many levels deep within the template structure the `Template` is), starting
|
|
30105
30131
|
* at 1.
|
|
30106
30132
|
*/
|
|
30107
|
-
static applyWithScope(
|
|
30108
|
-
const template =
|
|
30133
|
+
static applyWithScope(nodeOrNodes, scope, expressions, symbols, nestingLevel, usedPipes, eagerPipes, deferBlocks) {
|
|
30134
|
+
const template = nodeOrNodes instanceof Template ? nodeOrNodes : null;
|
|
30109
30135
|
// The top-level template has nesting level 0.
|
|
30110
30136
|
const binder = new TemplateBinder(expressions, symbols, usedPipes, eagerPipes, deferBlocks, nestingLevel, scope, template, 0);
|
|
30111
|
-
binder.ingest(
|
|
30137
|
+
binder.ingest(nodeOrNodes);
|
|
30112
30138
|
}
|
|
30113
30139
|
ingest(nodeOrNodes) {
|
|
30114
30140
|
if (nodeOrNodes instanceof Template) {
|
|
@@ -30150,6 +30176,10 @@ class TemplateBinder extends RecursiveAstVisitor {
|
|
|
30150
30176
|
nodeOrNodes.children.forEach((node) => node.visit(this));
|
|
30151
30177
|
this.nestingLevel.set(nodeOrNodes, this.level);
|
|
30152
30178
|
}
|
|
30179
|
+
else if (nodeOrNodes instanceof HostElement) {
|
|
30180
|
+
// Host elements are always at the top level.
|
|
30181
|
+
this.nestingLevel.set(nodeOrNodes, 0);
|
|
30182
|
+
}
|
|
30153
30183
|
else {
|
|
30154
30184
|
// Visit each node from the top-level template.
|
|
30155
30185
|
nodeOrNodes.forEach(this.visitNode);
|
|
@@ -32881,7 +32911,7 @@ const MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION = '18.0.0';
|
|
|
32881
32911
|
function compileDeclareClassMetadata(metadata) {
|
|
32882
32912
|
const definitionMap = new DefinitionMap();
|
|
32883
32913
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
|
|
32884
|
-
definitionMap.set('version', literal('20.0.0-next.
|
|
32914
|
+
definitionMap.set('version', literal('20.0.0-next.3'));
|
|
32885
32915
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
32886
32916
|
definitionMap.set('type', metadata.type);
|
|
32887
32917
|
definitionMap.set('decorators', metadata.decorators);
|
|
@@ -32899,7 +32929,7 @@ function compileComponentDeclareClassMetadata(metadata, dependencies) {
|
|
|
32899
32929
|
callbackReturnDefinitionMap.set('ctorParameters', metadata.ctorParameters ?? literal(null));
|
|
32900
32930
|
callbackReturnDefinitionMap.set('propDecorators', metadata.propDecorators ?? literal(null));
|
|
32901
32931
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION));
|
|
32902
|
-
definitionMap.set('version', literal('20.0.0-next.
|
|
32932
|
+
definitionMap.set('version', literal('20.0.0-next.3'));
|
|
32903
32933
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
32904
32934
|
definitionMap.set('type', metadata.type);
|
|
32905
32935
|
definitionMap.set('resolveDeferredDeps', compileComponentMetadataAsyncResolver(dependencies));
|
|
@@ -32994,7 +33024,7 @@ function createDirectiveDefinitionMap(meta) {
|
|
|
32994
33024
|
const definitionMap = new DefinitionMap();
|
|
32995
33025
|
const minVersion = getMinimumVersionForPartialOutput(meta);
|
|
32996
33026
|
definitionMap.set('minVersion', literal(minVersion));
|
|
32997
|
-
definitionMap.set('version', literal('20.0.0-next.
|
|
33027
|
+
definitionMap.set('version', literal('20.0.0-next.3'));
|
|
32998
33028
|
// e.g. `type: MyDirective`
|
|
32999
33029
|
definitionMap.set('type', meta.type.value);
|
|
33000
33030
|
if (meta.isStandalone !== undefined) {
|
|
@@ -33410,7 +33440,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
|
|
|
33410
33440
|
function compileDeclareFactoryFunction(meta) {
|
|
33411
33441
|
const definitionMap = new DefinitionMap();
|
|
33412
33442
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
|
|
33413
|
-
definitionMap.set('version', literal('20.0.0-next.
|
|
33443
|
+
definitionMap.set('version', literal('20.0.0-next.3'));
|
|
33414
33444
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
33415
33445
|
definitionMap.set('type', meta.type.value);
|
|
33416
33446
|
definitionMap.set('deps', compileDependencies(meta.deps));
|
|
@@ -33445,7 +33475,7 @@ function compileDeclareInjectableFromMetadata(meta) {
|
|
|
33445
33475
|
function createInjectableDefinitionMap(meta) {
|
|
33446
33476
|
const definitionMap = new DefinitionMap();
|
|
33447
33477
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
|
|
33448
|
-
definitionMap.set('version', literal('20.0.0-next.
|
|
33478
|
+
definitionMap.set('version', literal('20.0.0-next.3'));
|
|
33449
33479
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
33450
33480
|
definitionMap.set('type', meta.type.value);
|
|
33451
33481
|
// Only generate providedIn property if it has a non-null value
|
|
@@ -33496,7 +33526,7 @@ function compileDeclareInjectorFromMetadata(meta) {
|
|
|
33496
33526
|
function createInjectorDefinitionMap(meta) {
|
|
33497
33527
|
const definitionMap = new DefinitionMap();
|
|
33498
33528
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
|
|
33499
|
-
definitionMap.set('version', literal('20.0.0-next.
|
|
33529
|
+
definitionMap.set('version', literal('20.0.0-next.3'));
|
|
33500
33530
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
33501
33531
|
definitionMap.set('type', meta.type.value);
|
|
33502
33532
|
definitionMap.set('providers', meta.providers);
|
|
@@ -33529,7 +33559,7 @@ function createNgModuleDefinitionMap(meta) {
|
|
|
33529
33559
|
throw new Error('Invalid path! Local compilation mode should not get into the partial compilation path');
|
|
33530
33560
|
}
|
|
33531
33561
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
|
|
33532
|
-
definitionMap.set('version', literal('20.0.0-next.
|
|
33562
|
+
definitionMap.set('version', literal('20.0.0-next.3'));
|
|
33533
33563
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
33534
33564
|
definitionMap.set('type', meta.type.value);
|
|
33535
33565
|
// We only generate the keys in the metadata if the arrays contain values.
|
|
@@ -33580,7 +33610,7 @@ function compileDeclarePipeFromMetadata(meta) {
|
|
|
33580
33610
|
function createPipeDefinitionMap(meta) {
|
|
33581
33611
|
const definitionMap = new DefinitionMap();
|
|
33582
33612
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
|
|
33583
|
-
definitionMap.set('version', literal('20.0.0-next.
|
|
33613
|
+
definitionMap.set('version', literal('20.0.0-next.3'));
|
|
33584
33614
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
33585
33615
|
// e.g. `type: MyPipe`
|
|
33586
33616
|
definitionMap.set('type', meta.type.value);
|
|
@@ -33738,7 +33768,7 @@ function compileHmrUpdateCallback(definitions, constantStatements, meta) {
|
|
|
33738
33768
|
* @description
|
|
33739
33769
|
* Entry point for all public APIs of the compiler package.
|
|
33740
33770
|
*/
|
|
33741
|
-
const VERSION = new Version('20.0.0-next.
|
|
33771
|
+
const VERSION = new Version('20.0.0-next.3');
|
|
33742
33772
|
|
|
33743
33773
|
//////////////////////////////////////
|
|
33744
33774
|
// THIS FILE HAS GLOBAL SIDE EFFECT //
|
|
@@ -33764,5 +33794,5 @@ const VERSION = new Version('20.0.0-next.2');
|
|
|
33764
33794
|
// the late binding of the Compiler to the @angular/core for jit compilation.
|
|
33765
33795
|
publishFacade(_global);
|
|
33766
33796
|
|
|
33767
|
-
export { AST, ASTWithName, ASTWithSource, AbsoluteSourceSpan, ArrayType, ArrowFunctionExpr, Attribute, Binary, BinaryOperator, BinaryOperatorExpr, BindingPipe, BindingType, Block, BlockParameter, BoundElementProperty, BuiltinType, BuiltinTypeName, CUSTOM_ELEMENTS_SCHEMA, Call, Chain, ChangeDetectionStrategy, CommaExpr, Comment, CompilerConfig, Conditional, ConditionalExpr, ConstantPool, CssSelector, DEFAULT_INTERPOLATION_CONFIG, DYNAMIC_TYPE, DeclareFunctionStmt, DeclareVarStmt, DomElementSchemaRegistry, DynamicImportExpr, EOF, Element, ElementSchemaRegistry, EmitterVisitorContext, EmptyExpr$1 as EmptyExpr, Expansion, ExpansionCase, Expression, ExpressionBinding, ExpressionStatement, ExpressionType, ExternalExpr, ExternalReference, FactoryTarget$1 as FactoryTarget, FunctionExpr, HtmlParser, HtmlTagDefinition, I18NHtmlParser, IfStmt, ImplicitReceiver, InstantiateExpr, Interpolation$1 as Interpolation, InterpolationConfig, InvokeFunctionExpr, JSDocComment, JitEvaluator, KeyedRead, KeyedWrite, LeadingComment, LetDeclaration, Lexer, LiteralArray, LiteralArrayExpr, LiteralExpr, LiteralMap, LiteralMapExpr, LiteralPrimitive, LocalizedString, MapType, MessageBundle, NONE_TYPE, NO_ERRORS_SCHEMA, NodeWithI18n, NonNullAssert, NotExpr, ParenthesizedExpr, ParenthesizedExpression, ParseError, ParseErrorLevel, ParseLocation, ParseSourceFile, ParseSourceSpan, ParseSpan, ParseTreeResult, ParsedEvent, ParsedEventType, ParsedProperty, ParsedPropertyType, ParsedVariable, Parser, ParserError, PrefixNot, PropertyRead, PropertyWrite,
|
|
33797
|
+
export { AST, ASTWithName, ASTWithSource, AbsoluteSourceSpan, ArrayType, ArrowFunctionExpr, Attribute, Binary, BinaryOperator, BinaryOperatorExpr, BindingPipe, BindingType, Block, BlockParameter, BoundElementProperty, BuiltinType, BuiltinTypeName, CUSTOM_ELEMENTS_SCHEMA, Call, Chain, ChangeDetectionStrategy, CommaExpr, Comment, CompilerConfig, Conditional, ConditionalExpr, ConstantPool, CssSelector, DEFAULT_INTERPOLATION_CONFIG, DYNAMIC_TYPE, DeclareFunctionStmt, DeclareVarStmt, DomElementSchemaRegistry, DynamicImportExpr, EOF, Element, ElementSchemaRegistry, EmitterVisitorContext, EmptyExpr$1 as EmptyExpr, Expansion, ExpansionCase, Expression, ExpressionBinding, ExpressionStatement, ExpressionType, ExternalExpr, ExternalReference, FactoryTarget$1 as FactoryTarget, FunctionExpr, HtmlParser, HtmlTagDefinition, I18NHtmlParser, IfStmt, ImplicitReceiver, InstantiateExpr, Interpolation$1 as Interpolation, InterpolationConfig, InvokeFunctionExpr, JSDocComment, JitEvaluator, KeyedRead, KeyedWrite, LeadingComment, LetDeclaration, Lexer, LiteralArray, LiteralArrayExpr, LiteralExpr, LiteralMap, LiteralMapExpr, LiteralPrimitive, LocalizedString, MapType, MessageBundle, NONE_TYPE, NO_ERRORS_SCHEMA, NodeWithI18n, NonNullAssert, NotExpr, ParenthesizedExpr, ParenthesizedExpression, ParseError, ParseErrorLevel, ParseLocation, ParseSourceFile, ParseSourceSpan, ParseSpan, ParseTreeResult, ParsedEvent, ParsedEventType, ParsedProperty, ParsedPropertyType, ParsedVariable, Parser, ParserError, PrefixNot, PropertyRead, PropertyWrite, Identifiers as R3Identifiers, R3NgModuleMetadataKind, R3SelectorScopeMode, R3TargetBinder, R3TemplateDependencyKind, ReadKeyExpr, ReadPropExpr, ReadVarExpr, RecursiveAstVisitor, RecursiveVisitor, ResourceLoader, ReturnStatement, STRING_TYPE, SafeCall, SafeKeyedRead, SafePropertyRead, SelectorContext, SelectorListContext, SelectorMatcher, Serializer, SplitInterpolation, Statement, StmtModifier, StringToken, StringTokenKind, TagContentType, TaggedTemplateLiteral, TaggedTemplateLiteralExpr, TemplateBindingParseResult, TemplateLiteral, TemplateLiteralElement, TemplateLiteralElementExpr, TemplateLiteralExpr, Text, ThisReceiver, BlockNode as TmplAstBlockNode, BoundAttribute as TmplAstBoundAttribute, BoundDeferredTrigger as TmplAstBoundDeferredTrigger, BoundEvent as TmplAstBoundEvent, BoundText as TmplAstBoundText, Content as TmplAstContent, DeferredBlock as TmplAstDeferredBlock, DeferredBlockError as TmplAstDeferredBlockError, DeferredBlockLoading as TmplAstDeferredBlockLoading, DeferredBlockPlaceholder as TmplAstDeferredBlockPlaceholder, DeferredTrigger as TmplAstDeferredTrigger, Element$1 as TmplAstElement, ForLoopBlock as TmplAstForLoopBlock, ForLoopBlockEmpty as TmplAstForLoopBlockEmpty, HostElement as TmplAstHostElement, HoverDeferredTrigger as TmplAstHoverDeferredTrigger, Icu$1 as TmplAstIcu, IdleDeferredTrigger as TmplAstIdleDeferredTrigger, IfBlock as TmplAstIfBlock, IfBlockBranch as TmplAstIfBlockBranch, ImmediateDeferredTrigger as TmplAstImmediateDeferredTrigger, InteractionDeferredTrigger as TmplAstInteractionDeferredTrigger, LetDeclaration$1 as TmplAstLetDeclaration, NeverDeferredTrigger as TmplAstNeverDeferredTrigger, RecursiveVisitor$1 as TmplAstRecursiveVisitor, Reference as TmplAstReference, SwitchBlock as TmplAstSwitchBlock, SwitchBlockCase as TmplAstSwitchBlockCase, Template as TmplAstTemplate, Text$3 as TmplAstText, TextAttribute as TmplAstTextAttribute, TimerDeferredTrigger as TmplAstTimerDeferredTrigger, UnknownBlock as TmplAstUnknownBlock, Variable as TmplAstVariable, ViewportDeferredTrigger as TmplAstViewportDeferredTrigger, Token, TokenType, TransplantedType, TreeError, Type, TypeModifier, TypeofExpr, TypeofExpression, Unary, UnaryOperator, UnaryOperatorExpr, VERSION, VariableBinding, Version, ViewEncapsulation, VoidExpr, VoidExpression, WrappedNodeExpr, WriteKeyExpr, WritePropExpr, WriteVarExpr, Xliff, Xliff2, Xmb, XmlParser, Xtb, compileClassDebugInfo, compileClassMetadata, compileComponentClassMetadata, compileComponentDeclareClassMetadata, compileComponentFromMetadata, compileDeclareClassMetadata, compileDeclareComponentFromMetadata, compileDeclareDirectiveFromMetadata, compileDeclareFactoryFunction, compileDeclareInjectableFromMetadata, compileDeclareInjectorFromMetadata, compileDeclareNgModuleFromMetadata, compileDeclarePipeFromMetadata, compileDeferResolverFunction, compileDirectiveFromMetadata, compileFactoryFunction, compileHmrInitializer, compileHmrUpdateCallback, compileInjectable, compileInjector, compileNgModule, compileOpaqueAsyncClassMetadata, compilePipeFromMetadata, computeMsgId, core, createCssSelectorFromNode, createInjectableType, createMayBeForwardRefExpression, devOnlyGuardedExpression, emitDistinctChangesOnlyDefaultValue, encapsulateStyle, findMatchingDirectivesAndPipes, getHtmlTagDefinition, getNsPrefix, getSafePropertyAccessString, identifierName, isNgContainer, isNgContent, isNgTemplate, jsDocComment, leadingComment, literal, literalMap, makeBindingParser, mergeNsAndName, output_ast as outputAst, parseHostBindings, parseTemplate, preserveWhitespacesDefault, publishFacade, r3JitTypeSourceSpan, sanitizeIdentifier, splitNsName, visitAll$1 as tmplAstVisitAll, verifyHostBindings, visitAll };
|
|
33768
33798
|
//# sourceMappingURL=compiler.mjs.map
|