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/typescript.js
CHANGED
|
@@ -35,7 +35,7 @@ var ts = (() => {
|
|
|
35
35
|
"src/compiler/corePublic.ts"() {
|
|
36
36
|
"use strict";
|
|
37
37
|
versionMajorMinor = "5.1";
|
|
38
|
-
version = `${versionMajorMinor}.0-dev.
|
|
38
|
+
version = `${versionMajorMinor}.0-dev.20230427`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -51715,7 +51715,7 @@ ${lanes.join("\n")}
|
|
|
51715
51715
|
if (symbol.flags & 524288 /* TypeAlias */) {
|
|
51716
51716
|
serializeTypeAlias(symbol, symbolName2, modifierFlags);
|
|
51717
51717
|
}
|
|
51718
|
-
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) {
|
|
51718
|
+
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) {
|
|
51719
51719
|
if (propertyAsAlias) {
|
|
51720
51720
|
const createdExport = serializeMaybeAliasAssignment(symbol);
|
|
51721
51721
|
if (createdExport) {
|
|
@@ -56982,16 +56982,16 @@ ${lanes.join("\n")}
|
|
|
56982
56982
|
if (declaration.kind === 175 /* Constructor */) {
|
|
56983
56983
|
return getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol));
|
|
56984
56984
|
}
|
|
56985
|
+
const typeNode = getEffectiveReturnTypeNode(declaration);
|
|
56985
56986
|
if (isJSDocSignature(declaration)) {
|
|
56986
56987
|
const root = getJSDocRoot(declaration);
|
|
56987
|
-
if (root && isConstructorDeclaration(root.parent)) {
|
|
56988
|
+
if (root && isConstructorDeclaration(root.parent) && !typeNode) {
|
|
56988
56989
|
return getDeclaredTypeOfClassOrInterface(getMergedSymbol(root.parent.parent.symbol));
|
|
56989
56990
|
}
|
|
56990
56991
|
}
|
|
56991
56992
|
if (isJSDocConstructSignature(declaration)) {
|
|
56992
56993
|
return getTypeFromTypeNode(declaration.parameters[0].type);
|
|
56993
56994
|
}
|
|
56994
|
-
const typeNode = getEffectiveReturnTypeNode(declaration);
|
|
56995
56995
|
if (typeNode) {
|
|
56996
56996
|
return getTypeFromTypeNode(typeNode);
|
|
56997
56997
|
}
|
|
@@ -69418,6 +69418,7 @@ ${lanes.join("\n")}
|
|
|
69418
69418
|
);
|
|
69419
69419
|
}
|
|
69420
69420
|
function discriminateContextualTypeByJSXAttributes(node, contextualType) {
|
|
69421
|
+
const jsxChildrenPropertyName = getJsxElementChildrenPropertyName(getJsxNamespaceAt(node));
|
|
69421
69422
|
return discriminateTypeByDiscriminableItems(
|
|
69422
69423
|
contextualType,
|
|
69423
69424
|
concatenate(
|
|
@@ -69428,7 +69429,14 @@ ${lanes.join("\n")}
|
|
|
69428
69429
|
map(
|
|
69429
69430
|
filter(getPropertiesOfType(contextualType), (s) => {
|
|
69430
69431
|
var _a;
|
|
69431
|
-
|
|
69432
|
+
if (!(s.flags & 16777216 /* Optional */) || !((_a = node == null ? void 0 : node.symbol) == null ? void 0 : _a.members)) {
|
|
69433
|
+
return false;
|
|
69434
|
+
}
|
|
69435
|
+
const element = node.parent.parent;
|
|
69436
|
+
if (s.escapedName === jsxChildrenPropertyName && isJsxElement(element) && getSemanticJsxChildren(element.children).length) {
|
|
69437
|
+
return false;
|
|
69438
|
+
}
|
|
69439
|
+
return !node.symbol.members.has(s.escapedName) && isDiscriminantProperty(contextualType, s.escapedName);
|
|
69432
69440
|
}),
|
|
69433
69441
|
(s) => [() => undefinedType, s.escapedName]
|
|
69434
69442
|
)
|
|
@@ -106319,6 +106327,8 @@ ${lanes.join("\n")}
|
|
|
106319
106327
|
return visitLabeledStatement(node);
|
|
106320
106328
|
case 253 /* WithStatement */:
|
|
106321
106329
|
return visitWithStatement(node);
|
|
106330
|
+
case 244 /* IfStatement */:
|
|
106331
|
+
return visitIfStatement(node);
|
|
106322
106332
|
case 254 /* SwitchStatement */:
|
|
106323
106333
|
return visitSwitchStatement(node);
|
|
106324
106334
|
case 268 /* CaseBlock */:
|
|
@@ -106424,6 +106434,14 @@ ${lanes.join("\n")}
|
|
|
106424
106434
|
Debug.checkDefined(visitNode(node.statement, topLevelNestedVisitor, isStatement, factory2.liftToBlock))
|
|
106425
106435
|
);
|
|
106426
106436
|
}
|
|
106437
|
+
function visitIfStatement(node) {
|
|
106438
|
+
return factory2.updateIfStatement(
|
|
106439
|
+
node,
|
|
106440
|
+
visitNode(node.expression, visitor, isExpression),
|
|
106441
|
+
Debug.checkDefined(visitNode(node.thenStatement, topLevelNestedVisitor, isStatement, factory2.liftToBlock)),
|
|
106442
|
+
visitNode(node.elseStatement, topLevelNestedVisitor, isStatement, factory2.liftToBlock)
|
|
106443
|
+
);
|
|
106444
|
+
}
|
|
106427
106445
|
function visitSwitchStatement(node) {
|
|
106428
106446
|
return factory2.updateSwitchStatement(
|
|
106429
106447
|
node,
|
|
@@ -122891,7 +122909,9 @@ ${lanes.join("\n")}
|
|
|
122891
122909
|
MissingSourceMapFile: "Missing source map file",
|
|
122892
122910
|
NoopConfigFileForInferredRoot: "Noop Config file for the inferred project root",
|
|
122893
122911
|
MissingGeneratedFile: "Missing generated file",
|
|
122894
|
-
NodeModulesForModuleSpecifierCache: "node_modules for module specifier cache invalidation"
|
|
122912
|
+
NodeModulesForModuleSpecifierCache: "node_modules for module specifier cache invalidation",
|
|
122913
|
+
TypingInstallerLocationFile: "File location for typing installer",
|
|
122914
|
+
TypingInstallerLocationDirectory: "Directory location for typing installer"
|
|
122895
122915
|
};
|
|
122896
122916
|
}
|
|
122897
122917
|
});
|
|
@@ -126108,7 +126128,7 @@ ${lanes.join("\n")}
|
|
|
126108
126128
|
const d = /* @__PURE__ */ new Date();
|
|
126109
126129
|
return `${padLeft(d.getHours().toString(), 2, "0")}:${padLeft(d.getMinutes().toString(), 2, "0")}:${padLeft(d.getSeconds().toString(), 2, "0")}.${padLeft(d.getMilliseconds().toString(), 3, "0")}`;
|
|
126110
126130
|
}
|
|
126111
|
-
var ActionSet, ActionInvalidate, ActionPackageInstalled, EventTypesRegistry, EventBeginInstallTypes, EventEndInstallTypes, EventInitializationFailed, Arguments;
|
|
126131
|
+
var ActionSet, ActionInvalidate, ActionPackageInstalled, EventTypesRegistry, EventBeginInstallTypes, EventEndInstallTypes, EventInitializationFailed, ActionWatchTypingLocations, Arguments;
|
|
126112
126132
|
var init_shared = __esm({
|
|
126113
126133
|
"src/jsTyping/shared.ts"() {
|
|
126114
126134
|
"use strict";
|
|
@@ -126120,6 +126140,7 @@ ${lanes.join("\n")}
|
|
|
126120
126140
|
EventBeginInstallTypes = "event::beginInstallTypes";
|
|
126121
126141
|
EventEndInstallTypes = "event::endInstallTypes";
|
|
126122
126142
|
EventInitializationFailed = "event::initializationFailed";
|
|
126143
|
+
ActionWatchTypingLocations = "action::watchTypingLocations";
|
|
126123
126144
|
((Arguments2) => {
|
|
126124
126145
|
Arguments2.GlobalCacheLocation = "--globalTypingsCacheLocation";
|
|
126125
126146
|
Arguments2.LogFile = "--logFile";
|
|
@@ -126145,6 +126166,7 @@ ${lanes.join("\n")}
|
|
|
126145
126166
|
ActionInvalidate: () => ActionInvalidate,
|
|
126146
126167
|
ActionPackageInstalled: () => ActionPackageInstalled,
|
|
126147
126168
|
ActionSet: () => ActionSet,
|
|
126169
|
+
ActionWatchTypingLocations: () => ActionWatchTypingLocations,
|
|
126148
126170
|
Arguments: () => Arguments,
|
|
126149
126171
|
EventBeginInstallTypes: () => EventBeginInstallTypes,
|
|
126150
126172
|
EventEndInstallTypes: () => EventEndInstallTypes,
|
package/lib/typingsInstaller.js
CHANGED
|
@@ -54,7 +54,7 @@ var path = __toESM(require("path"));
|
|
|
54
54
|
|
|
55
55
|
// src/compiler/corePublic.ts
|
|
56
56
|
var versionMajorMinor = "5.1";
|
|
57
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
57
|
+
var version = `${versionMajorMinor}.0-dev.20230427`;
|
|
58
58
|
|
|
59
59
|
// src/compiler/core.ts
|
|
60
60
|
var emptyArray = [];
|
|
@@ -3689,9 +3689,6 @@ var curSysLog = noop;
|
|
|
3689
3689
|
function sysLog(s) {
|
|
3690
3690
|
return curSysLog(s);
|
|
3691
3691
|
}
|
|
3692
|
-
function setSysLog(logger) {
|
|
3693
|
-
curSysLog = logger;
|
|
3694
|
-
}
|
|
3695
3692
|
function createDirectoryWatcherSupportingRecursive({
|
|
3696
3693
|
watchDirectory,
|
|
3697
3694
|
useCaseSensitiveFileNames,
|
|
@@ -10005,10 +10002,15 @@ function createSingleLineStringWriter() {
|
|
|
10005
10002
|
clear: () => str = ""
|
|
10006
10003
|
};
|
|
10007
10004
|
}
|
|
10008
|
-
function
|
|
10009
|
-
|
|
10010
|
-
|
|
10011
|
-
|
|
10005
|
+
function forEachKey(map2, callback) {
|
|
10006
|
+
const iterator = map2.keys();
|
|
10007
|
+
for (const key of iterator) {
|
|
10008
|
+
const result = callback(key);
|
|
10009
|
+
if (result) {
|
|
10010
|
+
return result;
|
|
10011
|
+
}
|
|
10012
|
+
}
|
|
10013
|
+
return void 0;
|
|
10012
10014
|
}
|
|
10013
10015
|
function getFullWidth(node) {
|
|
10014
10016
|
return node.end - node.pos;
|
|
@@ -10969,10 +10971,6 @@ function directoryProbablyExists(directoryName, host) {
|
|
|
10969
10971
|
function closeFileWatcher(watcher) {
|
|
10970
10972
|
watcher.close();
|
|
10971
10973
|
}
|
|
10972
|
-
function clearMap(map2, onDeleteValue) {
|
|
10973
|
-
map2.forEach(onDeleteValue);
|
|
10974
|
-
map2.clear();
|
|
10975
|
-
}
|
|
10976
10974
|
function getLastChild(node) {
|
|
10977
10975
|
let lastChild;
|
|
10978
10976
|
forEachChild(
|
|
@@ -30464,104 +30462,6 @@ function createBracketsMap() {
|
|
|
30464
30462
|
}
|
|
30465
30463
|
|
|
30466
30464
|
// src/compiler/watchUtilities.ts
|
|
30467
|
-
function getWatchFactory(host, watchLogLevel, log2, getDetailWatchInfo2) {
|
|
30468
|
-
setSysLog(watchLogLevel === 2 /* Verbose */ ? log2 : noop);
|
|
30469
|
-
const plainInvokeFactory = {
|
|
30470
|
-
watchFile: (file, callback, pollingInterval, options) => host.watchFile(file, callback, pollingInterval, options),
|
|
30471
|
-
watchDirectory: (directory, callback, flags, options) => host.watchDirectory(directory, callback, (flags & 1 /* Recursive */) !== 0, options)
|
|
30472
|
-
};
|
|
30473
|
-
const triggerInvokingFactory = watchLogLevel !== 0 /* None */ ? {
|
|
30474
|
-
watchFile: createTriggerLoggingAddWatch("watchFile"),
|
|
30475
|
-
watchDirectory: createTriggerLoggingAddWatch("watchDirectory")
|
|
30476
|
-
} : void 0;
|
|
30477
|
-
const factory2 = watchLogLevel === 2 /* Verbose */ ? {
|
|
30478
|
-
watchFile: createFileWatcherWithLogging,
|
|
30479
|
-
watchDirectory: createDirectoryWatcherWithLogging
|
|
30480
|
-
} : triggerInvokingFactory || plainInvokeFactory;
|
|
30481
|
-
const excludeWatcherFactory = watchLogLevel === 2 /* Verbose */ ? createExcludeWatcherWithLogging : returnNoopFileWatcher;
|
|
30482
|
-
return {
|
|
30483
|
-
watchFile: createExcludeHandlingAddWatch("watchFile"),
|
|
30484
|
-
watchDirectory: createExcludeHandlingAddWatch("watchDirectory")
|
|
30485
|
-
};
|
|
30486
|
-
function createExcludeHandlingAddWatch(key) {
|
|
30487
|
-
return (file, cb, flags, options, detailInfo1, detailInfo2) => {
|
|
30488
|
-
var _a;
|
|
30489
|
-
return !matchesExclude(file, key === "watchFile" ? options == null ? void 0 : options.excludeFiles : options == null ? void 0 : options.excludeDirectories, useCaseSensitiveFileNames(), ((_a = host.getCurrentDirectory) == null ? void 0 : _a.call(host)) || "") ? factory2[key].call(
|
|
30490
|
-
/*thisArgs*/
|
|
30491
|
-
void 0,
|
|
30492
|
-
file,
|
|
30493
|
-
cb,
|
|
30494
|
-
flags,
|
|
30495
|
-
options,
|
|
30496
|
-
detailInfo1,
|
|
30497
|
-
detailInfo2
|
|
30498
|
-
) : excludeWatcherFactory(file, flags, options, detailInfo1, detailInfo2);
|
|
30499
|
-
};
|
|
30500
|
-
}
|
|
30501
|
-
function useCaseSensitiveFileNames() {
|
|
30502
|
-
return typeof host.useCaseSensitiveFileNames === "boolean" ? host.useCaseSensitiveFileNames : host.useCaseSensitiveFileNames();
|
|
30503
|
-
}
|
|
30504
|
-
function createExcludeWatcherWithLogging(file, flags, options, detailInfo1, detailInfo2) {
|
|
30505
|
-
log2(`ExcludeWatcher:: Added:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`);
|
|
30506
|
-
return {
|
|
30507
|
-
close: () => log2(`ExcludeWatcher:: Close:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`)
|
|
30508
|
-
};
|
|
30509
|
-
}
|
|
30510
|
-
function createFileWatcherWithLogging(file, cb, flags, options, detailInfo1, detailInfo2) {
|
|
30511
|
-
log2(`FileWatcher:: Added:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`);
|
|
30512
|
-
const watcher = triggerInvokingFactory.watchFile(file, cb, flags, options, detailInfo1, detailInfo2);
|
|
30513
|
-
return {
|
|
30514
|
-
close: () => {
|
|
30515
|
-
log2(`FileWatcher:: Close:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`);
|
|
30516
|
-
watcher.close();
|
|
30517
|
-
}
|
|
30518
|
-
};
|
|
30519
|
-
}
|
|
30520
|
-
function createDirectoryWatcherWithLogging(file, cb, flags, options, detailInfo1, detailInfo2) {
|
|
30521
|
-
const watchInfo = `DirectoryWatcher:: Added:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`;
|
|
30522
|
-
log2(watchInfo);
|
|
30523
|
-
const start = timestamp();
|
|
30524
|
-
const watcher = triggerInvokingFactory.watchDirectory(file, cb, flags, options, detailInfo1, detailInfo2);
|
|
30525
|
-
const elapsed = timestamp() - start;
|
|
30526
|
-
log2(`Elapsed:: ${elapsed}ms ${watchInfo}`);
|
|
30527
|
-
return {
|
|
30528
|
-
close: () => {
|
|
30529
|
-
const watchInfo2 = `DirectoryWatcher:: Close:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`;
|
|
30530
|
-
log2(watchInfo2);
|
|
30531
|
-
const start2 = timestamp();
|
|
30532
|
-
watcher.close();
|
|
30533
|
-
const elapsed2 = timestamp() - start2;
|
|
30534
|
-
log2(`Elapsed:: ${elapsed2}ms ${watchInfo2}`);
|
|
30535
|
-
}
|
|
30536
|
-
};
|
|
30537
|
-
}
|
|
30538
|
-
function createTriggerLoggingAddWatch(key) {
|
|
30539
|
-
return (file, cb, flags, options, detailInfo1, detailInfo2) => plainInvokeFactory[key].call(
|
|
30540
|
-
/*thisArgs*/
|
|
30541
|
-
void 0,
|
|
30542
|
-
file,
|
|
30543
|
-
(...args) => {
|
|
30544
|
-
const triggerredInfo = `${key === "watchFile" ? "FileWatcher" : "DirectoryWatcher"}:: Triggered with ${args[0]} ${args[1] !== void 0 ? args[1] : ""}:: ${getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo2)}`;
|
|
30545
|
-
log2(triggerredInfo);
|
|
30546
|
-
const start = timestamp();
|
|
30547
|
-
cb.call(
|
|
30548
|
-
/*thisArg*/
|
|
30549
|
-
void 0,
|
|
30550
|
-
...args
|
|
30551
|
-
);
|
|
30552
|
-
const elapsed = timestamp() - start;
|
|
30553
|
-
log2(`Elapsed:: ${elapsed}ms ${triggerredInfo}`);
|
|
30554
|
-
},
|
|
30555
|
-
flags,
|
|
30556
|
-
options,
|
|
30557
|
-
detailInfo1,
|
|
30558
|
-
detailInfo2
|
|
30559
|
-
);
|
|
30560
|
-
}
|
|
30561
|
-
function getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo3) {
|
|
30562
|
-
return `WatchInfo: ${file} ${flags} ${JSON.stringify(options)} ${getDetailWatchInfo3 ? getDetailWatchInfo3(detailInfo1, detailInfo2) : detailInfo2 === void 0 ? detailInfo1 : `${detailInfo1} ${detailInfo2}`}`;
|
|
30563
|
-
}
|
|
30564
|
-
}
|
|
30565
30465
|
function getFallbackOptions(options) {
|
|
30566
30466
|
const fallbackPolling = options == null ? void 0 : options.fallbackPolling;
|
|
30567
30467
|
return {
|
|
@@ -31140,8 +31040,6 @@ var screenStartingMessageCodes = [
|
|
|
31140
31040
|
Diagnostics.Starting_compilation_in_watch_mode.code,
|
|
31141
31041
|
Diagnostics.File_change_detected_Starting_incremental_compilation.code
|
|
31142
31042
|
];
|
|
31143
|
-
var noopFileWatcher = { close: noop };
|
|
31144
|
-
var returnNoopFileWatcher = () => noopFileWatcher;
|
|
31145
31043
|
|
|
31146
31044
|
// src/jsTyping/_namespaces/ts.JsTyping.ts
|
|
31147
31045
|
var ts_JsTyping_exports = {};
|
|
@@ -31466,11 +31364,11 @@ function renderPackageNameValidationFailureWorker(typing, result, name, isScopeN
|
|
|
31466
31364
|
|
|
31467
31365
|
// src/jsTyping/shared.ts
|
|
31468
31366
|
var ActionSet = "action::set";
|
|
31469
|
-
var ActionInvalidate = "action::invalidate";
|
|
31470
31367
|
var ActionPackageInstalled = "action::packageInstalled";
|
|
31471
31368
|
var EventTypesRegistry = "event::typesRegistry";
|
|
31472
31369
|
var EventBeginInstallTypes = "event::beginInstallTypes";
|
|
31473
31370
|
var EventEndInstallTypes = "event::endInstallTypes";
|
|
31371
|
+
var ActionWatchTypingLocations = "action::watchTypingLocations";
|
|
31474
31372
|
var Arguments;
|
|
31475
31373
|
((Arguments2) => {
|
|
31476
31374
|
Arguments2.GlobalCacheLocation = "--globalTypingsCacheLocation";
|
|
@@ -31530,19 +31428,6 @@ function getNpmCommandForInstallation(npmPath, tsVersion, packageNames, remainin
|
|
|
31530
31428
|
}
|
|
31531
31429
|
return { command, remaining: remaining - toSlice };
|
|
31532
31430
|
}
|
|
31533
|
-
function endsWith2(str, suffix, caseSensitive) {
|
|
31534
|
-
const expectedPos = str.length - suffix.length;
|
|
31535
|
-
return expectedPos >= 0 && (str.indexOf(suffix, expectedPos) === expectedPos || !caseSensitive && compareStringsCaseInsensitive(str.substr(expectedPos), suffix) === 0 /* EqualTo */);
|
|
31536
|
-
}
|
|
31537
|
-
function isPackageOrBowerJson(fileName, caseSensitive) {
|
|
31538
|
-
return endsWith2(fileName, "/package.json", caseSensitive) || endsWith2(fileName, "/bower.json", caseSensitive);
|
|
31539
|
-
}
|
|
31540
|
-
function sameFiles(a, b, caseSensitive) {
|
|
31541
|
-
return a === b || !caseSensitive && compareStringsCaseInsensitive(a, b) === 0 /* EqualTo */;
|
|
31542
|
-
}
|
|
31543
|
-
function getDetailWatchInfo(projectName, watchers) {
|
|
31544
|
-
return `Project: ${projectName} watcher already invoked: ${watchers == null ? void 0 : watchers.isInvoked}`;
|
|
31545
|
-
}
|
|
31546
31431
|
var TypingsInstaller = class {
|
|
31547
31432
|
constructor(installTypingHost, globalCachePath, safeListPath, typesMapLocation2, throttleLimit, log2 = nullLog) {
|
|
31548
31433
|
this.installTypingHost = installTypingHost;
|
|
@@ -31560,13 +31445,10 @@ var TypingsInstaller = class {
|
|
|
31560
31445
|
this.installRunCount = 1;
|
|
31561
31446
|
this.inFlightRequestCount = 0;
|
|
31562
31447
|
this.latestDistTag = "latest";
|
|
31563
|
-
this.toCanonicalFileName = createGetCanonicalFileName(installTypingHost.useCaseSensitiveFileNames);
|
|
31564
|
-
this.globalCachePackageJsonPath = combinePaths(globalCachePath, "package.json");
|
|
31565
31448
|
const isLoggingEnabled = this.log.isEnabled();
|
|
31566
31449
|
if (isLoggingEnabled) {
|
|
31567
31450
|
this.log.writeLine(`Global cache location '${globalCachePath}', safe file path '${safeListPath}', types map path ${typesMapLocation2}`);
|
|
31568
31451
|
}
|
|
31569
|
-
this.watchFactory = getWatchFactory(this.installTypingHost, isLoggingEnabled ? 2 /* Verbose */ : 0 /* None */, (s) => this.log.writeLine(s), getDetailWatchInfo);
|
|
31570
31452
|
this.processCacheLocation(this.globalCachePath);
|
|
31571
31453
|
}
|
|
31572
31454
|
closeProject(req) {
|
|
@@ -31583,8 +31465,8 @@ var TypingsInstaller = class {
|
|
|
31583
31465
|
}
|
|
31584
31466
|
return;
|
|
31585
31467
|
}
|
|
31586
|
-
clearMap(watchers, closeFileWatcher);
|
|
31587
31468
|
this.projectWatchers.delete(projectName);
|
|
31469
|
+
this.sendResponse({ kind: ActionWatchTypingLocations, projectName, files: [] });
|
|
31588
31470
|
if (this.log.isEnabled()) {
|
|
31589
31471
|
this.log.writeLine(`Closing file watchers for project '${projectName}' - done.`);
|
|
31590
31472
|
}
|
|
@@ -31617,7 +31499,7 @@ var TypingsInstaller = class {
|
|
|
31617
31499
|
if (this.log.isEnabled()) {
|
|
31618
31500
|
this.log.writeLine(`Finished typings discovery: ${JSON.stringify(discoverTypingsResult)}`);
|
|
31619
31501
|
}
|
|
31620
|
-
this.watchFiles(req.projectName, discoverTypingsResult.filesToWatch
|
|
31502
|
+
this.watchFiles(req.projectName, discoverTypingsResult.filesToWatch);
|
|
31621
31503
|
if (discoverTypingsResult.newTypingNames.length) {
|
|
31622
31504
|
this.installTypings(req, req.cachePath || this.globalCachePath, discoverTypingsResult.cachedTypingPaths, discoverTypingsResult.newTypingNames);
|
|
31623
31505
|
} else {
|
|
@@ -31818,75 +31700,19 @@ var TypingsInstaller = class {
|
|
|
31818
31700
|
host.createDirectory(directory);
|
|
31819
31701
|
}
|
|
31820
31702
|
}
|
|
31821
|
-
watchFiles(projectName, files
|
|
31703
|
+
watchFiles(projectName, files) {
|
|
31822
31704
|
if (!files.length) {
|
|
31823
31705
|
this.closeWatchers(projectName);
|
|
31824
31706
|
return;
|
|
31825
31707
|
}
|
|
31826
|
-
|
|
31827
|
-
const
|
|
31828
|
-
if (!
|
|
31829
|
-
|
|
31830
|
-
this.
|
|
31708
|
+
const existing = this.projectWatchers.get(projectName);
|
|
31709
|
+
const newSet = new Set(files);
|
|
31710
|
+
if (!existing || forEachKey(newSet, (s) => !existing.has(s)) || forEachKey(existing, (s) => !newSet.has(s))) {
|
|
31711
|
+
this.projectWatchers.set(projectName, newSet);
|
|
31712
|
+
this.sendResponse({ kind: ActionWatchTypingLocations, projectName, files });
|
|
31831
31713
|
} else {
|
|
31832
|
-
|
|
31833
|
-
}
|
|
31834
|
-
watchers.isInvoked = false;
|
|
31835
|
-
const isLoggingEnabled = this.log.isEnabled();
|
|
31836
|
-
const createProjectWatcher = (path2, projectWatcherType) => {
|
|
31837
|
-
const canonicalPath = this.toCanonicalFileName(path2);
|
|
31838
|
-
toRemove.delete(canonicalPath);
|
|
31839
|
-
if (watchers.has(canonicalPath)) {
|
|
31840
|
-
return;
|
|
31841
|
-
}
|
|
31842
|
-
if (isLoggingEnabled) {
|
|
31843
|
-
this.log.writeLine(`${projectWatcherType}:: Added:: WatchInfo: ${path2}`);
|
|
31844
|
-
}
|
|
31845
|
-
const watcher = projectWatcherType === "FileWatcher" /* FileWatcher */ ? this.watchFactory.watchFile(path2, () => {
|
|
31846
|
-
if (!watchers.isInvoked) {
|
|
31847
|
-
watchers.isInvoked = true;
|
|
31848
|
-
this.sendResponse({ projectName, kind: ActionInvalidate });
|
|
31849
|
-
}
|
|
31850
|
-
}, 2e3 /* High */, options, projectName, watchers) : this.watchFactory.watchDirectory(path2, (f) => {
|
|
31851
|
-
if (watchers.isInvoked || !fileExtensionIs(f, ".json" /* Json */)) {
|
|
31852
|
-
return;
|
|
31853
|
-
}
|
|
31854
|
-
if (isPackageOrBowerJson(f, this.installTypingHost.useCaseSensitiveFileNames) && !sameFiles(f, this.globalCachePackageJsonPath, this.installTypingHost.useCaseSensitiveFileNames)) {
|
|
31855
|
-
watchers.isInvoked = true;
|
|
31856
|
-
this.sendResponse({ projectName, kind: ActionInvalidate });
|
|
31857
|
-
}
|
|
31858
|
-
}, 1 /* Recursive */, options, projectName, watchers);
|
|
31859
|
-
watchers.set(canonicalPath, isLoggingEnabled ? {
|
|
31860
|
-
close: () => {
|
|
31861
|
-
this.log.writeLine(`${projectWatcherType}:: Closed:: WatchInfo: ${path2}`);
|
|
31862
|
-
watcher.close();
|
|
31863
|
-
}
|
|
31864
|
-
} : watcher);
|
|
31865
|
-
};
|
|
31866
|
-
for (const file of files) {
|
|
31867
|
-
if (file.endsWith("/package.json") || file.endsWith("/bower.json")) {
|
|
31868
|
-
createProjectWatcher(file, "FileWatcher" /* FileWatcher */);
|
|
31869
|
-
continue;
|
|
31870
|
-
}
|
|
31871
|
-
if (containsPath(projectRootPath, file, projectRootPath, !this.installTypingHost.useCaseSensitiveFileNames)) {
|
|
31872
|
-
const subDirectory = file.indexOf(directorySeparator, projectRootPath.length + 1);
|
|
31873
|
-
if (subDirectory !== -1) {
|
|
31874
|
-
createProjectWatcher(file.substr(0, subDirectory), "DirectoryWatcher" /* DirectoryWatcher */);
|
|
31875
|
-
} else {
|
|
31876
|
-
createProjectWatcher(file, "DirectoryWatcher" /* DirectoryWatcher */);
|
|
31877
|
-
}
|
|
31878
|
-
continue;
|
|
31879
|
-
}
|
|
31880
|
-
if (containsPath(this.globalCachePath, file, projectRootPath, !this.installTypingHost.useCaseSensitiveFileNames)) {
|
|
31881
|
-
createProjectWatcher(this.globalCachePath, "DirectoryWatcher" /* DirectoryWatcher */);
|
|
31882
|
-
continue;
|
|
31883
|
-
}
|
|
31884
|
-
createProjectWatcher(file, "DirectoryWatcher" /* DirectoryWatcher */);
|
|
31714
|
+
this.sendResponse({ kind: ActionWatchTypingLocations, projectName, files: void 0 });
|
|
31885
31715
|
}
|
|
31886
|
-
toRemove.forEach((watch, path2) => {
|
|
31887
|
-
watch.close();
|
|
31888
|
-
watchers.delete(path2);
|
|
31889
|
-
});
|
|
31890
31716
|
}
|
|
31891
31717
|
createSetTypings(request, typings) {
|
|
31892
31718
|
return {
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "typescript",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "5.1.0-dev.
|
|
5
|
+
"version": "5.1.0-dev.20230427",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|
|
@@ -115,5 +115,5 @@
|
|
|
115
115
|
"node": "14.21.1",
|
|
116
116
|
"npm": "8.19.3"
|
|
117
117
|
},
|
|
118
|
-
"gitHead": "
|
|
118
|
+
"gitHead": "157753520520fd0936bff280de30af56e15f94ee"
|
|
119
119
|
}
|