@angular/compiler 20.1.0-rc.0 → 20.2.0-next.0
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 +39 -16
- package/fesm2022/compiler.mjs.map +1 -1
- package/index.d.ts +2 -2
- package/package.json +1 -1
package/fesm2022/compiler.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v20.
|
|
2
|
+
* @license Angular v20.2.0-next.0
|
|
3
3
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -6625,7 +6625,7 @@ var ParseErrorLevel;
|
|
|
6625
6625
|
ParseErrorLevel[ParseErrorLevel["WARNING"] = 0] = "WARNING";
|
|
6626
6626
|
ParseErrorLevel[ParseErrorLevel["ERROR"] = 1] = "ERROR";
|
|
6627
6627
|
})(ParseErrorLevel || (ParseErrorLevel = {}));
|
|
6628
|
-
class ParseError {
|
|
6628
|
+
class ParseError extends Error {
|
|
6629
6629
|
span;
|
|
6630
6630
|
msg;
|
|
6631
6631
|
level;
|
|
@@ -6642,10 +6642,15 @@ class ParseError {
|
|
|
6642
6642
|
* couldn't be parsed. Not guaranteed to be defined, but can be used to provide more context.
|
|
6643
6643
|
*/
|
|
6644
6644
|
relatedError) {
|
|
6645
|
+
super(msg);
|
|
6645
6646
|
this.span = span;
|
|
6646
6647
|
this.msg = msg;
|
|
6647
6648
|
this.level = level;
|
|
6648
6649
|
this.relatedError = relatedError;
|
|
6650
|
+
// Extending `Error` ends up breaking some internal tests. This appears to be a known issue
|
|
6651
|
+
// when extending errors in TS and the workaround is to explicitly set the prototype.
|
|
6652
|
+
// https://stackoverflow.com/questions/41102060/typescript-extending-error-class
|
|
6653
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
6649
6654
|
}
|
|
6650
6655
|
contextualMessage() {
|
|
6651
6656
|
const ctx = this.span.start.getContext(100, 3);
|
|
@@ -10571,7 +10576,7 @@ class OpList {
|
|
|
10571
10576
|
oldOp.next = null;
|
|
10572
10577
|
let prev = oldPrev;
|
|
10573
10578
|
for (const newOp of newOps) {
|
|
10574
|
-
|
|
10579
|
+
OpList.assertIsUnowned(newOp);
|
|
10575
10580
|
newOp.debugListId = listId;
|
|
10576
10581
|
prev.next = newOp;
|
|
10577
10582
|
newOp.prev = prev;
|
|
@@ -10612,7 +10617,7 @@ class OpList {
|
|
|
10612
10617
|
static insertBefore(op, target) {
|
|
10613
10618
|
if (Array.isArray(op)) {
|
|
10614
10619
|
for (const o of op) {
|
|
10615
|
-
|
|
10620
|
+
OpList.insertBefore(o, target);
|
|
10616
10621
|
}
|
|
10617
10622
|
return;
|
|
10618
10623
|
}
|
|
@@ -17102,12 +17107,16 @@ class EscapedCharacterCursor extends PlainCharacterCursor {
|
|
|
17102
17107
|
}
|
|
17103
17108
|
}
|
|
17104
17109
|
}
|
|
17105
|
-
class CursorError {
|
|
17110
|
+
class CursorError extends Error {
|
|
17106
17111
|
msg;
|
|
17107
17112
|
cursor;
|
|
17108
17113
|
constructor(msg, cursor) {
|
|
17114
|
+
super(msg);
|
|
17109
17115
|
this.msg = msg;
|
|
17110
17116
|
this.cursor = cursor;
|
|
17117
|
+
// Extending `Error` does not always work when code is transpiled. See:
|
|
17118
|
+
// https://stackoverflow.com/questions/41102060/typescript-extending-error-class
|
|
17119
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
17111
17120
|
}
|
|
17112
17121
|
}
|
|
17113
17122
|
|
|
@@ -18094,9 +18103,11 @@ class Token {
|
|
|
18094
18103
|
return this.type === TokenType.Number ? this.numValue : -1;
|
|
18095
18104
|
}
|
|
18096
18105
|
isTemplateLiteralPart() {
|
|
18106
|
+
// Note: Explicit type is needed for Closure.
|
|
18097
18107
|
return this.isString() && this.kind === StringTokenKind.TemplateLiteralPart;
|
|
18098
18108
|
}
|
|
18099
18109
|
isTemplateLiteralEnd() {
|
|
18110
|
+
// Note: Explicit type is needed for Closure.
|
|
18100
18111
|
return this.isString() && this.kind === StringTokenKind.TemplateLiteralEnd;
|
|
18101
18112
|
}
|
|
18102
18113
|
isTemplateLiteralInterpolationStart() {
|
|
@@ -23606,6 +23617,18 @@ const GLOBAL_TARGET_RESOLVERS = new Map([
|
|
|
23606
23617
|
['document', Identifiers.resolveDocument],
|
|
23607
23618
|
['body', Identifiers.resolveBody],
|
|
23608
23619
|
]);
|
|
23620
|
+
/**
|
|
23621
|
+
* DOM properties that need to be remapped on the compiler side.
|
|
23622
|
+
* Note: this mapping has to be kept in sync with the equally named mapping in the runtime.
|
|
23623
|
+
*/
|
|
23624
|
+
const DOM_PROPERTY_REMAPPING = new Map([
|
|
23625
|
+
['class', 'className'],
|
|
23626
|
+
['for', 'htmlFor'],
|
|
23627
|
+
['formaction', 'formAction'],
|
|
23628
|
+
['innerHtml', 'innerHTML'],
|
|
23629
|
+
['readonly', 'readOnly'],
|
|
23630
|
+
['tabindex', 'tabIndex'],
|
|
23631
|
+
]);
|
|
23609
23632
|
/**
|
|
23610
23633
|
* Compiles semantic operations across all views and generates output `o.Statement`s with actual
|
|
23611
23634
|
* runtime calls in their place.
|
|
@@ -23878,7 +23901,7 @@ function reifyUpdateOperations(unit, ops) {
|
|
|
23878
23901
|
break;
|
|
23879
23902
|
case OpKind.Property:
|
|
23880
23903
|
OpList.replace(op, unit.job.mode === TemplateCompilationMode.DomOnly && !op.isLegacyAnimationTrigger
|
|
23881
|
-
? domProperty(op.name, op.expression, op.sanitizer, op.sourceSpan)
|
|
23904
|
+
? domProperty(DOM_PROPERTY_REMAPPING.get(op.name) ?? op.name, op.expression, op.sanitizer, op.sourceSpan)
|
|
23882
23905
|
: property(op.name, op.expression, op.sanitizer, op.sourceSpan));
|
|
23883
23906
|
break;
|
|
23884
23907
|
case OpKind.TwoWayProperty:
|
|
@@ -23917,7 +23940,7 @@ function reifyUpdateOperations(unit, ops) {
|
|
|
23917
23940
|
OpList.replace(op, syntheticHostProperty(op.name, op.expression, op.sourceSpan));
|
|
23918
23941
|
}
|
|
23919
23942
|
else {
|
|
23920
|
-
OpList.replace(op, domProperty(op.name, op.expression, op.sanitizer, op.sourceSpan));
|
|
23943
|
+
OpList.replace(op, domProperty(DOM_PROPERTY_REMAPPING.get(op.name) ?? op.name, op.expression, op.sanitizer, op.sourceSpan));
|
|
23921
23944
|
}
|
|
23922
23945
|
}
|
|
23923
23946
|
break;
|
|
@@ -33691,7 +33714,7 @@ const MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION = '18.0.0';
|
|
|
33691
33714
|
function compileDeclareClassMetadata(metadata) {
|
|
33692
33715
|
const definitionMap = new DefinitionMap();
|
|
33693
33716
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
|
|
33694
|
-
definitionMap.set('version', literal('20.
|
|
33717
|
+
definitionMap.set('version', literal('20.2.0-next.0'));
|
|
33695
33718
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
33696
33719
|
definitionMap.set('type', metadata.type);
|
|
33697
33720
|
definitionMap.set('decorators', metadata.decorators);
|
|
@@ -33709,7 +33732,7 @@ function compileComponentDeclareClassMetadata(metadata, dependencies) {
|
|
|
33709
33732
|
callbackReturnDefinitionMap.set('ctorParameters', metadata.ctorParameters ?? literal(null));
|
|
33710
33733
|
callbackReturnDefinitionMap.set('propDecorators', metadata.propDecorators ?? literal(null));
|
|
33711
33734
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION));
|
|
33712
|
-
definitionMap.set('version', literal('20.
|
|
33735
|
+
definitionMap.set('version', literal('20.2.0-next.0'));
|
|
33713
33736
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
33714
33737
|
definitionMap.set('type', metadata.type);
|
|
33715
33738
|
definitionMap.set('resolveDeferredDeps', compileComponentMetadataAsyncResolver(dependencies));
|
|
@@ -33804,7 +33827,7 @@ function createDirectiveDefinitionMap(meta) {
|
|
|
33804
33827
|
const definitionMap = new DefinitionMap();
|
|
33805
33828
|
const minVersion = getMinimumVersionForPartialOutput(meta);
|
|
33806
33829
|
definitionMap.set('minVersion', literal(minVersion));
|
|
33807
|
-
definitionMap.set('version', literal('20.
|
|
33830
|
+
definitionMap.set('version', literal('20.2.0-next.0'));
|
|
33808
33831
|
// e.g. `type: MyDirective`
|
|
33809
33832
|
definitionMap.set('type', meta.type.value);
|
|
33810
33833
|
if (meta.isStandalone !== undefined) {
|
|
@@ -34220,7 +34243,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
|
|
|
34220
34243
|
function compileDeclareFactoryFunction(meta) {
|
|
34221
34244
|
const definitionMap = new DefinitionMap();
|
|
34222
34245
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
|
|
34223
|
-
definitionMap.set('version', literal('20.
|
|
34246
|
+
definitionMap.set('version', literal('20.2.0-next.0'));
|
|
34224
34247
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
34225
34248
|
definitionMap.set('type', meta.type.value);
|
|
34226
34249
|
definitionMap.set('deps', compileDependencies(meta.deps));
|
|
@@ -34255,7 +34278,7 @@ function compileDeclareInjectableFromMetadata(meta) {
|
|
|
34255
34278
|
function createInjectableDefinitionMap(meta) {
|
|
34256
34279
|
const definitionMap = new DefinitionMap();
|
|
34257
34280
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
|
|
34258
|
-
definitionMap.set('version', literal('20.
|
|
34281
|
+
definitionMap.set('version', literal('20.2.0-next.0'));
|
|
34259
34282
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
34260
34283
|
definitionMap.set('type', meta.type.value);
|
|
34261
34284
|
// Only generate providedIn property if it has a non-null value
|
|
@@ -34306,7 +34329,7 @@ function compileDeclareInjectorFromMetadata(meta) {
|
|
|
34306
34329
|
function createInjectorDefinitionMap(meta) {
|
|
34307
34330
|
const definitionMap = new DefinitionMap();
|
|
34308
34331
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
|
|
34309
|
-
definitionMap.set('version', literal('20.
|
|
34332
|
+
definitionMap.set('version', literal('20.2.0-next.0'));
|
|
34310
34333
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
34311
34334
|
definitionMap.set('type', meta.type.value);
|
|
34312
34335
|
definitionMap.set('providers', meta.providers);
|
|
@@ -34339,7 +34362,7 @@ function createNgModuleDefinitionMap(meta) {
|
|
|
34339
34362
|
throw new Error('Invalid path! Local compilation mode should not get into the partial compilation path');
|
|
34340
34363
|
}
|
|
34341
34364
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
|
|
34342
|
-
definitionMap.set('version', literal('20.
|
|
34365
|
+
definitionMap.set('version', literal('20.2.0-next.0'));
|
|
34343
34366
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
34344
34367
|
definitionMap.set('type', meta.type.value);
|
|
34345
34368
|
// We only generate the keys in the metadata if the arrays contain values.
|
|
@@ -34390,7 +34413,7 @@ function compileDeclarePipeFromMetadata(meta) {
|
|
|
34390
34413
|
function createPipeDefinitionMap(meta) {
|
|
34391
34414
|
const definitionMap = new DefinitionMap();
|
|
34392
34415
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
|
|
34393
|
-
definitionMap.set('version', literal('20.
|
|
34416
|
+
definitionMap.set('version', literal('20.2.0-next.0'));
|
|
34394
34417
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
34395
34418
|
// e.g. `type: MyPipe`
|
|
34396
34419
|
definitionMap.set('type', meta.type.value);
|
|
@@ -34546,7 +34569,7 @@ function compileHmrUpdateCallback(definitions, constantStatements, meta) {
|
|
|
34546
34569
|
* @description
|
|
34547
34570
|
* Entry point for all public APIs of the compiler package.
|
|
34548
34571
|
*/
|
|
34549
|
-
const VERSION = new Version('20.
|
|
34572
|
+
const VERSION = new Version('20.2.0-next.0');
|
|
34550
34573
|
|
|
34551
34574
|
//////////////////////////////////////
|
|
34552
34575
|
// THIS FILE HAS GLOBAL SIDE EFFECT //
|