@angular/compiler-cli 20.3.0-rc.0 → 20.3.1
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-ES5JHT4S.js → chunk-EWP5PK2E.js} +109 -44
- package/bundles/{chunk-PVSLT73R.js → chunk-HQSSDNAP.js} +13 -3
- package/bundles/{chunk-6DF2AWLX.js → chunk-LBDATQBA.js} +1 -1
- package/bundles/{chunk-OLESUCWZ.js → chunk-WIZYXMS6.js} +1 -1
- 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 = "20.3.
|
|
458
|
+
var PLACEHOLDER_VERSION = "20.3.1";
|
|
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-LBDATQBA.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-HQSSDNAP.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.
|
|
@@ -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}".
|
|
@@ -4849,7 +4914,7 @@ var ReferenceGraphAdapter = class {
|
|
|
4849
4914
|
for (const { node } of references) {
|
|
4850
4915
|
let sourceFile = node.getSourceFile();
|
|
4851
4916
|
if (sourceFile === void 0) {
|
|
4852
|
-
sourceFile =
|
|
4917
|
+
sourceFile = ts26.getOriginalNode(node).getSourceFile();
|
|
4853
4918
|
}
|
|
4854
4919
|
if (sourceFile === void 0 || !isDtsPath(sourceFile.fileName)) {
|
|
4855
4920
|
this.graph.add(source, node);
|
|
@@ -4890,7 +4955,7 @@ function versionMapFromProgram(program, driver) {
|
|
|
4890
4955
|
}
|
|
4891
4956
|
|
|
4892
4957
|
// packages/compiler-cli/src/ngtsc/core/src/host.js
|
|
4893
|
-
import
|
|
4958
|
+
import ts27 from "typescript";
|
|
4894
4959
|
var DelegatingCompilerHost = class {
|
|
4895
4960
|
delegate;
|
|
4896
4961
|
createHash;
|
|
@@ -5029,7 +5094,7 @@ var NgCompilerHost = class _NgCompilerHost extends DelegatingCompilerHost {
|
|
|
5029
5094
|
entryPoint = findFlatIndexEntryPoint(normalizedTsInputFiles);
|
|
5030
5095
|
if (entryPoint === null) {
|
|
5031
5096
|
diagnostics.push({
|
|
5032
|
-
category:
|
|
5097
|
+
category: ts27.DiagnosticCategory.Error,
|
|
5033
5098
|
code: ngErrorCode(ErrorCode.CONFIG_FLAT_MODULE_NO_INDEX),
|
|
5034
5099
|
file: void 0,
|
|
5035
5100
|
start: void 0,
|
|
@@ -5083,10 +5148,10 @@ var NgCompilerHost = class _NgCompilerHost extends DelegatingCompilerHost {
|
|
|
5083
5148
|
return this.fileNameToModuleName !== void 0 ? this : null;
|
|
5084
5149
|
}
|
|
5085
5150
|
createCachedResolveModuleNamesFunction() {
|
|
5086
|
-
const moduleResolutionCache =
|
|
5151
|
+
const moduleResolutionCache = ts27.createModuleResolutionCache(this.getCurrentDirectory(), this.getCanonicalFileName.bind(this));
|
|
5087
5152
|
return (moduleNames, containingFile, reusedNames, redirectedReference, options) => {
|
|
5088
5153
|
return moduleNames.map((moduleName) => {
|
|
5089
|
-
const module =
|
|
5154
|
+
const module = ts27.resolveModuleName(moduleName, containingFile, options, this, moduleResolutionCache, redirectedReference);
|
|
5090
5155
|
return module.resolvedModule;
|
|
5091
5156
|
});
|
|
5092
5157
|
};
|
|
@@ -5118,7 +5183,7 @@ var NgtscProgram = class {
|
|
|
5118
5183
|
if (reuseProgram !== void 0) {
|
|
5119
5184
|
retagAllTsFiles(reuseProgram);
|
|
5120
5185
|
}
|
|
5121
|
-
this.tsProgram = perfRecorder.inPhase(PerfPhase.TypeScriptProgramCreate, () =>
|
|
5186
|
+
this.tsProgram = perfRecorder.inPhase(PerfPhase.TypeScriptProgramCreate, () => ts28.createProgram(this.host.inputFiles, options, this.host, reuseProgram));
|
|
5122
5187
|
perfRecorder.phase(PerfPhase.Unaccounted);
|
|
5123
5188
|
perfRecorder.memory(PerfCheckpoint.TypeScriptProgramCreate);
|
|
5124
5189
|
this.host.postProgramCreationCleanup();
|
|
@@ -5347,16 +5412,16 @@ function createProgram({ rootNames, options, host, oldProgram }) {
|
|
|
5347
5412
|
}
|
|
5348
5413
|
|
|
5349
5414
|
// packages/compiler-cli/src/perform_compile.js
|
|
5350
|
-
import
|
|
5415
|
+
import ts30 from "typescript";
|
|
5351
5416
|
|
|
5352
5417
|
// packages/compiler-cli/src/transformers/util.js
|
|
5353
|
-
import
|
|
5418
|
+
import ts29 from "typescript";
|
|
5354
5419
|
function createMessageDiagnostic(messageText) {
|
|
5355
5420
|
return {
|
|
5356
5421
|
file: void 0,
|
|
5357
5422
|
start: void 0,
|
|
5358
5423
|
length: void 0,
|
|
5359
|
-
category:
|
|
5424
|
+
category: ts29.DiagnosticCategory.Message,
|
|
5360
5425
|
messageText,
|
|
5361
5426
|
code: DEFAULT_ERROR_CODE,
|
|
5362
5427
|
source: SOURCE
|
|
@@ -5365,13 +5430,13 @@ function createMessageDiagnostic(messageText) {
|
|
|
5365
5430
|
|
|
5366
5431
|
// packages/compiler-cli/src/perform_compile.js
|
|
5367
5432
|
var defaultFormatHost = {
|
|
5368
|
-
getCurrentDirectory: () =>
|
|
5433
|
+
getCurrentDirectory: () => ts30.sys.getCurrentDirectory(),
|
|
5369
5434
|
getCanonicalFileName: (fileName) => fileName,
|
|
5370
|
-
getNewLine: () =>
|
|
5435
|
+
getNewLine: () => ts30.sys.newLine
|
|
5371
5436
|
};
|
|
5372
5437
|
function formatDiagnostics(diags, host = defaultFormatHost) {
|
|
5373
5438
|
if (diags && diags.length) {
|
|
5374
|
-
return diags.map((diagnostic) => replaceTsWithNgInErrors(
|
|
5439
|
+
return diags.map((diagnostic) => replaceTsWithNgInErrors(ts30.formatDiagnosticsWithColorAndContext([diagnostic], host))).join("");
|
|
5375
5440
|
} else {
|
|
5376
5441
|
return "";
|
|
5377
5442
|
}
|
|
@@ -5387,7 +5452,7 @@ function calcProjectFileAndBasePath(project, host = getFileSystem()) {
|
|
|
5387
5452
|
function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
5388
5453
|
try {
|
|
5389
5454
|
const fs = getFileSystem();
|
|
5390
|
-
const readConfigFile = (configFile) =>
|
|
5455
|
+
const readConfigFile = (configFile) => ts30.readConfigFile(configFile, (file) => host.readFile(host.resolve(file)));
|
|
5391
5456
|
const readAngularCompilerOptions = (configFile, parentOptions = {}) => {
|
|
5392
5457
|
const { config: config2, error: error2 } = readConfigFile(configFile);
|
|
5393
5458
|
if (error2) {
|
|
@@ -5423,7 +5488,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
5423
5488
|
...existingOptions
|
|
5424
5489
|
};
|
|
5425
5490
|
const parseConfigHost = createParseConfigHost(host, fs);
|
|
5426
|
-
const { options, errors, fileNames: rootNames, projectReferences } =
|
|
5491
|
+
const { options, errors, fileNames: rootNames, projectReferences } = ts30.parseJsonConfigFileContent(config, parseConfigHost, basePath, existingCompilerOptions, configFileName);
|
|
5427
5492
|
let emitFlags = EmitFlags.Default;
|
|
5428
5493
|
if (!(options["skipMetadataEmit"] || options["flatModuleOutFile"])) {
|
|
5429
5494
|
emitFlags |= EmitFlags.Metadata;
|
|
@@ -5435,7 +5500,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
5435
5500
|
} catch (e) {
|
|
5436
5501
|
const errors = [
|
|
5437
5502
|
{
|
|
5438
|
-
category:
|
|
5503
|
+
category: ts30.DiagnosticCategory.Error,
|
|
5439
5504
|
messageText: e.stack ?? e.message,
|
|
5440
5505
|
file: void 0,
|
|
5441
5506
|
start: void 0,
|
|
@@ -5470,7 +5535,7 @@ function getExtendedConfigPathWorker(configFile, extendsValue, host, fs) {
|
|
|
5470
5535
|
}
|
|
5471
5536
|
} else {
|
|
5472
5537
|
const parseConfigHost = createParseConfigHost(host, fs);
|
|
5473
|
-
const { resolvedModule } =
|
|
5538
|
+
const { resolvedModule } = ts30.nodeModuleNameResolver(extendsValue, configFile, { moduleResolution: ts30.ModuleResolutionKind.Node10, resolveJsonModule: true }, parseConfigHost);
|
|
5474
5539
|
if (resolvedModule) {
|
|
5475
5540
|
return absoluteFrom(resolvedModule.resolvedFileName);
|
|
5476
5541
|
}
|
|
@@ -5480,7 +5545,7 @@ function getExtendedConfigPathWorker(configFile, extendsValue, host, fs) {
|
|
|
5480
5545
|
function exitCodeFromResult(diags) {
|
|
5481
5546
|
if (!diags)
|
|
5482
5547
|
return 0;
|
|
5483
|
-
if (diags.every((diag) => diag.category !==
|
|
5548
|
+
if (diags.every((diag) => diag.category !== ts30.DiagnosticCategory.Error)) {
|
|
5484
5549
|
return 0;
|
|
5485
5550
|
}
|
|
5486
5551
|
return diags.some((d) => d.source === "angular" && d.code === UNKNOWN_ERROR_CODE) ? 2 : 1;
|
|
@@ -5518,7 +5583,7 @@ function performCompilation({ rootNames, options, host, oldProgram, emitCallback
|
|
|
5518
5583
|
} catch (e) {
|
|
5519
5584
|
program = void 0;
|
|
5520
5585
|
allDiagnostics.push({
|
|
5521
|
-
category:
|
|
5586
|
+
category: ts30.DiagnosticCategory.Error,
|
|
5522
5587
|
messageText: e.stack ?? e.message,
|
|
5523
5588
|
code: UNKNOWN_ERROR_CODE,
|
|
5524
5589
|
file: void 0,
|
|
@@ -5548,7 +5613,7 @@ function defaultGatherDiagnostics(program) {
|
|
|
5548
5613
|
return allDiagnostics;
|
|
5549
5614
|
}
|
|
5550
5615
|
function hasErrors(diags) {
|
|
5551
|
-
return diags.some((d) => d.category ===
|
|
5616
|
+
return diags.some((d) => d.category === ts30.DiagnosticCategory.Error);
|
|
5552
5617
|
}
|
|
5553
5618
|
|
|
5554
5619
|
export {
|
|
@@ -118,6 +118,7 @@ var ErrorCode;
|
|
|
118
118
|
ErrorCode2[ErrorCode2["UNINVOKED_TRACK_FUNCTION"] = 8115] = "UNINVOKED_TRACK_FUNCTION";
|
|
119
119
|
ErrorCode2[ErrorCode2["MISSING_STRUCTURAL_DIRECTIVE"] = 8116] = "MISSING_STRUCTURAL_DIRECTIVE";
|
|
120
120
|
ErrorCode2[ErrorCode2["UNINVOKED_FUNCTION_IN_TEXT_INTERPOLATION"] = 8117] = "UNINVOKED_FUNCTION_IN_TEXT_INTERPOLATION";
|
|
121
|
+
ErrorCode2[ErrorCode2["FORBIDDEN_REQUIRED_INITIALIZER_INVOCATION"] = 8118] = "FORBIDDEN_REQUIRED_INITIALIZER_INVOCATION";
|
|
121
122
|
ErrorCode2[ErrorCode2["INLINE_TCB_REQUIRED"] = 8900] = "INLINE_TCB_REQUIRED";
|
|
122
123
|
ErrorCode2[ErrorCode2["INLINE_TYPE_CTOR_REQUIRED"] = 8901] = "INLINE_TYPE_CTOR_REQUIRED";
|
|
123
124
|
ErrorCode2[ErrorCode2["INJECTABLE_DUPLICATE_PROV"] = 9001] = "INJECTABLE_DUPLICATE_PROV";
|
|
@@ -221,7 +222,11 @@ var COMPILER_ERRORS_WITH_GUIDES = /* @__PURE__ */ new Set([
|
|
|
221
222
|
]);
|
|
222
223
|
|
|
223
224
|
// packages/compiler-cli/src/ngtsc/diagnostics/src/error_details_base_url.js
|
|
224
|
-
|
|
225
|
+
import { VERSION } from "@angular/compiler";
|
|
226
|
+
var ERROR_DETAILS_PAGE_BASE_URL = (() => {
|
|
227
|
+
const versionSubDomain = VERSION.major !== "0" ? `v${VERSION.major}.` : "";
|
|
228
|
+
return `https://${versionSubDomain}angular.dev/errors`;
|
|
229
|
+
})();
|
|
225
230
|
|
|
226
231
|
// packages/compiler-cli/src/ngtsc/diagnostics/src/extended_template_diagnostic_name.js
|
|
227
232
|
var ExtendedTemplateDiagnosticName;
|
|
@@ -15571,10 +15576,15 @@ function getBoundAttributes(directive, node) {
|
|
|
15571
15576
|
});
|
|
15572
15577
|
}
|
|
15573
15578
|
};
|
|
15574
|
-
node.inputs.forEach(processAttribute);
|
|
15575
|
-
node.attributes.forEach(processAttribute);
|
|
15576
15579
|
if (node instanceof TmplAstTemplate) {
|
|
15580
|
+
if (node.tagName === "ng-template") {
|
|
15581
|
+
node.inputs.forEach(processAttribute);
|
|
15582
|
+
node.attributes.forEach(processAttribute);
|
|
15583
|
+
}
|
|
15577
15584
|
node.templateAttrs.forEach(processAttribute);
|
|
15585
|
+
} else {
|
|
15586
|
+
node.inputs.forEach(processAttribute);
|
|
15587
|
+
node.attributes.forEach(processAttribute);
|
|
15578
15588
|
}
|
|
15579
15589
|
return boundInputs;
|
|
15580
15590
|
}
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
tryParseSignalInputMapping,
|
|
17
17
|
tryParseSignalModelMapping,
|
|
18
18
|
tryParseSignalQueryFromInitializer
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-HQSSDNAP.js";
|
|
20
20
|
|
|
21
21
|
// packages/compiler-cli/src/ngtsc/transform/jit/src/downlevel_decorators_transform.js
|
|
22
22
|
import ts from "typescript";
|
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-EWP5PK2E.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-LBDATQBA.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-HQSSDNAP.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("20.3.
|
|
80
|
+
var VERSION = new Version("20.3.1");
|
|
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-HQSSDNAP.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-LBDATQBA.js";
|
|
8
|
+
import "../chunk-HQSSDNAP.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-WIZYXMS6.js";
|
|
10
10
|
import {
|
|
11
11
|
EmitFlags
|
|
12
|
-
} from "../../chunk-
|
|
13
|
-
import "../../chunk-
|
|
14
|
-
import "../../chunk-
|
|
12
|
+
} from "../../chunk-EWP5PK2E.js";
|
|
13
|
+
import "../../chunk-LBDATQBA.js";
|
|
14
|
+
import "../../chunk-HQSSDNAP.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-WIZYXMS6.js";
|
|
9
|
+
import "../../chunk-EWP5PK2E.js";
|
|
10
|
+
import "../../chunk-LBDATQBA.js";
|
|
11
|
+
import "../../chunk-HQSSDNAP.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 = "20.3.
|
|
10
|
+
export declare const PLACEHOLDER_VERSION = "20.3.1";
|
|
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": "20.3.
|
|
3
|
+
"version": "20.3.1",
|
|
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": "20.3.
|
|
51
|
+
"@angular/compiler": "20.3.1",
|
|
52
52
|
"typescript": ">=5.8 <6.0"
|
|
53
53
|
},
|
|
54
54
|
"peerDependenciesMeta": {
|
|
@@ -525,6 +525,21 @@ export declare enum ErrorCode {
|
|
|
525
525
|
* ```
|
|
526
526
|
*/
|
|
527
527
|
UNINVOKED_FUNCTION_IN_TEXT_INTERPOLATION = 8117,
|
|
528
|
+
/**
|
|
529
|
+
* A required initializer is being invoked in a forbidden context such as a property initializer
|
|
530
|
+
* or a constructor.
|
|
531
|
+
*
|
|
532
|
+
* For example:
|
|
533
|
+
* ```ts
|
|
534
|
+
* class MyComponent {
|
|
535
|
+
* myInput = input.required();
|
|
536
|
+
* somValue = this.myInput(); // Error
|
|
537
|
+
*
|
|
538
|
+
* constructor() {
|
|
539
|
+
* this.myInput(); // Error
|
|
540
|
+
* }
|
|
541
|
+
*/
|
|
542
|
+
FORBIDDEN_REQUIRED_INITIALIZER_INVOCATION = 8118,
|
|
528
543
|
/**
|
|
529
544
|
* The template type-checking engine would need to generate an inline type check block for a
|
|
530
545
|
* 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
|
+
}
|