@angular/compiler 20.2.0-next.2 → 20.2.0-next.4
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 +41 -18
- package/fesm2022/compiler.mjs.map +1 -1
- package/index.d.ts +11 -8
- package/package.json +1 -1
package/fesm2022/compiler.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v20.2.0-next.
|
|
2
|
+
* @license Angular v20.2.0-next.4
|
|
3
3
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -18824,7 +18824,7 @@ class Parser {
|
|
|
18824
18824
|
parseAction(input, parseSourceSpan, absoluteOffset, interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) {
|
|
18825
18825
|
const errors = [];
|
|
18826
18826
|
this._checkNoInterpolation(errors, input, parseSourceSpan, interpolationConfig);
|
|
18827
|
-
const sourceToLex = this._stripComments(input);
|
|
18827
|
+
const { stripped: sourceToLex } = this._stripComments(input);
|
|
18828
18828
|
const tokens = this._lexer.tokenize(sourceToLex);
|
|
18829
18829
|
const ast = new _ParseAST(input, parseSourceSpan, absoluteOffset, tokens, 1 /* ParseFlags.Action */, errors, 0, this._supportsDirectPipeReferences).parseChain();
|
|
18830
18830
|
return new ASTWithSource(ast, input, getLocation(parseSourceSpan), absoluteOffset, errors);
|
|
@@ -18851,7 +18851,7 @@ class Parser {
|
|
|
18851
18851
|
}
|
|
18852
18852
|
_parseBindingAst(input, parseSourceSpan, absoluteOffset, interpolationConfig, errors) {
|
|
18853
18853
|
this._checkNoInterpolation(errors, input, parseSourceSpan, interpolationConfig);
|
|
18854
|
-
const sourceToLex = this._stripComments(input);
|
|
18854
|
+
const { stripped: sourceToLex } = this._stripComments(input);
|
|
18855
18855
|
const tokens = this._lexer.tokenize(sourceToLex);
|
|
18856
18856
|
return new _ParseAST(input, parseSourceSpan, absoluteOffset, tokens, 0 /* ParseFlags.None */, errors, 0, this._supportsDirectPipeReferences).parseChain();
|
|
18857
18857
|
}
|
|
@@ -18902,8 +18902,13 @@ class Parser {
|
|
|
18902
18902
|
// indexes inside the tokens.
|
|
18903
18903
|
const expressionSpan = interpolatedTokens?.[i * 2 + 1]?.sourceSpan;
|
|
18904
18904
|
const expressionText = expressions[i].text;
|
|
18905
|
-
const sourceToLex = this._stripComments(expressionText);
|
|
18905
|
+
const { stripped: sourceToLex, hasComments } = this._stripComments(expressionText);
|
|
18906
18906
|
const tokens = this._lexer.tokenize(sourceToLex);
|
|
18907
|
+
if (hasComments && sourceToLex.trim().length === 0 && tokens.length === 0) {
|
|
18908
|
+
// Empty expressions error are handled futher down, here we only take care of the comment case
|
|
18909
|
+
errors.push(getParseError('Interpolation expression cannot only contain a comment', input, `at column ${expressions[i].start} in`, parseSourceSpan));
|
|
18910
|
+
continue;
|
|
18911
|
+
}
|
|
18907
18912
|
const ast = new _ParseAST(expressionSpan ? expressionText : input, expressionSpan || parseSourceSpan, absoluteOffset, tokens, 0 /* ParseFlags.None */, errors, offsets[i], this._supportsDirectPipeReferences).parseChain();
|
|
18908
18913
|
expressionNodes.push(ast);
|
|
18909
18914
|
}
|
|
@@ -18915,7 +18920,7 @@ class Parser {
|
|
|
18915
18920
|
* This is used for parsing the switch expression in ICUs.
|
|
18916
18921
|
*/
|
|
18917
18922
|
parseInterpolationExpression(expression, parseSourceSpan, absoluteOffset) {
|
|
18918
|
-
const sourceToLex = this._stripComments(expression);
|
|
18923
|
+
const { stripped: sourceToLex } = this._stripComments(expression);
|
|
18919
18924
|
const tokens = this._lexer.tokenize(sourceToLex);
|
|
18920
18925
|
const errors = [];
|
|
18921
18926
|
const ast = new _ParseAST(expression, parseSourceSpan, absoluteOffset, tokens, 0 /* ParseFlags.None */, errors, 0, this._supportsDirectPipeReferences).parseChain();
|
|
@@ -19003,7 +19008,9 @@ class Parser {
|
|
|
19003
19008
|
}
|
|
19004
19009
|
_stripComments(input) {
|
|
19005
19010
|
const i = this._commentStart(input);
|
|
19006
|
-
return i != null
|
|
19011
|
+
return i != null
|
|
19012
|
+
? { stripped: input.substring(0, i), hasComments: true }
|
|
19013
|
+
: { stripped: input, hasComments: false };
|
|
19007
19014
|
}
|
|
19008
19015
|
_commentStart(input) {
|
|
19009
19016
|
let outerQuote = null;
|
|
@@ -28261,11 +28268,25 @@ class BindingParser {
|
|
|
28261
28268
|
return this._isAllowedAssignmentEvent(ast.args[0]);
|
|
28262
28269
|
}
|
|
28263
28270
|
if (ast instanceof PropertyRead || ast instanceof KeyedRead) {
|
|
28264
|
-
|
|
28271
|
+
if (!hasRecursiveSafeReceiver(ast)) {
|
|
28272
|
+
return true;
|
|
28273
|
+
}
|
|
28265
28274
|
}
|
|
28266
28275
|
return false;
|
|
28267
28276
|
}
|
|
28268
28277
|
}
|
|
28278
|
+
function hasRecursiveSafeReceiver(ast) {
|
|
28279
|
+
if (ast instanceof SafePropertyRead || ast instanceof SafeKeyedRead) {
|
|
28280
|
+
return true;
|
|
28281
|
+
}
|
|
28282
|
+
if (ast instanceof ParenthesizedExpression) {
|
|
28283
|
+
return hasRecursiveSafeReceiver(ast.expression);
|
|
28284
|
+
}
|
|
28285
|
+
if (ast instanceof PropertyRead || ast instanceof KeyedRead || ast instanceof Call) {
|
|
28286
|
+
return hasRecursiveSafeReceiver(ast.receiver);
|
|
28287
|
+
}
|
|
28288
|
+
return false;
|
|
28289
|
+
}
|
|
28269
28290
|
function isLegacyAnimationLabel(name) {
|
|
28270
28291
|
return name[0] == '@';
|
|
28271
28292
|
}
|
|
@@ -30979,7 +31000,8 @@ class R3TargetBinder {
|
|
|
30979
31000
|
// Bind the host element in a separate scope. Note that it only uses the
|
|
30980
31001
|
// `TemplateBinder` since directives don't apply inside a host context.
|
|
30981
31002
|
if (target.host) {
|
|
30982
|
-
|
|
31003
|
+
directives.set(target.host.node, target.host.directives);
|
|
31004
|
+
TemplateBinder.applyWithScope(target.host.node, Scope.apply(target.host.node), expressions, symbols, nestingLevel, usedPipes, eagerPipes, deferBlocks);
|
|
30983
31005
|
}
|
|
30984
31006
|
return new R3BoundTarget(target, directives, eagerDirectives, missingDirectives, bindings, references, expressions, symbols, nestingLevel, scopedNodeEntities, usedPipes, eagerPipes, deferBlocks);
|
|
30985
31007
|
}
|
|
@@ -31772,7 +31794,8 @@ class R3BoundTarget {
|
|
|
31772
31794
|
}
|
|
31773
31795
|
if (target instanceof Template ||
|
|
31774
31796
|
target.node instanceof Component$1 ||
|
|
31775
|
-
target.node instanceof Directive$1
|
|
31797
|
+
target.node instanceof Directive$1 ||
|
|
31798
|
+
target.node instanceof HostElement) {
|
|
31776
31799
|
return null;
|
|
31777
31800
|
}
|
|
31778
31801
|
return this.referenceTargetToElement(target.node);
|
|
@@ -34248,7 +34271,7 @@ const MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION = '18.0.0';
|
|
|
34248
34271
|
function compileDeclareClassMetadata(metadata) {
|
|
34249
34272
|
const definitionMap = new DefinitionMap();
|
|
34250
34273
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
|
|
34251
|
-
definitionMap.set('version', literal('20.2.0-next.
|
|
34274
|
+
definitionMap.set('version', literal('20.2.0-next.4'));
|
|
34252
34275
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
34253
34276
|
definitionMap.set('type', metadata.type);
|
|
34254
34277
|
definitionMap.set('decorators', metadata.decorators);
|
|
@@ -34266,7 +34289,7 @@ function compileComponentDeclareClassMetadata(metadata, dependencies) {
|
|
|
34266
34289
|
callbackReturnDefinitionMap.set('ctorParameters', metadata.ctorParameters ?? literal(null));
|
|
34267
34290
|
callbackReturnDefinitionMap.set('propDecorators', metadata.propDecorators ?? literal(null));
|
|
34268
34291
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION));
|
|
34269
|
-
definitionMap.set('version', literal('20.2.0-next.
|
|
34292
|
+
definitionMap.set('version', literal('20.2.0-next.4'));
|
|
34270
34293
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
34271
34294
|
definitionMap.set('type', metadata.type);
|
|
34272
34295
|
definitionMap.set('resolveDeferredDeps', compileComponentMetadataAsyncResolver(dependencies));
|
|
@@ -34361,7 +34384,7 @@ function createDirectiveDefinitionMap(meta) {
|
|
|
34361
34384
|
const definitionMap = new DefinitionMap();
|
|
34362
34385
|
const minVersion = getMinimumVersionForPartialOutput(meta);
|
|
34363
34386
|
definitionMap.set('minVersion', literal(minVersion));
|
|
34364
|
-
definitionMap.set('version', literal('20.2.0-next.
|
|
34387
|
+
definitionMap.set('version', literal('20.2.0-next.4'));
|
|
34365
34388
|
// e.g. `type: MyDirective`
|
|
34366
34389
|
definitionMap.set('type', meta.type.value);
|
|
34367
34390
|
if (meta.isStandalone !== undefined) {
|
|
@@ -34777,7 +34800,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
|
|
|
34777
34800
|
function compileDeclareFactoryFunction(meta) {
|
|
34778
34801
|
const definitionMap = new DefinitionMap();
|
|
34779
34802
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
|
|
34780
|
-
definitionMap.set('version', literal('20.2.0-next.
|
|
34803
|
+
definitionMap.set('version', literal('20.2.0-next.4'));
|
|
34781
34804
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
34782
34805
|
definitionMap.set('type', meta.type.value);
|
|
34783
34806
|
definitionMap.set('deps', compileDependencies(meta.deps));
|
|
@@ -34812,7 +34835,7 @@ function compileDeclareInjectableFromMetadata(meta) {
|
|
|
34812
34835
|
function createInjectableDefinitionMap(meta) {
|
|
34813
34836
|
const definitionMap = new DefinitionMap();
|
|
34814
34837
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
|
|
34815
|
-
definitionMap.set('version', literal('20.2.0-next.
|
|
34838
|
+
definitionMap.set('version', literal('20.2.0-next.4'));
|
|
34816
34839
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
34817
34840
|
definitionMap.set('type', meta.type.value);
|
|
34818
34841
|
// Only generate providedIn property if it has a non-null value
|
|
@@ -34863,7 +34886,7 @@ function compileDeclareInjectorFromMetadata(meta) {
|
|
|
34863
34886
|
function createInjectorDefinitionMap(meta) {
|
|
34864
34887
|
const definitionMap = new DefinitionMap();
|
|
34865
34888
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
|
|
34866
|
-
definitionMap.set('version', literal('20.2.0-next.
|
|
34889
|
+
definitionMap.set('version', literal('20.2.0-next.4'));
|
|
34867
34890
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
34868
34891
|
definitionMap.set('type', meta.type.value);
|
|
34869
34892
|
definitionMap.set('providers', meta.providers);
|
|
@@ -34896,7 +34919,7 @@ function createNgModuleDefinitionMap(meta) {
|
|
|
34896
34919
|
throw new Error('Invalid path! Local compilation mode should not get into the partial compilation path');
|
|
34897
34920
|
}
|
|
34898
34921
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
|
|
34899
|
-
definitionMap.set('version', literal('20.2.0-next.
|
|
34922
|
+
definitionMap.set('version', literal('20.2.0-next.4'));
|
|
34900
34923
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
34901
34924
|
definitionMap.set('type', meta.type.value);
|
|
34902
34925
|
// We only generate the keys in the metadata if the arrays contain values.
|
|
@@ -34947,7 +34970,7 @@ function compileDeclarePipeFromMetadata(meta) {
|
|
|
34947
34970
|
function createPipeDefinitionMap(meta) {
|
|
34948
34971
|
const definitionMap = new DefinitionMap();
|
|
34949
34972
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
|
|
34950
|
-
definitionMap.set('version', literal('20.2.0-next.
|
|
34973
|
+
definitionMap.set('version', literal('20.2.0-next.4'));
|
|
34951
34974
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
34952
34975
|
// e.g. `type: MyPipe`
|
|
34953
34976
|
definitionMap.set('type', meta.type.value);
|
|
@@ -35103,7 +35126,7 @@ function compileHmrUpdateCallback(definitions, constantStatements, meta) {
|
|
|
35103
35126
|
* @description
|
|
35104
35127
|
* Entry point for all public APIs of the compiler package.
|
|
35105
35128
|
*/
|
|
35106
|
-
const VERSION = new Version('20.2.0-next.
|
|
35129
|
+
const VERSION = new Version('20.2.0-next.4');
|
|
35107
35130
|
|
|
35108
35131
|
//////////////////////////////////////
|
|
35109
35132
|
// THIS FILE HAS GLOBAL SIDE EFFECT //
|