@angular/compiler 22.0.0-next.4 → 22.0.0-next.5
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 +80 -33
- package/fesm2022/compiler.mjs.map +1 -1
- package/package.json +1 -1
- package/types/compiler.d.ts +4 -3
package/fesm2022/compiler.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v22.0.0-next.
|
|
2
|
+
* @license Angular v22.0.0-next.5
|
|
3
3
|
* (c) 2010-2026 Google LLC. https://angular.dev/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -3623,7 +3623,13 @@ class AbstractEmitterVisitor {
|
|
|
3623
3623
|
}
|
|
3624
3624
|
visitDynamicImportExpr(ast, ctx) {
|
|
3625
3625
|
this.printLeadingComments(ast, ctx);
|
|
3626
|
-
ctx.print(ast, `import(
|
|
3626
|
+
ctx.print(ast, `import(`);
|
|
3627
|
+
if (typeof ast.url === 'string') {
|
|
3628
|
+
ctx.print(ast, escapeIdentifier(ast.url, true));
|
|
3629
|
+
} else {
|
|
3630
|
+
ast.url.visitExpression(this, ctx);
|
|
3631
|
+
}
|
|
3632
|
+
ctx.print(ast, `)`);
|
|
3627
3633
|
}
|
|
3628
3634
|
visitNotExpr(ast, ctx) {
|
|
3629
3635
|
this.printLeadingComments(ast, ctx);
|
|
@@ -3634,13 +3640,14 @@ class AbstractEmitterVisitor {
|
|
|
3634
3640
|
this.printLeadingComments(ast, ctx);
|
|
3635
3641
|
ctx.print(ast, `function${ast.name ? ' ' + ast.name : ''}(`);
|
|
3636
3642
|
this.visitParams(ast.params, ctx);
|
|
3637
|
-
ctx.
|
|
3643
|
+
ctx.print(ast, `)`);
|
|
3638
3644
|
ast.type?.visitType(this, ctx);
|
|
3639
|
-
ctx.
|
|
3645
|
+
ctx.print(ast, ` {`);
|
|
3646
|
+
ctx.println(ast);
|
|
3640
3647
|
ctx.incIndent();
|
|
3641
3648
|
this.visitAllStatements(ast.statements, ctx);
|
|
3642
3649
|
ctx.decIndent();
|
|
3643
|
-
ctx.
|
|
3650
|
+
ctx.println(ast, `}`);
|
|
3644
3651
|
}
|
|
3645
3652
|
visitArrowFunctionExpr(ast, ctx) {
|
|
3646
3653
|
this.printLeadingComments(ast, ctx);
|
|
@@ -3648,13 +3655,14 @@ class AbstractEmitterVisitor {
|
|
|
3648
3655
|
this.visitParams(ast.params, ctx);
|
|
3649
3656
|
ctx.print(ast, ')');
|
|
3650
3657
|
ast.type?.visitType(this, ctx);
|
|
3651
|
-
ctx.print(ast, ' =>');
|
|
3658
|
+
ctx.print(ast, ' => ');
|
|
3652
3659
|
if (Array.isArray(ast.body)) {
|
|
3653
|
-
ctx.
|
|
3660
|
+
ctx.print(ast, `{`);
|
|
3661
|
+
ctx.println(ast);
|
|
3654
3662
|
ctx.incIndent();
|
|
3655
3663
|
this.visitAllStatements(ast.body, ctx);
|
|
3656
3664
|
ctx.decIndent();
|
|
3657
|
-
ctx.
|
|
3665
|
+
ctx.println(ast, `}`);
|
|
3658
3666
|
} else {
|
|
3659
3667
|
const shouldParenthesize = this.shouldParenthesize(ast.body, ast);
|
|
3660
3668
|
if (shouldParenthesize) {
|
|
@@ -3670,9 +3678,10 @@ class AbstractEmitterVisitor {
|
|
|
3670
3678
|
this.printLeadingComments(stmt, ctx);
|
|
3671
3679
|
ctx.print(stmt, `function ${stmt.name}(`);
|
|
3672
3680
|
this.visitParams(stmt.params, ctx);
|
|
3673
|
-
ctx.
|
|
3681
|
+
ctx.print(stmt, `)`);
|
|
3674
3682
|
stmt.type?.visitType(this, ctx);
|
|
3675
|
-
ctx.
|
|
3683
|
+
ctx.print(stmt, ` {`);
|
|
3684
|
+
ctx.println(stmt);
|
|
3676
3685
|
ctx.incIndent();
|
|
3677
3686
|
this.visitAllStatements(stmt.statements, ctx);
|
|
3678
3687
|
ctx.decIndent();
|
|
@@ -5129,8 +5138,10 @@ class SwitchBlockCaseGroup extends BlockNode {
|
|
|
5129
5138
|
}
|
|
5130
5139
|
}
|
|
5131
5140
|
class SwitchExhaustiveCheck extends BlockNode {
|
|
5132
|
-
|
|
5141
|
+
expression;
|
|
5142
|
+
constructor(expression, sourceSpan, startSourceSpan, endSourceSpan, nameSpan) {
|
|
5133
5143
|
super(nameSpan, sourceSpan, startSourceSpan, endSourceSpan);
|
|
5144
|
+
this.expression = expression;
|
|
5134
5145
|
}
|
|
5135
5146
|
visit(visitor) {
|
|
5136
5147
|
return visitor.visitSwitchExhaustiveCheck(this);
|
|
@@ -6950,7 +6961,7 @@ class ShadowCss {
|
|
|
6950
6961
|
comments.push(m);
|
|
6951
6962
|
} else {
|
|
6952
6963
|
const newLinesMatches = m.match(_newLinesRe);
|
|
6953
|
-
comments.push(
|
|
6964
|
+
comments.push(newLinesMatches?.join('') ?? '');
|
|
6954
6965
|
}
|
|
6955
6966
|
return COMMENT_PLACEHOLDER;
|
|
6956
6967
|
});
|
|
@@ -13747,13 +13758,6 @@ class _Tokenizer {
|
|
|
13747
13758
|
this._requireCharCode($AT);
|
|
13748
13759
|
this._beginToken(24, start);
|
|
13749
13760
|
const startToken = this._endToken([this._getBlockName()]);
|
|
13750
|
-
if (startToken.parts[0] === 'default never' && this._attemptCharCode($SEMICOLON)) {
|
|
13751
|
-
this._beginToken(25);
|
|
13752
|
-
this._endToken([]);
|
|
13753
|
-
this._beginToken(26);
|
|
13754
|
-
this._endToken([]);
|
|
13755
|
-
return;
|
|
13756
|
-
}
|
|
13757
13761
|
if (this._cursor.peek() === $LPAREN) {
|
|
13758
13762
|
this._cursor.advance();
|
|
13759
13763
|
this._consumeBlockParameters();
|
|
@@ -13765,6 +13769,13 @@ class _Tokenizer {
|
|
|
13765
13769
|
return;
|
|
13766
13770
|
}
|
|
13767
13771
|
}
|
|
13772
|
+
if (startToken.parts[0] === 'default never' && this._attemptCharCode($SEMICOLON)) {
|
|
13773
|
+
this._beginToken(25);
|
|
13774
|
+
this._endToken([]);
|
|
13775
|
+
this._beginToken(26);
|
|
13776
|
+
this._endToken([]);
|
|
13777
|
+
return;
|
|
13778
|
+
}
|
|
13768
13779
|
if (this._attemptCharCode($LBRACE)) {
|
|
13769
13780
|
this._beginToken(25);
|
|
13770
13781
|
this._endToken([]);
|
|
@@ -14128,6 +14139,26 @@ class _Tokenizer {
|
|
|
14128
14139
|
const name = this._cursor.getChars(nameStart);
|
|
14129
14140
|
return [prefix, name];
|
|
14130
14141
|
}
|
|
14142
|
+
_consumeSingleLineComment() {
|
|
14143
|
+
this._attemptCharCodeUntilFn(code => isNewLine(code) || code === $EOF);
|
|
14144
|
+
this._attemptCharCodeUntilFn(isNotWhitespace);
|
|
14145
|
+
}
|
|
14146
|
+
_consumeMultiLineComment() {
|
|
14147
|
+
this._attemptCharCodeUntilFn(code => {
|
|
14148
|
+
if (code === $EOF) {
|
|
14149
|
+
return true;
|
|
14150
|
+
}
|
|
14151
|
+
if (code === $STAR) {
|
|
14152
|
+
const next = this._cursor.clone();
|
|
14153
|
+
next.advance();
|
|
14154
|
+
return next.peek() === $SLASH;
|
|
14155
|
+
}
|
|
14156
|
+
return false;
|
|
14157
|
+
});
|
|
14158
|
+
if (this._attemptStr('*/')) {
|
|
14159
|
+
this._attemptCharCodeUntilFn(isNotWhitespace);
|
|
14160
|
+
}
|
|
14161
|
+
}
|
|
14131
14162
|
_consumeTagOpen(start) {
|
|
14132
14163
|
let tagName;
|
|
14133
14164
|
let prefix;
|
|
@@ -14153,7 +14184,18 @@ class _Tokenizer {
|
|
|
14153
14184
|
tagName = closingTagName = openToken.parts[1];
|
|
14154
14185
|
this._attemptCharCodeUntilFn(isNotWhitespace);
|
|
14155
14186
|
}
|
|
14156
|
-
while (
|
|
14187
|
+
while (true) {
|
|
14188
|
+
if (this._attemptStr('//')) {
|
|
14189
|
+
this._consumeSingleLineComment();
|
|
14190
|
+
continue;
|
|
14191
|
+
}
|
|
14192
|
+
if (this._attemptStr('/*')) {
|
|
14193
|
+
this._consumeMultiLineComment();
|
|
14194
|
+
continue;
|
|
14195
|
+
}
|
|
14196
|
+
if (isAttributeTerminator(this._cursor.peek())) {
|
|
14197
|
+
break;
|
|
14198
|
+
}
|
|
14157
14199
|
if (this._selectorlessEnabled && this._cursor.peek() === $AT) {
|
|
14158
14200
|
const start = this._cursor.clone();
|
|
14159
14201
|
const nameStart = start.clone();
|
|
@@ -23686,13 +23728,16 @@ function createSwitchBlock(ast, visitor, bindingParser) {
|
|
|
23686
23728
|
if (isCase) {
|
|
23687
23729
|
expression = parseBlockParameterToBinding(node.parameters[0], bindingParser);
|
|
23688
23730
|
} else if (node.name === 'default never') {
|
|
23731
|
+
if (node.parameters.length > 0) {
|
|
23732
|
+
expression = parseBlockParameterToBinding(node.parameters[0], bindingParser);
|
|
23733
|
+
}
|
|
23689
23734
|
if (node.children.length > 0 || node.endSourceSpan !== null && node.endSourceSpan.start.offset !== node.endSourceSpan.end.offset) {
|
|
23690
23735
|
errors.push(new ParseError(node.sourceSpan, '@default block with "never" parameter cannot have a body'));
|
|
23691
23736
|
}
|
|
23692
23737
|
if (collectedCases.length > 0) {
|
|
23693
23738
|
errors.push(new ParseError(node.sourceSpan, 'A @case block with no body cannot be followed by a @default block with "never" parameter'));
|
|
23694
23739
|
}
|
|
23695
|
-
exhaustiveCheck = new SwitchExhaustiveCheck(node.sourceSpan, node.startSourceSpan, node.endSourceSpan, node.nameSpan);
|
|
23740
|
+
exhaustiveCheck = new SwitchExhaustiveCheck(expression, node.sourceSpan, node.startSourceSpan, node.endSourceSpan, node.nameSpan);
|
|
23696
23741
|
continue;
|
|
23697
23742
|
}
|
|
23698
23743
|
const switchCase = new SwitchBlockCase(expression, node.sourceSpan, node.startSourceSpan, node.endSourceSpan, node.nameSpan);
|
|
@@ -25315,7 +25360,7 @@ function compileComponentFromMetadata(meta, constantPool, bindingParser) {
|
|
|
25315
25360
|
}]));
|
|
25316
25361
|
}
|
|
25317
25362
|
if (meta.changeDetection !== null) {
|
|
25318
|
-
if (typeof meta.changeDetection === 'number' && meta.changeDetection !== ChangeDetectionStrategy.
|
|
25363
|
+
if (typeof meta.changeDetection === 'number' && meta.changeDetection !== ChangeDetectionStrategy.OnPush) {
|
|
25319
25364
|
definitionMap.set('changeDetection', literal(meta.changeDetection));
|
|
25320
25365
|
} else if (typeof meta.changeDetection === 'object') {
|
|
25321
25366
|
definitionMap.set('changeDetection', meta.changeDetection);
|
|
@@ -26222,7 +26267,9 @@ class TemplateBinder extends CombinedRecursiveAstVisitor {
|
|
|
26222
26267
|
block.cases.forEach(caseNode => caseNode.visit(this));
|
|
26223
26268
|
this.ingestScopedNode(block);
|
|
26224
26269
|
}
|
|
26225
|
-
visitSwitchExhaustiveCheck(block) {
|
|
26270
|
+
visitSwitchExhaustiveCheck(block) {
|
|
26271
|
+
block.expression?.visit(this);
|
|
26272
|
+
}
|
|
26226
26273
|
visitForLoopBlock(block) {
|
|
26227
26274
|
block.expression.visit(this);
|
|
26228
26275
|
this.ingestScopedNode(block);
|
|
@@ -26801,7 +26848,7 @@ function convertDeclareComponentFacadeToMetadata(decl, typeSourceSpan, sourceMap
|
|
|
26801
26848
|
viewProviders: decl.viewProviders !== undefined ? new WrappedNodeExpr(decl.viewProviders) : null,
|
|
26802
26849
|
animations: decl.animations !== undefined ? new WrappedNodeExpr(decl.animations) : null,
|
|
26803
26850
|
defer,
|
|
26804
|
-
changeDetection: decl.changeDetection ?? ChangeDetectionStrategy.
|
|
26851
|
+
changeDetection: decl.changeDetection ?? ChangeDetectionStrategy.OnPush,
|
|
26805
26852
|
encapsulation: decl.encapsulation ?? ViewEncapsulation$1.Emulated,
|
|
26806
26853
|
declarationListEmitMode: 2,
|
|
26807
26854
|
relativeContextFilePath: '',
|
|
@@ -28614,7 +28661,7 @@ const MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION = '18.0.0';
|
|
|
28614
28661
|
function compileDeclareClassMetadata(metadata) {
|
|
28615
28662
|
const definitionMap = new DefinitionMap();
|
|
28616
28663
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
|
|
28617
|
-
definitionMap.set('version', literal('22.0.0-next.
|
|
28664
|
+
definitionMap.set('version', literal('22.0.0-next.5'));
|
|
28618
28665
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
28619
28666
|
definitionMap.set('type', metadata.type);
|
|
28620
28667
|
definitionMap.set('decorators', metadata.decorators);
|
|
@@ -28632,7 +28679,7 @@ function compileComponentDeclareClassMetadata(metadata, dependencies) {
|
|
|
28632
28679
|
callbackReturnDefinitionMap.set('ctorParameters', metadata.ctorParameters ?? literal(null));
|
|
28633
28680
|
callbackReturnDefinitionMap.set('propDecorators', metadata.propDecorators ?? literal(null));
|
|
28634
28681
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION));
|
|
28635
|
-
definitionMap.set('version', literal('22.0.0-next.
|
|
28682
|
+
definitionMap.set('version', literal('22.0.0-next.5'));
|
|
28636
28683
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
28637
28684
|
definitionMap.set('type', metadata.type);
|
|
28638
28685
|
definitionMap.set('resolveDeferredDeps', compileComponentMetadataAsyncResolver(dependencies));
|
|
@@ -28705,7 +28752,7 @@ function createDirectiveDefinitionMap(meta) {
|
|
|
28705
28752
|
const definitionMap = new DefinitionMap();
|
|
28706
28753
|
const minVersion = getMinimumVersionForPartialOutput(meta);
|
|
28707
28754
|
definitionMap.set('minVersion', literal(minVersion));
|
|
28708
|
-
definitionMap.set('version', literal('22.0.0-next.
|
|
28755
|
+
definitionMap.set('version', literal('22.0.0-next.5'));
|
|
28709
28756
|
definitionMap.set('type', meta.type.value);
|
|
28710
28757
|
if (meta.isStandalone !== undefined) {
|
|
28711
28758
|
definitionMap.set('isStandalone', literal(meta.isStandalone));
|
|
@@ -29047,7 +29094,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
|
|
|
29047
29094
|
function compileDeclareFactoryFunction(meta) {
|
|
29048
29095
|
const definitionMap = new DefinitionMap();
|
|
29049
29096
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
|
|
29050
|
-
definitionMap.set('version', literal('22.0.0-next.
|
|
29097
|
+
definitionMap.set('version', literal('22.0.0-next.5'));
|
|
29051
29098
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
29052
29099
|
definitionMap.set('type', meta.type.value);
|
|
29053
29100
|
definitionMap.set('deps', compileDependencies(meta.deps));
|
|
@@ -29073,7 +29120,7 @@ function compileDeclareInjectableFromMetadata(meta) {
|
|
|
29073
29120
|
function createInjectableDefinitionMap(meta) {
|
|
29074
29121
|
const definitionMap = new DefinitionMap();
|
|
29075
29122
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
|
|
29076
|
-
definitionMap.set('version', literal('22.0.0-next.
|
|
29123
|
+
definitionMap.set('version', literal('22.0.0-next.5'));
|
|
29077
29124
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
29078
29125
|
definitionMap.set('type', meta.type.value);
|
|
29079
29126
|
if (meta.providedIn !== undefined) {
|
|
@@ -29114,7 +29161,7 @@ function compileDeclareInjectorFromMetadata(meta) {
|
|
|
29114
29161
|
function createInjectorDefinitionMap(meta) {
|
|
29115
29162
|
const definitionMap = new DefinitionMap();
|
|
29116
29163
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
|
|
29117
|
-
definitionMap.set('version', literal('22.0.0-next.
|
|
29164
|
+
definitionMap.set('version', literal('22.0.0-next.5'));
|
|
29118
29165
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
29119
29166
|
definitionMap.set('type', meta.type.value);
|
|
29120
29167
|
definitionMap.set('providers', meta.providers);
|
|
@@ -29141,7 +29188,7 @@ function createNgModuleDefinitionMap(meta) {
|
|
|
29141
29188
|
throw new Error('Invalid path! Local compilation mode should not get into the partial compilation path');
|
|
29142
29189
|
}
|
|
29143
29190
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
|
|
29144
|
-
definitionMap.set('version', literal('22.0.0-next.
|
|
29191
|
+
definitionMap.set('version', literal('22.0.0-next.5'));
|
|
29145
29192
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
29146
29193
|
definitionMap.set('type', meta.type.value);
|
|
29147
29194
|
if (meta.bootstrap.length > 0) {
|
|
@@ -29179,7 +29226,7 @@ function compileDeclarePipeFromMetadata(meta) {
|
|
|
29179
29226
|
function createPipeDefinitionMap(meta) {
|
|
29180
29227
|
const definitionMap = new DefinitionMap();
|
|
29181
29228
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
|
|
29182
|
-
definitionMap.set('version', literal('22.0.0-next.
|
|
29229
|
+
definitionMap.set('version', literal('22.0.0-next.5'));
|
|
29183
29230
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
29184
29231
|
definitionMap.set('type', meta.type.value);
|
|
29185
29232
|
if (meta.isStandalone !== undefined) {
|
|
@@ -29253,7 +29300,7 @@ function compileHmrUpdateCallback(definitions, constantStatements, meta) {
|
|
|
29253
29300
|
return new DeclareFunctionStmt(`${meta.className}_UpdateMetadata`, params, body, null, StmtModifier.Final);
|
|
29254
29301
|
}
|
|
29255
29302
|
|
|
29256
|
-
const VERSION = new Version('22.0.0-next.
|
|
29303
|
+
const VERSION = new Version('22.0.0-next.5');
|
|
29257
29304
|
|
|
29258
29305
|
publishFacade(_global);
|
|
29259
29306
|
|