@angular/compiler 20.2.0-next.0 → 20.2.0-next.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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v20.2.0-next.0
2
+ * @license Angular v20.2.0-next.1
3
3
  * (c) 2010-2025 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -2987,6 +2987,7 @@ class Identifiers {
2987
2987
  static InputSignalBrandWriteType = { name: 'ɵINPUT_SIGNAL_BRAND_WRITE_TYPE', moduleName: CORE };
2988
2988
  static UnwrapDirectiveSignalInputs = { name: 'ɵUnwrapDirectiveSignalInputs', moduleName: CORE };
2989
2989
  static unwrapWritableSignal = { name: 'ɵunwrapWritableSignal', moduleName: CORE };
2990
+ static assertType = { name: 'ɵassertType', moduleName: CORE };
2990
2991
  }
2991
2992
 
2992
2993
  const DASH_CASE_REGEXP = /-+([a-z0-9])/g;
@@ -4815,8 +4816,9 @@ let Element$1 = class Element {
4815
4816
  sourceSpan;
4816
4817
  startSourceSpan;
4817
4818
  endSourceSpan;
4819
+ isVoid;
4818
4820
  i18n;
4819
- constructor(name, attributes, inputs, outputs, directives, children, references, isSelfClosing, sourceSpan, startSourceSpan, endSourceSpan, i18n) {
4821
+ constructor(name, attributes, inputs, outputs, directives, children, references, isSelfClosing, sourceSpan, startSourceSpan, endSourceSpan, isVoid, i18n) {
4820
4822
  this.name = name;
4821
4823
  this.attributes = attributes;
4822
4824
  this.inputs = inputs;
@@ -4828,6 +4830,7 @@ let Element$1 = class Element {
4828
4830
  this.sourceSpan = sourceSpan;
4829
4831
  this.startSourceSpan = startSourceSpan;
4830
4832
  this.endSourceSpan = endSourceSpan;
4833
+ this.isVoid = isVoid;
4831
4834
  this.i18n = i18n;
4832
4835
  }
4833
4836
  visit(visitor) {
@@ -13438,7 +13441,8 @@ class Element extends NodeWithI18n {
13438
13441
  isSelfClosing;
13439
13442
  startSourceSpan;
13440
13443
  endSourceSpan;
13441
- constructor(name, attrs, directives, children, isSelfClosing, sourceSpan, startSourceSpan, endSourceSpan = null, i18n) {
13444
+ isVoid;
13445
+ constructor(name, attrs, directives, children, isSelfClosing, sourceSpan, startSourceSpan, endSourceSpan = null, isVoid, i18n) {
13442
13446
  super(sourceSpan, i18n);
13443
13447
  this.name = name;
13444
13448
  this.attrs = attrs;
@@ -13447,6 +13451,7 @@ class Element extends NodeWithI18n {
13447
13451
  this.isSelfClosing = isSelfClosing;
13448
13452
  this.startSourceSpan = startSourceSpan;
13449
13453
  this.endSourceSpan = endSourceSpan;
13454
+ this.isVoid = isVoid;
13450
13455
  }
13451
13456
  visit(visitor, context) {
13452
13457
  return visitor.visitElement(this, context);
@@ -15784,6 +15789,19 @@ var CharacterReferenceType;
15784
15789
  CharacterReferenceType["HEX"] = "hexadecimal";
15785
15790
  CharacterReferenceType["DEC"] = "decimal";
15786
15791
  })(CharacterReferenceType || (CharacterReferenceType = {}));
15792
+ const SUPPORTED_BLOCKS = [
15793
+ '@if',
15794
+ '@else', // Covers `@else if` as well
15795
+ '@for',
15796
+ '@switch',
15797
+ '@case',
15798
+ '@default',
15799
+ '@empty',
15800
+ '@defer',
15801
+ '@placeholder',
15802
+ '@loading',
15803
+ '@error',
15804
+ ];
15787
15805
  // See https://www.w3.org/TR/html51/syntax.html#writing-html-documents
15788
15806
  class _Tokenizer {
15789
15807
  _getTagDefinition;
@@ -15874,10 +15892,10 @@ class _Tokenizer {
15874
15892
  // don't want to advance in case it's not `@let`.
15875
15893
  this._cursor.peek() === $AT &&
15876
15894
  !this._inInterpolation &&
15877
- this._attemptStr('@let')) {
15895
+ this._isLetStart()) {
15878
15896
  this._consumeLetDeclaration(start);
15879
15897
  }
15880
- else if (this._tokenizeBlocks && this._attemptCharCode($AT)) {
15898
+ else if (this._tokenizeBlocks && this._isBlockStart()) {
15881
15899
  this._consumeBlockStart(start);
15882
15900
  }
15883
15901
  else if (this._tokenizeBlocks &&
@@ -15917,6 +15935,7 @@ class _Tokenizer {
15917
15935
  return this._cursor.getChars(nameCursor).trim();
15918
15936
  }
15919
15937
  _consumeBlockStart(start) {
15938
+ this._requireCharCode($AT);
15920
15939
  this._beginToken(24 /* TokenType.BLOCK_OPEN_START */, start);
15921
15940
  const startToken = this._endToken([this._getBlockName()]);
15922
15941
  if (this._cursor.peek() === $LPAREN) {
@@ -15989,6 +16008,7 @@ class _Tokenizer {
15989
16008
  }
15990
16009
  }
15991
16010
  _consumeLetDeclaration(start) {
16011
+ this._requireStr('@let');
15992
16012
  this._beginToken(29 /* TokenType.LET_START */, start);
15993
16013
  // Require at least one white space after the `@let`.
15994
16014
  if (isWhitespace(this._cursor.peek())) {
@@ -16202,6 +16222,27 @@ class _Tokenizer {
16202
16222
  this._cursor.advance();
16203
16223
  return char;
16204
16224
  }
16225
+ _peekStr(chars) {
16226
+ const len = chars.length;
16227
+ if (this._cursor.charsLeft() < len) {
16228
+ return false;
16229
+ }
16230
+ const cursor = this._cursor.clone();
16231
+ for (let i = 0; i < len; i++) {
16232
+ if (cursor.peek() !== chars.charCodeAt(i)) {
16233
+ return false;
16234
+ }
16235
+ cursor.advance();
16236
+ }
16237
+ return true;
16238
+ }
16239
+ _isBlockStart() {
16240
+ return (this._cursor.peek() === $AT &&
16241
+ SUPPORTED_BLOCKS.some((blockName) => this._peekStr(blockName)));
16242
+ }
16243
+ _isLetStart() {
16244
+ return this._cursor.peek() === $AT && this._peekStr('@let');
16245
+ }
16205
16246
  _consumeEntity(textTokenType) {
16206
16247
  this._beginToken(9 /* TokenType.ENCODED_ENTITY */);
16207
16248
  const start = this._cursor.clone();
@@ -16748,7 +16789,7 @@ class _Tokenizer {
16748
16789
  if (this._tokenizeBlocks &&
16749
16790
  !this._inInterpolation &&
16750
16791
  !this._isInExpansion() &&
16751
- (this._cursor.peek() === $AT || this._cursor.peek() === $RBRACE)) {
16792
+ (this._isBlockStart() || this._isLetStart() || this._cursor.peek() === $RBRACE)) {
16752
16793
  return true;
16753
16794
  }
16754
16795
  return false;
@@ -17385,13 +17426,13 @@ class _TreeBuilder {
17385
17426
  const directives = [];
17386
17427
  this._consumeAttributesAndDirectives(attrs, directives);
17387
17428
  const fullName = this._getElementFullName(startTagToken, this._getClosestElementLikeParent());
17429
+ const tagDef = this._getTagDefinition(fullName);
17388
17430
  let selfClosing = false;
17389
17431
  // Note: There could have been a tokenizer error
17390
17432
  // so that we don't get a token for the end tag...
17391
17433
  if (this._peek.type === 2 /* TokenType.TAG_OPEN_END_VOID */) {
17392
17434
  this._advance();
17393
17435
  selfClosing = true;
17394
- const tagDef = this._getTagDefinition(fullName);
17395
17436
  if (!(tagDef?.canSelfClose || getNsPrefix(fullName) !== null || tagDef?.isVoid)) {
17396
17437
  this.errors.push(TreeError.create(fullName, startTagToken.sourceSpan, `Only void, custom and foreign elements can be self closed "${startTagToken.parts[1]}"`));
17397
17438
  }
@@ -17404,7 +17445,7 @@ class _TreeBuilder {
17404
17445
  const span = new ParseSourceSpan(startTagToken.sourceSpan.start, end, startTagToken.sourceSpan.fullStart);
17405
17446
  // Create a separate `startSpan` because `span` will be modified when there is an `end` span.
17406
17447
  const startSpan = new ParseSourceSpan(startTagToken.sourceSpan.start, end, startTagToken.sourceSpan.fullStart);
17407
- const el = new Element(fullName, attrs, directives, [], selfClosing, span, startSpan, undefined);
17448
+ const el = new Element(fullName, attrs, directives, [], selfClosing, span, startSpan, undefined, tagDef?.isVoid ?? false);
17408
17449
  const parent = this._getContainer();
17409
17450
  const isClosedByChild = parent !== null && !!this._getTagDefinition(parent)?.isClosedByChild(el.name);
17410
17451
  this._pushContainer(el, isClosedByChild);
@@ -17847,11 +17888,11 @@ class WhitespaceVisitor {
17847
17888
  if (SKIP_WS_TRIM_TAGS.has(element.name) || hasPreserveWhitespacesAttr(element.attrs)) {
17848
17889
  // don't descent into elements where we need to preserve whitespaces
17849
17890
  // but still visit all attributes to eliminate one used as a market to preserve WS
17850
- const newElement = new Element(element.name, visitAllWithSiblings(this, element.attrs), visitAllWithSiblings(this, element.directives), element.children, element.isSelfClosing, element.sourceSpan, element.startSourceSpan, element.endSourceSpan, element.i18n);
17891
+ const newElement = new Element(element.name, visitAllWithSiblings(this, element.attrs), visitAllWithSiblings(this, element.directives), element.children, element.isSelfClosing, element.sourceSpan, element.startSourceSpan, element.endSourceSpan, element.isVoid, element.i18n);
17851
17892
  this.originalNodeMap?.set(newElement, element);
17852
17893
  return newElement;
17853
17894
  }
17854
- const newElement = new Element(element.name, element.attrs, element.directives, visitAllWithSiblings(this, element.children), element.isSelfClosing, element.sourceSpan, element.startSourceSpan, element.endSourceSpan, element.i18n);
17895
+ const newElement = new Element(element.name, element.attrs, element.directives, visitAllWithSiblings(this, element.children), element.isSelfClosing, element.sourceSpan, element.startSourceSpan, element.endSourceSpan, element.isVoid, element.i18n);
17855
17896
  this.originalNodeMap?.set(newElement, element);
17856
17897
  return newElement;
17857
17898
  }
@@ -19498,12 +19539,13 @@ class _ParseAST {
19498
19539
  else {
19499
19540
  if (this.isAssignmentOperator(this.next)) {
19500
19541
  const operation = this.next.strValue;
19501
- this.advance();
19502
19542
  if (!(this.parseFlags & 1 /* ParseFlags.Action */)) {
19543
+ this.advance();
19503
19544
  this.error('Bindings cannot contain assignments');
19504
19545
  return new EmptyExpr$1(this.span(start), this.sourceSpan(start));
19505
19546
  }
19506
19547
  const receiver = new PropertyRead(this.span(start), this.sourceSpan(start), nameSpan, readReceiver, id);
19548
+ this.advance();
19507
19549
  const value = this.parseConditional();
19508
19550
  return new Binary(this.span(start), this.sourceSpan(start), operation, receiver, value);
19509
19551
  }
@@ -19622,12 +19664,13 @@ class _ParseAST {
19622
19664
  this.expectCharacter($RBRACKET);
19623
19665
  if (this.isAssignmentOperator(this.next)) {
19624
19666
  const operation = this.next.strValue;
19625
- this.advance();
19626
19667
  if (isSafe) {
19668
+ this.advance();
19627
19669
  this.error("The '?.' operator cannot be used in the assignment");
19628
19670
  }
19629
19671
  else {
19630
19672
  const binaryReceiver = new KeyedRead(this.span(start), this.sourceSpan(start), receiver, key);
19673
+ this.advance();
19631
19674
  const value = this.parseConditional();
19632
19675
  return new Binary(this.span(start), this.sourceSpan(start), operation, binaryReceiver, value);
19633
19676
  }
@@ -28988,7 +29031,7 @@ class HtmlAstToIvyAst {
28988
29031
  }
28989
29032
  else {
28990
29033
  const attrs = this.categorizePropertyAttributes(element.name, parsedProperties, i18nAttrsMeta);
28991
- parsedElement = new Element$1(element.name, attributes, attrs.bound, boundEvents, directives, children, references, element.isSelfClosing, element.sourceSpan, element.startSourceSpan, element.endSourceSpan, element.i18n);
29034
+ parsedElement = new Element$1(element.name, attributes, attrs.bound, boundEvents, directives, children, references, element.isSelfClosing, element.sourceSpan, element.startSourceSpan, element.endSourceSpan, element.isVoid, element.i18n);
28992
29035
  }
28993
29036
  if (elementHasInlineTemplate) {
28994
29037
  // If this node is an inline-template (e.g. has *ngFor) then we need to create a template
@@ -29494,7 +29537,7 @@ class NonBindableVisitor {
29494
29537
  /* inputs */ [],
29495
29538
  /* outputs */ [],
29496
29539
  /* directives */ [], children,
29497
- /* references */ [], ast.isSelfClosing, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan);
29540
+ /* references */ [], ast.isSelfClosing, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan, ast.isVoid);
29498
29541
  }
29499
29542
  visitComment(comment) {
29500
29543
  return null;
@@ -29535,7 +29578,7 @@ class NonBindableVisitor {
29535
29578
  /* inputs */ [],
29536
29579
  /* outputs */ [],
29537
29580
  /* directives */ [], children,
29538
- /* references */ [], ast.isSelfClosing, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan);
29581
+ /* references */ [], ast.isSelfClosing, ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan, false);
29539
29582
  }
29540
29583
  visitDirective(directive, context) {
29541
29584
  return null;
@@ -32042,7 +32085,7 @@ class _Visitor {
32042
32085
  this._init(_VisitorMode.Merge, interpolationConfig);
32043
32086
  this._translations = translations;
32044
32087
  // Construct a single fake root element
32045
- const wrapper = new Element('wrapper', [], [], nodes, false, undefined, undefined, undefined);
32088
+ const wrapper = new Element('wrapper', [], [], nodes, false, undefined, undefined, undefined, false);
32046
32089
  const translatedNode = wrapper.visit(this, null);
32047
32090
  if (this._inI18nBlock) {
32048
32091
  this._reportError(nodes[nodes.length - 1], 'Unclosed block');
@@ -32220,7 +32263,7 @@ class _Visitor {
32220
32263
  this._inImplicitNode = wasInImplicitNode;
32221
32264
  if (this._mode === _VisitorMode.Merge) {
32222
32265
  if (node instanceof Element) {
32223
- return new Element(node.name, this._translateAttributes(node), this._translateDirectives(node), childNodes, node.isSelfClosing, node.sourceSpan, node.startSourceSpan, node.endSourceSpan);
32266
+ return new Element(node.name, this._translateAttributes(node), this._translateDirectives(node), childNodes, node.isSelfClosing, node.sourceSpan, node.startSourceSpan, node.endSourceSpan, node.isVoid);
32224
32267
  }
32225
32268
  else {
32226
32269
  return new Component(node.componentName, node.tagName, node.fullName, this._translateAttributes(node), this._translateDirectives(node), childNodes, node.isSelfClosing, node.sourceSpan, node.startSourceSpan, node.endSourceSpan);
@@ -33714,7 +33757,7 @@ const MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION = '18.0.0';
33714
33757
  function compileDeclareClassMetadata(metadata) {
33715
33758
  const definitionMap = new DefinitionMap();
33716
33759
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
33717
- definitionMap.set('version', literal('20.2.0-next.0'));
33760
+ definitionMap.set('version', literal('20.2.0-next.1'));
33718
33761
  definitionMap.set('ngImport', importExpr(Identifiers.core));
33719
33762
  definitionMap.set('type', metadata.type);
33720
33763
  definitionMap.set('decorators', metadata.decorators);
@@ -33732,7 +33775,7 @@ function compileComponentDeclareClassMetadata(metadata, dependencies) {
33732
33775
  callbackReturnDefinitionMap.set('ctorParameters', metadata.ctorParameters ?? literal(null));
33733
33776
  callbackReturnDefinitionMap.set('propDecorators', metadata.propDecorators ?? literal(null));
33734
33777
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION));
33735
- definitionMap.set('version', literal('20.2.0-next.0'));
33778
+ definitionMap.set('version', literal('20.2.0-next.1'));
33736
33779
  definitionMap.set('ngImport', importExpr(Identifiers.core));
33737
33780
  definitionMap.set('type', metadata.type);
33738
33781
  definitionMap.set('resolveDeferredDeps', compileComponentMetadataAsyncResolver(dependencies));
@@ -33827,7 +33870,7 @@ function createDirectiveDefinitionMap(meta) {
33827
33870
  const definitionMap = new DefinitionMap();
33828
33871
  const minVersion = getMinimumVersionForPartialOutput(meta);
33829
33872
  definitionMap.set('minVersion', literal(minVersion));
33830
- definitionMap.set('version', literal('20.2.0-next.0'));
33873
+ definitionMap.set('version', literal('20.2.0-next.1'));
33831
33874
  // e.g. `type: MyDirective`
33832
33875
  definitionMap.set('type', meta.type.value);
33833
33876
  if (meta.isStandalone !== undefined) {
@@ -34243,7 +34286,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
34243
34286
  function compileDeclareFactoryFunction(meta) {
34244
34287
  const definitionMap = new DefinitionMap();
34245
34288
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
34246
- definitionMap.set('version', literal('20.2.0-next.0'));
34289
+ definitionMap.set('version', literal('20.2.0-next.1'));
34247
34290
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34248
34291
  definitionMap.set('type', meta.type.value);
34249
34292
  definitionMap.set('deps', compileDependencies(meta.deps));
@@ -34278,7 +34321,7 @@ function compileDeclareInjectableFromMetadata(meta) {
34278
34321
  function createInjectableDefinitionMap(meta) {
34279
34322
  const definitionMap = new DefinitionMap();
34280
34323
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
34281
- definitionMap.set('version', literal('20.2.0-next.0'));
34324
+ definitionMap.set('version', literal('20.2.0-next.1'));
34282
34325
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34283
34326
  definitionMap.set('type', meta.type.value);
34284
34327
  // Only generate providedIn property if it has a non-null value
@@ -34329,7 +34372,7 @@ function compileDeclareInjectorFromMetadata(meta) {
34329
34372
  function createInjectorDefinitionMap(meta) {
34330
34373
  const definitionMap = new DefinitionMap();
34331
34374
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
34332
- definitionMap.set('version', literal('20.2.0-next.0'));
34375
+ definitionMap.set('version', literal('20.2.0-next.1'));
34333
34376
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34334
34377
  definitionMap.set('type', meta.type.value);
34335
34378
  definitionMap.set('providers', meta.providers);
@@ -34362,7 +34405,7 @@ function createNgModuleDefinitionMap(meta) {
34362
34405
  throw new Error('Invalid path! Local compilation mode should not get into the partial compilation path');
34363
34406
  }
34364
34407
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
34365
- definitionMap.set('version', literal('20.2.0-next.0'));
34408
+ definitionMap.set('version', literal('20.2.0-next.1'));
34366
34409
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34367
34410
  definitionMap.set('type', meta.type.value);
34368
34411
  // We only generate the keys in the metadata if the arrays contain values.
@@ -34413,7 +34456,7 @@ function compileDeclarePipeFromMetadata(meta) {
34413
34456
  function createPipeDefinitionMap(meta) {
34414
34457
  const definitionMap = new DefinitionMap();
34415
34458
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
34416
- definitionMap.set('version', literal('20.2.0-next.0'));
34459
+ definitionMap.set('version', literal('20.2.0-next.1'));
34417
34460
  definitionMap.set('ngImport', importExpr(Identifiers.core));
34418
34461
  // e.g. `type: MyPipe`
34419
34462
  definitionMap.set('type', meta.type.value);
@@ -34569,7 +34612,7 @@ function compileHmrUpdateCallback(definitions, constantStatements, meta) {
34569
34612
  * @description
34570
34613
  * Entry point for all public APIs of the compiler package.
34571
34614
  */
34572
- const VERSION = new Version('20.2.0-next.0');
34615
+ const VERSION = new Version('20.2.0-next.1');
34573
34616
 
34574
34617
  //////////////////////////////////////
34575
34618
  // THIS FILE HAS GLOBAL SIDE EFFECT //