@angular/compiler 21.0.0-next.0 → 21.0.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/fesm2022/compiler.mjs +37 -14
- package/fesm2022/compiler.mjs.map +1 -1
- package/index.d.ts +1 -1
- package/package.json +1 -1
package/fesm2022/compiler.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v21.0.0-next.
|
|
2
|
+
* @license Angular v21.0.0-next.2
|
|
3
3
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -25485,8 +25485,13 @@ function hasPipe(root) {
|
|
|
25485
25485
|
*
|
|
25486
25486
|
* 1. Unary operators in the base of an exponentiation expression. For example, `-2 ** 3` is not
|
|
25487
25487
|
* valid JavaScript, but `(-2) ** 3` is.
|
|
25488
|
+
*
|
|
25488
25489
|
* 2. When mixing nullish coalescing (`??`) and logical and/or operators (`&&`, `||`), we need
|
|
25489
25490
|
* parentheses. For example, `a ?? b && c` is not valid JavaScript, but `a ?? (b && c)` is.
|
|
25491
|
+
* Note: Because of the outcome of https://github.com/microsoft/TypeScript/issues/62307
|
|
25492
|
+
* We need (for now) to keep parentheses around the `??` operator when it is used with and/or operators.
|
|
25493
|
+
* For example, `a ?? b && c` is not valid JavaScript, but `(a ?? b) && c` is.
|
|
25494
|
+
*
|
|
25490
25495
|
* 3. Ternary expression used as an operand for nullish coalescing. Typescript generates incorrect
|
|
25491
25496
|
* code if the parentheses are missing. For example when `(a ? b : c) ?? d` is translated to
|
|
25492
25497
|
* typescript AST, the parentheses node is removed, and then the remaining AST is printed, it
|
|
@@ -25509,6 +25514,11 @@ function stripNonrequiredParentheses(job) {
|
|
|
25509
25514
|
case BinaryOperator.NullishCoalesce:
|
|
25510
25515
|
checkNullishCoalescingParens(expr, requiredParens);
|
|
25511
25516
|
break;
|
|
25517
|
+
// these 2 cases can be dropped if the regression introduced in 5.9.2 is fixed
|
|
25518
|
+
// see https://github.com/microsoft/TypeScript/issues/62307
|
|
25519
|
+
case BinaryOperator.And:
|
|
25520
|
+
case BinaryOperator.Or:
|
|
25521
|
+
checkAndOrParens(expr, requiredParens);
|
|
25512
25522
|
}
|
|
25513
25523
|
}
|
|
25514
25524
|
});
|
|
@@ -25541,6 +25551,13 @@ function checkNullishCoalescingParens(expr, requiredParens) {
|
|
|
25541
25551
|
requiredParens.add(expr.rhs);
|
|
25542
25552
|
}
|
|
25543
25553
|
}
|
|
25554
|
+
function checkAndOrParens(expr, requiredParens) {
|
|
25555
|
+
if (expr.lhs instanceof ParenthesizedExpr &&
|
|
25556
|
+
expr.lhs.expr instanceof BinaryOperatorExpr &&
|
|
25557
|
+
expr.lhs.expr.operator === BinaryOperator.NullishCoalesce) {
|
|
25558
|
+
requiredParens.add(expr.lhs);
|
|
25559
|
+
}
|
|
25560
|
+
}
|
|
25544
25561
|
function isLogicalAndOr(expr) {
|
|
25545
25562
|
return (expr instanceof BinaryOperatorExpr &&
|
|
25546
25563
|
(expr.operator === BinaryOperator.And || expr.operator === BinaryOperator.Or));
|
|
@@ -28075,7 +28092,7 @@ class BindingParser {
|
|
|
28075
28092
|
if (isLegacyAnimationProp) {
|
|
28076
28093
|
this._parseLegacyAnimation(name, expression, sourceSpan, absoluteOffset, keySpan, valueSpan, targetMatchableAttrs, targetProps);
|
|
28077
28094
|
}
|
|
28078
|
-
else if (name.startsWith(ANIMATE_PREFIX)) {
|
|
28095
|
+
else if (name.startsWith(`${ANIMATE_PREFIX}${PROPERTY_PARTS_SEPARATOR}`)) {
|
|
28079
28096
|
this._parseAnimation(name, this.parseBinding(expression, isHost, valueSpan || sourceSpan, absoluteOffset), sourceSpan, keySpan, valueSpan, targetMatchableAttrs, targetProps);
|
|
28080
28097
|
}
|
|
28081
28098
|
else {
|
|
@@ -28238,7 +28255,7 @@ class BindingParser {
|
|
|
28238
28255
|
if (isAssignmentEvent) {
|
|
28239
28256
|
eventType = ParsedEventType.TwoWay;
|
|
28240
28257
|
}
|
|
28241
|
-
if (name.startsWith(ANIMATE_PREFIX)) {
|
|
28258
|
+
if (name.startsWith(`${ANIMATE_PREFIX}${PROPERTY_PARTS_SEPARATOR}`)) {
|
|
28242
28259
|
eventType = ParsedEventType.Animation;
|
|
28243
28260
|
}
|
|
28244
28261
|
targetEvents.push(new ParsedEvent(eventName, target, eventType, ast, sourceSpan, handlerSpan, keySpan));
|
|
@@ -29915,6 +29932,12 @@ class HtmlAstToIvyAst {
|
|
|
29915
29932
|
}
|
|
29916
29933
|
return directives;
|
|
29917
29934
|
}
|
|
29935
|
+
filterAnimationAttributes(attributes) {
|
|
29936
|
+
return attributes.filter((a) => !a.name.startsWith('animate.'));
|
|
29937
|
+
}
|
|
29938
|
+
filterAnimationInputs(attributes) {
|
|
29939
|
+
return attributes.filter((a) => a.type !== BindingType.Animation);
|
|
29940
|
+
}
|
|
29918
29941
|
wrapInTemplate(node, templateProperties, templateVariables, i18nAttrsMeta, isTemplateElement, isI18nRootElement) {
|
|
29919
29942
|
// We need to hoist the attributes of the node to the template for content projection purposes.
|
|
29920
29943
|
const attrs = this.categorizePropertyAttributes('ng-template', templateProperties, i18nAttrsMeta);
|
|
@@ -29927,8 +29950,8 @@ class HtmlAstToIvyAst {
|
|
|
29927
29950
|
outputs: [],
|
|
29928
29951
|
};
|
|
29929
29952
|
if (node instanceof Element$1 || node instanceof Component$1) {
|
|
29930
|
-
hoistedAttrs.attributes.push(...node.attributes);
|
|
29931
|
-
hoistedAttrs.inputs.push(...node.inputs);
|
|
29953
|
+
hoistedAttrs.attributes.push(...this.filterAnimationAttributes(node.attributes));
|
|
29954
|
+
hoistedAttrs.inputs.push(...this.filterAnimationInputs(node.inputs));
|
|
29932
29955
|
hoistedAttrs.outputs.push(...node.outputs);
|
|
29933
29956
|
}
|
|
29934
29957
|
// For <ng-template>s with structural directives on them, avoid passing i18n information to
|
|
@@ -34302,7 +34325,7 @@ const MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION = '18.0.0';
|
|
|
34302
34325
|
function compileDeclareClassMetadata(metadata) {
|
|
34303
34326
|
const definitionMap = new DefinitionMap();
|
|
34304
34327
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
|
|
34305
|
-
definitionMap.set('version', literal('21.0.0-next.
|
|
34328
|
+
definitionMap.set('version', literal('21.0.0-next.2'));
|
|
34306
34329
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
34307
34330
|
definitionMap.set('type', metadata.type);
|
|
34308
34331
|
definitionMap.set('decorators', metadata.decorators);
|
|
@@ -34320,7 +34343,7 @@ function compileComponentDeclareClassMetadata(metadata, dependencies) {
|
|
|
34320
34343
|
callbackReturnDefinitionMap.set('ctorParameters', metadata.ctorParameters ?? literal(null));
|
|
34321
34344
|
callbackReturnDefinitionMap.set('propDecorators', metadata.propDecorators ?? literal(null));
|
|
34322
34345
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION));
|
|
34323
|
-
definitionMap.set('version', literal('21.0.0-next.
|
|
34346
|
+
definitionMap.set('version', literal('21.0.0-next.2'));
|
|
34324
34347
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
34325
34348
|
definitionMap.set('type', metadata.type);
|
|
34326
34349
|
definitionMap.set('resolveDeferredDeps', compileComponentMetadataAsyncResolver(dependencies));
|
|
@@ -34415,7 +34438,7 @@ function createDirectiveDefinitionMap(meta) {
|
|
|
34415
34438
|
const definitionMap = new DefinitionMap();
|
|
34416
34439
|
const minVersion = getMinimumVersionForPartialOutput(meta);
|
|
34417
34440
|
definitionMap.set('minVersion', literal(minVersion));
|
|
34418
|
-
definitionMap.set('version', literal('21.0.0-next.
|
|
34441
|
+
definitionMap.set('version', literal('21.0.0-next.2'));
|
|
34419
34442
|
// e.g. `type: MyDirective`
|
|
34420
34443
|
definitionMap.set('type', meta.type.value);
|
|
34421
34444
|
if (meta.isStandalone !== undefined) {
|
|
@@ -34831,7 +34854,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
|
|
|
34831
34854
|
function compileDeclareFactoryFunction(meta) {
|
|
34832
34855
|
const definitionMap = new DefinitionMap();
|
|
34833
34856
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
|
|
34834
|
-
definitionMap.set('version', literal('21.0.0-next.
|
|
34857
|
+
definitionMap.set('version', literal('21.0.0-next.2'));
|
|
34835
34858
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
34836
34859
|
definitionMap.set('type', meta.type.value);
|
|
34837
34860
|
definitionMap.set('deps', compileDependencies(meta.deps));
|
|
@@ -34866,7 +34889,7 @@ function compileDeclareInjectableFromMetadata(meta) {
|
|
|
34866
34889
|
function createInjectableDefinitionMap(meta) {
|
|
34867
34890
|
const definitionMap = new DefinitionMap();
|
|
34868
34891
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
|
|
34869
|
-
definitionMap.set('version', literal('21.0.0-next.
|
|
34892
|
+
definitionMap.set('version', literal('21.0.0-next.2'));
|
|
34870
34893
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
34871
34894
|
definitionMap.set('type', meta.type.value);
|
|
34872
34895
|
// Only generate providedIn property if it has a non-null value
|
|
@@ -34917,7 +34940,7 @@ function compileDeclareInjectorFromMetadata(meta) {
|
|
|
34917
34940
|
function createInjectorDefinitionMap(meta) {
|
|
34918
34941
|
const definitionMap = new DefinitionMap();
|
|
34919
34942
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
|
|
34920
|
-
definitionMap.set('version', literal('21.0.0-next.
|
|
34943
|
+
definitionMap.set('version', literal('21.0.0-next.2'));
|
|
34921
34944
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
34922
34945
|
definitionMap.set('type', meta.type.value);
|
|
34923
34946
|
definitionMap.set('providers', meta.providers);
|
|
@@ -34950,7 +34973,7 @@ function createNgModuleDefinitionMap(meta) {
|
|
|
34950
34973
|
throw new Error('Invalid path! Local compilation mode should not get into the partial compilation path');
|
|
34951
34974
|
}
|
|
34952
34975
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
|
|
34953
|
-
definitionMap.set('version', literal('21.0.0-next.
|
|
34976
|
+
definitionMap.set('version', literal('21.0.0-next.2'));
|
|
34954
34977
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
34955
34978
|
definitionMap.set('type', meta.type.value);
|
|
34956
34979
|
// We only generate the keys in the metadata if the arrays contain values.
|
|
@@ -35001,7 +35024,7 @@ function compileDeclarePipeFromMetadata(meta) {
|
|
|
35001
35024
|
function createPipeDefinitionMap(meta) {
|
|
35002
35025
|
const definitionMap = new DefinitionMap();
|
|
35003
35026
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
|
|
35004
|
-
definitionMap.set('version', literal('21.0.0-next.
|
|
35027
|
+
definitionMap.set('version', literal('21.0.0-next.2'));
|
|
35005
35028
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
35006
35029
|
// e.g. `type: MyPipe`
|
|
35007
35030
|
definitionMap.set('type', meta.type.value);
|
|
@@ -35157,7 +35180,7 @@ function compileHmrUpdateCallback(definitions, constantStatements, meta) {
|
|
|
35157
35180
|
* @description
|
|
35158
35181
|
* Entry point for all public APIs of the compiler package.
|
|
35159
35182
|
*/
|
|
35160
|
-
const VERSION = new Version('21.0.0-next.
|
|
35183
|
+
const VERSION = new Version('21.0.0-next.2');
|
|
35161
35184
|
|
|
35162
35185
|
//////////////////////////////////////
|
|
35163
35186
|
// THIS FILE HAS GLOBAL SIDE EFFECT //
|