@angular/compiler-cli 21.0.0-next.2 → 21.0.0-next.4

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.
@@ -455,7 +455,7 @@ import { compileDirectiveFromMetadata, makeBindingParser, ParseLocation, ParseSo
455
455
  // packages/compiler-cli/linker/src/file_linker/partial_linkers/util.js
456
456
  import { createMayBeForwardRefExpression, outputAst as o2 } from "@angular/compiler";
457
457
  import semver from "semver";
458
- var PLACEHOLDER_VERSION = "21.0.0-next.2";
458
+ var PLACEHOLDER_VERSION = "21.0.0-next.4";
459
459
  function wrapReference(wrapped) {
460
460
  return { value: wrapped, type: wrapped };
461
461
  }
@@ -12,7 +12,7 @@ import {
12
12
  formatDiagnostics,
13
13
  performCompilation,
14
14
  readConfiguration
15
- } from "./chunk-BHH6AQ45.js";
15
+ } from "./chunk-IMTR3556.js";
16
16
 
17
17
  // packages/compiler-cli/src/main.js
18
18
  import ts2 from "typescript";
@@ -4,7 +4,7 @@
4
4
 
5
5
  import {
6
6
  angularJitApplicationTransform
7
- } from "./chunk-BSGTWRWT.js";
7
+ } from "./chunk-TO7TOCP7.js";
8
8
  import {
9
9
  AbsoluteModuleStrategy,
10
10
  ActivePerfRecorder,
@@ -92,7 +92,7 @@ import {
92
92
  toUnredirectedSourceFile,
93
93
  tryParseInitializerApi,
94
94
  untagAllTsFiles
95
- } from "./chunk-DQC7LG5E.js";
95
+ } from "./chunk-YRHCC62K.js";
96
96
  import {
97
97
  LogicalFileSystem,
98
98
  absoluteFrom,
@@ -1205,7 +1205,7 @@ function getRelativeFilePath(sourceFile, rootDir) {
1205
1205
 
1206
1206
  // packages/compiler-cli/src/ngtsc/program.js
1207
1207
  import { HtmlParser, MessageBundle } from "@angular/compiler";
1208
- import ts27 from "typescript";
1208
+ import ts28 from "typescript";
1209
1209
 
1210
1210
  // packages/compiler-cli/src/transformers/i18n.js
1211
1211
  import { Xliff, Xliff2, Xmb } from "@angular/compiler";
@@ -1297,7 +1297,7 @@ function compareVersions(v1, v2) {
1297
1297
  }
1298
1298
 
1299
1299
  // packages/compiler-cli/src/typescript_support.js
1300
- var MIN_TS_VERSION = "5.8.0";
1300
+ var MIN_TS_VERSION = "5.9.0";
1301
1301
  var MAX_TS_VERSION = "6.0.0";
1302
1302
  var tsVersion = ts13.version;
1303
1303
  function checkVersion(version, minVersion, maxVersion) {
@@ -1310,7 +1310,7 @@ function verifySupportedTypeScriptVersion() {
1310
1310
  }
1311
1311
 
1312
1312
  // packages/compiler-cli/src/ngtsc/core/src/compiler.js
1313
- import ts25 from "typescript";
1313
+ import ts26 from "typescript";
1314
1314
 
1315
1315
  // packages/compiler-cli/src/ngtsc/cycles/src/analyzer.js
1316
1316
  var CycleAnalyzer = class {
@@ -2804,7 +2804,7 @@ var StandaloneComponentScopeReader = class {
2804
2804
  };
2805
2805
 
2806
2806
  // packages/compiler-cli/src/ngtsc/typecheck/extended/checks/interpolated_signal_not_invoked/index.js
2807
- import { ASTWithSource as ASTWithSource2, BindingType, Interpolation, PrefixNot, PropertyRead as PropertyRead2, TmplAstBoundAttribute } from "@angular/compiler";
2807
+ import { ASTWithSource as ASTWithSource2, BindingType, Interpolation, PrefixNot, PropertyRead as PropertyRead2, TmplAstBoundAttribute, TmplAstIfBlock, TmplAstSwitchBlock } from "@angular/compiler";
2808
2808
 
2809
2809
  // packages/compiler-cli/src/ngtsc/typecheck/src/symbol_util.js
2810
2810
  import ts18 from "typescript";
@@ -2896,8 +2896,8 @@ var InterpolatedSignalCheck = class extends TemplateCheckWithVisitor {
2896
2896
  if (node instanceof Interpolation) {
2897
2897
  return node.expressions.map((item) => item instanceof PrefixNot ? item.expression : item).filter((item) => item instanceof PropertyRead2).flatMap((item) => buildDiagnosticForSignal(ctx, item, component));
2898
2898
  } else if (node instanceof TmplAstBoundAttribute) {
2899
- const usedDirectives = ctx.templateTypeChecker.getUsedDirectives(component);
2900
- if (usedDirectives !== null && usedDirectives.some((dir) => dir.inputs.getByBindingPropertyName(node.name) !== null)) {
2899
+ const symbol = ctx.templateTypeChecker.getSymbolOfNode(node, component);
2900
+ if (symbol?.kind === SymbolKind.Input && symbol.bindings.length > 0 && symbol.bindings.some((binding) => binding.target.kind === SymbolKind.Directive)) {
2901
2901
  return [];
2902
2902
  }
2903
2903
  const nodeAst = isPropertyReadNodeAst(node);
@@ -2912,6 +2912,16 @@ var InterpolatedSignalCheck = class extends TemplateCheckWithVisitor {
2912
2912
  ) {
2913
2913
  return buildDiagnosticForSignal(ctx, nodeAst, component);
2914
2914
  }
2915
+ } else if (node instanceof TmplAstIfBlock) {
2916
+ return node.branches.map((branch) => branch.expression).filter((expr) => expr instanceof ASTWithSource2).map((expr) => {
2917
+ const ast = expr.ast;
2918
+ return ast instanceof PrefixNot ? ast.expression : ast;
2919
+ }).filter((ast) => ast instanceof PropertyRead2).flatMap((item) => buildDiagnosticForSignal(ctx, item, component));
2920
+ } else if (node instanceof TmplAstSwitchBlock && node.expression instanceof ASTWithSource2) {
2921
+ const expression = node.expression.ast instanceof PrefixNot ? node.expression.ast.expression : node.expression.ast;
2922
+ if (expression instanceof PropertyRead2) {
2923
+ return buildDiagnosticForSignal(ctx, expression, component);
2924
+ }
2915
2925
  }
2916
2926
  return [];
2917
2927
  }
@@ -3791,12 +3801,77 @@ function closestNode(start, predicate) {
3791
3801
  return null;
3792
3802
  }
3793
3803
 
3804
+ // packages/compiler-cli/src/ngtsc/validation/src/rules/forbidden_required_initializer_invocation_rule.js
3805
+ import ts25 from "typescript";
3806
+ var APIS_TO_CHECK2 = [
3807
+ INPUT_INITIALIZER_FN,
3808
+ MODEL_INITIALIZER_FN,
3809
+ ...QUERY_INITIALIZER_FNS
3810
+ ];
3811
+ var ForbiddenRequiredInitializersInvocationRule = class {
3812
+ reflector;
3813
+ importedSymbolsTracker;
3814
+ constructor(reflector, importedSymbolsTracker) {
3815
+ this.reflector = reflector;
3816
+ this.importedSymbolsTracker = importedSymbolsTracker;
3817
+ }
3818
+ shouldCheck(sourceFile) {
3819
+ return APIS_TO_CHECK2.some(({ functionName, owningModule }) => {
3820
+ return this.importedSymbolsTracker.hasNamedImport(sourceFile, functionName, owningModule) || this.importedSymbolsTracker.hasNamespaceImport(sourceFile, owningModule);
3821
+ });
3822
+ }
3823
+ checkNode(node) {
3824
+ if (!ts25.isClassDeclaration(node))
3825
+ return null;
3826
+ const requiredInitializerDeclarations = node.members.filter((m) => ts25.isPropertyDeclaration(m) && this.isPropDeclarationARequiredInitializer(m));
3827
+ const diagnostics = [];
3828
+ for (let decl of node.members) {
3829
+ if (!ts25.isPropertyDeclaration(decl))
3830
+ continue;
3831
+ const initiallizerExpr = decl.initializer;
3832
+ if (!initiallizerExpr)
3833
+ continue;
3834
+ checkForbiddenInvocation(initiallizerExpr);
3835
+ }
3836
+ function checkForbiddenInvocation(node2) {
3837
+ if (ts25.isArrowFunction(node2) || ts25.isFunctionExpression(node2))
3838
+ return;
3839
+ if (ts25.isPropertyAccessExpression(node2) && node2.expression.kind === ts25.SyntaxKind.ThisKeyword && // With the following we make sure we only flag invoked required initializers
3840
+ ts25.isCallExpression(node2.parent) && node2.parent.expression === node2) {
3841
+ const requiredProp = requiredInitializerDeclarations.find((prop) => prop.name.getText() === node2.name.getText());
3842
+ if (requiredProp) {
3843
+ const initializerFn = requiredProp.initializer.expression.expression.getText();
3844
+ diagnostics.push(makeDiagnostic(ErrorCode.FORBIDDEN_REQUIRED_INITIALIZER_INVOCATION, node2, `\`${node2.name.getText()}\` is a required \`${initializerFn}\` and does not have a value in this context.`));
3845
+ }
3846
+ }
3847
+ return node2.forEachChild(checkForbiddenInvocation);
3848
+ }
3849
+ const ctor = getConstructorFromClass(node);
3850
+ if (ctor) {
3851
+ checkForbiddenInvocation(ctor);
3852
+ }
3853
+ return diagnostics;
3854
+ }
3855
+ isPropDeclarationARequiredInitializer(node) {
3856
+ if (!node.initializer)
3857
+ return false;
3858
+ const identifiedInitializer = tryParseInitializerApi(APIS_TO_CHECK2, node.initializer, this.reflector, this.importedSymbolsTracker);
3859
+ if (identifiedInitializer === null || !identifiedInitializer.isRequired)
3860
+ return false;
3861
+ return true;
3862
+ }
3863
+ };
3864
+ function getConstructorFromClass(node) {
3865
+ return node.members.find((m) => ts25.isConstructorDeclaration(m) && m.body !== void 0);
3866
+ }
3867
+
3794
3868
  // packages/compiler-cli/src/ngtsc/validation/src/source_file_validator.js
3795
3869
  var SourceFileValidator = class {
3796
3870
  rules;
3797
3871
  constructor(reflector, importedSymbolsTracker, templateTypeChecker, typeCheckingConfig) {
3798
3872
  this.rules = [new InitializerApiUsageRule(reflector, importedSymbolsTracker)];
3799
3873
  this.rules.push(new UnusedStandaloneImportsRule(templateTypeChecker, typeCheckingConfig, importedSymbolsTracker));
3874
+ this.rules.push(new ForbiddenRequiredInitializersInvocationRule(reflector, importedSymbolsTracker));
3800
3875
  }
3801
3876
  /**
3802
3877
  * Gets the diagnostics for a specific file, or null if the file is valid.
@@ -3986,8 +4061,8 @@ var NgCompiler = class _NgCompiler {
3986
4061
  this.delegatingPerfRecorder = new DelegatingPerfRecorder(this.perfRecorder);
3987
4062
  this.usePoisonedData = usePoisonedData || !!options._compilePoisonedComponents;
3988
4063
  this.enableTemplateTypeChecker = enableTemplateTypeChecker || !!options._enableTemplateTypeChecker;
3989
- this.enableBlockSyntax = options["_enableBlockSyntax"] ?? true;
3990
- this.enableLetSyntax = options["_enableLetSyntax"] ?? true;
4064
+ this.enableBlockSyntax = this.angularCoreVersion === null || coreVersionSupportsFeature(this.angularCoreVersion, ">= 17.0.0");
4065
+ this.enableLetSyntax = this.angularCoreVersion === null || coreVersionSupportsFeature(this.angularCoreVersion, ">= 18.1.0");
3991
4066
  this.enableSelectorless = options["_enableSelectorless"] ?? false;
3992
4067
  this.emitDeclarationOnly = !!options.emitDeclarationOnly && !!options._experimentalAllowEmitDeclarationOnly;
3993
4068
  this.implicitStandaloneValue = this.angularCoreVersion === null || coreVersionSupportsFeature(this.angularCoreVersion, ">= 19.0.0");
@@ -3996,7 +4071,7 @@ var NgCompiler = class _NgCompiler {
3996
4071
  this.currentProgram = inputProgram;
3997
4072
  this.closureCompilerEnabled = !!this.options.annotateForClosureCompiler;
3998
4073
  this.entryPoint = adapter.entryPoint !== null ? getSourceFileOrNull(inputProgram, adapter.entryPoint) : null;
3999
- const moduleResolutionCache = ts25.createModuleResolutionCache(
4074
+ const moduleResolutionCache = ts26.createModuleResolutionCache(
4000
4075
  this.adapter.getCurrentDirectory(),
4001
4076
  // doen't retain a reference to `this`, if other closures in the constructor here reference
4002
4077
  // `this` internally then a closure created here would retain them. This can cause major
@@ -4044,7 +4119,7 @@ var NgCompiler = class _NgCompiler {
4044
4119
  }
4045
4120
  for (const clazz of classesToUpdate) {
4046
4121
  this.compilation.traitCompiler.updateResources(clazz);
4047
- if (!ts25.isClassDeclaration(clazz)) {
4122
+ if (!ts26.isClassDeclaration(clazz)) {
4048
4123
  continue;
4049
4124
  }
4050
4125
  this.compilation.templateTypeChecker.invalidateClass(clazz);
@@ -4254,12 +4329,12 @@ var NgCompiler = class _NgCompiler {
4254
4329
  if (compilation.supportJitMode && compilation.jitDeclarationRegistry.jitDeclarations.size > 0) {
4255
4330
  const { jitDeclarations } = compilation.jitDeclarationRegistry;
4256
4331
  const jitDeclarationsArray = Array.from(jitDeclarations);
4257
- const jitDeclarationOriginalNodes = new Set(jitDeclarationsArray.map((d) => ts25.getOriginalNode(d)));
4332
+ const jitDeclarationOriginalNodes = new Set(jitDeclarationsArray.map((d) => ts26.getOriginalNode(d)));
4258
4333
  const sourceFilesWithJit = new Set(jitDeclarationsArray.map((d) => d.getSourceFile().fileName));
4259
4334
  before.push((ctx) => {
4260
4335
  const reflectionHost = new TypeScriptReflectionHost(this.inputProgram.getTypeChecker());
4261
4336
  const jitTransform = angularJitApplicationTransform(this.inputProgram, compilation.isCore, (node) => {
4262
- node = ts25.getOriginalNode(node, ts25.isClassDeclaration);
4337
+ node = ts26.getOriginalNode(node, ts26.isClassDeclaration);
4263
4338
  return reflectionHost.isClass(node) && jitDeclarationOriginalNodes.has(node);
4264
4339
  })(ctx);
4265
4340
  return (sourceFile) => {
@@ -4338,16 +4413,16 @@ var NgCompiler = class _NgCompiler {
4338
4413
  return null;
4339
4414
  }
4340
4415
  const sourceFile = node.getSourceFile();
4341
- const printer = ts25.createPrinter();
4342
- const nodeText = printer.printNode(ts25.EmitHint.Unspecified, callback, sourceFile);
4343
- return ts25.transpileModule(nodeText, {
4416
+ const printer = ts26.createPrinter();
4417
+ const nodeText = printer.printNode(ts26.EmitHint.Unspecified, callback, sourceFile);
4418
+ return ts26.transpileModule(nodeText, {
4344
4419
  compilerOptions: {
4345
4420
  ...this.options,
4346
4421
  // Some module types can produce additional code (see #60795) whereas we need the
4347
4422
  // HMR update module to use a native `export`. Override the `target` and `module`
4348
4423
  // to ensure that it looks as expected.
4349
- module: ts25.ModuleKind.ES2022,
4350
- target: ts25.ScriptTarget.ES2022
4424
+ module: ts26.ModuleKind.ES2022,
4425
+ target: ts26.ScriptTarget.ES2022
4351
4426
  },
4352
4427
  fileName: sourceFile.fileName,
4353
4428
  reportDiagnostics: false
@@ -4663,7 +4738,7 @@ var NgCompiler = class _NgCompiler {
4663
4738
  const supportJitMode = this.options["supportJitMode"] ?? true;
4664
4739
  const supportTestBed = this.options["supportTestBed"] ?? true;
4665
4740
  const externalRuntimeStyles = this.options["externalRuntimeStyles"] ?? false;
4666
- const typeCheckHostBindings = this.options.typeCheckHostBindings ?? false;
4741
+ const typeCheckHostBindings = this.options.typeCheckHostBindings ?? true;
4667
4742
  if (supportTestBed === false && compilationMode === CompilationMode.PARTIAL) {
4668
4743
  throw new Error('TestBed support ("supportTestBed" option) cannot be disabled in partial compilation mode.');
4669
4744
  }
@@ -4723,18 +4798,18 @@ function isAngularCorePackage(program) {
4723
4798
  return false;
4724
4799
  }
4725
4800
  return r3Symbols.statements.some((stmt) => {
4726
- if (!ts25.isVariableStatement(stmt)) {
4801
+ if (!ts26.isVariableStatement(stmt)) {
4727
4802
  return false;
4728
4803
  }
4729
- const modifiers = ts25.getModifiers(stmt);
4730
- if (modifiers === void 0 || !modifiers.some((mod) => mod.kind === ts25.SyntaxKind.ExportKeyword)) {
4804
+ const modifiers = ts26.getModifiers(stmt);
4805
+ if (modifiers === void 0 || !modifiers.some((mod) => mod.kind === ts26.SyntaxKind.ExportKeyword)) {
4731
4806
  return false;
4732
4807
  }
4733
4808
  return stmt.declarationList.declarations.some((decl) => {
4734
- if (!ts25.isIdentifier(decl.name) || decl.name.text !== "ITS_JUST_ANGULAR") {
4809
+ if (!ts26.isIdentifier(decl.name) || decl.name.text !== "ITS_JUST_ANGULAR") {
4735
4810
  return false;
4736
4811
  }
4737
- if (decl.initializer === void 0 || decl.initializer.kind !== ts25.SyntaxKind.TrueKeyword) {
4812
+ if (decl.initializer === void 0 || decl.initializer.kind !== ts26.SyntaxKind.TrueKeyword) {
4738
4813
  return false;
4739
4814
  }
4740
4815
  return true;
@@ -4747,7 +4822,7 @@ function getR3SymbolsFile(program) {
4747
4822
  function* verifyCompatibleTypeCheckOptions(options) {
4748
4823
  if (options.fullTemplateTypeCheck === false && options.strictTemplates === true) {
4749
4824
  yield makeConfigDiagnostic({
4750
- category: ts25.DiagnosticCategory.Error,
4825
+ category: ts26.DiagnosticCategory.Error,
4751
4826
  code: ErrorCode.CONFIG_STRICT_TEMPLATES_IMPLIES_FULL_TEMPLATE_TYPECHECK,
4752
4827
  messageText: `
4753
4828
  Angular compiler option "strictTemplates" is enabled, however "fullTemplateTypeCheck" is disabled.
@@ -4766,7 +4841,7 @@ https://angular.dev/tools/cli/template-typecheck
4766
4841
  }
4767
4842
  if (options.extendedDiagnostics && options.strictTemplates === false) {
4768
4843
  yield makeConfigDiagnostic({
4769
- category: ts25.DiagnosticCategory.Error,
4844
+ category: ts26.DiagnosticCategory.Error,
4770
4845
  code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_IMPLIES_STRICT_TEMPLATES,
4771
4846
  messageText: `
4772
4847
  Angular compiler option "extendedDiagnostics" is configured, however "strictTemplates" is disabled.
@@ -4783,7 +4858,7 @@ One of the following actions is required:
4783
4858
  const defaultCategory = options.extendedDiagnostics?.defaultCategory;
4784
4859
  if (defaultCategory && !allowedCategoryLabels.includes(defaultCategory)) {
4785
4860
  yield makeConfigDiagnostic({
4786
- category: ts25.DiagnosticCategory.Error,
4861
+ category: ts26.DiagnosticCategory.Error,
4787
4862
  code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CATEGORY_LABEL,
4788
4863
  messageText: `
4789
4864
  Angular compiler option "extendedDiagnostics.defaultCategory" has an unknown diagnostic category: "${defaultCategory}".
@@ -4796,7 +4871,7 @@ ${allowedCategoryLabels.join("\n")}
4796
4871
  for (const [checkName, category] of Object.entries(options.extendedDiagnostics?.checks ?? {})) {
4797
4872
  if (!SUPPORTED_DIAGNOSTIC_NAMES.has(checkName)) {
4798
4873
  yield makeConfigDiagnostic({
4799
- category: ts25.DiagnosticCategory.Error,
4874
+ category: ts26.DiagnosticCategory.Error,
4800
4875
  code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CHECK,
4801
4876
  messageText: `
4802
4877
  Angular compiler option "extendedDiagnostics.checks" has an unknown check: "${checkName}".
@@ -4808,7 +4883,7 @@ ${Array.from(SUPPORTED_DIAGNOSTIC_NAMES).join("\n")}
4808
4883
  }
4809
4884
  if (!allowedCategoryLabels.includes(category)) {
4810
4885
  yield makeConfigDiagnostic({
4811
- category: ts25.DiagnosticCategory.Error,
4886
+ category: ts26.DiagnosticCategory.Error,
4812
4887
  code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CATEGORY_LABEL,
4813
4888
  messageText: `
4814
4889
  Angular compiler option "extendedDiagnostics.checks['${checkName}']" has an unknown diagnostic category: "${category}".
@@ -4826,7 +4901,7 @@ function verifyEmitDeclarationOnly(options) {
4826
4901
  }
4827
4902
  return [
4828
4903
  makeConfigDiagnostic({
4829
- category: ts25.DiagnosticCategory.Error,
4904
+ category: ts26.DiagnosticCategory.Error,
4830
4905
  code: ErrorCode.CONFIG_EMIT_DECLARATION_ONLY_UNSUPPORTED,
4831
4906
  messageText: 'TS compiler option "emitDeclarationOnly" is not supported.'
4832
4907
  })
@@ -4851,7 +4926,7 @@ var ReferenceGraphAdapter = class {
4851
4926
  for (const { node } of references) {
4852
4927
  let sourceFile = node.getSourceFile();
4853
4928
  if (sourceFile === void 0) {
4854
- sourceFile = ts25.getOriginalNode(node).getSourceFile();
4929
+ sourceFile = ts26.getOriginalNode(node).getSourceFile();
4855
4930
  }
4856
4931
  if (sourceFile === void 0 || !isDtsPath(sourceFile.fileName)) {
4857
4932
  this.graph.add(source, node);
@@ -4892,7 +4967,7 @@ function versionMapFromProgram(program, driver) {
4892
4967
  }
4893
4968
 
4894
4969
  // packages/compiler-cli/src/ngtsc/core/src/host.js
4895
- import ts26 from "typescript";
4970
+ import ts27 from "typescript";
4896
4971
  var DelegatingCompilerHost = class {
4897
4972
  delegate;
4898
4973
  createHash;
@@ -5031,7 +5106,7 @@ var NgCompilerHost = class _NgCompilerHost extends DelegatingCompilerHost {
5031
5106
  entryPoint = findFlatIndexEntryPoint(normalizedTsInputFiles);
5032
5107
  if (entryPoint === null) {
5033
5108
  diagnostics.push({
5034
- category: ts26.DiagnosticCategory.Error,
5109
+ category: ts27.DiagnosticCategory.Error,
5035
5110
  code: ngErrorCode(ErrorCode.CONFIG_FLAT_MODULE_NO_INDEX),
5036
5111
  file: void 0,
5037
5112
  start: void 0,
@@ -5085,10 +5160,10 @@ var NgCompilerHost = class _NgCompilerHost extends DelegatingCompilerHost {
5085
5160
  return this.fileNameToModuleName !== void 0 ? this : null;
5086
5161
  }
5087
5162
  createCachedResolveModuleNamesFunction() {
5088
- const moduleResolutionCache = ts26.createModuleResolutionCache(this.getCurrentDirectory(), this.getCanonicalFileName.bind(this));
5163
+ const moduleResolutionCache = ts27.createModuleResolutionCache(this.getCurrentDirectory(), this.getCanonicalFileName.bind(this));
5089
5164
  return (moduleNames, containingFile, reusedNames, redirectedReference, options) => {
5090
5165
  return moduleNames.map((moduleName) => {
5091
- const module = ts26.resolveModuleName(moduleName, containingFile, options, this, moduleResolutionCache, redirectedReference);
5166
+ const module = ts27.resolveModuleName(moduleName, containingFile, options, this, moduleResolutionCache, redirectedReference);
5092
5167
  return module.resolvedModule;
5093
5168
  });
5094
5169
  };
@@ -5120,7 +5195,7 @@ var NgtscProgram = class {
5120
5195
  if (reuseProgram !== void 0) {
5121
5196
  retagAllTsFiles(reuseProgram);
5122
5197
  }
5123
- this.tsProgram = perfRecorder.inPhase(PerfPhase.TypeScriptProgramCreate, () => ts27.createProgram(this.host.inputFiles, options, this.host, reuseProgram));
5198
+ this.tsProgram = perfRecorder.inPhase(PerfPhase.TypeScriptProgramCreate, () => ts28.createProgram(this.host.inputFiles, options, this.host, reuseProgram));
5124
5199
  perfRecorder.phase(PerfPhase.Unaccounted);
5125
5200
  perfRecorder.memory(PerfCheckpoint.TypeScriptProgramCreate);
5126
5201
  this.host.postProgramCreationCleanup();
@@ -5349,16 +5424,16 @@ function createProgram({ rootNames, options, host, oldProgram }) {
5349
5424
  }
5350
5425
 
5351
5426
  // packages/compiler-cli/src/perform_compile.js
5352
- import ts29 from "typescript";
5427
+ import ts30 from "typescript";
5353
5428
 
5354
5429
  // packages/compiler-cli/src/transformers/util.js
5355
- import ts28 from "typescript";
5430
+ import ts29 from "typescript";
5356
5431
  function createMessageDiagnostic(messageText) {
5357
5432
  return {
5358
5433
  file: void 0,
5359
5434
  start: void 0,
5360
5435
  length: void 0,
5361
- category: ts28.DiagnosticCategory.Message,
5436
+ category: ts29.DiagnosticCategory.Message,
5362
5437
  messageText,
5363
5438
  code: DEFAULT_ERROR_CODE,
5364
5439
  source: SOURCE
@@ -5367,13 +5442,13 @@ function createMessageDiagnostic(messageText) {
5367
5442
 
5368
5443
  // packages/compiler-cli/src/perform_compile.js
5369
5444
  var defaultFormatHost = {
5370
- getCurrentDirectory: () => ts29.sys.getCurrentDirectory(),
5445
+ getCurrentDirectory: () => ts30.sys.getCurrentDirectory(),
5371
5446
  getCanonicalFileName: (fileName) => fileName,
5372
- getNewLine: () => ts29.sys.newLine
5447
+ getNewLine: () => ts30.sys.newLine
5373
5448
  };
5374
5449
  function formatDiagnostics(diags, host = defaultFormatHost) {
5375
5450
  if (diags && diags.length) {
5376
- return diags.map((diagnostic) => replaceTsWithNgInErrors(ts29.formatDiagnosticsWithColorAndContext([diagnostic], host))).join("");
5451
+ return diags.map((diagnostic) => replaceTsWithNgInErrors(ts30.formatDiagnosticsWithColorAndContext([diagnostic], host))).join("");
5377
5452
  } else {
5378
5453
  return "";
5379
5454
  }
@@ -5389,7 +5464,7 @@ function calcProjectFileAndBasePath(project, host = getFileSystem()) {
5389
5464
  function readConfiguration(project, existingOptions, host = getFileSystem()) {
5390
5465
  try {
5391
5466
  const fs = getFileSystem();
5392
- const readConfigFile = (configFile) => ts29.readConfigFile(configFile, (file) => host.readFile(host.resolve(file)));
5467
+ const readConfigFile = (configFile) => ts30.readConfigFile(configFile, (file) => host.readFile(host.resolve(file)));
5393
5468
  const readAngularCompilerOptions = (configFile, parentOptions = {}) => {
5394
5469
  const { config: config2, error: error2 } = readConfigFile(configFile);
5395
5470
  if (error2) {
@@ -5425,7 +5500,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
5425
5500
  ...existingOptions
5426
5501
  };
5427
5502
  const parseConfigHost = createParseConfigHost(host, fs);
5428
- const { options, errors, fileNames: rootNames, projectReferences } = ts29.parseJsonConfigFileContent(config, parseConfigHost, basePath, existingCompilerOptions, configFileName);
5503
+ const { options, errors, fileNames: rootNames, projectReferences } = ts30.parseJsonConfigFileContent(config, parseConfigHost, basePath, existingCompilerOptions, configFileName);
5429
5504
  let emitFlags = EmitFlags.Default;
5430
5505
  if (!(options["skipMetadataEmit"] || options["flatModuleOutFile"])) {
5431
5506
  emitFlags |= EmitFlags.Metadata;
@@ -5437,7 +5512,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
5437
5512
  } catch (e) {
5438
5513
  const errors = [
5439
5514
  {
5440
- category: ts29.DiagnosticCategory.Error,
5515
+ category: ts30.DiagnosticCategory.Error,
5441
5516
  messageText: e.stack ?? e.message,
5442
5517
  file: void 0,
5443
5518
  start: void 0,
@@ -5472,7 +5547,7 @@ function getExtendedConfigPathWorker(configFile, extendsValue, host, fs) {
5472
5547
  }
5473
5548
  } else {
5474
5549
  const parseConfigHost = createParseConfigHost(host, fs);
5475
- const { resolvedModule } = ts29.nodeModuleNameResolver(extendsValue, configFile, { moduleResolution: ts29.ModuleResolutionKind.Node10, resolveJsonModule: true }, parseConfigHost);
5550
+ const { resolvedModule } = ts30.nodeModuleNameResolver(extendsValue, configFile, { moduleResolution: ts30.ModuleResolutionKind.Node10, resolveJsonModule: true }, parseConfigHost);
5476
5551
  if (resolvedModule) {
5477
5552
  return absoluteFrom(resolvedModule.resolvedFileName);
5478
5553
  }
@@ -5482,7 +5557,7 @@ function getExtendedConfigPathWorker(configFile, extendsValue, host, fs) {
5482
5557
  function exitCodeFromResult(diags) {
5483
5558
  if (!diags)
5484
5559
  return 0;
5485
- if (diags.every((diag) => diag.category !== ts29.DiagnosticCategory.Error)) {
5560
+ if (diags.every((diag) => diag.category !== ts30.DiagnosticCategory.Error)) {
5486
5561
  return 0;
5487
5562
  }
5488
5563
  return diags.some((d) => d.source === "angular" && d.code === UNKNOWN_ERROR_CODE) ? 2 : 1;
@@ -5520,7 +5595,7 @@ function performCompilation({ rootNames, options, host, oldProgram, emitCallback
5520
5595
  } catch (e) {
5521
5596
  program = void 0;
5522
5597
  allDiagnostics.push({
5523
- category: ts29.DiagnosticCategory.Error,
5598
+ category: ts30.DiagnosticCategory.Error,
5524
5599
  messageText: e.stack ?? e.message,
5525
5600
  code: UNKNOWN_ERROR_CODE,
5526
5601
  file: void 0,
@@ -5550,7 +5625,7 @@ function defaultGatherDiagnostics(program) {
5550
5625
  return allDiagnostics;
5551
5626
  }
5552
5627
  function hasErrors(diags) {
5553
- return diags.some((d) => d.category === ts29.DiagnosticCategory.Error);
5628
+ return diags.some((d) => d.category === ts30.DiagnosticCategory.Error);
5554
5629
  }
5555
5630
 
5556
5631
  export {
@@ -16,7 +16,7 @@ import {
16
16
  tryParseSignalInputMapping,
17
17
  tryParseSignalModelMapping,
18
18
  tryParseSignalQueryFromInitializer
19
- } from "./chunk-DQC7LG5E.js";
19
+ } from "./chunk-YRHCC62K.js";
20
20
 
21
21
  // packages/compiler-cli/src/ngtsc/transform/jit/src/downlevel_decorators_transform.js
22
22
  import ts from "typescript";
@@ -119,6 +119,7 @@ var ErrorCode;
119
119
  ErrorCode2[ErrorCode2["UNINVOKED_TRACK_FUNCTION"] = 8115] = "UNINVOKED_TRACK_FUNCTION";
120
120
  ErrorCode2[ErrorCode2["MISSING_STRUCTURAL_DIRECTIVE"] = 8116] = "MISSING_STRUCTURAL_DIRECTIVE";
121
121
  ErrorCode2[ErrorCode2["UNINVOKED_FUNCTION_IN_TEXT_INTERPOLATION"] = 8117] = "UNINVOKED_FUNCTION_IN_TEXT_INTERPOLATION";
122
+ ErrorCode2[ErrorCode2["FORBIDDEN_REQUIRED_INITIALIZER_INVOCATION"] = 8118] = "FORBIDDEN_REQUIRED_INITIALIZER_INVOCATION";
122
123
  ErrorCode2[ErrorCode2["INLINE_TCB_REQUIRED"] = 8900] = "INLINE_TCB_REQUIRED";
123
124
  ErrorCode2[ErrorCode2["INLINE_TYPE_CTOR_REQUIRED"] = 8901] = "INLINE_TYPE_CTOR_REQUIRED";
124
125
  ErrorCode2[ErrorCode2["INJECTABLE_DUPLICATE_PROV"] = 9001] = "INJECTABLE_DUPLICATE_PROV";
@@ -222,7 +223,11 @@ var COMPILER_ERRORS_WITH_GUIDES = /* @__PURE__ */ new Set([
222
223
  ]);
223
224
 
224
225
  // packages/compiler-cli/src/ngtsc/diagnostics/src/error_details_base_url.js
225
- var ERROR_DETAILS_PAGE_BASE_URL = "https://angular.dev/errors";
226
+ import { VERSION } from "@angular/compiler";
227
+ var ERROR_DETAILS_PAGE_BASE_URL = (() => {
228
+ const versionSubDomain = VERSION.major !== "0" ? `v${VERSION.major}.` : "";
229
+ return `https://${versionSubDomain}angular.dev/errors`;
230
+ })();
226
231
 
227
232
  // packages/compiler-cli/src/ngtsc/diagnostics/src/extended_template_diagnostic_name.js
228
233
  var ExtendedTemplateDiagnosticName;
@@ -15572,10 +15577,15 @@ function getBoundAttributes(directive, node) {
15572
15577
  });
15573
15578
  }
15574
15579
  };
15575
- node.inputs.forEach(processAttribute);
15576
- node.attributes.forEach(processAttribute);
15577
15580
  if (node instanceof TmplAstTemplate) {
15581
+ if (node.tagName === "ng-template") {
15582
+ node.inputs.forEach(processAttribute);
15583
+ node.attributes.forEach(processAttribute);
15584
+ }
15578
15585
  node.templateAttrs.forEach(processAttribute);
15586
+ } else {
15587
+ node.inputs.forEach(processAttribute);
15588
+ node.attributes.forEach(processAttribute);
15579
15589
  }
15580
15590
  return boundInputs;
15581
15591
  }
package/bundles/index.js CHANGED
@@ -28,7 +28,7 @@ import {
28
28
  isTsDiagnostic,
29
29
  performCompilation,
30
30
  readConfiguration
31
- } from "./chunk-BHH6AQ45.js";
31
+ } from "./chunk-IMTR3556.js";
32
32
  import {
33
33
  ConsoleLogger,
34
34
  LogLevel
@@ -37,7 +37,7 @@ import {
37
37
  angularJitApplicationTransform,
38
38
  getDownlevelDecoratorsTransform,
39
39
  getInitializerApiJitTransform
40
- } from "./chunk-BSGTWRWT.js";
40
+ } from "./chunk-TO7TOCP7.js";
41
41
  import {
42
42
  ActivePerfRecorder,
43
43
  ErrorCode,
@@ -46,7 +46,7 @@ import {
46
46
  TsCreateProgramDriver,
47
47
  isLocalCompilationDiagnostics,
48
48
  ngErrorCode
49
- } from "./chunk-DQC7LG5E.js";
49
+ } from "./chunk-YRHCC62K.js";
50
50
  import "./chunk-I2BHWRAU.js";
51
51
  import {
52
52
  InvalidFileSystem,
@@ -77,7 +77,7 @@ import "./chunk-G7GFT6BU.js";
77
77
 
78
78
  // packages/compiler-cli/src/version.js
79
79
  import { Version } from "@angular/compiler";
80
- var VERSION = new Version("21.0.0-next.2");
80
+ var VERSION = new Version("21.0.0-next.4");
81
81
 
82
82
  // packages/compiler-cli/private/tooling.js
83
83
  var GLOBAL_DEFS_FOR_TERSER = {
@@ -13,7 +13,7 @@ import {
13
13
  TypeScriptReflectionHost,
14
14
  createForwardRefResolver,
15
15
  reflectObjectLiteral
16
- } from "../chunk-DQC7LG5E.js";
16
+ } from "../chunk-YRHCC62K.js";
17
17
  import "../chunk-I2BHWRAU.js";
18
18
  import "../chunk-GWZQLAGK.js";
19
19
  import "../chunk-XYYEESKY.js";
@@ -4,8 +4,8 @@
4
4
 
5
5
  import {
6
6
  angularJitApplicationTransform
7
- } from "../chunk-BSGTWRWT.js";
8
- import "../chunk-DQC7LG5E.js";
7
+ } from "../chunk-TO7TOCP7.js";
8
+ import "../chunk-YRHCC62K.js";
9
9
  import "../chunk-I2BHWRAU.js";
10
10
  import "../chunk-GWZQLAGK.js";
11
11
  import "../chunk-XYYEESKY.js";
@@ -6,12 +6,12 @@
6
6
  import {
7
7
  main,
8
8
  readCommandLineAndConfiguration
9
- } from "../../chunk-6GMQREBC.js";
9
+ } from "../../chunk-COFK26OM.js";
10
10
  import {
11
11
  EmitFlags
12
- } from "../../chunk-BHH6AQ45.js";
13
- import "../../chunk-BSGTWRWT.js";
14
- import "../../chunk-DQC7LG5E.js";
12
+ } from "../../chunk-IMTR3556.js";
13
+ import "../../chunk-TO7TOCP7.js";
14
+ import "../../chunk-YRHCC62K.js";
15
15
  import "../../chunk-I2BHWRAU.js";
