@typescript-deploys/pr-build 4.9.0-pr-50776-2 → 4.9.0-pr-50976-13
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/lib/cs/diagnosticMessages.generated.json +4 -2
- package/lib/de/diagnosticMessages.generated.json +3 -0
- package/lib/es/diagnosticMessages.generated.json +3 -0
- package/lib/fr/diagnosticMessages.generated.json +4 -2
- package/lib/it/diagnosticMessages.generated.json +4 -2
- package/lib/ja/diagnosticMessages.generated.json +3 -0
- package/lib/ko/diagnosticMessages.generated.json +3 -0
- package/lib/lib.es2015.symbol.wellknown.d.ts +3 -3
- package/lib/lib.es5.d.ts +2 -2
- package/lib/pl/diagnosticMessages.generated.json +4 -2
- package/lib/pt-br/diagnosticMessages.generated.json +3 -0
- package/lib/ru/diagnosticMessages.generated.json +3 -0
- package/lib/tr/diagnosticMessages.generated.json +3 -0
- package/lib/tsc.js +72 -32
- package/lib/tsserver.js +114 -54
- package/lib/tsserverlibrary.d.ts +3 -2
- package/lib/tsserverlibrary.js +114 -54
- package/lib/typescript.d.ts +3 -2
- package/lib/typescript.js +98 -38
- package/lib/typescriptServices.d.ts +3 -2
- package/lib/typescriptServices.js +98 -38
- package/lib/typingsInstaller.js +94 -34
- package/lib/zh-cn/diagnosticMessages.generated.json +4 -2
- package/lib/zh-tw/diagnosticMessages.generated.json +3 -0
- package/package.json +8 -10
package/lib/tsserverlibrary.js
CHANGED
|
@@ -108,7 +108,7 @@ var ts;
|
|
|
108
108
|
// The following is baselined as a literal template type without intervention
|
|
109
109
|
/** The version of the TypeScript compiler release */
|
|
110
110
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
111
|
-
ts.version = "".concat(ts.versionMajorMinor, ".0-insiders.
|
|
111
|
+
ts.version = "".concat(ts.versionMajorMinor, ".0-insiders.20220929");
|
|
112
112
|
/* @internal */
|
|
113
113
|
var Comparison;
|
|
114
114
|
(function (Comparison) {
|
|
@@ -3214,11 +3214,13 @@ var ts;
|
|
|
3214
3214
|
// > alphanumerics and hyphen [0-9A-Za-z-]. Identifiers MUST NOT be empty. Numeric identifiers
|
|
3215
3215
|
// > MUST NOT include leading zeroes.
|
|
3216
3216
|
var prereleaseRegExp = /^(?:0|[1-9]\d*|[a-z-][a-z0-9-]*)(?:\.(?:0|[1-9]\d*|[a-z-][a-z0-9-]*))*$/i;
|
|
3217
|
+
var prereleasePartRegExp = /^(?:0|[1-9]\d*|[a-z-][a-z0-9-]*)$/i;
|
|
3217
3218
|
// https://semver.org/#spec-item-10
|
|
3218
3219
|
// > Build metadata MAY be denoted by appending a plus sign and a series of dot separated
|
|
3219
3220
|
// > identifiers immediately following the patch or pre-release version. Identifiers MUST
|
|
3220
3221
|
// > comprise only ASCII alphanumerics and hyphen [0-9A-Za-z-]. Identifiers MUST NOT be empty.
|
|
3221
3222
|
var buildRegExp = /^[a-z0-9-]+(?:\.[a-z0-9-]+)*$/i;
|
|
3223
|
+
var buildPartRegExp = /^[a-z0-9-]+$/i;
|
|
3222
3224
|
// https://semver.org/#spec-item-9
|
|
3223
3225
|
// > Numeric identifiers MUST NOT include leading zeroes.
|
|
3224
3226
|
var numericIdentifierRegExp = /^(0|[1-9]\d*)$/;
|
|
@@ -3238,13 +3240,15 @@ var ts;
|
|
|
3238
3240
|
ts.Debug.assert(major >= 0, "Invalid argument: major");
|
|
3239
3241
|
ts.Debug.assert(minor >= 0, "Invalid argument: minor");
|
|
3240
3242
|
ts.Debug.assert(patch >= 0, "Invalid argument: patch");
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
+
var prereleaseArray = prerelease ? ts.isArray(prerelease) ? prerelease : prerelease.split(".") : ts.emptyArray;
|
|
3244
|
+
var buildArray = build ? ts.isArray(build) ? build : build.split(".") : ts.emptyArray;
|
|
3245
|
+
ts.Debug.assert(ts.every(prereleaseArray, function (s) { return prereleasePartRegExp.test(s); }), "Invalid argument: prerelease");
|
|
3246
|
+
ts.Debug.assert(ts.every(buildArray, function (s) { return buildPartRegExp.test(s); }), "Invalid argument: build");
|
|
3243
3247
|
this.major = major;
|
|
3244
3248
|
this.minor = minor;
|
|
3245
3249
|
this.patch = patch;
|
|
3246
|
-
this.prerelease =
|
|
3247
|
-
this.build =
|
|
3250
|
+
this.prerelease = prereleaseArray;
|
|
3251
|
+
this.build = buildArray;
|
|
3248
3252
|
}
|
|
3249
3253
|
Version.tryParse = function (text) {
|
|
3250
3254
|
var result = tryParseComponents(text);
|
|
@@ -3283,6 +3287,10 @@ var ts;
|
|
|
3283
3287
|
default: return ts.Debug.assertNever(field);
|
|
3284
3288
|
}
|
|
3285
3289
|
};
|
|
3290
|
+
Version.prototype.with = function (fields) {
|
|
3291
|
+
var _a = fields.major, major = _a === void 0 ? this.major : _a, _b = fields.minor, minor = _b === void 0 ? this.minor : _b, _c = fields.patch, patch = _c === void 0 ? this.patch : _c, _d = fields.prerelease, prerelease = _d === void 0 ? this.prerelease : _d, _e = fields.build, build = _e === void 0 ? this.build : _e;
|
|
3292
|
+
return new Version(major, minor, patch, prerelease, build);
|
|
3293
|
+
};
|
|
3286
3294
|
Version.prototype.toString = function () {
|
|
3287
3295
|
var result = "".concat(this.major, ".").concat(this.minor, ".").concat(this.patch);
|
|
3288
3296
|
if (ts.some(this.prerelease))
|
|
@@ -3291,7 +3299,7 @@ var ts;
|
|
|
3291
3299
|
result += "+".concat(this.build.join("."));
|
|
3292
3300
|
return result;
|
|
3293
3301
|
};
|
|
3294
|
-
Version.zero = new Version(0, 0, 0);
|
|
3302
|
+
Version.zero = new Version(0, 0, 0, ["0"]);
|
|
3295
3303
|
return Version;
|
|
3296
3304
|
}());
|
|
3297
3305
|
ts.Version = Version;
|
|
@@ -3374,6 +3382,10 @@ var ts;
|
|
|
3374
3382
|
}
|
|
3375
3383
|
return undefined;
|
|
3376
3384
|
};
|
|
3385
|
+
/**
|
|
3386
|
+
* Tests whether a version matches the range. This is equivalent to `satisfies(version, range, { includePrerelease: true })`.
|
|
3387
|
+
* in `node-semver`.
|
|
3388
|
+
*/
|
|
3377
3389
|
VersionRange.prototype.test = function (version) {
|
|
3378
3390
|
if (typeof version === "string")
|
|
3379
3391
|
version = new Version(version);
|
|
@@ -3484,19 +3496,20 @@ var ts;
|
|
|
3484
3496
|
break;
|
|
3485
3497
|
case "<":
|
|
3486
3498
|
case ">=":
|
|
3487
|
-
comparators.push(createComparator(operator, version))
|
|
3499
|
+
comparators.push(isWildcard(minor) || isWildcard(patch) ? createComparator(operator, version.with({ prerelease: "0" })) :
|
|
3500
|
+
createComparator(operator, version));
|
|
3488
3501
|
break;
|
|
3489
3502
|
case "<=":
|
|
3490
3503
|
case ">":
|
|
3491
|
-
comparators.push(isWildcard(minor) ? createComparator(operator === "<=" ? "<" : ">=", version.increment("major")) :
|
|
3492
|
-
isWildcard(patch) ? createComparator(operator === "<=" ? "<" : ">=", version.increment("minor")) :
|
|
3504
|
+
comparators.push(isWildcard(minor) ? createComparator(operator === "<=" ? "<" : ">=", version.increment("major").with({ prerelease: "0" })) :
|
|
3505
|
+
isWildcard(patch) ? createComparator(operator === "<=" ? "<" : ">=", version.increment("minor").with({ prerelease: "0" })) :
|
|
3493
3506
|
createComparator(operator, version));
|
|
3494
3507
|
break;
|
|
3495
3508
|
case "=":
|
|
3496
3509
|
case undefined:
|
|
3497
3510
|
if (isWildcard(minor) || isWildcard(patch)) {
|
|
3498
|
-
comparators.push(createComparator(">=", version));
|
|
3499
|
-
comparators.push(createComparator("<", version.increment(isWildcard(minor) ? "major" : "minor")));
|
|
3511
|
+
comparators.push(createComparator(">=", version.with({ prerelease: "0" })));
|
|
3512
|
+
comparators.push(createComparator("<", version.increment(isWildcard(minor) ? "major" : "minor").with({ prerelease: "0" })));
|
|
3500
3513
|
}
|
|
3501
3514
|
else {
|
|
3502
3515
|
comparators.push(createComparator("=", version));
|
|
@@ -57606,16 +57619,32 @@ var ts;
|
|
|
57606
57619
|
return getTypeFromTypeNode(typeNode);
|
|
57607
57620
|
}
|
|
57608
57621
|
}
|
|
57622
|
+
function isParameterOfContextSensitiveSignature(symbol) {
|
|
57623
|
+
var decl = symbol.valueDeclaration;
|
|
57624
|
+
if (!decl) {
|
|
57625
|
+
return false;
|
|
57626
|
+
}
|
|
57627
|
+
if (ts.isBindingElement(decl)) {
|
|
57628
|
+
decl = ts.walkUpBindingElementsAndPatterns(decl);
|
|
57629
|
+
}
|
|
57630
|
+
if (ts.isParameter(decl)) {
|
|
57631
|
+
return isContextSensitiveFunctionOrObjectLiteralMethod(decl.parent);
|
|
57632
|
+
}
|
|
57633
|
+
return false;
|
|
57634
|
+
}
|
|
57609
57635
|
function getTypeOfVariableOrParameterOrProperty(symbol) {
|
|
57610
57636
|
var links = getSymbolLinks(symbol);
|
|
57611
57637
|
if (!links.type) {
|
|
57612
57638
|
var type = getTypeOfVariableOrParameterOrPropertyWorker(symbol);
|
|
57613
57639
|
// For a contextually typed parameter it is possible that a type has already
|
|
57614
57640
|
// been assigned (in assignTypeToParameterAndFixTypeParameters), and we want
|
|
57615
|
-
// to preserve this type.
|
|
57616
|
-
|
|
57641
|
+
// to preserve this type. In fact, we need to _prefer_ that type, but it won't
|
|
57642
|
+
// be assigned until contextual typing is complete, so we need to defer in
|
|
57643
|
+
// cases where contextual typing may take place.
|
|
57644
|
+
if (!links.type && !isParameterOfContextSensitiveSignature(symbol)) {
|
|
57617
57645
|
links.type = type;
|
|
57618
57646
|
}
|
|
57647
|
+
return type;
|
|
57619
57648
|
}
|
|
57620
57649
|
return links.type;
|
|
57621
57650
|
}
|
|
@@ -63342,7 +63371,18 @@ var ts;
|
|
|
63342
63371
|
return accessFlags & 1 /* AccessFlags.IncludeUndefined */ ? getUnionType([indexInfo.type, undefinedType]) : indexInfo.type;
|
|
63343
63372
|
}
|
|
63344
63373
|
errorIfWritingToReadonlyIndex(indexInfo);
|
|
63345
|
-
|
|
63374
|
+
// When accessing an enum object with its own type,
|
|
63375
|
+
// e.g. E[E.A] for enum E { A }, undefined shouldn't
|
|
63376
|
+
// be included in the result type
|
|
63377
|
+
if ((accessFlags & 1 /* AccessFlags.IncludeUndefined */) &&
|
|
63378
|
+
!(objectType.symbol &&
|
|
63379
|
+
objectType.symbol.flags & (256 /* SymbolFlags.RegularEnum */ | 128 /* SymbolFlags.ConstEnum */) &&
|
|
63380
|
+
(indexType.symbol &&
|
|
63381
|
+
indexType.flags & 1024 /* TypeFlags.EnumLiteral */ &&
|
|
63382
|
+
getParentOfSymbol(indexType.symbol) === objectType.symbol))) {
|
|
63383
|
+
return getUnionType([indexInfo.type, undefinedType]);
|
|
63384
|
+
}
|
|
63385
|
+
return indexInfo.type;
|
|
63346
63386
|
}
|
|
63347
63387
|
if (indexType.flags & 131072 /* TypeFlags.Never */) {
|
|
63348
63388
|
return neverType;
|
|
@@ -66999,7 +67039,7 @@ var ts;
|
|
|
66999
67039
|
// with another type parameter unless one extends the other. (Remember: comparability is mostly bidirectional!)
|
|
67000
67040
|
var constraint = getConstraintOfTypeParameter(source);
|
|
67001
67041
|
if (constraint && hasNonCircularBaseConstraint(source)) {
|
|
67002
|
-
while (constraint && constraint.flags & 262144 /* TypeFlags.TypeParameter */) {
|
|
67042
|
+
while (constraint && someType(constraint, function (c) { return !!(c.flags & 262144 /* TypeFlags.TypeParameter */); })) {
|
|
67003
67043
|
if (result = isRelatedTo(constraint, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false)) {
|
|
67004
67044
|
return result;
|
|
67005
67045
|
}
|
|
@@ -70761,7 +70801,7 @@ var ts;
|
|
|
70761
70801
|
}
|
|
70762
70802
|
if (ts.isEntityNameExpression(node.argumentExpression)) {
|
|
70763
70803
|
var symbol = resolveEntityName(node.argumentExpression, 111551 /* SymbolFlags.Value */, /*ignoreErrors*/ true);
|
|
70764
|
-
if (!symbol || !isConstVariable(symbol))
|
|
70804
|
+
if (!symbol || !(isConstVariable(symbol) || (symbol.flags & 8 /* SymbolFlags.EnumMember */)))
|
|
70765
70805
|
return undefined;
|
|
70766
70806
|
var declaration = symbol.valueDeclaration;
|
|
70767
70807
|
if (declaration === undefined)
|
|
@@ -70775,7 +70815,12 @@ var ts;
|
|
|
70775
70815
|
}
|
|
70776
70816
|
if (ts.hasOnlyExpressionInitializer(declaration) && isBlockScopedNameDeclaredBeforeUse(declaration, node.argumentExpression)) {
|
|
70777
70817
|
var initializer = ts.getEffectiveInitializer(declaration);
|
|
70778
|
-
|
|
70818
|
+
if (initializer) {
|
|
70819
|
+
return tryGetNameFromType(getTypeOfExpression(initializer));
|
|
70820
|
+
}
|
|
70821
|
+
if (ts.isEnumMember(declaration)) {
|
|
70822
|
+
return ts.getTextOfPropertyName(declaration.name);
|
|
70823
|
+
}
|
|
70779
70824
|
}
|
|
70780
70825
|
}
|
|
70781
70826
|
return undefined;
|
|
@@ -118839,7 +118884,7 @@ var ts;
|
|
|
118839
118884
|
* Determines if program structure is upto date or needs to be recreated
|
|
118840
118885
|
*/
|
|
118841
118886
|
/* @internal */
|
|
118842
|
-
function isProgramUptoDate(program, rootFileNames, newOptions, getSourceVersion, fileExists,
|
|
118887
|
+
function isProgramUptoDate(program, rootFileNames, newOptions, getSourceVersion, fileExists, hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences) {
|
|
118843
118888
|
// If we haven't created a program yet or have changed automatic type directives, then it is not up-to-date
|
|
118844
118889
|
if (!program || (hasChangedAutomaticTypeDirectiveNames === null || hasChangedAutomaticTypeDirectiveNames === void 0 ? void 0 : hasChangedAutomaticTypeDirectiveNames()))
|
|
118845
118890
|
return false;
|
|
@@ -118867,7 +118912,7 @@ var ts;
|
|
|
118867
118912
|
return true;
|
|
118868
118913
|
function sourceFileNotUptoDate(sourceFile) {
|
|
118869
118914
|
return !sourceFileVersionUptoDate(sourceFile) ||
|
|
118870
|
-
|
|
118915
|
+
hasInvalidatedResolutions(sourceFile.path);
|
|
118871
118916
|
}
|
|
118872
118917
|
function sourceFileVersionUptoDate(sourceFile) {
|
|
118873
118918
|
return sourceFile.version === getSourceVersion(sourceFile.resolvedPath, sourceFile.fileName);
|
|
@@ -119113,7 +119158,7 @@ var ts;
|
|
|
119113
119158
|
var moduleResolutionCache;
|
|
119114
119159
|
var typeReferenceDirectiveResolutionCache;
|
|
119115
119160
|
var actualResolveModuleNamesWorker;
|
|
119116
|
-
var
|
|
119161
|
+
var hasInvalidatedResolutions = host.hasInvalidatedResolutions || ts.returnFalse;
|
|
119117
119162
|
if (host.resolveModuleNames) {
|
|
119118
119163
|
actualResolveModuleNamesWorker = function (moduleNames, containingFile, containingFileName, reusedNames, redirectedReference) { return host.resolveModuleNames(ts.Debug.checkEachDefined(moduleNames), containingFileName, reusedNames, redirectedReference, options, containingFile).map(function (resolved) {
|
|
119119
119164
|
// An older host may have omitted extension, in which case we should infer it from the file extension of resolvedFileName.
|
|
@@ -119560,7 +119605,7 @@ var ts;
|
|
|
119560
119605
|
for (var i = 0; i < moduleNames.length; i++) {
|
|
119561
119606
|
var moduleName = moduleNames[i];
|
|
119562
119607
|
// If the source file is unchanged and doesnt have invalidated resolution, reuse the module resolutions
|
|
119563
|
-
if (file === oldSourceFile && !
|
|
119608
|
+
if (file === oldSourceFile && !hasInvalidatedResolutions(oldSourceFile.path)) {
|
|
119564
119609
|
var oldResolvedModule = ts.getResolvedModule(oldSourceFile, moduleName, getModeForResolutionAtIndex(oldSourceFile, i));
|
|
119565
119610
|
if (oldResolvedModule) {
|
|
119566
119611
|
if (ts.isTraceEnabled(options, host)) {
|
|
@@ -119796,7 +119841,7 @@ var ts;
|
|
|
119796
119841
|
// tentatively approve the file
|
|
119797
119842
|
modifiedSourceFiles.push({ oldFile: oldSourceFile, newFile: newSourceFile });
|
|
119798
119843
|
}
|
|
119799
|
-
else if (
|
|
119844
|
+
else if (hasInvalidatedResolutions(oldSourceFile.path)) {
|
|
119800
119845
|
// 'module/types' references could have changed
|
|
119801
119846
|
structureIsReused = 1 /* StructureIsReused.SafeModules */;
|
|
119802
119847
|
// add file to the modified list so that we will resolve it later
|
|
@@ -122540,10 +122585,16 @@ var ts;
|
|
|
122540
122585
|
var oldCompilerOptions = useOldState ? oldState.compilerOptions : undefined;
|
|
122541
122586
|
var canCopySemanticDiagnostics = useOldState && oldState.semanticDiagnosticsPerFile && !!state.semanticDiagnosticsPerFile &&
|
|
122542
122587
|
!ts.compilerOptionsAffectSemanticDiagnostics(compilerOptions, oldCompilerOptions);
|
|
122588
|
+
// We can only reuse emit signatures (i.e. .d.ts signatures) if the .d.ts file is unchanged,
|
|
122589
|
+
// which will eg be depedent on change in options like declarationDir and outDir options are unchanged.
|
|
122590
|
+
// We need to look in oldState.compilerOptions, rather than oldCompilerOptions (i.e.we need to disregard useOldState) because
|
|
122591
|
+
// oldCompilerOptions can be undefined if there was change in say module from None to some other option
|
|
122592
|
+
// which would make useOldState as false since we can now use reference maps that are needed to track what to emit, what to check etc
|
|
122593
|
+
// but that option change does not affect d.ts file name so emitSignatures should still be reused.
|
|
122543
122594
|
var canCopyEmitSignatures = compilerOptions.composite &&
|
|
122544
122595
|
(oldState === null || oldState === void 0 ? void 0 : oldState.emitSignatures) &&
|
|
122545
122596
|
!outFilePath &&
|
|
122546
|
-
!ts.compilerOptionsAffectDeclarationPath(compilerOptions,
|
|
122597
|
+
!ts.compilerOptionsAffectDeclarationPath(compilerOptions, oldState.compilerOptions);
|
|
122547
122598
|
if (useOldState) {
|
|
122548
122599
|
// Copy old state's changed files set
|
|
122549
122600
|
(_a = oldState.changedFilesSet) === null || _a === void 0 ? void 0 : _a.forEach(function (value) { return state.changedFilesSet.add(value); });
|
|
@@ -123842,7 +123893,7 @@ var ts;
|
|
|
123842
123893
|
invalidateResolutionOfFile: invalidateResolutionOfFile,
|
|
123843
123894
|
invalidateResolutionsOfFailedLookupLocations: invalidateResolutionsOfFailedLookupLocations,
|
|
123844
123895
|
setFilesWithInvalidatedNonRelativeUnresolvedImports: setFilesWithInvalidatedNonRelativeUnresolvedImports,
|
|
123845
|
-
|
|
123896
|
+
createHasInvalidatedResolutions: createHasInvalidatedResolutions,
|
|
123846
123897
|
isFileWithInvalidatedNonRelativeUnresolvedImports: isFileWithInvalidatedNonRelativeUnresolvedImports,
|
|
123847
123898
|
updateTypeRootsWatch: updateTypeRootsWatch,
|
|
123848
123899
|
closeTypeRootsWatch: closeTypeRootsWatch,
|
|
@@ -123897,12 +123948,12 @@ var ts;
|
|
|
123897
123948
|
var value = filesWithInvalidatedNonRelativeUnresolvedImports.get(path);
|
|
123898
123949
|
return !!value && !!value.length;
|
|
123899
123950
|
}
|
|
123900
|
-
function
|
|
123951
|
+
function createHasInvalidatedResolutions(customHasInvalidatedResolutions) {
|
|
123901
123952
|
// Ensure pending resolutions are applied
|
|
123902
123953
|
invalidateResolutionsOfFailedLookupLocations();
|
|
123903
123954
|
var collected = filesWithInvalidatedResolutions;
|
|
123904
123955
|
filesWithInvalidatedResolutions = undefined;
|
|
123905
|
-
return function (path) { return (
|
|
123956
|
+
return function (path) { return customHasInvalidatedResolutions(path) ||
|
|
123906
123957
|
!!(collected === null || collected === void 0 ? void 0 : collected.has(path)) ||
|
|
123907
123958
|
isFileWithInvalidatedNonRelativeUnresolvedImports(path); };
|
|
123908
123959
|
}
|
|
@@ -126283,7 +126334,10 @@ var ts;
|
|
|
126283
126334
|
ts.maybeBind(host, host.getModuleResolutionCache) :
|
|
126284
126335
|
(function () { return resolutionCache.getModuleResolutionCache(); });
|
|
126285
126336
|
var userProvidedResolution = !!host.resolveModuleNames || !!host.resolveTypeReferenceDirectives;
|
|
126286
|
-
|
|
126337
|
+
// All resolutions are invalid if user provided resolutions and didnt supply hasInvalidatedResolutions
|
|
126338
|
+
var customHasInvalidatedResolutions = userProvidedResolution ?
|
|
126339
|
+
ts.maybeBind(host, host.hasInvalidatedResolutions) || ts.returnTrue :
|
|
126340
|
+
ts.returnFalse;
|
|
126287
126341
|
builderProgram = readBuilderProgram(compilerOptions, compilerHost);
|
|
126288
126342
|
synchronizeProgram();
|
|
126289
126343
|
// Update the wild card directory watch
|
|
@@ -126349,10 +126403,9 @@ var ts;
|
|
|
126349
126403
|
resolutionCache.clear();
|
|
126350
126404
|
}
|
|
126351
126405
|
}
|
|
126352
|
-
|
|
126353
|
-
var hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(userProvidedResolution ? userProvidedHasInvalidatedResolution : undefined);
|
|
126406
|
+
var hasInvalidatedResolutions = resolutionCache.createHasInvalidatedResolutions(customHasInvalidatedResolutions);
|
|
126354
126407
|
var _a = ts.changeCompilerHostLikeToUseCache(compilerHost, toPath), originalReadFile = _a.originalReadFile, originalFileExists = _a.originalFileExists, originalDirectoryExists = _a.originalDirectoryExists, originalCreateDirectory = _a.originalCreateDirectory, originalWriteFile = _a.originalWriteFile;
|
|
126355
|
-
if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, function (fileName) { return compilerHost.fileExists(fileName); },
|
|
126408
|
+
if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
|
|
126356
126409
|
if (hasChangedConfigFileParsingErrors) {
|
|
126357
126410
|
if (reportFileChangeDetectedOnCreateProgram) {
|
|
126358
126411
|
reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation);
|
|
@@ -126365,7 +126418,7 @@ var ts;
|
|
|
126365
126418
|
if (reportFileChangeDetectedOnCreateProgram) {
|
|
126366
126419
|
reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation);
|
|
126367
126420
|
}
|
|
126368
|
-
createNewProgram(
|
|
126421
|
+
createNewProgram(hasInvalidatedResolutions);
|
|
126369
126422
|
}
|
|
126370
126423
|
reportFileChangeDetectedOnCreateProgram = false;
|
|
126371
126424
|
if (host.afterProgramCreate && program !== builderProgram) {
|
|
@@ -126378,7 +126431,7 @@ var ts;
|
|
|
126378
126431
|
compilerHost.writeFile = originalWriteFile;
|
|
126379
126432
|
return builderProgram;
|
|
126380
126433
|
}
|
|
126381
|
-
function createNewProgram(
|
|
126434
|
+
function createNewProgram(hasInvalidatedResolutions) {
|
|
126382
126435
|
// Compile the program
|
|
126383
126436
|
writeLog("CreatingProgramWith::");
|
|
126384
126437
|
writeLog(" roots: ".concat(JSON.stringify(rootFileNames)));
|
|
@@ -126389,7 +126442,7 @@ var ts;
|
|
|
126389
126442
|
hasChangedCompilerOptions = false;
|
|
126390
126443
|
hasChangedConfigFileParsingErrors = false;
|
|
126391
126444
|
resolutionCache.startCachingPerDirectoryResolution();
|
|
126392
|
-
compilerHost.
|
|
126445
|
+
compilerHost.hasInvalidatedResolutions = hasInvalidatedResolutions;
|
|
126393
126446
|
compilerHost.hasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames;
|
|
126394
126447
|
var oldProgram = getCurrentProgram();
|
|
126395
126448
|
builderProgram = createProgram(rootFileNames, compilerOptions, compilerHost, builderProgram, configFileParsingDiagnostics, projectReferences);
|
|
@@ -127976,8 +128029,15 @@ var ts;
|
|
|
127976
128029
|
}
|
|
127977
128030
|
if (buildInfo.program) {
|
|
127978
128031
|
// If there are pending changes that are not emitted, project is out of date
|
|
128032
|
+
// When there are syntax errors, changeFileSet will have list of files changed (irrespective of noEmit)
|
|
128033
|
+
// But in case of semantic error we need special treatment.
|
|
128034
|
+
// Checking presence of affectedFilesPendingEmit list is fast and good way to tell if there were semantic errors and file emit was blocked
|
|
128035
|
+
// But if noEmit is true, affectedFilesPendingEmit will have file list even if there are no semantic errors to preserve list of files to be emitted when running with noEmit false
|
|
128036
|
+
// So with noEmit set to true, check on semantic diagnostics needs to be explicit as oppose to when it is false when only files pending emit is sufficient
|
|
127979
128037
|
if (((_a = buildInfo.program.changeFileSet) === null || _a === void 0 ? void 0 : _a.length) ||
|
|
127980
|
-
(!project.options.noEmit
|
|
128038
|
+
(!project.options.noEmit ?
|
|
128039
|
+
(_b = buildInfo.program.affectedFilesPendingEmit) === null || _b === void 0 ? void 0 : _b.length :
|
|
128040
|
+
ts.some(buildInfo.program.semanticDiagnosticsPerFile, ts.isArray))) {
|
|
127981
128041
|
return {
|
|
127982
128042
|
type: ts.UpToDateStatusType.OutOfDateBuildInfo,
|
|
127983
128043
|
buildInfoFile: buildInfoPath
|
|
@@ -139592,7 +139652,7 @@ var ts;
|
|
|
139592
139652
|
break;
|
|
139593
139653
|
case 202 /* SyntaxKind.ImportType */:
|
|
139594
139654
|
// Only check for typeof import('xyz')
|
|
139595
|
-
if (direct.isTypeOf && !direct.qualifier && isExported(direct)) {
|
|
139655
|
+
if (!isAvailableThroughGlobal && direct.isTypeOf && !direct.qualifier && isExported(direct)) {
|
|
139596
139656
|
addIndirectUser(direct.getSourceFile(), /** addTransitiveDependencies */ true);
|
|
139597
139657
|
}
|
|
139598
139658
|
directImports.push(direct);
|
|
@@ -168754,7 +168814,7 @@ var ts;
|
|
|
168754
168814
|
var rootFileNames = host.getScriptFileNames().slice();
|
|
168755
168815
|
// Get a fresh cache of the host information
|
|
168756
168816
|
var newSettings = host.getCompilationSettings() || getDefaultCompilerOptions();
|
|
168757
|
-
var
|
|
168817
|
+
var hasInvalidatedResolutions = host.hasInvalidatedResolutions || ts.returnFalse;
|
|
168758
168818
|
var hasChangedAutomaticTypeDirectiveNames = ts.maybeBind(host, host.hasChangedAutomaticTypeDirectiveNames);
|
|
168759
168819
|
var projectReferences = (_b = host.getProjectReferences) === null || _b === void 0 ? void 0 : _b.call(host);
|
|
168760
168820
|
var parsedCommandLines;
|
|
@@ -168785,7 +168845,7 @@ var ts;
|
|
|
168785
168845
|
},
|
|
168786
168846
|
onReleaseOldSourceFile: onReleaseOldSourceFile,
|
|
168787
168847
|
onReleaseParsedCommandLine: onReleaseParsedCommandLine,
|
|
168788
|
-
|
|
168848
|
+
hasInvalidatedResolutions: hasInvalidatedResolutions,
|
|
168789
168849
|
hasChangedAutomaticTypeDirectiveNames: hasChangedAutomaticTypeDirectiveNames,
|
|
168790
168850
|
trace: ts.maybeBind(host, host.trace),
|
|
168791
168851
|
resolveModuleNames: ts.maybeBind(host, host.resolveModuleNames),
|
|
@@ -168825,7 +168885,7 @@ var ts;
|
|
|
168825
168885
|
// as a const variable without downleveling, doesn't crash).
|
|
168826
168886
|
var documentRegistryBucketKey = documentRegistry.getKeyForCompilationSettings(newSettings);
|
|
168827
168887
|
// If the program is already up-to-date, we can reuse it
|
|
168828
|
-
if (ts.isProgramUptoDate(program, rootFileNames, newSettings, function (_path, fileName) { return host.getScriptVersion(fileName); }, function (fileName) { return compilerHost.fileExists(fileName); },
|
|
168888
|
+
if (ts.isProgramUptoDate(program, rootFileNames, newSettings, function (_path, fileName) { return host.getScriptVersion(fileName); }, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
|
|
168829
168889
|
return;
|
|
168830
168890
|
}
|
|
168831
168891
|
// IMPORTANT - It is critical from this moment onward that we do not check
|
|
@@ -173700,7 +173760,7 @@ var ts;
|
|
|
173700
173760
|
ts.Debug.assert(!this.isClosed(), "Called update graph worker of closed project");
|
|
173701
173761
|
this.writeLog("Starting updateGraphWorker: Project: ".concat(this.getProjectName()));
|
|
173702
173762
|
var start = ts.timestamp();
|
|
173703
|
-
this.
|
|
173763
|
+
this.hasInvalidatedResolutions = this.resolutionCache.createHasInvalidatedResolutions(ts.returnFalse);
|
|
173704
173764
|
this.resolutionCache.startCachingPerDirectoryResolution();
|
|
173705
173765
|
this.program = this.languageService.getProgram(); // TODO: GH#18217
|
|
173706
173766
|
this.dirty = false;
|
|
@@ -175691,18 +175751,20 @@ var ts;
|
|
|
175691
175751
|
return ensureProject ? this.ensureDefaultProjectForFile(fileName) : this.tryGetDefaultProjectForFile(fileName);
|
|
175692
175752
|
};
|
|
175693
175753
|
/* @internal */
|
|
175694
|
-
ProjectService.prototype.tryGetDefaultProjectForFile = function (
|
|
175695
|
-
var scriptInfo = this.getScriptInfoForNormalizedPath(
|
|
175754
|
+
ProjectService.prototype.tryGetDefaultProjectForFile = function (fileNameOrScriptInfo) {
|
|
175755
|
+
var scriptInfo = ts.isString(fileNameOrScriptInfo) ? this.getScriptInfoForNormalizedPath(fileNameOrScriptInfo) : fileNameOrScriptInfo;
|
|
175696
175756
|
return scriptInfo && !scriptInfo.isOrphan() ? scriptInfo.getDefaultProject() : undefined;
|
|
175697
175757
|
};
|
|
175698
175758
|
/* @internal */
|
|
175699
|
-
ProjectService.prototype.ensureDefaultProjectForFile = function (
|
|
175700
|
-
return this.tryGetDefaultProjectForFile(
|
|
175759
|
+
ProjectService.prototype.ensureDefaultProjectForFile = function (fileNameOrScriptInfo) {
|
|
175760
|
+
return this.tryGetDefaultProjectForFile(fileNameOrScriptInfo) || this.doEnsureDefaultProjectForFile(fileNameOrScriptInfo);
|
|
175701
175761
|
};
|
|
175702
|
-
ProjectService.prototype.doEnsureDefaultProjectForFile = function (
|
|
175762
|
+
ProjectService.prototype.doEnsureDefaultProjectForFile = function (fileNameOrScriptInfo) {
|
|
175703
175763
|
this.ensureProjectStructuresUptoDate();
|
|
175704
|
-
var scriptInfo = this.getScriptInfoForNormalizedPath(
|
|
175705
|
-
return scriptInfo ?
|
|
175764
|
+
var scriptInfo = ts.isString(fileNameOrScriptInfo) ? this.getScriptInfoForNormalizedPath(fileNameOrScriptInfo) : fileNameOrScriptInfo;
|
|
175765
|
+
return scriptInfo ?
|
|
175766
|
+
scriptInfo.getDefaultProject() :
|
|
175767
|
+
(this.logErrorForScriptInfoNotFound(ts.isString(fileNameOrScriptInfo) ? fileNameOrScriptInfo : fileNameOrScriptInfo.fileName), server.Errors.ThrowNoProject());
|
|
175706
175768
|
};
|
|
175707
175769
|
ProjectService.prototype.getScriptInfoEnsuringProjectsUptoDate = function (uncheckedFileName) {
|
|
175708
175770
|
this.ensureProjectStructuresUptoDate();
|
|
@@ -177874,7 +177936,7 @@ var ts;
|
|
|
177874
177936
|
if (this.serverMode !== ts.LanguageServiceMode.Semantic || !this.eventHandler || !scriptInfo.isJavaScript() || !ts.addToSeen(this.allJsFilesForOpenFileTelemetry, scriptInfo.path)) {
|
|
177875
177937
|
return;
|
|
177876
177938
|
}
|
|
177877
|
-
var project =
|
|
177939
|
+
var project = this.ensureDefaultProjectForFile(scriptInfo);
|
|
177878
177940
|
if (!project.languageServiceEnabled) {
|
|
177879
177941
|
return;
|
|
177880
177942
|
}
|
|
@@ -180474,6 +180536,10 @@ var ts;
|
|
|
180474
180536
|
this.projectService.logErrorForScriptInfoNotFound(args.file);
|
|
180475
180537
|
return server.Errors.ThrowNoProject();
|
|
180476
180538
|
}
|
|
180539
|
+
else if (!getScriptInfoEnsuringProjectsUptoDate) {
|
|
180540
|
+
// Ensure there are containing projects are present
|
|
180541
|
+
this.projectService.ensureDefaultProjectForFile(scriptInfo);
|
|
180542
|
+
}
|
|
180477
180543
|
projects = scriptInfo.containingProjects;
|
|
180478
180544
|
symLinkedProjects = this.projectService.getSymlinkedProjects(scriptInfo);
|
|
180479
180545
|
}
|
|
@@ -180600,13 +180666,7 @@ var ts;
|
|
|
180600
180666
|
return this.getFileAndProjectWorker(args.file, args.projectFileName);
|
|
180601
180667
|
};
|
|
180602
180668
|
Session.prototype.getFileAndLanguageServiceForSyntacticOperation = function (args) {
|
|
180603
|
-
|
|
180604
|
-
// throw if we dont get project
|
|
180605
|
-
var file = server.toNormalizedPath(args.file);
|
|
180606
|
-
var project = this.getProject(args.projectFileName) || this.projectService.ensureDefaultProjectForFile(file);
|
|
180607
|
-
if (!project) {
|
|
180608
|
-
return server.Errors.ThrowNoProject();
|
|
180609
|
-
}
|
|
180669
|
+
var _a = this.getFileAndProject(args), file = _a.file, project = _a.project;
|
|
180610
180670
|
return {
|
|
180611
180671
|
file: file,
|
|
180612
180672
|
languageService: project.getLanguageService(/*ensureSynchronized*/ false)
|
package/lib/typescript.d.ts
CHANGED
|
@@ -3320,7 +3320,8 @@ declare namespace ts {
|
|
|
3320
3320
|
*/
|
|
3321
3321
|
resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[] | readonly FileReference[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingFileMode?: SourceFile["impliedNodeFormat"] | undefined): (ResolvedTypeReferenceDirective | undefined)[];
|
|
3322
3322
|
getEnvironmentVariable?(name: string): string | undefined;
|
|
3323
|
-
|
|
3323
|
+
/** If provided along with custom resolveModuleNames or resolveTypeReferenceDirectives, used to determine if unchanged file path needs to re-resolve modules/type reference directives */
|
|
3324
|
+
hasInvalidatedResolutions?(filePath: Path): boolean;
|
|
3324
3325
|
createHash?(data: string): string;
|
|
3325
3326
|
getParsedCommandLine?(fileName: string): ParsedCommandLine | undefined;
|
|
3326
3327
|
}
|
|
@@ -5444,7 +5445,7 @@ declare namespace ts {
|
|
|
5444
5445
|
/** If provided, used to resolve type reference directives, otherwise typescript's default resolution */
|
|
5445
5446
|
resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[] | readonly FileReference[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingFileMode?: SourceFile["impliedNodeFormat"] | undefined): (ResolvedTypeReferenceDirective | undefined)[];
|
|
5446
5447
|
/** If provided along with custom resolveModuleNames or resolveTypeReferenceDirectives, used to determine if unchanged file path needs to re-resolve modules/type reference directives */
|
|
5447
|
-
|
|
5448
|
+
hasInvalidatedResolutions?(filePath: Path): boolean;
|
|
5448
5449
|
/**
|
|
5449
5450
|
* Returns the module resolution cache used by a provided `resolveModuleNames` implementation so that any non-name module resolution operations (eg, package.json lookup) can reuse it
|
|
5450
5451
|
*/
|