From b7de5e3c4cd11f9bdbcb5e741125f79ec9853bfe Mon Sep 17 00:00:00 2001 From: TypeScript Bot Date: Wed, 16 Jun 2021 00:17:18 +0000 Subject: [PATCH] Bump version to 3.9.10 and LKG --- lib/tsc.js | 29 ++++++++++++++++++++--------- lib/tsserver.js | 36 +++++++++++++++++++++++++++--------- lib/tsserverlibrary.js | 35 ++++++++++++++++++++++++++--------- lib/typescript.js | 35 ++++++++++++++++++++++++++--------- lib/typescriptServices.js | 35 ++++++++++++++++++++++++++--------- lib/typingsInstaller.js | 35 ++++++++++++++++++++++++++--------- package.json | 2 +- src/compiler/corePublic.ts | 2 +- 8 files changed, 153 insertions(+), 56 deletions(-) diff --git a/lib/tsc.js b/lib/tsc.js index b57ed61921f40..a7d235c6b9e4d 100644 --- a/lib/tsc.js +++ b/lib/tsc.js @@ -67,7 +67,7 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook var ts; (function (ts) { ts.versionMajorMinor = "3.9"; - ts.version = "3.9.9"; + ts.version = "3.9.10"; function tryGetNativeMap() { return typeof Map !== "undefined" && "entries" in Map.prototype ? Map : undefined; } @@ -3279,8 +3279,8 @@ var ts; }, getFileSize: function (path) { try { - var stat = _fs.statSync(path); - if (stat.isFile()) { + var stat = statSync(path); + if (stat === null || stat === void 0 ? void 0 : stat.isFile()) { return stat.size; } } @@ -3325,6 +3325,9 @@ var ts; } }; return nodeSystem; + function statSync(path) { + return _fs.statSync(path, { throwIfNoEntry: false }); + } function enableCPUProfiler(path, cb) { if (activeSession) { cb(); @@ -3370,19 +3373,20 @@ var ts; if (activeSession && activeSession !== "stopping") { var s_1 = activeSession; activeSession.post("Profiler.stop", function (err, _a) { + var _b; var profile = _a.profile; if (!err) { try { - if (_fs.statSync(profilePath).isDirectory()) { + if ((_b = statSync(profilePath)) === null || _b === void 0 ? void 0 : _b.isDirectory()) { profilePath = _path.join(profilePath, (new Date()).toISOString().replace(/:/g, "-") + "+P" + process.pid + ".cpuprofile"); } } - catch (_b) { + catch (_c) { } try { _fs.mkdirSync(_path.dirname(profilePath), { recursive: true }); } - catch (_c) { + catch (_d) { } _fs.writeFileSync(profilePath, JSON.stringify(cleanupPaths(profile))); } @@ -3571,7 +3575,10 @@ var ts; if (typeof dirent === "string" || dirent.isSymbolicLink()) { var name = ts.combinePaths(path, entry); try { - stat = _fs.statSync(name); + stat = statSync(name); + if (!stat) { + continue; + } } catch (e) { continue; @@ -3600,7 +3607,10 @@ var ts; } function fileSystemEntryExists(path, entryKind) { try { - var stat = _fs.statSync(path); + var stat = statSync(path); + if (!stat) { + return false; + } switch (entryKind) { case 0: return stat.isFile(); case 1: return stat.isDirectory(); @@ -3629,8 +3639,9 @@ var ts; } } function getModifiedTime(path) { + var _a; try { - return _fs.statSync(path).mtime; + return (_a = statSync(path)) === null || _a === void 0 ? void 0 : _a.mtime; } catch (e) { return undefined; diff --git a/lib/tsserver.js b/lib/tsserver.js index 22bbc400d7013..59a5b24fbbf2e 100644 --- a/lib/tsserver.js +++ b/lib/tsserver.js @@ -94,7 +94,7 @@ var ts; // If changing the text in this section, be sure to test `configurePrerelease` too. ts.versionMajorMinor = "3.9"; /** The version of the TypeScript compiler release */ - ts.version = "3.9.9"; + ts.version = "3.9.10"; /** * Returns the native Map implementation if it is available and compatible (i.e. supports iteration). */ @@ -5516,8 +5516,8 @@ var ts; }, getFileSize: function (path) { try { - var stat = _fs.statSync(path); - if (stat.isFile()) { + var stat = statSync(path); + if (stat === null || stat === void 0 ? void 0 : stat.isFile()) { return stat.size; } } @@ -5563,6 +5563,15 @@ var ts; } }; return nodeSystem; + /** + * `throwIfNoEntry` was added so recently that it's not in the node types. + * This helper encapsulates the mitigating usage of `any`. + * See https://github.com/nodejs/node/pull/33716 + */ + function statSync(path) { + // throwIfNoEntry will be ignored by older versions of node + return _fs.statSync(path, { throwIfNoEntry: false }); + } /** * Uses the builtin inspector APIs to capture a CPU profile * See https://nodejs.org/api/inspector.html#inspector_example_usage for details @@ -5617,20 +5626,21 @@ var ts; if (activeSession && activeSession !== "stopping") { var s_1 = activeSession; activeSession.post("Profiler.stop", function (err, _a) { + var _b; var profile = _a.profile; if (!err) { try { - if (_fs.statSync(profilePath).isDirectory()) { + if ((_b = statSync(profilePath)) === null || _b === void 0 ? void 0 : _b.isDirectory()) { profilePath = _path.join(profilePath, (new Date()).toISOString().replace(/:/g, "-") + "+P" + process.pid + ".cpuprofile"); } } - catch (_b) { + catch (_c) { // do nothing and ignore fallible fs operation } try { _fs.mkdirSync(_path.dirname(profilePath), { recursive: true }); } - catch (_c) { + catch (_d) { // do nothing and ignore fallible fs operation } _fs.writeFileSync(profilePath, JSON.stringify(cleanupPaths(profile))); @@ -5869,7 +5879,10 @@ var ts; if (typeof dirent === "string" || dirent.isSymbolicLink()) { var name = ts.combinePaths(path, entry); try { - stat = _fs.statSync(name); + stat = statSync(name); + if (!stat) { + continue; + } } catch (e) { continue; @@ -5898,7 +5911,10 @@ var ts; } function fileSystemEntryExists(path, entryKind) { try { - var stat = _fs.statSync(path); + var stat = statSync(path); + if (!stat) { + return false; + } switch (entryKind) { case 0 /* File */: return stat.isFile(); case 1 /* Directory */: return stat.isDirectory(); @@ -5927,8 +5943,9 @@ var ts; } } function getModifiedTime(path) { + var _a; try { - return _fs.statSync(path).mtime; + return (_a = statSync(path)) === null || _a === void 0 ? void 0 : _a.mtime; } catch (e) { return undefined; @@ -150988,6 +151005,7 @@ var ts; var nextFileToCheck = 0; return { getModifiedTime: getModifiedTime, poll: poll, startWatchTimer: startWatchTimer, addFile: addFile, removeFile: removeFile }; function getModifiedTime(fileName) { + // Caller guarantees that `fileName` exists, so there'd be no benefit from throwIfNoEntry return fs.statSync(fileName).mtime; } function poll(checkedIndex) { diff --git a/lib/tsserverlibrary.js b/lib/tsserverlibrary.js index f641900569730..0ffb92ce37b57 100644 --- a/lib/tsserverlibrary.js +++ b/lib/tsserverlibrary.js @@ -244,7 +244,7 @@ var ts; // If changing the text in this section, be sure to test `configurePrerelease` too. ts.versionMajorMinor = "3.9"; /** The version of the TypeScript compiler release */ - ts.version = "3.9.9"; + ts.version = "3.9.10"; /** * Returns the native Map implementation if it is available and compatible (i.e. supports iteration). */ @@ -5666,8 +5666,8 @@ var ts; }, getFileSize: function (path) { try { - var stat = _fs.statSync(path); - if (stat.isFile()) { + var stat = statSync(path); + if (stat === null || stat === void 0 ? void 0 : stat.isFile()) { return stat.size; } } @@ -5713,6 +5713,15 @@ var ts; } }; return nodeSystem; + /** + * `throwIfNoEntry` was added so recently that it's not in the node types. + * This helper encapsulates the mitigating usage of `any`. + * See https://github.com/nodejs/node/pull/33716 + */ + function statSync(path) { + // throwIfNoEntry will be ignored by older versions of node + return _fs.statSync(path, { throwIfNoEntry: false }); + } /** * Uses the builtin inspector APIs to capture a CPU profile * See https://nodejs.org/api/inspector.html#inspector_example_usage for details @@ -5767,20 +5776,21 @@ var ts; if (activeSession && activeSession !== "stopping") { var s_1 = activeSession; activeSession.post("Profiler.stop", function (err, _a) { + var _b; var profile = _a.profile; if (!err) { try { - if (_fs.statSync(profilePath).isDirectory()) { + if ((_b = statSync(profilePath)) === null || _b === void 0 ? void 0 : _b.isDirectory()) { profilePath = _path.join(profilePath, (new Date()).toISOString().replace(/:/g, "-") + "+P" + process.pid + ".cpuprofile"); } } - catch (_b) { + catch (_c) { // do nothing and ignore fallible fs operation } try { _fs.mkdirSync(_path.dirname(profilePath), { recursive: true }); } - catch (_c) { + catch (_d) { // do nothing and ignore fallible fs operation } _fs.writeFileSync(profilePath, JSON.stringify(cleanupPaths(profile))); @@ -6019,7 +6029,10 @@ var ts; if (typeof dirent === "string" || dirent.isSymbolicLink()) { var name = ts.combinePaths(path, entry); try { - stat = _fs.statSync(name); + stat = statSync(name); + if (!stat) { + continue; + } } catch (e) { continue; @@ -6048,7 +6061,10 @@ var ts; } function fileSystemEntryExists(path, entryKind) { try { - var stat = _fs.statSync(path); + var stat = statSync(path); + if (!stat) { + return false; + } switch (entryKind) { case 0 /* File */: return stat.isFile(); case 1 /* Directory */: return stat.isDirectory(); @@ -6077,8 +6093,9 @@ var ts; } } function getModifiedTime(path) { + var _a; try { - return _fs.statSync(path).mtime; + return (_a = statSync(path)) === null || _a === void 0 ? void 0 : _a.mtime; } catch (e) { return undefined; diff --git a/lib/typescript.js b/lib/typescript.js index 4d40e415aa30c..d50bf7b1898dd 100644 --- a/lib/typescript.js +++ b/lib/typescript.js @@ -244,7 +244,7 @@ var ts; // If changing the text in this section, be sure to test `configurePrerelease` too. ts.versionMajorMinor = "3.9"; /** The version of the TypeScript compiler release */ - ts.version = "3.9.9"; + ts.version = "3.9.10"; /** * Returns the native Map implementation if it is available and compatible (i.e. supports iteration). */ @@ -5666,8 +5666,8 @@ var ts; }, getFileSize: function (path) { try { - var stat = _fs.statSync(path); - if (stat.isFile()) { + var stat = statSync(path); + if (stat === null || stat === void 0 ? void 0 : stat.isFile()) { return stat.size; } } @@ -5713,6 +5713,15 @@ var ts; } }; return nodeSystem; + /** + * `throwIfNoEntry` was added so recently that it's not in the node types. + * This helper encapsulates the mitigating usage of `any`. + * See https://github.com/nodejs/node/pull/33716 + */ + function statSync(path) { + // throwIfNoEntry will be ignored by older versions of node + return _fs.statSync(path, { throwIfNoEntry: false }); + } /** * Uses the builtin inspector APIs to capture a CPU profile * See https://nodejs.org/api/inspector.html#inspector_example_usage for details @@ -5767,20 +5776,21 @@ var ts; if (activeSession && activeSession !== "stopping") { var s_1 = activeSession; activeSession.post("Profiler.stop", function (err, _a) { + var _b; var profile = _a.profile; if (!err) { try { - if (_fs.statSync(profilePath).isDirectory()) { + if ((_b = statSync(profilePath)) === null || _b === void 0 ? void 0 : _b.isDirectory()) { profilePath = _path.join(profilePath, (new Date()).toISOString().replace(/:/g, "-") + "+P" + process.pid + ".cpuprofile"); } } - catch (_b) { + catch (_c) { // do nothing and ignore fallible fs operation } try { _fs.mkdirSync(_path.dirname(profilePath), { recursive: true }); } - catch (_c) { + catch (_d) { // do nothing and ignore fallible fs operation } _fs.writeFileSync(profilePath, JSON.stringify(cleanupPaths(profile))); @@ -6019,7 +6029,10 @@ var ts; if (typeof dirent === "string" || dirent.isSymbolicLink()) { var name = ts.combinePaths(path, entry); try { - stat = _fs.statSync(name); + stat = statSync(name); + if (!stat) { + continue; + } } catch (e) { continue; @@ -6048,7 +6061,10 @@ var ts; } function fileSystemEntryExists(path, entryKind) { try { - var stat = _fs.statSync(path); + var stat = statSync(path); + if (!stat) { + return false; + } switch (entryKind) { case 0 /* File */: return stat.isFile(); case 1 /* Directory */: return stat.isDirectory(); @@ -6077,8 +6093,9 @@ var ts; } } function getModifiedTime(path) { + var _a; try { - return _fs.statSync(path).mtime; + return (_a = statSync(path)) === null || _a === void 0 ? void 0 : _a.mtime; } catch (e) { return undefined; diff --git a/lib/typescriptServices.js b/lib/typescriptServices.js index 379191119f1e1..83830e2bc2f6c 100644 --- a/lib/typescriptServices.js +++ b/lib/typescriptServices.js @@ -244,7 +244,7 @@ var ts; // If changing the text in this section, be sure to test `configurePrerelease` too. ts.versionMajorMinor = "3.9"; /** The version of the TypeScript compiler release */ - ts.version = "3.9.9"; + ts.version = "3.9.10"; /** * Returns the native Map implementation if it is available and compatible (i.e. supports iteration). */ @@ -5666,8 +5666,8 @@ var ts; }, getFileSize: function (path) { try { - var stat = _fs.statSync(path); - if (stat.isFile()) { + var stat = statSync(path); + if (stat === null || stat === void 0 ? void 0 : stat.isFile()) { return stat.size; } } @@ -5713,6 +5713,15 @@ var ts; } }; return nodeSystem; + /** + * `throwIfNoEntry` was added so recently that it's not in the node types. + * This helper encapsulates the mitigating usage of `any`. + * See https://github.com/nodejs/node/pull/33716 + */ + function statSync(path) { + // throwIfNoEntry will be ignored by older versions of node + return _fs.statSync(path, { throwIfNoEntry: false }); + } /** * Uses the builtin inspector APIs to capture a CPU profile * See https://nodejs.org/api/inspector.html#inspector_example_usage for details @@ -5767,20 +5776,21 @@ var ts; if (activeSession && activeSession !== "stopping") { var s_1 = activeSession; activeSession.post("Profiler.stop", function (err, _a) { + var _b; var profile = _a.profile; if (!err) { try { - if (_fs.statSync(profilePath).isDirectory()) { + if ((_b = statSync(profilePath)) === null || _b === void 0 ? void 0 : _b.isDirectory()) { profilePath = _path.join(profilePath, (new Date()).toISOString().replace(/:/g, "-") + "+P" + process.pid + ".cpuprofile"); } } - catch (_b) { + catch (_c) { // do nothing and ignore fallible fs operation } try { _fs.mkdirSync(_path.dirname(profilePath), { recursive: true }); } - catch (_c) { + catch (_d) { // do nothing and ignore fallible fs operation } _fs.writeFileSync(profilePath, JSON.stringify(cleanupPaths(profile))); @@ -6019,7 +6029,10 @@ var ts; if (typeof dirent === "string" || dirent.isSymbolicLink()) { var name = ts.combinePaths(path, entry); try { - stat = _fs.statSync(name); + stat = statSync(name); + if (!stat) { + continue; + } } catch (e) { continue; @@ -6048,7 +6061,10 @@ var ts; } function fileSystemEntryExists(path, entryKind) { try { - var stat = _fs.statSync(path); + var stat = statSync(path); + if (!stat) { + return false; + } switch (entryKind) { case 0 /* File */: return stat.isFile(); case 1 /* Directory */: return stat.isDirectory(); @@ -6077,8 +6093,9 @@ var ts; } } function getModifiedTime(path) { + var _a; try { - return _fs.statSync(path).mtime; + return (_a = statSync(path)) === null || _a === void 0 ? void 0 : _a.mtime; } catch (e) { return undefined; diff --git a/lib/typingsInstaller.js b/lib/typingsInstaller.js index a990920d8e948..9ddfa75a59e2f 100644 --- a/lib/typingsInstaller.js +++ b/lib/typingsInstaller.js @@ -83,7 +83,7 @@ var ts; // If changing the text in this section, be sure to test `configurePrerelease` too. ts.versionMajorMinor = "3.9"; /** The version of the TypeScript compiler release */ - ts.version = "3.9.9"; + ts.version = "3.9.10"; /** * Returns the native Map implementation if it is available and compatible (i.e. supports iteration). */ @@ -5505,8 +5505,8 @@ var ts; }, getFileSize: function (path) { try { - var stat = _fs.statSync(path); - if (stat.isFile()) { + var stat = statSync(path); + if (stat === null || stat === void 0 ? void 0 : stat.isFile()) { return stat.size; } } @@ -5552,6 +5552,15 @@ var ts; } }; return nodeSystem; + /** + * `throwIfNoEntry` was added so recently that it's not in the node types. + * This helper encapsulates the mitigating usage of `any`. + * See https://github.com/nodejs/node/pull/33716 + */ + function statSync(path) { + // throwIfNoEntry will be ignored by older versions of node + return _fs.statSync(path, { throwIfNoEntry: false }); + } /** * Uses the builtin inspector APIs to capture a CPU profile * See https://nodejs.org/api/inspector.html#inspector_example_usage for details @@ -5606,20 +5615,21 @@ var ts; if (activeSession && activeSession !== "stopping") { var s_1 = activeSession; activeSession.post("Profiler.stop", function (err, _a) { + var _b; var profile = _a.profile; if (!err) { try { - if (_fs.statSync(profilePath).isDirectory()) { + if ((_b = statSync(profilePath)) === null || _b === void 0 ? void 0 : _b.isDirectory()) { profilePath = _path.join(profilePath, (new Date()).toISOString().replace(/:/g, "-") + "+P" + process.pid + ".cpuprofile"); } } - catch (_b) { + catch (_c) { // do nothing and ignore fallible fs operation } try { _fs.mkdirSync(_path.dirname(profilePath), { recursive: true }); } - catch (_c) { + catch (_d) { // do nothing and ignore fallible fs operation } _fs.writeFileSync(profilePath, JSON.stringify(cleanupPaths(profile))); @@ -5858,7 +5868,10 @@ var ts; if (typeof dirent === "string" || dirent.isSymbolicLink()) { var name = ts.combinePaths(path, entry); try { - stat = _fs.statSync(name); + stat = statSync(name); + if (!stat) { + continue; + } } catch (e) { continue; @@ -5887,7 +5900,10 @@ var ts; } function fileSystemEntryExists(path, entryKind) { try { - var stat = _fs.statSync(path); + var stat = statSync(path); + if (!stat) { + return false; + } switch (entryKind) { case 0 /* File */: return stat.isFile(); case 1 /* Directory */: return stat.isDirectory(); @@ -5916,8 +5932,9 @@ var ts; } } function getModifiedTime(path) { + var _a; try { - return _fs.statSync(path).mtime; + return (_a = statSync(path)) === null || _a === void 0 ? void 0 : _a.mtime; } catch (e) { return undefined; diff --git a/package.json b/package.json index 4d2db7fd319a0..69089c42b761c 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "typescript", "author": "Microsoft Corp.", "homepage": "https://www.typescriptlang.org/", - "version": "3.9.9", + "version": "3.9.10", "license": "Apache-2.0", "description": "TypeScript is a language for application scale JavaScript development", "keywords": [ diff --git a/src/compiler/corePublic.ts b/src/compiler/corePublic.ts index 5bf096b6c0cef..dee8774d6e470 100644 --- a/src/compiler/corePublic.ts +++ b/src/compiler/corePublic.ts @@ -3,7 +3,7 @@ namespace ts { // If changing the text in this section, be sure to test `configurePrerelease` too. export const versionMajorMinor = "3.9"; /** The version of the TypeScript compiler release */ - export const version = "3.9.9" as string; + export const version = "3.9.10" as string; /** * Type of objects whose values are all of the same type.