From 6d54ce8a37595c041df97c32d7f0ccd88570998d Mon Sep 17 00:00:00 2001 From: TypeScript Bot Date: Wed, 16 Jun 2021 22:33:48 +0000 Subject: [PATCH] Bump version to 4.0.8 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 1a208ecb91e..71968d70d85 100644 --- a/lib/tsc.js +++ b/lib/tsc.js @@ -67,7 +67,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) { var ts; (function (ts) { ts.versionMajorMinor = "4.0"; - ts.version = "4.0.7"; + ts.version = "4.0.8"; var NativeCollections; (function (NativeCollections) { function tryGetNativeMap() { @@ -3516,8 +3516,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; } } @@ -3562,6 +3562,9 @@ var ts; } }; return nodeSystem; + function statSync(path) { + return _fs.statSync(path, { throwIfNoEntry: false }); + } function enableCPUProfiler(path, cb) { if (activeSession) { cb(); @@ -3607,19 +3610,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))); } @@ -3808,7 +3812,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; @@ -3839,7 +3846,10 @@ var ts; var originalStackTraceLimit = Error.stackTraceLimit; Error.stackTraceLimit = 0; 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(); @@ -3871,8 +3881,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 ea7ffedb361..ffcfadd7277 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 = "4.0"; /** The version of the TypeScript compiler release */ - ts.version = "4.0.7"; + ts.version = "4.0.8"; /* @internal */ var Comparison; (function (Comparison) { @@ -5793,8 +5793,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; } } @@ -5840,6 +5840,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 @@ -5894,20 +5903,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))); @@ -6146,7 +6156,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; @@ -6179,7 +6192,10 @@ var ts; var originalStackTraceLimit = Error.stackTraceLimit; Error.stackTraceLimit = 0; 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(); @@ -6211,8 +6227,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; @@ -157350,6 +157367,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 6304b1b3441..c84cf087d97 100644 --- a/lib/tsserverlibrary.js +++ b/lib/tsserverlibrary.js @@ -288,7 +288,7 @@ var ts; // If changing the text in this section, be sure to test `configurePrerelease` too. ts.versionMajorMinor = "4.0"; /** The version of the TypeScript compiler release */ - ts.version = "4.0.7"; + ts.version = "4.0.8"; /* @internal */ var Comparison; (function (Comparison) { @@ -5987,8 +5987,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; } } @@ -6034,6 +6034,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 @@ -6088,20 +6097,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))); @@ -6340,7 +6350,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; @@ -6373,7 +6386,10 @@ var ts; var originalStackTraceLimit = Error.stackTraceLimit; Error.stackTraceLimit = 0; 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(); @@ -6405,8 +6421,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 093cea6ad86..6bdd4352e48 100644 --- a/lib/typescript.js +++ b/lib/typescript.js @@ -288,7 +288,7 @@ var ts; // If changing the text in this section, be sure to test `configurePrerelease` too. ts.versionMajorMinor = "4.0"; /** The version of the TypeScript compiler release */ - ts.version = "4.0.7"; + ts.version = "4.0.8"; /* @internal */ var Comparison; (function (Comparison) { @@ -5987,8 +5987,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; } } @@ -6034,6 +6034,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 @@ -6088,20 +6097,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))); @@ -6340,7 +6350,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; @@ -6373,7 +6386,10 @@ var ts; var originalStackTraceLimit = Error.stackTraceLimit; Error.stackTraceLimit = 0; 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(); @@ -6405,8 +6421,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 6cd7b3ab6e9..d09ab296964 100644 --- a/lib/typescriptServices.js +++ b/lib/typescriptServices.js @@ -288,7 +288,7 @@ var ts; // If changing the text in this section, be sure to test `configurePrerelease` too. ts.versionMajorMinor = "4.0"; /** The version of the TypeScript compiler release */ - ts.version = "4.0.7"; + ts.version = "4.0.8"; /* @internal */ var Comparison; (function (Comparison) { @@ -5987,8 +5987,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; } } @@ -6034,6 +6034,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 @@ -6088,20 +6097,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))); @@ -6340,7 +6350,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; @@ -6373,7 +6386,10 @@ var ts; var originalStackTraceLimit = Error.stackTraceLimit; Error.stackTraceLimit = 0; 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(); @@ -6405,8 +6421,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 242cb2f8ec3..e372c622ae5 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 = "4.0"; /** The version of the TypeScript compiler release */ - ts.version = "4.0.7"; + ts.version = "4.0.8"; /* @internal */ var Comparison; (function (Comparison) { @@ -5782,8 +5782,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; } } @@ -5829,6 +5829,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 @@ -5883,20 +5892,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))); @@ -6135,7 +6145,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; @@ -6168,7 +6181,10 @@ var ts; var originalStackTraceLimit = Error.stackTraceLimit; Error.stackTraceLimit = 0; 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(); @@ -6200,8 +6216,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 7181ffc344d..8b8d87cc873 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "typescript", "author": "Microsoft Corp.", "homepage": "https://www.typescriptlang.org/", - "version": "4.0.7", + "version": "4.0.8", "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 4e8aab3154b..d120f26c1d0 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 = "4.0"; /** The version of the TypeScript compiler release */ - export const version = "4.0.7" as string; + export const version = "4.0.8" as string; /** * Type of objects whose values are all of the same type.