@typescript-deploys/pr-build 5.4.0-pr-56358-23 → 5.4.0-pr-56404-7
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/tsc.js +14 -9
- package/lib/tsserver.js +241 -181
- package/lib/typescript.js +232 -11
- package/lib/typingsInstaller.js +32 -25
- package/package.json +2 -2
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.4";
|
|
21
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
21
|
+
var version = `${versionMajorMinor}.0-insiders.20231115`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -31217,6 +31217,9 @@ var Parser;
|
|
|
31217
31217
|
function nextTokenIsStringLiteral() {
|
|
31218
31218
|
return nextToken() === 11 /* StringLiteral */;
|
|
31219
31219
|
}
|
|
31220
|
+
function nextTokenIsFromKeyword() {
|
|
31221
|
+
return nextToken() === 161 /* FromKeyword */;
|
|
31222
|
+
}
|
|
31220
31223
|
function nextTokenIsIdentifierOrStringLiteralOnSameLine() {
|
|
31221
31224
|
nextToken();
|
|
31222
31225
|
return !scanner.hasPrecedingLineBreak() && (isIdentifier2() || token() === 11 /* StringLiteral */);
|
|
@@ -31912,7 +31915,7 @@ var Parser;
|
|
|
31912
31915
|
identifier = parseIdentifier();
|
|
31913
31916
|
}
|
|
31914
31917
|
let isTypeOnly = false;
|
|
31915
|
-
if (
|
|
31918
|
+
if ((identifier == null ? void 0 : identifier.escapedText) === "type" && (token() !== 161 /* FromKeyword */ || isIdentifier2() && lookAhead(nextTokenIsFromKeyword)) && (isIdentifier2() || tokenAfterImportDefinitelyProducesImportDeclaration())) {
|
|
31916
31919
|
isTypeOnly = true;
|
|
31917
31920
|
identifier = isIdentifier2() ? parseIdentifier() : void 0;
|
|
31918
31921
|
}
|
|
@@ -48229,13 +48232,15 @@ function createTypeChecker(host) {
|
|
|
48229
48232
|
}
|
|
48230
48233
|
const cachedResult = (_a2 = links == null ? void 0 : links.serializedTypes) == null ? void 0 : _a2.get(key);
|
|
48231
48234
|
if (cachedResult) {
|
|
48232
|
-
(
|
|
48233
|
-
(
|
|
48234
|
-
symbol,
|
|
48235
|
-
|
|
48236
|
-
|
|
48237
|
-
|
|
48238
|
-
|
|
48235
|
+
if (context.trackedSymbols !== cachedResult.trackedSymbols) {
|
|
48236
|
+
(_b2 = cachedResult.trackedSymbols) == null ? void 0 : _b2.forEach(
|
|
48237
|
+
([symbol, enclosingDeclaration, meaning]) => context.tracker.trackSymbol(
|
|
48238
|
+
symbol,
|
|
48239
|
+
enclosingDeclaration,
|
|
48240
|
+
meaning
|
|
48241
|
+
)
|
|
48242
|
+
);
|
|
48243
|
+
}
|
|
48239
48244
|
if (cachedResult.truncating) {
|
|
48240
48245
|
context.truncating = true;
|
|
48241
48246
|
}
|
package/lib/tsserver.js
CHANGED
|
@@ -2330,7 +2330,7 @@ module.exports = __toCommonJS(server_exports);
|
|
|
2330
2330
|
|
|
2331
2331
|
// src/compiler/corePublic.ts
|
|
2332
2332
|
var versionMajorMinor = "5.4";
|
|
2333
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
2333
|
+
var version = `${versionMajorMinor}.0-insiders.20231115`;
|
|
2334
2334
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2335
2335
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2336
2336
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -35625,6 +35625,9 @@ var Parser;
|
|
|
35625
35625
|
function nextTokenIsStringLiteral() {
|
|
35626
35626
|
return nextToken() === 11 /* StringLiteral */;
|
|
35627
35627
|
}
|
|
35628
|
+
function nextTokenIsFromKeyword() {
|
|
35629
|
+
return nextToken() === 161 /* FromKeyword */;
|
|
35630
|
+
}
|
|
35628
35631
|
function nextTokenIsIdentifierOrStringLiteralOnSameLine() {
|
|
35629
35632
|
nextToken();
|
|
35630
35633
|
return !scanner2.hasPrecedingLineBreak() && (isIdentifier2() || token() === 11 /* StringLiteral */);
|
|
@@ -36320,7 +36323,7 @@ var Parser;
|
|
|
36320
36323
|
identifier = parseIdentifier();
|
|
36321
36324
|
}
|
|
36322
36325
|
let isTypeOnly = false;
|
|
36323
|
-
if (
|
|
36326
|
+
if ((identifier == null ? void 0 : identifier.escapedText) === "type" && (token() !== 161 /* FromKeyword */ || isIdentifier2() && lookAhead(nextTokenIsFromKeyword)) && (isIdentifier2() || tokenAfterImportDefinitelyProducesImportDeclaration())) {
|
|
36324
36327
|
isTypeOnly = true;
|
|
36325
36328
|
identifier = isIdentifier2() ? parseIdentifier() : void 0;
|
|
36326
36329
|
}
|
|
@@ -52937,13 +52940,15 @@ function createTypeChecker(host) {
|
|
|
52937
52940
|
}
|
|
52938
52941
|
const cachedResult = (_a2 = links == null ? void 0 : links.serializedTypes) == null ? void 0 : _a2.get(key);
|
|
52939
52942
|
if (cachedResult) {
|
|
52940
|
-
(
|
|
52941
|
-
(
|
|
52942
|
-
symbol,
|
|
52943
|
-
|
|
52944
|
-
|
|
52945
|
-
|
|
52946
|
-
|
|
52943
|
+
if (context.trackedSymbols !== cachedResult.trackedSymbols) {
|
|
52944
|
+
(_b2 = cachedResult.trackedSymbols) == null ? void 0 : _b2.forEach(
|
|
52945
|
+
([symbol, enclosingDeclaration, meaning]) => context.tracker.trackSymbol(
|
|
52946
|
+
symbol,
|
|
52947
|
+
enclosingDeclaration,
|
|
52948
|
+
meaning
|
|
52949
|
+
)
|
|
52950
|
+
);
|
|
52951
|
+
}
|
|
52947
52952
|
if (cachedResult.truncating) {
|
|
52948
52953
|
context.truncating = true;
|
|
52949
52954
|
}
|
|
@@ -161081,6 +161086,11 @@ function getImportStatementCompletionInfo(contextToken, sourceFile) {
|
|
|
161081
161086
|
}
|
|
161082
161087
|
return void 0;
|
|
161083
161088
|
}
|
|
161089
|
+
if (isExportDeclaration(parent2) && contextToken.kind === 42 /* AsteriskToken */ || isNamedExports(parent2) && contextToken.kind === 20 /* CloseBraceToken */) {
|
|
161090
|
+
isKeywordOnlyCompletion = true;
|
|
161091
|
+
keywordCompletion = 161 /* FromKeyword */;
|
|
161092
|
+
return void 0;
|
|
161093
|
+
}
|
|
161084
161094
|
if (isImportKeyword(contextToken) && isSourceFile(parent2)) {
|
|
161085
161095
|
keywordCompletion = 156 /* TypeKeyword */;
|
|
161086
161096
|
return contextToken;
|
|
@@ -175247,6 +175257,7 @@ __export(ts_server_exports3, {
|
|
|
175247
175257
|
TextStorage: () => TextStorage,
|
|
175248
175258
|
ThrottledOperations: () => ThrottledOperations,
|
|
175249
175259
|
TypingsCache: () => TypingsCache,
|
|
175260
|
+
TypingsInstallerAdapter: () => TypingsInstallerAdapter,
|
|
175250
175261
|
allFilesAreJsOrDts: () => allFilesAreJsOrDts,
|
|
175251
175262
|
allRootFilesAreJsOrDts: () => allRootFilesAreJsOrDts,
|
|
175252
175263
|
asNormalizedPath: () => asNormalizedPath,
|
|
@@ -175368,6 +175379,32 @@ var TypingsInstaller = class {
|
|
|
175368
175379
|
}
|
|
175369
175380
|
this.processCacheLocation(this.globalCachePath);
|
|
175370
175381
|
}
|
|
175382
|
+
/** @internal */
|
|
175383
|
+
handleRequest(req) {
|
|
175384
|
+
switch (req.kind) {
|
|
175385
|
+
case "discover":
|
|
175386
|
+
this.install(req);
|
|
175387
|
+
break;
|
|
175388
|
+
case "closeProject":
|
|
175389
|
+
this.closeProject(req);
|
|
175390
|
+
break;
|
|
175391
|
+
case "typesRegistry": {
|
|
175392
|
+
const typesRegistry = {};
|
|
175393
|
+
this.typesRegistry.forEach((value, key) => {
|
|
175394
|
+
typesRegistry[key] = value;
|
|
175395
|
+
});
|
|
175396
|
+
const response = { kind: EventTypesRegistry, typesRegistry };
|
|
175397
|
+
this.sendResponse(response);
|
|
175398
|
+
break;
|
|
175399
|
+
}
|
|
175400
|
+
case "installPackage": {
|
|
175401
|
+
this.installPackage(req);
|
|
175402
|
+
break;
|
|
175403
|
+
}
|
|
175404
|
+
default:
|
|
175405
|
+
Debug.assertNever(req);
|
|
175406
|
+
}
|
|
175407
|
+
}
|
|
175371
175408
|
closeProject(req) {
|
|
175372
175409
|
this.closeWatchers(req.projectName);
|
|
175373
175410
|
}
|
|
@@ -176696,8 +176733,9 @@ var TypingsCache = class {
|
|
|
176696
176733
|
return !typeAcquisition || !typeAcquisition.enable ? emptyArray2 : typings;
|
|
176697
176734
|
}
|
|
176698
176735
|
onProjectClosed(project) {
|
|
176699
|
-
this.perProjectCache.delete(project.getProjectName())
|
|
176700
|
-
|
|
176736
|
+
if (this.perProjectCache.delete(project.getProjectName())) {
|
|
176737
|
+
this.installer.onProjectClosed(project);
|
|
176738
|
+
}
|
|
176701
176739
|
}
|
|
176702
176740
|
};
|
|
176703
176741
|
|
|
@@ -186625,6 +186663,179 @@ var LineLeaf = class {
|
|
|
186625
186663
|
}
|
|
186626
186664
|
};
|
|
186627
186665
|
|
|
186666
|
+
// src/server/typingInstallerAdapter.ts
|
|
186667
|
+
var _TypingsInstallerAdapter = class _TypingsInstallerAdapter {
|
|
186668
|
+
constructor(telemetryEnabled, logger, host, globalTypingsCacheLocation, event, maxActiveRequestCount) {
|
|
186669
|
+
this.telemetryEnabled = telemetryEnabled;
|
|
186670
|
+
this.logger = logger;
|
|
186671
|
+
this.host = host;
|
|
186672
|
+
this.globalTypingsCacheLocation = globalTypingsCacheLocation;
|
|
186673
|
+
this.event = event;
|
|
186674
|
+
this.maxActiveRequestCount = maxActiveRequestCount;
|
|
186675
|
+
this.activeRequestCount = 0;
|
|
186676
|
+
this.requestQueue = createQueue();
|
|
186677
|
+
this.requestMap = /* @__PURE__ */ new Map();
|
|
186678
|
+
// Maps project name to newest requestQueue entry for that project
|
|
186679
|
+
/** We will lazily request the types registry on the first call to `isKnownTypesPackageName` and store it in `typesRegistryCache`. */
|
|
186680
|
+
this.requestedRegistry = false;
|
|
186681
|
+
}
|
|
186682
|
+
isKnownTypesPackageName(name) {
|
|
186683
|
+
var _a;
|
|
186684
|
+
const validationResult = ts_JsTyping_exports.validatePackageName(name);
|
|
186685
|
+
if (validationResult !== ts_JsTyping_exports.NameValidationResult.Ok) {
|
|
186686
|
+
return false;
|
|
186687
|
+
}
|
|
186688
|
+
if (!this.requestedRegistry) {
|
|
186689
|
+
this.requestedRegistry = true;
|
|
186690
|
+
this.installer.send({ kind: "typesRegistry" });
|
|
186691
|
+
}
|
|
186692
|
+
return !!((_a = this.typesRegistryCache) == null ? void 0 : _a.has(name));
|
|
186693
|
+
}
|
|
186694
|
+
installPackage(options) {
|
|
186695
|
+
this.installer.send({ kind: "installPackage", ...options });
|
|
186696
|
+
Debug.assert(this.packageInstalledPromise === void 0);
|
|
186697
|
+
return new Promise((resolve, reject) => {
|
|
186698
|
+
this.packageInstalledPromise = { resolve, reject };
|
|
186699
|
+
});
|
|
186700
|
+
}
|
|
186701
|
+
attach(projectService) {
|
|
186702
|
+
this.projectService = projectService;
|
|
186703
|
+
this.installer = this.createInstallerProcess();
|
|
186704
|
+
}
|
|
186705
|
+
onProjectClosed(p) {
|
|
186706
|
+
this.installer.send({ projectName: p.getProjectName(), kind: "closeProject" });
|
|
186707
|
+
}
|
|
186708
|
+
enqueueInstallTypingsRequest(project, typeAcquisition, unresolvedImports) {
|
|
186709
|
+
const request = createInstallTypingsRequest(project, typeAcquisition, unresolvedImports);
|
|
186710
|
+
if (this.logger.hasLevel(3 /* verbose */)) {
|
|
186711
|
+
this.logger.info(`TIAdapter:: Scheduling throttled operation:${stringifyIndented(request)}`);
|
|
186712
|
+
}
|
|
186713
|
+
if (this.activeRequestCount < this.maxActiveRequestCount) {
|
|
186714
|
+
this.scheduleRequest(request);
|
|
186715
|
+
} else {
|
|
186716
|
+
if (this.logger.hasLevel(3 /* verbose */)) {
|
|
186717
|
+
this.logger.info(`TIAdapter:: Deferring request for: ${request.projectName}`);
|
|
186718
|
+
}
|
|
186719
|
+
this.requestQueue.enqueue(request);
|
|
186720
|
+
this.requestMap.set(request.projectName, request);
|
|
186721
|
+
}
|
|
186722
|
+
}
|
|
186723
|
+
handleMessage(response) {
|
|
186724
|
+
if (this.logger.hasLevel(3 /* verbose */)) {
|
|
186725
|
+
this.logger.info(`TIAdapter:: Received response:${stringifyIndented(response)}`);
|
|
186726
|
+
}
|
|
186727
|
+
switch (response.kind) {
|
|
186728
|
+
case EventTypesRegistry:
|
|
186729
|
+
this.typesRegistryCache = new Map(Object.entries(response.typesRegistry));
|
|
186730
|
+
break;
|
|
186731
|
+
case ActionPackageInstalled: {
|
|
186732
|
+
const { success, message } = response;
|
|
186733
|
+
if (success) {
|
|
186734
|
+
this.packageInstalledPromise.resolve({ successMessage: message });
|
|
186735
|
+
} else {
|
|
186736
|
+
this.packageInstalledPromise.reject(message);
|
|
186737
|
+
}
|
|
186738
|
+
this.packageInstalledPromise = void 0;
|
|
186739
|
+
this.projectService.updateTypingsForProject(response);
|
|
186740
|
+
this.event(response, "setTypings");
|
|
186741
|
+
break;
|
|
186742
|
+
}
|
|
186743
|
+
case EventInitializationFailed: {
|
|
186744
|
+
const body = {
|
|
186745
|
+
message: response.message
|
|
186746
|
+
};
|
|
186747
|
+
const eventName = "typesInstallerInitializationFailed";
|
|
186748
|
+
this.event(body, eventName);
|
|
186749
|
+
break;
|
|
186750
|
+
}
|
|
186751
|
+
case EventBeginInstallTypes: {
|
|
186752
|
+
const body = {
|
|
186753
|
+
eventId: response.eventId,
|
|
186754
|
+
packages: response.packagesToInstall
|
|
186755
|
+
};
|
|
186756
|
+
const eventName = "beginInstallTypes";
|
|
186757
|
+
this.event(body, eventName);
|
|
186758
|
+
break;
|
|
186759
|
+
}
|
|
186760
|
+
case EventEndInstallTypes: {
|
|
186761
|
+
if (this.telemetryEnabled) {
|
|
186762
|
+
const body2 = {
|
|
186763
|
+
telemetryEventName: "typingsInstalled",
|
|
186764
|
+
payload: {
|
|
186765
|
+
installedPackages: response.packagesToInstall.join(","),
|
|
186766
|
+
installSuccess: response.installSuccess,
|
|
186767
|
+
typingsInstallerVersion: response.typingsInstallerVersion
|
|
186768
|
+
}
|
|
186769
|
+
};
|
|
186770
|
+
const eventName2 = "telemetry";
|
|
186771
|
+
this.event(body2, eventName2);
|
|
186772
|
+
}
|
|
186773
|
+
const body = {
|
|
186774
|
+
eventId: response.eventId,
|
|
186775
|
+
packages: response.packagesToInstall,
|
|
186776
|
+
success: response.installSuccess
|
|
186777
|
+
};
|
|
186778
|
+
const eventName = "endInstallTypes";
|
|
186779
|
+
this.event(body, eventName);
|
|
186780
|
+
break;
|
|
186781
|
+
}
|
|
186782
|
+
case ActionInvalidate: {
|
|
186783
|
+
this.projectService.updateTypingsForProject(response);
|
|
186784
|
+
break;
|
|
186785
|
+
}
|
|
186786
|
+
case ActionSet: {
|
|
186787
|
+
if (this.activeRequestCount > 0) {
|
|
186788
|
+
this.activeRequestCount--;
|
|
186789
|
+
} else {
|
|
186790
|
+
Debug.fail("TIAdapter:: Received too many responses");
|
|
186791
|
+
}
|
|
186792
|
+
while (!this.requestQueue.isEmpty()) {
|
|
186793
|
+
const queuedRequest = this.requestQueue.dequeue();
|
|
186794
|
+
if (this.requestMap.get(queuedRequest.projectName) === queuedRequest) {
|
|
186795
|
+
this.requestMap.delete(queuedRequest.projectName);
|
|
186796
|
+
this.scheduleRequest(queuedRequest);
|
|
186797
|
+
break;
|
|
186798
|
+
}
|
|
186799
|
+
if (this.logger.hasLevel(3 /* verbose */)) {
|
|
186800
|
+
this.logger.info(`TIAdapter:: Skipping defunct request for: ${queuedRequest.projectName}`);
|
|
186801
|
+
}
|
|
186802
|
+
}
|
|
186803
|
+
this.projectService.updateTypingsForProject(response);
|
|
186804
|
+
this.event(response, "setTypings");
|
|
186805
|
+
break;
|
|
186806
|
+
}
|
|
186807
|
+
case ActionWatchTypingLocations:
|
|
186808
|
+
this.projectService.watchTypingLocations(response);
|
|
186809
|
+
break;
|
|
186810
|
+
default:
|
|
186811
|
+
assertType(response);
|
|
186812
|
+
}
|
|
186813
|
+
}
|
|
186814
|
+
scheduleRequest(request) {
|
|
186815
|
+
if (this.logger.hasLevel(3 /* verbose */)) {
|
|
186816
|
+
this.logger.info(`TIAdapter:: Scheduling request for: ${request.projectName}`);
|
|
186817
|
+
}
|
|
186818
|
+
this.activeRequestCount++;
|
|
186819
|
+
this.host.setTimeout(
|
|
186820
|
+
() => {
|
|
186821
|
+
if (this.logger.hasLevel(3 /* verbose */)) {
|
|
186822
|
+
this.logger.info(`TIAdapter:: Sending request:${stringifyIndented(request)}`);
|
|
186823
|
+
}
|
|
186824
|
+
this.installer.send(request);
|
|
186825
|
+
},
|
|
186826
|
+
_TypingsInstallerAdapter.requestDelayMillis,
|
|
186827
|
+
`${request.projectName}::${request.kind}`
|
|
186828
|
+
);
|
|
186829
|
+
}
|
|
186830
|
+
};
|
|
186831
|
+
// This number is essentially arbitrary. Processing more than one typings request
|
|
186832
|
+
// at a time makes sense, but having too many in the pipe results in a hang
|
|
186833
|
+
// (see https://github.com/nodejs/node/issues/7657).
|
|
186834
|
+
// It would be preferable to base our limit on the amount of space left in the
|
|
186835
|
+
// buffer, but we have yet to find a way to retrieve that value.
|
|
186836
|
+
_TypingsInstallerAdapter.requestDelayMillis = 100;
|
|
186837
|
+
var TypingsInstallerAdapter = _TypingsInstallerAdapter;
|
|
186838
|
+
|
|
186628
186839
|
// src/tsserver/_namespaces/ts.server.ts
|
|
186629
186840
|
var ts_server_exports4 = {};
|
|
186630
186841
|
__export(ts_server_exports4, {
|
|
@@ -186672,6 +186883,7 @@ __export(ts_server_exports4, {
|
|
|
186672
186883
|
TextStorage: () => TextStorage,
|
|
186673
186884
|
ThrottledOperations: () => ThrottledOperations,
|
|
186674
186885
|
TypingsCache: () => TypingsCache,
|
|
186886
|
+
TypingsInstallerAdapter: () => TypingsInstallerAdapter,
|
|
186675
186887
|
allFilesAreJsOrDts: () => allFilesAreJsOrDts,
|
|
186676
186888
|
allRootFilesAreJsOrDts: () => allRootFilesAreJsOrDts,
|
|
186677
186889
|
asNormalizedPath: () => asNormalizedPath,
|
|
@@ -186791,7 +187003,7 @@ function initializeNodeSystem() {
|
|
|
186791
187003
|
const sys2 = Debug.checkDefined(sys);
|
|
186792
187004
|
const childProcess = require("child_process");
|
|
186793
187005
|
const fs = require("fs");
|
|
186794
|
-
class
|
|
187006
|
+
class Logger7 {
|
|
186795
187007
|
constructor(logFilename, traceToConsole, level) {
|
|
186796
187008
|
this.logFilename = logFilename;
|
|
186797
187009
|
this.traceToConsole = traceToConsole;
|
|
@@ -186858,7 +187070,7 @@ function initializeNodeSystem() {
|
|
|
186858
187070
|
s = `[${nowString()}] ${s}
|
|
186859
187071
|
`;
|
|
186860
187072
|
if (!this.inGroup || this.firstInGroup) {
|
|
186861
|
-
const prefix =
|
|
187073
|
+
const prefix = Logger7.padStringRight(type + " " + this.seq.toString(), " ");
|
|
186862
187074
|
s = prefix + s;
|
|
186863
187075
|
}
|
|
186864
187076
|
this.write(s, type);
|
|
@@ -186995,7 +187207,7 @@ function initializeNodeSystem() {
|
|
|
186995
187207
|
const unsubstitutedLogFileName = cmdLineLogFileName ? stripQuotes(cmdLineLogFileName) : envLogOptions.logToFile ? envLogOptions.file || libDirectory + "/.log" + process.pid.toString() : void 0;
|
|
186996
187208
|
const substitutedLogFileName = unsubstitutedLogFileName ? unsubstitutedLogFileName.replace("PID", process.pid.toString()) : void 0;
|
|
186997
187209
|
const logVerbosity = cmdLineVerbosity || envLogOptions.detailLevel;
|
|
186998
|
-
return new
|
|
187210
|
+
return new Logger7(substitutedLogFileName, envLogOptions.traceToConsole, logVerbosity);
|
|
186999
187211
|
}
|
|
187000
187212
|
function writeMessage(buf) {
|
|
187001
187213
|
if (!canWrite) {
|
|
@@ -187055,45 +187267,22 @@ function startNodeSession(options, logger, cancellationToken) {
|
|
|
187055
187267
|
output: process.stdout,
|
|
187056
187268
|
terminal: false
|
|
187057
187269
|
});
|
|
187058
|
-
const
|
|
187270
|
+
const _NodeTypingsInstallerAdapter = class _NodeTypingsInstallerAdapter extends TypingsInstallerAdapter {
|
|
187059
187271
|
constructor(telemetryEnabled2, logger2, host, globalTypingsCacheLocation, typingSafeListLocation2, typesMapLocation2, npmLocation2, validateDefaultNpmLocation2, event) {
|
|
187060
|
-
|
|
187061
|
-
|
|
187062
|
-
|
|
187063
|
-
|
|
187272
|
+
super(
|
|
187273
|
+
telemetryEnabled2,
|
|
187274
|
+
logger2,
|
|
187275
|
+
host,
|
|
187276
|
+
globalTypingsCacheLocation,
|
|
187277
|
+
event,
|
|
187278
|
+
_NodeTypingsInstallerAdapter.maxActiveRequestCount
|
|
187279
|
+
);
|
|
187064
187280
|
this.typingSafeListLocation = typingSafeListLocation2;
|
|
187065
187281
|
this.typesMapLocation = typesMapLocation2;
|
|
187066
187282
|
this.npmLocation = npmLocation2;
|
|
187067
187283
|
this.validateDefaultNpmLocation = validateDefaultNpmLocation2;
|
|
187068
|
-
this.event = event;
|
|
187069
|
-
this.activeRequestCount = 0;
|
|
187070
|
-
this.requestQueue = createQueue();
|
|
187071
|
-
this.requestMap = /* @__PURE__ */ new Map();
|
|
187072
|
-
// Maps operation ID to newest requestQueue entry with that ID
|
|
187073
|
-
/** We will lazily request the types registry on the first call to `isKnownTypesPackageName` and store it in `typesRegistryCache`. */
|
|
187074
|
-
this.requestedRegistry = false;
|
|
187075
|
-
}
|
|
187076
|
-
isKnownTypesPackageName(name) {
|
|
187077
|
-
const validationResult = ts_JsTyping_exports.validatePackageName(name);
|
|
187078
|
-
if (validationResult !== ts_JsTyping_exports.NameValidationResult.Ok) {
|
|
187079
|
-
return false;
|
|
187080
|
-
}
|
|
187081
|
-
if (this.requestedRegistry) {
|
|
187082
|
-
return !!this.typesRegistryCache && this.typesRegistryCache.has(name);
|
|
187083
|
-
}
|
|
187084
|
-
this.requestedRegistry = true;
|
|
187085
|
-
this.send({ kind: "typesRegistry" });
|
|
187086
|
-
return false;
|
|
187087
187284
|
}
|
|
187088
|
-
|
|
187089
|
-
this.send({ kind: "installPackage", ...options2 });
|
|
187090
|
-
Debug.assert(this.packageInstalledPromise === void 0);
|
|
187091
|
-
return new Promise((resolve, reject) => {
|
|
187092
|
-
this.packageInstalledPromise = { resolve, reject };
|
|
187093
|
-
});
|
|
187094
|
-
}
|
|
187095
|
-
attach(projectService) {
|
|
187096
|
-
this.projectService = projectService;
|
|
187285
|
+
createInstallerProcess() {
|
|
187097
187286
|
if (this.logger.hasLevel(2 /* requestTime */)) {
|
|
187098
187287
|
this.logger.info("Binding...");
|
|
187099
187288
|
}
|
|
@@ -187132,135 +187321,7 @@ function startNodeSession(options, logger, cancellationToken) {
|
|
|
187132
187321
|
process.on("exit", () => {
|
|
187133
187322
|
this.installer.kill();
|
|
187134
187323
|
});
|
|
187135
|
-
|
|
187136
|
-
onProjectClosed(p) {
|
|
187137
|
-
this.send({ projectName: p.getProjectName(), kind: "closeProject" });
|
|
187138
|
-
}
|
|
187139
|
-
send(rq) {
|
|
187140
|
-
this.installer.send(rq);
|
|
187141
|
-
}
|
|
187142
|
-
enqueueInstallTypingsRequest(project, typeAcquisition, unresolvedImports) {
|
|
187143
|
-
const request = createInstallTypingsRequest(project, typeAcquisition, unresolvedImports);
|
|
187144
|
-
if (this.logger.hasLevel(3 /* verbose */)) {
|
|
187145
|
-
if (this.logger.hasLevel(3 /* verbose */)) {
|
|
187146
|
-
this.logger.info(`Scheduling throttled operation:${stringifyIndented(request)}`);
|
|
187147
|
-
}
|
|
187148
|
-
}
|
|
187149
|
-
const operationId = project.getProjectName();
|
|
187150
|
-
const operation = () => {
|
|
187151
|
-
if (this.logger.hasLevel(3 /* verbose */)) {
|
|
187152
|
-
this.logger.info(`Sending request:${stringifyIndented(request)}`);
|
|
187153
|
-
}
|
|
187154
|
-
this.send(request);
|
|
187155
|
-
};
|
|
187156
|
-
const queuedRequest = { operationId, operation };
|
|
187157
|
-
if (this.activeRequestCount < _NodeTypingsInstaller.maxActiveRequestCount) {
|
|
187158
|
-
this.scheduleRequest(queuedRequest);
|
|
187159
|
-
} else {
|
|
187160
|
-
if (this.logger.hasLevel(3 /* verbose */)) {
|
|
187161
|
-
this.logger.info(`Deferring request for: ${operationId}`);
|
|
187162
|
-
}
|
|
187163
|
-
this.requestQueue.enqueue(queuedRequest);
|
|
187164
|
-
this.requestMap.set(operationId, queuedRequest);
|
|
187165
|
-
}
|
|
187166
|
-
}
|
|
187167
|
-
handleMessage(response) {
|
|
187168
|
-
if (this.logger.hasLevel(3 /* verbose */)) {
|
|
187169
|
-
this.logger.info(`Received response:${stringifyIndented(response)}`);
|
|
187170
|
-
}
|
|
187171
|
-
switch (response.kind) {
|
|
187172
|
-
case EventTypesRegistry:
|
|
187173
|
-
this.typesRegistryCache = new Map(Object.entries(response.typesRegistry));
|
|
187174
|
-
break;
|
|
187175
|
-
case ActionPackageInstalled: {
|
|
187176
|
-
const { success, message } = response;
|
|
187177
|
-
if (success) {
|
|
187178
|
-
this.packageInstalledPromise.resolve({ successMessage: message });
|
|
187179
|
-
} else {
|
|
187180
|
-
this.packageInstalledPromise.reject(message);
|
|
187181
|
-
}
|
|
187182
|
-
this.packageInstalledPromise = void 0;
|
|
187183
|
-
this.projectService.updateTypingsForProject(response);
|
|
187184
|
-
this.event(response, "setTypings");
|
|
187185
|
-
break;
|
|
187186
|
-
}
|
|
187187
|
-
case EventInitializationFailed: {
|
|
187188
|
-
const body = {
|
|
187189
|
-
message: response.message
|
|
187190
|
-
};
|
|
187191
|
-
const eventName = "typesInstallerInitializationFailed";
|
|
187192
|
-
this.event(body, eventName);
|
|
187193
|
-
break;
|
|
187194
|
-
}
|
|
187195
|
-
case EventBeginInstallTypes: {
|
|
187196
|
-
const body = {
|
|
187197
|
-
eventId: response.eventId,
|
|
187198
|
-
packages: response.packagesToInstall
|
|
187199
|
-
};
|
|
187200
|
-
const eventName = "beginInstallTypes";
|
|
187201
|
-
this.event(body, eventName);
|
|
187202
|
-
break;
|
|
187203
|
-
}
|
|
187204
|
-
case EventEndInstallTypes: {
|
|
187205
|
-
if (this.telemetryEnabled) {
|
|
187206
|
-
const body2 = {
|
|
187207
|
-
telemetryEventName: "typingsInstalled",
|
|
187208
|
-
payload: {
|
|
187209
|
-
installedPackages: response.packagesToInstall.join(","),
|
|
187210
|
-
installSuccess: response.installSuccess,
|
|
187211
|
-
typingsInstallerVersion: response.typingsInstallerVersion
|
|
187212
|
-
}
|
|
187213
|
-
};
|
|
187214
|
-
const eventName2 = "telemetry";
|
|
187215
|
-
this.event(body2, eventName2);
|
|
187216
|
-
}
|
|
187217
|
-
const body = {
|
|
187218
|
-
eventId: response.eventId,
|
|
187219
|
-
packages: response.packagesToInstall,
|
|
187220
|
-
success: response.installSuccess
|
|
187221
|
-
};
|
|
187222
|
-
const eventName = "endInstallTypes";
|
|
187223
|
-
this.event(body, eventName);
|
|
187224
|
-
break;
|
|
187225
|
-
}
|
|
187226
|
-
case ActionInvalidate: {
|
|
187227
|
-
this.projectService.updateTypingsForProject(response);
|
|
187228
|
-
break;
|
|
187229
|
-
}
|
|
187230
|
-
case ActionSet: {
|
|
187231
|
-
if (this.activeRequestCount > 0) {
|
|
187232
|
-
this.activeRequestCount--;
|
|
187233
|
-
} else {
|
|
187234
|
-
Debug.fail("Received too many responses");
|
|
187235
|
-
}
|
|
187236
|
-
while (!this.requestQueue.isEmpty()) {
|
|
187237
|
-
const queuedRequest = this.requestQueue.dequeue();
|
|
187238
|
-
if (this.requestMap.get(queuedRequest.operationId) === queuedRequest) {
|
|
187239
|
-
this.requestMap.delete(queuedRequest.operationId);
|
|
187240
|
-
this.scheduleRequest(queuedRequest);
|
|
187241
|
-
break;
|
|
187242
|
-
}
|
|
187243
|
-
if (this.logger.hasLevel(3 /* verbose */)) {
|
|
187244
|
-
this.logger.info(`Skipping defunct request for: ${queuedRequest.operationId}`);
|
|
187245
|
-
}
|
|
187246
|
-
}
|
|
187247
|
-
this.projectService.updateTypingsForProject(response);
|
|
187248
|
-
this.event(response, "setTypings");
|
|
187249
|
-
break;
|
|
187250
|
-
}
|
|
187251
|
-
case ActionWatchTypingLocations:
|
|
187252
|
-
this.projectService.watchTypingLocations(response);
|
|
187253
|
-
break;
|
|
187254
|
-
default:
|
|
187255
|
-
assertType(response);
|
|
187256
|
-
}
|
|
187257
|
-
}
|
|
187258
|
-
scheduleRequest(request) {
|
|
187259
|
-
if (this.logger.hasLevel(3 /* verbose */)) {
|
|
187260
|
-
this.logger.info(`Scheduling request for: ${request.operationId}`);
|
|
187261
|
-
}
|
|
187262
|
-
this.activeRequestCount++;
|
|
187263
|
-
this.host.setTimeout(request.operation, _NodeTypingsInstaller.requestDelayMillis);
|
|
187324
|
+
return this.installer;
|
|
187264
187325
|
}
|
|
187265
187326
|
};
|
|
187266
187327
|
// This number is essentially arbitrary. Processing more than one typings request
|
|
@@ -187268,21 +187329,20 @@ function startNodeSession(options, logger, cancellationToken) {
|
|
|
187268
187329
|
// (see https://github.com/nodejs/node/issues/7657).
|
|
187269
187330
|
// It would be preferable to base our limit on the amount of space left in the
|
|
187270
187331
|
// buffer, but we have yet to find a way to retrieve that value.
|
|
187271
|
-
|
|
187272
|
-
|
|
187273
|
-
let NodeTypingsInstaller = _NodeTypingsInstaller;
|
|
187332
|
+
_NodeTypingsInstallerAdapter.maxActiveRequestCount = 10;
|
|
187333
|
+
let NodeTypingsInstallerAdapter = _NodeTypingsInstallerAdapter;
|
|
187274
187334
|
class IOSession extends Session3 {
|
|
187275
187335
|
constructor() {
|
|
187276
187336
|
const event = (body, eventName) => {
|
|
187277
187337
|
this.event(body, eventName);
|
|
187278
187338
|
};
|
|
187279
187339
|
const host = sys;
|
|
187280
|
-
const typingsInstaller = disableAutomaticTypingAcquisition ? void 0 : new
|
|
187340
|
+
const typingsInstaller = disableAutomaticTypingAcquisition ? void 0 : new NodeTypingsInstallerAdapter(telemetryEnabled, logger, host, getGlobalTypingsCacheLocation(), typingSafeListLocation, typesMapLocation, npmLocation, validateDefaultNpmLocation, event);
|
|
187281
187341
|
super({
|
|
187282
187342
|
host,
|
|
187283
187343
|
cancellationToken,
|
|
187284
187344
|
...options,
|
|
187285
|
-
typingsInstaller
|
|
187345
|
+
typingsInstaller,
|
|
187286
187346
|
byteLength: Buffer.byteLength,
|
|
187287
187347
|
hrtime: process.hrtime,
|
|
187288
187348
|
logger,
|
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.4";
|
|
38
|
-
version = `${versionMajorMinor}.0-insiders.
|
|
38
|
+
version = `${versionMajorMinor}.0-insiders.20231115`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -33695,6 +33695,9 @@ ${lanes.join("\n")}
|
|
|
33695
33695
|
function nextTokenIsStringLiteral() {
|
|
33696
33696
|
return nextToken() === 11 /* StringLiteral */;
|
|
33697
33697
|
}
|
|
33698
|
+
function nextTokenIsFromKeyword() {
|
|
33699
|
+
return nextToken() === 161 /* FromKeyword */;
|
|
33700
|
+
}
|
|
33698
33701
|
function nextTokenIsIdentifierOrStringLiteralOnSameLine() {
|
|
33699
33702
|
nextToken();
|
|
33700
33703
|
return !scanner2.hasPrecedingLineBreak() && (isIdentifier2() || token() === 11 /* StringLiteral */);
|
|
@@ -34390,7 +34393,7 @@ ${lanes.join("\n")}
|
|
|
34390
34393
|
identifier = parseIdentifier();
|
|
34391
34394
|
}
|
|
34392
34395
|
let isTypeOnly = false;
|
|
34393
|
-
if (
|
|
34396
|
+
if ((identifier == null ? void 0 : identifier.escapedText) === "type" && (token() !== 161 /* FromKeyword */ || isIdentifier2() && lookAhead(nextTokenIsFromKeyword)) && (isIdentifier2() || tokenAfterImportDefinitelyProducesImportDeclaration())) {
|
|
34394
34397
|
isTypeOnly = true;
|
|
34395
34398
|
identifier = isIdentifier2() ? parseIdentifier() : void 0;
|
|
34396
34399
|
}
|
|
@@ -50702,13 +50705,15 @@ ${lanes.join("\n")}
|
|
|
50702
50705
|
}
|
|
50703
50706
|
const cachedResult = (_a2 = links == null ? void 0 : links.serializedTypes) == null ? void 0 : _a2.get(key);
|
|
50704
50707
|
if (cachedResult) {
|
|
50705
|
-
(
|
|
50706
|
-
(
|
|
50707
|
-
symbol,
|
|
50708
|
-
|
|
50709
|
-
|
|
50710
|
-
|
|
50711
|
-
|
|
50708
|
+
if (context.trackedSymbols !== cachedResult.trackedSymbols) {
|
|
50709
|
+
(_b2 = cachedResult.trackedSymbols) == null ? void 0 : _b2.forEach(
|
|
50710
|
+
([symbol, enclosingDeclaration, meaning]) => context.tracker.trackSymbol(
|
|
50711
|
+
symbol,
|
|
50712
|
+
enclosingDeclaration,
|
|
50713
|
+
meaning
|
|
50714
|
+
)
|
|
50715
|
+
);
|
|
50716
|
+
}
|
|
50712
50717
|
if (cachedResult.truncating) {
|
|
50713
50718
|
context.truncating = true;
|
|
50714
50719
|
}
|
|
@@ -160282,6 +160287,11 @@ ${newComment.split("\n").map((c) => ` * ${c}`).join("\n")}
|
|
|
160282
160287
|
}
|
|
160283
160288
|
return void 0;
|
|
160284
160289
|
}
|
|
160290
|
+
if (isExportDeclaration(parent2) && contextToken.kind === 42 /* AsteriskToken */ || isNamedExports(parent2) && contextToken.kind === 20 /* CloseBraceToken */) {
|
|
160291
|
+
isKeywordOnlyCompletion = true;
|
|
160292
|
+
keywordCompletion = 161 /* FromKeyword */;
|
|
160293
|
+
return void 0;
|
|
160294
|
+
}
|
|
160285
160295
|
if (isImportKeyword(contextToken) && isSourceFile(parent2)) {
|
|
160286
160296
|
keywordCompletion = 156 /* TypeKeyword */;
|
|
160287
160297
|
return contextToken;
|
|
@@ -172583,6 +172593,32 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
172583
172593
|
}
|
|
172584
172594
|
this.processCacheLocation(this.globalCachePath);
|
|
172585
172595
|
}
|
|
172596
|
+
/** @internal */
|
|
172597
|
+
handleRequest(req) {
|
|
172598
|
+
switch (req.kind) {
|
|
172599
|
+
case "discover":
|
|
172600
|
+
this.install(req);
|
|
172601
|
+
break;
|
|
172602
|
+
case "closeProject":
|
|
172603
|
+
this.closeProject(req);
|
|
172604
|
+
break;
|
|
172605
|
+
case "typesRegistry": {
|
|
172606
|
+
const typesRegistry = {};
|
|
172607
|
+
this.typesRegistry.forEach((value, key) => {
|
|
172608
|
+
typesRegistry[key] = value;
|
|
172609
|
+
});
|
|
172610
|
+
const response = { kind: EventTypesRegistry, typesRegistry };
|
|
172611
|
+
this.sendResponse(response);
|
|
172612
|
+
break;
|
|
172613
|
+
}
|
|
172614
|
+
case "installPackage": {
|
|
172615
|
+
this.installPackage(req);
|
|
172616
|
+
break;
|
|
172617
|
+
}
|
|
172618
|
+
default:
|
|
172619
|
+
Debug.assertNever(req);
|
|
172620
|
+
}
|
|
172621
|
+
}
|
|
172586
172622
|
closeProject(req) {
|
|
172587
172623
|
this.closeWatchers(req.projectName);
|
|
172588
172624
|
}
|
|
@@ -173981,8 +174017,9 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
173981
174017
|
return !typeAcquisition || !typeAcquisition.enable ? emptyArray2 : typings;
|
|
173982
174018
|
}
|
|
173983
174019
|
onProjectClosed(project) {
|
|
173984
|
-
this.perProjectCache.delete(project.getProjectName())
|
|
173985
|
-
|
|
174020
|
+
if (this.perProjectCache.delete(project.getProjectName())) {
|
|
174021
|
+
this.installer.onProjectClosed(project);
|
|
174022
|
+
}
|
|
173986
174023
|
}
|
|
173987
174024
|
};
|
|
173988
174025
|
}
|
|
@@ -183959,6 +183996,187 @@ ${e.message}`;
|
|
|
183959
183996
|
}
|
|
183960
183997
|
});
|
|
183961
183998
|
|
|
183999
|
+
// src/server/typingInstallerAdapter.ts
|
|
184000
|
+
var _TypingsInstallerAdapter, TypingsInstallerAdapter;
|
|
184001
|
+
var init_typingInstallerAdapter = __esm({
|
|
184002
|
+
"src/server/typingInstallerAdapter.ts"() {
|
|
184003
|
+
"use strict";
|
|
184004
|
+
init_ts7();
|
|
184005
|
+
init_ts_server3();
|
|
184006
|
+
_TypingsInstallerAdapter = class _TypingsInstallerAdapter {
|
|
184007
|
+
constructor(telemetryEnabled, logger, host, globalTypingsCacheLocation, event, maxActiveRequestCount) {
|
|
184008
|
+
this.telemetryEnabled = telemetryEnabled;
|
|
184009
|
+
this.logger = logger;
|
|
184010
|
+
this.host = host;
|
|
184011
|
+
this.globalTypingsCacheLocation = globalTypingsCacheLocation;
|
|
184012
|
+
this.event = event;
|
|
184013
|
+
this.maxActiveRequestCount = maxActiveRequestCount;
|
|
184014
|
+
this.activeRequestCount = 0;
|
|
184015
|
+
this.requestQueue = createQueue();
|
|
184016
|
+
this.requestMap = /* @__PURE__ */ new Map();
|
|
184017
|
+
// Maps project name to newest requestQueue entry for that project
|
|
184018
|
+
/** We will lazily request the types registry on the first call to `isKnownTypesPackageName` and store it in `typesRegistryCache`. */
|
|
184019
|
+
this.requestedRegistry = false;
|
|
184020
|
+
}
|
|
184021
|
+
isKnownTypesPackageName(name) {
|
|
184022
|
+
var _a;
|
|
184023
|
+
const validationResult = ts_JsTyping_exports.validatePackageName(name);
|
|
184024
|
+
if (validationResult !== ts_JsTyping_exports.NameValidationResult.Ok) {
|
|
184025
|
+
return false;
|
|
184026
|
+
}
|
|
184027
|
+
if (!this.requestedRegistry) {
|
|
184028
|
+
this.requestedRegistry = true;
|
|
184029
|
+
this.installer.send({ kind: "typesRegistry" });
|
|
184030
|
+
}
|
|
184031
|
+
return !!((_a = this.typesRegistryCache) == null ? void 0 : _a.has(name));
|
|
184032
|
+
}
|
|
184033
|
+
installPackage(options) {
|
|
184034
|
+
this.installer.send({ kind: "installPackage", ...options });
|
|
184035
|
+
Debug.assert(this.packageInstalledPromise === void 0);
|
|
184036
|
+
return new Promise((resolve, reject) => {
|
|
184037
|
+
this.packageInstalledPromise = { resolve, reject };
|
|
184038
|
+
});
|
|
184039
|
+
}
|
|
184040
|
+
attach(projectService) {
|
|
184041
|
+
this.projectService = projectService;
|
|
184042
|
+
this.installer = this.createInstallerProcess();
|
|
184043
|
+
}
|
|
184044
|
+
onProjectClosed(p) {
|
|
184045
|
+
this.installer.send({ projectName: p.getProjectName(), kind: "closeProject" });
|
|
184046
|
+
}
|
|
184047
|
+
enqueueInstallTypingsRequest(project, typeAcquisition, unresolvedImports) {
|
|
184048
|
+
const request = createInstallTypingsRequest(project, typeAcquisition, unresolvedImports);
|
|
184049
|
+
if (this.logger.hasLevel(3 /* verbose */)) {
|
|
184050
|
+
this.logger.info(`TIAdapter:: Scheduling throttled operation:${stringifyIndented(request)}`);
|
|
184051
|
+
}
|
|
184052
|
+
if (this.activeRequestCount < this.maxActiveRequestCount) {
|
|
184053
|
+
this.scheduleRequest(request);
|
|
184054
|
+
} else {
|
|
184055
|
+
if (this.logger.hasLevel(3 /* verbose */)) {
|
|
184056
|
+
this.logger.info(`TIAdapter:: Deferring request for: ${request.projectName}`);
|
|
184057
|
+
}
|
|
184058
|
+
this.requestQueue.enqueue(request);
|
|
184059
|
+
this.requestMap.set(request.projectName, request);
|
|
184060
|
+
}
|
|
184061
|
+
}
|
|
184062
|
+
handleMessage(response) {
|
|
184063
|
+
if (this.logger.hasLevel(3 /* verbose */)) {
|
|
184064
|
+
this.logger.info(`TIAdapter:: Received response:${stringifyIndented(response)}`);
|
|
184065
|
+
}
|
|
184066
|
+
switch (response.kind) {
|
|
184067
|
+
case EventTypesRegistry:
|
|
184068
|
+
this.typesRegistryCache = new Map(Object.entries(response.typesRegistry));
|
|
184069
|
+
break;
|
|
184070
|
+
case ActionPackageInstalled: {
|
|
184071
|
+
const { success, message } = response;
|
|
184072
|
+
if (success) {
|
|
184073
|
+
this.packageInstalledPromise.resolve({ successMessage: message });
|
|
184074
|
+
} else {
|
|
184075
|
+
this.packageInstalledPromise.reject(message);
|
|
184076
|
+
}
|
|
184077
|
+
this.packageInstalledPromise = void 0;
|
|
184078
|
+
this.projectService.updateTypingsForProject(response);
|
|
184079
|
+
this.event(response, "setTypings");
|
|
184080
|
+
break;
|
|
184081
|
+
}
|
|
184082
|
+
case EventInitializationFailed: {
|
|
184083
|
+
const body = {
|
|
184084
|
+
message: response.message
|
|
184085
|
+
};
|
|
184086
|
+
const eventName = "typesInstallerInitializationFailed";
|
|
184087
|
+
this.event(body, eventName);
|
|
184088
|
+
break;
|
|
184089
|
+
}
|
|
184090
|
+
case EventBeginInstallTypes: {
|
|
184091
|
+
const body = {
|
|
184092
|
+
eventId: response.eventId,
|
|
184093
|
+
packages: response.packagesToInstall
|
|
184094
|
+
};
|
|
184095
|
+
const eventName = "beginInstallTypes";
|
|
184096
|
+
this.event(body, eventName);
|
|
184097
|
+
break;
|
|
184098
|
+
}
|
|
184099
|
+
case EventEndInstallTypes: {
|
|
184100
|
+
if (this.telemetryEnabled) {
|
|
184101
|
+
const body2 = {
|
|
184102
|
+
telemetryEventName: "typingsInstalled",
|
|
184103
|
+
payload: {
|
|
184104
|
+
installedPackages: response.packagesToInstall.join(","),
|
|
184105
|
+
installSuccess: response.installSuccess,
|
|
184106
|
+
typingsInstallerVersion: response.typingsInstallerVersion
|
|
184107
|
+
}
|
|
184108
|
+
};
|
|
184109
|
+
const eventName2 = "telemetry";
|
|
184110
|
+
this.event(body2, eventName2);
|
|
184111
|
+
}
|
|
184112
|
+
const body = {
|
|
184113
|
+
eventId: response.eventId,
|
|
184114
|
+
packages: response.packagesToInstall,
|
|
184115
|
+
success: response.installSuccess
|
|
184116
|
+
};
|
|
184117
|
+
const eventName = "endInstallTypes";
|
|
184118
|
+
this.event(body, eventName);
|
|
184119
|
+
break;
|
|
184120
|
+
}
|
|
184121
|
+
case ActionInvalidate: {
|
|
184122
|
+
this.projectService.updateTypingsForProject(response);
|
|
184123
|
+
break;
|
|
184124
|
+
}
|
|
184125
|
+
case ActionSet: {
|
|
184126
|
+
if (this.activeRequestCount > 0) {
|
|
184127
|
+
this.activeRequestCount--;
|
|
184128
|
+
} else {
|
|
184129
|
+
Debug.fail("TIAdapter:: Received too many responses");
|
|
184130
|
+
}
|
|
184131
|
+
while (!this.requestQueue.isEmpty()) {
|
|
184132
|
+
const queuedRequest = this.requestQueue.dequeue();
|
|
184133
|
+
if (this.requestMap.get(queuedRequest.projectName) === queuedRequest) {
|
|
184134
|
+
this.requestMap.delete(queuedRequest.projectName);
|
|
184135
|
+
this.scheduleRequest(queuedRequest);
|
|
184136
|
+
break;
|
|
184137
|
+
}
|
|
184138
|
+
if (this.logger.hasLevel(3 /* verbose */)) {
|
|
184139
|
+
this.logger.info(`TIAdapter:: Skipping defunct request for: ${queuedRequest.projectName}`);
|
|
184140
|
+
}
|
|
184141
|
+
}
|
|
184142
|
+
this.projectService.updateTypingsForProject(response);
|
|
184143
|
+
this.event(response, "setTypings");
|
|
184144
|
+
break;
|
|
184145
|
+
}
|
|
184146
|
+
case ActionWatchTypingLocations:
|
|
184147
|
+
this.projectService.watchTypingLocations(response);
|
|
184148
|
+
break;
|
|
184149
|
+
default:
|
|
184150
|
+
assertType(response);
|
|
184151
|
+
}
|
|
184152
|
+
}
|
|
184153
|
+
scheduleRequest(request) {
|
|
184154
|
+
if (this.logger.hasLevel(3 /* verbose */)) {
|
|
184155
|
+
this.logger.info(`TIAdapter:: Scheduling request for: ${request.projectName}`);
|
|
184156
|
+
}
|
|
184157
|
+
this.activeRequestCount++;
|
|
184158
|
+
this.host.setTimeout(
|
|
184159
|
+
() => {
|
|
184160
|
+
if (this.logger.hasLevel(3 /* verbose */)) {
|
|
184161
|
+
this.logger.info(`TIAdapter:: Sending request:${stringifyIndented(request)}`);
|
|
184162
|
+
}
|
|
184163
|
+
this.installer.send(request);
|
|
184164
|
+
},
|
|
184165
|
+
_TypingsInstallerAdapter.requestDelayMillis,
|
|
184166
|
+
`${request.projectName}::${request.kind}`
|
|
184167
|
+
);
|
|
184168
|
+
}
|
|
184169
|
+
};
|
|
184170
|
+
// This number is essentially arbitrary. Processing more than one typings request
|
|
184171
|
+
// at a time makes sense, but having too many in the pipe results in a hang
|
|
184172
|
+
// (see https://github.com/nodejs/node/issues/7657).
|
|
184173
|
+
// It would be preferable to base our limit on the amount of space left in the
|
|
184174
|
+
// buffer, but we have yet to find a way to retrieve that value.
|
|
184175
|
+
_TypingsInstallerAdapter.requestDelayMillis = 100;
|
|
184176
|
+
TypingsInstallerAdapter = _TypingsInstallerAdapter;
|
|
184177
|
+
}
|
|
184178
|
+
});
|
|
184179
|
+
|
|
183962
184180
|
// src/server/_namespaces/ts.server.ts
|
|
183963
184181
|
var ts_server_exports3 = {};
|
|
183964
184182
|
__export(ts_server_exports3, {
|
|
@@ -184006,6 +184224,7 @@ ${e.message}`;
|
|
|
184006
184224
|
TextStorage: () => TextStorage,
|
|
184007
184225
|
ThrottledOperations: () => ThrottledOperations,
|
|
184008
184226
|
TypingsCache: () => TypingsCache,
|
|
184227
|
+
TypingsInstallerAdapter: () => TypingsInstallerAdapter,
|
|
184009
184228
|
allFilesAreJsOrDts: () => allFilesAreJsOrDts,
|
|
184010
184229
|
allRootFilesAreJsOrDts: () => allRootFilesAreJsOrDts,
|
|
184011
184230
|
asNormalizedPath: () => asNormalizedPath,
|
|
@@ -184074,6 +184293,7 @@ ${e.message}`;
|
|
|
184074
184293
|
init_packageJsonCache();
|
|
184075
184294
|
init_session();
|
|
184076
184295
|
init_scriptVersionCache();
|
|
184296
|
+
init_typingInstallerAdapter();
|
|
184077
184297
|
}
|
|
184078
184298
|
});
|
|
184079
184299
|
|
|
@@ -186428,6 +186648,7 @@ ${e.message}`;
|
|
|
186428
186648
|
TextStorage: () => TextStorage,
|
|
186429
186649
|
ThrottledOperations: () => ThrottledOperations,
|
|
186430
186650
|
TypingsCache: () => TypingsCache,
|
|
186651
|
+
TypingsInstallerAdapter: () => TypingsInstallerAdapter,
|
|
186431
186652
|
allFilesAreJsOrDts: () => allFilesAreJsOrDts,
|
|
186432
186653
|
allRootFilesAreJsOrDts: () => allRootFilesAreJsOrDts,
|
|
186433
186654
|
asNormalizedPath: () => asNormalizedPath,
|
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.4";
|
|
57
|
-
var version = `${versionMajorMinor}.0-insiders.
|
|
57
|
+
var version = `${versionMajorMinor}.0-insiders.20231115`;
|
|
58
58
|
|
|
59
59
|
// src/compiler/core.ts
|
|
60
60
|
var emptyArray = [];
|
|
@@ -23031,6 +23031,9 @@ var Parser;
|
|
|
23031
23031
|
function nextTokenIsStringLiteral() {
|
|
23032
23032
|
return nextToken() === 11 /* StringLiteral */;
|
|
23033
23033
|
}
|
|
23034
|
+
function nextTokenIsFromKeyword() {
|
|
23035
|
+
return nextToken() === 161 /* FromKeyword */;
|
|
23036
|
+
}
|
|
23034
23037
|
function nextTokenIsIdentifierOrStringLiteralOnSameLine() {
|
|
23035
23038
|
nextToken();
|
|
23036
23039
|
return !scanner.hasPrecedingLineBreak() && (isIdentifier2() || token() === 11 /* StringLiteral */);
|
|
@@ -23726,7 +23729,7 @@ var Parser;
|
|
|
23726
23729
|
identifier = parseIdentifier();
|
|
23727
23730
|
}
|
|
23728
23731
|
let isTypeOnly = false;
|
|
23729
|
-
if (
|
|
23732
|
+
if ((identifier == null ? void 0 : identifier.escapedText) === "type" && (token() !== 161 /* FromKeyword */ || isIdentifier2() && lookAhead(nextTokenIsFromKeyword)) && (isIdentifier2() || tokenAfterImportDefinitelyProducesImportDeclaration())) {
|
|
23730
23733
|
isTypeOnly = true;
|
|
23731
23734
|
identifier = isIdentifier2() ? parseIdentifier() : void 0;
|
|
23732
23735
|
}
|
|
@@ -31847,6 +31850,32 @@ var TypingsInstaller = class {
|
|
|
31847
31850
|
}
|
|
31848
31851
|
this.processCacheLocation(this.globalCachePath);
|
|
31849
31852
|
}
|
|
31853
|
+
/** @internal */
|
|
31854
|
+
handleRequest(req) {
|
|
31855
|
+
switch (req.kind) {
|
|
31856
|
+
case "discover":
|
|
31857
|
+
this.install(req);
|
|
31858
|
+
break;
|
|
31859
|
+
case "closeProject":
|
|
31860
|
+
this.closeProject(req);
|
|
31861
|
+
break;
|
|
31862
|
+
case "typesRegistry": {
|
|
31863
|
+
const typesRegistry = {};
|
|
31864
|
+
this.typesRegistry.forEach((value, key) => {
|
|
31865
|
+
typesRegistry[key] = value;
|
|
31866
|
+
});
|
|
31867
|
+
const response = { kind: EventTypesRegistry, typesRegistry };
|
|
31868
|
+
this.sendResponse(response);
|
|
31869
|
+
break;
|
|
31870
|
+
}
|
|
31871
|
+
case "installPackage": {
|
|
31872
|
+
this.installPackage(req);
|
|
31873
|
+
break;
|
|
31874
|
+
}
|
|
31875
|
+
default:
|
|
31876
|
+
Debug.assertNever(req);
|
|
31877
|
+
}
|
|
31878
|
+
}
|
|
31850
31879
|
closeProject(req) {
|
|
31851
31880
|
this.closeWatchers(req.projectName);
|
|
31852
31881
|
}
|
|
@@ -32264,29 +32293,7 @@ var NodeTypingsInstaller = class extends TypingsInstaller {
|
|
|
32264
32293
|
this.sendResponse(this.delayedInitializationError);
|
|
32265
32294
|
this.delayedInitializationError = void 0;
|
|
32266
32295
|
}
|
|
32267
|
-
|
|
32268
|
-
case "discover":
|
|
32269
|
-
this.install(req);
|
|
32270
|
-
break;
|
|
32271
|
-
case "closeProject":
|
|
32272
|
-
this.closeProject(req);
|
|
32273
|
-
break;
|
|
32274
|
-
case "typesRegistry": {
|
|
32275
|
-
const typesRegistry = {};
|
|
32276
|
-
this.typesRegistry.forEach((value, key) => {
|
|
32277
|
-
typesRegistry[key] = value;
|
|
32278
|
-
});
|
|
32279
|
-
const response = { kind: EventTypesRegistry, typesRegistry };
|
|
32280
|
-
this.sendResponse(response);
|
|
32281
|
-
break;
|
|
32282
|
-
}
|
|
32283
|
-
case "installPackage": {
|
|
32284
|
-
this.installPackage(req);
|
|
32285
|
-
break;
|
|
32286
|
-
}
|
|
32287
|
-
default:
|
|
32288
|
-
Debug.assertNever(req);
|
|
32289
|
-
}
|
|
32296
|
+
super.handleRequest(req);
|
|
32290
32297
|
}
|
|
32291
32298
|
sendResponse(response) {
|
|
32292
32299
|
if (this.log.isEnabled()) {
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@typescript-deploys/pr-build",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "5.4.0-pr-
|
|
5
|
+
"version": "5.4.0-pr-56404-7",
|
|
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": "20.1.0",
|
|
116
116
|
"npm": "8.19.4"
|
|
117
117
|
},
|
|
118
|
-
"gitHead": "
|
|
118
|
+
"gitHead": "6ab635994fd78fd55a82a7c5078db32c34525259"
|
|
119
119
|
}
|