16
16
  import {
17
17
  setFileSystem
@@ -5,10 +5,10 @@
5
5
 
6
6
  import {
7
7
  main
8
- } from "../../chunk-6GMQREBC.js";
9
- import "../../chunk-BHH6AQ45.js";
10
- import "../../chunk-BSGTWRWT.js";
11
- import "../../chunk-DQC7LG5E.js";
8
+ } from "../../chunk-COFK26OM.js";
9
+ import "../../chunk-IMTR3556.js";
10
+ import "../../chunk-TO7TOCP7.js";
11
+ import "../../chunk-YRHCC62K.js";
12
12
  import "../../chunk-I2BHWRAU.js";
13
13
  import {
14
14
  setFileSystem
@@ -7,7 +7,7 @@
7
7
  */
8
8
  import { MaybeForwardRefExpression, outputAst as o, R3DeclareDependencyMetadata, R3DependencyMetadata, R3Reference } from '@angular/compiler';
9
9
  import { AstObject, AstValue } from '../../ast/ast_value';
10
- export declare const PLACEHOLDER_VERSION = "21.0.0-next.2";
10
+ export declare const PLACEHOLDER_VERSION = "21.0.0-next.4";
11
11
  export declare function wrapReference<TExpression>(wrapped: o.WrappedNodeExpr<TExpression>): R3Reference;
12
12
  /**
13
13
  * Parses the value of an enum from the AST value's symbol name.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/compiler-cli",
3
- "version": "21.0.0-next.2",
3
+ "version": "21.0.0-next.4",
4
4
  "description": "Angular - the compiler CLI for Node.js",
5
5
  "typings": "index.d.ts",
6
6
  "bin": {
@@ -38,7 +38,7 @@
38
38
  }
39
39
  },
40
40
  "dependencies": {
41
- "@babel/core": "7.28.3",
41
+ "@babel/core": "7.28.4",
42
42
  "@jridgewell/sourcemap-codec": "^1.4.14",
43
43
  "reflect-metadata": "^0.2.0",
44
44
  "chokidar": "^4.0.0",
@@ -48,8 +48,8 @@
48
48
  "yargs": "^18.0.0"
49
49
  },
50
50
  "peerDependencies": {
51
- "@angular/compiler": "21.0.0-next.2",
52
- "typescript": ">=5.8 <6.0"
51
+ "@angular/compiler": "21.0.0-next.4",
52
+ "typescript": ">=5.9 <6.0"
53
53
  },
54
54
  "peerDependenciesMeta": {
55
55
  "typescript": {
@@ -526,6 +526,21 @@ export declare enum ErrorCode {
526
526
  * ```
527
527
  */
528
528
  UNINVOKED_FUNCTION_IN_TEXT_INTERPOLATION = 8117,
529
+ /**
530
+ * A required initializer is being invoked in a forbidden context such as a property initializer
531
+ * or a constructor.
532
+ *
533
+ * For example:
534
+ * ```ts
535
+ * class MyComponent {
536
+ * myInput = input.required();
537
+ * somValue = this.myInput(); // Error
538
+ *
539
+ * constructor() {
540
+ * this.myInput(); // Error
541
+ * }
542
+ */
543
+ FORBIDDEN_REQUIRED_INITIALIZER_INVOCATION = 8118,
529
544
  /**
530
545
  * The template type-checking engine would need to generate an inline type check block for a
531
546
  * component, but the current type-checking environment doesn't support it.
@@ -12,4 +12,4 @@
12
12
  * - packages/compiler-cli/src/ngtsc/diagnostics/src/error_details_base_url.ts
13
13
  * - packages/core/src/error_details_base_url.ts
14
14
  */
15
- export declare const ERROR_DETAILS_PAGE_BASE_URL = "https://angular.dev/errors";
15
+ export declare const ERROR_DETAILS_PAGE_BASE_URL: string;
@@ -0,0 +1,22 @@
1
+ /*!
2
+ * @license
3
+ * Copyright Google LLC All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be
6
+ * found in the LICENSE file at https://angular.dev/license
7
+ */
8
+ import ts from 'typescript';
9
+ import { ImportedSymbolsTracker } from '../../../imports';
10
+ import { ReflectionHost } from '../../../reflection';
11
+ import { SourceFileValidatorRule } from './api';
12
+ /**
13
+ * Rule that flags forbidden invocations of required initializers in property initializers and constructors.
14
+ */
15
+ export declare class ForbiddenRequiredInitializersInvocationRule implements SourceFileValidatorRule {
16
+ private reflector;
17
+ private importedSymbolsTracker;
18
+ constructor(reflector: ReflectionHost, importedSymbolsTracker: ImportedSymbolsTracker);
19
+ shouldCheck(sourceFile: ts.SourceFile): boolean;
20
+ checkNode(node: ts.Node): ts.Diagnostic[] | null;
21
+ private isPropDeclarationARequiredInitializer;
22
+ }