@angular/compiler-cli 19.1.0-next.3 → 19.1.0-rc.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.
Files changed (31) hide show
  1. package/bundles/{chunk-DVLQORCX.js → chunk-BG43WWWL.js} +2 -2
  2. package/bundles/{chunk-QMSFXNUC.js → chunk-FL5MUNIS.js} +3 -3
  3. package/bundles/{chunk-BC3UIHLS.js → chunk-MMGTGRB2.js} +18 -6
  4. package/bundles/chunk-MMGTGRB2.js.map +6 -0
  5. package/bundles/{chunk-JU5KR7ZS.js → chunk-NLSHLQF3.js} +5 -5
  6. package/bundles/chunk-NLSHLQF3.js.map +6 -0
  7. package/bundles/{chunk-F73PYGWL.js → chunk-O7ZKVJOW.js} +56 -29
  8. package/bundles/{chunk-F73PYGWL.js.map → chunk-O7ZKVJOW.js.map} +1 -1
  9. package/bundles/{chunk-CONSPLNK.js → chunk-PXMCBAEC.js} +2 -2
  10. package/bundles/{chunk-F3XFZLFK.js → chunk-T2HQMWRH.js} +3 -3
  11. package/bundles/index.js +11 -7
  12. package/bundles/index.js.map +1 -1
  13. package/bundles/linker/babel/index.js +2 -2
  14. package/bundles/linker/index.js +2 -2
  15. package/bundles/private/migrations.js +2 -2
  16. package/bundles/private/tooling.js +4 -4
  17. package/bundles/src/bin/ng_xi18n.js +5 -5
  18. package/bundles/src/bin/ngc.js +5 -5
  19. package/bundles_metadata.json +1 -1
  20. package/index.d.ts +1 -1
  21. package/linker/src/file_linker/partial_linkers/util.d.ts +1 -1
  22. package/package.json +2 -2
  23. package/src/ngtsc/hmr/src/extract_dependencies.d.ts +3 -2
  24. package/src/ngtsc/hmr/src/metadata.d.ts +3 -2
  25. package/src/ngtsc/reflection/src/typescript.d.ts +8 -1
  26. package/bundles/chunk-BC3UIHLS.js.map +0 -6
  27. package/bundles/chunk-JU5KR7ZS.js.map +0 -6
  28. /package/bundles/{chunk-DVLQORCX.js.map → chunk-BG43WWWL.js.map} +0 -0
  29. /package/bundles/{chunk-QMSFXNUC.js.map → chunk-FL5MUNIS.js.map} +0 -0
  30. /package/bundles/{chunk-CONSPLNK.js.map → chunk-PXMCBAEC.js.map} +0 -0
  31. /package/bundles/{chunk-F3XFZLFK.js.map → chunk-T2HQMWRH.js.map} +0 -0
