@angular/compiler 20.0.0-next.9 → 20.0.0-rc.1
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 +69 -30
- package/fesm2022/compiler.mjs.map +1 -1
- package/index.d.ts +1 -1
- package/package.json +2 -2
package/fesm2022/compiler.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v20.0.0-
|
|
2
|
+
* @license Angular v20.0.0-rc.1
|
|
3
3
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -3218,28 +3218,26 @@ function stringify(token) {
|
|
|
3218
3218
|
return token;
|
|
3219
3219
|
}
|
|
3220
3220
|
if (Array.isArray(token)) {
|
|
3221
|
-
return
|
|
3221
|
+
return `[${token.map(stringify).join(', ')}]`;
|
|
3222
3222
|
}
|
|
3223
3223
|
if (token == null) {
|
|
3224
3224
|
return '' + token;
|
|
3225
3225
|
}
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
if (token.name) {
|
|
3230
|
-
return `${token.name}`;
|
|
3226
|
+
const name = token.overriddenName || token.name;
|
|
3227
|
+
if (name) {
|
|
3228
|
+
return `${name}`;
|
|
3231
3229
|
}
|
|
3232
3230
|
if (!token.toString) {
|
|
3233
3231
|
return 'object';
|
|
3234
3232
|
}
|
|
3235
3233
|
// WARNING: do not try to `JSON.stringify(token)` here
|
|
3236
3234
|
// see https://github.com/angular/angular/issues/23440
|
|
3237
|
-
const
|
|
3238
|
-
if (
|
|
3239
|
-
return '' +
|
|
3235
|
+
const result = token.toString();
|
|
3236
|
+
if (result == null) {
|
|
3237
|
+
return '' + result;
|
|
3240
3238
|
}
|
|
3241
|
-
const newLineIndex =
|
|
3242
|
-
return newLineIndex
|
|
3239
|
+
const newLineIndex = result.indexOf('\n');
|
|
3240
|
+
return newLineIndex >= 0 ? result.slice(0, newLineIndex) : result;
|
|
3243
3241
|
}
|
|
3244
3242
|
class Version {
|
|
3245
3243
|
full;
|
|
@@ -11756,7 +11754,23 @@ function assignI18nSlotDependencies(job) {
|
|
|
11756
11754
|
i18nExpressionsInProgress.push(opToRemove);
|
|
11757
11755
|
continue;
|
|
11758
11756
|
}
|
|
11757
|
+
let hasDifferentTarget = false;
|
|
11759
11758
|
if (hasDependsOnSlotContextTrait(updateOp) && updateOp.target !== createOp.xref) {
|
|
11759
|
+
hasDifferentTarget = true;
|
|
11760
|
+
}
|
|
11761
|
+
else if (
|
|
11762
|
+
// Some expressions may consume slots as well (e.g. `storeLet`).
|
|
11763
|
+
updateOp.kind === OpKind.Statement ||
|
|
11764
|
+
updateOp.kind === OpKind.Variable) {
|
|
11765
|
+
visitExpressionsInOp(updateOp, (expr) => {
|
|
11766
|
+
if (!hasDifferentTarget &&
|
|
11767
|
+
hasDependsOnSlotContextTrait(expr) &&
|
|
11768
|
+
expr.target !== createOp.xref) {
|
|
11769
|
+
hasDifferentTarget = true;
|
|
11770
|
+
}
|
|
11771
|
+
});
|
|
11772
|
+
}
|
|
11773
|
+
if (hasDifferentTarget) {
|
|
11760
11774
|
break;
|
|
11761
11775
|
}
|
|
11762
11776
|
updateOp = updateOp.next;
|
|
@@ -25203,11 +25217,16 @@ function allocateSlots(job) {
|
|
|
25203
25217
|
*/
|
|
25204
25218
|
function optimizeStoreLet(job) {
|
|
25205
25219
|
const letUsedExternally = new Set();
|
|
25220
|
+
const declareLetOps = new Map();
|
|
25206
25221
|
// Since `@let` declarations can be referenced in child views, both in
|
|
25207
25222
|
// the creation block (via listeners) and in the update block, we have
|
|
25208
25223
|
// to look through all the ops to find the references.
|
|
25209
25224
|
for (const unit of job.units) {
|
|
25210
25225
|
for (const op of unit.ops()) {
|
|
25226
|
+
// Take advantage that we're already looking through all the ops and track some more info.
|
|
25227
|
+
if (op.kind === OpKind.DeclareLet) {
|
|
25228
|
+
declareLetOps.set(op.xref, op);
|
|
25229
|
+
}
|
|
25211
25230
|
visitExpressionsInOp(op, (expr) => {
|
|
25212
25231
|
if (expr instanceof ContextLetReferenceExpr) {
|
|
25213
25232
|
letUsedExternally.add(expr.target);
|
|
@@ -25215,15 +25234,35 @@ function optimizeStoreLet(job) {
|
|
|
25215
25234
|
});
|
|
25216
25235
|
}
|
|
25217
25236
|
}
|
|
25218
|
-
// TODO(crisbeto): potentially remove the unused calls completely, pending discussion.
|
|
25219
25237
|
for (const unit of job.units) {
|
|
25220
25238
|
for (const op of unit.update) {
|
|
25221
|
-
transformExpressionsInOp(op, (
|
|
25222
|
-
|
|
25223
|
-
|
|
25239
|
+
transformExpressionsInOp(op, (expr) => {
|
|
25240
|
+
// If a @let isn't used in other views, we don't have to store its value.
|
|
25241
|
+
if (expr instanceof StoreLetExpr && !letUsedExternally.has(expr.target)) {
|
|
25242
|
+
// Furthermore, if the @let isn't using pipes, we can also drop its declareLet op.
|
|
25243
|
+
// We need to keep the declareLet if there are pipes, because they can use DI which
|
|
25244
|
+
// requires the TNode created by declareLet.
|
|
25245
|
+
if (!hasPipe(expr)) {
|
|
25246
|
+
OpList.remove(declareLetOps.get(expr.target));
|
|
25247
|
+
}
|
|
25248
|
+
return expr.value;
|
|
25249
|
+
}
|
|
25250
|
+
return expr;
|
|
25251
|
+
}, VisitorContextFlag.None);
|
|
25224
25252
|
}
|
|
25225
25253
|
}
|
|
25226
25254
|
}
|
|
25255
|
+
/** Determines if a `storeLet` expression contains a pipe. */
|
|
25256
|
+
function hasPipe(root) {
|
|
25257
|
+
let result = false;
|
|
25258
|
+
transformExpressionsInExpression(root, (expr) => {
|
|
25259
|
+
if (expr instanceof PipeBindingExpr || expr instanceof PipeBindingVariadicExpr) {
|
|
25260
|
+
result = true;
|
|
25261
|
+
}
|
|
25262
|
+
return expr;
|
|
25263
|
+
}, VisitorContextFlag.None);
|
|
25264
|
+
return result;
|
|
25265
|
+
}
|
|
25227
25266
|
|
|
25228
25267
|
/**
|
|
25229
25268
|
* In most cases we can drop user added parentheses from expressions. However, in some cases
|
|
@@ -26182,11 +26221,6 @@ const phases = [
|
|
|
26182
26221
|
{ kind: CompilationJobKind.Tmpl, fn: generateConditionalExpressions },
|
|
26183
26222
|
{ kind: CompilationJobKind.Tmpl, fn: createPipes },
|
|
26184
26223
|
{ kind: CompilationJobKind.Tmpl, fn: configureDeferInstructions },
|
|
26185
|
-
{ kind: CompilationJobKind.Tmpl, fn: convertI18nText },
|
|
26186
|
-
{ kind: CompilationJobKind.Tmpl, fn: convertI18nBindings },
|
|
26187
|
-
{ kind: CompilationJobKind.Tmpl, fn: removeUnusedI18nAttributesOps },
|
|
26188
|
-
{ kind: CompilationJobKind.Tmpl, fn: assignI18nSlotDependencies },
|
|
26189
|
-
{ kind: CompilationJobKind.Tmpl, fn: applyI18nExpressions },
|
|
26190
26224
|
{ kind: CompilationJobKind.Tmpl, fn: createVariadicPipes },
|
|
26191
26225
|
{ kind: CompilationJobKind.Both, fn: generatePureLiteralStructures },
|
|
26192
26226
|
{ kind: CompilationJobKind.Tmpl, fn: generateProjectionDefs },
|
|
@@ -26209,6 +26243,11 @@ const phases = [
|
|
|
26209
26243
|
{ kind: CompilationJobKind.Both, fn: generateTemporaryVariables },
|
|
26210
26244
|
{ kind: CompilationJobKind.Both, fn: optimizeVariables },
|
|
26211
26245
|
{ kind: CompilationJobKind.Both, fn: optimizeStoreLet },
|
|
26246
|
+
{ kind: CompilationJobKind.Tmpl, fn: convertI18nText },
|
|
26247
|
+
{ kind: CompilationJobKind.Tmpl, fn: convertI18nBindings },
|
|
26248
|
+
{ kind: CompilationJobKind.Tmpl, fn: removeUnusedI18nAttributesOps },
|
|
26249
|
+
{ kind: CompilationJobKind.Tmpl, fn: assignI18nSlotDependencies },
|
|
26250
|
+
{ kind: CompilationJobKind.Tmpl, fn: applyI18nExpressions },
|
|
26212
26251
|
{ kind: CompilationJobKind.Tmpl, fn: allocateSlots },
|
|
26213
26252
|
{ kind: CompilationJobKind.Tmpl, fn: resolveI18nElementPlaceholders },
|
|
26214
26253
|
{ kind: CompilationJobKind.Tmpl, fn: resolveI18nExpressionPlaceholders },
|
|
@@ -33870,7 +33909,7 @@ const MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION = '18.0.0';
|
|
|
33870
33909
|
function compileDeclareClassMetadata(metadata) {
|
|
33871
33910
|
const definitionMap = new DefinitionMap();
|
|
33872
33911
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
|
|
33873
|
-
definitionMap.set('version', literal('20.0.0-
|
|
33912
|
+
definitionMap.set('version', literal('20.0.0-rc.1'));
|
|
33874
33913
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
33875
33914
|
definitionMap.set('type', metadata.type);
|
|
33876
33915
|
definitionMap.set('decorators', metadata.decorators);
|
|
@@ -33888,7 +33927,7 @@ function compileComponentDeclareClassMetadata(metadata, dependencies) {
|
|
|
33888
33927
|
callbackReturnDefinitionMap.set('ctorParameters', metadata.ctorParameters ?? literal(null));
|
|
33889
33928
|
callbackReturnDefinitionMap.set('propDecorators', metadata.propDecorators ?? literal(null));
|
|
33890
33929
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION));
|
|
33891
|
-
definitionMap.set('version', literal('20.0.0-
|
|
33930
|
+
definitionMap.set('version', literal('20.0.0-rc.1'));
|
|
33892
33931
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
33893
33932
|
definitionMap.set('type', metadata.type);
|
|
33894
33933
|
definitionMap.set('resolveDeferredDeps', compileComponentMetadataAsyncResolver(dependencies));
|
|
@@ -33983,7 +34022,7 @@ function createDirectiveDefinitionMap(meta) {
|
|
|
33983
34022
|
const definitionMap = new DefinitionMap();
|
|
33984
34023
|
const minVersion = getMinimumVersionForPartialOutput(meta);
|
|
33985
34024
|
definitionMap.set('minVersion', literal(minVersion));
|
|
33986
|
-
definitionMap.set('version', literal('20.0.0-
|
|
34025
|
+
definitionMap.set('version', literal('20.0.0-rc.1'));
|
|
33987
34026
|
// e.g. `type: MyDirective`
|
|
33988
34027
|
definitionMap.set('type', meta.type.value);
|
|
33989
34028
|
if (meta.isStandalone !== undefined) {
|
|
@@ -34399,7 +34438,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
|
|
|
34399
34438
|
function compileDeclareFactoryFunction(meta) {
|
|
34400
34439
|
const definitionMap = new DefinitionMap();
|
|
34401
34440
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
|
|
34402
|
-
definitionMap.set('version', literal('20.0.0-
|
|
34441
|
+
definitionMap.set('version', literal('20.0.0-rc.1'));
|
|
34403
34442
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
34404
34443
|
definitionMap.set('type', meta.type.value);
|
|
34405
34444
|
definitionMap.set('deps', compileDependencies(meta.deps));
|
|
@@ -34434,7 +34473,7 @@ function compileDeclareInjectableFromMetadata(meta) {
|
|
|
34434
34473
|
function createInjectableDefinitionMap(meta) {
|
|
34435
34474
|
const definitionMap = new DefinitionMap();
|
|
34436
34475
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
|
|
34437
|
-
definitionMap.set('version', literal('20.0.0-
|
|
34476
|
+
definitionMap.set('version', literal('20.0.0-rc.1'));
|
|
34438
34477
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
34439
34478
|
definitionMap.set('type', meta.type.value);
|
|
34440
34479
|
// Only generate providedIn property if it has a non-null value
|
|
@@ -34485,7 +34524,7 @@ function compileDeclareInjectorFromMetadata(meta) {
|
|
|
34485
34524
|
function createInjectorDefinitionMap(meta) {
|
|
34486
34525
|
const definitionMap = new DefinitionMap();
|
|
34487
34526
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
|
|
34488
|
-
definitionMap.set('version', literal('20.0.0-
|
|
34527
|
+
definitionMap.set('version', literal('20.0.0-rc.1'));
|
|
34489
34528
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
34490
34529
|
definitionMap.set('type', meta.type.value);
|
|
34491
34530
|
definitionMap.set('providers', meta.providers);
|
|
@@ -34518,7 +34557,7 @@ function createNgModuleDefinitionMap(meta) {
|
|
|
34518
34557
|
throw new Error('Invalid path! Local compilation mode should not get into the partial compilation path');
|
|
34519
34558
|
}
|
|
34520
34559
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
|
|
34521
|
-
definitionMap.set('version', literal('20.0.0-
|
|
34560
|
+
definitionMap.set('version', literal('20.0.0-rc.1'));
|
|
34522
34561
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
34523
34562
|
definitionMap.set('type', meta.type.value);
|
|
34524
34563
|
// We only generate the keys in the metadata if the arrays contain values.
|
|
@@ -34569,7 +34608,7 @@ function compileDeclarePipeFromMetadata(meta) {
|
|
|
34569
34608
|
function createPipeDefinitionMap(meta) {
|
|
34570
34609
|
const definitionMap = new DefinitionMap();
|
|
34571
34610
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
|
|
34572
|
-
definitionMap.set('version', literal('20.0.0-
|
|
34611
|
+
definitionMap.set('version', literal('20.0.0-rc.1'));
|
|
34573
34612
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
34574
34613
|
// e.g. `type: MyPipe`
|
|
34575
34614
|
definitionMap.set('type', meta.type.value);
|
|
@@ -34727,7 +34766,7 @@ function compileHmrUpdateCallback(definitions, constantStatements, meta) {
|
|
|
34727
34766
|
* @description
|
|
34728
34767
|
* Entry point for all public APIs of the compiler package.
|
|
34729
34768
|
*/
|
|
34730
|
-
const VERSION = new Version('20.0.0-
|
|
34769
|
+
const VERSION = new Version('20.0.0-rc.1');
|
|
34731
34770
|
|
|
34732
34771
|
//////////////////////////////////////
|
|
34733
34772
|
// THIS FILE HAS GLOBAL SIDE EFFECT //
|