@angular/compiler 18.1.0-next.0 → 18.1.0-next.2
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/esm2022/src/compiler.mjs +2 -2
- package/esm2022/src/i18n/extractor_merger.mjs +2 -1
- package/esm2022/src/i18n/i18n_parser.mjs +4 -1
- package/esm2022/src/i18n/serializers/xliff.mjs +3 -1
- package/esm2022/src/i18n/serializers/xliff2.mjs +3 -1
- package/esm2022/src/i18n/serializers/xtb.mjs +3 -1
- package/esm2022/src/ml_parser/ast.mjs +14 -1
- package/esm2022/src/ml_parser/html_whitespaces.mjs +4 -1
- package/esm2022/src/ml_parser/icu_ast_expander.mjs +4 -1
- package/esm2022/src/ml_parser/lexer.mjs +83 -2
- package/esm2022/src/ml_parser/parser.mjs +57 -4
- package/esm2022/src/ml_parser/tokens.mjs +1 -1
- package/esm2022/src/ml_parser/xml_parser.mjs +3 -3
- package/esm2022/src/render3/partial/class_metadata.mjs +2 -2
- package/esm2022/src/render3/partial/directive.mjs +1 -1
- package/esm2022/src/render3/partial/factory.mjs +1 -1
- package/esm2022/src/render3/partial/injectable.mjs +1 -1
- package/esm2022/src/render3/partial/injector.mjs +1 -1
- package/esm2022/src/render3/partial/ng_module.mjs +1 -1
- package/esm2022/src/render3/partial/pipe.mjs +1 -1
- package/esm2022/src/render3/r3_ast.mjs +14 -1
- package/esm2022/src/render3/r3_template_transform.mjs +12 -1
- package/esm2022/src/render3/view/i18n/meta.mjs +4 -1
- package/esm2022/src/render3/view/t2_api.mjs +1 -1
- package/esm2022/src/render3/view/t2_binder.mjs +20 -4
- package/esm2022/src/render3/view/template.mjs +2 -1
- package/esm2022/src/template/pipeline/src/ingest.mjs +4 -1
- package/esm2022/src/version.mjs +1 -1
- package/fesm2022/compiler.mjs +224 -18
- package/fesm2022/compiler.mjs.map +1 -1
- package/index.d.ts +52 -11
- package/package.json +3 -3
package/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v18.1.0-next.
|
|
2
|
+
* @license Angular v18.1.0-next.2
|
|
3
3
|
* (c) 2010-2024 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -525,14 +525,14 @@ export declare interface BoundTarget<DirectiveT extends DirectiveMeta> {
|
|
|
525
525
|
* This is only defined for `AST` expressions that read or write to a property of an
|
|
526
526
|
* `ImplicitReceiver`.
|
|
527
527
|
*/
|
|
528
|
-
getExpressionTarget(expr: AST):
|
|
528
|
+
getExpressionTarget(expr: AST): TemplateEntity | null;
|
|
529
529
|
/**
|
|
530
530
|
* Given a particular `Reference` or `Variable`, get the `ScopedNode` which created it.
|
|
531
531
|
*
|
|
532
532
|
* All `Variable`s are defined on node, so this will always return a value for a `Variable`
|
|
533
533
|
* from the `Target`. Returns `null` otherwise.
|
|
534
534
|
*/
|
|
535
|
-
getDefinitionNodeOfSymbol(symbol:
|
|
535
|
+
getDefinitionNodeOfSymbol(symbol: TemplateEntity): ScopedNode | null;
|
|
536
536
|
/**
|
|
537
537
|
* Get the nesting level of a particular `ScopedNode`.
|
|
538
538
|
*
|
|
@@ -544,7 +544,7 @@ export declare interface BoundTarget<DirectiveT extends DirectiveMeta> {
|
|
|
544
544
|
* Get all `Reference`s and `Variables` visible within the given `ScopedNode` (or at the top
|
|
545
545
|
* level, if `null` is passed).
|
|
546
546
|
*/
|
|
547
|
-
getEntitiesInScope(node: ScopedNode | null): ReadonlySet<
|
|
547
|
+
getEntitiesInScope(node: ScopedNode | null): ReadonlySet<TemplateEntity>;
|
|
548
548
|
/**
|
|
549
549
|
* Get a list of all the directives used by the target,
|
|
550
550
|
* including directives from `@defer` blocks.
|
|
@@ -1479,6 +1479,7 @@ declare namespace html {
|
|
|
1479
1479
|
Comment_2 as Comment,
|
|
1480
1480
|
Block,
|
|
1481
1481
|
BlockParameter,
|
|
1482
|
+
LetDeclaration,
|
|
1482
1483
|
Visitor,
|
|
1483
1484
|
RecursiveVisitor
|
|
1484
1485
|
}
|
|
@@ -1804,6 +1805,16 @@ export declare function leadingComment(text: string, multiline?: boolean, traili
|
|
|
1804
1805
|
|
|
1805
1806
|
export declare type LegacyInputPartialMapping = string | [bindingPropertyName: string, classPropertyName: string, transformFunction?: outputAst.Expression];
|
|
1806
1807
|
|
|
1808
|
+
export declare class LetDeclaration implements BaseNode {
|
|
1809
|
+
name: string;
|
|
1810
|
+
value: string;
|
|
1811
|
+
sourceSpan: ParseSourceSpan;
|
|
1812
|
+
readonly nameSpan: ParseSourceSpan;
|
|
1813
|
+
valueSpan: ParseSourceSpan;
|
|
1814
|
+
constructor(name: string, value: string, sourceSpan: ParseSourceSpan, nameSpan: ParseSourceSpan, valueSpan: ParseSourceSpan);
|
|
1815
|
+
visit(visitor: Visitor, context: any): any;
|
|
1816
|
+
}
|
|
1817
|
+
|
|
1807
1818
|
export declare class Lexer {
|
|
1808
1819
|
tokenize(text: string): Token[];
|
|
1809
1820
|
}
|
|
@@ -1845,7 +1856,11 @@ export declare const enum LexerTokenType {
|
|
|
1845
1856
|
BLOCK_CLOSE = 26,
|
|
1846
1857
|
BLOCK_PARAMETER = 27,
|
|
1847
1858
|
INCOMPLETE_BLOCK_OPEN = 28,
|
|
1848
|
-
|
|
1859
|
+
LET_START = 29,
|
|
1860
|
+
LET_VALUE = 30,
|
|
1861
|
+
LET_END = 31,
|
|
1862
|
+
INCOMPLETE_LET = 32,
|
|
1863
|
+
EOF = 33
|
|
1849
1864
|
}
|
|
1850
1865
|
|
|
1851
1866
|
export declare function literal(value: any, type?: Type | null, sourceSpan?: ParseSourceSpan | null): LiteralExpr;
|
|
@@ -2614,6 +2629,8 @@ export declare interface ParseTemplateOptions {
|
|
|
2614
2629
|
collectCommentNodes?: boolean;
|
|
2615
2630
|
/** Whether the @ block syntax is enabled. */
|
|
2616
2631
|
enableBlockSyntax?: boolean;
|
|
2632
|
+
/** Whether the `@let` syntax is enabled. */
|
|
2633
|
+
enableLetSyntax?: boolean;
|
|
2617
2634
|
/**
|
|
2618
2635
|
* Whether the parser should allow invalid two-way bindings.
|
|
2619
2636
|
*
|
|
@@ -2712,13 +2729,13 @@ export declare class R3BoundTarget<DirectiveT extends DirectiveMeta> implements
|
|
|
2712
2729
|
constructor(target: Target, directives: Map<TmplAstElement | TmplAstTemplate, DirectiveT[]>, eagerDirectives: DirectiveT[], bindings: Map<TmplAstBoundAttribute | TmplAstBoundEvent | TmplAstTextAttribute, DirectiveT | TmplAstElement | TmplAstTemplate>, references: Map<TmplAstBoundAttribute | TmplAstBoundEvent | TmplAstReference | TmplAstTextAttribute, {
|
|
2713
2730
|
directive: DirectiveT;
|
|
2714
2731
|
node: TmplAstElement | TmplAstTemplate;
|
|
2715
|
-
} | TmplAstElement | TmplAstTemplate>, exprTargets: Map<AST,
|
|
2716
|
-
getEntitiesInScope(node: ScopedNode | null): ReadonlySet<
|
|
2732
|
+
} | TmplAstElement | TmplAstTemplate>, exprTargets: Map<AST, TemplateEntity>, symbols: Map<TemplateEntity, TmplAstTemplate>, nestingLevel: Map<ScopedNode, number>, scopedNodeEntities: Map<ScopedNode | null, ReadonlySet<TemplateEntity>>, usedPipes: Set<string>, eagerPipes: Set<string>, rawDeferred: [TmplAstDeferredBlock, Scope][]);
|
|
2733
|
+
getEntitiesInScope(node: ScopedNode | null): ReadonlySet<TemplateEntity>;
|
|
2717
2734
|
getDirectivesOfNode(node: TmplAstElement | TmplAstTemplate): DirectiveT[] | null;
|
|
2718
2735
|
getReferenceTarget(ref: TmplAstReference): ReferenceTarget<DirectiveT> | null;
|
|
2719
2736
|
getConsumerOfBinding(binding: TmplAstBoundAttribute | TmplAstBoundEvent | TmplAstTextAttribute): DirectiveT | TmplAstElement | TmplAstTemplate | null;
|
|
2720
|
-
getExpressionTarget(expr: AST):
|
|
2721
|
-
getDefinitionNodeOfSymbol(symbol:
|
|
2737
|
+
getExpressionTarget(expr: AST): TemplateEntity | null;
|
|
2738
|
+
getDefinitionNodeOfSymbol(symbol: TemplateEntity): ScopedNode | null;
|
|
2722
2739
|
getNestingLevel(node: ScopedNode): number;
|
|
2723
2740
|
getUsedDirectives(): DirectiveT[];
|
|
2724
2741
|
getEagerlyUsedDirectives(): DirectiveT[];
|
|
@@ -4369,6 +4386,7 @@ export declare class RecursiveVisitor implements Visitor {
|
|
|
4369
4386
|
visitExpansionCase(ast: ExpansionCase, context: any): any;
|
|
4370
4387
|
visitBlock(block: Block, context: any): any;
|
|
4371
4388
|
visitBlockParameter(ast: BlockParameter, context: any): any;
|
|
4389
|
+
visitLetDeclaration(decl: LetDeclaration, context: any): void;
|
|
4372
4390
|
private visitChildren;
|
|
4373
4391
|
}
|
|
4374
4392
|
|
|
@@ -4451,7 +4469,7 @@ declare class Scope implements TmplAstVisitor {
|
|
|
4451
4469
|
/**
|
|
4452
4470
|
* Named members of the `Scope`, such as `Reference`s or `Variable`s.
|
|
4453
4471
|
*/
|
|
4454
|
-
readonly namedEntities: Map<string,
|
|
4472
|
+
readonly namedEntities: Map<string, TemplateEntity>;
|
|
4455
4473
|
/**
|
|
4456
4474
|
* Set of elements that belong to this scope.
|
|
4457
4475
|
*/
|
|
@@ -4488,6 +4506,7 @@ declare class Scope implements TmplAstVisitor {
|
|
|
4488
4506
|
visitIfBlock(block: TmplAstIfBlock): void;
|
|
4489
4507
|
visitIfBlockBranch(block: TmplAstIfBlockBranch): void;
|
|
4490
4508
|
visitContent(content: TmplAstContent): void;
|
|
4509
|
+
visitLetDeclaration(decl: TmplAstLetDeclaration): void;
|
|
4491
4510
|
visitBoundAttribute(attr: TmplAstBoundAttribute): void;
|
|
4492
4511
|
visitBoundEvent(event: TmplAstBoundEvent): void;
|
|
4493
4512
|
visitBoundText(text: TmplAstBoundText): void;
|
|
@@ -4502,7 +4521,7 @@ declare class Scope implements TmplAstVisitor {
|
|
|
4502
4521
|
*
|
|
4503
4522
|
* This can recurse into a parent `Scope` if it's available.
|
|
4504
4523
|
*/
|
|
4505
|
-
lookup(name: string):
|
|
4524
|
+
lookup(name: string): TemplateEntity | null;
|
|
4506
4525
|
/**
|
|
4507
4526
|
* Get the child scope for a `ScopedNode`.
|
|
4508
4527
|
*
|
|
@@ -4700,6 +4719,7 @@ declare namespace t {
|
|
|
4700
4719
|
TmplAstIfBlock as IfBlock,
|
|
4701
4720
|
TmplAstIfBlockBranch as IfBlockBranch,
|
|
4702
4721
|
TmplAstUnknownBlock as UnknownBlock,
|
|
4722
|
+
TmplAstLetDeclaration as LetDeclaration,
|
|
4703
4723
|
TmplAstTemplate as Template,
|
|
4704
4724
|
TmplAstContent as Content,
|
|
4705
4725
|
TmplAstVariable as Variable,
|
|
@@ -4808,6 +4828,9 @@ export declare class TemplateBindingParseResult {
|
|
|
4808
4828
|
constructor(templateBindings: TemplateBinding[], warnings: string[], errors: ParserError[]);
|
|
4809
4829
|
}
|
|
4810
4830
|
|
|
4831
|
+
/** Entity that is local to the template and defined within the template. */
|
|
4832
|
+
export declare type TemplateEntity = TmplAstReference | TmplAstVariable | TmplAstLetDeclaration;
|
|
4833
|
+
|
|
4811
4834
|
export declare class TemplateLiteral {
|
|
4812
4835
|
elements: TemplateLiteralElement[];
|
|
4813
4836
|
expressions: Expression[];
|
|
@@ -5060,6 +5083,16 @@ export declare class TmplAstInteractionDeferredTrigger extends TmplAstDeferredTr
|
|
|
5060
5083
|
constructor(reference: string | null, nameSpan: ParseSourceSpan, sourceSpan: ParseSourceSpan, prefetchSpan: ParseSourceSpan | null, onSourceSpan: ParseSourceSpan | null);
|
|
5061
5084
|
}
|
|
5062
5085
|
|
|
5086
|
+
export declare class TmplAstLetDeclaration implements TmplAstNode {
|
|
5087
|
+
name: string;
|
|
5088
|
+
value: AST;
|
|
5089
|
+
sourceSpan: ParseSourceSpan;
|
|
5090
|
+
nameSpan: ParseSourceSpan;
|
|
5091
|
+
valueSpan: ParseSourceSpan;
|
|
5092
|
+
constructor(name: string, value: AST, sourceSpan: ParseSourceSpan, nameSpan: ParseSourceSpan, valueSpan: ParseSourceSpan);
|
|
5093
|
+
visit<Result>(visitor: TmplAstVisitor<Result>): Result;
|
|
5094
|
+
}
|
|
5095
|
+
|
|
5063
5096
|
export declare interface TmplAstNode {
|
|
5064
5097
|
sourceSpan: ParseSourceSpan;
|
|
5065
5098
|
visit<Result>(visitor: TmplAstVisitor<Result>): Result;
|
|
@@ -5089,6 +5122,7 @@ export declare class TmplAstRecursiveVisitor implements TmplAstVisitor<void> {
|
|
|
5089
5122
|
visitIcu(icu: TmplAstIcu): void;
|
|
5090
5123
|
visitDeferredTrigger(trigger: TmplAstDeferredTrigger): void;
|
|
5091
5124
|
visitUnknownBlock(block: TmplAstUnknownBlock): void;
|
|
5125
|
+
visitLetDeclaration(decl: TmplAstLetDeclaration): void;
|
|
5092
5126
|
}
|
|
5093
5127
|
|
|
5094
5128
|
export declare class TmplAstReference implements TmplAstNode {
|
|
@@ -5222,6 +5256,7 @@ export declare interface TmplAstVisitor<Result = any> {
|
|
|
5222
5256
|
visitIfBlock(block: TmplAstIfBlock): Result;
|
|
5223
5257
|
visitIfBlockBranch(block: TmplAstIfBlockBranch): Result;
|
|
5224
5258
|
visitUnknownBlock(block: TmplAstUnknownBlock): Result;
|
|
5259
|
+
visitLetDeclaration(decl: TmplAstLetDeclaration): Result;
|
|
5225
5260
|
}
|
|
5226
5261
|
|
|
5227
5262
|
export declare class Token {
|
|
@@ -5317,6 +5352,11 @@ declare interface TokenizeOptions {
|
|
|
5317
5352
|
* or ICU tokens if `tokenizeExpansionForms` is enabled.
|
|
5318
5353
|
*/
|
|
5319
5354
|
tokenizeBlocks?: boolean;
|
|
5355
|
+
/**
|
|
5356
|
+
* Whether to tokenize the `@let` syntax. Otherwise will be considered either
|
|
5357
|
+
* text or an incomplete block, depending on whether `tokenizeBlocks` is enabled.
|
|
5358
|
+
*/
|
|
5359
|
+
tokenizeLet?: boolean;
|
|
5320
5360
|
}
|
|
5321
5361
|
|
|
5322
5362
|
|
|
@@ -5481,6 +5521,7 @@ export declare interface Visitor {
|
|
|
5481
5521
|
visitExpansionCase(expansionCase: ExpansionCase, context: any): any;
|
|
5482
5522
|
visitBlock(block: Block, context: any): any;
|
|
5483
5523
|
visitBlockParameter(parameter: BlockParameter, context: any): any;
|
|
5524
|
+
visitLetDeclaration(decl: LetDeclaration, context: any): any;
|
|
5484
5525
|
}
|
|
5485
5526
|
|
|
5486
5527
|
declare interface Visitor_2 {
|
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@angular/compiler",
|
|
3
|
-
"version": "18.1.0-next.
|
|
3
|
+
"version": "18.1.0-next.2",
|
|
4
4
|
"description": "Angular - the compiler library",
|
|
5
5
|
"author": "angular",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"engines": {
|
|
8
|
-
"node": "^18.
|
|
8
|
+
"node": "^18.19.1 || ^20.11.1 || >=22.0.0"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"tslib": "^2.3.0"
|
|
12
12
|
},
|
|
13
13
|
"peerDependencies": {
|
|
14
|
-
"@angular/core": "18.1.0-next.
|
|
14
|
+
"@angular/core": "18.1.0-next.2"
|
|
15
15
|
},
|
|
16
16
|
"peerDependenciesMeta": {
|
|
17
17
|
"@angular/core": {
|