@typescript-deploys/pr-build 4.9.0-pr-50903-10 → 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/lib.es2015.symbol.wellknown.d.ts +3 -3
- package/lib/lib.es5.d.ts +2 -2
- package/lib/pl/diagnosticMessages.generated.json +3 -3
- package/lib/tr/diagnosticMessages.generated.json +3 -0
- package/lib/tsc.js +74 -42
- package/lib/tsserver.js +117 -65
- package/lib/tsserverlibrary.d.ts +4 -0
- package/lib/tsserverlibrary.js +117 -65
- package/lib/typescript.d.ts +4 -0
- package/lib/typescript.js +101 -49
- package/lib/typescriptServices.d.ts +4 -0
- package/lib/typescriptServices.js +101 -49
- package/lib/typingsInstaller.js +97 -45
- package/package.json +8 -10
package/lib/tsserver.js
CHANGED
|
@@ -109,7 +109,7 @@ var ts;
|
|
|
109
109
|
// The following is baselined as a literal template type without intervention
|
|
110
110
|
/** The version of the TypeScript compiler release */
|
|
111
111
|
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
112
|
-
ts.version = "".concat(ts.versionMajorMinor, ".0-insiders.
|
|
112
|
+
ts.version = "".concat(ts.versionMajorMinor, ".0-insiders.20220929");
|
|
113
113
|
/* @internal */
|
|
114
114
|
var Comparison;
|
|
115
115
|
(function (Comparison) {
|
|
@@ -3215,11 +3215,13 @@ var ts;
|
|
|
3215
3215
|
// > alphanumerics and hyphen [0-9A-Za-z-]. Identifiers MUST NOT be empty. Numeric identifiers
|
|
3216
3216
|
// > MUST NOT include leading zeroes.
|
|
3217
3217
|
var prereleaseRegExp = /^(?:0|[1-9]\d*|[a-z-][a-z0-9-]*)(?:\.(?:0|[1-9]\d*|[a-z-][a-z0-9-]*))*$/i;
|
|
3218
|
+
var prereleasePartRegExp = /^(?:0|[1-9]\d*|[a-z-][a-z0-9-]*)$/i;
|
|
3218
3219
|
// https://semver.org/#spec-item-10
|
|
3219
3220
|
// > Build metadata MAY be denoted by appending a plus sign and a series of dot separated
|
|
3220
3221
|
// > identifiers immediately following the patch or pre-release version. Identifiers MUST
|
|
3221
3222
|
// > comprise only ASCII alphanumerics and hyphen [0-9A-Za-z-]. Identifiers MUST NOT be empty.
|
|
3222
3223
|
var buildRegExp = /^[a-z0-9-]+(?:\.[a-z0-9-]+)*$/i;
|
|
3224
|
+
var buildPartRegExp = /^[a-z0-9-]+$/i;
|
|
3223
3225
|
// https://semver.org/#spec-item-9
|
|
3224
3226
|
// > Numeric identifiers MUST NOT include leading zeroes.
|
|
3225
3227
|
var numericIdentifierRegExp = /^(0|[1-9]\d*)$/;
|
|
@@ -3239,13 +3241,15 @@ var ts;
|
|
|
3239
3241
|
ts.Debug.assert(major >= 0, "Invalid argument: major");
|
|
3240
3242
|
ts.Debug.assert(minor >= 0, "Invalid argument: minor");
|
|
3241
3243
|
ts.Debug.assert(patch >= 0, "Invalid argument: patch");
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
+
var prereleaseArray = prerelease ? ts.isArray(prerelease) ? prerelease : prerelease.split(".") : ts.emptyArray;
|
|
3245
|
+
var buildArray = build ? ts.isArray(build) ? build : build.split(".") : ts.emptyArray;
|
|
3246
|
+
ts.Debug.assert(ts.every(prereleaseArray, function (s) { return prereleasePartRegExp.test(s); }), "Invalid argument: prerelease");
|
|
3247
|
+
ts.Debug.assert(ts.every(buildArray, function (s) { return buildPartRegExp.test(s); }), "Invalid argument: build");
|
|
3244
3248
|
this.major = major;
|
|
3245
3249
|
this.minor = minor;
|
|
3246
3250
|
this.patch = patch;
|
|
3247
|
-
this.prerelease =
|
|
3248
|
-
this.build =
|
|
3251
|
+
this.prerelease = prereleaseArray;
|
|
3252
|
+
this.build = buildArray;
|
|
3249
3253
|
}
|
|
3250
3254
|
Version.tryParse = function (text) {
|
|
3251
3255
|
var result = tryParseComponents(text);
|
|
@@ -3284,6 +3288,10 @@ var ts;
|
|
|
3284
3288
|
default: return ts.Debug.assertNever(field);
|
|
3285
3289
|
}
|
|
3286
3290
|
};
|
|
3291
|
+
Version.prototype.with = function (fields) {
|
|
3292
|
+
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;
|
|
3293
|
+
return new Version(major, minor, patch, prerelease, build);
|
|
3294
|
+
};
|
|
3287
3295
|
Version.prototype.toString = function () {
|
|
3288
3296
|
var result = "".concat(this.major, ".").concat(this.minor, ".").concat(this.patch);
|
|
3289
3297
|
if (ts.some(this.prerelease))
|
|
@@ -3292,7 +3300,7 @@ var ts;
|
|
|
3292
3300
|
result += "+".concat(this.build.join("."));
|
|
3293
3301
|
return result;
|
|
3294
3302
|
};
|
|
3295
|
-
Version.zero = new Version(0, 0, 0);
|
|
3303
|
+
Version.zero = new Version(0, 0, 0, ["0"]);
|
|
3296
3304
|
return Version;
|
|
3297
3305
|
}());
|
|
3298
3306
|
ts.Version = Version;
|
|
@@ -3375,6 +3383,10 @@ var ts;
|
|
|
3375
3383
|
}
|
|
3376
3384
|
return undefined;
|
|
3377
3385
|
};
|
|
3386
|
+
/**
|
|
3387
|
+
* Tests whether a version matches the range. This is equivalent to `satisfies(version, range, { includePrerelease: true })`.
|
|
3388
|
+
* in `node-semver`.
|
|
3389
|
+
*/
|
|
3378
3390
|
VersionRange.prototype.test = function (version) {
|
|
3379
3391
|
if (typeof version === "string")
|
|
3380
3392
|
version = new Version(version);
|
|
@@ -3485,19 +3497,20 @@ var ts;
|
|
|
3485
3497
|
break;
|
|
3486
3498
|
case "<":
|
|
3487
3499
|
case ">=":
|
|
3488
|
-
comparators.push(createComparator(operator, version))
|
|
3500
|
+
comparators.push(isWildcard(minor) || isWildcard(patch) ? createComparator(operator, version.with({ prerelease: "0" })) :
|
|
3501
|
+
createComparator(operator, version));
|
|
3489
3502
|
break;
|
|
3490
3503
|
case "<=":
|
|
3491
3504
|
case ">":
|
|
3492
|
-
comparators.push(isWildcard(minor) ? createComparator(operator === "<=" ? "<" : ">=", version.increment("major")) :
|
|
3493
|
-
isWildcard(patch) ? createComparator(operator === "<=" ? "<" : ">=", version.increment("minor")) :
|
|
3505
|
+
comparators.push(isWildcard(minor) ? createComparator(operator === "<=" ? "<" : ">=", version.increment("major").with({ prerelease: "0" })) :
|
|
3506
|
+
isWildcard(patch) ? createComparator(operator === "<=" ? "<" : ">=", version.increment("minor").with({ prerelease: "0" })) :
|
|
3494
3507
|
createComparator(operator, version));
|
|
3495
3508
|
break;
|
|
3496
3509
|
case "=":
|
|
3497
3510
|
case undefined:
|
|
3498
3511
|
if (isWildcard(minor) || isWildcard(patch)) {
|
|
3499
|
-
comparators.push(createComparator(">=", version));
|
|
3500
|
-
comparators.push(createComparator("<", version.increment(isWildcard(minor) ? "major" : "minor")));
|
|
3512
|
+
comparators.push(createComparator(">=", version.with({ prerelease: "0" })));
|
|
3513
|
+
comparators.push(createComparator("<", version.increment(isWildcard(minor) ? "major" : "minor").with({ prerelease: "0" })));
|
|
3501
3514
|
}
|
|
3502
3515
|
else {
|
|
3503
3516
|
comparators.push(createComparator("=", version));
|
|
@@ -57607,16 +57620,32 @@ var ts;
|
|
|
57607
57620
|
return getTypeFromTypeNode(typeNode);
|
|
57608
57621
|
}
|
|
57609
57622
|
}
|
|
57623
|
+
function isParameterOfContextSensitiveSignature(symbol) {
|
|
57624
|
+
var decl = symbol.valueDeclaration;
|
|
57625
|
+
if (!decl) {
|
|
57626
|
+
return false;
|
|
57627
|
+
}
|
|
57628
|
+
if (ts.isBindingElement(decl)) {
|
|
57629
|
+
decl = ts.walkUpBindingElementsAndPatterns(decl);
|
|
57630
|
+
}
|
|
57631
|
+
if (ts.isParameter(decl)) {
|
|
57632
|
+
return isContextSensitiveFunctionOrObjectLiteralMethod(decl.parent);
|
|
57633
|
+
}
|
|
57634
|
+
return false;
|
|
57635
|
+
}
|
|
57610
57636
|
function getTypeOfVariableOrParameterOrProperty(symbol) {
|
|
57611
57637
|
var links = getSymbolLinks(symbol);
|
|
57612
57638
|
if (!links.type) {
|
|
57613
57639
|
var type = getTypeOfVariableOrParameterOrPropertyWorker(symbol);
|
|
57614
57640
|
// For a contextually typed parameter it is possible that a type has already
|
|
57615
57641
|
// been assigned (in assignTypeToParameterAndFixTypeParameters), and we want
|
|
57616
|
-
// to preserve this type.
|
|
57617
|
-
|
|
57642
|
+
// to preserve this type. In fact, we need to _prefer_ that type, but it won't
|
|
57643
|
+
// be assigned until contextual typing is complete, so we need to defer in
|
|
57644
|
+
// cases where contextual typing may take place.
|
|
57645
|
+
if (!links.type && !isParameterOfContextSensitiveSignature(symbol)) {
|
|
57618
57646
|
links.type = type;
|
|
57619
57647
|
}
|
|
57648
|
+
return type;
|
|
57620
57649
|
}
|
|
57621
57650
|
return links.type;
|
|
57622
57651
|
}
|
|
@@ -63343,7 +63372,18 @@ var ts;
|
|
|
63343
63372
|
return accessFlags & 1 /* AccessFlags.IncludeUndefined */ ? getUnionType([indexInfo.type, undefinedType]) : indexInfo.type;
|
|
63344
63373
|
}
|
|
63345
63374
|
errorIfWritingToReadonlyIndex(indexInfo);
|
|
63346
|
-
|
|
63375
|
+
// When accessing an enum object with its own type,
|
|
63376
|
+
// e.g. E[E.A] for enum E { A }, undefined shouldn't
|
|
63377
|
+
// be included in the result type
|
|
63378
|
+
if ((accessFlags & 1 /* AccessFlags.IncludeUndefined */) &&
|
|
63379
|
+
!(objectType.symbol &&
|
|
63380
|
+
objectType.symbol.flags & (256 /* SymbolFlags.RegularEnum */ | 128 /* SymbolFlags.ConstEnum */) &&
|
|
63381
|
+
(indexType.symbol &&
|
|
63382
|
+
indexType.flags & 1024 /* TypeFlags.EnumLiteral */ &&
|
|
63383
|
+
getParentOfSymbol(indexType.symbol) === objectType.symbol))) {
|
|
63384
|
+
return getUnionType([indexInfo.type, undefinedType]);
|
|
63385
|
+
}
|
|
63386
|
+
return indexInfo.type;
|
|
63347
63387
|
}
|
|
63348
63388
|
if (indexType.flags & 131072 /* TypeFlags.Never */) {
|
|
63349
63389
|
return neverType;
|
|
@@ -65036,13 +65076,8 @@ var ts;
|
|
|
65036
65076
|
return ts.hasContextSensitiveParameters(node) || hasContextSensitiveReturnExpression(node);
|
|
65037
65077
|
}
|
|
65038
65078
|
function hasContextSensitiveReturnExpression(node) {
|
|
65039
|
-
|
|
65040
|
-
|
|
65041
|
-
}
|
|
65042
|
-
if (node.body.kind !== 238 /* SyntaxKind.Block */) {
|
|
65043
|
-
return isContextSensitive(node.body);
|
|
65044
|
-
}
|
|
65045
|
-
return !!ts.forEachReturnStatement(node.body, function (statement) { return !!statement.expression && isContextSensitive(statement.expression); });
|
|
65079
|
+
// TODO(anhans): A block should be context-sensitive if it has a context-sensitive return value.
|
|
65080
|
+
return !node.typeParameters && !ts.getEffectiveReturnTypeNode(node) && !!node.body && node.body.kind !== 238 /* SyntaxKind.Block */ && isContextSensitive(node.body);
|
|
65046
65081
|
}
|
|
65047
65082
|
function isContextSensitiveFunctionOrObjectLiteralMethod(func) {
|
|
65048
65083
|
return (ts.isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) &&
|
|
@@ -67005,7 +67040,7 @@ var ts;
|
|
|
67005
67040
|
// with another type parameter unless one extends the other. (Remember: comparability is mostly bidirectional!)
|
|
67006
67041
|
var constraint = getConstraintOfTypeParameter(source);
|
|
67007
67042
|
if (constraint && hasNonCircularBaseConstraint(source)) {
|
|
67008
|
-
while (constraint && constraint.flags & 262144 /* TypeFlags.TypeParameter */) {
|
|
67043
|
+
while (constraint && someType(constraint, function (c) { return !!(c.flags & 262144 /* TypeFlags.TypeParameter */); })) {
|
|
67009
67044
|
if (result = isRelatedTo(constraint, target, 1 /* RecursionFlags.Source */, /*reportErrors*/ false)) {
|
|
67010
67045
|
return result;
|
|
67011
67046
|
}
|
|
@@ -70767,7 +70802,7 @@ var ts;
|
|
|
70767
70802
|
}
|
|
70768
70803
|
if (ts.isEntityNameExpression(node.argumentExpression)) {
|
|
70769
70804
|
var symbol = resolveEntityName(node.argumentExpression, 111551 /* SymbolFlags.Value */, /*ignoreErrors*/ true);
|
|
70770
|
-
if (!symbol || !isConstVariable(symbol))
|
|
70805
|
+
if (!symbol || !(isConstVariable(symbol) || (symbol.flags & 8 /* SymbolFlags.EnumMember */)))
|
|
70771
70806
|
return undefined;
|
|
70772
70807
|
var declaration = symbol.valueDeclaration;
|
|
70773
70808
|
if (declaration === undefined)
|
|
@@ -70781,7 +70816,12 @@ var ts;
|
|
|
70781
70816
|
}
|
|
70782
70817
|
if (ts.hasOnlyExpressionInitializer(declaration) && isBlockScopedNameDeclaredBeforeUse(declaration, node.argumentExpression)) {
|
|
70783
70818
|
var initializer = ts.getEffectiveInitializer(declaration);
|
|
70784
|
-
|
|
70819
|
+
if (initializer) {
|
|
70820
|
+
return tryGetNameFromType(getTypeOfExpression(initializer));
|
|
70821
|
+
}
|
|
70822
|
+
if (ts.isEnumMember(declaration)) {
|
|
70823
|
+
return ts.getTextOfPropertyName(declaration.name);
|
|
70824
|
+
}
|
|
70785
70825
|
}
|
|
70786
70826
|
}
|
|
70787
70827
|
return undefined;
|
|
@@ -118845,7 +118885,7 @@ var ts;
|
|
|
118845
118885
|
* Determines if program structure is upto date or needs to be recreated
|
|
118846
118886
|
*/
|
|
118847
118887
|
/* @internal */
|
|
118848
|
-
function isProgramUptoDate(program, rootFileNames, newOptions, getSourceVersion, fileExists,
|
|
118888
|
+
function isProgramUptoDate(program, rootFileNames, newOptions, getSourceVersion, fileExists, hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences) {
|
|
118849
118889
|
// If we haven't created a program yet or have changed automatic type directives, then it is not up-to-date
|
|
118850
118890
|
if (!program || (hasChangedAutomaticTypeDirectiveNames === null || hasChangedAutomaticTypeDirectiveNames === void 0 ? void 0 : hasChangedAutomaticTypeDirectiveNames()))
|
|
118851
118891
|
return false;
|
|
@@ -118873,7 +118913,7 @@ var ts;
|
|
|
118873
118913
|
return true;
|
|
118874
118914
|
function sourceFileNotUptoDate(sourceFile) {
|
|
118875
118915
|
return !sourceFileVersionUptoDate(sourceFile) ||
|
|
118876
|
-
|
|
118916
|
+
hasInvalidatedResolutions(sourceFile.path);
|
|
118877
118917
|
}
|
|
118878
118918
|
function sourceFileVersionUptoDate(sourceFile) {
|
|
118879
118919
|
return sourceFile.version === getSourceVersion(sourceFile.resolvedPath, sourceFile.fileName);
|
|
@@ -119119,7 +119159,7 @@ var ts;
|
|
|
119119
119159
|
var moduleResolutionCache;
|
|
119120
119160
|
var typeReferenceDirectiveResolutionCache;
|
|
119121
119161
|
var actualResolveModuleNamesWorker;
|
|
119122
|
-
var
|
|
119162
|
+
var hasInvalidatedResolutions = host.hasInvalidatedResolutions || ts.returnFalse;
|
|
119123
119163
|
if (host.resolveModuleNames) {
|
|
119124
119164
|
actualResolveModuleNamesWorker = function (moduleNames, containingFile, containingFileName, reusedNames, redirectedReference) { return host.resolveModuleNames(ts.Debug.checkEachDefined(moduleNames), containingFileName, reusedNames, redirectedReference, options, containingFile).map(function (resolved) {
|
|
119125
119165
|
// An older host may have omitted extension, in which case we should infer it from the file extension of resolvedFileName.
|
|
@@ -119566,7 +119606,7 @@ var ts;
|
|
|
119566
119606
|
for (var i = 0; i < moduleNames.length; i++) {
|
|
119567
119607
|
var moduleName = moduleNames[i];
|
|
119568
119608
|
// If the source file is unchanged and doesnt have invalidated resolution, reuse the module resolutions
|
|
119569
|
-
if (file === oldSourceFile && !
|
|
119609
|
+
if (file === oldSourceFile && !hasInvalidatedResolutions(oldSourceFile.path)) {
|
|
119570
119610
|
var oldResolvedModule = ts.getResolvedModule(oldSourceFile, moduleName, getModeForResolutionAtIndex(oldSourceFile, i));
|
|
119571
119611
|
if (oldResolvedModule) {
|
|
119572
119612
|
if (ts.isTraceEnabled(options, host)) {
|
|
@@ -119802,7 +119842,7 @@ var ts;
|
|
|
119802
119842
|
// tentatively approve the file
|
|
119803
119843
|
modifiedSourceFiles.push({ oldFile: oldSourceFile, newFile: newSourceFile });
|
|
119804
119844
|
}
|
|
119805
|
-
else if (
|
|
119845
|
+
else if (hasInvalidatedResolutions(oldSourceFile.path)) {
|
|
119806
119846
|
// 'module/types' references could have changed
|
|
119807
119847
|
structureIsReused = 1 /* StructureIsReused.SafeModules */;
|
|
119808
119848
|
// add file to the modified list so that we will resolve it later
|
|
@@ -122546,10 +122586,16 @@ var ts;
|
|
|
122546
122586
|
var oldCompilerOptions = useOldState ? oldState.compilerOptions : undefined;
|
|
122547
122587
|
var canCopySemanticDiagnostics = useOldState && oldState.semanticDiagnosticsPerFile && !!state.semanticDiagnosticsPerFile &&
|
|
122548
122588
|
!ts.compilerOptionsAffectSemanticDiagnostics(compilerOptions, oldCompilerOptions);
|
|
122589
|
+
// We can only reuse emit signatures (i.e. .d.ts signatures) if the .d.ts file is unchanged,
|
|
122590
|
+
// which will eg be depedent on change in options like declarationDir and outDir options are unchanged.
|
|
122591
|
+
// We need to look in oldState.compilerOptions, rather than oldCompilerOptions (i.e.we need to disregard useOldState) because
|
|
122592
|
+
// oldCompilerOptions can be undefined if there was change in say module from None to some other option
|
|
122593
|
+
// 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
|
|
122594
|
+
// but that option change does not affect d.ts file name so emitSignatures should still be reused.
|
|
122549
122595
|
var canCopyEmitSignatures = compilerOptions.composite &&
|
|
122550
122596
|
(oldState === null || oldState === void 0 ? void 0 : oldState.emitSignatures) &&
|
|
122551
122597
|
!outFilePath &&
|
|
122552
|
-
!ts.compilerOptionsAffectDeclarationPath(compilerOptions,
|
|
122598
|
+
!ts.compilerOptionsAffectDeclarationPath(compilerOptions, oldState.compilerOptions);
|
|
122553
122599
|
if (useOldState) {
|
|
122554
122600
|
// Copy old state's changed files set
|
|
122555
122601
|
(_a = oldState.changedFilesSet) === null || _a === void 0 ? void 0 : _a.forEach(function (value) { return state.changedFilesSet.add(value); });
|
|
@@ -123848,7 +123894,7 @@ var ts;
|
|
|
123848
123894
|
invalidateResolutionOfFile: invalidateResolutionOfFile,
|
|
123849
123895
|
invalidateResolutionsOfFailedLookupLocations: invalidateResolutionsOfFailedLookupLocations,
|
|
123850
123896
|
setFilesWithInvalidatedNonRelativeUnresolvedImports: setFilesWithInvalidatedNonRelativeUnresolvedImports,
|
|
123851
|
-
|
|
123897
|
+
createHasInvalidatedResolutions: createHasInvalidatedResolutions,
|
|
123852
123898
|
isFileWithInvalidatedNonRelativeUnresolvedImports: isFileWithInvalidatedNonRelativeUnresolvedImports,
|
|
123853
123899
|
updateTypeRootsWatch: updateTypeRootsWatch,
|
|
123854
123900
|
closeTypeRootsWatch: closeTypeRootsWatch,
|
|
@@ -123903,17 +123949,13 @@ var ts;
|
|
|
123903
123949
|
var value = filesWithInvalidatedNonRelativeUnresolvedImports.get(path);
|
|
123904
123950
|
return !!value && !!value.length;
|
|
123905
123951
|
}
|
|
123906
|
-
function
|
|
123952
|
+
function createHasInvalidatedResolutions(customHasInvalidatedResolutions) {
|
|
123907
123953
|
// Ensure pending resolutions are applied
|
|
123908
123954
|
invalidateResolutionsOfFailedLookupLocations();
|
|
123909
|
-
if (forceAllFilesAsInvalidated) {
|
|
123910
|
-
// Any file asked would have invalidated resolution
|
|
123911
|
-
filesWithInvalidatedResolutions = undefined;
|
|
123912
|
-
return ts.returnTrue;
|
|
123913
|
-
}
|
|
123914
123955
|
var collected = filesWithInvalidatedResolutions;
|
|
123915
123956
|
filesWithInvalidatedResolutions = undefined;
|
|
123916
|
-
return function (path) { return (
|
|
123957
|
+
return function (path) { return customHasInvalidatedResolutions(path) ||
|
|
123958
|
+
!!(collected === null || collected === void 0 ? void 0 : collected.has(path)) ||
|
|
123917
123959
|
isFileWithInvalidatedNonRelativeUnresolvedImports(path); };
|
|
123918
123960
|
}
|
|
123919
123961
|
function startCachingPerDirectoryResolution() {
|
|
@@ -126293,6 +126335,10 @@ var ts;
|
|
|
126293
126335
|
ts.maybeBind(host, host.getModuleResolutionCache) :
|
|
126294
126336
|
(function () { return resolutionCache.getModuleResolutionCache(); });
|
|
126295
126337
|
var userProvidedResolution = !!host.resolveModuleNames || !!host.resolveTypeReferenceDirectives;
|
|
126338
|
+
// All resolutions are invalid if user provided resolutions and didnt supply hasInvalidatedResolutions
|
|
126339
|
+
var customHasInvalidatedResolutions = userProvidedResolution ?
|
|
126340
|
+
ts.maybeBind(host, host.hasInvalidatedResolutions) || ts.returnTrue :
|
|
126341
|
+
ts.returnFalse;
|
|
126296
126342
|
builderProgram = readBuilderProgram(compilerOptions, compilerHost);
|
|
126297
126343
|
synchronizeProgram();
|
|
126298
126344
|
// Update the wild card directory watch
|
|
@@ -126358,10 +126404,9 @@ var ts;
|
|
|
126358
126404
|
resolutionCache.clear();
|
|
126359
126405
|
}
|
|
126360
126406
|
}
|
|
126361
|
-
|
|
126362
|
-
var hasInvalidatedResolution = resolutionCache.createHasInvalidatedResolution(userProvidedResolution);
|
|
126407
|
+
var hasInvalidatedResolutions = resolutionCache.createHasInvalidatedResolutions(customHasInvalidatedResolutions);
|
|
126363
126408
|
var _a = ts.changeCompilerHostLikeToUseCache(compilerHost, toPath), originalReadFile = _a.originalReadFile, originalFileExists = _a.originalFileExists, originalDirectoryExists = _a.originalDirectoryExists, originalCreateDirectory = _a.originalCreateDirectory, originalWriteFile = _a.originalWriteFile;
|
|
126364
|
-
if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, function (fileName) { return compilerHost.fileExists(fileName); },
|
|
126409
|
+
if (ts.isProgramUptoDate(getCurrentProgram(), rootFileNames, compilerOptions, getSourceVersion, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
|
|
126365
126410
|
if (hasChangedConfigFileParsingErrors) {
|
|
126366
126411
|
if (reportFileChangeDetectedOnCreateProgram) {
|
|
126367
126412
|
reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation);
|
|
@@ -126374,7 +126419,7 @@ var ts;
|
|
|
126374
126419
|
if (reportFileChangeDetectedOnCreateProgram) {
|
|
126375
126420
|
reportWatchDiagnostic(ts.Diagnostics.File_change_detected_Starting_incremental_compilation);
|
|
126376
126421
|
}
|
|
126377
|
-
createNewProgram(
|
|
126422
|
+
createNewProgram(hasInvalidatedResolutions);
|
|
126378
126423
|
}
|
|
126379
126424
|
reportFileChangeDetectedOnCreateProgram = false;
|
|
126380
126425
|
if (host.afterProgramCreate && program !== builderProgram) {
|
|
@@ -126387,7 +126432,7 @@ var ts;
|
|
|
126387
126432
|
compilerHost.writeFile = originalWriteFile;
|
|
126388
126433
|
return builderProgram;
|
|
126389
126434
|
}
|
|
126390
|
-
function createNewProgram(
|
|
126435
|
+
function createNewProgram(hasInvalidatedResolutions) {
|
|
126391
126436
|
// Compile the program
|
|
126392
126437
|
writeLog("CreatingProgramWith::");
|
|
126393
126438
|
writeLog(" roots: ".concat(JSON.stringify(rootFileNames)));
|
|
@@ -126398,7 +126443,7 @@ var ts;
|
|
|
126398
126443
|
hasChangedCompilerOptions = false;
|
|
126399
126444
|
hasChangedConfigFileParsingErrors = false;
|
|
126400
126445
|
resolutionCache.startCachingPerDirectoryResolution();
|
|
126401
|
-
compilerHost.
|
|
126446
|
+
compilerHost.hasInvalidatedResolutions = hasInvalidatedResolutions;
|
|
126402
126447
|
compilerHost.hasChangedAutomaticTypeDirectiveNames = hasChangedAutomaticTypeDirectiveNames;
|
|
126403
126448
|
var oldProgram = getCurrentProgram();
|
|
126404
126449
|
builderProgram = createProgram(rootFileNames, compilerOptions, compilerHost, builderProgram, configFileParsingDiagnostics, projectReferences);
|
|
@@ -127985,8 +128030,15 @@ var ts;
|
|
|
127985
128030
|
}
|
|
127986
128031
|
if (buildInfo.program) {
|
|
127987
128032
|
// If there are pending changes that are not emitted, project is out of date
|
|
128033
|
+
// When there are syntax errors, changeFileSet will have list of files changed (irrespective of noEmit)
|
|
128034
|
+
// But in case of semantic error we need special treatment.
|
|
128035
|
+
// Checking presence of affectedFilesPendingEmit list is fast and good way to tell if there were semantic errors and file emit was blocked
|
|
128036
|
+
// 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
|
|
128037
|
+
// 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
|
|
127988
128038
|
if (((_a = buildInfo.program.changeFileSet) === null || _a === void 0 ? void 0 : _a.length) ||
|
|
127989
|
-
(!project.options.noEmit
|
|
128039
|
+
(!project.options.noEmit ?
|
|
128040
|
+
(_b = buildInfo.program.affectedFilesPendingEmit) === null || _b === void 0 ? void 0 : _b.length :
|
|
128041
|
+
ts.some(buildInfo.program.semanticDiagnosticsPerFile, ts.isArray))) {
|
|
127990
128042
|
return {
|
|
127991
128043
|
type: ts.UpToDateStatusType.OutOfDateBuildInfo,
|
|
127992
128044
|
buildInfoFile: buildInfoPath
|
|
@@ -139182,7 +139234,7 @@ var ts;
|
|
|
139182
139234
|
break;
|
|
139183
139235
|
case 202 /* SyntaxKind.ImportType */:
|
|
139184
139236
|
// Only check for typeof import('xyz')
|
|
139185
|
-
if (direct.isTypeOf && !direct.qualifier && isExported(direct)) {
|
|
139237
|
+
if (!isAvailableThroughGlobal && direct.isTypeOf && !direct.qualifier && isExported(direct)) {
|
|
139186
139238
|
addIndirectUser(direct.getSourceFile(), /** addTransitiveDependencies */ true);
|
|
139187
139239
|
}
|
|
139188
139240
|
directImports.push(direct);
|
|
@@ -168344,7 +168396,7 @@ var ts;
|
|
|
168344
168396
|
var rootFileNames = host.getScriptFileNames().slice();
|
|
168345
168397
|
// Get a fresh cache of the host information
|
|
168346
168398
|
var newSettings = host.getCompilationSettings() || getDefaultCompilerOptions();
|
|
168347
|
-
var
|
|
168399
|
+
var hasInvalidatedResolutions = host.hasInvalidatedResolutions || ts.returnFalse;
|
|
168348
168400
|
var hasChangedAutomaticTypeDirectiveNames = ts.maybeBind(host, host.hasChangedAutomaticTypeDirectiveNames);
|
|
168349
168401
|
var projectReferences = (_b = host.getProjectReferences) === null || _b === void 0 ? void 0 : _b.call(host);
|
|
168350
168402
|
var parsedCommandLines;
|
|
@@ -168375,7 +168427,7 @@ var ts;
|
|
|
168375
168427
|
},
|
|
168376
168428
|
onReleaseOldSourceFile: onReleaseOldSourceFile,
|
|
168377
168429
|
onReleaseParsedCommandLine: onReleaseParsedCommandLine,
|
|
168378
|
-
|
|
168430
|
+
hasInvalidatedResolutions: hasInvalidatedResolutions,
|
|
168379
168431
|
hasChangedAutomaticTypeDirectiveNames: hasChangedAutomaticTypeDirectiveNames,
|
|
168380
168432
|
trace: ts.maybeBind(host, host.trace),
|
|
168381
168433
|
resolveModuleNames: ts.maybeBind(host, host.resolveModuleNames),
|
|
@@ -168415,7 +168467,7 @@ var ts;
|
|
|
168415
168467
|
// as a const variable without downleveling, doesn't crash).
|
|
168416
168468
|
var documentRegistryBucketKey = documentRegistry.getKeyForCompilationSettings(newSettings);
|
|
168417
168469
|
// If the program is already up-to-date, we can reuse it
|
|
168418
|
-
if (ts.isProgramUptoDate(program, rootFileNames, newSettings, function (_path, fileName) { return host.getScriptVersion(fileName); }, function (fileName) { return compilerHost.fileExists(fileName); },
|
|
168470
|
+
if (ts.isProgramUptoDate(program, rootFileNames, newSettings, function (_path, fileName) { return host.getScriptVersion(fileName); }, function (fileName) { return compilerHost.fileExists(fileName); }, hasInvalidatedResolutions, hasChangedAutomaticTypeDirectiveNames, getParsedCommandLine, projectReferences)) {
|
|
168419
168471
|
return;
|
|
168420
168472
|
}
|
|
168421
168473
|
// IMPORTANT - It is critical from this moment onward that we do not check
|
|
@@ -173709,7 +173761,7 @@ var ts;
|
|
|
173709
173761
|
ts.Debug.assert(!this.isClosed(), "Called update graph worker of closed project");
|
|
173710
173762
|
this.writeLog("Starting updateGraphWorker: Project: ".concat(this.getProjectName()));
|
|
173711
173763
|
var start = ts.timestamp();
|
|
173712
|
-
this.
|
|
173764
|
+
this.hasInvalidatedResolutions = this.resolutionCache.createHasInvalidatedResolutions(ts.returnFalse);
|
|
173713
173765
|
this.resolutionCache.startCachingPerDirectoryResolution();
|
|
173714
173766
|
this.program = this.languageService.getProgram(); // TODO: GH#18217
|
|
173715
173767
|
this.dirty = false;
|
|
@@ -175700,18 +175752,20 @@ var ts;
|
|
|
175700
175752
|
return ensureProject ? this.ensureDefaultProjectForFile(fileName) : this.tryGetDefaultProjectForFile(fileName);
|
|
175701
175753
|
};
|
|
175702
175754
|
/* @internal */
|
|
175703
|
-
ProjectService.prototype.tryGetDefaultProjectForFile = function (
|
|
175704
|
-
var scriptInfo = this.getScriptInfoForNormalizedPath(
|
|
175755
|
+
ProjectService.prototype.tryGetDefaultProjectForFile = function (fileNameOrScriptInfo) {
|
|
175756
|
+
var scriptInfo = ts.isString(fileNameOrScriptInfo) ? this.getScriptInfoForNormalizedPath(fileNameOrScriptInfo) : fileNameOrScriptInfo;
|
|
175705
175757
|
return scriptInfo && !scriptInfo.isOrphan() ? scriptInfo.getDefaultProject() : undefined;
|
|
175706
175758
|
};
|
|
175707
175759
|
/* @internal */
|
|
175708
|
-
ProjectService.prototype.ensureDefaultProjectForFile = function (
|
|
175709
|
-
return this.tryGetDefaultProjectForFile(
|
|
175760
|
+
ProjectService.prototype.ensureDefaultProjectForFile = function (fileNameOrScriptInfo) {
|
|
175761
|
+
return this.tryGetDefaultProjectForFile(fileNameOrScriptInfo) || this.doEnsureDefaultProjectForFile(fileNameOrScriptInfo);
|
|
175710
175762
|
};
|
|
175711
|
-
ProjectService.prototype.doEnsureDefaultProjectForFile = function (
|
|
175763
|
+
ProjectService.prototype.doEnsureDefaultProjectForFile = function (fileNameOrScriptInfo) {
|
|
175712
175764
|
this.ensureProjectStructuresUptoDate();
|
|
175713
|
-
var scriptInfo = this.getScriptInfoForNormalizedPath(
|
|
175714
|
-
return scriptInfo ?
|
|
175765
|
+
var scriptInfo = ts.isString(fileNameOrScriptInfo) ? this.getScriptInfoForNormalizedPath(fileNameOrScriptInfo) : fileNameOrScriptInfo;
|
|
175766
|
+
return scriptInfo ?
|
|
175767
|
+
scriptInfo.getDefaultProject() :
|
|
175768
|
+
(this.logErrorForScriptInfoNotFound(ts.isString(fileNameOrScriptInfo) ? fileNameOrScriptInfo : fileNameOrScriptInfo.fileName), server.Errors.ThrowNoProject());
|
|
175715
175769
|
};
|
|
175716
175770
|
ProjectService.prototype.getScriptInfoEnsuringProjectsUptoDate = function (uncheckedFileName) {
|
|
175717
175771
|
this.ensureProjectStructuresUptoDate();
|
|
@@ -177883,7 +177937,7 @@ var ts;
|
|
|
177883
177937
|
if (this.serverMode !== ts.LanguageServiceMode.Semantic || !this.eventHandler || !scriptInfo.isJavaScript() || !ts.addToSeen(this.allJsFilesForOpenFileTelemetry, scriptInfo.path)) {
|
|
177884
177938
|
return;
|
|
177885
177939
|
}
|
|
177886
|
-
var project =
|
|
177940
|
+
var project = this.ensureDefaultProjectForFile(scriptInfo);
|
|
177887
177941
|
if (!project.languageServiceEnabled) {
|
|
177888
177942
|
return;
|
|
177889
177943
|
}
|
|
@@ -180483,6 +180537,10 @@ var ts;
|
|
|
180483
180537
|
this.projectService.logErrorForScriptInfoNotFound(args.file);
|
|
180484
180538
|
return server.Errors.ThrowNoProject();
|
|
180485
180539
|
}
|
|
180540
|
+
else if (!getScriptInfoEnsuringProjectsUptoDate) {
|
|
180541
|
+
// Ensure there are containing projects are present
|
|
180542
|
+
this.projectService.ensureDefaultProjectForFile(scriptInfo);
|
|
180543
|
+
}
|
|
180486
180544
|
projects = scriptInfo.containingProjects;
|
|
180487
180545
|
symLinkedProjects = this.projectService.getSymlinkedProjects(scriptInfo);
|
|
180488
180546
|
}
|
|
@@ -180609,13 +180667,7 @@ var ts;
|
|
|
180609
180667
|
return this.getFileAndProjectWorker(args.file, args.projectFileName);
|
|
180610
180668
|
};
|
|
180611
180669
|
Session.prototype.getFileAndLanguageServiceForSyntacticOperation = function (args) {
|
|
180612
|
-
|
|
180613
|
-
// throw if we dont get project
|
|
180614
|
-
var file = server.toNormalizedPath(args.file);
|
|
180615
|
-
var project = this.getProject(args.projectFileName) || this.projectService.ensureDefaultProjectForFile(file);
|
|
180616
|
-
if (!project) {
|
|
180617
|
-
return server.Errors.ThrowNoProject();
|
|
180618
|
-
}
|
|
180670
|
+
var _a = this.getFileAndProject(args), file = _a.file, project = _a.project;
|
|
180619
180671
|
return {
|
|
180620
180672
|
file: file,
|
|
180621
180673
|
languageService: project.getLanguageService(/*ensureSynchronized*/ false)
|
package/lib/tsserverlibrary.d.ts
CHANGED
|
@@ -3320,6 +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
|
+
/** 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;
|
|
3323
3325
|
createHash?(data: string): string;
|
|
3324
3326
|
getParsedCommandLine?(fileName: string): ParsedCommandLine | undefined;
|
|
3325
3327
|
}
|
|
@@ -5442,6 +5444,8 @@ declare namespace ts {
|
|
|
5442
5444
|
resolveModuleNames?(moduleNames: string[], containingFile: string, reusedNames: string[] | undefined, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingSourceFile?: SourceFile): (ResolvedModule | undefined)[];
|
|
5443
5445
|
/** If provided, used to resolve type reference directives, otherwise typescript's default resolution */
|
|
5444
5446
|
resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[] | readonly FileReference[], containingFile: string, redirectedReference: ResolvedProjectReference | undefined, options: CompilerOptions, containingFileMode?: SourceFile["impliedNodeFormat"] | undefined): (ResolvedTypeReferenceDirective | undefined)[];
|
|
5447
|
+
/** If provided along with custom resolveModuleNames or resolveTypeReferenceDirectives, used to determine if unchanged file path needs to re-resolve modules/type reference directives */
|
|
5448
|
+
hasInvalidatedResolutions?(filePath: Path): boolean;
|
|
5445
5449
|
/**
|
|
5446
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
|
|
5447
5451
|
*/
|