@angular/compiler-cli 21.0.0-next.3 → 21.0.0-next.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-GHWSK4FH.js";
15
+ } from "./chunk-PAVVB3HR.js";
16
16
 
17
17
  // packages/compiler-cli/src/main.js
18
18
  import ts2 from "typescript";
@@ -16,7 +16,7 @@ import {
16
16
  tryParseSignalInputMapping,
17
17
  tryParseSignalModelMapping,
18
18
  tryParseSignalQueryFromInitializer
19
- } from "./chunk-DQC7LG5E.js";
19
+ } from "./chunk-WXM53XCM.js";
20
20
 
21
21
  // packages/compiler-cli/src/ngtsc/transform/jit/src/downlevel_decorators_transform.js
22
22
  import ts from "typescript";
@@ -8,7 +8,7 @@ import {
8
8
  import {
9
9
  Context,
10
10
  ExpressionTranslatorVisitor
11
- } from "./chunk-I2BHWRAU.js";
11
+ } from "./chunk-LS5RJ5CS.js";
12
12
 
13
13
  // packages/compiler-cli/linker/src/fatal_linker_error.js
14
14
  var FatalLinkerError = class extends Error {
@@ -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.3";
458
+ var PLACEHOLDER_VERSION = "21.0.0-next.5";
459
459
  function wrapReference(wrapped) {
460
460
  return { value: wrapped, type: wrapped };
461
461
  }
@@ -107,6 +107,9 @@ var ExpressionTranslatorVisitor = class {
107
107
  visitLiteralExpr(ast, _context) {
108
108
  return this.setSourceMapRange(this.factory.createLiteral(ast.value), ast.sourceSpan);
109
109
  }
110
+ visitRegularExpressionLiteral(ast, context) {
111
+ return this.setSourceMapRange(this.factory.createRegularExpressionLiteral(ast.body, ast.flags), ast.sourceSpan);
112
+ }
110
113
  visitLocalizedString(ast, context) {
111
114
  const elements = [createTemplateElement(ast.serializeI18nHead())];
112
115
  const expressions = [];
@@ -4,7 +4,7 @@
4
4
 
5
5
  import {
6
6
  angularJitApplicationTransform
7
- } from "./chunk-BSGTWRWT.js";
7
+ } from "./chunk-FO6ETSOL.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-WXM53XCM.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";
@@ -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 {
@@ -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);
@@ -3146,14 +3146,23 @@ var factory6 = {
3146
3146
  };
3147
3147
 
3148
3148
  // packages/compiler-cli/src/ngtsc/typecheck/extended/checks/optional_chain_not_nullable/index.js
3149
- import { SafeCall, SafeKeyedRead, SafePropertyRead } from "@angular/compiler";
3149
+ import { KeyedRead, SafeCall, SafeKeyedRead, SafePropertyRead } from "@angular/compiler";
3150
3150
  import ts20 from "typescript";
3151
3151
  var OptionalChainNotNullableCheck = class extends TemplateCheckWithVisitor {
3152
+ noUncheckedIndexedAccess;
3152
3153
  canVisitStructuralAttributes = false;
3153
3154
  code = ErrorCode.OPTIONAL_CHAIN_NOT_NULLABLE;
3155
+ constructor(noUncheckedIndexedAccess) {
3156
+ super();
3157
+ this.noUncheckedIndexedAccess = noUncheckedIndexedAccess;
3158
+ }
3154
3159
  visitNode(ctx, component, node) {
3155
- if (!(node instanceof SafeCall) && !(node instanceof SafePropertyRead) && !(node instanceof SafeKeyedRead))
3160
+ if (!(node instanceof SafeCall) && !(node instanceof SafePropertyRead) && !(node instanceof SafeKeyedRead)) {
3156
3161
  return [];
3162
+ }
3163
+ if (node.receiver instanceof KeyedRead && !this.noUncheckedIndexedAccess) {
3164
+ return [];
3165
+ }
3157
3166
  const symbolLeft = ctx.templateTypeChecker.getSymbolOfNode(node.receiver, component);
3158
3167
  if (symbolLeft === null || symbolLeft.kind !== SymbolKind.Expression) {
3159
3168
  return [];
@@ -3185,7 +3194,8 @@ var factory7 = {
3185
3194
  if (!strictNullChecks) {
3186
3195
  return null;
3187
3196
  }
3188
- return new OptionalChainNotNullableCheck();
3197
+ const noUncheckedIndexedAccess = !!options.noUncheckedIndexedAccess;
3198
+ return new OptionalChainNotNullableCheck(noUncheckedIndexedAccess);
3189
3199
  }
3190
3200
  };
3191
3201
 
@@ -3801,12 +3811,77 @@ function closestNode(start, predicate) {
3801
3811
  return null;
3802
3812
  }
3803
3813
 
3814
+ // packages/compiler-cli/src/ngtsc/validation/src/rules/forbidden_required_initializer_invocation_rule.js
3815
+ import ts25 from "typescript";
3816
+ var APIS_TO_CHECK2 = [
3817
+ INPUT_INITIALIZER_FN,
3818
+ MODEL_INITIALIZER_FN,
3819
+ ...QUERY_INITIALIZER_FNS
3820
+ ];
3821
+ var ForbiddenRequiredInitializersInvocationRule = class {
3822
+ reflector;
3823
+ importedSymbolsTracker;
3824
+ constructor(reflector, importedSymbolsTracker) {
3825
+ this.reflector = reflector;
3826
+ this.importedSymbolsTracker = importedSymbolsTracker;
3827
+ }
3828
+ shouldCheck(sourceFile) {
3829
+ return APIS_TO_CHECK2.some(({ functionName, owningModule }) => {
3830
+ return this.importedSymbolsTracker.hasNamedImport(sourceFile, functionName, owningModule) || this.importedSymbolsTracker.hasNamespaceImport(sourceFile, owningModule);
3831
+ });
3832
+ }
3833
+ checkNode(node) {
3834
+ if (!ts25.isClassDeclaration(node))
3835
+ return null;
3836
+ const requiredInitializerDeclarations = node.members.filter((m) => ts25.isPropertyDeclaration(m) && this.isPropDeclarationARequiredInitializer(m));
3837
+ const diagnostics = [];
3838
+ for (let decl of node.members) {
3839
+ if (!ts25.isPropertyDeclaration(decl))
3840
+ continue;
3841
+ const initiallizerExpr = decl.initializer;
3842
+ if (!initiallizerExpr)
3843
+ continue;
3844
+ checkForbiddenInvocation(initiallizerExpr);
3845
+ }
3846
+ function checkForbiddenInvocation(node2) {
3847
+ if (ts25.isArrowFunction(node2) || ts25.isFunctionExpression(node2))
3848
+ return;
3849
+ if (ts25.isPropertyAccessExpression(node2) && node2.expression.kind === ts25.SyntaxKind.ThisKeyword && // With the following we make sure we only flag invoked required initializers
3850
+ ts25.isCallExpression(node2.parent) && node2.parent.expression === node2) {
3851
+ const requiredProp = requiredInitializerDeclarations.find((prop) => prop.name.getText() === node2.name.getText());
3852
+ if (requiredProp) {
3853
+ const initializerFn = requiredProp.initializer.expression.expression.getText();
3854
+ 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.`));
3855
+ }
3856
+ }
3857
+ return node2.forEachChild(checkForbiddenInvocation);
3858
+ }
3859
+ const ctor = getConstructorFromClass(node);
3860
+ if (ctor) {
3861
+ checkForbiddenInvocation(ctor);
3862
+ }
3863
+ return diagnostics;
3864
+ }
3865
+ isPropDeclarationARequiredInitializer(node) {
3866
+ if (!node.initializer)
3867
+ return false;
3868
+ const identifiedInitializer = tryParseInitializerApi(APIS_TO_CHECK2, node.initializer, this.reflector, this.importedSymbolsTracker);
3869
+ if (identifiedInitializer === null || !identifiedInitializer.isRequired)
3870
+ return false;
3871
+ return true;
3872
+ }
3873
+ };
3874
+ function getConstructorFromClass(node) {
3875
+ return node.members.find((m) => ts25.isConstructorDeclaration(m) && m.body !== void 0);
3876
+ }
3877
+
3804
3878
  // packages/compiler-cli/src/ngtsc/validation/src/source_file_validator.js
3805
3879
  var SourceFileValidator = class {
3806
3880
  rules;
3807
3881
  constructor(reflector, importedSymbolsTracker, templateTypeChecker, typeCheckingConfig) {
3808
3882
  this.rules = [new InitializerApiUsageRule(reflector, importedSymbolsTracker)];
3809
3883
  this.rules.push(new UnusedStandaloneImportsRule(templateTypeChecker, typeCheckingConfig, importedSymbolsTracker));
3884
+ this.rules.push(new ForbiddenRequiredInitializersInvocationRule(reflector, importedSymbolsTracker));
3810
3885
  }
3811
3886
  /**
3812
3887
  * Gets the diagnostics for a specific file, or null if the file is valid.
@@ -3996,8 +4071,8 @@ var NgCompiler = class _NgCompiler {
3996
4071
  this.delegatingPerfRecorder = new DelegatingPerfRecorder(this.perfRecorder);
3997
4072
  this.usePoisonedData = usePoisonedData || !!options._compilePoisonedComponents;
3998
4073
  this.enableTemplateTypeChecker = enableTemplateTypeChecker || !!options._enableTemplateTypeChecker;
3999
- this.enableBlockSyntax = options["_enableBlockSyntax"] ?? true;
4000
- this.enableLetSyntax = options["_enableLetSyntax"] ?? true;
4074
+ this.enableBlockSyntax = this.angularCoreVersion === null || coreVersionSupportsFeature(this.angularCoreVersion, ">= 17.0.0");
4075
+ this.enableLetSyntax = this.angularCoreVersion === null || coreVersionSupportsFeature(this.angularCoreVersion, ">= 18.1.0");
4001
4076
  this.enableSelectorless = options["_enableSelectorless"] ?? false;
4002
4077
  this.emitDeclarationOnly = !!options.emitDeclarationOnly && !!options._experimentalAllowEmitDeclarationOnly;
4003
4078
  this.implicitStandaloneValue = this.angularCoreVersion === null || coreVersionSupportsFeature(this.angularCoreVersion, ">= 19.0.0");
@@ -4006,7 +4081,7 @@ var NgCompiler = class _NgCompiler {
4006
4081
  this.currentProgram = inputProgram;
4007
4082
  this.closureCompilerEnabled = !!this.options.annotateForClosureCompiler;
4008
4083
  this.entryPoint = adapter.entryPoint !== null ? getSourceFileOrNull(inputProgram, adapter.entryPoint) : null;
4009
- const moduleResolutionCache = ts25.createModuleResolutionCache(
4084
+ const moduleResolutionCache = ts26.createModuleResolutionCache(
4010
4085
  this.adapter.getCurrentDirectory(),
4011
4086
  // doen't retain a reference to `this`, if other closures in the constructor here reference
4012
4087
  // `this` internally then a closure created here would retain them. This can cause major
@@ -4054,7 +4129,7 @@ var NgCompiler = class _NgCompiler {
4054
4129
  }
4055
4130
  for (const clazz of classesToUpdate) {
4056
4131
  this.compilation.traitCompiler.updateResources(clazz);
4057
- if (!ts25.isClassDeclaration(clazz)) {
4132
+ if (!ts26.isClassDeclaration(clazz)) {
4058
4133
  continue;
4059
4134
  }
4060
4135
  this.compilation.templateTypeChecker.invalidateClass(clazz);
@@ -4264,12 +4339,12 @@ var NgCompiler = class _NgCompiler {
4264
4339
  if (compilation.supportJitMode && compilation.jitDeclarationRegistry.jitDeclarations.size > 0) {
4265
4340
  const { jitDeclarations } = compilation.jitDeclarationRegistry;
4266
4341
  const jitDeclarationsArray = Array.from(jitDeclarations);
4267
- const jitDeclarationOriginalNodes = new Set(jitDeclarationsArray.map((d) => ts25.getOriginalNode(d)));
4342
+ const jitDeclarationOriginalNodes = new Set(jitDeclarationsArray.map((d) => ts26.getOriginalNode(d)));
4268
4343
  const sourceFilesWithJit = new Set(jitDeclarationsArray.map((d) => d.getSourceFile().fileName));
4269
4344
  before.push((ctx) => {
4270
4345
  const reflectionHost = new TypeScriptReflectionHost(this.inputProgram.getTypeChecker());
4271
4346
  const jitTransform = angularJitApplicationTransform(this.inputProgram, compilation.isCore, (node) => {
4272
- node = ts25.getOriginalNode(node, ts25.isClassDeclaration);
4347
+ node = ts26.getOriginalNode(node, ts26.isClassDeclaration);
4273
4348
  return reflectionHost.isClass(node) && jitDeclarationOriginalNodes.has(node);
4274
4349
  })(ctx);
4275
4350
  return (sourceFile) => {
@@ -4348,16 +4423,16 @@ var NgCompiler = class _NgCompiler {
4348
4423
  return null;
4349
4424
  }
4350
4425
  const sourceFile = node.getSourceFile();
4351
- const printer = ts25.createPrinter();
4352
- const nodeText = printer.printNode(ts25.EmitHint.Unspecified, callback, sourceFile);
4353
- return ts25.transpileModule(nodeText, {
4426
+ const printer = ts26.createPrinter();
4427
+ const nodeText = printer.printNode(ts26.EmitHint.Unspecified, callback, sourceFile);
4428
+ return ts26.transpileModule(nodeText, {
4354
4429
  compilerOptions: {
4355
4430
  ...this.options,
4356
4431
  // Some module types can produce additional code (see #60795) whereas we need the
4357
4432
  // HMR update module to use a native `export`. Override the `target` and `module`
4358
4433
  // to ensure that it looks as expected.
4359
- module: ts25.ModuleKind.ES2022,
4360
- target: ts25.ScriptTarget.ES2022
4434
+ module: ts26.ModuleKind.ES2022,
4435
+ target: ts26.ScriptTarget.ES2022
4361
4436
  },
4362
4437
  fileName: sourceFile.fileName,
4363
4438
  reportDiagnostics: false
@@ -4733,18 +4808,18 @@ function isAngularCorePackage(program) {
4733
4808
  return false;
4734
4809
  }
4735
4810
  return r3Symbols.statements.some((stmt) => {
4736
- if (!ts25.isVariableStatement(stmt)) {
4811
+ if (!ts26.isVariableStatement(stmt)) {
4737
4812
  return false;
4738
4813
  }
4739
- const modifiers = ts25.getModifiers(stmt);
4740
- if (modifiers === void 0 || !modifiers.some((mod) => mod.kind === ts25.SyntaxKind.ExportKeyword)) {
4814
+ const modifiers = ts26.getModifiers(stmt);
4815
+ if (modifiers === void 0 || !modifiers.some((mod) => mod.kind === ts26.SyntaxKind.ExportKeyword)) {
4741
4816
  return false;
4742
4817
  }
4743
4818
  return stmt.declarationList.declarations.some((decl) => {
4744
- if (!ts25.isIdentifier(decl.name) || decl.name.text !== "ITS_JUST_ANGULAR") {
4819
+ if (!ts26.isIdentifier(decl.name) || decl.name.text !== "ITS_JUST_ANGULAR") {
4745
4820
  return false;
4746
4821
  }
4747
- if (decl.initializer === void 0 || decl.initializer.kind !== ts25.SyntaxKind.TrueKeyword) {
4822
+ if (decl.initializer === void 0 || decl.initializer.kind !== ts26.SyntaxKind.TrueKeyword) {
4748
4823
  return false;
4749
4824
  }
4750
4825
  return true;
@@ -4757,7 +4832,7 @@ function getR3SymbolsFile(program) {
4757
4832
  function* verifyCompatibleTypeCheckOptions(options) {
4758
4833
  if (options.fullTemplateTypeCheck === false && options.strictTemplates === true) {
4759
4834
  yield makeConfigDiagnostic({
4760
- category: ts25.DiagnosticCategory.Error,
4835
+ category: ts26.DiagnosticCategory.Error,
4761
4836
  code: ErrorCode.CONFIG_STRICT_TEMPLATES_IMPLIES_FULL_TEMPLATE_TYPECHECK,
4762
4837
  messageText: `
4763
4838
  Angular compiler option "strictTemplates" is enabled, however "fullTemplateTypeCheck" is disabled.
@@ -4776,7 +4851,7 @@ https://angular.dev/tools/cli/template-typecheck
4776
4851
  }
4777
4852
  if (options.extendedDiagnostics && options.strictTemplates === false) {
4778
4853
  yield makeConfigDiagnostic({
4779
- category: ts25.DiagnosticCategory.Error,
4854
+ category: ts26.DiagnosticCategory.Error,
4780
4855
  code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_IMPLIES_STRICT_TEMPLATES,
4781
4856
  messageText: `
4782
4857
  Angular compiler option "extendedDiagnostics" is configured, however "strictTemplates" is disabled.
@@ -4793,7 +4868,7 @@ One of the following actions is required:
4793
4868
  const defaultCategory = options.extendedDiagnostics?.defaultCategory;
4794
4869
  if (defaultCategory && !allowedCategoryLabels.includes(defaultCategory)) {
4795
4870
  yield makeConfigDiagnostic({
4796
- category: ts25.DiagnosticCategory.Error,
4871
+ category: ts26.DiagnosticCategory.Error,
4797
4872
  code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CATEGORY_LABEL,
4798
4873
  messageText: `
4799
4874
  Angular compiler option "extendedDiagnostics.defaultCategory" has an unknown diagnostic category: "${defaultCategory}".
@@ -4806,7 +4881,7 @@ ${allowedCategoryLabels.join("\n")}
4806
4881
  for (const [checkName, category] of Object.entries(options.extendedDiagnostics?.checks ?? {})) {
4807
4882
  if (!SUPPORTED_DIAGNOSTIC_NAMES.has(checkName)) {
4808
4883
  yield makeConfigDiagnostic({
4809
- category: ts25.DiagnosticCategory.Error,
4884
+ category: ts26.DiagnosticCategory.Error,
4810
4885
  code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CHECK,
4811
4886
  messageText: `
4812
4887
  Angular compiler option "extendedDiagnostics.checks" has an unknown check: "${checkName}".
@@ -4818,7 +4893,7 @@ ${Array.from(SUPPORTED_DIAGNOSTIC_NAMES).join("\n")}
4818
4893
  }
4819
4894
  if (!allowedCategoryLabels.includes(category)) {
4820
4895
  yield makeConfigDiagnostic({
4821
- category: ts25.DiagnosticCategory.Error,
4896
+ category: ts26.DiagnosticCategory.Error,
4822
4897
  code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CATEGORY_LABEL,
4823
4898
  messageText: `
4824
4899
  Angular compiler option "extendedDiagnostics.checks['${checkName}']" has an unknown diagnostic category: "${category}".
@@ -4836,7 +4911,7 @@ function verifyEmitDeclarationOnly(options) {
4836
4911
  }
4837
4912
  return [
4838
4913
  makeConfigDiagnostic({
4839
- category: ts25.DiagnosticCategory.Error,
4914
+ category: ts26.DiagnosticCategory.Error,
4840
4915
  code: ErrorCode.CONFIG_EMIT_DECLARATION_ONLY_UNSUPPORTED,
4841
4916
  messageText: 'TS compiler option "emitDeclarationOnly" is not supported.'
4842
4917
  })
@@ -4861,7 +4936,7 @@ var ReferenceGraphAdapter = class {
4861
4936
  for (const { node } of references) {
4862
4937
  let sourceFile = node.getSourceFile();
4863
4938
  if (sourceFile === void 0) {
4864
- sourceFile = ts25.getOriginalNode(node).getSourceFile();
4939
+ sourceFile = ts26.getOriginalNode(node).getSourceFile();
4865
4940
  }
4866
4941
  if (sourceFile === void 0 || !isDtsPath(sourceFile.fileName)) {
4867
4942
  this.graph.add(source, node);
@@ -4902,7 +4977,7 @@ function versionMapFromProgram(program, driver) {
4902
4977
  }
4903
4978
 
4904
4979
  // packages/compiler-cli/src/ngtsc/core/src/host.js
4905
- import ts26 from "typescript";
4980
+ import ts27 from "typescript";
4906
4981
  var DelegatingCompilerHost = class {
4907
4982
  delegate;
4908
4983
  createHash;
@@ -5041,7 +5116,7 @@ var NgCompilerHost = class _NgCompilerHost extends DelegatingCompilerHost {
5041
5116
  entryPoint = findFlatIndexEntryPoint(normalizedTsInputFiles);
5042
5117
  if (entryPoint === null) {
5043
5118
  diagnostics.push({
5044
- category: ts26.DiagnosticCategory.Error,
5119
+ category: ts27.DiagnosticCategory.Error,
5045
5120
  code: ngErrorCode(ErrorCode.CONFIG_FLAT_MODULE_NO_INDEX),
5046
5121
  file: void 0,
5047
5122
  start: void 0,
@@ -5095,10 +5170,10 @@ var NgCompilerHost = class _NgCompilerHost extends DelegatingCompilerHost {
5095
5170
  return this.fileNameToModuleName !== void 0 ? this : null;
5096
5171
  }
5097
5172
  createCachedResolveModuleNamesFunction() {
5098
- const moduleResolutionCache = ts26.createModuleResolutionCache(this.getCurrentDirectory(), this.getCanonicalFileName.bind(this));
5173
+ const moduleResolutionCache = ts27.createModuleResolutionCache(this.getCurrentDirectory(), this.getCanonicalFileName.bind(this));
5099
5174
  return (moduleNames, containingFile, reusedNames, redirectedReference, options) => {
5100
5175
  return moduleNames.map((moduleName) => {
5101
- const module = ts26.resolveModuleName(moduleName, containingFile, options, this, moduleResolutionCache, redirectedReference);
5176
+ const module = ts27.resolveModuleName(moduleName, containingFile, options, this, moduleResolutionCache, redirectedReference);
5102
5177
  return module.resolvedModule;
5103
5178
  });
5104
5179
  };
@@ -5130,7 +5205,7 @@ var NgtscProgram = class {
5130
5205
  if (reuseProgram !== void 0) {
5131
5206
  retagAllTsFiles(reuseProgram);
5132
5207
  }
5133
- this.tsProgram = perfRecorder.inPhase(PerfPhase.TypeScriptProgramCreate, () => ts27.createProgram(this.host.inputFiles, options, this.host, reuseProgram));
5208
+ this.tsProgram = perfRecorder.inPhase(PerfPhase.TypeScriptProgramCreate, () => ts28.createProgram(this.host.inputFiles, options, this.host, reuseProgram));
5134
5209
  perfRecorder.phase(PerfPhase.Unaccounted);
5135
5210
  perfRecorder.memory(PerfCheckpoint.TypeScriptProgramCreate);
5136
5211
  this.host.postProgramCreationCleanup();
@@ -5359,16 +5434,16 @@ function createProgram({ rootNames, options, host, oldProgram }) {
5359
5434
  }
5360
5435
 
5361
5436
  // packages/compiler-cli/src/perform_compile.js
5362
- import ts29 from "typescript";
5437
+ import ts30 from "typescript";
5363
5438
 
5364
5439
  // packages/compiler-cli/src/transformers/util.js
5365
- import ts28 from "typescript";
5440
+ import ts29 from "typescript";
5366
5441
  function createMessageDiagnostic(messageText) {
5367
5442
  return {
5368
5443
  file: void 0,
5369
5444
  start: void 0,
5370
5445
  length: void 0,
5371
- category: ts28.DiagnosticCategory.Message,
5446
+ category: ts29.DiagnosticCategory.Message,
5372
5447
  messageText,
5373
5448
  code: DEFAULT_ERROR_CODE,
5374
5449
  source: SOURCE
@@ -5377,13 +5452,13 @@ function createMessageDiagnostic(messageText) {
5377
5452
 
5378
5453
  // packages/compiler-cli/src/perform_compile.js
5379
5454
  var defaultFormatHost = {
5380
- getCurrentDirectory: () => ts29.sys.getCurrentDirectory(),
5455
+ getCurrentDirectory: () => ts30.sys.getCurrentDirectory(),
5381
5456
  getCanonicalFileName: (fileName) => fileName,
5382
- getNewLine: () => ts29.sys.newLine
5457
+ getNewLine: () => ts30.sys.newLine
5383
5458
  };
5384
5459
  function formatDiagnostics(diags, host = defaultFormatHost) {
5385
5460
  if (diags && diags.length) {
5386
- return diags.map((diagnostic) => replaceTsWithNgInErrors(ts29.formatDiagnosticsWithColorAndContext([diagnostic], host))).join("");
5461
+ return diags.map((diagnostic) => replaceTsWithNgInErrors(ts30.formatDiagnosticsWithColorAndContext([diagnostic], host))).join("");
5387
5462
  } else {
5388
5463
  return "";
5389
5464
  }
@@ -5399,7 +5474,7 @@ function calcProjectFileAndBasePath(project, host = getFileSystem()) {
5399
5474
  function readConfiguration(project, existingOptions, host = getFileSystem()) {
5400
5475
  try {
5401
5476
  const fs = getFileSystem();
5402
- const readConfigFile = (configFile) => ts29.readConfigFile(configFile, (file) => host.readFile(host.resolve(file)));
5477
+ const readConfigFile = (configFile) => ts30.readConfigFile(configFile, (file) => host.readFile(host.resolve(file)));
5403
5478
  const readAngularCompilerOptions = (configFile, parentOptions = {}) => {
5404
5479
  const { config: config2, error: error2 } = readConfigFile(configFile);
5405
5480
  if (error2) {
@@ -5435,7 +5510,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
5435
5510
  ...existingOptions
5436
5511
  };
5437
5512
  const parseConfigHost = createParseConfigHost(host, fs);
5438
- const { options, errors, fileNames: rootNames, projectReferences } = ts29.parseJsonConfigFileContent(config, parseConfigHost, basePath, existingCompilerOptions, configFileName);
5513
+ const { options, errors, fileNames: rootNames, projectReferences } = ts30.parseJsonConfigFileContent(config, parseConfigHost, basePath, existingCompilerOptions, configFileName);
5439
5514
  let emitFlags = EmitFlags.Default;
5440
5515
  if (!(options["skipMetadataEmit"] || options["flatModuleOutFile"])) {
5441
5516
  emitFlags |= EmitFlags.Metadata;
@@ -5447,7 +5522,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
5447
5522
  } catch (e) {
5448
5523
  const errors = [
5449
5524
  {
5450
- category: ts29.DiagnosticCategory.Error,
5525
+ category: ts30.DiagnosticCategory.Error,
5451
5526
  messageText: e.stack ?? e.message,
5452
5527
  file: void 0,
5453
5528
  start: void 0,
@@ -5482,7 +5557,7 @@ function getExtendedConfigPathWorker(configFile, extendsValue, host, fs) {
5482
5557
  }
5483
5558
  } else {
5484
5559
  const parseConfigHost = createParseConfigHost(host, fs);
5485
- const { resolvedModule } = ts29.nodeModuleNameResolver(extendsValue, configFile, { moduleResolution: ts29.ModuleResolutionKind.Node10, resolveJsonModule: true }, parseConfigHost);
5560
+ const { resolvedModule } = ts30.nodeModuleNameResolver(extendsValue, configFile, { moduleResolution: ts30.ModuleResolutionKind.Node10, resolveJsonModule: true }, parseConfigHost);
5486
5561
  if (resolvedModule) {
5487
5562
  return absoluteFrom(resolvedModule.resolvedFileName);
5488
5563
  }
@@ -5492,7 +5567,7 @@ function getExtendedConfigPathWorker(configFile, extendsValue, host, fs) {
5492
5567
  function exitCodeFromResult(diags) {
5493
5568
  if (!diags)
5494
5569
  return 0;
5495
- if (diags.every((diag) => diag.category !== ts29.DiagnosticCategory.Error)) {
5570
+ if (diags.every((diag) => diag.category !== ts30.DiagnosticCategory.Error)) {
5496
5571
  return 0;
5497
5572
  }
5498
5573
  return diags.some((d) => d.source === "angular" && d.code === UNKNOWN_ERROR_CODE) ? 2 : 1;
@@ -5530,7 +5605,7 @@ function performCompilation({ rootNames, options, host, oldProgram, emitCallback
5530
5605
  } catch (e) {
5531
5606
  program = void 0;
5532
5607
  allDiagnostics.push({
5533
- category: ts29.DiagnosticCategory.Error,
5608
+ category: ts30.DiagnosticCategory.Error,
5534
5609
  messageText: e.stack ?? e.message,
5535
5610
  code: UNKNOWN_ERROR_CODE,
5536
5611
  file: void 0,
@@ -5560,7 +5635,7 @@ function defaultGatherDiagnostics(program) {
5560
5635
  return allDiagnostics;
5561
5636
  }
5562
5637
  function hasErrors(diags) {
5563
- return diags.some((d) => d.category === ts29.DiagnosticCategory.Error);
5638
+ return diags.some((d) => d.category === ts30.DiagnosticCategory.Error);
5564
5639
  }
5565
5640
 
5566
5641
  export {
@@ -5,7 +5,7 @@
5
5
  import {
6
6
  Context,
7
7
  ExpressionTranslatorVisitor
8
- } from "./chunk-I2BHWRAU.js";
8
+ } from "./chunk-LS5RJ5CS.js";
9
9
  import {
10
10
  LogicalProjectPath,
11
11
  absoluteFrom,
@@ -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;
@@ -4041,6 +4046,9 @@ var TypeTranslatorVisitor = class {
4041
4046
  visitDynamicImportExpr(ast, context) {
4042
4047
  throw new Error("Method not implemented.");
4043
4048
  }
4049
+ visitRegularExpressionLiteral(ast, context) {
4050
+ throw new Error("Method not implemented.");
4051
+ }
4044
4052
  visitNotExpr(ast, context) {
4045
4053
  throw new Error("Method not implemented.");
4046
4054
  }
@@ -4336,6 +4344,9 @@ var TypeScriptAstFactory = class {
4336
4344
  ts23.factory.createVariableDeclaration(variableName, void 0, void 0, initializer ?? void 0)
4337
4345
  ], this.VAR_TYPES[type]));
4338
4346
  }
4347
+ createRegularExpressionLiteral(body, flags) {
4348
+ return ts23.factory.createRegularExpressionLiteral(`/${body}/${flags ?? ""}`);
4349
+ }
4339
4350
  setSourceMapRange(node, sourceMapRange) {
4340
4351
  if (sourceMapRange === null) {
4341
4352
  return node;
@@ -10979,7 +10990,7 @@ var CompletionEngine = class {
10979
10990
  // packages/compiler-cli/src/ngtsc/typecheck/src/context.js
10980
10991
  import { ParseSourceFile as ParseSourceFile2 } from "@angular/compiler";
10981
10992
 
10982
- // node_modules/.aspect_rules_js/magic-string@0.30.18/node_modules/magic-string/dist/magic-string.es.mjs
10993
+ // node_modules/.aspect_rules_js/magic-string@0.30.19/node_modules/magic-string/dist/magic-string.es.mjs
10983
10994
  import { encode } from "@jridgewell/sourcemap-codec";
10984
10995
  var BitSet = class _BitSet {
10985
10996
  constructor(arg) {
@@ -11429,6 +11440,9 @@ var MagicString = class _MagicString {
11429
11440
  if (chunk.outro.length)
11430
11441
  mappings.advance(chunk.outro);
11431
11442
  });
11443
+ if (this.outro) {
11444
+ mappings.advance(this.outro);
11445
+ }
11432
11446
  return {
11433
11447
  file: options.file ? options.file.split(/[/\\]/).pop() : void 0,
11434
11448
  sources: [
@@ -11991,7 +12005,12 @@ var MagicString = class _MagicString {
11991
12005
  const { original } = this;
11992
12006
  const index = original.indexOf(string);
11993
12007
  if (index !== -1) {
11994
- this.overwrite(index, index + string.length, replacement);
12008
+ if (typeof replacement === "function") {
12009
+ replacement = replacement(string, index, original);
12010
+ }
12011
+ if (string !== replacement) {
12012
+ this.overwrite(index, index + string.length, replacement);
12013
+ }
11995
12014
  }
11996
12015
  return this;
11997
12016
  }
@@ -12006,8 +12025,12 @@ var MagicString = class _MagicString {
12006
12025
  const stringLength = string.length;
12007
12026
  for (let index = original.indexOf(string); index !== -1; index = original.indexOf(string, index + stringLength)) {
12008
12027
  const previous = original.slice(index, index + stringLength);
12009
- if (previous !== replacement)
12010
- this.overwrite(index, index + stringLength, replacement);
12028
+ let _replacement = replacement;
12029
+ if (typeof replacement === "function") {
12030
+ _replacement = replacement(previous, index, original);
12031
+ }
12032
+ if (previous !== _replacement)
12033
+ this.overwrite(index, index + stringLength, _replacement);
12011
12034
  }
12012
12035
  return this;
12013
12036
  }
@@ -13298,6 +13321,9 @@ var AstTranslator = class {
13298
13321
  visitThisReceiver(ast) {
13299
13322
  throw new Error("Method not implemented.");
13300
13323
  }
13324
+ visitRegularExpressionLiteral(ast, context) {
13325
+ return wrapForTypeChecker(ts59.factory.createRegularExpressionLiteral(`/${ast.body}/${ast.flags ?? ""}`));
13326
+ }
13301
13327
  visitInterpolation(ast) {
13302
13328
  return ast.expressions.reduce((lhs, ast2) => ts59.factory.createBinaryExpression(lhs, ts59.SyntaxKind.PlusToken, wrapForTypeChecker(this.translate(ast2))), ts59.factory.createStringLiteral(""));
13303
13329
  }
@@ -13566,6 +13592,9 @@ var VeSafeLhsInferenceBugDetector = class _VeSafeLhsInferenceBugDetector {
13566
13592
  visitParenthesizedExpression(ast, context) {
13567
13593
  return ast.expression.visit(this);
13568
13594
  }
13595
+ visitRegularExpressionLiteral(ast, context) {
13596
+ return false;
13597
+ }
13569
13598
  };
13570
13599
 
13571
13600
  // packages/compiler-cli/src/ngtsc/typecheck/src/type_check_block.js
@@ -15572,10 +15601,15 @@ function getBoundAttributes(directive, node) {
15572
15601
  });
15573
15602
  }
15574
15603
  };
15575
- node.inputs.forEach(processAttribute);
15576
- node.attributes.forEach(processAttribute);
15577
15604
  if (node instanceof TmplAstTemplate) {
15605
+ if (node.tagName === "ng-template") {
15606
+ node.inputs.forEach(processAttribute);
15607
+ node.attributes.forEach(processAttribute);
15608
+ }
15578
15609
  node.templateAttrs.forEach(processAttribute);
15610
+ } else {
15611
+ node.inputs.forEach(processAttribute);
15612
+ node.attributes.forEach(processAttribute);
15579
15613
  }
15580
15614
  return boundInputs;
15581
15615
  }
@@ -21062,11 +21096,12 @@ var ComponentDecoratorHandler = class {
21062
21096
  for (const [_, deps] of resolution.deferPerBlockDependencies) {
21063
21097
  for (const deferBlockDep of deps) {
21064
21098
  const node = deferBlockDep.declaration.node;
21065
- const importDecl = resolution.deferrableDeclToImportDecl.get(node) ?? null;
21066
- if (importDecl !== null && this.deferredSymbolTracker.canDefer(importDecl)) {
21099
+ const importInfo = resolution.deferrableDeclToImportDecl.get(node) ?? null;
21100
+ if (importInfo !== null && this.deferredSymbolTracker.canDefer(importInfo.node)) {
21067
21101
  deferBlockDep.isDeferrable = true;
21068
- deferBlockDep.importPath = importDecl.moduleSpecifier.text;
21069
- deferBlockDep.isDefaultImport = isDefaultImport(importDecl);
21102
+ deferBlockDep.symbolName = importInfo.name;
21103
+ deferBlockDep.importPath = importInfo.from;
21104
+ deferBlockDep.isDefaultImport = isDefaultImport(importInfo.node);
21070
21105
  if (!seenDeps.has(node)) {
21071
21106
  seenDeps.add(node);
21072
21107
  deferrableTypes.push(deferBlockDep);
@@ -21209,7 +21244,7 @@ var ComponentDecoratorHandler = class {
21209
21244
  if (dirMeta === null && pipeMeta === null) {
21210
21245
  return;
21211
21246
  }
21212
- resolutionData.deferrableDeclToImportDecl.set(decl.node, imp.node);
21247
+ resolutionData.deferrableDeclToImportDecl.set(decl.node, imp);
21213
21248
  this.deferredSymbolTracker.markAsDeferrableCandidate(node, imp.node, componentClassDecl, isDeferredImport);
21214
21249
  }
21215
21250
  compileDeferBlocks(resolution) {
package/bundles/index.js CHANGED
@@ -28,7 +28,7 @@ import {
28
28
  isTsDiagnostic,
29
29
  performCompilation,
30
30
  readConfiguration
31
- } from "./chunk-GHWSK4FH.js";
31
+ } from "./chunk-PAVVB3HR.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-FO6ETSOL.js";
41
41
  import {
42
42
  ActivePerfRecorder,
43
43
  ErrorCode,
@@ -46,8 +46,8 @@ import {
46
46
  TsCreateProgramDriver,
47
47
  isLocalCompilationDiagnostics,
48
48
  ngErrorCode
49
- } from "./chunk-DQC7LG5E.js";
50
- import "./chunk-I2BHWRAU.js";
49
+ } from "./chunk-WXM53XCM.js";
50
+ import "./chunk-LS5RJ5CS.js";
51
51
  import {
52
52
  InvalidFileSystem,
53
53
  LogicalFileSystem,
@@ -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.3");
80
+ var VERSION = new Version("21.0.0-next.5");
81
81
 
82
82
  // packages/compiler-cli/private/tooling.js
83
83
  var GLOBAL_DEFS_FOR_TERSER = {
@@ -8,13 +8,13 @@ import {
8
8
  LinkerEnvironment,
9
9
  assert,
10
10
  isFatalLinkerError
11
- } from "../../chunk-BPDNYZBC.js";
11
+ } from "../../chunk-KZHANLEJ.js";
12
12
  import {
13
13
  ConsoleLogger,
14
14
  LogLevel
15
15
  } from "../../chunk-6HOSNZU5.js";
16
16
  import "../../chunk-HYJ2H3FU.js";
17
- import "../../chunk-I2BHWRAU.js";
17
+ import "../../chunk-LS5RJ5CS.js";
18
18
  import {
19
19
  NodeJSFileSystem
20
20
  } from "../../chunk-XYYEESKY.js";
@@ -163,6 +163,9 @@ var BabelAstFactory = class {
163
163
  t.variableDeclarator(t.identifier(variableName), initializer)
164
164
  ]);
165
165
  }
166
+ createRegularExpressionLiteral(body, flags) {
167
+ return t.regExpLiteral(body, flags ?? void 0);
168
+ }
166
169
  setSourceMapRange(node, sourceMapRange) {
167
170
  if (sourceMapRange === null) {
168
171
  return node;
@@ -10,9 +10,9 @@ import {
10
10
  assert,
11
11
  isFatalLinkerError,
12
12
  needsLinking
13
- } from "../chunk-BPDNYZBC.js";
13
+ } from "../chunk-KZHANLEJ.js";
14
14
  import "../chunk-HYJ2H3FU.js";
15
- import "../chunk-I2BHWRAU.js";
15
+ import "../chunk-LS5RJ5CS.js";
16
16
  import "../chunk-G7GFT6BU.js";
17
17
  export {
18
18
  DEFAULT_LINKER_OPTIONS,
@@ -13,8 +13,8 @@ import {
13
13
  TypeScriptReflectionHost,
14
14
  createForwardRefResolver,
15
15
  reflectObjectLiteral
16
- } from "../chunk-DQC7LG5E.js";
17
- import "../chunk-I2BHWRAU.js";
16
+ } from "../chunk-WXM53XCM.js";
17
+ import "../chunk-LS5RJ5CS.js";
18
18
  import "../chunk-GWZQLAGK.js";
19
19
  import "../chunk-XYYEESKY.js";
20
20
  import "../chunk-G7GFT6BU.js";
@@ -4,9 +4,9 @@
4
4
 
5
5
  import {
6
6
  angularJitApplicationTransform
7
- } from "../chunk-BSGTWRWT.js";
8
- import "../chunk-DQC7LG5E.js";
9
- import "../chunk-I2BHWRAU.js";
7
+ } from "../chunk-FO6ETSOL.js";
8
+ import "../chunk-WXM53XCM.js";
9
+ import "../chunk-LS5RJ5CS.js";
10
10
  import "../chunk-GWZQLAGK.js";
11
11
  import "../chunk-XYYEESKY.js";
12
12
  import "../chunk-G7GFT6BU.js";
@@ -6,13 +6,13 @@
6
6
  import {
7
7
  main,
8
8
  readCommandLineAndConfiguration
9
- } from "../../chunk-XGTXFDVY.js";
9
+ } from "../../chunk-4OZZORXD.js";
10
10
  import {
11
11
  EmitFlags
12
- } from "../../chunk-GHWSK4FH.js";
13
- import "../../chunk-BSGTWRWT.js";
14
- import "../../chunk-DQC7LG5E.js";
15
- import "../../chunk-I2BHWRAU.js";
12
+ } from "../../chunk-PAVVB3HR.js";
13
+ import "../../chunk-FO6ETSOL.js";
14
+ import "../../chunk-WXM53XCM.js";
15
+ import "../../chunk-LS5RJ5CS.js";
16
16
  import {
17
17
  setFileSystem
18
18
  } from "../../chunk-GWZQLAGK.js";
@@ -5,11 +5,11 @@
5
5
 
6
6
  import {
7
7
  main
8
- } from "../../chunk-XGTXFDVY.js";
9
- import "../../chunk-GHWSK4FH.js";
10
- import "../../chunk-BSGTWRWT.js";
11
- import "../../chunk-DQC7LG5E.js";
12
- import "../../chunk-I2BHWRAU.js";
8
+ } from "../../chunk-4OZZORXD.js";
9
+ import "../../chunk-PAVVB3HR.js";
10
+ import "../../chunk-FO6ETSOL.js";
11
+ import "../../chunk-WXM53XCM.js";
12
+ import "../../chunk-LS5RJ5CS.js";
13
13
  import {
14
14
  setFileSystem
15
15
  } from "../../chunk-GWZQLAGK.js";
@@ -44,5 +44,6 @@ export declare class BabelAstFactory implements AstFactory<t.Statement, t.Expres
44
44
  createVoidExpression(expression: t.Expression): t.Expression;
45
45
  createUnaryExpression: typeof t.unaryExpression;
46
46
  createVariableDeclaration(variableName: string, initializer: t.Expression | null, type: VariableDeclarationType): t.Statement;
47
+ createRegularExpressionLiteral(body: string, flags: string | null): t.Expression;
47
48
  setSourceMapRange<T extends t.Statement | t.Expression | t.TemplateElement>(node: T, sourceMapRange: SourceMapRange | null): T;
48
49
  }
@@ -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.3";
10
+ export declare const PLACEHOLDER_VERSION = "21.0.0-next.5";
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.3",
3
+ "version": "21.0.0-next.5",
4
4
  "description": "Angular - the compiler CLI for Node.js",
5
5
  "typings": "index.d.ts",
6
6
  "bin": {
@@ -48,7 +48,7 @@
48
48
  "yargs": "^18.0.0"
49
49
  },
50
50
  "peerDependencies": {
51
- "@angular/compiler": "21.0.0-next.3",
51
+ "@angular/compiler": "21.0.0-next.5",
52
52
  "typescript": ">=5.9 <6.0"
53
53
  },
54
54
  "peerDependenciesMeta": {
@@ -9,7 +9,7 @@ import { LegacyAnimationTriggerNames, DeclarationListEmitMode, DeferBlockDepsEmi
9
9
  import ts from 'typescript';
10
10
  import { Reference } from '../../../imports';
11
11
  import { ClassPropertyMapping, DirectiveResources, DirectiveTypeCheckMeta, HostDirectiveMeta, InputMapping } from '../../../metadata';
12
- import { ClassDeclaration } from '../../../reflection';
12
+ import { ClassDeclaration, Import } from '../../../reflection';
13
13
  import { SubsetOfKeys } from '../../../util/src/typescript';
14
14
  import { ParsedTemplateWithSource, StyleUrlMeta } from './resources';
15
15
  import { HostBindingNodes } from '../../directive';
@@ -84,10 +84,11 @@ export interface ComponentResolutionData {
84
84
  declarationListEmitMode: DeclarationListEmitMode;
85
85
  /**
86
86
  * Map of all types that can be defer loaded (ts.ClassDeclaration) ->
87
- * corresponding import declaration (ts.ImportDeclaration) within
88
- * the current source file.
87
+ * corresponding import information (reflection `Import`) within
88
+ * the current source file. The `Import` preserves the exported name
89
+ * as seen by the importing module so aliasing is handled correctly.
89
90
  */
90
- deferrableDeclToImportDecl: Map<ClassDeclaration, ts.ImportDeclaration>;
91
+ deferrableDeclToImportDecl: Map<ClassDeclaration, Import>;
91
92
  /**
92
93
  * Map of `@defer` blocks -> their corresponding dependencies.
93
94
  * Required to compile the defer resolver function in `PerBlock` mode.
@@ -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;
@@ -219,6 +219,13 @@ export interface AstFactory<TStatement, TExpression> {
219
219
  * @param type whether this variable should be declared as `var`, `let` or `const`.
220
220
  */
221
221
  createVariableDeclaration(variableName: string, initializer: TExpression | null, type: VariableDeclarationType): TStatement;
222
+ /**
223
+ * Create a regular expression literal (e.g. `/\d+/g`).
224
+ *
225
+ * @param body Body of the regex.
226
+ * @param flags Flags of the regex, if any.
227
+ */
228
+ createRegularExpressionLiteral(body: string, flags: string | null): TExpression;
222
229
  /**
223
230
  * Attach a source map range to the given node.
224
231
  *
@@ -35,6 +35,7 @@ export declare class ExpressionTranslatorVisitor<TFile, TStatement, TExpression>
35
35
  visitTemplateLiteralExpr(ast: o.TemplateLiteralExpr, context: Context): TExpression;
36
36
  visitInstantiateExpr(ast: o.InstantiateExpr, context: Context): TExpression;
37
37
  visitLiteralExpr(ast: o.LiteralExpr, _context: Context): TExpression;
38
+ visitRegularExpressionLiteral(ast: o.outputAst.RegularExpressionLiteral, context: any): TExpression;
38
39
  visitLocalizedString(ast: o.LocalizedString, context: Context): TExpression;
39
40
  private createTaggedTemplateExpression;
40
41
  /**
@@ -45,6 +45,7 @@ export declare class TypeScriptAstFactory implements AstFactory<ts.Statement, ts
45
45
  createVoidExpression: (expression: ts.Expression) => ts.VoidExpression;
46
46
  createUnaryExpression(operator: UnaryOperator, operand: ts.Expression): ts.Expression;
47
47
  createVariableDeclaration(variableName: string, initializer: ts.Expression | null, type: VariableDeclarationType): ts.Statement;
48
+ createRegularExpressionLiteral(body: string, flags: string | null): ts.Expression;
48
49
  setSourceMapRange<T extends ts.Node>(node: T, sourceMapRange: SourceMapRange | null): T;
49
50
  }
50
51
  export declare function createTemplateMiddle(cooked: string, raw: string): ts.TemplateMiddle;
@@ -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
+ }