@angular/compiler-cli 19.1.4 → 19.1.5

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.
@@ -12,7 +12,7 @@ import {
12
12
  formatDiagnostics,
13
13
  performCompilation,
14
14
  readConfiguration
15
- } from "./chunk-FKFYHCYY.js";
15
+ } from "./chunk-DNXA7U6Z.js";
16
16
 
17
17
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/main.mjs
18
18
  import ts2 from "typescript";
@@ -363,4 +363,4 @@ export {
363
363
  * Use of this source code is governed by an MIT-style license that can be
364
364
  * found in the LICENSE file at https://angular.dev/license
365
365
  */
366
- //# sourceMappingURL=chunk-IWQC66R5.js.map
366
+ //# sourceMappingURL=chunk-ADWOXAAC.js.map
@@ -10,7 +10,7 @@ import {
10
10
  tryParseSignalInputMapping,
11
11
  tryParseSignalModelMapping,
12
12
  tryParseSignalQueryFromInitializer
13
- } from "./chunk-DTXH7LOW.js";
13
+ } from "./chunk-K5NXWRJU.js";
14
14
  import {
15
15
  ImportManager,
16
16
  ImportedSymbolsTracker,
@@ -536,4 +536,4 @@ export {
536
536
  * Use of this source code is governed by an MIT-style license that can be
537
537
  * found in the LICENSE file at https://angular.dev/license
538
538
  */
539
- //# sourceMappingURL=chunk-VKWVSPWR.js.map
539
+ //# sourceMappingURL=chunk-DNKJBJUY.js.map
@@ -4,7 +4,7 @@
4
4
 
5
5
  import {
6
6
  angularJitApplicationTransform
7
- } from "./chunk-VKWVSPWR.js";
7
+ } from "./chunk-DNKJBJUY.js";
8
8
  import {
9
9
  CompilationMode,
10
10
  ComponentDecoratorHandler,
@@ -51,7 +51,7 @@ import {
51
51
  retagAllTsFiles,
52
52
  tryParseInitializerApi,
53
53
  untagAllTsFiles
54
- } from "./chunk-DTXH7LOW.js";
54
+ } from "./chunk-K5NXWRJU.js";
55
55
  import {
56
56
  AbsoluteModuleStrategy,
57
57
  AliasStrategy,
@@ -5034,4 +5034,4 @@ export {
5034
5034
  * Use of this source code is governed by an MIT-style license that can be
5035
5035
  * found in the LICENSE file at https://angular.dev/license
5036
5036
  */
5037
- //# sourceMappingURL=chunk-FKFYHCYY.js.map
5037
+ //# sourceMappingURL=chunk-DNXA7U6Z.js.map
@@ -4,7 +4,7 @@
4
4
 
5
5
  import {
6
6
  angularJitApplicationTransform
7
- } from "./chunk-VKWVSPWR.js";
7
+ } from "./chunk-DNKJBJUY.js";
8
8
 
9
9
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/private/tooling.mjs
10
10
  var GLOBAL_DEFS_FOR_TERSER = {
@@ -31,4 +31,4 @@ export {
31
31
  * Use of this source code is governed by an MIT-style license that can be
32
32
  * found in the LICENSE file at https://angular.dev/license
33
33
  */
34
- //# sourceMappingURL=chunk-XZ4L2FK2.js.map
34
+ //# sourceMappingURL=chunk-EEK4TGRE.js.map
@@ -741,10 +741,10 @@ var StaticInterpreter = class {
741
741
  visitEnumDeclaration(node, context) {
742
742
  const enumRef = this.getReference(node, context);
743
743
  const map = /* @__PURE__ */ new Map();
744
- node.members.forEach((member) => {
744
+ node.members.forEach((member, index) => {
745
745
  const name = this.stringNameFromPropertyName(member.name, context);
746
746
  if (name !== void 0) {
747
- const resolved = member.initializer && this.visit(member.initializer, context);
747
+ const resolved = member.initializer ? this.visit(member.initializer, context) : index;
748
748
  map.set(name, new EnumValue(enumRef, name, resolved));
749
749
  }
750
750
  });
@@ -13638,7 +13638,7 @@ import { outputAst as o3 } from "@angular/compiler";
13638
13638
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/hmr/src/extract_dependencies.mjs
13639
13639
  import { outputAst as o2 } from "@angular/compiler";
13640
13640
  import ts45 from "typescript";
13641
- function extractHmrDependencies(node, definition, factory, deferBlockMetadata, classMetadata, debugInfo) {
13641
+ function extractHmrDependencies(node, definition, factory, deferBlockMetadata, classMetadata, debugInfo, reflection, evaluator) {
13642
13642
  var _a, _b;
13643
13643
  const name = ts45.isClassDeclaration(node) && node.name ? node.name.text : null;
13644
13644
  const visitor = new PotentialTopLevelReadsVisitor();
@@ -13655,19 +13655,55 @@ function extractHmrDependencies(node, definition, factory, deferBlockMetadata, c
13655
13655
  (_b = deferBlockMetadata.dependenciesFn) == null ? void 0 : _b.visitExpression(visitor, null);
13656
13656
  }
13657
13657
  const availableTopLevel = getTopLevelDeclarationNames(sourceFile);
13658
+ const local = [];
13659
+ const seenLocals = /* @__PURE__ */ new Set();
13660
+ for (const readNode of visitor.allReads) {
13661
+ const readName = readNode instanceof o2.ReadVarExpr ? readNode.name : readNode.text;
13662
+ if (readName !== name && !seenLocals.has(readName) && availableTopLevel.has(readName)) {
13663
+ const runtimeRepresentation = getRuntimeRepresentation(readNode, reflection, evaluator);
13664
+ if (runtimeRepresentation === null) {
13665
+ return null;
13666
+ }
13667
+ local.push({ name: readName, runtimeRepresentation });
13668
+ seenLocals.add(readName);
13669
+ }
13670
+ }
13658
13671
  return {
13659
- local: Array.from(visitor.allReads).filter((r) => r !== name && availableTopLevel.has(r)),
13672
+ local,
13660
13673
  external: Array.from(visitor.namespaceReads, (name2, index) => ({
13661
13674
  moduleName: name2,
13662
13675
  assignedName: `\u0275hmr${index}`
13663
13676
  }))
13664
13677
  };
13665
13678
  }
13679
+ function getRuntimeRepresentation(node, reflection, evaluator) {
13680
+ if (node instanceof o2.ReadVarExpr) {
13681
+ return o2.variable(node.name);
13682
+ }
13683
+ if (isConstEnumReference(node, reflection)) {
13684
+ const evaluated = evaluator.evaluate(node);
13685
+ if (evaluated instanceof Map) {
13686
+ const members = [];
13687
+ for (const [name, value] of evaluated.entries()) {
13688
+ if (value instanceof EnumValue && (value.resolved == null || typeof value.resolved === "string" || typeof value.resolved === "boolean" || typeof value.resolved === "number")) {
13689
+ members.push({
13690
+ key: name,
13691
+ quoted: false,
13692
+ value: o2.literal(value.resolved)
13693
+ });
13694
+ } else {
13695
+ return null;
13696
+ }
13697
+ }
13698
+ return o2.literalMap(members);
13699
+ }
13700
+ }
13701
+ return o2.variable(node.text);
13702
+ }
13666
13703
  function getTopLevelDeclarationNames(sourceFile) {
13667
- var _a;
13668
13704
  const results = /* @__PURE__ */ new Set();
13669
13705
  for (const node of sourceFile.statements) {
13670
- if (ts45.isClassDeclaration(node) || ts45.isFunctionDeclaration(node) || ts45.isEnumDeclaration(node) && !((_a = node.modifiers) == null ? void 0 : _a.some((m) => m.kind === ts45.SyntaxKind.ConstKeyword))) {
13706
+ if (ts45.isClassDeclaration(node) || ts45.isFunctionDeclaration(node) || ts45.isEnumDeclaration(node)) {
13671
13707
  if (node.name) {
13672
13708
  results.add(node.name.text);
13673
13709
  }
@@ -13725,7 +13761,7 @@ var PotentialTopLevelReadsVisitor = class extends o2.RecursiveAstVisitor {
13725
13761
  super.visitExternalExpr(ast, context);
13726
13762
  }
13727
13763
  visitReadVarExpr(ast, context) {
13728
- this.allReads.add(ast.name);
13764
+ this.allReads.add(ast);
13729
13765
  super.visitReadVarExpr(ast, context);
13730
13766
  }
13731
13767
  visitWrappedNodeExpr(ast, context) {
@@ -13736,7 +13772,7 @@ var PotentialTopLevelReadsVisitor = class extends o2.RecursiveAstVisitor {
13736
13772
  }
13737
13773
  addAllTopLevelIdentifiers = (node) => {
13738
13774
  if (ts45.isIdentifier(node) && this.isTopLevelIdentifierReference(node)) {
13739
- this.allReads.add(node.text);
13775
+ this.allReads.add(node);
13740
13776
  } else {
13741
13777
  ts45.forEachChild(node, this.addAllTopLevelIdentifiers);
13742
13778
  }
@@ -13801,15 +13837,27 @@ var PotentialTopLevelReadsVisitor = class extends o2.RecursiveAstVisitor {
13801
13837
  return !!value && typeof value.kind === "number";
13802
13838
  }
13803
13839
  };
13840
+ function isConstEnumReference(node, reflection) {
13841
+ var _a;
13842
+ const parent = node.parent;
13843
+ if (!parent || !ts45.isPropertyAccessExpression(parent) || parent.expression !== node || !ts45.isIdentifier(parent.name)) {
13844
+ return false;
13845
+ }
13846
+ const declaration = reflection.getDeclarationOfIdentifier(node);
13847
+ return declaration !== null && ts45.isEnumDeclaration(declaration.node) && !!((_a = declaration.node.modifiers) == null ? void 0 : _a.some((m) => m.kind === ts45.SyntaxKind.ConstKeyword));
13848
+ }
13804
13849
 
13805
13850
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/hmr/src/metadata.mjs
13806
- function extractHmrMetatadata(clazz, reflection, compilerHost, rootDirs, definition, factory, deferBlockMetadata, classMetadata, debugInfo) {
13851
+ function extractHmrMetatadata(clazz, reflection, evaluator, compilerHost, rootDirs, definition, factory, deferBlockMetadata, classMetadata, debugInfo) {
13807
13852
  if (!reflection.isClass(clazz)) {
13808
13853
  return null;
13809
13854
  }
13810
13855
  const sourceFile = clazz.getSourceFile();
13811
13856
  const filePath = getProjectRelativePath(sourceFile.fileName, rootDirs, compilerHost) || compilerHost.getCanonicalFileName(sourceFile.fileName);
13812
- const dependencies = extractHmrDependencies(clazz, definition, factory, deferBlockMetadata, classMetadata, debugInfo);
13857
+ const dependencies = extractHmrDependencies(clazz, definition, factory, deferBlockMetadata, classMetadata, debugInfo, reflection, evaluator);
13858
+ if (dependencies === null) {
13859
+ return null;
13860
+ }
13813
13861
  const meta = {
13814
13862
  type: new o3.WrappedNodeExpr(clazz.name),
13815
13863
  className: clazz.name.text,
@@ -14721,7 +14769,7 @@ var ComponentDecoratorHandler = class {
14721
14769
  const inputTransformFields = compileInputTransformFields(analysis.inputs);
14722
14770
  const classMetadata = analysis.classMetadata !== null ? compileComponentClassMetadata(analysis.classMetadata, perComponentDeferredDeps).toStmt() : null;
14723
14771
  const debugInfo = analysis.classDebugInfo !== null ? compileClassDebugInfo(analysis.classDebugInfo).toStmt() : null;
14724
- const hmrMeta = this.enableHmr ? extractHmrMetatadata(node, this.reflector, this.compilerHost, this.rootDirs, def, fac, defer, classMetadata, debugInfo) : null;
14772
+ const hmrMeta = this.enableHmr ? extractHmrMetatadata(node, this.reflector, this.evaluator, this.compilerHost, this.rootDirs, def, fac, defer, classMetadata, debugInfo) : null;
14725
14773
  const hmrInitializer = hmrMeta ? compileHmrInitializer(hmrMeta).toStmt() : null;
14726
14774
  const deferrableImports = this.canDeferDeps ? this.deferredSymbolTracker.getDeferrableImportDecls() : null;
14727
14775
  return compileResults(fac, def, classMetadata, "\u0275cmp", inputTransformFields, deferrableImports, debugInfo, hmrInitializer);
@@ -14747,7 +14795,7 @@ var ComponentDecoratorHandler = class {
14747
14795
  const inputTransformFields = compileInputTransformFields(analysis.inputs);
14748
14796
  const def = compileDeclareComponentFromMetadata(meta, analysis.template, templateInfo);
14749
14797
  const classMetadata = analysis.classMetadata !== null ? compileComponentDeclareClassMetadata(analysis.classMetadata, perComponentDeferredDeps).toStmt() : null;
14750
- const hmrMeta = this.enableHmr ? extractHmrMetatadata(node, this.reflector, this.compilerHost, this.rootDirs, def, fac, defer, classMetadata, null) : null;
14798
+ const hmrMeta = this.enableHmr ? extractHmrMetatadata(node, this.reflector, this.evaluator, this.compilerHost, this.rootDirs, def, fac, defer, classMetadata, null) : null;
14751
14799
  const hmrInitializer = hmrMeta ? compileHmrInitializer(hmrMeta).toStmt() : null;
14752
14800
  const deferrableImports = this.canDeferDeps ? this.deferredSymbolTracker.getDeferrableImportDecls() : null;
14753
14801
  return compileResults(fac, def, classMetadata, "\u0275cmp", inputTransformFields, deferrableImports, null, hmrInitializer);
@@ -14768,7 +14816,7 @@ var ComponentDecoratorHandler = class {
14768
14816
  const inputTransformFields = compileInputTransformFields(analysis.inputs);
14769
14817
  const classMetadata = analysis.classMetadata !== null ? compileComponentClassMetadata(analysis.classMetadata, deferrableTypes).toStmt() : null;
14770
14818
  const debugInfo = analysis.classDebugInfo !== null ? compileClassDebugInfo(analysis.classDebugInfo).toStmt() : null;
14771
- const hmrMeta = this.enableHmr ? extractHmrMetatadata(node, this.reflector, this.compilerHost, this.rootDirs, def, fac, defer, classMetadata, debugInfo) : null;
14819
+ const hmrMeta = this.enableHmr ? extractHmrMetatadata(node, this.reflector, this.evaluator, this.compilerHost, this.rootDirs, def, fac, defer, classMetadata, debugInfo) : null;
14772
14820
  const hmrInitializer = hmrMeta ? compileHmrInitializer(hmrMeta).toStmt() : null;
14773
14821
  const deferrableImports = this.canDeferDeps ? this.deferredSymbolTracker.getDeferrableImportDecls() : null;
14774
14822
  return compileResults(fac, def, classMetadata, "\u0275cmp", inputTransformFields, deferrableImports, debugInfo, hmrInitializer);
@@ -14788,7 +14836,7 @@ var ComponentDecoratorHandler = class {
14788
14836
  const def = compileComponentFromMetadata(meta, pool, makeBindingParser2());
14789
14837
  const classMetadata = analysis.classMetadata !== null ? compileComponentClassMetadata(analysis.classMetadata, null).toStmt() : null;
14790
14838
  const debugInfo = analysis.classDebugInfo !== null ? compileClassDebugInfo(analysis.classDebugInfo).toStmt() : null;
14791
- const hmrMeta = this.enableHmr ? extractHmrMetatadata(node, this.reflector, this.compilerHost, this.rootDirs, def, fac, defer, classMetadata, debugInfo) : null;
14839
+ const hmrMeta = this.enableHmr ? extractHmrMetatadata(node, this.reflector, this.evaluator, this.compilerHost, this.rootDirs, def, fac, defer, classMetadata, debugInfo) : null;
14792
14840
  const res = compileResults(fac, def, classMetadata, "\u0275cmp", null, null, debugInfo, null);
14793
14841
  return hmrMeta === null || res.length === 0 ? null : getHmrUpdateDeclaration(res, pool.statements, hmrMeta, node.getSourceFile());
14794
14842
  }
@@ -15518,4 +15566,4 @@ export {
15518
15566
  * Use of this source code is governed by an MIT-style license that can be
15519
15567
  * found in the LICENSE file at https://angular.dev/license
15520
15568
  */
15521
- //# sourceMappingURL=chunk-DTXH7LOW.js.map
15569
+ //# sourceMappingURL=chunk-K5NXWRJU.js.map