diff --git a/lib/cancellationToken.js b/lib/cancellationToken.js index 76a6a60e72976..0d4569c601b91 100644 --- a/lib/cancellationToken.js +++ b/lib/cancellationToken.js @@ -49,7 +49,7 @@ function createCancellationToken(args) { }, resetRequest: function (requestId) { if (currentRequestId_1 !== requestId) { - throw new Error("Mismatched request id, expected " + currentRequestId_1 + ", actual " + requestId); + throw new Error("Mismatched request id, expected ".concat(currentRequestId_1, ", actual ").concat(requestId)); } perRequestPipeName_1 = undefined; } diff --git a/lib/tsc.js b/lib/tsc.js index ab0a0ed2848d7..c2c5c03f365f2 100644 --- a/lib/tsc.js +++ b/lib/tsc.js @@ -45,7 +45,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) { function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); - while (_) try { + while (g && (g = 0, op[0] && (_ = 0)), _) try { if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { @@ -98124,14 +98124,16 @@ var ts; } return setReadFileCache(key, fileName); }; - var getSourceFileWithCache = getSourceFile ? function (fileName, languageVersion, onError, shouldCreateNewSourceFile) { + var getSourceFileWithCache = getSourceFile ? function (fileName, languageVersionOrOptions, onError, shouldCreateNewSourceFile) { var key = toPath(fileName); - var value = sourceFileCache.get(key); + var impliedNodeFormat = typeof languageVersionOrOptions === "object" ? languageVersionOrOptions.impliedNodeFormat : undefined; + var forImpliedNodeFormat = sourceFileCache.get(impliedNodeFormat); + var value = forImpliedNodeFormat === null || forImpliedNodeFormat === void 0 ? void 0 : forImpliedNodeFormat.get(key); if (value) return value; - var sourceFile = getSourceFile(fileName, languageVersion, onError, shouldCreateNewSourceFile); + var sourceFile = getSourceFile(fileName, languageVersionOrOptions, onError, shouldCreateNewSourceFile); if (sourceFile && (ts.isDeclarationFileName(fileName) || ts.fileExtensionIs(fileName, ".json"))) { - sourceFileCache.set(key, sourceFile); + sourceFileCache.set(impliedNodeFormat, (forImpliedNodeFormat || new ts.Map()).set(key, sourceFile)); } return sourceFile; } : undefined; @@ -98155,13 +98157,15 @@ var ts; var value = readFileCache.get(key); if (value !== undefined && value !== data) { readFileCache.delete(key); - sourceFileCache.delete(key); + sourceFileCache.forEach(function (map) { return map.delete(key); }); } else if (getSourceFileWithCache) { - var sourceFile = sourceFileCache.get(key); - if (sourceFile && sourceFile.text !== data) { - sourceFileCache.delete(key); - } + sourceFileCache.forEach(function (map) { + var sourceFile = map.get(key); + if (sourceFile && sourceFile.text !== data) { + map.delete(key); + } + }); } originalWriteFile.call.apply(originalWriteFile, __spreadArray([host, fileName, data], rest, false)); }; diff --git a/lib/tsserver.js b/lib/tsserver.js index 444cf2ffb3504..fc48171a6eb2b 100644 --- a/lib/tsserver.js +++ b/lib/tsserver.js @@ -45,7 +45,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) { function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); - while (_) try { + while (g && (g = 0, op[0] && (_ = 0)), _) try { if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { @@ -118604,14 +118604,16 @@ var ts; } return setReadFileCache(key, fileName); }; - var getSourceFileWithCache = getSourceFile ? function (fileName, languageVersion, onError, shouldCreateNewSourceFile) { + var getSourceFileWithCache = getSourceFile ? function (fileName, languageVersionOrOptions, onError, shouldCreateNewSourceFile) { var key = toPath(fileName); - var value = sourceFileCache.get(key); + var impliedNodeFormat = typeof languageVersionOrOptions === "object" ? languageVersionOrOptions.impliedNodeFormat : undefined; + var forImpliedNodeFormat = sourceFileCache.get(impliedNodeFormat); + var value = forImpliedNodeFormat === null || forImpliedNodeFormat === void 0 ? void 0 : forImpliedNodeFormat.get(key); if (value) return value; - var sourceFile = getSourceFile(fileName, languageVersion, onError, shouldCreateNewSourceFile); + var sourceFile = getSourceFile(fileName, languageVersionOrOptions, onError, shouldCreateNewSourceFile); if (sourceFile && (ts.isDeclarationFileName(fileName) || ts.fileExtensionIs(fileName, ".json" /* Extension.Json */))) { - sourceFileCache.set(key, sourceFile); + sourceFileCache.set(impliedNodeFormat, (forImpliedNodeFormat || new ts.Map()).set(key, sourceFile)); } return sourceFile; } : undefined; @@ -118636,13 +118638,15 @@ var ts; var value = readFileCache.get(key); if (value !== undefined && value !== data) { readFileCache.delete(key); - sourceFileCache.delete(key); + sourceFileCache.forEach(function (map) { return map.delete(key); }); } else if (getSourceFileWithCache) { - var sourceFile = sourceFileCache.get(key); - if (sourceFile && sourceFile.text !== data) { - sourceFileCache.delete(key); - } + sourceFileCache.forEach(function (map) { + var sourceFile = map.get(key); + if (sourceFile && sourceFile.text !== data) { + map.delete(key); + } + }); } originalWriteFile.call.apply(originalWriteFile, __spreadArray([host, fileName, data], rest, false)); }; diff --git a/lib/tsserverlibrary.js b/lib/tsserverlibrary.js index 1affbcf305f17..ec521e9cc0443 100644 --- a/lib/tsserverlibrary.js +++ b/lib/tsserverlibrary.js @@ -44,7 +44,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) { function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); - while (_) try { + while (g && (g = 0, op[0] && (_ = 0)), _) try { if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { @@ -118603,14 +118603,16 @@ var ts; } return setReadFileCache(key, fileName); }; - var getSourceFileWithCache = getSourceFile ? function (fileName, languageVersion, onError, shouldCreateNewSourceFile) { + var getSourceFileWithCache = getSourceFile ? function (fileName, languageVersionOrOptions, onError, shouldCreateNewSourceFile) { var key = toPath(fileName); - var value = sourceFileCache.get(key); + var impliedNodeFormat = typeof languageVersionOrOptions === "object" ? languageVersionOrOptions.impliedNodeFormat : undefined; + var forImpliedNodeFormat = sourceFileCache.get(impliedNodeFormat); + var value = forImpliedNodeFormat === null || forImpliedNodeFormat === void 0 ? void 0 : forImpliedNodeFormat.get(key); if (value) return value; - var sourceFile = getSourceFile(fileName, languageVersion, onError, shouldCreateNewSourceFile); + var sourceFile = getSourceFile(fileName, languageVersionOrOptions, onError, shouldCreateNewSourceFile); if (sourceFile && (ts.isDeclarationFileName(fileName) || ts.fileExtensionIs(fileName, ".json" /* Extension.Json */))) { - sourceFileCache.set(key, sourceFile); + sourceFileCache.set(impliedNodeFormat, (forImpliedNodeFormat || new ts.Map()).set(key, sourceFile)); } return sourceFile; } : undefined; @@ -118635,13 +118637,15 @@ var ts; var value = readFileCache.get(key); if (value !== undefined && value !== data) { readFileCache.delete(key); - sourceFileCache.delete(key); + sourceFileCache.forEach(function (map) { return map.delete(key); }); } else if (getSourceFileWithCache) { - var sourceFile = sourceFileCache.get(key); - if (sourceFile && sourceFile.text !== data) { - sourceFileCache.delete(key); - } + sourceFileCache.forEach(function (map) { + var sourceFile = map.get(key); + if (sourceFile && sourceFile.text !== data) { + map.delete(key); + } + }); } originalWriteFile.call.apply(originalWriteFile, __spreadArray([host, fileName, data], rest, false)); }; diff --git a/lib/typescript.js b/lib/typescript.js index a1370cc514c7b..530b87683c34c 100644 --- a/lib/typescript.js +++ b/lib/typescript.js @@ -44,7 +44,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) { function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); - while (_) try { + while (g && (g = 0, op[0] && (_ = 0)), _) try { if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { @@ -118594,14 +118594,16 @@ var ts; } return setReadFileCache(key, fileName); }; - var getSourceFileWithCache = getSourceFile ? function (fileName, languageVersion, onError, shouldCreateNewSourceFile) { + var getSourceFileWithCache = getSourceFile ? function (fileName, languageVersionOrOptions, onError, shouldCreateNewSourceFile) { var key = toPath(fileName); - var value = sourceFileCache.get(key); + var impliedNodeFormat = typeof languageVersionOrOptions === "object" ? languageVersionOrOptions.impliedNodeFormat : undefined; + var forImpliedNodeFormat = sourceFileCache.get(impliedNodeFormat); + var value = forImpliedNodeFormat === null || forImpliedNodeFormat === void 0 ? void 0 : forImpliedNodeFormat.get(key); if (value) return value; - var sourceFile = getSourceFile(fileName, languageVersion, onError, shouldCreateNewSourceFile); + var sourceFile = getSourceFile(fileName, languageVersionOrOptions, onError, shouldCreateNewSourceFile); if (sourceFile && (ts.isDeclarationFileName(fileName) || ts.fileExtensionIs(fileName, ".json" /* Extension.Json */))) { - sourceFileCache.set(key, sourceFile); + sourceFileCache.set(impliedNodeFormat, (forImpliedNodeFormat || new ts.Map()).set(key, sourceFile)); } return sourceFile; } : undefined; @@ -118626,13 +118628,15 @@ var ts; var value = readFileCache.get(key); if (value !== undefined && value !== data) { readFileCache.delete(key); - sourceFileCache.delete(key); + sourceFileCache.forEach(function (map) { return map.delete(key); }); } else if (getSourceFileWithCache) { - var sourceFile = sourceFileCache.get(key); - if (sourceFile && sourceFile.text !== data) { - sourceFileCache.delete(key); - } + sourceFileCache.forEach(function (map) { + var sourceFile = map.get(key); + if (sourceFile && sourceFile.text !== data) { + map.delete(key); + } + }); } originalWriteFile.call.apply(originalWriteFile, __spreadArray([host, fileName, data], rest, false)); }; diff --git a/lib/typescriptServices.js b/lib/typescriptServices.js index 576ee090df80f..59e716a7bdf41 100644 --- a/lib/typescriptServices.js +++ b/lib/typescriptServices.js @@ -44,7 +44,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) { function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); - while (_) try { + while (g && (g = 0, op[0] && (_ = 0)), _) try { if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { @@ -118594,14 +118594,16 @@ var ts; } return setReadFileCache(key, fileName); }; - var getSourceFileWithCache = getSourceFile ? function (fileName, languageVersion, onError, shouldCreateNewSourceFile) { + var getSourceFileWithCache = getSourceFile ? function (fileName, languageVersionOrOptions, onError, shouldCreateNewSourceFile) { var key = toPath(fileName); - var value = sourceFileCache.get(key); + var impliedNodeFormat = typeof languageVersionOrOptions === "object" ? languageVersionOrOptions.impliedNodeFormat : undefined; + var forImpliedNodeFormat = sourceFileCache.get(impliedNodeFormat); + var value = forImpliedNodeFormat === null || forImpliedNodeFormat === void 0 ? void 0 : forImpliedNodeFormat.get(key); if (value) return value; - var sourceFile = getSourceFile(fileName, languageVersion, onError, shouldCreateNewSourceFile); + var sourceFile = getSourceFile(fileName, languageVersionOrOptions, onError, shouldCreateNewSourceFile); if (sourceFile && (ts.isDeclarationFileName(fileName) || ts.fileExtensionIs(fileName, ".json" /* Extension.Json */))) { - sourceFileCache.set(key, sourceFile); + sourceFileCache.set(impliedNodeFormat, (forImpliedNodeFormat || new ts.Map()).set(key, sourceFile)); } return sourceFile; } : undefined; @@ -118626,13 +118628,15 @@ var ts; var value = readFileCache.get(key); if (value !== undefined && value !== data) { readFileCache.delete(key); - sourceFileCache.delete(key); + sourceFileCache.forEach(function (map) { return map.delete(key); }); } else if (getSourceFileWithCache) { - var sourceFile = sourceFileCache.get(key); - if (sourceFile && sourceFile.text !== data) { - sourceFileCache.delete(key); - } + sourceFileCache.forEach(function (map) { + var sourceFile = map.get(key); + if (sourceFile && sourceFile.text !== data) { + map.delete(key); + } + }); } originalWriteFile.call.apply(originalWriteFile, __spreadArray([host, fileName, data], rest, false)); }; diff --git a/lib/typingsInstaller.js b/lib/typingsInstaller.js index 764e544746138..ed96b50501b72 100644 --- a/lib/typingsInstaller.js +++ b/lib/typingsInstaller.js @@ -45,7 +45,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) { function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); - while (_) try { + while (g && (g = 0, op[0] && (_ = 0)), _) try { if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { @@ -118584,14 +118584,16 @@ var ts; } return setReadFileCache(key, fileName); }; - var getSourceFileWithCache = getSourceFile ? function (fileName, languageVersion, onError, shouldCreateNewSourceFile) { + var getSourceFileWithCache = getSourceFile ? function (fileName, languageVersionOrOptions, onError, shouldCreateNewSourceFile) { var key = toPath(fileName); - var value = sourceFileCache.get(key); + var impliedNodeFormat = typeof languageVersionOrOptions === "object" ? languageVersionOrOptions.impliedNodeFormat : undefined; + var forImpliedNodeFormat = sourceFileCache.get(impliedNodeFormat); + var value = forImpliedNodeFormat === null || forImpliedNodeFormat === void 0 ? void 0 : forImpliedNodeFormat.get(key); if (value) return value; - var sourceFile = getSourceFile(fileName, languageVersion, onError, shouldCreateNewSourceFile); + var sourceFile = getSourceFile(fileName, languageVersionOrOptions, onError, shouldCreateNewSourceFile); if (sourceFile && (ts.isDeclarationFileName(fileName) || ts.fileExtensionIs(fileName, ".json" /* Extension.Json */))) { - sourceFileCache.set(key, sourceFile); + sourceFileCache.set(impliedNodeFormat, (forImpliedNodeFormat || new ts.Map()).set(key, sourceFile)); } return sourceFile; } : undefined; @@ -118616,13 +118618,15 @@ var ts; var value = readFileCache.get(key); if (value !== undefined && value !== data) { readFileCache.delete(key); - sourceFileCache.delete(key); + sourceFileCache.forEach(function (map) { return map.delete(key); }); } else if (getSourceFileWithCache) { - var sourceFile = sourceFileCache.get(key); - if (sourceFile && sourceFile.text !== data) { - sourceFileCache.delete(key); - } + sourceFileCache.forEach(function (map) { + var sourceFile = map.get(key); + if (sourceFile && sourceFile.text !== data) { + map.delete(key); + } + }); } originalWriteFile.call.apply(originalWriteFile, __spreadArray([host, fileName, data], rest, false)); };