@@ -48,7 +48,7 @@ import {
48
48
  translateStatement,
49
49
  translateType,
50
50
  typeNodeToValueExpr
51
- } from "./chunk-BC3UIHLS.js";
51
+ } from "./chunk-MMGTGRB2.js";
52
52
  import {
53
53
  PerfCheckpoint,
54
54
  PerfEvent,
@@ -8298,6 +8298,7 @@ var Mappings = class {
8298
8298
  this.raw[this.generatedCodeLine] = this.rawSegments = [];
8299
8299
  this.generatedCodeColumn = 0;
8300
8300
  first = true;
8301
+ charInHiresBoundary = false;
8301
8302
  } else {
8302
8303
  if (this.hires || first || sourcemapLocations.has(originalCharIndex)) {
8303
8304
  const segment = [this.generatedCodeColumn, sourceIndex, loc.line, loc.column];
@@ -8360,7 +8361,8 @@ var MagicString = class {
8360
8361
  sourcemapLocations: { writable: true, value: new BitSet() },
8361
8362
  storedNames: { writable: true, value: {} },
8362
8363
  indentStr: { writable: true, value: void 0 },
8363
- ignoreList: { writable: true, value: options.ignoreList }
8364
+ ignoreList: { writable: true, value: options.ignoreList },
8365
+ offset: { writable: true, value: options.offset || 0 }
8364
8366
  });
8365
8367
  this.byStart[0] = chunk;
8366
8368
  this.byEnd[string.length] = chunk;
@@ -8375,6 +8377,7 @@ var MagicString = class {
8375
8377
  return this;
8376
8378
  }
8377
8379
  appendLeft(index, content) {
8380
+ index = index + this.offset;
8378
8381
  if (typeof content !== "string")
8379
8382
  throw new TypeError("inserted content must be a string");
8380
8383
  this._split(index);
@@ -8387,6 +8390,7 @@ var MagicString = class {
8387
8390
  return this;
8388
8391
  }
8389
8392
  appendRight(index, content) {
8393
+ index = index + this.offset;
8390
8394
  if (typeof content !== "string")
8391
8395
  throw new TypeError("inserted content must be a string");
8392
8396
  this._split(index);
@@ -8399,7 +8403,7 @@ var MagicString = class {
8399
8403
  return this;
8400
8404
  }
8401
8405
  clone() {
8402
- const cloned = new MagicString(this.original, { filename: this.filename });
8406
+ const cloned = new MagicString(this.original, { filename: this.filename, offset: this.offset });
8403
8407
  let originalChunk = this.firstChunk;
8404
8408
  let clonedChunk = cloned.firstChunk = cloned.lastSearchedChunk = originalChunk.clone();
8405
8409
  while (originalChunk) {
@@ -8568,6 +8572,9 @@ var MagicString = class {
8568
8572
  return this.prependRight(index, content);
8569
8573
  }
8570
8574
  move(start, end, index) {
8575
+ start = start + this.offset;
8576
+ end = end + this.offset;
8577
+ index = index + this.offset;
8571
8578
  if (index >= start && index <= end)
8572
8579
  throw new Error("Cannot move a selection inside itself");
8573
8580
  this._split(start);
@@ -8608,6 +8615,8 @@ var MagicString = class {
8608
8615
  return this.update(start, end, content, { ...options, overwrite: !options.contentOnly });
8609
8616
  }
8610
8617
  update(start, end, content, options) {
8618
+ start = start + this.offset;
8619
+ end = end + this.offset;
8611
8620
  if (typeof content !== "string")
8612
8621
  throw new TypeError("replacement content must be a string");
8613
8622
  if (this.original.length !== 0) {
@@ -8669,6 +8678,7 @@ var MagicString = class {
8669
8678
  return this;
8670
8679
  }
8671
8680
  prependLeft(index, content) {
8681
+ index = index + this.offset;
8672
8682
  if (typeof content !== "string")
8673
8683
  throw new TypeError("inserted content must be a string");
8674
8684
  this._split(index);
@@ -8681,6 +8691,7 @@ var MagicString = class {
8681
8691
  return this;
8682
8692
  }
8683
8693
  prependRight(index, content) {
8694
+ index = index + this.offset;
8684
8695
  if (typeof content !== "string")
8685
8696
  throw new TypeError("inserted content must be a string");
8686
8697
  this._split(index);
@@ -8693,6 +8704,8 @@ var MagicString = class {
8693
8704
  return this;
8694
8705
  }
8695
8706
  remove(start, end) {
8707
+ start = start + this.offset;
8708
+ end = end + this.offset;
8696
8709
  if (this.original.length !== 0) {
8697
8710
  while (start < 0)
8698
8711
  start += this.original.length;
@@ -8717,6 +8730,8 @@ var MagicString = class {
8717
8730
  return this;
8718
8731
  }
8719
8732
  reset(start, end) {
8733
+ start = start + this.offset;
8734
+ end = end + this.offset;
8720
8735
  if (this.original.length !== 0) {
8721
8736
  while (start < 0)
8722
8737
  start += this.original.length;
@@ -8785,7 +8800,9 @@ var MagicString = class {
8785
8800
  return this.intro.substr(lineIndex + 1) + lineStr;
8786
8801
  return this.intro + lineStr;
8787
8802
  }
8788
- slice(start = 0, end = this.original.length) {
8803
+ slice(start = 0, end = this.original.length - this.offset) {
8804
+ start = start + this.offset;
8805
+ end = end + this.offset;
8789
8806
  if (this.original.length !== 0) {
8790
8807
  while (start < 0)
8791
8808
  start += this.original.length;
@@ -8974,11 +8991,7 @@ var MagicString = class {
8974
8991
  if (match.index != null) {
8975
8992
  const replacement2 = getReplacement(match, this.original);
8976
8993
  if (replacement2 !== match[0]) {
8977
- this.overwrite(
8978
- match.index,
8979
- match.index + match[0].length,
8980
- replacement2
8981
- );
8994
+ this.overwrite(match.index, match.index + match[0].length, replacement2);
8982
8995
  }
8983
8996
  }
8984
8997
  });
@@ -8987,11 +9000,7 @@ var MagicString = class {
8987
9000
  if (match && match.index != null) {
8988
9001
  const replacement2 = getReplacement(match, this.original);
8989
9002
  if (replacement2 !== match[0]) {
8990
- this.overwrite(
8991
- match.index,
8992
- match.index + match[0].length,
8993
- replacement2
8994
- );
9003
+ this.overwrite(match.index, match.index + match[0].length, replacement2);
8995
9004
  }
8996
9005
  }
8997
9006
  }
@@ -13629,8 +13638,8 @@ import { outputAst as o3 } from "@angular/compiler";
13629
13638
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/hmr/src/extract_dependencies.mjs
13630
13639
  import { outputAst as o2 } from "@angular/compiler";
13631
13640
  import ts45 from "typescript";
13632
- function extractHmrDependencies(node, definition, factory, classMetadata, debugInfo) {
13633
- var _a;
13641
+ function extractHmrDependencies(node, definition, factory, deferBlockMetadata, classMetadata, debugInfo) {
13642
+ var _a, _b;
13634
13643
  const name = ts45.isClassDeclaration(node) && node.name ? node.name.text : null;
13635
13644
  const visitor = new PotentialTopLevelReadsVisitor();
13636
13645
  const sourceFile = node.getSourceFile();
@@ -13640,6 +13649,11 @@ function extractHmrDependencies(node, definition, factory, classMetadata, debugI
13640
13649
  factory.statements.forEach((statement) => statement.visitStatement(visitor, null));
13641
13650
  classMetadata == null ? void 0 : classMetadata.visitStatement(visitor, null);
13642
13651
  debugInfo == null ? void 0 : debugInfo.visitStatement(visitor, null);
13652
+ if (deferBlockMetadata.mode === 0) {
13653
+ deferBlockMetadata.blocks.forEach((loader) => loader == null ? void 0 : loader.visitExpression(visitor, null));
13654
+ } else {
13655
+ (_b = deferBlockMetadata.dependenciesFn) == null ? void 0 : _b.visitExpression(visitor, null);
13656
+ }
13643
13657
  const availableTopLevel = getTopLevelDeclarationNames(sourceFile);
13644
13658
  return {
13645
13659
  local: Array.from(visitor.allReads).filter((r) => r !== name && availableTopLevel.has(r)),
@@ -13738,7 +13752,7 @@ var PotentialTopLevelReadsVisitor = class extends o2.RecursiveAstVisitor {
13738
13752
  if (ts45.isCallExpression(parent)) {
13739
13753
  return parent.expression === node || parent.arguments.includes(node);
13740
13754
  }
13741
- if (ts45.isPropertyAccessExpression(parent)) {
13755
+ if (ts45.isPropertyAccessExpression(parent) || ts45.isComputedPropertyName(parent) || ts45.isTemplateSpan(parent) || ts45.isSpreadAssignment(parent) || ts45.isSpreadElement(parent) || ts45.isAwaitExpression(parent) || ts45.isNonNullExpression(parent) || ts45.isIfStatement(parent) || ts45.isDoStatement(parent) || ts45.isWhileStatement(parent) || ts45.isForInStatement(parent) || ts45.isForOfStatement(parent) || ts45.isSwitchStatement(parent) || ts45.isCaseClause(parent) || ts45.isThrowStatement(parent)) {
13742
13756
  return parent.expression === node;
13743
13757
  }
13744
13758
  if (ts45.isArrayLiteralExpression(parent)) {
@@ -13747,9 +13761,18 @@ var PotentialTopLevelReadsVisitor = class extends o2.RecursiveAstVisitor {
13747
13761
  if (ts45.isPropertyAssignment(parent)) {
13748
13762
  return parent.initializer === node;
13749
13763
  }
13750
- if (ts45.isClassDeclaration(parent)) {
13764
+ if (ts45.isClassDeclaration(parent) || ts45.isFunctionDeclaration(parent) || ts45.isVariableDeclaration(parent) || ts45.isShorthandPropertyAssignment(parent)) {
13751
13765
  return parent.name === node;
13752
13766
  }
13767
+ if (ts45.isElementAccessExpression(parent)) {
13768
+ return parent.expression === node || parent.argumentExpression === node;
13769
+ }
13770
+ if (ts45.isBinaryExpression(parent)) {
13771
+ return parent.left === node || parent.right === node;
13772
+ }
13773
+ if (ts45.isImportSpecifier(parent) || ts45.isExportSpecifier(parent)) {
13774
+ return (parent.propertyName || parent.name) === node;
13775
+ }
13753
13776
  return false;
13754
13777
  }
13755
13778
  isTypeScriptNode(value) {
@@ -13758,13 +13781,13 @@ var PotentialTopLevelReadsVisitor = class extends o2.RecursiveAstVisitor {
13758
13781
  };
13759
13782
 
13760
13783
  // bazel-out/k8-fastbuild/bin/packages/compiler-cli/src/ngtsc/hmr/src/metadata.mjs
13761
- function extractHmrMetatadata(clazz, reflection, compilerHost, rootDirs, definition, factory, classMetadata, debugInfo) {
13784
+ function extractHmrMetatadata(clazz, reflection, compilerHost, rootDirs, definition, factory, deferBlockMetadata, classMetadata, debugInfo) {
13762
13785
  if (!reflection.isClass(clazz)) {
13763
13786
  return null;
13764
13787
  }
13765
13788
  const sourceFile = clazz.getSourceFile();
13766
13789
  const filePath = getProjectRelativePath(sourceFile.fileName, rootDirs, compilerHost) || compilerHost.getCanonicalFileName(sourceFile.fileName);
13767
- const dependencies = extractHmrDependencies(clazz, definition, factory, classMetadata, debugInfo);
13790
+ const dependencies = extractHmrDependencies(clazz, definition, factory, deferBlockMetadata, classMetadata, debugInfo);
13768
13791
  const meta = {
13769
13792
  type: new o3.WrappedNodeExpr(clazz.name),
13770
13793
  className: clazz.name.text,
@@ -14649,10 +14672,11 @@ var ComponentDecoratorHandler = class {
14649
14672
  return [];
14650
14673
  }
14651
14674
  const perComponentDeferredDeps = this.canDeferDeps ? this.resolveAllDeferredDependencies(resolution) : null;
14675
+ const defer = this.compileDeferBlocks(resolution);
14652
14676
  const meta = {
14653
14677
  ...analysis.meta,
14654
14678
  ...resolution,
14655
- defer: this.compileDeferBlocks(resolution)
14679
+ defer
14656
14680
  };
14657
14681
  const fac = compileNgFactoryDefField(toFactoryMetadata(meta, FactoryTarget3.Component));
14658
14682
  if (perComponentDeferredDeps !== null) {
@@ -14662,7 +14686,7 @@ var ComponentDecoratorHandler = class {
14662
14686
  const inputTransformFields = compileInputTransformFields(analysis.inputs);
14663
14687
  const classMetadata = analysis.classMetadata !== null ? compileComponentClassMetadata(analysis.classMetadata, perComponentDeferredDeps).toStmt() : null;
14664
14688
  const debugInfo = analysis.classDebugInfo !== null ? compileClassDebugInfo(analysis.classDebugInfo).toStmt() : null;
14665
- const hmrMeta = this.enableHmr ? extractHmrMetatadata(node, this.reflector, this.compilerHost, this.rootDirs, def, fac, classMetadata, debugInfo) : null;
14689
+ const hmrMeta = this.enableHmr ? extractHmrMetatadata(node, this.reflector, this.compilerHost, this.rootDirs, def, fac, defer, classMetadata, debugInfo) : null;
14666
14690
  const hmrInitializer = hmrMeta ? compileHmrInitializer(hmrMeta).toStmt() : null;
14667
14691
  const deferrableImports = this.canDeferDeps ? this.deferredSymbolTracker.getDeferrableImportDecls() : null;
14668
14692
  return compileResults(fac, def, classMetadata, "\u0275cmp", inputTransformFields, deferrableImports, debugInfo, hmrInitializer);
@@ -14678,26 +14702,28 @@ var ComponentDecoratorHandler = class {
14678
14702
  inlineTemplateLiteralExpression: analysis.template.sourceMapping.type === "direct" ? new o4.WrappedNodeExpr(analysis.template.sourceMapping.node) : null
14679
14703
  };
14680
14704
  const perComponentDeferredDeps = this.canDeferDeps ? this.resolveAllDeferredDependencies(resolution) : null;
14705
+ const defer = this.compileDeferBlocks(resolution);
14681
14706
  const meta = {
14682
14707
  ...analysis.meta,
14683
14708
  ...resolution,
14684
- defer: this.compileDeferBlocks(resolution)
14709
+ defer
14685
14710
  };
14686
14711
  const fac = compileDeclareFactory(toFactoryMetadata(meta, FactoryTarget3.Component));
14687
14712
  const inputTransformFields = compileInputTransformFields(analysis.inputs);
14688
14713
  const def = compileDeclareComponentFromMetadata(meta, analysis.template, templateInfo);
14689
14714
  const classMetadata = analysis.classMetadata !== null ? compileComponentDeclareClassMetadata(analysis.classMetadata, perComponentDeferredDeps).toStmt() : null;
14690
- const hmrMeta = this.enableHmr ? extractHmrMetatadata(node, this.reflector, this.compilerHost, this.rootDirs, def, fac, classMetadata, null) : null;
14715
+ const hmrMeta = this.enableHmr ? extractHmrMetatadata(node, this.reflector, this.compilerHost, this.rootDirs, def, fac, defer, classMetadata, null) : null;
14691
14716
  const hmrInitializer = hmrMeta ? compileHmrInitializer(hmrMeta).toStmt() : null;
14692
14717
  const deferrableImports = this.canDeferDeps ? this.deferredSymbolTracker.getDeferrableImportDecls() : null;
14693
14718
  return compileResults(fac, def, classMetadata, "\u0275cmp", inputTransformFields, deferrableImports, null, hmrInitializer);
14694
14719
  }
14695
14720
  compileLocal(node, analysis, resolution, pool) {
14696
14721
  const deferrableTypes = this.canDeferDeps ? analysis.explicitlyDeferredTypes : null;
14722
+ const defer = this.compileDeferBlocks(resolution);
14697
14723
  const meta = {
14698
14724
  ...analysis.meta,
14699
14725
  ...resolution,
14700
- defer: this.compileDeferBlocks(resolution)
14726
+ defer
14701
14727
  };
14702
14728
  if (deferrableTypes !== null) {
14703
14729
  removeDeferrableTypesFromComponentDecorator(analysis, deferrableTypes);
@@ -14707,7 +14733,7 @@ var ComponentDecoratorHandler = class {
14707
14733
  const inputTransformFields = compileInputTransformFields(analysis.inputs);
14708
14734
  const classMetadata = analysis.classMetadata !== null ? compileComponentClassMetadata(analysis.classMetadata, deferrableTypes).toStmt() : null;
14709
14735
  const debugInfo = analysis.classDebugInfo !== null ? compileClassDebugInfo(analysis.classDebugInfo).toStmt() : null;
14710
- const hmrMeta = this.enableHmr ? extractHmrMetatadata(node, this.reflector, this.compilerHost, this.rootDirs, def, fac, classMetadata, debugInfo) : null;
14736
+ const hmrMeta = this.enableHmr ? extractHmrMetatadata(node, this.reflector, this.compilerHost, this.rootDirs, def, fac, defer, classMetadata, debugInfo) : null;
14711
14737
  const hmrInitializer = hmrMeta ? compileHmrInitializer(hmrMeta).toStmt() : null;
14712
14738
  const deferrableImports = this.canDeferDeps ? this.deferredSymbolTracker.getDeferrableImportDecls() : null;
14713
14739
  return compileResults(fac, def, classMetadata, "\u0275cmp", inputTransformFields, deferrableImports, debugInfo, hmrInitializer);
@@ -14717,16 +14743,17 @@ var ComponentDecoratorHandler = class {
14717
14743
  return null;
14718
14744
  }
14719
14745
  const pool = new ConstantPool2();
14746
+ const defer = this.compileDeferBlocks(resolution);
14720
14747
  const meta = {
14721
14748
  ...analysis.meta,
14722
14749
  ...resolution,
14723
- defer: this.compileDeferBlocks(resolution)
14750
+ defer
14724
14751
  };
14725
14752
  const fac = compileNgFactoryDefField(toFactoryMetadata(meta, FactoryTarget3.Component));
14726
14753
  const def = compileComponentFromMetadata(meta, pool, makeBindingParser2());
14727
14754
  const classMetadata = analysis.classMetadata !== null ? compileComponentClassMetadata(analysis.classMetadata, null).toStmt() : null;
14728
14755
  const debugInfo = analysis.classDebugInfo !== null ? compileClassDebugInfo(analysis.classDebugInfo).toStmt() : null;
14729
- const hmrMeta = this.enableHmr ? extractHmrMetatadata(node, this.reflector, this.compilerHost, this.rootDirs, def, fac, classMetadata, debugInfo) : null;
14756
+ const hmrMeta = this.enableHmr ? extractHmrMetatadata(node, this.reflector, this.compilerHost, this.rootDirs, def, fac, defer, classMetadata, debugInfo) : null;
14730
14757
  const res = compileResults(fac, def, classMetadata, "\u0275cmp", null, null, debugInfo, null);
14731
14758
  return hmrMeta === null || res.length === 0 ? null : getHmrUpdateDeclaration(res, pool.statements, hmrMeta, node.getSourceFile());
14732
14759
  }
@@ -15456,4 +15483,4 @@ export {
15456
15483
  * Use of this source code is governed by an MIT-style license that can be
15457
15484
  * found in the LICENSE file at https://angular.dev/license
15458
15485
  */
15459
- //# sourceMappingURL=chunk-F73PYGWL.js.map
15486
+ //# sourceMappingURL=chunk-O7ZKVJOW.js.map