@angular/compiler-cli 21.0.0-next.3 → 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.
- package/bundles/chunk-BPDNYZBC.js +1 -1
- package/bundles/{chunk-XGTXFDVY.js → chunk-COFK26OM.js} +1 -1
- package/bundles/{chunk-GHWSK4FH.js → chunk-IMTR3556.js} +112 -47
- package/bundles/{chunk-BSGTWRWT.js → chunk-TO7TOCP7.js} +1 -1
- package/bundles/{chunk-DQC7LG5E.js → chunk-YRHCC62K.js} +13 -3
- package/bundles/index.js +4 -4
- package/bundles/private/migrations.js +1 -1
- package/bundles/private/tooling.js +2 -2
- package/bundles/src/bin/ng_xi18n.js +4 -4
- package/bundles/src/bin/ngc.js +4 -4
- package/linker/src/file_linker/partial_linkers/util.d.ts +1 -1
- package/package.json +2 -2
- package/src/ngtsc/diagnostics/src/error_code.d.ts +15 -0
- package/src/ngtsc/diagnostics/src/error_details_base_url.d.ts +1 -1
- package/src/ngtsc/validation/src/rules/forbidden_required_initializer_invocation_rule.d.ts +22 -0
|
@@ -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.
|
|
458
|
+
var PLACEHOLDER_VERSION = "21.0.0-next.4";
|
|
459
459
|
function wrapReference(wrapped) {
|
|
460
460
|
return { value: wrapped, type: wrapped };
|
|
461
461
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
6
|
angularJitApplicationTransform
|
|
7
|
-
} from "./chunk-
|
|
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-
|
|
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
|
|
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
|
|
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
|
|
2900
|
-
if (
|
|
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);
|
|
@@ -3801,12 +3801,77 @@ function closestNode(start, predicate) {
|
|
|
3801
3801
|
return null;
|
|
3802
3802
|
}
|
|
3803
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
|
+
|
|
3804
3868
|
// packages/compiler-cli/src/ngtsc/validation/src/source_file_validator.js
|
|
3805
3869
|
var SourceFileValidator = class {
|
|
3806
3870
|
rules;
|
|
3807
3871
|
constructor(reflector, importedSymbolsTracker, templateTypeChecker, typeCheckingConfig) {
|
|
3808
3872
|
this.rules = [new InitializerApiUsageRule(reflector, importedSymbolsTracker)];
|
|
3809
3873
|
this.rules.push(new UnusedStandaloneImportsRule(templateTypeChecker, typeCheckingConfig, importedSymbolsTracker));
|
|
3874
|
+
this.rules.push(new ForbiddenRequiredInitializersInvocationRule(reflector, importedSymbolsTracker));
|
|
3810
3875
|
}
|
|
3811
3876
|
/**
|
|
3812
3877
|
* Gets the diagnostics for a specific file, or null if the file is valid.
|
|
@@ -3996,8 +4061,8 @@ var NgCompiler = class _NgCompiler {
|
|
|
3996
4061
|
this.delegatingPerfRecorder = new DelegatingPerfRecorder(this.perfRecorder);
|
|
3997
4062
|
this.usePoisonedData = usePoisonedData || !!options._compilePoisonedComponents;
|
|
3998
4063
|
this.enableTemplateTypeChecker = enableTemplateTypeChecker || !!options._enableTemplateTypeChecker;
|
|
3999
|
-
this.enableBlockSyntax =
|
|
4000
|
-
this.enableLetSyntax =
|
|
4064
|
+
this.enableBlockSyntax = this.angularCoreVersion === null || coreVersionSupportsFeature(this.angularCoreVersion, ">= 17.0.0");
|
|
4065
|
+
this.enableLetSyntax = this.angularCoreVersion === null || coreVersionSupportsFeature(this.angularCoreVersion, ">= 18.1.0");
|
|
4001
4066
|
this.enableSelectorless = options["_enableSelectorless"] ?? false;
|
|
4002
4067
|
this.emitDeclarationOnly = !!options.emitDeclarationOnly && !!options._experimentalAllowEmitDeclarationOnly;
|
|
4003
4068
|
this.implicitStandaloneValue = this.angularCoreVersion === null || coreVersionSupportsFeature(this.angularCoreVersion, ">= 19.0.0");
|
|
@@ -4006,7 +4071,7 @@ var NgCompiler = class _NgCompiler {
|
|
|
4006
4071
|
this.currentProgram = inputProgram;
|
|
4007
4072
|
this.closureCompilerEnabled = !!this.options.annotateForClosureCompiler;
|
|
4008
4073
|
this.entryPoint = adapter.entryPoint !== null ? getSourceFileOrNull(inputProgram, adapter.entryPoint) : null;
|
|
4009
|
-
const moduleResolutionCache =
|
|
4074
|
+
const moduleResolutionCache = ts26.createModuleResolutionCache(
|
|
4010
4075
|
this.adapter.getCurrentDirectory(),
|
|
4011
4076
|
// doen't retain a reference to `this`, if other closures in the constructor here reference
|
|
4012
4077
|
// `this` internally then a closure created here would retain them. This can cause major
|
|
@@ -4054,7 +4119,7 @@ var NgCompiler = class _NgCompiler {
|
|
|
4054
4119
|
}
|
|
4055
4120
|
for (const clazz of classesToUpdate) {
|
|
4056
4121
|
this.compilation.traitCompiler.updateResources(clazz);
|
|
4057
|
-
if (!
|
|
4122
|
+
if (!ts26.isClassDeclaration(clazz)) {
|
|
4058
4123
|
continue;
|
|
4059
4124
|
}
|
|
4060
4125
|
this.compilation.templateTypeChecker.invalidateClass(clazz);
|
|
@@ -4264,12 +4329,12 @@ var NgCompiler = class _NgCompiler {
|
|
|
4264
4329
|
if (compilation.supportJitMode && compilation.jitDeclarationRegistry.jitDeclarations.size > 0) {
|
|
4265
4330
|
const { jitDeclarations } = compilation.jitDeclarationRegistry;
|
|
4266
4331
|
const jitDeclarationsArray = Array.from(jitDeclarations);
|
|
4267
|
-
const jitDeclarationOriginalNodes = new Set(jitDeclarationsArray.map((d) =>
|
|
4332
|
+
const jitDeclarationOriginalNodes = new Set(jitDeclarationsArray.map((d) => ts26.getOriginalNode(d)));
|
|
4268
4333
|
const sourceFilesWithJit = new Set(jitDeclarationsArray.map((d) => d.getSourceFile().fileName));
|
|
4269
4334
|
before.push((ctx) => {
|
|
4270
4335
|
const reflectionHost = new TypeScriptReflectionHost(this.inputProgram.getTypeChecker());
|
|
4271
4336
|
const jitTransform = angularJitApplicationTransform(this.inputProgram, compilation.isCore, (node) => {
|
|
4272
|
-
node =
|
|
4337
|
+
node = ts26.getOriginalNode(node, ts26.isClassDeclaration);
|
|
4273
4338
|
return reflectionHost.isClass(node) && jitDeclarationOriginalNodes.has(node);
|
|
4274
4339
|
})(ctx);
|
|
4275
4340
|
return (sourceFile) => {
|
|
@@ -4348,16 +4413,16 @@ var NgCompiler = class _NgCompiler {
|
|
|
4348
4413
|
return null;
|
|
4349
4414
|
}
|
|
4350
4415
|
const sourceFile = node.getSourceFile();
|
|
4351
|
-
const printer =
|
|
4352
|
-
const nodeText = printer.printNode(
|
|
4353
|
-
return
|
|
4416
|
+
const printer = ts26.createPrinter();
|
|
4417
|
+
const nodeText = printer.printNode(ts26.EmitHint.Unspecified, callback, sourceFile);
|
|
4418
|
+
return ts26.transpileModule(nodeText, {
|
|
4354
4419
|
compilerOptions: {
|
|
4355
4420
|
...this.options,
|
|
4356
4421
|
// Some module types can produce additional code (see #60795) whereas we need the
|
|
4357
4422
|
// HMR update module to use a native `export`. Override the `target` and `module`
|
|
4358
4423
|
// to ensure that it looks as expected.
|
|
4359
|
-
module:
|
|
4360
|
-
target:
|
|
4424
|
+
module: ts26.ModuleKind.ES2022,
|
|
4425
|
+
target: ts26.ScriptTarget.ES2022
|
|
4361
4426
|
},
|
|
4362
4427
|
fileName: sourceFile.fileName,
|
|
4363
4428
|
reportDiagnostics: false
|
|
@@ -4733,18 +4798,18 @@ function isAngularCorePackage(program) {
|
|
|
4733
4798
|
return false;
|
|
4734
4799
|
}
|
|
4735
4800
|
return r3Symbols.statements.some((stmt) => {
|
|
4736
|
-
if (!
|
|
4801
|
+
if (!ts26.isVariableStatement(stmt)) {
|
|
4737
4802
|
return false;
|
|
4738
4803
|
}
|
|
4739
|
-
const modifiers =
|
|
4740
|
-
if (modifiers === void 0 || !modifiers.some((mod) => mod.kind ===
|
|
4804
|
+
const modifiers = ts26.getModifiers(stmt);
|
|
4805
|
+
if (modifiers === void 0 || !modifiers.some((mod) => mod.kind === ts26.SyntaxKind.ExportKeyword)) {
|
|
4741
4806
|
return false;
|
|
4742
4807
|
}
|
|
4743
4808
|
return stmt.declarationList.declarations.some((decl) => {
|
|
4744
|
-
if (!
|
|
4809
|
+
if (!ts26.isIdentifier(decl.name) || decl.name.text !== "ITS_JUST_ANGULAR") {
|
|
4745
4810
|
return false;
|
|
4746
4811
|
}
|
|
4747
|
-
if (decl.initializer === void 0 || decl.initializer.kind !==
|
|
4812
|
+
if (decl.initializer === void 0 || decl.initializer.kind !== ts26.SyntaxKind.TrueKeyword) {
|
|
4748
4813
|
return false;
|
|
4749
4814
|
}
|
|
4750
4815
|
return true;
|
|
@@ -4757,7 +4822,7 @@ function getR3SymbolsFile(program) {
|
|
|
4757
4822
|
function* verifyCompatibleTypeCheckOptions(options) {
|
|
4758
4823
|
if (options.fullTemplateTypeCheck === false && options.strictTemplates === true) {
|
|
4759
4824
|
yield makeConfigDiagnostic({
|
|
4760
|
-
category:
|
|
4825
|
+
category: ts26.DiagnosticCategory.Error,
|
|
4761
4826
|
code: ErrorCode.CONFIG_STRICT_TEMPLATES_IMPLIES_FULL_TEMPLATE_TYPECHECK,
|
|
4762
4827
|
messageText: `
|
|
4763
4828
|
Angular compiler option "strictTemplates" is enabled, however "fullTemplateTypeCheck" is disabled.
|
|
@@ -4776,7 +4841,7 @@ https://angular.dev/tools/cli/template-typecheck
|
|
|
4776
4841
|
}
|
|
4777
4842
|
if (options.extendedDiagnostics && options.strictTemplates === false) {
|
|
4778
4843
|
yield makeConfigDiagnostic({
|
|
4779
|
-
category:
|
|
4844
|
+
category: ts26.DiagnosticCategory.Error,
|
|
4780
4845
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_IMPLIES_STRICT_TEMPLATES,
|
|
4781
4846
|
messageText: `
|
|
4782
4847
|
Angular compiler option "extendedDiagnostics" is configured, however "strictTemplates" is disabled.
|
|
@@ -4793,7 +4858,7 @@ One of the following actions is required:
|
|
|
4793
4858
|
const defaultCategory = options.extendedDiagnostics?.defaultCategory;
|
|
4794
4859
|
if (defaultCategory && !allowedCategoryLabels.includes(defaultCategory)) {
|
|
4795
4860
|
yield makeConfigDiagnostic({
|
|
4796
|
-
category:
|
|
4861
|
+
category: ts26.DiagnosticCategory.Error,
|
|
4797
4862
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CATEGORY_LABEL,
|
|
4798
4863
|
messageText: `
|
|
4799
4864
|
Angular compiler option "extendedDiagnostics.defaultCategory" has an unknown diagnostic category: "${defaultCategory}".
|
|
@@ -4806,7 +4871,7 @@ ${allowedCategoryLabels.join("\n")}
|
|
|
4806
4871
|
for (const [checkName, category] of Object.entries(options.extendedDiagnostics?.checks ?? {})) {
|
|
4807
4872
|
if (!SUPPORTED_DIAGNOSTIC_NAMES.has(checkName)) {
|
|
4808
4873
|
yield makeConfigDiagnostic({
|
|
4809
|
-
category:
|
|
4874
|
+
category: ts26.DiagnosticCategory.Error,
|
|
4810
4875
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CHECK,
|
|
4811
4876
|
messageText: `
|
|
4812
4877
|
Angular compiler option "extendedDiagnostics.checks" has an unknown check: "${checkName}".
|
|
@@ -4818,7 +4883,7 @@ ${Array.from(SUPPORTED_DIAGNOSTIC_NAMES).join("\n")}
|
|
|
4818
4883
|
}
|
|
4819
4884
|
if (!allowedCategoryLabels.includes(category)) {
|
|
4820
4885
|
yield makeConfigDiagnostic({
|
|
4821
|
-
category:
|
|
4886
|
+
category: ts26.DiagnosticCategory.Error,
|
|
4822
4887
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CATEGORY_LABEL,
|
|
4823
4888
|
messageText: `
|
|
4824
4889
|
Angular compiler option "extendedDiagnostics.checks['${checkName}']" has an unknown diagnostic category: "${category}".
|
|
@@ -4836,7 +4901,7 @@ function verifyEmitDeclarationOnly(options) {
|
|
|
4836
4901
|
}
|
|
4837
4902
|
return [
|
|
4838
4903
|
makeConfigDiagnostic({
|
|
4839
|
-
category:
|
|
4904
|
+
category: ts26.DiagnosticCategory.Error,
|
|
4840
4905
|
code: ErrorCode.CONFIG_EMIT_DECLARATION_ONLY_UNSUPPORTED,
|
|
4841
4906
|
messageText: 'TS compiler option "emitDeclarationOnly" is not supported.'
|
|
4842
4907
|
})
|
|
@@ -4861,7 +4926,7 @@ var ReferenceGraphAdapter = class {
|
|
|
4861
4926
|
for (const { node } of references) {
|
|
4862
4927
|
let sourceFile = node.getSourceFile();
|
|
4863
4928
|
if (sourceFile === void 0) {
|
|
4864
|
-
sourceFile =
|
|
4929
|
+
sourceFile = ts26.getOriginalNode(node).getSourceFile();
|
|
4865
4930
|
}
|
|
4866
4931
|
if (sourceFile === void 0 || !isDtsPath(sourceFile.fileName)) {
|
|
4867
4932
|
this.graph.add(source, node);
|
|
@@ -4902,7 +4967,7 @@ function versionMapFromProgram(program, driver) {
|
|
|
4902
4967
|
}
|
|
4903
4968
|
|
|
4904
4969
|
// packages/compiler-cli/src/ngtsc/core/src/host.js
|
|
4905
|
-
import
|
|
4970
|
+
import ts27 from "typescript";
|
|
4906
4971
|
var DelegatingCompilerHost = class {
|
|
4907
4972
|
delegate;
|
|
4908
4973
|
createHash;
|
|
@@ -5041,7 +5106,7 @@ var NgCompilerHost = class _NgCompilerHost extends DelegatingCompilerHost {
|
|
|
5041
5106
|
entryPoint = findFlatIndexEntryPoint(normalizedTsInputFiles);
|
|
5042
5107
|
if (entryPoint === null) {
|
|
5043
5108
|
diagnostics.push({
|
|
5044
|
-
category:
|
|
5109
|
+
category: ts27.DiagnosticCategory.Error,
|
|
5045
5110
|
code: ngErrorCode(ErrorCode.CONFIG_FLAT_MODULE_NO_INDEX),
|
|
5046
5111
|
file: void 0,
|
|
5047
5112
|
start: void 0,
|
|
@@ -5095,10 +5160,10 @@ var NgCompilerHost = class _NgCompilerHost extends DelegatingCompilerHost {
|
|
|
5095
5160
|
return this.fileNameToModuleName !== void 0 ? this : null;
|
|
5096
5161
|
}
|
|
5097
5162
|
createCachedResolveModuleNamesFunction() {
|
|
5098
|
-
const moduleResolutionCache =
|
|
5163
|
+
const moduleResolutionCache = ts27.createModuleResolutionCache(this.getCurrentDirectory(), this.getCanonicalFileName.bind(this));
|
|
5099
5164
|
return (moduleNames, containingFile, reusedNames, redirectedReference, options) => {
|
|
5100
5165
|
return moduleNames.map((moduleName) => {
|
|
5101
|
-
const module =
|
|
5166
|
+
const module = ts27.resolveModuleName(moduleName, containingFile, options, this, moduleResolutionCache, redirectedReference);
|
|
5102
5167
|
return module.resolvedModule;
|
|
5103
5168
|
});
|
|
5104
5169
|
};
|
|
@@ -5130,7 +5195,7 @@ var NgtscProgram = class {
|
|
|
5130
5195
|
if (reuseProgram !== void 0) {
|
|
5131
5196
|
retagAllTsFiles(reuseProgram);
|
|
5132
5197
|
}
|
|
5133
|
-
this.tsProgram = perfRecorder.inPhase(PerfPhase.TypeScriptProgramCreate, () =>
|
|
5198
|
+
this.tsProgram = perfRecorder.inPhase(PerfPhase.TypeScriptProgramCreate, () => ts28.createProgram(this.host.inputFiles, options, this.host, reuseProgram));
|
|
5134
5199
|
perfRecorder.phase(PerfPhase.Unaccounted);
|
|
5135
5200
|
perfRecorder.memory(PerfCheckpoint.TypeScriptProgramCreate);
|
|
5136
5201
|
this.host.postProgramCreationCleanup();
|
|
@@ -5359,16 +5424,16 @@ function createProgram({ rootNames, options, host, oldProgram }) {
|
|
|
5359
5424
|
}
|
|
5360
5425
|
|
|
5361
5426
|
// packages/compiler-cli/src/perform_compile.js
|
|
5362
|
-
import
|
|
5427
|
+
import ts30 from "typescript";
|
|
5363
5428
|
|
|
5364
5429
|
// packages/compiler-cli/src/transformers/util.js
|
|
5365
|
-
import
|
|
5430
|
+
import ts29 from "typescript";
|
|
5366
5431
|
function createMessageDiagnostic(messageText) {
|
|
5367
5432
|
return {
|
|
5368
5433
|
file: void 0,
|
|
5369
5434
|
start: void 0,
|
|
5370
5435
|
length: void 0,
|
|
5371
|
-
category:
|
|
5436
|
+
category: ts29.DiagnosticCategory.Message,
|
|
5372
5437
|
messageText,
|
|
5373
5438
|
code: DEFAULT_ERROR_CODE,
|
|
5374
5439
|
source: SOURCE
|
|
@@ -5377,13 +5442,13 @@ function createMessageDiagnostic(messageText) {
|
|
|
5377
5442
|
|
|
5378
5443
|
// packages/compiler-cli/src/perform_compile.js
|
|
5379
5444
|
var defaultFormatHost = {
|
|
5380
|
-
getCurrentDirectory: () =>
|
|
5445
|
+
getCurrentDirectory: () => ts30.sys.getCurrentDirectory(),
|
|
5381
5446
|
getCanonicalFileName: (fileName) => fileName,
|
|
5382
|
-
getNewLine: () =>
|
|
5447
|
+
getNewLine: () => ts30.sys.newLine
|
|
5383
5448
|
};
|
|
5384
5449
|
function formatDiagnostics(diags, host = defaultFormatHost) {
|
|
5385
5450
|
if (diags && diags.length) {
|
|
5386
|
-
return diags.map((diagnostic) => replaceTsWithNgInErrors(
|
|
5451
|
+
return diags.map((diagnostic) => replaceTsWithNgInErrors(ts30.formatDiagnosticsWithColorAndContext([diagnostic], host))).join("");
|
|
5387
5452
|
} else {
|
|
5388
5453
|
return "";
|
|
5389
5454
|
}
|
|
@@ -5399,7 +5464,7 @@ function calcProjectFileAndBasePath(project, host = getFileSystem()) {
|
|
|
5399
5464
|
function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
5400
5465
|
try {
|
|
5401
5466
|
const fs = getFileSystem();
|
|
5402
|
-
const readConfigFile = (configFile) =>
|
|
5467
|
+
const readConfigFile = (configFile) => ts30.readConfigFile(configFile, (file) => host.readFile(host.resolve(file)));
|
|
5403
5468
|
const readAngularCompilerOptions = (configFile, parentOptions = {}) => {
|
|
5404
5469
|
const { config: config2, error: error2 } = readConfigFile(configFile);
|
|
5405
5470
|
if (error2) {
|
|
@@ -5435,7 +5500,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
5435
5500
|
...existingOptions
|
|
5436
5501
|
};
|
|
5437
5502
|
const parseConfigHost = createParseConfigHost(host, fs);
|
|
5438
|
-
const { options, errors, fileNames: rootNames, projectReferences } =
|
|
5503
|
+
const { options, errors, fileNames: rootNames, projectReferences } = ts30.parseJsonConfigFileContent(config, parseConfigHost, basePath, existingCompilerOptions, configFileName);
|
|
5439
5504
|
let emitFlags = EmitFlags.Default;
|
|
5440
5505
|
if (!(options["skipMetadataEmit"] || options["flatModuleOutFile"])) {
|
|
5441
5506
|
emitFlags |= EmitFlags.Metadata;
|
|
@@ -5447,7 +5512,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
5447
5512
|
} catch (e) {
|
|
5448
5513
|
const errors = [
|
|
5449
5514
|
{
|
|
5450
|
-
category:
|
|
5515
|
+
category: ts30.DiagnosticCategory.Error,
|
|
5451
5516
|
messageText: e.stack ?? e.message,
|
|
5452
5517
|
file: void 0,
|
|
5453
5518
|
start: void 0,
|
|
@@ -5482,7 +5547,7 @@ function getExtendedConfigPathWorker(configFile, extendsValue, host, fs) {
|
|
|
5482
5547
|
}
|
|
5483
5548
|
} else {
|
|
5484
5549
|
const parseConfigHost = createParseConfigHost(host, fs);
|
|
5485
|
-
const { resolvedModule } =
|
|
5550
|
+
const { resolvedModule } = ts30.nodeModuleNameResolver(extendsValue, configFile, { moduleResolution: ts30.ModuleResolutionKind.Node10, resolveJsonModule: true }, parseConfigHost);
|
|
5486
5551
|
if (resolvedModule) {
|
|
5487
5552
|
return absoluteFrom(resolvedModule.resolvedFileName);
|
|
5488
5553
|
}
|
|
@@ -5492,7 +5557,7 @@ function getExtendedConfigPathWorker(configFile, extendsValue, host, fs) {
|
|
|
5492
5557
|
function exitCodeFromResult(diags) {
|
|
5493
5558
|
if (!diags)
|
|
5494
5559
|
return 0;
|
|
5495
|
-
if (diags.every((diag) => diag.category !==
|
|
5560
|
+
if (diags.every((diag) => diag.category !== ts30.DiagnosticCategory.Error)) {
|
|
5496
5561
|
return 0;
|
|
5497
5562
|
}
|
|
5498
5563
|
return diags.some((d) => d.source === "angular" && d.code === UNKNOWN_ERROR_CODE) ? 2 : 1;
|
|
@@ -5530,7 +5595,7 @@ function performCompilation({ rootNames, options, host, oldProgram, emitCallback
|
|
|
5530
5595
|
} catch (e) {
|
|
5531
5596
|
program = void 0;
|
|
5532
5597
|
allDiagnostics.push({
|
|
5533
|
-
category:
|
|
5598
|
+
category: ts30.DiagnosticCategory.Error,
|
|
5534
5599
|
messageText: e.stack ?? e.message,
|
|
5535
5600
|
code: UNKNOWN_ERROR_CODE,
|
|
5536
5601
|
file: void 0,
|
|
@@ -5560,7 +5625,7 @@ function defaultGatherDiagnostics(program) {
|
|
|
5560
5625
|
return allDiagnostics;
|
|
5561
5626
|
}
|
|
5562
5627
|
function hasErrors(diags) {
|
|
5563
|
-
return diags.some((d) => d.category ===
|
|
5628
|
+
return diags.some((d) => d.category === ts30.DiagnosticCategory.Error);
|
|
5564
5629
|
}
|
|
5565
5630
|
|
|
5566
5631
|
export {
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
tryParseSignalInputMapping,
|
|
17
17
|
tryParseSignalModelMapping,
|
|
18
18
|
tryParseSignalQueryFromInitializer
|
|
19
|
-
} from "./chunk-
|
|
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
|
-
|
|
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-
|
|
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-
|
|
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-
|
|
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.
|
|
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-
|
|
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-
|
|
8
|
-
import "../chunk-
|
|
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-
|
|
9
|
+
} from "../../chunk-COFK26OM.js";
|
|
10
10
|
import {
|
|
11
11
|
EmitFlags
|
|
12
|
-
} from "../../chunk-
|
|
13
|
-
import "../../chunk-
|
|
14
|
-
import "../../chunk-
|
|
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
|
package/bundles/src/bin/ngc.js
CHANGED
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
|
|
6
6
|
import {
|
|
7
7
|
main
|
|
8
|
-
} from "../../chunk-
|
|
9
|
-
import "../../chunk-
|
|
10
|
-
import "../../chunk-
|
|
11
|
-
import "../../chunk-
|
|
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.
|
|
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.
|
|
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": {
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"yargs": "^18.0.0"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"@angular/compiler": "21.0.0-next.
|
|
51
|
+
"@angular/compiler": "21.0.0-next.4",
|
|
52
52
|
"typescript": ">=5.9 <6.0"
|
|
53
53
|
},
|
|
54
54
|
"peerDependenciesMeta": {
|
|
@@ -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
|
|
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
|
+
}
|