typescript 5.1.0-dev.20230425 → 5.1.0-dev.20230427
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.es5.d.ts +14 -4
- package/lib/tsc.js +26 -6
- package/lib/tsserver.js +147 -104
- package/lib/tsserverlibrary.d.ts +8 -7
- package/lib/tsserverlibrary.js +145 -105
- package/lib/typescript.d.ts +7 -4
- package/lib/typescript.js +29 -7
- package/lib/typingsInstaller.js +20 -194
- package/package.json +2 -2
package/lib/lib.es5.d.ts
CHANGED
|
@@ -4329,12 +4329,21 @@ interface Float64Array {
|
|
|
4329
4329
|
sort(compareFn?: (a: number, b: number) => number): this;
|
|
4330
4330
|
|
|
4331
4331
|
/**
|
|
4332
|
+
* Gets a new Float64Array view of the ArrayBuffer store for this array, referencing the elements
|
|
4332
4333
|
* at begin, inclusive, up to end, exclusive.
|
|
4333
4334
|
* @param begin The index of the beginning of the array.
|
|
4334
4335
|
* @param end The index of the end of the array.
|
|
4335
4336
|
*/
|
|
4336
4337
|
subarray(begin?: number, end?: number): Float64Array;
|
|
4337
4338
|
|
|
4339
|
+
/**
|
|
4340
|
+
* Converts a number to a string by using the current locale.
|
|
4341
|
+
*/
|
|
4342
|
+
toLocaleString(): string;
|
|
4343
|
+
|
|
4344
|
+
/**
|
|
4345
|
+
* Returns a string representation of an array.
|
|
4346
|
+
*/
|
|
4338
4347
|
toString(): string;
|
|
4339
4348
|
|
|
4340
4349
|
/** Returns the primitive value of the specified object. */
|
|
@@ -4383,11 +4392,12 @@ declare var Float64Array: Float64ArrayConstructor;
|
|
|
4383
4392
|
|
|
4384
4393
|
declare namespace Intl {
|
|
4385
4394
|
interface CollatorOptions {
|
|
4386
|
-
usage?:
|
|
4387
|
-
localeMatcher?:
|
|
4395
|
+
usage?: "sort" | "search" | undefined;
|
|
4396
|
+
localeMatcher?: "lookup" | "best fit" | undefined;
|
|
4388
4397
|
numeric?: boolean | undefined;
|
|
4389
|
-
caseFirst?:
|
|
4390
|
-
sensitivity?:
|
|
4398
|
+
caseFirst?: "upper" | "lower" | "false" | undefined;
|
|
4399
|
+
sensitivity?: "base" | "accent" | "case" | "variant" | undefined;
|
|
4400
|
+
collation?: "big5han" | "compat" | "dict" | "direct" | "ducet" | "emoji" | "eor" | "gb2312" | "phonebk" | "phonetic" | "pinyin" | "reformed" | "searchjl" | "stroke" | "trad" | "unihan" | "zhuyin" | undefined;
|
|
4391
4401
|
ignorePunctuation?: boolean | undefined;
|
|
4392
4402
|
}
|
|
4393
4403
|
|
package/lib/tsc.js
CHANGED
|
@@ -18,7 +18,7 @@ and limitations under the License.
|
|
|
18
18
|
|
|
19
19
|
// src/compiler/corePublic.ts
|
|
20
20
|
var versionMajorMinor = "5.1";
|
|
21
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20230427`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -49273,7 +49273,7 @@ function createTypeChecker(host) {
|
|
|
49273
49273
|
if (symbol.flags & 524288 /* TypeAlias */) {
|
|
49274
49274
|
serializeTypeAlias(symbol, symbolName2, modifierFlags);
|
|
49275
49275
|
}
|
|
49276
|
-
if (symbol.flags & (2 /* BlockScopedVariable */ | 1 /* FunctionScopedVariable */ | 4 /* Property */) && symbol.escapedName !== "export=" /* ExportEquals */ && !(symbol.flags & 4194304 /* Prototype */) && !(symbol.flags & 32 /* Class */) && !(symbol.flags & 8192 /* Method */) && !isConstMergedWithNSPrintableAsSignatureMerge) {
|
|
49276
|
+
if (symbol.flags & (2 /* BlockScopedVariable */ | 1 /* FunctionScopedVariable */ | 4 /* Property */ | 98304 /* Accessor */) && symbol.escapedName !== "export=" /* ExportEquals */ && !(symbol.flags & 4194304 /* Prototype */) && !(symbol.flags & 32 /* Class */) && !(symbol.flags & 8192 /* Method */) && !isConstMergedWithNSPrintableAsSignatureMerge) {
|
|
49277
49277
|
if (propertyAsAlias) {
|
|
49278
49278
|
const createdExport = serializeMaybeAliasAssignment(symbol);
|
|
49279
49279
|
if (createdExport) {
|
|
@@ -54540,16 +54540,16 @@ function createTypeChecker(host) {
|
|
|
54540
54540
|
if (declaration.kind === 175 /* Constructor */) {
|
|
54541
54541
|
return getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol));
|
|
54542
54542
|
}
|
|
54543
|
+
const typeNode = getEffectiveReturnTypeNode(declaration);
|
|
54543
54544
|
if (isJSDocSignature(declaration)) {
|
|
54544
54545
|
const root = getJSDocRoot(declaration);
|
|
54545
|
-
if (root && isConstructorDeclaration(root.parent)) {
|
|
54546
|
+
if (root && isConstructorDeclaration(root.parent) && !typeNode) {
|
|
54546
54547
|
return getDeclaredTypeOfClassOrInterface(getMergedSymbol(root.parent.parent.symbol));
|
|
54547
54548
|
}
|
|
54548
54549
|
}
|
|
54549
54550
|
if (isJSDocConstructSignature(declaration)) {
|
|
54550
54551
|
return getTypeFromTypeNode(declaration.parameters[0].type);
|
|
54551
54552
|
}
|
|
54552
|
-
const typeNode = getEffectiveReturnTypeNode(declaration);
|
|
54553
54553
|
if (typeNode) {
|
|
54554
54554
|
return getTypeFromTypeNode(typeNode);
|
|
54555
54555
|
}
|
|
@@ -66976,6 +66976,7 @@ function createTypeChecker(host) {
|
|
|
66976
66976
|
);
|
|
66977
66977
|
}
|
|
66978
66978
|
function discriminateContextualTypeByJSXAttributes(node, contextualType) {
|
|
66979
|
+
const jsxChildrenPropertyName = getJsxElementChildrenPropertyName(getJsxNamespaceAt(node));
|
|
66979
66980
|
return discriminateTypeByDiscriminableItems(
|
|
66980
66981
|
contextualType,
|
|
66981
66982
|
concatenate(
|
|
@@ -66986,7 +66987,14 @@ function createTypeChecker(host) {
|
|
|
66986
66987
|
map(
|
|
66987
66988
|
filter(getPropertiesOfType(contextualType), (s) => {
|
|
66988
66989
|
var _a;
|
|
66989
|
-
|
|
66990
|
+
if (!(s.flags & 16777216 /* Optional */) || !((_a = node == null ? void 0 : node.symbol) == null ? void 0 : _a.members)) {
|
|
66991
|
+
return false;
|
|
66992
|
+
}
|
|
66993
|
+
const element = node.parent.parent;
|
|
66994
|
+
if (s.escapedName === jsxChildrenPropertyName && isJsxElement(element) && getSemanticJsxChildren(element.children).length) {
|
|
66995
|
+
return false;
|
|
66996
|
+
}
|
|
66997
|
+
return !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName);
|
|
66990
66998
|
}),
|
|
66991
66999
|
(s) => [() => undefinedType, s.escapedName]
|
|
66992
67000
|
)
|
|
@@ -103433,6 +103441,8 @@ function transformSystemModule(context) {
|
|
|
103433
103441
|
return visitLabeledStatement(node);
|
|
103434
103442
|
case 253 /* WithStatement */:
|
|
103435
103443
|
return visitWithStatement(node);
|
|
103444
|
+
case 244 /* IfStatement */:
|
|
103445
|
+
return visitIfStatement(node);
|
|
103436
103446
|
case 254 /* SwitchStatement */:
|
|
103437
103447
|
return visitSwitchStatement(node);
|
|
103438
103448
|
case 268 /* CaseBlock */:
|
|
@@ -103538,6 +103548,14 @@ function transformSystemModule(context) {
|
|
|
103538
103548
|
Debug.checkDefined(visitNode(node.statement, topLevelNestedVisitor, isStatement, factory2.liftToBlock))
|
|
103539
103549
|
);
|
|
103540
103550
|
}
|
|
103551
|
+
function visitIfStatement(node) {
|
|
103552
|
+
return factory2.updateIfStatement(
|
|
103553
|
+
node,
|
|
103554
|
+
visitNode(node.expression, visitor, isExpression),
|
|
103555
|
+
Debug.checkDefined(visitNode(node.thenStatement, topLevelNestedVisitor, isStatement, factory2.liftToBlock)),
|
|
103556
|
+
visitNode(node.elseStatement, topLevelNestedVisitor, isStatement, factory2.liftToBlock)
|
|
103557
|
+
);
|
|
103558
|
+
}
|
|
103541
103559
|
function visitSwitchStatement(node) {
|
|
103542
103560
|
return factory2.updateSwitchStatement(
|
|
103543
103561
|
node,
|
|
@@ -119623,7 +119641,9 @@ var WatchType = {
|
|
|
119623
119641
|
MissingSourceMapFile: "Missing source map file",
|
|
119624
119642
|
NoopConfigFileForInferredRoot: "Noop Config file for the inferred project root",
|
|
119625
119643
|
MissingGeneratedFile: "Missing generated file",
|
|
119626
|
-
NodeModulesForModuleSpecifierCache: "node_modules for module specifier cache invalidation"
|
|
119644
|
+
NodeModulesForModuleSpecifierCache: "node_modules for module specifier cache invalidation",
|
|
119645
|
+
TypingInstallerLocationFile: "File location for typing installer",
|
|
119646
|
+
TypingInstallerLocationDirectory: "Directory location for typing installer"
|
|
119627
119647
|
};
|
|
119628
119648
|
function createWatchFactory(host, options) {
|
|
119629
119649
|
const watchLogLevel = host.trace ? options.extendedDiagnostics ? 2 /* Verbose */ : options.diagnostics ? 1 /* TriggerOnly */ : 0 /* None */ : 0 /* None */;
|
package/lib/tsserver.js
CHANGED
|
@@ -2303,7 +2303,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2303
2303
|
|
|
2304
2304
|
// src/compiler/corePublic.ts
|
|
2305
2305
|
var versionMajorMinor = "5.1";
|
|
2306
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2306
|
+
var version = `${versionMajorMinor}.0-dev.20230427`;
|
|
2307
2307
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2308
2308
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2309
2309
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -6951,10 +6951,10 @@ var LanguageVariant = /* @__PURE__ */ ((LanguageVariant4) => {
|
|
|
6951
6951
|
LanguageVariant4[LanguageVariant4["JSX"] = 1] = "JSX";
|
|
6952
6952
|
return LanguageVariant4;
|
|
6953
6953
|
})(LanguageVariant || {});
|
|
6954
|
-
var WatchDirectoryFlags = /* @__PURE__ */ ((
|
|
6955
|
-
|
|
6956
|
-
|
|
6957
|
-
return
|
|
6954
|
+
var WatchDirectoryFlags = /* @__PURE__ */ ((WatchDirectoryFlags3) => {
|
|
6955
|
+
WatchDirectoryFlags3[WatchDirectoryFlags3["None"] = 0] = "None";
|
|
6956
|
+
WatchDirectoryFlags3[WatchDirectoryFlags3["Recursive"] = 1] = "Recursive";
|
|
6957
|
+
return WatchDirectoryFlags3;
|
|
6958
6958
|
})(WatchDirectoryFlags || {});
|
|
6959
6959
|
var CharacterCodes = /* @__PURE__ */ ((CharacterCodes2) => {
|
|
6960
6960
|
CharacterCodes2[CharacterCodes2["nullCharacter"] = 0] = "nullCharacter";
|
|
@@ -53923,7 +53923,7 @@ function createTypeChecker(host) {
|
|
|
53923
53923
|
if (symbol.flags & 524288 /* TypeAlias */) {
|
|
53924
53924
|
serializeTypeAlias(symbol, symbolName2, modifierFlags);
|
|
53925
53925
|
}
|
|
53926
|
-
if (symbol.flags & (2 /* BlockScopedVariable */ | 1 /* FunctionScopedVariable */ | 4 /* Property */) && symbol.escapedName !== "export=" /* ExportEquals */ && !(symbol.flags & 4194304 /* Prototype */) && !(symbol.flags & 32 /* Class */) && !(symbol.flags & 8192 /* Method */) && !isConstMergedWithNSPrintableAsSignatureMerge) {
|
|
53926
|
+
if (symbol.flags & (2 /* BlockScopedVariable */ | 1 /* FunctionScopedVariable */ | 4 /* Property */ | 98304 /* Accessor */) && symbol.escapedName !== "export=" /* ExportEquals */ && !(symbol.flags & 4194304 /* Prototype */) && !(symbol.flags & 32 /* Class */) && !(symbol.flags & 8192 /* Method */) && !isConstMergedWithNSPrintableAsSignatureMerge) {
|
|
53927
53927
|
if (propertyAsAlias) {
|
|
53928
53928
|
const createdExport = serializeMaybeAliasAssignment(symbol);
|
|
53929
53929
|
if (createdExport) {
|
|
@@ -59190,16 +59190,16 @@ function createTypeChecker(host) {
|
|
|
59190
59190
|
if (declaration.kind === 175 /* Constructor */) {
|
|
59191
59191
|
return getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol));
|
|
59192
59192
|
}
|
|
59193
|
+
const typeNode = getEffectiveReturnTypeNode(declaration);
|
|
59193
59194
|
if (isJSDocSignature(declaration)) {
|
|
59194
59195
|
const root = getJSDocRoot(declaration);
|
|
59195
|
-
if (root && isConstructorDeclaration(root.parent)) {
|
|
59196
|
+
if (root && isConstructorDeclaration(root.parent) && !typeNode) {
|
|
59196
59197
|
return getDeclaredTypeOfClassOrInterface(getMergedSymbol(root.parent.parent.symbol));
|
|
59197
59198
|
}
|
|
59198
59199
|
}
|
|
59199
59200
|
if (isJSDocConstructSignature(declaration)) {
|
|
59200
59201
|
return getTypeFromTypeNode(declaration.parameters[0].type);
|
|
59201
59202
|
}
|
|
59202
|
-
const typeNode = getEffectiveReturnTypeNode(declaration);
|
|
59203
59203
|
if (typeNode) {
|
|
59204
59204
|
return getTypeFromTypeNode(typeNode);
|
|
59205
59205
|
}
|
|
@@ -71626,6 +71626,7 @@ function createTypeChecker(host) {
|
|
|
71626
71626
|
);
|
|
71627
71627
|
}
|
|
71628
71628
|
function discriminateContextualTypeByJSXAttributes(node, contextualType) {
|
|
71629
|
+
const jsxChildrenPropertyName = getJsxElementChildrenPropertyName(getJsxNamespaceAt(node));
|
|
71629
71630
|
return discriminateTypeByDiscriminableItems(
|
|
71630
71631
|
contextualType,
|
|
71631
71632
|
concatenate(
|
|
@@ -71636,7 +71637,14 @@ function createTypeChecker(host) {
|
|
|
71636
71637
|
map(
|
|
71637
71638
|
filter(getPropertiesOfType(contextualType), (s) => {
|
|
71638
71639
|
var _a;
|
|
71639
|
-
|
|
71640
|
+
if (!(s.flags & 16777216 /* Optional */) || !((_a = node == null ? void 0 : node.symbol) == null ? void 0 : _a.members)) {
|
|
71641
|
+
return false;
|
|
71642
|
+
}
|
|
71643
|
+
const element = node.parent.parent;
|
|
71644
|
+
if (s.escapedName === jsxChildrenPropertyName && isJsxElement(element) && getSemanticJsxChildren(element.children).length) {
|
|
71645
|
+
return false;
|
|
71646
|
+
}
|
|
71647
|
+
return !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName);
|
|
71640
71648
|
}),
|
|
71641
71649
|
(s) => [() => undefinedType, s.escapedName]
|
|
71642
71650
|
)
|
|
@@ -108254,6 +108262,8 @@ function transformSystemModule(context) {
|
|
|
108254
108262
|
return visitLabeledStatement(node);
|
|
108255
108263
|
case 253 /* WithStatement */:
|
|
108256
108264
|
return visitWithStatement(node);
|
|
108265
|
+
case 244 /* IfStatement */:
|
|
108266
|
+
return visitIfStatement(node);
|
|
108257
108267
|
case 254 /* SwitchStatement */:
|
|
108258
108268
|
return visitSwitchStatement(node);
|
|
108259
108269
|
case 268 /* CaseBlock */:
|
|
@@ -108359,6 +108369,14 @@ function transformSystemModule(context) {
|
|
|
108359
108369
|
Debug.checkDefined(visitNode(node.statement, topLevelNestedVisitor, isStatement, factory2.liftToBlock))
|
|
108360
108370
|
);
|
|
108361
108371
|
}
|
|
108372
|
+
function visitIfStatement(node) {
|
|
108373
|
+
return factory2.updateIfStatement(
|
|
108374
|
+
node,
|
|
108375
|
+
visitNode(node.expression, visitor, isExpression),
|
|
108376
|
+
Debug.checkDefined(visitNode(node.thenStatement, topLevelNestedVisitor, isStatement, factory2.liftToBlock)),
|
|
108377
|
+
visitNode(node.elseStatement, topLevelNestedVisitor, isStatement, factory2.liftToBlock)
|
|
108378
|
+
);
|
|
108379
|
+
}
|
|
108362
108380
|
function visitSwitchStatement(node) {
|
|
108363
108381
|
return factory2.updateSwitchStatement(
|
|
108364
108382
|
node,
|
|
@@ -117317,7 +117335,7 @@ var WatchLogLevel = /* @__PURE__ */ ((WatchLogLevel2) => {
|
|
|
117317
117335
|
WatchLogLevel2[WatchLogLevel2["Verbose"] = 2] = "Verbose";
|
|
117318
117336
|
return WatchLogLevel2;
|
|
117319
117337
|
})(WatchLogLevel || {});
|
|
117320
|
-
function getWatchFactory(host, watchLogLevel, log,
|
|
117338
|
+
function getWatchFactory(host, watchLogLevel, log, getDetailWatchInfo2) {
|
|
117321
117339
|
setSysLog(watchLogLevel === 2 /* Verbose */ ? log : noop);
|
|
117322
117340
|
const plainInvokeFactory = {
|
|
117323
117341
|
watchFile: (file, callback, pollingInterval, options) => host.watchFile(file, callback, pollingInterval, options),
|
|
@@ -117355,23 +117373,23 @@ function getWatchFactory(host, watchLogLevel, log, getDetailWatchInfo3) {
|
|
|
117355
117373
|
return typeof host.useCaseSensitiveFileNames === "boolean" ? host.useCaseSensitiveFileNames : host.useCaseSensitiveFileNames();
|
|
117356
117374
|
}
|
|
117357
117375
|
function createExcludeWatcherWithLogging(file, flags, options, detailInfo1, detailInfo2) {
|
|
117358
|
-
log(`ExcludeWatcher:: Added:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2,
|
|
117376
|
+
log(`ExcludeWatcher:: Added:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`);
|
|
117359
117377
|
return {
|
|
117360
|
-
close: () => log(`ExcludeWatcher:: Close:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2,
|
|
117378
|
+
close: () => log(`ExcludeWatcher:: Close:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`)
|
|
117361
117379
|
};
|
|
117362
117380
|
}
|
|
117363
117381
|
function createFileWatcherWithLogging(file, cb, flags, options, detailInfo1, detailInfo2) {
|
|
117364
|
-
log(`FileWatcher:: Added:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2,
|
|
117382
|
+
log(`FileWatcher:: Added:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`);
|
|
117365
117383
|
const watcher = triggerInvokingFactory.watchFile(file, cb, flags, options, detailInfo1, detailInfo2);
|
|
117366
117384
|
return {
|
|
117367
117385
|
close: () => {
|
|
117368
|
-
log(`FileWatcher:: Close:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2,
|
|
117386
|
+
log(`FileWatcher:: Close:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`);
|
|
117369
117387
|
watcher.close();
|
|
117370
117388
|
}
|
|
117371
117389
|
};
|
|
117372
117390
|
}
|
|
117373
117391
|
function createDirectoryWatcherWithLogging(file, cb, flags, options, detailInfo1, detailInfo2) {
|
|
117374
|
-
const watchInfo = `DirectoryWatcher:: Added:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2,
|
|
117392
|
+
const watchInfo = `DirectoryWatcher:: Added:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`;
|
|
117375
117393
|
log(watchInfo);
|
|
117376
117394
|
const start2 = timestamp();
|
|
117377
117395
|
const watcher = triggerInvokingFactory.watchDirectory(file, cb, flags, options, detailInfo1, detailInfo2);
|
|
@@ -117379,7 +117397,7 @@ function getWatchFactory(host, watchLogLevel, log, getDetailWatchInfo3) {
|
|
|
117379
117397
|
log(`Elapsed:: ${elapsed}ms ${watchInfo}`);
|
|
117380
117398
|
return {
|
|
117381
117399
|
close: () => {
|
|
117382
|
-
const watchInfo2 = `DirectoryWatcher:: Close:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2,
|
|
117400
|
+
const watchInfo2 = `DirectoryWatcher:: Close:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`;
|
|
117383
117401
|
log(watchInfo2);
|
|
117384
117402
|
const start3 = timestamp();
|
|
117385
117403
|
watcher.close();
|
|
@@ -117394,7 +117412,7 @@ function getWatchFactory(host, watchLogLevel, log, getDetailWatchInfo3) {
|
|
|
117394
117412
|
void 0,
|
|
117395
117413
|
file,
|
|
117396
117414
|
(...args) => {
|
|
117397
|
-
const triggerredInfo = `${key === "watchFile" ? "FileWatcher" : "DirectoryWatcher"}:: Triggered with ${args[0]} ${args[1] !== void 0 ? args[1] : ""}:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2,
|
|
117415
|
+
const triggerredInfo = `${key === "watchFile" ? "FileWatcher" : "DirectoryWatcher"}:: Triggered with ${args[0]} ${args[1] !== void 0 ? args[1] : ""}:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`;
|
|
117398
117416
|
log(triggerredInfo);
|
|
117399
117417
|
const start2 = timestamp();
|
|
117400
117418
|
cb.call(
|
|
@@ -117411,8 +117429,8 @@ function getWatchFactory(host, watchLogLevel, log, getDetailWatchInfo3) {
|
|
|
117411
117429
|
detailInfo2
|
|
117412
117430
|
);
|
|
117413
117431
|
}
|
|
117414
|
-
function getWatchInfo(file, flags, options, detailInfo1, detailInfo2,
|
|
117415
|
-
return `WatchInfo: ${file} ${flags} ${JSON.stringify(options)} ${
|
|
117432
|
+
function getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo3) {
|
|
117433
|
+
return `WatchInfo: ${file} ${flags} ${JSON.stringify(options)} ${getDetailWatchInfo3 ? getDetailWatchInfo3(detailInfo1, detailInfo2) : detailInfo2 === void 0 ? detailInfo1 : `${detailInfo1} ${detailInfo2}`}`;
|
|
117416
117434
|
}
|
|
117417
117435
|
}
|
|
117418
117436
|
function getFallbackOptions(options) {
|
|
@@ -124544,7 +124562,9 @@ var WatchType = {
|
|
|
124544
124562
|
MissingSourceMapFile: "Missing source map file",
|
|
124545
124563
|
NoopConfigFileForInferredRoot: "Noop Config file for the inferred project root",
|
|
124546
124564
|
MissingGeneratedFile: "Missing generated file",
|
|
124547
|
-
NodeModulesForModuleSpecifierCache: "node_modules for module specifier cache invalidation"
|
|
124565
|
+
NodeModulesForModuleSpecifierCache: "node_modules for module specifier cache invalidation",
|
|
124566
|
+
TypingInstallerLocationFile: "File location for typing installer",
|
|
124567
|
+
TypingInstallerLocationDirectory: "Directory location for typing installer"
|
|
124548
124568
|
};
|
|
124549
124569
|
function createWatchFactory(host, options) {
|
|
124550
124570
|
const watchLogLevel = host.trace ? options.extendedDiagnostics ? 2 /* Verbose */ : options.diagnostics ? 1 /* TriggerOnly */ : 0 /* None */ : 0 /* None */;
|
|
@@ -127824,6 +127844,7 @@ var EventTypesRegistry = "event::typesRegistry";
|
|
|
127824
127844
|
var EventBeginInstallTypes = "event::beginInstallTypes";
|
|
127825
127845
|
var EventEndInstallTypes = "event::endInstallTypes";
|
|
127826
127846
|
var EventInitializationFailed = "event::initializationFailed";
|
|
127847
|
+
var ActionWatchTypingLocations = "action::watchTypingLocations";
|
|
127827
127848
|
var Arguments;
|
|
127828
127849
|
((Arguments2) => {
|
|
127829
127850
|
Arguments2.GlobalCacheLocation = "--globalTypingsCacheLocation";
|
|
@@ -171585,6 +171606,7 @@ __export(ts_server_exports3, {
|
|
|
171585
171606
|
ActionInvalidate: () => ActionInvalidate,
|
|
171586
171607
|
ActionPackageInstalled: () => ActionPackageInstalled,
|
|
171587
171608
|
ActionSet: () => ActionSet,
|
|
171609
|
+
ActionWatchTypingLocations: () => ActionWatchTypingLocations,
|
|
171588
171610
|
Arguments: () => Arguments,
|
|
171589
171611
|
AutoImportProviderProject: () => AutoImportProviderProject,
|
|
171590
171612
|
CharRangeSection: () => CharRangeSection,
|
|
@@ -171718,19 +171740,6 @@ function getNpmCommandForInstallation(npmPath, tsVersion, packageNames, remainin
|
|
|
171718
171740
|
}
|
|
171719
171741
|
return { command, remaining: remaining - toSlice };
|
|
171720
171742
|
}
|
|
171721
|
-
function endsWith2(str, suffix, caseSensitive) {
|
|
171722
|
-
const expectedPos = str.length - suffix.length;
|
|
171723
|
-
return expectedPos >= 0 && (str.indexOf(suffix, expectedPos) === expectedPos || !caseSensitive && compareStringsCaseInsensitive(str.substr(expectedPos), suffix) === 0 /* EqualTo */);
|
|
171724
|
-
}
|
|
171725
|
-
function isPackageOrBowerJson(fileName, caseSensitive) {
|
|
171726
|
-
return endsWith2(fileName, "/package.json", caseSensitive) || endsWith2(fileName, "/bower.json", caseSensitive);
|
|
171727
|
-
}
|
|
171728
|
-
function sameFiles(a, b, caseSensitive) {
|
|
171729
|
-
return a === b || !caseSensitive && compareStringsCaseInsensitive(a, b) === 0 /* EqualTo */;
|
|
171730
|
-
}
|
|
171731
|
-
function getDetailWatchInfo(projectName, watchers) {
|
|
171732
|
-
return `Project: ${projectName} watcher already invoked: ${watchers == null ? void 0 : watchers.isInvoked}`;
|
|
171733
|
-
}
|
|
171734
171743
|
var TypingsInstaller = class {
|
|
171735
171744
|
constructor(installTypingHost, globalCachePath, safeListPath, typesMapLocation, throttleLimit, log = nullLog) {
|
|
171736
171745
|
this.installTypingHost = installTypingHost;
|
|
@@ -171748,13 +171757,10 @@ var TypingsInstaller = class {
|
|
|
171748
171757
|
this.installRunCount = 1;
|
|
171749
171758
|
this.inFlightRequestCount = 0;
|
|
171750
171759
|
this.latestDistTag = "latest";
|
|
171751
|
-
this.toCanonicalFileName = createGetCanonicalFileName(installTypingHost.useCaseSensitiveFileNames);
|
|
171752
|
-
this.globalCachePackageJsonPath = combinePaths(globalCachePath, "package.json");
|
|
171753
171760
|
const isLoggingEnabled = this.log.isEnabled();
|
|
171754
171761
|
if (isLoggingEnabled) {
|
|
171755
171762
|
this.log.writeLine(`Global cache location '${globalCachePath}', safe file path '${safeListPath}', types map path ${typesMapLocation}`);
|
|
171756
171763
|
}
|
|
171757
|
-
this.watchFactory = getWatchFactory(this.installTypingHost, isLoggingEnabled ? 2 /* Verbose */ : 0 /* None */, (s) => this.log.writeLine(s), getDetailWatchInfo);
|
|
171758
171764
|
this.processCacheLocation(this.globalCachePath);
|
|
171759
171765
|
}
|
|
171760
171766
|
closeProject(req) {
|
|
@@ -171771,8 +171777,8 @@ var TypingsInstaller = class {
|
|
|
171771
171777
|
}
|
|
171772
171778
|
return;
|
|
171773
171779
|
}
|
|
171774
|
-
clearMap(watchers, closeFileWatcher);
|
|
171775
171780
|
this.projectWatchers.delete(projectName);
|
|
171781
|
+
this.sendResponse({ kind: ActionWatchTypingLocations, projectName, files: [] });
|
|
171776
171782
|
if (this.log.isEnabled()) {
|
|
171777
171783
|
this.log.writeLine(`Closing file watchers for project '${projectName}' - done.`);
|
|
171778
171784
|
}
|
|
@@ -171805,7 +171811,7 @@ var TypingsInstaller = class {
|
|
|
171805
171811
|
if (this.log.isEnabled()) {
|
|
171806
171812
|
this.log.writeLine(`Finished typings discovery: ${JSON.stringify(discoverTypingsResult)}`);
|
|
171807
171813
|
}
|
|
171808
|
-
this.watchFiles(req.projectName, discoverTypingsResult.filesToWatch
|
|
171814
|
+
this.watchFiles(req.projectName, discoverTypingsResult.filesToWatch);
|
|
171809
171815
|
if (discoverTypingsResult.newTypingNames.length) {
|
|
171810
171816
|
this.installTypings(req, req.cachePath || this.globalCachePath, discoverTypingsResult.cachedTypingPaths, discoverTypingsResult.newTypingNames);
|
|
171811
171817
|
} else {
|
|
@@ -172006,75 +172012,19 @@ var TypingsInstaller = class {
|
|
|
172006
172012
|
host.createDirectory(directory);
|
|
172007
172013
|
}
|
|
172008
172014
|
}
|
|
172009
|
-
watchFiles(projectName, files
|
|
172015
|
+
watchFiles(projectName, files) {
|
|
172010
172016
|
if (!files.length) {
|
|
172011
172017
|
this.closeWatchers(projectName);
|
|
172012
172018
|
return;
|
|
172013
172019
|
}
|
|
172014
|
-
|
|
172015
|
-
const
|
|
172016
|
-
if (!
|
|
172017
|
-
|
|
172018
|
-
this.
|
|
172020
|
+
const existing = this.projectWatchers.get(projectName);
|
|
172021
|
+
const newSet = new Set(files);
|
|
172022
|
+
if (!existing || forEachKey(newSet, (s) => !existing.has(s)) || forEachKey(existing, (s) => !newSet.has(s))) {
|
|
172023
|
+
this.projectWatchers.set(projectName, newSet);
|
|
172024
|
+
this.sendResponse({ kind: ActionWatchTypingLocations, projectName, files });
|
|
172019
172025
|
} else {
|
|
172020
|
-
|
|
172026
|
+
this.sendResponse({ kind: ActionWatchTypingLocations, projectName, files: void 0 });
|
|
172021
172027
|
}
|
|
172022
|
-
watchers.isInvoked = false;
|
|
172023
|
-
const isLoggingEnabled = this.log.isEnabled();
|
|
172024
|
-
const createProjectWatcher = (path, projectWatcherType) => {
|
|
172025
|
-
const canonicalPath = this.toCanonicalFileName(path);
|
|
172026
|
-
toRemove.delete(canonicalPath);
|
|
172027
|
-
if (watchers.has(canonicalPath)) {
|
|
172028
|
-
return;
|
|
172029
|
-
}
|
|
172030
|
-
if (isLoggingEnabled) {
|
|
172031
|
-
this.log.writeLine(`${projectWatcherType}:: Added:: WatchInfo: ${path}`);
|
|
172032
|
-
}
|
|
172033
|
-
const watcher = projectWatcherType === "FileWatcher" /* FileWatcher */ ? this.watchFactory.watchFile(path, () => {
|
|
172034
|
-
if (!watchers.isInvoked) {
|
|
172035
|
-
watchers.isInvoked = true;
|
|
172036
|
-
this.sendResponse({ projectName, kind: ActionInvalidate });
|
|
172037
|
-
}
|
|
172038
|
-
}, 2e3 /* High */, options, projectName, watchers) : this.watchFactory.watchDirectory(path, (f) => {
|
|
172039
|
-
if (watchers.isInvoked || !fileExtensionIs(f, ".json" /* Json */)) {
|
|
172040
|
-
return;
|
|
172041
|
-
}
|
|
172042
|
-
if (isPackageOrBowerJson(f, this.installTypingHost.useCaseSensitiveFileNames) && !sameFiles(f, this.globalCachePackageJsonPath, this.installTypingHost.useCaseSensitiveFileNames)) {
|
|
172043
|
-
watchers.isInvoked = true;
|
|
172044
|
-
this.sendResponse({ projectName, kind: ActionInvalidate });
|
|
172045
|
-
}
|
|
172046
|
-
}, 1 /* Recursive */, options, projectName, watchers);
|
|
172047
|
-
watchers.set(canonicalPath, isLoggingEnabled ? {
|
|
172048
|
-
close: () => {
|
|
172049
|
-
this.log.writeLine(`${projectWatcherType}:: Closed:: WatchInfo: ${path}`);
|
|
172050
|
-
watcher.close();
|
|
172051
|
-
}
|
|
172052
|
-
} : watcher);
|
|
172053
|
-
};
|
|
172054
|
-
for (const file of files) {
|
|
172055
|
-
if (file.endsWith("/package.json") || file.endsWith("/bower.json")) {
|
|
172056
|
-
createProjectWatcher(file, "FileWatcher" /* FileWatcher */);
|
|
172057
|
-
continue;
|
|
172058
|
-
}
|
|
172059
|
-
if (containsPath(projectRootPath, file, projectRootPath, !this.installTypingHost.useCaseSensitiveFileNames)) {
|
|
172060
|
-
const subDirectory = file.indexOf(directorySeparator, projectRootPath.length + 1);
|
|
172061
|
-
if (subDirectory !== -1) {
|
|
172062
|
-
createProjectWatcher(file.substr(0, subDirectory), "DirectoryWatcher" /* DirectoryWatcher */);
|
|
172063
|
-
} else {
|
|
172064
|
-
createProjectWatcher(file, "DirectoryWatcher" /* DirectoryWatcher */);
|
|
172065
|
-
}
|
|
172066
|
-
continue;
|
|
172067
|
-
}
|
|
172068
|
-
if (containsPath(this.globalCachePath, file, projectRootPath, !this.installTypingHost.useCaseSensitiveFileNames)) {
|
|
172069
|
-
createProjectWatcher(this.globalCachePath, "DirectoryWatcher" /* DirectoryWatcher */);
|
|
172070
|
-
continue;
|
|
172071
|
-
}
|
|
172072
|
-
createProjectWatcher(file, "DirectoryWatcher" /* DirectoryWatcher */);
|
|
172073
|
-
}
|
|
172074
|
-
toRemove.forEach((watch, path) => {
|
|
172075
|
-
watch.close();
|
|
172076
|
-
watchers.delete(path);
|
|
172077
|
-
});
|
|
172078
172028
|
}
|
|
172079
172029
|
createSetTypings(request, typings) {
|
|
172080
172030
|
return {
|
|
@@ -172131,7 +172081,6 @@ function createInstallTypingsRequest(project, typeAcquisition, unresolvedImports
|
|
|
172131
172081
|
true
|
|
172132
172082
|
).concat(project.getExcludedFiles()),
|
|
172133
172083
|
compilerOptions: project.getCompilationSettings(),
|
|
172134
|
-
watchOptions: project.projectService.getWatchOptions(project),
|
|
172135
172084
|
typeAcquisition,
|
|
172136
172085
|
unresolvedImports,
|
|
172137
172086
|
projectRootPath: project.getCurrentDirectory(),
|
|
@@ -173749,6 +173698,8 @@ var Project3 = class {
|
|
|
173749
173698
|
return path === options.configFilePath ? options.configFile : this.getSourceFile(path);
|
|
173750
173699
|
}
|
|
173751
173700
|
close() {
|
|
173701
|
+
this.projectService.typingsCache.onProjectClosed(this);
|
|
173702
|
+
this.closeWatchingTypingLocations();
|
|
173752
173703
|
if (this.program) {
|
|
173753
173704
|
for (const f of this.program.getSourceFiles()) {
|
|
173754
173705
|
this.detachScriptInfoIfNotRoot(f.fileName);
|
|
@@ -174039,6 +173990,89 @@ var Project3 = class {
|
|
|
174039
173990
|
}
|
|
174040
173991
|
}
|
|
174041
173992
|
/** @internal */
|
|
173993
|
+
closeWatchingTypingLocations() {
|
|
173994
|
+
if (this.typingWatchers)
|
|
173995
|
+
clearMap(this.typingWatchers, closeFileWatcher);
|
|
173996
|
+
this.typingWatchers = void 0;
|
|
173997
|
+
}
|
|
173998
|
+
/** @internal */
|
|
173999
|
+
onTypingInstallerWatchInvoke() {
|
|
174000
|
+
this.typingWatchers.isInvoked = true;
|
|
174001
|
+
this.projectService.updateTypingsForProject({ projectName: this.getProjectName(), kind: ActionInvalidate });
|
|
174002
|
+
}
|
|
174003
|
+
/** @internal */
|
|
174004
|
+
watchTypingLocations(files) {
|
|
174005
|
+
if (!files) {
|
|
174006
|
+
this.typingWatchers.isInvoked = false;
|
|
174007
|
+
return;
|
|
174008
|
+
}
|
|
174009
|
+
if (!files.length) {
|
|
174010
|
+
this.closeWatchingTypingLocations();
|
|
174011
|
+
return;
|
|
174012
|
+
}
|
|
174013
|
+
const toRemove = new Map(this.typingWatchers);
|
|
174014
|
+
if (!this.typingWatchers)
|
|
174015
|
+
this.typingWatchers = /* @__PURE__ */ new Map();
|
|
174016
|
+
this.typingWatchers.isInvoked = false;
|
|
174017
|
+
const createProjectWatcher = (path, typingsWatcherType) => {
|
|
174018
|
+
const canonicalPath = this.toPath(path);
|
|
174019
|
+
toRemove.delete(canonicalPath);
|
|
174020
|
+
if (!this.typingWatchers.has(canonicalPath)) {
|
|
174021
|
+
this.typingWatchers.set(
|
|
174022
|
+
canonicalPath,
|
|
174023
|
+
typingsWatcherType === "FileWatcher" /* FileWatcher */ ? this.projectService.watchFactory.watchFile(
|
|
174024
|
+
path,
|
|
174025
|
+
() => !this.typingWatchers.isInvoked ? this.onTypingInstallerWatchInvoke() : this.writeLog(`TypingWatchers already invoked`),
|
|
174026
|
+
2e3 /* High */,
|
|
174027
|
+
this.projectService.getWatchOptions(this),
|
|
174028
|
+
WatchType.TypingInstallerLocationFile,
|
|
174029
|
+
this
|
|
174030
|
+
) : this.projectService.watchFactory.watchDirectory(
|
|
174031
|
+
path,
|
|
174032
|
+
(f) => {
|
|
174033
|
+
if (this.typingWatchers.isInvoked)
|
|
174034
|
+
return this.writeLog(`TypingWatchers already invoked`);
|
|
174035
|
+
if (!fileExtensionIs(f, ".json" /* Json */))
|
|
174036
|
+
return this.writeLog(`Ignoring files that are not *.json`);
|
|
174037
|
+
if (comparePaths(f, combinePaths(this.projectService.typingsInstaller.globalTypingsCacheLocation, "package.json"), !this.useCaseSensitiveFileNames()))
|
|
174038
|
+
return this.writeLog(`Ignoring package.json change at global typings location`);
|
|
174039
|
+
this.onTypingInstallerWatchInvoke();
|
|
174040
|
+
},
|
|
174041
|
+
1 /* Recursive */,
|
|
174042
|
+
this.projectService.getWatchOptions(this),
|
|
174043
|
+
WatchType.TypingInstallerLocationDirectory,
|
|
174044
|
+
this
|
|
174045
|
+
)
|
|
174046
|
+
);
|
|
174047
|
+
}
|
|
174048
|
+
};
|
|
174049
|
+
for (const file of files) {
|
|
174050
|
+
const basename = getBaseFileName(file);
|
|
174051
|
+
if (basename === "package.json" || basename === "bower.json") {
|
|
174052
|
+
createProjectWatcher(file, "FileWatcher" /* FileWatcher */);
|
|
174053
|
+
continue;
|
|
174054
|
+
}
|
|
174055
|
+
if (containsPath(this.currentDirectory, file, this.currentDirectory, !this.useCaseSensitiveFileNames())) {
|
|
174056
|
+
const subDirectory = file.indexOf(directorySeparator, this.currentDirectory.length + 1);
|
|
174057
|
+
if (subDirectory !== -1) {
|
|
174058
|
+
createProjectWatcher(file.substr(0, subDirectory), "DirectoryWatcher" /* DirectoryWatcher */);
|
|
174059
|
+
} else {
|
|
174060
|
+
createProjectWatcher(file, "DirectoryWatcher" /* DirectoryWatcher */);
|
|
174061
|
+
}
|
|
174062
|
+
continue;
|
|
174063
|
+
}
|
|
174064
|
+
if (containsPath(this.projectService.typingsInstaller.globalTypingsCacheLocation, file, this.currentDirectory, !this.useCaseSensitiveFileNames())) {
|
|
174065
|
+
createProjectWatcher(this.projectService.typingsInstaller.globalTypingsCacheLocation, "DirectoryWatcher" /* DirectoryWatcher */);
|
|
174066
|
+
continue;
|
|
174067
|
+
}
|
|
174068
|
+
createProjectWatcher(file, "DirectoryWatcher" /* DirectoryWatcher */);
|
|
174069
|
+
}
|
|
174070
|
+
toRemove.forEach((watch, path) => {
|
|
174071
|
+
watch.close();
|
|
174072
|
+
this.typingWatchers.delete(path);
|
|
174073
|
+
});
|
|
174074
|
+
}
|
|
174075
|
+
/** @internal */
|
|
174042
174076
|
getCurrentProgram() {
|
|
174043
174077
|
return this.program;
|
|
174044
174078
|
}
|
|
@@ -175603,7 +175637,7 @@ function forEachReferencedProject(project, cb) {
|
|
|
175603
175637
|
(potentialProjectRef) => callbackRefProject(project, cb, potentialProjectRef)
|
|
175604
175638
|
);
|
|
175605
175639
|
}
|
|
175606
|
-
function
|
|
175640
|
+
function getDetailWatchInfo(watchType, project) {
|
|
175607
175641
|
return `${isString(project) ? `Config: ${project} ` : project ? `Project: ${project.getProjectName()} ` : ""}WatchType: ${watchType}`;
|
|
175608
175642
|
}
|
|
175609
175643
|
function isScriptInfoWatchedFromNodeModules(info) {
|
|
@@ -175749,7 +175783,7 @@ var _ProjectService = class {
|
|
|
175749
175783
|
this.watchFactory = this.serverMode !== 0 /* Semantic */ ? {
|
|
175750
175784
|
watchFile: returnNoopFileWatcher,
|
|
175751
175785
|
watchDirectory: returnNoopFileWatcher
|
|
175752
|
-
} : getWatchFactory(this.host, watchLogLevel, log,
|
|
175786
|
+
} : getWatchFactory(this.host, watchLogLevel, log, getDetailWatchInfo);
|
|
175753
175787
|
}
|
|
175754
175788
|
toPath(fileName) {
|
|
175755
175789
|
return toPath(fileName, this.currentDirectory, this.toCanonicalFileName);
|
|
@@ -175835,6 +175869,11 @@ var _ProjectService = class {
|
|
|
175835
175869
|
}
|
|
175836
175870
|
}
|
|
175837
175871
|
/** @internal */
|
|
175872
|
+
watchTypingLocations(response) {
|
|
175873
|
+
var _a;
|
|
175874
|
+
(_a = this.findProject(response.projectName)) == null ? void 0 : _a.watchTypingLocations(response.files);
|
|
175875
|
+
}
|
|
175876
|
+
/** @internal */
|
|
175838
175877
|
delayEnsureProjectForOpenFiles() {
|
|
175839
175878
|
if (!this.openFiles.size)
|
|
175840
175879
|
return;
|
|
@@ -182794,6 +182833,7 @@ __export(ts_server_exports4, {
|
|
|
182794
182833
|
ActionInvalidate: () => ActionInvalidate,
|
|
182795
182834
|
ActionPackageInstalled: () => ActionPackageInstalled,
|
|
182796
182835
|
ActionSet: () => ActionSet,
|
|
182836
|
+
ActionWatchTypingLocations: () => ActionWatchTypingLocations,
|
|
182797
182837
|
Arguments: () => Arguments,
|
|
182798
182838
|
AutoImportProviderProject: () => AutoImportProviderProject,
|
|
182799
182839
|
CharRangeSection: () => CharRangeSection,
|
|
@@ -183405,6 +183445,9 @@ function startNodeSession(options, logger, cancellationToken) {
|
|
|
183405
183445
|
this.event(response, "setTypings");
|
|
183406
183446
|
break;
|
|
183407
183447
|
}
|
|
183448
|
+
case ActionWatchTypingLocations:
|
|
183449
|
+
this.projectService.watchTypingLocations(response);
|
|
183450
|
+
break;
|
|
183408
183451
|
default:
|
|
183409
183452
|
assertType(response);
|
|
183410
183453
|
}
|