@angular/compiler-cli 19.2.0-next.1 → 19.2.0-next.2

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.
@@ -311,7 +311,7 @@ import { compileDirectiveFromMetadata, makeBindingParser, ParseLocation, ParseSo
311
311
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/linker/src/file_linker/partial_linkers/util.mjs
312
312
  import { createMayBeForwardRefExpression, outputAst as o2 } from "@angular/compiler";
313
313
  import semver from "semver";
314
- var PLACEHOLDER_VERSION = "19.2.0-next.1";
314
+ var PLACEHOLDER_VERSION = "19.2.0-next.2";
315
315
  function wrapReference(wrapped) {
316
316
  return { value: wrapped, type: wrapped };
317
317
  }
@@ -4,7 +4,7 @@
4
4
 
5
5
  import {
6
6
  angularJitApplicationTransform
7
- } from "./chunk-NVY57P6E.js";
7
+ } from "./chunk-SPTIAMJL.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-QAZCJIR5.js";
54
+ } from "./chunk-GSGK42HV.js";
55
55
  import {
56
56
  AbsoluteModuleStrategy,
57
57
  AliasStrategy,
@@ -1163,7 +1163,7 @@ function compareVersions(v1, v2) {
1163
1163
 
1164
1164
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/typescript_support.mjs
1165
1165
  var MIN_TS_VERSION = "5.5.0";
1166
- var MAX_TS_VERSION = "5.8.0";
1166
+ var MAX_TS_VERSION = "5.9.0";
1167
1167
  var tsVersion = ts12.version;
1168
1168
  function checkVersion(version, minVersion, maxVersion) {
1169
1169
  if (compareVersions(version, minVersion) < 0 || compareVersions(version, maxVersion) >= 0) {
@@ -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-LPSGMAO4.js.map
5037
+ //# sourceMappingURL=chunk-3WDOF2PD.js.map
@@ -12,7 +12,7 @@ import {
12
12
  formatDiagnostics,
13
13
  performCompilation,
14
14
  readConfiguration
15
- } from "./chunk-LPSGMAO4.js";
15
+ } from "./chunk-3WDOF2PD.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-5COTWN7J.js.map
366
+ //# sourceMappingURL=chunk-7U2MEXOV.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
  });
@@ -13667,7 +13667,7 @@ import { outputAst as o3 } from "@angular/compiler";
13667
13667
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/hmr/src/extract_dependencies.mjs
13668
13668
  import { outputAst as o2 } from "@angular/compiler";
13669
13669
  import ts45 from "typescript";
13670
- function extractHmrDependencies(node, definition, factory, deferBlockMetadata, classMetadata, debugInfo) {
13670
+ function extractHmrDependencies(node, definition, factory, deferBlockMetadata, classMetadata, debugInfo, reflection, evaluator) {
13671
13671
  var _a, _b;
13672
13672
  const name = ts45.isClassDeclaration(node) && node.name ? node.name.text : null;
13673
13673
  const visitor = new PotentialTopLevelReadsVisitor();
@@ -13684,19 +13684,55 @@ function extractHmrDependencies(node, definition, factory, deferBlockMetadata, c
13684
13684
  (_b = deferBlockMetadata.dependenciesFn) == null ? void 0 : _b.visitExpression(visitor, null);
13685
13685
  }
13686
13686
  const availableTopLevel = getTopLevelDeclarationNames(sourceFile);
13687
+ const local = [];
13688
+ const seenLocals = /* @__PURE__ */ new Set();
13689
+ for (const readNode of visitor.allReads) {
13690
+ const readName = readNode instanceof o2.ReadVarExpr ? readNode.name : readNode.text;
13691
+ if (readName !== name && !seenLocals.has(readName) && availableTopLevel.has(readName)) {
13692
+ const runtimeRepresentation = getRuntimeRepresentation(readNode, reflection, evaluator);
13693
+ if (runtimeRepresentation === null) {
13694
+ return null;
13695
+ }
13696
+ local.push({ name: readName, runtimeRepresentation });
13697
+ seenLocals.add(readName);
13698
+ }
13699
+ }
13687
13700
  return {
13688
- local: Array.from(visitor.allReads).filter((r) => r !== name && availableTopLevel.has(r)),
13701
+ local,
13689
13702
  external: Array.from(visitor.namespaceReads, (name2, index) => ({
13690
13703
  moduleName: name2,
13691
13704
  assignedName: `\u0275hmr${index}`
13692
13705
  }))
13693
13706
  };
13694
13707
  }
13708
+ function getRuntimeRepresentation(node, reflection, evaluator) {
13709
+ if (node instanceof o2.ReadVarExpr) {
13710
+ return o2.variable(node.name);
13711
+ }
13712
+ if (isConstEnumReference(node, reflection)) {
13713
+ const evaluated = evaluator.evaluate(node);
13714
+ if (evaluated instanceof Map) {
13715
+ const members = [];
13716
+ for (const [name, value] of evaluated.entries()) {
13717
+ if (value instanceof EnumValue && (value.resolved == null || typeof value.resolved === "string" || typeof value.resolved === "boolean" || typeof value.resolved === "number")) {
13718
+ members.push({
13719
+ key: name,
13720
+ quoted: false,
13721
+ value: o2.literal(value.resolved)
13722
+ });
13723
+ } else {
13724
+ return null;
13725
+ }
13726
+ }
13727
+ return o2.literalMap(members);
13728
+ }
13729
+ }
13730
+ return o2.variable(node.text);
13731
+ }
13695
13732
  function getTopLevelDeclarationNames(sourceFile) {
13696
- var _a;
13697
13733
  const results = /* @__PURE__ */ new Set();
13698
13734
  for (const node of sourceFile.statements) {
13699
- if (ts45.isClassDeclaration(node) || ts45.isFunctionDeclaration(node) || ts45.isEnumDeclaration(node) && !((_a = node.modifiers) == null ? void 0 : _a.some((m) => m.kind === ts45.SyntaxKind.ConstKeyword))) {
13735
+ if (ts45.isClassDeclaration(node) || ts45.isFunctionDeclaration(node) || ts45.isEnumDeclaration(node)) {
13700
13736
  if (node.name) {
13701
13737
  results.add(node.name.text);
13702
13738
  }
@@ -13754,7 +13790,7 @@ var PotentialTopLevelReadsVisitor = class extends o2.RecursiveAstVisitor {
13754
13790
  super.visitExternalExpr(ast, context);
13755
13791
  }
13756
13792
  visitReadVarExpr(ast, context) {
13757
- this.allReads.add(ast.name);
13793
+ this.allReads.add(ast);
13758
13794
  super.visitReadVarExpr(ast, context);
13759
13795
  }
13760
13796
  visitWrappedNodeExpr(ast, context) {
@@ -13765,7 +13801,7 @@ var PotentialTopLevelReadsVisitor = class extends o2.RecursiveAstVisitor {
13765
13801
  }
13766
13802
  addAllTopLevelIdentifiers = (node) => {
13767
13803
  if (ts45.isIdentifier(node) && this.isTopLevelIdentifierReference(node)) {
13768
- this.allReads.add(node.text);
13804
+ this.allReads.add(node);
13769
13805
  } else {
13770
13806
  ts45.forEachChild(node, this.addAllTopLevelIdentifiers);
13771
13807
  }
@@ -13830,15 +13866,27 @@ var PotentialTopLevelReadsVisitor = class extends o2.RecursiveAstVisitor {
13830
13866
  return !!value && typeof value.kind === "number";
13831
13867
  }
13832
13868
  };
13869
+ function isConstEnumReference(node, reflection) {
13870
+ var _a;
13871
+ const parent = node.parent;
13872
+ if (!parent || !ts45.isPropertyAccessExpression(parent) || parent.expression !== node || !ts45.isIdentifier(parent.name)) {
13873
+ return false;
13874
+ }
13875
+ const declaration = reflection.getDeclarationOfIdentifier(node);
13876
+ return declaration !== null && ts45.isEnumDeclaration(declaration.node) && !!((_a = declaration.node.modifiers) == null ? void 0 : _a.some((m) => m.kind === ts45.SyntaxKind.ConstKeyword));
13877
+ }
13833
13878
 
13834
13879
  // bazel-out/darwin_arm64-fastbuild/bin/packages/compiler-cli/src/ngtsc/hmr/src/metadata.mjs
13835
- function extractHmrMetatadata(clazz, reflection, compilerHost, rootDirs, definition, factory, deferBlockMetadata, classMetadata, debugInfo) {
13880
+ function extractHmrMetatadata(clazz, reflection, evaluator, compilerHost, rootDirs, definition, factory, deferBlockMetadata, classMetadata, debugInfo) {
13836
13881
  if (!reflection.isClass(clazz)) {
13837
13882
  return null;
13838
13883
  }
13839
13884
  const sourceFile = clazz.getSourceFile();
13840
13885
  const filePath = getProjectRelativePath(sourceFile.fileName, rootDirs, compilerHost) || compilerHost.getCanonicalFileName(sourceFile.fileName);
13841
- const dependencies = extractHmrDependencies(clazz, definition, factory, deferBlockMetadata, classMetadata, debugInfo);
13886
+ const dependencies = extractHmrDependencies(clazz, definition, factory, deferBlockMetadata, classMetadata, debugInfo, reflection, evaluator);
13887
+ if (dependencies === null) {
13888
+ return null;
13889
+ }
13842
13890
  const meta = {
13843
13891
  type: new o3.WrappedNodeExpr(clazz.name),
13844
13892
  className: clazz.name.text,
@@ -14750,7 +14798,7 @@ var ComponentDecoratorHandler = class {
14750
14798
  const inputTransformFields = compileInputTransformFields(analysis.inputs);
14751
14799
  const classMetadata = analysis.classMetadata !== null ? compileComponentClassMetadata(analysis.classMetadata, perComponentDeferredDeps).toStmt() : null;
14752
14800
  const debugInfo = analysis.classDebugInfo !== null ? compileClassDebugInfo(analysis.classDebugInfo).toStmt() : null;
14753
- const hmrMeta = this.enableHmr ? extractHmrMetatadata(node, this.reflector, this.compilerHost, this.rootDirs, def, fac, defer, classMetadata, debugInfo) : null;
14801
+ const hmrMeta = this.enableHmr ? extractHmrMetatadata(node, this.reflector, this.evaluator, this.compilerHost, this.rootDirs, def, fac, defer, classMetadata, debugInfo) : null;
14754
14802
  const hmrInitializer = hmrMeta ? compileHmrInitializer(hmrMeta).toStmt() : null;
14755
14803
  const deferrableImports = this.canDeferDeps ? this.deferredSymbolTracker.getDeferrableImportDecls() : null;
14756
14804
  return compileResults(fac, def, classMetadata, "\u0275cmp", inputTransformFields, deferrableImports, debugInfo, hmrInitializer);
@@ -14776,7 +14824,7 @@ var ComponentDecoratorHandler = class {
14776
14824
  const inputTransformFields = compileInputTransformFields(analysis.inputs);
14777
14825
  const def = compileDeclareComponentFromMetadata(meta, analysis.template, templateInfo);
14778
14826
  const classMetadata = analysis.classMetadata !== null ? compileComponentDeclareClassMetadata(analysis.classMetadata, perComponentDeferredDeps).toStmt() : null;
14779
- const hmrMeta = this.enableHmr ? extractHmrMetatadata(node, this.reflector, this.compilerHost, this.rootDirs, def, fac, defer, classMetadata, null) : null;
14827
+ const hmrMeta = this.enableHmr ? extractHmrMetatadata(node, this.reflector, this.evaluator, this.compilerHost, this.rootDirs, def, fac, defer, classMetadata, null) : null;
14780
14828
  const hmrInitializer = hmrMeta ? compileHmrInitializer(hmrMeta).toStmt() : null;
14781
14829
  const deferrableImports = this.canDeferDeps ? this.deferredSymbolTracker.getDeferrableImportDecls() : null;
14782
14830
  return compileResults(fac, def, classMetadata, "\u0275cmp", inputTransformFields, deferrableImports, null, hmrInitializer);
@@ -14797,7 +14845,7 @@ var ComponentDecoratorHandler = class {
14797
14845
  const inputTransformFields = compileInputTransformFields(analysis.inputs);
14798
14846
  const classMetadata = analysis.classMetadata !== null ? compileComponentClassMetadata(analysis.classMetadata, deferrableTypes).toStmt() : null;
14799
14847
  const debugInfo = analysis.classDebugInfo !== null ? compileClassDebugInfo(analysis.classDebugInfo).toStmt() : null;
14800
- const hmrMeta = this.enableHmr ? extractHmrMetatadata(node, this.reflector, this.compilerHost, this.rootDirs, def, fac, defer, classMetadata, debugInfo) : null;
14848
+ const hmrMeta = this.enableHmr ? extractHmrMetatadata(node, this.reflector, this.evaluator, this.compilerHost, this.rootDirs, def, fac, defer, classMetadata, debugInfo) : null;
14801
14849
  const hmrInitializer = hmrMeta ? compileHmrInitializer(hmrMeta).toStmt() : null;
14802
14850
  const deferrableImports = this.canDeferDeps ? this.deferredSymbolTracker.getDeferrableImportDecls() : null;
14803
14851
  return compileResults(fac, def, classMetadata, "\u0275cmp", inputTransformFields, deferrableImports, debugInfo, hmrInitializer);
@@ -14817,7 +14865,7 @@ var ComponentDecoratorHandler = class {
14817
14865
  const def = compileComponentFromMetadata(meta, pool, makeBindingParser2());
14818
14866
  const classMetadata = analysis.classMetadata !== null ? compileComponentClassMetadata(analysis.classMetadata, null).toStmt() : null;
14819
14867
  const debugInfo = analysis.classDebugInfo !== null ? compileClassDebugInfo(analysis.classDebugInfo).toStmt() : null;
14820
- const hmrMeta = this.enableHmr ? extractHmrMetatadata(node, this.reflector, this.compilerHost, this.rootDirs, def, fac, defer, classMetadata, debugInfo) : null;
14868
+ const hmrMeta = this.enableHmr ? extractHmrMetatadata(node, this.reflector, this.evaluator, this.compilerHost, this.rootDirs, def, fac, defer, classMetadata, debugInfo) : null;
14821
14869
  const res = compileResults(fac, def, classMetadata, "\u0275cmp", null, null, debugInfo, null);
14822
14870
  return hmrMeta === null || res.length === 0 ? null : getHmrUpdateDeclaration(res, pool.statements, hmrMeta, node.getSourceFile());
14823
14871
  }
@@ -15547,4 +15595,4 @@ export {
15547
15595
  * Use of this source code is governed by an MIT-style license that can be
15548
15596
  * found in the LICENSE file at https://angular.dev/license
15549
15597
  */
15550
- //# sourceMappingURL=chunk-QAZCJIR5.js.map
15598
+ //# sourceMappingURL=chunk-GSGK42HV.js.map