From cba4ae7924f838cbf3ed1691c1713054ff784929 Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Thu, 29 Sep 2022 15:08:53 -0700 Subject: [PATCH 1/7] Use typescript.js as source for typescriptServices --- build/importTypescript.ts | 14 +++----------- .../typescript/lib/typescriptServices-amd.js | 1 + .../typescript/lib/typescriptServices.d.ts | 4 +--- src/language/typescript/lib/typescriptServices.js | 1 + 4 files changed, 6 insertions(+), 14 deletions(-) diff --git a/build/importTypescript.ts b/build/importTypescript.ts index 930469cc89..ff05bcff71 100644 --- a/build/importTypescript.ts +++ b/build/importTypescript.ts @@ -35,9 +35,7 @@ const TYPESCRIPT_LIB_DESTINATION = path.join(REPO_ROOT, 'src/language/typescript export const typescriptVersion = "${typeScriptDependencyVersion}";\n` ); - let tsServices = fs - .readFileSync(path.join(TYPESCRIPT_LIB_SOURCE, 'typescriptServices.js')) - .toString(); + let tsServices = fs.readFileSync(path.join(TYPESCRIPT_LIB_SOURCE, 'typescript.js')).toString(); // Ensure we never run into the node system... // (this also removes require calls that trick webpack into shimming those modules...) @@ -149,14 +147,8 @@ export var typescript = ts; stripSourceMaps(tsServices_esm) ); - let dtsServices = fs - .readFileSync(path.join(TYPESCRIPT_LIB_SOURCE, 'typescriptServices.d.ts')) - .toString(); - dtsServices += ` -// MONACOCHANGE -export = ts; -// END MONACOCHANGE -`; + let dtsServices = fs.readFileSync(path.join(TYPESCRIPT_LIB_SOURCE, 'typescript.d.ts')).toString(); + fs.writeFileSync( path.join(TYPESCRIPT_LIB_DESTINATION, 'typescriptServices.d.ts'), generatedNote + dtsServices diff --git a/src/language/typescript/lib/typescriptServices-amd.js b/src/language/typescript/lib/typescriptServices-amd.js index 1a6f35111e..55d72f7bae 100644 --- a/src/language/typescript/lib/typescriptServices-amd.js +++ b/src/language/typescript/lib/typescriptServices-amd.js @@ -163529,6 +163529,7 @@ var ts; + // MONACOCHANGE // Defining the entire module name because r.js has an issue and cannot bundle this file // correctly with an anonymous define call diff --git a/src/language/typescript/lib/typescriptServices.d.ts b/src/language/typescript/lib/typescriptServices.d.ts index 99187a6f61..f600542b09 100644 --- a/src/language/typescript/lib/typescriptServices.d.ts +++ b/src/language/typescript/lib/typescriptServices.d.ts @@ -7594,6 +7594,4 @@ declare namespace ts { const isIdentifierOrPrivateIdentifier: (node: Node) => node is MemberName; } -// MONACOCHANGE -export = ts; -// END MONACOCHANGE +export = ts; \ No newline at end of file diff --git a/src/language/typescript/lib/typescriptServices.js b/src/language/typescript/lib/typescriptServices.js index 49b7ebb894..fec0134f6d 100644 --- a/src/language/typescript/lib/typescriptServices.js +++ b/src/language/typescript/lib/typescriptServices.js @@ -163529,6 +163529,7 @@ var ts; + // MONACOCHANGE export var createClassifier = ts.createClassifier; export var createLanguageService = ts.createLanguageService; From 7e1e4d4cec1349f228cbb7799fde70391a677481 Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Tue, 4 Oct 2022 20:20:28 -0700 Subject: [PATCH 2/7] Support moduleified TS --- build/importTypescript.ts | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/build/importTypescript.ts b/build/importTypescript.ts index ff05bcff71..305e7f850b 100644 --- a/build/importTypescript.ts +++ b/build/importTypescript.ts @@ -43,6 +43,11 @@ export const typescriptVersion = "${typeScriptDependencyVersion}";\n` /\n ts\.sys =([^]*)\n \}\)\(\);/m, `\n // MONACOCHANGE\n ts.sys = undefined;\n // END MONACOCHANGE` ); + tsServices = tsServices.replace( + // module'd TS + /^ var sys =([^]*)\n function setSys\(/m, + ` // MONACOCHANGE\n var sys = undefined;\n // END MONACOCHANGE\n function setSys(` + ); // Eliminate more require() calls... tsServices = tsServices.replace( @@ -50,9 +55,15 @@ export const typescriptVersion = "${typeScriptDependencyVersion}";\n` '$1// MONACOCHANGE\n$1etwModule = undefined;\n$1// END MONACOCHANGE' ); tsServices = tsServices.replace( + // module'd TS /^( +)var result = ts\.sys\.require\(.*$/m, '$1// MONACOCHANGE\n$1var result = undefined;\n$1// END MONACOCHANGE' ); + tsServices = tsServices.replace( + // module'd TS + /^( +)(var|const|let) result = sys\.require\(.*$/m, + '$1// MONACOCHANGE\n$1$2 result = undefined;\n$1// END MONACOCHANGE' + ); tsServices = tsServices.replace( /^( +)fs = require\("fs"\);$/m, '$1// MONACOCHANGE\n$1fs = undefined;\n$1// END MONACOCHANGE' @@ -89,7 +100,12 @@ export const typescriptVersion = "${typeScriptDependencyVersion}";\n` // Allow error messages to include references to require() in their strings const runtimeRequires = linesWithRequire && - linesWithRequire.filter((l) => !l.includes(': diag(') && !l.includes('ts.DiagnosticCategory')); + linesWithRequire.filter( + (l) => + !l.includes(': diag(') && + !l.includes('ts.DiagnosticCategory') && + !/`[^`]*require[^`]+`/.test(l) + ); if (runtimeRequires && runtimeRequires.length && linesWithRequire) { console.error( From e07915ccbc100f8a386b259320037c46361d6d1c Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Tue, 4 Oct 2022 22:28:23 -0700 Subject: [PATCH 3/7] Hack things to retry --- build/importTypescript.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build/importTypescript.ts b/build/importTypescript.ts index 305e7f850b..5a860a18db 100644 --- a/build/importTypescript.ts +++ b/build/importTypescript.ts @@ -104,7 +104,8 @@ export const typescriptVersion = "${typeScriptDependencyVersion}";\n` (l) => !l.includes(': diag(') && !l.includes('ts.DiagnosticCategory') && - !/`[^`]*require[^`]+`/.test(l) + !/`[^`]*require[^`]+`/.test(l) && + !/"[^"]*require[^"]+"/.test(l) // hack ); if (runtimeRequires && runtimeRequires.length && linesWithRequire) { From 333b37d6b948a5b98dd8340f4d2b6e1c8aff8cac Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Tue, 4 Oct 2022 22:29:16 -0700 Subject: [PATCH 4/7] Fix indent --- build/importTypescript.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/importTypescript.ts b/build/importTypescript.ts index 5a860a18db..1941a4aa3a 100644 --- a/build/importTypescript.ts +++ b/build/importTypescript.ts @@ -105,7 +105,7 @@ export const typescriptVersion = "${typeScriptDependencyVersion}";\n` !l.includes(': diag(') && !l.includes('ts.DiagnosticCategory') && !/`[^`]*require[^`]+`/.test(l) && - !/"[^"]*require[^"]+"/.test(l) // hack + !/"[^"]*require[^"]+"/.test(l) // hack ); if (runtimeRequires && runtimeRequires.length && linesWithRequire) { From 161611c1265453cb0431e6d68c5b48e5e8b4c4eb Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Wed, 5 Oct 2022 15:53:20 -0700 Subject: [PATCH 5/7] Use transformer to remove require calls and nodeSystem from typescript.js --- build/importTypescript.ts | 145 +- .../typescript/lib/typescriptServices-amd.js | 2275 +++++++++++------ .../typescript/lib/typescriptServices.js | 2275 +++++++++++------ 3 files changed, 3159 insertions(+), 1536 deletions(-) diff --git a/build/importTypescript.ts b/build/importTypescript.ts index 1941a4aa3a..58539eeea0 100644 --- a/build/importTypescript.ts +++ b/build/importTypescript.ts @@ -6,6 +6,7 @@ import path = require('path'); import fs = require('fs'); import child_process = require('child_process'); +import ts = require('typescript'); import { REPO_ROOT } from './utils'; const generatedNote = `// @@ -37,48 +38,92 @@ export const typescriptVersion = "${typeScriptDependencyVersion}";\n` let tsServices = fs.readFileSync(path.join(TYPESCRIPT_LIB_SOURCE, 'typescript.js')).toString(); - // Ensure we never run into the node system... - // (this also removes require calls that trick webpack into shimming those modules...) - tsServices = tsServices.replace( - /\n ts\.sys =([^]*)\n \}\)\(\);/m, - `\n // MONACOCHANGE\n ts.sys = undefined;\n // END MONACOCHANGE` - ); - tsServices = tsServices.replace( - // module'd TS - /^ var sys =([^]*)\n function setSys\(/m, - ` // MONACOCHANGE\n var sys = undefined;\n // END MONACOCHANGE\n function setSys(` - ); + const transformed = ts.transpileModule(tsServices, { + compilerOptions: { + target: ts.ScriptTarget.Latest + }, + transformers: { + after: [ + (context) => { + function isRequireCall(node: ts.Node): node is ts.CallExpression { + return (ts as any).isRequireCall(node); + } + + return (sourceFile) => { + return ts.visitEachChild( + sourceFile, + function visit(node) { + // Replace require calls with functions that return undefined. + if (isRequireCall(node)) { + return context.factory.updateCallExpression( + node, + context.factory.createParenthesizedExpression( + context.factory.createFunctionExpression( + /*modifiers*/ undefined, + /*asteriskToken*/ undefined, + context.factory.createIdentifier('MONACOCHANGE_require'), + /*typeParameters*/ undefined, + /*parameters*/ undefined, + /*type*/ undefined, + context.factory.createBlock([]) + ) + ), + node.typeArguments, + node.arguments + ); + } + + // Ensure we never run into the node system... + if (ts.isFunctionDeclaration(node) && node.name?.escapedText === 'getNodeSystem') { + // HACK: don't call the deprecated method when the new one is available. + if (parseFloat(ts.versionMajorMinor) < 4.8) { + return context.factory.updateFunctionDeclaration( + node, + node.decorators, + node.modifiers, + node.asteriskToken, + node.name, + node.typeParameters, + node.parameters, + node.type, + context.factory.createBlock([]) + ); + } else { + return (context.factory.updateFunctionDeclaration as any)( + node, + node.modifiers, + node.asteriskToken, + node.name, + node.typeParameters, + node.parameters, + node.type, + context.factory.createBlock([]) + ); + } + } + return ts.visitEachChild(node, visit, context); + }, + context + ); + }; + } + ] + } + }); + + tsServices = transformed.outputText; - // Eliminate more require() calls... - tsServices = tsServices.replace( - /^( +)etwModule = require\(.*$/m, - '$1// MONACOCHANGE\n$1etwModule = undefined;\n$1// END MONACOCHANGE' - ); - tsServices = tsServices.replace( - // module'd TS - /^( +)var result = ts\.sys\.require\(.*$/m, - '$1// MONACOCHANGE\n$1var result = undefined;\n$1// END MONACOCHANGE' - ); - tsServices = tsServices.replace( - // module'd TS - /^( +)(var|const|let) result = sys\.require\(.*$/m, - '$1// MONACOCHANGE\n$1$2 result = undefined;\n$1// END MONACOCHANGE' - ); - tsServices = tsServices.replace( - /^( +)fs = require\("fs"\);$/m, - '$1// MONACOCHANGE\n$1fs = undefined;\n$1// END MONACOCHANGE' - ); tsServices = tsServices.replace( /^( +)debugger;$/m, '$1// MONACOCHANGE\n$1// debugger;\n$1// END MONACOCHANGE' ); tsServices = tsServices.replace( - /= require\("perf_hooks"\)/m, - '/* MONACOCHANGE */= {}/* END MONACOCHANGE */' + /typeof require === "function"/m, + '/* MONACOCHANGE */ false /* END MONACOCHANGE */' ); tsServices = tsServices.replace( - /typeof require === "function"/m, - '/* MONACOCHANGE */false/* END MONACOCHANGE */' + /typeof require !== "undefined"/m, + '/* MONACOCHANGE */ false /* END MONACOCHANGE */' ); tsServices = tsServices.replace( @@ -86,38 +131,6 @@ export const typescriptVersion = "${typeScriptDependencyVersion}";\n` '/* MONACOCHANGE */ /*module.exports = ts;*/ /* END MONACOCHANGE */' ); - // Flag any new require calls (outside comments) so they can be corrected preemptively. - // To avoid missing cases (or using an even more complex regex), temporarily remove comments - // about require() and then check for lines actually calling require(). - // \/[*/] matches the start of a comment (single or multi-line). - // ^\s+\*[^/] matches (presumably) a later line of a multi-line comment. - const tsServicesNoCommentedRequire = tsServices.replace( - /(\/[*/]|^\s+\*[^/]).*\brequire\(.*/gm, - '' - ); - const linesWithRequire = tsServicesNoCommentedRequire.match(/^.*?\brequire\(.*$/gm); - - // Allow error messages to include references to require() in their strings - const runtimeRequires = - linesWithRequire && - linesWithRequire.filter( - (l) => - !l.includes(': diag(') && - !l.includes('ts.DiagnosticCategory') && - !/`[^`]*require[^`]+`/.test(l) && - !/"[^"]*require[^"]+"/.test(l) // hack - ); - - if (runtimeRequires && runtimeRequires.length && linesWithRequire) { - console.error( - 'Found new require() calls on the following lines. These should be removed to avoid breaking webpack builds.\n' - ); - console.error( - runtimeRequires.map((r) => `${r} (${tsServicesNoCommentedRequire.indexOf(r)})`).join('\n') - ); - process.exit(1); - } - const tsServices_amd = generatedNote + tsServices + diff --git a/src/language/typescript/lib/typescriptServices-amd.js b/src/language/typescript/lib/typescriptServices-amd.js index 55d72f7bae..d44945288e 100644 --- a/src/language/typescript/lib/typescriptServices-amd.js +++ b/src/language/typescript/lib/typescriptServices-amd.js @@ -15,63 +15,113 @@ MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ - "use strict"; var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { - if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { - if (ar || !(i in from)) { - if (!ar) ar = Array.prototype.slice.call(from, 0, i); - ar[i] = from[i]; + if (pack || arguments.length === 2) + for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) + ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } } - } return to.concat(ar || Array.prototype.slice.call(from)); }; var __assign = (this && this.__assign) || function () { - __assign = Object.assign || function(t) { + __assign = Object.assign || function (t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) - t[p] = s[p]; + for (var p in s) + if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) { - if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } + if (Object.defineProperty) { + Object.defineProperty(cooked, "raw", { value: raw }); + } + else { + cooked.raw = raw; + } return cooked; }; var __generator = (this && this.__generator) || function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + var _ = { label: 0, sent: function () { if (t[0] & 1) + throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) 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]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; + if (f) + throw new TypeError("Generator is already executing."); + while (_) + 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]) { + case 0: + case 1: + t = op; + break; + case 4: + _.label++; + return { value: op[1], done: false }; + case 5: + _.label++; + y = op[1]; + op = [0]; + continue; + case 7: + op = _.ops.pop(); + _.trys.pop(); + continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { + _ = 0; + continue; + } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { + _.label = op[1]; + break; + } + if (op[0] === 6 && _.label < t[1]) { + _.label = t[1]; + t = op; + break; + } + if (t && _.label < t[2]) { + _.label = t[2]; + _.ops.push(op); + break; + } + if (t[2]) + _.ops.pop(); + _.trys.pop(); + continue; + } + op = body.call(thisArg, _); + } + catch (e) { + op = [6, e]; + y = 0; } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + finally { + f = t = 0; + } + if (op[0] & 5) + throw op[1]; + return { value: op[0] ? op[1] : void 0, done: true }; } }; var __rest = (this && this.__rest) || function (s, e) { var t = {}; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) - t[p] = s[p]; + for (var p in s) + if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) @@ -83,7 +133,9 @@ var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + function (d, b) { for (var p in b) + if (Object.prototype.hasOwnProperty.call(b, p)) + d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { @@ -571,7 +623,9 @@ var ts; } ts.findMap = findMap; function contains(array, value, equalityComparer) { - if (equalityComparer === void 0) { equalityComparer = equateValues; } + if (equalityComparer === void 0) { + equalityComparer = equateValues; + } if (array) { for (var _i = 0, array_1 = array; _i < array_1.length; _i++) { var v = array_1[_i]; @@ -584,7 +638,9 @@ var ts; } ts.contains = contains; function arraysEqual(a, b, equalityComparer) { - if (equalityComparer === void 0) { equalityComparer = equateValues; } + if (equalityComparer === void 0) { + equalityComparer = equateValues; + } return a.length === b.length && a.every(function (x, i) { return equalityComparer(x, b[i]); }); } ts.arraysEqual = arraysEqual; @@ -1090,7 +1146,9 @@ var ts; } ts.arrayIsSorted = arrayIsSorted; function arrayIsEqualTo(array1, array2, equalityComparer) { - if (equalityComparer === void 0) { equalityComparer = equateValues; } + if (equalityComparer === void 0) { + equalityComparer = equateValues; + } if (!array1 || !array2) { return array1 === array2; } @@ -1541,7 +1599,9 @@ var ts; * @param right A map-like whose properties should be compared. */ function equalOwnProperties(left, right, equalityComparer) { - if (equalityComparer === void 0) { equalityComparer = equateValues; } + if (equalityComparer === void 0) { + equalityComparer = equateValues; + } if (left === right) return true; if (!left || !right) @@ -1564,7 +1624,9 @@ var ts; } ts.equalOwnProperties = equalOwnProperties; function arrayToMap(array, makeKey, makeValue) { - if (makeValue === void 0) { makeValue = identity; } + if (makeValue === void 0) { + makeValue = identity; + } var result = new ts.Map(); for (var _i = 0, array_6 = array; _i < array_6.length; _i++) { var value = array_6[_i]; @@ -1576,7 +1638,9 @@ var ts; } ts.arrayToMap = arrayToMap; function arrayToNumericMap(array, makeKey, makeValue) { - if (makeValue === void 0) { makeValue = identity; } + if (makeValue === void 0) { + makeValue = identity; + } var result = []; for (var _i = 0, array_7 = array; _i < array_7.length; _i++) { var value = array_7[_i]; @@ -1586,7 +1650,9 @@ var ts; } ts.arrayToNumericMap = arrayToNumericMap; function arrayToMultiMap(values, makeKey, makeValue) { - if (makeValue === void 0) { makeValue = identity; } + if (makeValue === void 0) { + makeValue = identity; + } var result = createMultiMap(); for (var _i = 0, values_1 = values; _i < values_1.length; _i++) { var value = values_1[_i]; @@ -1596,7 +1662,9 @@ var ts; } ts.arrayToMultiMap = arrayToMultiMap; function group(values, getGroupId, resultSelector) { - if (resultSelector === void 0) { resultSelector = identity; } + if (resultSelector === void 0) { + resultSelector = identity; + } return arrayFrom(arrayToMultiMap(values, getGroupId).values(), resultSelector); } ts.group = group; @@ -2279,7 +2347,9 @@ var ts; } ts.removePrefix = removePrefix; function tryRemovePrefix(str, prefix, getCanonicalFileName) { - if (getCanonicalFileName === void 0) { getCanonicalFileName = identity; } + if (getCanonicalFileName === void 0) { + getCanonicalFileName = identity; + } return startsWith(getCanonicalFileName(str), getCanonicalFileName(prefix)) ? str.substring(prefix.length) : undefined; } ts.tryRemovePrefix = tryRemovePrefix; @@ -2408,7 +2478,9 @@ var ts; * @param padString Character to use as padding (default " "). */ function padLeft(s, length, padString) { - if (padString === void 0) { padString = " "; } + if (padString === void 0) { + padString = " "; + } return length <= s.length ? s : padString.repeat(length - s.length) + s; } ts.padLeft = padLeft; @@ -2420,7 +2492,9 @@ var ts; * @param padString Character to use as padding (default " "). */ function padRight(s, length, padString) { - if (padString === void 0) { padString = " "; } + if (padString === void 0) { + padString = " "; + } return length <= s.length ? s : s + padString.repeat(length - s.length); } ts.padRight = padRight; @@ -2638,7 +2712,9 @@ var ts; */ Debug.assertEachDefined = checkEachDefined; function assertNever(member, message, stackCrawlMark) { - if (message === void 0) { message = "Illegal value:"; } + if (message === void 0) { + message = "Illegal value:"; + } var detail = typeof member === "object" && ts.hasProperty(member, "kind") && ts.hasProperty(member, "pos") && formatSyntaxKind ? "SyntaxKind: " + formatSyntaxKind(member.kind) : JSON.stringify(member); return fail("".concat(message, " ").concat(detail), stackCrawlMark || assertNever); } @@ -2703,7 +2779,9 @@ var ts; * Formats an enum value as a string for debugging and debug assertions. */ function formatEnum(value, enumObject, isFlags) { - if (value === void 0) { value = 0; } + if (value === void 0) { + value = 0; + } var members = getEnumMembers(enumObject); if (value === 0) { return members.length > 0 && members[0][0] === 0 ? members[0][1] : "0"; @@ -3058,9 +3136,7 @@ var ts; try { if (ts.sys && ts.sys.require) { var basePath = ts.getDirectoryPath(ts.resolvePath(ts.sys.getExecutingFilePath())); - // MONACOCHANGE - var result = undefined; - // END MONACOCHANGE + var result = ts.sys.require(basePath, "./compiler-debug"); if (!result.error) { result.module.init(ts); extendedDebugModule = result.module; @@ -3098,7 +3174,9 @@ var ts; } function createDeprecation(name, options) { var _a, _b; - if (options === void 0) { options = {}; } + if (options === void 0) { + options = {}; + } var version = typeof options.typeScriptVersion === "string" ? new ts.Version(options.typeScriptVersion) : (_a = options.typeScriptVersion) !== null && _a !== void 0 ? _a : getTypeScriptVersion(); var errorAfter = typeof options.errorAfter === "string" ? new ts.Version(options.errorAfter) : options.errorAfter; var warnAfter = typeof options.warnAfter === "string" ? new ts.Version(options.warnAfter) : options.warnAfter; @@ -3152,10 +3230,18 @@ var ts; */ var Version = /** @class */ (function () { function Version(major, minor, patch, prerelease, build) { - if (minor === void 0) { minor = 0; } - if (patch === void 0) { patch = 0; } - if (prerelease === void 0) { prerelease = ""; } - if (build === void 0) { build = ""; } + if (minor === void 0) { + minor = 0; + } + if (patch === void 0) { + patch = 0; + } + if (prerelease === void 0) { + prerelease = ""; + } + if (build === void 0) { + build = ""; + } if (typeof major === "string") { var result = ts.Debug.checkDefined(tryParseComponents(major), "Invalid version"); (major = result.major, minor = result.minor, patch = result.patch, prerelease = result.prerelease, build = result.build); @@ -3512,10 +3598,10 @@ var ts; } } function tryGetNodePerformanceHooks() { - if (typeof process !== "undefined" && process.nextTick && !process.browser && typeof module === "object" && /* MONACOCHANGE */false/* END MONACOCHANGE */) { + if (typeof process !== "undefined" && process.nextTick && !process.browser && typeof module === "object" && /* MONACOCHANGE */ false /* END MONACOCHANGE */) { try { var performance_1; - var _a /* MONACOCHANGE */= {}/* END MONACOCHANGE */, nodePerformance_1 = _a.performance, PerformanceObserver_1 = _a.PerformanceObserver; + var _a = (function MONACOCHANGE_require() { })("perf_hooks"), nodePerformance_1 = _a.performance, PerformanceObserver_1 = _a.PerformanceObserver; if (hasRequiredAPI(nodePerformance_1, PerformanceObserver_1)) { performance_1 = nodePerformance_1; // There is a bug in Node's performance.measure prior to 12.16.3/13.13.0 that does not @@ -3530,7 +3616,9 @@ var ts; now: function () { return nodePerformance_1.now(); }, mark: function (name) { return nodePerformance_1.mark(name); }, measure: function (name, start, end) { - if (start === void 0) { start = "nodeStart"; } + if (start === void 0) { + start = "nodeStart"; + } if (end === undefined) { end = "__performance.measure-fix__"; nodePerformance_1.mark(end); @@ -3682,7 +3770,9 @@ var ts; /** Enables (and resets) performance measurements for the compiler. */ function enable(system) { var _a; - if (system === void 0) { system = ts.sys; } + if (system === void 0) { + system = ts.sys; + } if (!enabled) { enabled = true; perfHooks || (perfHooks = ts.tryGetNativePerformanceHooks()); @@ -3746,9 +3836,7 @@ var ts; var etwModulePath = (_a = process.env.TS_ETW_MODULE_PATH) !== null && _a !== void 0 ? _a : "./node_modules/@microsoft/typescript-etw"; // require() will throw an exception if the module is not found // It may also return undefined if not installed properly - // MONACOCHANGE - etwModule = undefined; - // END MONACOCHANGE + etwModule = (function MONACOCHANGE_require() { })(etwModulePath); } catch (e) { etwModule = undefined; @@ -3777,9 +3865,7 @@ var ts; ts.Debug.assert(!ts.tracing, "Tracing already started"); if (fs === undefined) { try { - // MONACOCHANGE - fs = undefined; - // END MONACOCHANGE + fs = (function MONACOCHANGE_require() { })("fs"); } catch (e) { throw new Error("tracing requires having fs\n(original error: ".concat(e.message || e, ")")); @@ -3858,7 +3944,9 @@ var ts; * these operations. */ function push(phase, name, args, separateBeginAndEnd) { - if (separateBeginAndEnd === void 0) { separateBeginAndEnd = false; } + if (separateBeginAndEnd === void 0) { + separateBeginAndEnd = false; + } if (separateBeginAndEnd) { writeEvent("B", phase, name, args); } @@ -3892,7 +3980,9 @@ var ts; } } function writeEvent(eventType, phase, name, args, extras, time) { - if (time === void 0) { time = 1000 * ts.timestamp(); } + if (time === void 0) { + time = 1000 * ts.timestamp(); + } // In server mode, there's no easy way to dump type information, so we drop events that would require it. if (mode === "server" && phase === "checkTypes" /* CheckTypes */) return; @@ -5324,7 +5414,9 @@ var ts; })(DiagnosticCategory = ts.DiagnosticCategory || (ts.DiagnosticCategory = {})); /* @internal */ function diagnosticCategoryName(d, lowerCase) { - if (lowerCase === void 0) { lowerCase = true; } + if (lowerCase === void 0) { + lowerCase = true; + } var name = DiagnosticCategory[d.category]; return lowerCase ? name.toLowerCase() : name; } @@ -6248,7 +6340,9 @@ var ts; * getPathComponents("file://") === ["file://"] */ function getPathComponents(path, currentDirectory) { - if (currentDirectory === void 0) { currentDirectory = ""; } + if (currentDirectory === void 0) { + currentDirectory = ""; + } path = combinePaths(currentDirectory, path); return pathComponents(path, getRootLength(path)); } @@ -7055,9 +7149,11 @@ var ts; var timerToUpdateChildWatches; var filePathComparer = ts.getStringComparer(!useCaseSensitiveFileNames); var toCanonicalFilePath = ts.createGetCanonicalFileName(useCaseSensitiveFileNames); - return function (dirName, callback, recursive, options) { return recursive ? - createDirectoryWatcher(dirName, options, callback) : - watchDirectory(dirName, callback, recursive, options); }; + return function (dirName, callback, recursive, options) { + return recursive ? + createDirectoryWatcher(dirName, options, callback) : + watchDirectory(dirName, callback, recursive, options); + }; /** * Create the directory watcher for the dirPath. */ @@ -7463,9 +7559,24 @@ var ts; ts.getNodeMajorVersion = getNodeMajorVersion; // TODO: GH#18217 this is used as if it's certainly defined in many places. // eslint-disable-next-line prefer-const - // MONACOCHANGE - ts.sys = undefined; - // END MONACOCHANGE + ts.sys = (function () { + // NodeJS detects "\uFEFF" at the start of the string and *replaces* it with the actual + // byte order mark from the specified encoding. Using any other byte order mark does + // not actually work. + var byteOrderMarkIndicator = "\uFEFF"; + function getNodeSystem() { } + var sys; + if (typeof process !== "undefined" && process.nextTick && !process.browser && /* MONACOCHANGE */ false /* END MONACOCHANGE */) { + // process and process.nextTick checks if current environment is node-like + // process.browser check excludes webpack and browserify + sys = getNodeSystem(); + } + if (sys) { + // patch writefile to create folder before writing the file + patchWriteFileEnsuringDirectory(sys); + } + return sys; + })(); /*@internal*/ function setSys(s) { ts.sys = s; @@ -9301,20 +9412,20 @@ var ts; ts.tokenIsIdentifierOrKeywordOrGreaterThan = tokenIsIdentifierOrKeywordOrGreaterThan; /** @internal */ ts.textToKeywordObj = (_a = { - abstract: 126 /* AbstractKeyword */, - any: 130 /* AnyKeyword */, - as: 127 /* AsKeyword */, - asserts: 128 /* AssertsKeyword */, - assert: 129 /* AssertKeyword */, - bigint: 157 /* BigIntKeyword */, - boolean: 133 /* BooleanKeyword */, - break: 81 /* BreakKeyword */, - case: 82 /* CaseKeyword */, - catch: 83 /* CatchKeyword */, - class: 84 /* ClassKeyword */, - continue: 86 /* ContinueKeyword */, - const: 85 /* ConstKeyword */ - }, + abstract: 126 /* AbstractKeyword */, + any: 130 /* AnyKeyword */, + as: 127 /* AsKeyword */, + asserts: 128 /* AssertsKeyword */, + assert: 129 /* AssertKeyword */, + bigint: 157 /* BigIntKeyword */, + boolean: 133 /* BooleanKeyword */, + break: 81 /* BreakKeyword */, + case: 82 /* CaseKeyword */, + catch: 83 /* CatchKeyword */, + class: 84 /* ClassKeyword */, + continue: 86 /* ContinueKeyword */, + const: 85 /* ConstKeyword */ + }, _a["" + "constructor"] = 134 /* ConstructorKeyword */, _a.debugger = 87 /* DebuggerKeyword */, _a.declare = 135 /* DeclareKeyword */, @@ -10032,7 +10143,9 @@ var ts; ts.isIdentifierText = isIdentifierText; // Creates a scanner over a (possibly unspecified) range of a piece of text. function createScanner(languageVersion, skipTrivia, languageVariant, textInitial, onError, start, length) { - if (languageVariant === void 0) { languageVariant = 0 /* Standard */; } + if (languageVariant === void 0) { + languageVariant = 0 /* Standard */; + } var text = textInitial; // Current position (end position of text of current token) var pos; @@ -10103,7 +10216,9 @@ var ts; } return scanner; function error(message, errPos, length) { - if (errPos === void 0) { errPos = pos; } + if (errPos === void 0) { + errPos = pos; + } if (onError) { var oldPos = pos; pos = errPos; @@ -10283,7 +10398,9 @@ var ts; return String.fromCharCode.apply(String, valueChars); } function scanString(jsxAttributeString) { - if (jsxAttributeString === void 0) { jsxAttributeString = false; } + if (jsxAttributeString === void 0) { + jsxAttributeString = false; + } var quote = text.charCodeAt(pos); pos++; var result = ""; @@ -11232,7 +11349,9 @@ var ts; return token = scanTemplateAndSetTokenValue(/* isTaggedTemplate */ true); } function reScanJsxToken(allowMultilineJsxText) { - if (allowMultilineJsxText === void 0) { allowMultilineJsxText = true; } + if (allowMultilineJsxText === void 0) { + allowMultilineJsxText = true; + } pos = tokenPos = startPos; return token = scanJsxToken(allowMultilineJsxText); } @@ -11256,7 +11375,9 @@ var ts; return token = 57 /* QuestionToken */; } function scanJsxToken(allowMultilineJsxText) { - if (allowMultilineJsxText === void 0) { allowMultilineJsxText = true; } + if (allowMultilineJsxText === void 0) { + allowMultilineJsxText = true; + } startPos = tokenPos = pos; if (pos >= end) { return token = 1 /* EndOfFileToken */; @@ -13913,10 +14034,12 @@ var ts; } ts.isPinnedComment = isPinnedComment; function createCommentDirectivesMap(sourceFile, commentDirectives) { - var directivesByLine = new ts.Map(commentDirectives.map(function (commentDirective) { return ([ - "".concat(ts.getLineAndCharacterOfPosition(sourceFile, commentDirective.range.end).line), - commentDirective, - ]); })); + var directivesByLine = new ts.Map(commentDirectives.map(function (commentDirective) { + return ([ + "".concat(ts.getLineAndCharacterOfPosition(sourceFile, commentDirective.range.end).line), + commentDirective, + ]); + })); var usedLines = new ts.Map(); return { getUnusedExpectations: getUnusedExpectations, markUsed: markUsed }; function getUnusedExpectations() { @@ -13972,7 +14095,9 @@ var ts; } ts.getNonDecoratorTokenPosOfNode = getNonDecoratorTokenPosOfNode; function getSourceTextOfNodeFromSourceFile(sourceFile, node, includeTrivia) { - if (includeTrivia === void 0) { includeTrivia = false; } + if (includeTrivia === void 0) { + includeTrivia = false; + } return getTextOfNodeFromSourceText(sourceFile.text, node, includeTrivia); } ts.getSourceTextOfNodeFromSourceFile = getSourceTextOfNodeFromSourceFile; @@ -13984,7 +14109,9 @@ var ts; } ts.isExportNamespaceAsDefaultDeclaration = isExportNamespaceAsDefaultDeclaration; function getTextOfNodeFromSourceText(sourceText, node, includeTrivia) { - if (includeTrivia === void 0) { includeTrivia = false; } + if (includeTrivia === void 0) { + includeTrivia = false; + } if (nodeIsMissing(node)) { return ""; } @@ -13997,7 +14124,9 @@ var ts; } ts.getTextOfNodeFromSourceText = getTextOfNodeFromSourceText; function getTextOfNode(node, includeTrivia) { - if (includeTrivia === void 0) { includeTrivia = false; } + if (includeTrivia === void 0) { + includeTrivia = false; + } return getSourceTextOfNodeFromSourceFile(getSourceFileOfNode(node), node, includeTrivia); } ts.getTextOfNode = getTextOfNode; @@ -18485,7 +18614,9 @@ var ts; * @param end The end position. */ function createRange(pos, end) { - if (end === void 0) { end = pos; } + if (end === void 0) { + end = pos; + } ts.Debug.assert(end >= pos || end === -1); return { pos: pos, end: end }; } @@ -18600,7 +18731,9 @@ var ts; } ts.getLinesBetweenPositionAndNextNonWhitespaceCharacter = getLinesBetweenPositionAndNextNonWhitespaceCharacter; function getPreviousNonWhitespacePosition(pos, stopPos, sourceFile) { - if (stopPos === void 0) { stopPos = 0; } + if (stopPos === void 0) { + stopPos = 0; + } while (pos-- > stopPos) { if (!ts.isWhiteSpaceLike(sourceFile.text.charCodeAt(pos))) { return pos; @@ -18644,7 +18777,9 @@ var ts; } ts.getCheckFlags = getCheckFlags; function getDeclarationModifierFlagsFromSymbol(s, isWrite) { - if (isWrite === void 0) { isWrite = false; } + if (isWrite === void 0) { + isWrite = false; + } if (s.valueDeclaration) { var declaration = (isWrite && s.declarations && ts.find(s.declarations, function (d) { return d.kind === 172 /* SetAccessor */; })) || s.valueDeclaration; var flags = ts.getCombinedModifierFlags(declaration); @@ -18854,7 +18989,9 @@ var ts; } ts.getLastChild = getLastChild; function addToSeen(seen, key, value) { - if (value === void 0) { value = true; } + if (value === void 0) { + value = true; + } if (seen.has(key)) { return false; } @@ -19028,7 +19165,9 @@ var ts; } ts.setObjectAllocator = setObjectAllocator; function formatStringFromArgs(text, args, baseIndex) { - if (baseIndex === void 0) { baseIndex = 0; } + if (baseIndex === void 0) { + baseIndex = 0; + } return text.replace(/{(\d+)}/g, function (_match, index) { return "" + ts.Debug.checkDefined(args[+index + baseIndex]); }); } ts.formatStringFromArgs = formatStringFromArgs; @@ -20154,7 +20293,9 @@ var ts; } ts.isIdentifierTypeReference = isIdentifierTypeReference; function arrayIsHomogeneous(array, comparer) { - if (comparer === void 0) { comparer = ts.equateValues; } + if (comparer === void 0) { + comparer = ts.equateValues; + } if (array.length < 2) return true; var first = array[0]; @@ -21631,7 +21772,9 @@ var ts; } // @api function createNumericLiteral(value, numericLiteralFlags) { - if (numericLiteralFlags === void 0) { numericLiteralFlags = 0 /* None */; } + if (numericLiteralFlags === void 0) { + numericLiteralFlags = 0 /* None */; + } var node = createBaseLiteral(8 /* NumericLiteral */, typeof value === "number" ? value + "" : value); node.numericLiteralFlags = numericLiteralFlags; if (numericLiteralFlags & 384 /* BinaryOrOctalSpecifier */) @@ -21742,7 +21885,9 @@ var ts; /** Create a unique name based on the supplied text. */ // @api function createUniqueName(text, flags) { - if (flags === void 0) { flags = 0 /* None */; } + if (flags === void 0) { + flags = 0 /* None */; + } ts.Debug.assert(!(flags & 7 /* KindMask */), "Argument out of range: flags"); ts.Debug.assert((flags & (16 /* Optimistic */ | 32 /* FileLevel */)) !== 32 /* FileLevel */, "GeneratedIdentifierFlags.FileLevel cannot be set without also setting GeneratedIdentifierFlags.Optimistic"); return createBaseGeneratedIdentifier(text, 3 /* Unique */ | flags); @@ -21750,7 +21895,9 @@ var ts; /** Create a unique name generated for a node. */ // @api function getGeneratedNameForNode(node, flags) { - if (flags === void 0) { flags = 0; } + if (flags === void 0) { + flags = 0; + } ts.Debug.assert(!(flags & 7 /* KindMask */), "Argument out of range: flags"); var name = createBaseGeneratedIdentifier(node && ts.isIdentifier(node) ? ts.idText(node) : "", 4 /* Node */ | flags); name.original = node; @@ -22500,7 +22647,9 @@ var ts; } // @api function createImportTypeNode(argument, qualifier, typeArguments, isTypeOf) { - if (isTypeOf === void 0) { isTypeOf = false; } + if (isTypeOf === void 0) { + isTypeOf = false; + } var node = createBaseNode(199 /* ImportType */); node.argument = argument; node.qualifier = qualifier; @@ -22511,7 +22660,9 @@ var ts; } // @api function updateImportTypeNode(node, argument, qualifier, typeArguments, isTypeOf) { - if (isTypeOf === void 0) { isTypeOf = node.isTypeOf; } + if (isTypeOf === void 0) { + isTypeOf = node.isTypeOf; + } return node.argument !== argument || node.qualifier !== qualifier || node.typeArguments !== typeArguments @@ -23238,7 +23389,9 @@ var ts; : node; } function createTemplateLiteralLikeNodeChecked(kind, text, rawText, templateFlags) { - if (templateFlags === void 0) { templateFlags = 0 /* None */; } + if (templateFlags === void 0) { + templateFlags = 0 /* None */; + } ts.Debug.assert(!(templateFlags & ~2048 /* TemplateLiteralLikeFlags */), "Unsupported template flags."); // NOTE: without the assignment to `undefined`, we don't narrow the initial type of `cooked`. // eslint-disable-next-line no-undef-init @@ -23801,7 +23954,9 @@ var ts; } // @api function createVariableDeclarationList(declarations, flags) { - if (flags === void 0) { flags = 0 /* None */; } + if (flags === void 0) { + flags = 0 /* None */; + } var node = createBaseNode(254 /* VariableDeclarationList */); node.flags |= flags & 3 /* BlockScoped */; node.declarations = createNodeArray(declarations); @@ -23940,7 +24095,9 @@ var ts; } // @api function createModuleDeclaration(decorators, modifiers, name, body, flags) { - if (flags === void 0) { flags = 0 /* None */; } + if (flags === void 0) { + flags = 0 /* None */; + } var node = createBaseDeclaration(260 /* ModuleDeclaration */, decorators, modifiers); node.flags |= flags & (16 /* Namespace */ | 4 /* NestedNamespace */ | 1024 /* GlobalAugmentation */); node.name = name; @@ -24316,7 +24473,9 @@ var ts; } // @api function createJSDocTypeLiteral(propertyTags, isArrayType) { - if (isArrayType === void 0) { isArrayType = false; } + if (isArrayType === void 0) { + isArrayType = false; + } var node = createBaseNode(320 /* JSDocTypeLiteral */); node.jsDocPropertyTags = asNodeArray(propertyTags); node.isArrayType = isArrayType; @@ -24379,7 +24538,9 @@ var ts; } // @api function updateJSDocTemplateTag(node, tagName, constraint, typeParameters, comment) { - if (tagName === void 0) { tagName = getDefaultTagName(node); } + if (tagName === void 0) { + tagName = getDefaultTagName(node); + } return node.tagName !== tagName || node.constraint !== constraint || node.typeParameters !== typeParameters @@ -24397,7 +24558,9 @@ var ts; } // @api function updateJSDocTypedefTag(node, tagName, typeExpression, fullName, comment) { - if (tagName === void 0) { tagName = getDefaultTagName(node); } + if (tagName === void 0) { + tagName = getDefaultTagName(node); + } return node.tagName !== tagName || node.typeExpression !== typeExpression || node.fullName !== fullName @@ -24416,7 +24579,9 @@ var ts; } // @api function updateJSDocParameterTag(node, tagName, name, isBracketed, typeExpression, isNameFirst, comment) { - if (tagName === void 0) { tagName = getDefaultTagName(node); } + if (tagName === void 0) { + tagName = getDefaultTagName(node); + } return node.tagName !== tagName || node.name !== name || node.isBracketed !== isBracketed @@ -24437,7 +24602,9 @@ var ts; } // @api function updateJSDocPropertyTag(node, tagName, name, isBracketed, typeExpression, isNameFirst, comment) { - if (tagName === void 0) { tagName = getDefaultTagName(node); } + if (tagName === void 0) { + tagName = getDefaultTagName(node); + } return node.tagName !== tagName || node.name !== name || node.isBracketed !== isBracketed @@ -24457,7 +24624,9 @@ var ts; } // @api function updateJSDocCallbackTag(node, tagName, typeExpression, fullName, comment) { - if (tagName === void 0) { tagName = getDefaultTagName(node); } + if (tagName === void 0) { + tagName = getDefaultTagName(node); + } return node.tagName !== tagName || node.typeExpression !== typeExpression || node.fullName !== fullName @@ -24473,7 +24642,9 @@ var ts; } // @api function updateJSDocAugmentsTag(node, tagName, className, comment) { - if (tagName === void 0) { tagName = getDefaultTagName(node); } + if (tagName === void 0) { + tagName = getDefaultTagName(node); + } return node.tagName !== tagName || node.class !== className || node.comment !== comment @@ -24570,7 +24741,9 @@ var ts; } // @api function updateJSDocImplementsTag(node, tagName, className, comment) { - if (tagName === void 0) { tagName = getDefaultTagName(node); } + if (tagName === void 0) { + tagName = getDefaultTagName(node); + } return node.tagName !== tagName || node.class !== className || node.comment !== comment @@ -24598,7 +24771,9 @@ var ts; // updateJSDocReadonlyTag // updateJSDocDeprecatedTag function updateJSDocSimpleTagWorker(kind, node, tagName, comment) { - if (tagName === void 0) { tagName = getDefaultTagName(node); } + if (tagName === void 0) { + tagName = getDefaultTagName(node); + } return node.tagName !== tagName || node.comment !== comment ? update(createJSDocSimpleTagWorker(kind, tagName, comment), node) : @@ -24620,7 +24795,9 @@ var ts; // updateJSDocThisTag // updateJSDocEnumTag function updateJSDocTypeLikeTagWorker(kind, node, tagName, typeExpression, comment) { - if (tagName === void 0) { tagName = getDefaultTagName(node); } + if (tagName === void 0) { + tagName = getDefaultTagName(node); + } return node.tagName !== tagName || node.typeExpression !== typeExpression || node.comment !== comment @@ -25093,11 +25270,21 @@ var ts; } // @api function updateSourceFile(node, statements, isDeclarationFile, referencedFiles, typeReferenceDirectives, hasNoDefaultLib, libReferenceDirectives) { - if (isDeclarationFile === void 0) { isDeclarationFile = node.isDeclarationFile; } - if (referencedFiles === void 0) { referencedFiles = node.referencedFiles; } - if (typeReferenceDirectives === void 0) { typeReferenceDirectives = node.typeReferenceDirectives; } - if (hasNoDefaultLib === void 0) { hasNoDefaultLib = node.hasNoDefaultLib; } - if (libReferenceDirectives === void 0) { libReferenceDirectives = node.libReferenceDirectives; } + if (isDeclarationFile === void 0) { + isDeclarationFile = node.isDeclarationFile; + } + if (referencedFiles === void 0) { + referencedFiles = node.referencedFiles; + } + if (typeReferenceDirectives === void 0) { + typeReferenceDirectives = node.typeReferenceDirectives; + } + if (hasNoDefaultLib === void 0) { + hasNoDefaultLib = node.hasNoDefaultLib; + } + if (libReferenceDirectives === void 0) { + libReferenceDirectives = node.libReferenceDirectives; + } return node.statements !== statements || node.isDeclarationFile !== isDeclarationFile || node.referencedFiles !== referencedFiles @@ -25109,7 +25296,9 @@ var ts; } // @api function createBundle(sourceFiles, prepends) { - if (prepends === void 0) { prepends = ts.emptyArray; } + if (prepends === void 0) { + prepends = ts.emptyArray; + } var node = createBaseNode(304 /* Bundle */); node.prepends = prepends; node.sourceFiles = sourceFiles; @@ -25117,7 +25306,9 @@ var ts; } // @api function updateBundle(node, sourceFiles, prepends) { - if (prepends === void 0) { prepends = ts.emptyArray; } + if (prepends === void 0) { + prepends = ts.emptyArray; + } return node.sourceFiles !== sourceFiles || node.prepends !== prepends ? update(createBundle(sourceFiles, prepends), node) @@ -25174,7 +25365,9 @@ var ts; // // @api function createSyntheticExpression(type, isSpread, tupleNameSource) { - if (isSpread === void 0) { isSpread = false; } + if (isSpread === void 0) { + isSpread = false; + } var node = createBaseNode(231 /* SyntheticExpression */); node.type = type; node.isSpread = isSpread; @@ -25446,7 +25639,9 @@ var ts; && !ts.some(ts.getSyntheticTrailingComments(node)); } function restoreOuterExpressions(outerExpression, innerExpression, kinds) { - if (kinds === void 0) { kinds = 15 /* All */; } + if (kinds === void 0) { + kinds = 15 /* All */; + } if (outerExpression && ts.isOuterExpression(outerExpression, kinds) && !isIgnorableParen(outerExpression)) { return updateOuterExpression(outerExpression, restoreOuterExpressions(outerExpression.expression, innerExpression)); } @@ -25487,7 +25682,9 @@ var ts; } } function createCallBinding(expression, recordTempVariable, languageVersion, cacheIdentifiers) { - if (cacheIdentifiers === void 0) { cacheIdentifiers = false; } + if (cacheIdentifiers === void 0) { + cacheIdentifiers = false; + } var callee = ts.skipOuterExpressions(expression, 15 /* All */); var thisArg; var target; @@ -25561,7 +25758,9 @@ var ts; : ts.reduceLeft(expressions, factory.createComma); } function getName(node, allowComments, allowSourceMaps, emitFlags) { - if (emitFlags === void 0) { emitFlags = 0; } + if (emitFlags === void 0) { + emitFlags = 0; + } var nodeName = ts.getNameOfDeclaration(node); if (nodeName && ts.isIdentifier(nodeName) && !ts.isGeneratedIdentifier(nodeName)) { // TODO(rbuckton): Does this need to be parented? @@ -25711,7 +25910,9 @@ var ts; return statementOffset; } function copyCustomPrologue(source, target, statementOffset, visitor, filter) { - if (filter === void 0) { filter = ts.returnTrue; } + if (filter === void 0) { + filter = ts.returnTrue; + } var numStatements = source.length; while (statementOffset !== undefined && statementOffset < numStatements) { var statement = source[statementOffset]; @@ -26863,7 +27064,9 @@ var ts; /*typeArguments*/ undefined, [expression]); } function createExportStarHelper(moduleExpression, exportsExpression) { - if (exportsExpression === void 0) { exportsExpression = factory.createIdentifier("exports"); } + if (exportsExpression === void 0) { + exportsExpression = factory.createIdentifier("exports"); + } context.requestEmitHelper(ts.exportStarHelper); context.requestEmitHelper(ts.createBindingHelper); return factory.createCallExpression(getUnscopedHelperName("__exportStar"), @@ -28565,7 +28768,9 @@ var ts; } ts.getJSDocTypeAssertionType = getJSDocTypeAssertionType; function isOuterExpression(node, kinds) { - if (kinds === void 0) { kinds = 15 /* All */; } + if (kinds === void 0) { + kinds = 15 /* All */; + } switch (node.kind) { case 211 /* ParenthesizedExpression */: if (kinds & 16 /* ExcludeJSDocTypeAssertion */ && isJSDocTypeAssertion(node)) { @@ -28584,7 +28789,9 @@ var ts; } ts.isOuterExpression = isOuterExpression; function skipOuterExpressions(node, kinds) { - if (kinds === void 0) { kinds = 15 /* All */; } + if (kinds === void 0) { + kinds = 15 /* All */; + } while (isOuterExpression(node, kinds)) { node = node.expression; } @@ -28633,9 +28840,11 @@ var ts; helperNames.sort(ts.compareStringsCaseSensitive); // Alias the imports if the names are used somewhere in the file. // NOTE: We don't need to care about global import collisions as this is a module. - namedBindings = nodeFactory.createNamedImports(ts.map(helperNames, function (name) { return ts.isFileLevelUniqueName(sourceFile, name) - ? nodeFactory.createImportSpecifier(/*isTypeOnly*/ false, /*propertyName*/ undefined, nodeFactory.createIdentifier(name)) - : nodeFactory.createImportSpecifier(/*isTypeOnly*/ false, nodeFactory.createIdentifier(name), helperFactory.getUnscopedHelperName(name)); })); + namedBindings = nodeFactory.createNamedImports(ts.map(helperNames, function (name) { + return ts.isFileLevelUniqueName(sourceFile, name) + ? nodeFactory.createImportSpecifier(/*isTypeOnly*/ false, /*propertyName*/ undefined, nodeFactory.createIdentifier(name)) + : nodeFactory.createImportSpecifier(/*isTypeOnly*/ false, nodeFactory.createIdentifier(name), helperFactory.getUnscopedHelperName(name)); + })); var parseNode = ts.getOriginalNode(sourceFile, ts.isSourceFile); var emitNode = ts.getOrCreateEmitNode(parseNode); emitNode.externalHelpers = true; @@ -29905,7 +30114,9 @@ var ts; } } function createSourceFile(fileName, sourceText, languageVersion, setParentNodes, scriptKind) { - if (setParentNodes === void 0) { setParentNodes = false; } + if (setParentNodes === void 0) { + setParentNodes = false; + } ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("parse" /* Parse */, "createSourceFile", { path: fileName }, /*separateBeginAndEnd*/ true); ts.performance.mark("beforeParse"); var result; @@ -29951,7 +30162,9 @@ var ts; // becoming detached from any SourceFile). It is recommended that this SourceFile not // be used once 'update' is called on it. function updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks) { - if (aggressiveChecks === void 0) { aggressiveChecks = false; } + if (aggressiveChecks === void 0) { + aggressiveChecks = false; + } var newSourceFile = IncrementalParser.updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks); // Because new source file node is created, it may not have the flag PossiblyContainDynamicImport. This is the case if there is no new edit to add dynamic import. // We will manually port the flag to the new source file. @@ -30102,7 +30315,9 @@ var ts; var parseErrorBeforeNextFinishedNode = false; function parseSourceFile(fileName, sourceText, languageVersion, syntaxCursor, setParentNodes, scriptKind) { var _a; - if (setParentNodes === void 0) { setParentNodes = false; } + if (setParentNodes === void 0) { + setParentNodes = false; + } scriptKind = ts.ensureScriptKind(fileName, scriptKind); if (scriptKind === 6 /* JSON */) { var result_3 = parseJsonText(fileName, sourceText, languageVersion, syntaxCursor, setParentNodes); @@ -30133,8 +30348,12 @@ var ts; } Parser.parseIsolatedEntityName = parseIsolatedEntityName; function parseJsonText(fileName, sourceText, languageVersion, syntaxCursor, setParentNodes) { - if (languageVersion === void 0) { languageVersion = 2 /* ES2015 */; } - if (setParentNodes === void 0) { setParentNodes = false; } + if (languageVersion === void 0) { + languageVersion = 2 /* ES2015 */; + } + if (setParentNodes === void 0) { + setParentNodes = false; + } initializeState(fileName, sourceText, languageVersion, syntaxCursor, 6 /* JSON */); sourceFlags = contextFlags; // Prime the scanner. @@ -30690,7 +30909,9 @@ var ts; return token() > 116 /* LastReservedWord */; } function parseExpected(kind, diagnosticMessage, shouldAdvance) { - if (shouldAdvance === void 0) { shouldAdvance = true; } + if (shouldAdvance === void 0) { + shouldAdvance = true; + } if (token() === kind) { if (shouldAdvance) { nextToken(); @@ -36049,7 +36270,9 @@ var ts; PropertyLikeParse[PropertyLikeParse["CallbackParameter"] = 4] = "CallbackParameter"; })(PropertyLikeParse || (PropertyLikeParse = {})); function parseJSDocCommentWorker(start, length) { - if (start === void 0) { start = 0; } + if (start === void 0) { + start = 0; + } var content = sourceText; var end = length === undefined ? content.length : start + length; length = end - start; @@ -39021,7 +39244,9 @@ var ts; ts.parseCustomTypeOption = parseCustomTypeOption; /* @internal */ function parseListTypeOption(opt, value, errors) { - if (value === void 0) { value = ""; } + if (value === void 0) { + value = ""; + } value = ts.trimString(value); if (ts.startsWith(value, "-")) { return undefined; @@ -39219,7 +39444,9 @@ var ts; } ts.getOptionFromName = getOptionFromName; function getOptionDeclarationFromName(getOptionNameMap, optionName, allowShort) { - if (allowShort === void 0) { allowShort = false; } + if (allowShort === void 0) { + allowShort = false; + } optionName = optionName.toLowerCase(); var _a = getOptionNameMap(), optionsNameMap = _a.optionsNameMap, shortOptionNames = _a.shortOptionNames; // Try to translate short option names to their full equivalents. @@ -39982,9 +40209,15 @@ var ts; * @param resolutionStack Only present for backwards-compatibility. Should be empty. */ function parseJsonConfigFileContentWorker(json, sourceFile, host, basePath, existingOptions, existingWatchOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache) { - if (existingOptions === void 0) { existingOptions = {}; } - if (resolutionStack === void 0) { resolutionStack = []; } - if (extraFileExtensions === void 0) { extraFileExtensions = []; } + if (existingOptions === void 0) { + existingOptions = {}; + } + if (resolutionStack === void 0) { + resolutionStack = []; + } + if (extraFileExtensions === void 0) { + extraFileExtensions = []; + } ts.Debug.assert((json === undefined && sourceFile !== undefined) || (json !== undefined && sourceFile === undefined)); var errors = []; var parsedConfig = parseConfig(json, sourceFile, host, basePath, configFileName, resolutionStack, errors, extendedConfigCache); @@ -40506,7 +40739,9 @@ var ts; */ /* @internal */ function getFileNamesFromConfigSpecs(configFileSpecs, basePath, options, host, extraFileExtensions) { - if (extraFileExtensions === void 0) { extraFileExtensions = ts.emptyArray; } + if (extraFileExtensions === void 0) { + extraFileExtensions = ts.emptyArray; + } basePath = ts.normalizePath(basePath); var keyMapper = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames); // Literal file names (provided via the "files" array in tsconfig.json) are stored in a @@ -42055,7 +42290,9 @@ var ts; return undefined; } function loadNodeModuleFromDirectory(extensions, candidate, onlyRecordFailures, state, considerPackageJson) { - if (considerPackageJson === void 0) { considerPackageJson = true; } + if (considerPackageJson === void 0) { + considerPackageJson = true; + } var packageInfo = considerPackageJson ? getPackageJsonInfo(candidate, onlyRecordFailures, state) : undefined; var packageJsonContent = packageInfo && packageInfo.packageJsonContent; var versionPaths = packageInfo && packageInfo.versionPaths; @@ -42694,7 +42931,9 @@ var ts; } ts.getModuleInstanceState = getModuleInstanceState; function getModuleInstanceStateCached(node, visited) { - if (visited === void 0) { visited = new ts.Map(); } + if (visited === void 0) { + visited = new ts.Map(); + } var nodeId = ts.getNodeId(node); if (visited.has(nodeId)) { return visited.get(nodeId) || 0 /* NonInstantiated */; @@ -43346,7 +43585,9 @@ var ts; bindEach(nodes, function (n) { return n.kind !== 255 /* FunctionDeclaration */ ? bind(n) : undefined; }); } function bindEach(nodes, bindFunction) { - if (bindFunction === void 0) { bindFunction = bind; } + if (bindFunction === void 0) { + bindFunction = bind; + } if (nodes === undefined) { return; } @@ -45618,7 +45859,9 @@ var ts; return expr.parent; } function lookupSymbolForPropertyAccess(node, lookupContainer) { - if (lookupContainer === void 0) { lookupContainer = container; } + if (lookupContainer === void 0) { + lookupContainer = container; + } if (ts.isIdentifier(node)) { return lookupSymbolForName(lookupContainer, node.escapedText); } @@ -45923,7 +46166,9 @@ var ts; function createGetSymbolWalker(getRestTypeOfSignature, getTypePredicateOfSignature, getReturnTypeOfSignature, getBaseTypes, resolveStructuredTypeMembers, getTypeOfSymbol, getResolvedSymbol, getConstraintOfTypeParameter, getFirstIdentifier, getTypeArguments) { return getSymbolWalker; function getSymbolWalker(accept) { - if (accept === void 0) { accept = function () { return true; }; } + if (accept === void 0) { + accept = function () { return true; }; + } var visitedTypes = []; // Sparse array from id to type var visitedSymbols = []; // Sparse array from id to symbol return { @@ -46440,12 +46685,14 @@ var ts; getSymbolCount: function () { return ts.sum(host.getSourceFiles(), "symbolCount") + symbolCount; }, getTypeCount: function () { return typeCount; }, getInstantiationCount: function () { return totalInstantiationCount; }, - getRelationCacheSizes: function () { return ({ - assignable: assignableRelation.size, - identity: identityRelation.size, - subtype: subtypeRelation.size, - strictSubtype: strictSubtypeRelation.size, - }); }, + getRelationCacheSizes: function () { + return ({ + assignable: assignableRelation.size, + identity: identityRelation.size, + subtype: subtypeRelation.size, + strictSubtype: strictSubtypeRelation.size, + }); + }, isUndefinedSymbol: function (symbol) { return symbol === undefinedSymbol; }, isArgumentsSymbol: function (symbol) { return symbol === argumentsSymbol; }, isUnknownSymbol: function (symbol) { return symbol === unknownSymbol; }, @@ -47242,7 +47489,9 @@ var ts; * If target is not transient, mergeSymbol will produce a transient clone, mutate that and return it. */ function mergeSymbol(target, source, unidirectional) { - if (unidirectional === void 0) { unidirectional = false; } + if (unidirectional === void 0) { + unidirectional = false; + } if (!(target.flags & getExcludedSymbolFlags(source.flags)) || (source.flags | target.flags) & 67108864 /* Assignment */) { if (source === target) { @@ -47363,7 +47612,9 @@ var ts; return combined; } function mergeSymbolTable(target, source, unidirectional) { - if (unidirectional === void 0) { unidirectional = false; } + if (unidirectional === void 0) { + unidirectional = false; + } source.forEach(function (sourceSymbol, id) { var targetSymbol = target.get(id); target.set(id, targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol, unidirectional) : sourceSymbol); @@ -47739,8 +47990,12 @@ var ts; * @param isUse If true, this will count towards --noUnusedLocals / --noUnusedParameters. */ function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggstions) { - if (excludeGlobals === void 0) { excludeGlobals = false; } - if (getSpellingSuggstions === void 0) { getSpellingSuggstions = true; } + if (excludeGlobals === void 0) { + excludeGlobals = false; + } + if (getSpellingSuggstions === void 0) { + getSpellingSuggstions = true; + } return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggstions, getSymbol); } function resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, lookup) { @@ -48694,7 +48949,9 @@ var ts; } function getExternalModuleMember(node, specifier, dontResolveAlias) { var _a, _b; - if (dontResolveAlias === void 0) { dontResolveAlias = false; } + if (dontResolveAlias === void 0) { + dontResolveAlias = false; + } var moduleSpecifier = ts.getExternalModuleRequireArgument(node) || node.moduleSpecifier; var moduleSymbol = resolveExternalModuleName(node, moduleSpecifier); // TODO: GH#18217 var name = !ts.isPropertyAccessExpression(specifier) && specifier.propertyName || specifier.name; @@ -48855,7 +49112,9 @@ var ts; return getTargetOfAliasLikeExpression(node.parent.right, dontRecursivelyResolve); } function getTargetOfAliasDeclaration(node, dontRecursivelyResolve) { - if (dontRecursivelyResolve === void 0) { dontRecursivelyResolve = false; } + if (dontRecursivelyResolve === void 0) { + dontRecursivelyResolve = false; + } switch (node.kind) { case 264 /* ImportEqualsDeclaration */: case 253 /* VariableDeclaration */: @@ -48892,7 +49151,9 @@ var ts; * OR Is a JSContainer which may merge an alias with a local declaration */ function isNonLocalAlias(symbol, excludes) { - if (excludes === void 0) { excludes = 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */; } + if (excludes === void 0) { + excludes = 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */; + } if (!symbol) return false; return (symbol.flags & (2097152 /* Alias */ | excludes)) === 2097152 /* Alias */ || !!(symbol.flags & 2097152 /* Alias */ && symbol.flags & 67108864 /* Assignment */); @@ -49232,14 +49493,18 @@ var ts; return resolveExternalModuleNameWorker(location, moduleReferenceExpression, ignoreErrors ? undefined : errorMessage); } function resolveExternalModuleNameWorker(location, moduleReferenceExpression, moduleNotFoundError, isForAugmentation) { - if (isForAugmentation === void 0) { isForAugmentation = false; } + if (isForAugmentation === void 0) { + isForAugmentation = false; + } return ts.isStringLiteralLike(moduleReferenceExpression) ? resolveExternalModule(location, moduleReferenceExpression.text, moduleNotFoundError, moduleReferenceExpression, isForAugmentation) : undefined; } function resolveExternalModule(location, moduleReference, moduleNotFoundError, errorNode, isForAugmentation) { var _a, _b, _c, _d, _e, _f, _g; - if (isForAugmentation === void 0) { isForAugmentation = false; } + if (isForAugmentation === void 0) { + isForAugmentation = false; + } if (ts.startsWith(moduleReference, "@types/")) { var diag = ts.Diagnostics.Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1; var withoutAtTypePrefix = ts.removePrefix(moduleReference, "@types/"); @@ -49795,7 +50060,9 @@ var ts; return new Type(checker, flags); } function createIntrinsicType(kind, intrinsicName, objectFlags) { - if (objectFlags === void 0) { objectFlags = 0; } + if (objectFlags === void 0) { + objectFlags = 0; + } var type = createType(kind); type.intrinsicName = intrinsicName; type.objectFlags = objectFlags; @@ -49936,7 +50203,9 @@ var ts; return rightMeaning === 111551 /* Value */ ? 111551 /* Value */ : 1920 /* Namespace */; } function getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, useOnlyExternalAliasing, visitedSymbolTablesMap) { - if (visitedSymbolTablesMap === void 0) { visitedSymbolTablesMap = new ts.Map(); } + if (visitedSymbolTablesMap === void 0) { + visitedSymbolTablesMap = new ts.Map(); + } if (!(symbol && !isPropertyOrMethodDeclarationSymbol(symbol))) { return undefined; } @@ -50278,7 +50547,9 @@ var ts; }; } function symbolToString(symbol, enclosingDeclaration, meaning, flags, writer) { - if (flags === void 0) { flags = 4 /* AllowAnyNodeKind */; } + if (flags === void 0) { + flags = 4 /* AllowAnyNodeKind */; + } var nodeFlags = 70221824 /* IgnoreErrors */; if (flags & 2 /* UseOnlyExternalAliasing */) { nodeFlags |= 128 /* UseOnlyExternalAliasing */; @@ -50304,7 +50575,9 @@ var ts; } } function signatureToString(signature, enclosingDeclaration, flags, kind, writer) { - if (flags === void 0) { flags = 0 /* None */; } + if (flags === void 0) { + flags = 0 /* None */; + } return writer ? signatureToStringWorker(writer).getText() : ts.usingSingleLineStringWriter(signatureToStringWorker); function signatureToStringWorker(writer) { var sigOutput; @@ -50322,8 +50595,12 @@ var ts; } } function typeToString(type, enclosingDeclaration, flags, writer) { - if (flags === void 0) { flags = 1048576 /* AllowUniqueESSymbolType */ | 16384 /* UseAliasDefinedOutsideCurrentScope */; } - if (writer === void 0) { writer = ts.createTextWriter(""); } + if (flags === void 0) { + flags = 1048576 /* AllowUniqueESSymbolType */ | 16384 /* UseAliasDefinedOutsideCurrentScope */; + } + if (writer === void 0) { + writer = ts.createTextWriter(""); + } var noTruncation = compilerOptions.noErrorTruncation || flags & 1 /* NoTruncation */; var typeNode = nodeBuilder.typeToTypeNode(type, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* IgnoreErrors */ | (noTruncation ? 1 /* NoTruncation */ : 0), writer); if (typeNode === undefined) @@ -50357,7 +50634,9 @@ var ts; return symbol && !!symbol.valueDeclaration && ts.isExpression(symbol.valueDeclaration) && !isContextSensitive(symbol.valueDeclaration); } function toNodeBuilderFlags(flags) { - if (flags === void 0) { flags = 0 /* None */; } + if (flags === void 0) { + flags = 0 /* None */; + } return flags & 814775659 /* NodeBuilderFlagsMask */; } function isClassInstanceSide(type) { @@ -51334,7 +51613,9 @@ var ts; return ts.factory.createTypeParameterDeclaration(name, constraintNode, defaultParameterNode); } function typeParameterToDeclaration(type, context, constraint) { - if (constraint === void 0) { constraint = getConstraintOfTypeParameter(type); } + if (constraint === void 0) { + constraint = getConstraintOfTypeParameter(type); + } var constraintNode = constraint && typeToTypeNodeHelper(constraint, context); return typeParameterToDeclarationWithConstraint(type, context, constraintNode); } @@ -51978,16 +52259,20 @@ var ts; if (ts.isJSDocFunctionType(node)) { if (ts.isJSDocConstructSignature(node)) { var newTypeNode_1; - return ts.factory.createConstructorTypeNode(node.modifiers, ts.visitNodes(node.typeParameters, visitExistingNodeTreeSymbols), ts.mapDefined(node.parameters, function (p, i) { return p.name && ts.isIdentifier(p.name) && p.name.escapedText === "new" ? (newTypeNode_1 = p.type, undefined) : ts.factory.createParameterDeclaration( - /*decorators*/ undefined, - /*modifiers*/ undefined, getEffectiveDotDotDotForParameter(p), getNameForJSDocFunctionParameter(p, i), p.questionToken, ts.visitNode(p.type, visitExistingNodeTreeSymbols), - /*initializer*/ undefined); }), ts.visitNode(newTypeNode_1 || node.type, visitExistingNodeTreeSymbols) || ts.factory.createKeywordTypeNode(130 /* AnyKeyword */)); + return ts.factory.createConstructorTypeNode(node.modifiers, ts.visitNodes(node.typeParameters, visitExistingNodeTreeSymbols), ts.mapDefined(node.parameters, function (p, i) { + return p.name && ts.isIdentifier(p.name) && p.name.escapedText === "new" ? (newTypeNode_1 = p.type, undefined) : ts.factory.createParameterDeclaration( + /*decorators*/ undefined, + /*modifiers*/ undefined, getEffectiveDotDotDotForParameter(p), getNameForJSDocFunctionParameter(p, i), p.questionToken, ts.visitNode(p.type, visitExistingNodeTreeSymbols), + /*initializer*/ undefined); + }), ts.visitNode(newTypeNode_1 || node.type, visitExistingNodeTreeSymbols) || ts.factory.createKeywordTypeNode(130 /* AnyKeyword */)); } else { - return ts.factory.createFunctionTypeNode(ts.visitNodes(node.typeParameters, visitExistingNodeTreeSymbols), ts.map(node.parameters, function (p, i) { return ts.factory.createParameterDeclaration( - /*decorators*/ undefined, - /*modifiers*/ undefined, getEffectiveDotDotDotForParameter(p), getNameForJSDocFunctionParameter(p, i), p.questionToken, ts.visitNode(p.type, visitExistingNodeTreeSymbols), - /*initializer*/ undefined); }), ts.visitNode(node.type, visitExistingNodeTreeSymbols) || ts.factory.createKeywordTypeNode(130 /* AnyKeyword */)); + return ts.factory.createFunctionTypeNode(ts.visitNodes(node.typeParameters, visitExistingNodeTreeSymbols), ts.map(node.parameters, function (p, i) { + return ts.factory.createParameterDeclaration( + /*decorators*/ undefined, + /*modifiers*/ undefined, getEffectiveDotDotDotForParameter(p), getNameForJSDocFunctionParameter(p, i), p.questionToken, ts.visitNode(p.type, visitExistingNodeTreeSymbols), + /*initializer*/ undefined); + }), ts.visitNode(node.type, visitExistingNodeTreeSymbols) || ts.factory.createKeywordTypeNode(130 /* AnyKeyword */)); } } if (ts.isTypeReferenceNode(node) && ts.isInJSDoc(node) && (!existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(node, getTypeFromTypeNode(node)) || getIntendedTypeFromJSDocTypeReference(node) || unknownSymbol === resolveTypeReferenceName(node, 788968 /* Type */, /*ignoreErrors*/ true))) { @@ -52649,10 +52934,12 @@ var ts; var declarations = results; results = oldResults; // replace namespace with synthetic version - var defaultReplaced = ts.map(declarations, function (d) { return ts.isExportAssignment(d) && !d.isExportEquals && ts.isIdentifier(d.expression) ? ts.factory.createExportDeclaration( - /*decorators*/ undefined, - /*modifiers*/ undefined, - /*isTypeOnly*/ false, ts.factory.createNamedExports([ts.factory.createExportSpecifier(/*isTypeOnly*/ false, d.expression, ts.factory.createIdentifier("default" /* Default */))])) : d; }); + var defaultReplaced = ts.map(declarations, function (d) { + return ts.isExportAssignment(d) && !d.isExportEquals && ts.isIdentifier(d.expression) ? ts.factory.createExportDeclaration( + /*decorators*/ undefined, + /*modifiers*/ undefined, + /*isTypeOnly*/ false, ts.factory.createNamedExports([ts.factory.createExportSpecifier(/*isTypeOnly*/ false, d.expression, ts.factory.createIdentifier("default" /* Default */))])) : d; + }); var exportModifierStripped = ts.every(defaultReplaced, function (d) { return ts.hasSyntacticModifier(d, 1 /* Export */); }) ? ts.map(defaultReplaced, removeExportModifier) : defaultReplaced; fakespace = ts.factory.updateModuleDeclaration(fakespace, fakespace.decorators, fakespace.modifiers, fakespace.name, ts.factory.createModuleBlock(exportModifierStripped)); addResult(fakespace, modifierFlags); // namespaces can never be default exported @@ -53269,7 +53556,9 @@ var ts; } } function typePredicateToString(typePredicate, enclosingDeclaration, flags, writer) { - if (flags === void 0) { flags = 16384 /* UseAliasDefinedOutsideCurrentScope */; } + if (flags === void 0) { + flags = 16384 /* UseAliasDefinedOutsideCurrentScope */; + } return writer ? typePredicateToStringWorker(writer).getText() : ts.usingSingleLineStringWriter(typePredicateToStringWorker); function typePredicateToStringWorker(writer) { var predicate = ts.factory.createTypePredicateNode(typePredicate.kind === 2 /* AssertsThis */ || typePredicate.kind === 3 /* AssertsIdentifier */ ? ts.factory.createToken(128 /* AssertsKeyword */) : undefined, typePredicate.kind === 1 /* Identifier */ || typePredicate.kind === 3 /* AssertsIdentifier */ ? ts.factory.createIdentifier(typePredicate.parameterName) : ts.factory.createThisTypeNode(), typePredicate.type && nodeBuilder.typeToTypeNode(typePredicate.type, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* IgnoreErrors */ | 512 /* WriteTypeParametersInQualifiedName */) // TODO: GH#18217 @@ -53843,8 +54132,12 @@ var ts; return expr.kind === 203 /* ArrayLiteralExpression */ && expr.elements.length === 0; } function addOptionality(type, isProperty, isOptional) { - if (isProperty === void 0) { isProperty = false; } - if (isOptional === void 0) { isOptional = true; } + if (isProperty === void 0) { + isProperty = false; + } + if (isOptional === void 0) { + isOptional = true; + } return strictNullChecks && isOptional ? getOptionalType(type, isProperty) : type; } // Return the inferred type for a variable, parameter, or property declaration @@ -54374,8 +54667,12 @@ var ts; // parameter with no type annotation or initializer, the type implied by the binding pattern becomes the type of // the parameter. function getTypeFromBindingPattern(pattern, includePatternInType, reportErrors) { - if (includePatternInType === void 0) { includePatternInType = false; } - if (reportErrors === void 0) { reportErrors = false; } + if (includePatternInType === void 0) { + includePatternInType = false; + } + if (reportErrors === void 0) { + reportErrors = false; + } return pattern.kind === 200 /* ObjectBindingPattern */ ? getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) : getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors); @@ -54601,7 +54898,9 @@ var ts; return links.writeType || (links.writeType = getTypeOfAccessorsWorker(symbol, /*writing*/ true)); } function getTypeOfAccessorsWorker(symbol, writing) { - if (writing === void 0) { writing = false; } + if (writing === void 0) { + writing = false; + } if (!pushTypeResolution(symbol, 0 /* Type */)) { return errorType; } @@ -54616,7 +54915,9 @@ var ts; return type; } function resolveTypeOfAccessors(symbol, writing) { - if (writing === void 0) { writing = false; } + if (writing === void 0) { + writing = false; + } var getter = ts.getDeclarationOfKind(symbol, 171 /* GetAccessor */); var setter = ts.getDeclarationOfKind(symbol, 172 /* SetAccessor */); var setterType = getAnnotatedAccessorType(setter); @@ -56341,9 +56642,11 @@ var ts; var classType_1 = getDeclaredTypeOfClassOrInterface(symbol); var constructSignatures = symbol.members ? getSignaturesOfSymbol(symbol.members.get("__constructor" /* Constructor */)) : ts.emptyArray; if (symbol.flags & 16 /* Function */) { - constructSignatures = ts.addRange(constructSignatures.slice(), ts.mapDefined(type.callSignatures, function (sig) { return isJSConstructor(sig.declaration) ? - createSignature(sig.declaration, sig.typeParameters, sig.thisParameter, sig.parameters, classType_1, /*resolvedTypePredicate*/ undefined, sig.minArgumentCount, sig.flags & 39 /* PropagatingFlags */) : - undefined; })); + constructSignatures = ts.addRange(constructSignatures.slice(), ts.mapDefined(type.callSignatures, function (sig) { + return isJSConstructor(sig.declaration) ? + createSignature(sig.declaration, sig.typeParameters, sig.thisParameter, sig.parameters, classType_1, /*resolvedTypePredicate*/ undefined, sig.minArgumentCount, sig.flags & 39 /* PropagatingFlags */) : + undefined; + })); } if (!constructSignatures.length) { constructSignatures = getDefaultConstructSignatures(classType_1); @@ -58598,7 +58901,9 @@ var ts; return (deferredGlobalIteratorReturnResultType || (deferredGlobalIteratorReturnResultType = getGlobalType("IteratorReturnResult", /*arity*/ 1, reportErrors))) || emptyGenericType; } function getGlobalTypeOrUndefined(name, arity) { - if (arity === void 0) { arity = 0; } + if (arity === void 0) { + arity = 0; + } var symbol = getGlobalSymbol(name, 788968 /* Type */, /*diagnostic*/ undefined); return symbol && getTypeOfGlobalSymbol(symbol, arity); } @@ -58744,7 +59049,9 @@ var ts; return ts.isTypeOperatorNode(node) && node.operator === 144 /* ReadonlyKeyword */; } function createTupleType(elementTypes, elementFlags, readonly, namedMemberDeclarations) { - if (readonly === void 0) { readonly = false; } + if (readonly === void 0) { + readonly = false; + } var tupleTarget = getTupleTargetType(elementFlags || ts.map(elementTypes, function (_) { return 1 /* Required */; }), readonly, namedMemberDeclarations); return tupleTarget === emptyGenericType ? emptyObjectType : elementTypes.length ? createNormalizedTypeReference(tupleTarget, elementTypes) : @@ -58927,7 +59234,9 @@ var ts; } } function sliceTupleType(type, index, endSkipCount) { - if (endSkipCount === void 0) { endSkipCount = 0; } + if (endSkipCount === void 0) { + endSkipCount = 0; + } var target = type.target; var endIndex = getTypeReferenceArity(type) - endSkipCount; return index > target.fixedLength ? getRestArrayTypeOfTupleType(type) || createTupleType(ts.emptyArray) : @@ -59120,7 +59429,9 @@ var ts; // circularly reference themselves and therefore cannot be subtype reduced during their declaration. // For example, "type Item = string | (() => Item" is a named type that circularly references itself. function getUnionType(types, unionReduction, aliasSymbol, aliasTypeArguments, origin) { - if (unionReduction === void 0) { unionReduction = 1 /* Literal */; } + if (unionReduction === void 0) { + unionReduction = 1 /* Literal */; + } if (types.length === 0) { return neverType; } @@ -59679,13 +59990,17 @@ var ts; function getLiteralTypeFromProperties(type, include, includeOrigin) { var origin = includeOrigin && (ts.getObjectFlags(type) & (3 /* ClassOrInterface */ | 4 /* Reference */) || type.aliasSymbol) ? createOriginIndexType(type) : undefined; var propertyTypes = ts.map(getPropertiesOfType(type), function (prop) { return getLiteralTypeFromProperty(prop, include); }); - var indexKeyTypes = ts.map(getIndexInfosOfType(type), function (info) { return info !== enumNumberIndexInfo && isKeyTypeIncluded(info.keyType, include) ? - info.keyType === stringType && include & 8 /* Number */ ? stringOrNumberType : info.keyType : neverType; }); + var indexKeyTypes = ts.map(getIndexInfosOfType(type), function (info) { + return info !== enumNumberIndexInfo && isKeyTypeIncluded(info.keyType, include) ? + info.keyType === stringType && include & 8 /* Number */ ? stringOrNumberType : info.keyType : neverType; + }); return getUnionType(ts.concatenate(propertyTypes, indexKeyTypes), 1 /* Literal */, /*aliasSymbol*/ undefined, /*aliasTypeArguments*/ undefined, origin); } function getIndexType(type, stringsOnly, noIndexSignatures) { - if (stringsOnly === void 0) { stringsOnly = keyofStringsOnly; } + if (stringsOnly === void 0) { + stringsOnly = keyofStringsOnly; + } type = getReducedType(type); return type.flags & 1048576 /* Union */ ? getIntersectionType(ts.map(type.types, function (t) { return getIndexType(t, stringsOnly, noIndexSignatures); })) : type.flags & 2097152 /* Intersection */ ? getUnionType(ts.map(type.types, function (t) { return getIndexType(t, stringsOnly, noIndexSignatures); })) : @@ -60199,7 +60514,9 @@ var ts; return instantiateType(getTemplateTypeFromMappedType(objectType), templateMapper); } function getIndexedAccessType(objectType, indexType, accessFlags, accessNode, aliasSymbol, aliasTypeArguments) { - if (accessFlags === void 0) { accessFlags = 0 /* None */; } + if (accessFlags === void 0) { + accessFlags = 0 /* None */; + } return getIndexedAccessTypeOrUndefined(objectType, indexType, accessFlags, accessNode, aliasSymbol, aliasTypeArguments) || (accessNode ? errorType : unknownType); } function indexTypeLessThan(indexType, limit) { @@ -60215,7 +60532,9 @@ var ts; }); } function getIndexedAccessTypeOrUndefined(objectType, indexType, accessFlags, accessNode, aliasSymbol, aliasTypeArguments) { - if (accessFlags === void 0) { accessFlags = 0 /* None */; } + if (accessFlags === void 0) { + accessFlags = 0 /* None */; + } if (objectType === wildcardType || indexType === wildcardType) { return wildcardType; } @@ -61834,7 +62153,8 @@ var ts; _i = 0, _a = node.properties; _b.label = 1; case 1: - if (!(_i < _a.length)) return [3 /*break*/, 4]; + if (!(_i < _a.length)) + return [3 /*break*/, 4]; prop = _a[_i]; if (ts.isJsxSpreadAttribute(prop) || isHyphenatedJsxName(ts.idText(prop.name))) return [3 /*break*/, 3]; @@ -61860,11 +62180,13 @@ var ts; i = 0; _a.label = 1; case 1: - if (!(i < node.children.length)) return [3 /*break*/, 5]; + if (!(i < node.children.length)) + return [3 /*break*/, 5]; child = node.children[i]; nameType = getNumberLiteralType(i - memberOffset); elem = getElaborationElementForJsxChild(child, nameType, getInvalidTextDiagnostic); - if (!elem) return [3 /*break*/, 3]; + if (!elem) + return [3 /*break*/, 3]; return [4 /*yield*/, elem]; case 2: _a.sent(); @@ -61935,14 +62257,16 @@ var ts; var child = validChildren[0]; var elem_1 = getElaborationElementForJsxChild(child, childrenNameType, getInvalidTextualChildDiagnostic); if (elem_1) { - result = elaborateElementwise((function () { return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, elem_1]; - case 1: - _a.sent(); - return [2 /*return*/]; - } - }); })(), source, target, relation, containingMessageChain, errorOutputContainer) || result; + result = elaborateElementwise((function () { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, elem_1]; + case 1: + _a.sent(); + return [2 /*return*/]; + } + }); + })(), source, target, relation, containingMessageChain, errorOutputContainer) || result; } } else if (!isTypeRelatedTo(getIndexedAccessType(source, childrenNameType), childrenTargetType, relation)) { @@ -61979,7 +62303,8 @@ var ts; i = 0; _a.label = 1; case 1: - if (!(i < len)) return [3 /*break*/, 4]; + if (!(i < len)) + return [3 /*break*/, 4]; // Skip elements which do not exist in the target - a length error on the tuple overall is likely better than an error on a mismatched index signature if (isTupleLikeType(target) && !getPropertyOfType(target, ("" + i))) return [3 /*break*/, 3]; @@ -62030,7 +62355,8 @@ var ts; _i = 0, _a = node.properties; _c.label = 1; case 1: - if (!(_i < _a.length)) return [3 /*break*/, 8]; + if (!(_i < _a.length)) + return [3 /*break*/, 8]; prop = _a[_i]; if (ts.isSpreadAssignment(prop)) return [3 /*break*/, 7]; @@ -62731,9 +63057,15 @@ var ts; * * Ternary.False if they are not related. */ function isRelatedTo(originalSource, originalTarget, recursionFlags, reportErrors, headMessage, intersectionState) { - if (recursionFlags === void 0) { recursionFlags = 3 /* Both */; } - if (reportErrors === void 0) { reportErrors = false; } - if (intersectionState === void 0) { intersectionState = 0 /* None */; } + if (recursionFlags === void 0) { + recursionFlags = 3 /* Both */; + } + if (reportErrors === void 0) { + reportErrors = false; + } + if (intersectionState === void 0) { + intersectionState = 0 /* None */; + } // Before normalization: if `source` is type an object type, and `target` is primitive, // skip all the checks we don't need and just return `isSimpleTypeRelatedTo` result if (originalSource.flags & 524288 /* Object */ && originalTarget.flags & 131068 /* Primitive */) { @@ -63163,9 +63495,15 @@ var ts; return result; } function typeArgumentsRelatedTo(sources, targets, variances, reportErrors, intersectionState) { - if (sources === void 0) { sources = ts.emptyArray; } - if (targets === void 0) { targets = ts.emptyArray; } - if (variances === void 0) { variances = ts.emptyArray; } + if (sources === void 0) { + sources = ts.emptyArray; + } + if (targets === void 0) { + targets = ts.emptyArray; + } + if (variances === void 0) { + variances = ts.emptyArray; + } if (sources.length !== targets.length && relation === identityRelation) { return 0 /* False */; } @@ -64609,7 +64947,9 @@ var ts; return getPropertiesOfType(type).filter(function (targetProp) { return containsMissingType(getTypeOfSymbol(targetProp)); }); } function getBestMatchingType(source, target, isRelatedTo) { - if (isRelatedTo === void 0) { isRelatedTo = compareTypesAssignable; } + if (isRelatedTo === void 0) { + isRelatedTo = compareTypesAssignable; + } return findMatchingDiscriminantType(source, target, isRelatedTo, /*skipPartial*/ true) || findMatchingTypeReferenceOrTypeAliasReference(source, target) || findBestTypeForObjectLiteral(source, target) || @@ -64699,7 +65039,9 @@ var ts; // returns the emptyArray singleton when invoked recursively for the given generic type. function getVariancesWorker(typeParameters, cache, createMarkerType) { var _a, _b, _c; - if (typeParameters === void 0) { typeParameters = ts.emptyArray; } + if (typeParameters === void 0) { + typeParameters = ts.emptyArray; + } var variances = cache.variances; if (!variances) { ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("checkTypes" /* CheckTypes */, "getVariancesWorker", { arity: typeParameters.length, id: (_c = (_a = cache.id) !== null && _a !== void 0 ? _a : (_b = cache.declaredType) === null || _b === void 0 ? void 0 : _b.id) !== null && _c !== void 0 ? _c : -1 }); @@ -64780,7 +65122,9 @@ var ts; // getTypeReferenceId(A) returns "111=0-12=1" // where A.id=111 and number.id=12 function getTypeReferenceId(type, depth) { - if (depth === void 0) { depth = 0; } + if (depth === void 0) { + depth = 0; + } var result = "" + type.target.id; for (var _i = 0, _a = getTypeArguments(type); _i < _a.length; _i++) { var t = _a[_i]; @@ -64858,14 +65202,18 @@ var ts; } // Return true if source property is a valid override of protected parts of target property. function isValidOverrideOf(sourceProp, targetProp) { - return !forEachProperty(targetProp, function (tp) { return ts.getDeclarationModifierFlagsFromSymbol(tp) & 16 /* Protected */ ? - !isPropertyInClassDerivedFrom(sourceProp, getDeclaringClass(tp)) : false; }); + return !forEachProperty(targetProp, function (tp) { + return ts.getDeclarationModifierFlagsFromSymbol(tp) & 16 /* Protected */ ? + !isPropertyInClassDerivedFrom(sourceProp, getDeclaringClass(tp)) : false; + }); } // Return true if the given class derives from each of the declaring classes of the protected // constituents of the given property. function isClassDerivedFromDeclaringClasses(checkClass, prop, writing) { - return forEachProperty(prop, function (p) { return ts.getDeclarationModifierFlagsFromSymbol(p, writing) & 16 /* Protected */ ? - !hasBaseType(checkClass, getDeclaringClass(p)) : false; }) ? undefined : checkClass; + return forEachProperty(prop, function (p) { + return ts.getDeclarationModifierFlagsFromSymbol(p, writing) & 16 /* Protected */ ? + !hasBaseType(checkClass, getDeclaringClass(p)) : false; + }) ? undefined : checkClass; } // Return true if the given type is deeply nested. We consider this to be the case when structural type comparisons // for maxDepth or more occurrences or instantiations of the type have been recorded on the given stack. It is possible, @@ -64880,7 +65228,9 @@ var ts; // has expanded into `[A>>>>>]`. In such cases we need // to terminate the expansion, and we do so here. function isDeeplyNestedType(type, stack, depth, maxDepth) { - if (maxDepth === void 0) { maxDepth = 3; } + if (maxDepth === void 0) { + maxDepth = 3; + } if (depth >= maxDepth) { var identity_1 = getRecursionIdentity(type); var count = 0; @@ -65256,8 +65606,12 @@ var ts; return restType && createArrayType(restType); } function getElementTypeOfSliceOfTupleType(type, index, endSkipCount, writing) { - if (endSkipCount === void 0) { endSkipCount = 0; } - if (writing === void 0) { writing = false; } + if (endSkipCount === void 0) { + endSkipCount = 0; + } + if (writing === void 0) { + writing = false; + } var length = getTypeReferenceArity(type) - endSkipCount; if (index < length) { var typeArguments = getTypeArguments(type); @@ -65330,7 +65684,9 @@ var ts; getUnionType([type, undefinedType, nullType]); } function getOptionalType(type, isProperty) { - if (isProperty === void 0) { isProperty = false; } + if (isProperty === void 0) { + isProperty = false; + } ts.Debug.assert(strictNullChecks); return type.flags & 32768 /* Undefined */ ? type : getUnionType([type, isProperty ? missingType : undefinedType]); } @@ -65726,7 +66082,9 @@ var ts; return createInferenceContextWorker(typeParameters.map(createInferenceInfo), signature, flags, compareTypes || compareTypesAssignable); } function cloneInferenceContext(context, extraFlags) { - if (extraFlags === void 0) { extraFlags = 0; } + if (extraFlags === void 0) { + extraFlags = 0; + } return context && createInferenceContextWorker(ts.map(context.inferences, cloneInferenceInfo), context.signature, context.flags | extraFlags, context.compareTypes); } function createInferenceContextWorker(inferences, signature, flags, compareTypes) { @@ -65922,25 +66280,31 @@ var ts; _i = 0, properties_2 = properties; _a.label = 1; case 1: - if (!(_i < properties_2.length)) return [3 /*break*/, 6]; + if (!(_i < properties_2.length)) + return [3 /*break*/, 6]; targetProp = properties_2[_i]; // TODO: remove this when we support static private identifier fields and find other solutions to get privateNamesAndStaticFields test to pass if (isStaticPrivateIdentifierProperty(targetProp)) { return [3 /*break*/, 5]; } - if (!(requireOptionalProperties || !(targetProp.flags & 16777216 /* Optional */ || ts.getCheckFlags(targetProp) & 48 /* Partial */))) return [3 /*break*/, 5]; + if (!(requireOptionalProperties || !(targetProp.flags & 16777216 /* Optional */ || ts.getCheckFlags(targetProp) & 48 /* Partial */))) + return [3 /*break*/, 5]; sourceProp = getPropertyOfType(source, targetProp.escapedName); - if (!!sourceProp) return [3 /*break*/, 3]; + if (!!sourceProp) + return [3 /*break*/, 3]; return [4 /*yield*/, targetProp]; case 2: _a.sent(); return [3 /*break*/, 5]; case 3: - if (!matchDiscriminantProperties) return [3 /*break*/, 5]; + if (!matchDiscriminantProperties) + return [3 /*break*/, 5]; targetType = getTypeOfSymbol(targetProp); - if (!(targetType.flags & 109440 /* Unit */)) return [3 /*break*/, 5]; + if (!(targetType.flags & 109440 /* Unit */)) + return [3 /*break*/, 5]; sourceType = getTypeOfSymbol(sourceProp); - if (!!(sourceType.flags & 1 /* Any */ || getRegularTypeOfLiteralType(sourceType) === getRegularTypeOfLiteralType(targetType))) return [3 /*break*/, 5]; + if (!!(sourceType.flags & 1 /* Any */ || getRegularTypeOfLiteralType(sourceType) === getRegularTypeOfLiteralType(targetType))) + return [3 /*break*/, 5]; return [4 /*yield*/, targetProp]; case 4: _a.sent(); @@ -66113,8 +66477,12 @@ var ts; } } function inferTypes(inferences, originalSource, originalTarget, priority, contravariant) { - if (priority === void 0) { priority = 0; } - if (contravariant === void 0) { contravariant = false; } + if (priority === void 0) { + priority = 0; + } + if (contravariant === void 0) { + contravariant = false; + } var bivariant = false; var propagationType; var inferencePriority = 2048 /* MaxValue */; @@ -67154,8 +67522,10 @@ var ts; } function getMatchingUnionConstituentForObjectLiteral(unionType, node) { var keyPropertyName = getKeyPropertyName(unionType); - var propNode = keyPropertyName && ts.find(node.properties, function (p) { return p.symbol && p.kind === 294 /* PropertyAssignment */ && - p.symbol.escapedName === keyPropertyName && isPossiblyDiscriminantValue(p.initializer); }); + var propNode = keyPropertyName && ts.find(node.properties, function (p) { + return p.symbol && p.kind === 294 /* PropertyAssignment */ && + p.symbol.escapedName === keyPropertyName && isPossiblyDiscriminantValue(p.initializer); + }); var propType = propNode && getContextFreeTypeOfExpression(propNode.initializer); return propType && getConstituentTypeForKeyType(unionType, propType); } @@ -67226,7 +67596,9 @@ var ts; resolved.members.get("bind") && isTypeSubtypeOf(type, globalFunctionType)); } function getTypeFacts(type, ignoreObjects) { - if (ignoreObjects === void 0) { ignoreObjects = false; } + if (ignoreObjects === void 0) { + ignoreObjects = false; + } var flags = type.flags; if (flags & 4 /* String */) { return strictNullChecks ? 16317953 /* StringStrictFacts */ : 16776705 /* StringFacts */; @@ -67924,7 +68296,9 @@ var ts; return false; } function getFlowTypeOfReference(reference, declaredType, initialType, flowContainer) { - if (initialType === void 0) { initialType = declaredType; } + if (initialType === void 0) { + initialType = declaredType; + } var key; var isKeySet = false; var flowDepth = 0; @@ -69485,8 +69859,12 @@ var ts; return type || anyType; } function tryGetThisTypeAt(node, includeGlobalThis, container) { - if (includeGlobalThis === void 0) { includeGlobalThis = true; } - if (container === void 0) { container = ts.getThisContainer(node, /*includeArrowFunctions*/ false); } + if (includeGlobalThis === void 0) { + includeGlobalThis = true; + } + if (container === void 0) { + container = ts.getThisContainer(node, /*includeArrowFunctions*/ false); + } var isInJS = ts.isInJSFile(node); if (ts.isFunctionLike(container) && (!isInParameterInitializerBeforeContainingFunction(node) || ts.getThisParameter(container))) { @@ -70214,7 +70592,9 @@ var ts; } } function isPossiblyAliasedThisProperty(declaration, kind) { - if (kind === void 0) { kind = ts.getAssignmentDeclarationKind(declaration); } + if (kind === void 0) { + kind = ts.getAssignmentDeclarationKind(declaration); + } if (kind === 4 /* ThisProperty */) { return true; } @@ -71831,7 +72211,9 @@ var ts; * @param prop The symbol for the property being accessed. */ function checkPropertyAccessibility(node, isSuper, writing, type, prop, reportError) { - if (reportError === void 0) { reportError = true; } + if (reportError === void 0) { + reportError = true; + } var errorNode = !reportError ? undefined : node.kind === 160 /* QualifiedName */ ? node.right : node.kind === 199 /* ImportType */ ? node : @@ -72496,9 +72878,11 @@ var ts; return symbol; var candidates; if (symbols === globals) { - var primitives = ts.mapDefined(["string", "number", "boolean", "object", "bigint", "symbol"], function (s) { return symbols.has((s.charAt(0).toUpperCase() + s.slice(1))) - ? createSymbol(524288 /* TypeAlias */, s) - : undefined; }); + var primitives = ts.mapDefined(["string", "number", "boolean", "object", "bigint", "symbol"], function (s) { + return symbols.has((s.charAt(0).toUpperCase() + s.slice(1))) + ? createSymbol(524288 /* TypeAlias */, s) + : undefined; + }); candidates = primitives.concat(ts.arrayFrom(symbols.values())); } else { @@ -72828,7 +73212,9 @@ var ts; return !!(t.flags & (16384 /* Void */ | 32768 /* Undefined */ | 2 /* Unknown */ | 1 /* Any */)); } function hasCorrectArity(node, args, signature, signatureHelpTrailingComma) { - if (signatureHelpTrailingComma === void 0) { signatureHelpTrailingComma = false; } + if (signatureHelpTrailingComma === void 0) { + signatureHelpTrailingComma = false; + } var argCount; var callIsIncomplete = false; // In incomplete call we want to be lenient when we have too few arguments var effectiveParameterCount = getParameterCount(signature); @@ -73721,7 +74107,9 @@ var ts; candidateForTypeArgumentError = oldCandidateForTypeArgumentError; } function chooseOverload(candidates, relation, isSingleNonGenericCandidate, signatureHelpTrailingComma) { - if (signatureHelpTrailingComma === void 0) { signatureHelpTrailingComma = false; } + if (signatureHelpTrailingComma === void 0) { + signatureHelpTrailingComma = false; + } candidatesForArgumentError = undefined; candidateForArgumentArityError = undefined; candidateForTypeArgumentError = undefined; @@ -73820,9 +74208,11 @@ var ts; var _a = ts.minAndMax(candidates, getNumNonRestParameters), minArgumentCount = _a.min, maxNonRestParam = _a.max; var parameters = []; var _loop_25 = function (i) { - var symbols = ts.mapDefined(candidates, function (s) { return signatureHasRestParameter(s) ? - i < s.parameters.length - 1 ? s.parameters[i] : ts.last(s.parameters) : - i < s.parameters.length ? s.parameters[i] : undefined; }); + var symbols = ts.mapDefined(candidates, function (s) { + return signatureHasRestParameter(s) ? + i < s.parameters.length - 1 ? s.parameters[i] : ts.last(s.parameters) : + i < s.parameters.length ? s.parameters[i] : undefined; + }); ts.Debug.assert(symbols.length !== 0); parameters.push(createCombinedSymbolFromTypes(symbols, ts.mapDefined(candidates, function (candidate) { return tryGetTypeAtPosition(candidate, i); }))); }; @@ -75645,7 +76035,9 @@ var ts; } } function checkArithmeticOperandType(operand, type, diagnostic, isAwaitValid) { - if (isAwaitValid === void 0) { isAwaitValid = false; } + if (isAwaitValid === void 0) { + isAwaitValid = false; + } if (!isTypeAssignableTo(type, numberOrBigIntType)) { var awaitedType = isAwaitValid && getAwaitedTypeOfPromise(type); errorAndMaybeSuggestAwait(operand, !!awaitedType && isTypeAssignableTo(awaitedType, numberOrBigIntType), diagnostic); @@ -76045,7 +76437,9 @@ var ts; } /** Note: If property cannot be a SpreadAssignment, then allProperties does not need to be provided */ function checkObjectLiteralDestructuringPropertyAssignment(node, objectLiteralType, propertyIndex, allProperties, rightIsThis) { - if (rightIsThis === void 0) { rightIsThis = false; } + if (rightIsThis === void 0) { + rightIsThis = false; + } var properties = node.properties; var property = properties[propertyIndex]; if (property.kind === 294 /* PropertyAssignment */ || property.kind === 295 /* ShorthandPropertyAssignment */) { @@ -80381,9 +80775,15 @@ var ts; // `yieldType` and `returnType` are defaulted to `neverType` they each will be combined // via `getUnionType` when merging iteration types. `nextType` is defined as `unknownType` // as it is combined via `getIntersectionType` when merging iteration types. - if (yieldType === void 0) { yieldType = neverType; } - if (returnType === void 0) { returnType = neverType; } - if (nextType === void 0) { nextType = unknownType; } + if (yieldType === void 0) { + yieldType = neverType; + } + if (returnType === void 0) { + returnType = neverType; + } + if (nextType === void 0) { + nextType = unknownType; + } // Use the cache only for intrinsic types to keep it small as they are likely to be // more frequently created (i.e. `Iterator`). Iteration types // are also cached on the type they are requested for, so we shouldn't need to maintain @@ -81456,7 +81856,9 @@ var ts; * Note: `member` cannot be a synthetic node. */ function checkExistingMemberForOverrideModifier(node, staticType, baseStaticType, baseWithThis, type, typeWithThis, member, memberIsParameterProperty, reportErrors) { - if (reportErrors === void 0) { reportErrors = true; } + if (reportErrors === void 0) { + reportErrors = true; + } var declaredProp = member.name && getSymbolAtLocation(member.name) || getSymbolAtLocation(member); @@ -81545,8 +81947,10 @@ var ts; var prop = getPropertyOfType(typeWithThis, declaredProp.escapedName); var baseProp = getPropertyOfType(baseWithThis, declaredProp.escapedName); if (prop && baseProp) { - var rootChain = function () { return ts.chainDiagnosticMessages( - /*details*/ undefined, ts.Diagnostics.Property_0_in_type_1_is_not_assignable_to_the_same_property_in_base_type_2, symbolToString(declaredProp), typeToString(typeWithThis), typeToString(baseWithThis)); }; + var rootChain = function () { + return ts.chainDiagnosticMessages( + /*details*/ undefined, ts.Diagnostics.Property_0_in_type_1_is_not_assignable_to_the_same_property_in_base_type_2, symbolToString(declaredProp), typeToString(typeWithThis), typeToString(baseWithThis)); + }; if (!checkTypeAssignableTo(getTypeOfSymbol(prop), getTypeOfSymbol(baseProp), member.name || member, /*message*/ undefined, rootChain)) { issuedMemberError = true; } @@ -85151,7 +85555,9 @@ var ts; return grammarErrorOnNode(asyncModifier, ts.Diagnostics._0_modifier_cannot_be_used_here, "async"); } function checkGrammarForDisallowedTrailingComma(list, diag) { - if (diag === void 0) { diag = ts.Diagnostics.Trailing_comma_not_allowed; } + if (diag === void 0) { + diag = ts.Diagnostics.Trailing_comma_not_allowed; + } if (list && list.hasTrailingComma) { return grammarErrorAtPos(list[0], list.end - ",".length, ",".length, diag); } @@ -86517,7 +86923,9 @@ var ts; * and merging hoisted declarations upon completion. */ function visitLexicalEnvironment(statements, visitor, context, start, ensureUseStrict, nodesVisitor) { - if (nodesVisitor === void 0) { nodesVisitor = visitNodes; } + if (nodesVisitor === void 0) { + nodesVisitor = visitNodes; + } context.startLexicalEnvironment(); statements = nodesVisitor(statements, visitor, ts.isStatement, start); if (ensureUseStrict) @@ -86526,7 +86934,9 @@ var ts; } ts.visitLexicalEnvironment = visitLexicalEnvironment; function visitParameterList(nodes, visitor, context, nodesVisitor) { - if (nodesVisitor === void 0) { nodesVisitor = visitNodes; } + if (nodesVisitor === void 0) { + nodesVisitor = visitNodes; + } var updated; context.startLexicalEnvironment(); if (nodes) { @@ -86595,7 +87005,9 @@ var ts; /*initializer*/ undefined); } function visitFunctionBody(node, visitor, context, nodeVisitor) { - if (nodeVisitor === void 0) { nodeVisitor = visitNode; } + if (nodeVisitor === void 0) { + nodeVisitor = visitNode; + } context.resumeLexicalEnvironment(); var updated = nodeVisitor(node, visitor, ts.isConciseBody); var declarations = context.endLexicalEnvironment(); @@ -86629,8 +87041,12 @@ var ts; } ts.visitIterationBody = visitIterationBody; function visitEachChild(node, visitor, context, nodesVisitor, tokenVisitor, nodeVisitor) { - if (nodesVisitor === void 0) { nodesVisitor = visitNodes; } - if (nodeVisitor === void 0) { nodeVisitor = visitNode; } + if (nodesVisitor === void 0) { + nodesVisitor = visitNodes; + } + if (nodeVisitor === void 0) { + nodeVisitor = visitNode; + } if (node === undefined) { return undefined; } @@ -88233,7 +88649,9 @@ var ts; * @param level Indicates the extent to which flattening should occur. */ function flattenDestructuringBinding(node, visitor, context, level, rval, hoistTempVariables, skipInitializer) { - if (hoistTempVariables === void 0) { hoistTempVariables = false; } + if (hoistTempVariables === void 0) { + hoistTempVariables = false; + } var pendingExpressions; var pendingDeclarations = []; var declarations = []; @@ -94848,9 +95266,11 @@ var ts; function transformJsxAttributesToExpression(attrs, children) { // Map spans of JsxAttribute nodes into object literals and spans // of JsxSpreadAttribute nodes into expressions. - var expressions = ts.flatten(ts.spanMap(attrs, ts.isJsxSpreadAttribute, function (attrs, isSpread) { return isSpread - ? ts.map(attrs, transformJsxSpreadAttributeToExpression) - : factory.createObjectLiteralExpression(ts.map(attrs, transformJsxAttributeToObjectLiteralElement)); })); + var expressions = ts.flatten(ts.spanMap(attrs, ts.isJsxSpreadAttribute, function (attrs, isSpread) { + return isSpread + ? ts.map(attrs, transformJsxSpreadAttributeToExpression) + : factory.createObjectLiteralExpression(ts.map(attrs, transformJsxAttributeToObjectLiteralElement)); + })); if (ts.isJsxSpreadAttribute(attrs[0])) { // We must always emit at least one object literal before a spread // argument.factory.createObjectLiteral @@ -99553,7 +99973,9 @@ var ts; return ts.visitEachChild(node, visitor, context); } function transformAndEmitStatements(statements, start) { - if (start === void 0) { start = 0; } + if (start === void 0) { + start = 0; + } var numStatements = statements.length; for (var i = start; i < numStatements; i++) { transformAndEmitStatement(statements[i]); @@ -105079,12 +105501,14 @@ var ts; } function transformDeclarationsForJS(sourceFile, bundled) { var oldDiag = getSymbolAccessibilityDiagnostic; - getSymbolAccessibilityDiagnostic = function (s) { return (s.errorNode && ts.canProduceDiagnostics(s.errorNode) ? ts.createGetSymbolAccessibilityDiagnosticForNode(s.errorNode)(s) : ({ - diagnosticMessage: s.errorModuleName - ? ts.Diagnostics.Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotation_may_unblock_declaration_emit - : ts.Diagnostics.Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_declaration_emit, - errorNode: s.errorNode || sourceFile - })); }; + getSymbolAccessibilityDiagnostic = function (s) { + return (s.errorNode && ts.canProduceDiagnostics(s.errorNode) ? ts.createGetSymbolAccessibilityDiagnosticForNode(s.errorNode)(s) : ({ + diagnosticMessage: s.errorModuleName + ? ts.Diagnostics.Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotation_may_unblock_declaration_emit + : ts.Diagnostics.Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_declaration_emit, + errorNode: s.errorNode || sourceFile + })); + }; var result = resolver.getDeclarationStatementsForSourceFile(sourceFile, declarationEmitNodeBuilderFlags, symbolTracker, bundled); getSymbolAccessibilityDiagnostic = oldDiag; return result; @@ -105791,10 +106215,12 @@ var ts; } else { var newId = factory.createUniqueName("_default", 16 /* Optimistic */); - getSymbolAccessibilityDiagnostic = function () { return ({ - diagnosticMessage: ts.Diagnostics.Default_export_of_the_module_has_or_is_using_private_name_0, - errorNode: input - }); }; + getSymbolAccessibilityDiagnostic = function () { + return ({ + diagnosticMessage: ts.Diagnostics.Default_export_of_the_module_has_or_is_using_private_name_0, + errorNode: input + }); + }; errorFallbackNode = input; var varDecl = factory.createVariableDeclaration(newId, /*exclamationToken*/ undefined, resolver.createTypeOfExpression(input.expression, input, declarationEmitNodeBuilderFlags, symbolTracker), /*initializer*/ undefined); errorFallbackNode = undefined; @@ -106024,11 +106450,13 @@ var ts; // We must add a temporary declaration for the extends clause expression var oldId = input.name ? ts.unescapeLeadingUnderscores(input.name.escapedText) : "default"; var newId_1 = factory.createUniqueName("".concat(oldId, "_base"), 16 /* Optimistic */); - getSymbolAccessibilityDiagnostic = function () { return ({ - diagnosticMessage: ts.Diagnostics.extends_clause_of_exported_class_0_has_or_is_using_private_name_1, - errorNode: extendsClause_1, - typeName: input.name - }); }; + getSymbolAccessibilityDiagnostic = function () { + return ({ + diagnosticMessage: ts.Diagnostics.extends_clause_of_exported_class_0_has_or_is_using_private_name_1, + errorNode: extendsClause_1, + typeName: input.name + }); + }; var varDecl = factory.createVariableDeclaration(newId_1, /*exclamationToken*/ undefined, resolver.createTypeOfExpression(extendsClause_1.expression, input, declarationEmitNodeBuilderFlags, symbolTracker), /*initializer*/ undefined); var statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(135 /* DeclareKeyword */)] : [], factory.createVariableDeclarationList([varDecl], 2 /* Const */)); var heritageClauses = factory.createNodeArray(ts.map(input.heritageClauses, function (clause) { @@ -106167,9 +106595,11 @@ var ts; return accessorType; } function transformHeritageClauses(nodes) { - return factory.createNodeArray(ts.filter(ts.map(nodes, function (clause) { return factory.updateHeritageClause(clause, ts.visitNodes(factory.createNodeArray(ts.filter(clause.types, function (t) { - return ts.isEntityNameExpression(t.expression) || (clause.token === 94 /* ExtendsKeyword */ && t.expression.kind === 104 /* NullKeyword */); - })), visitDeclarationSubtree)); }), function (clause) { return clause.types && !!clause.types.length; })); + return factory.createNodeArray(ts.filter(ts.map(nodes, function (clause) { + return factory.updateHeritageClause(clause, ts.visitNodes(factory.createNodeArray(ts.filter(clause.types, function (t) { + return ts.isEntityNameExpression(t.expression) || (clause.token === 94 /* ExtendsKeyword */ && t.expression.kind === 104 /* NullKeyword */); + })), visitDeclarationSubtree)); + }), function (clause) { return clause.types && !!clause.types.length; })); } } ts.transformDeclarations = transformDeclarations; @@ -106184,8 +106614,12 @@ var ts; return ts.factory.createModifiersFromModifierFlags(maskModifierFlags(node, modifierMask, modifierAdditions)); } function maskModifierFlags(node, modifierMask, modifierAdditions) { - if (modifierMask === void 0) { modifierMask = 27647 /* All */ ^ 4 /* Public */; } - if (modifierAdditions === void 0) { modifierAdditions = 0 /* None */; } + if (modifierMask === void 0) { + modifierMask = 27647 /* All */ ^ 4 /* Public */; + } + if (modifierAdditions === void 0) { + modifierAdditions = 0 /* None */; + } var flags = (ts.getEffectiveModifierFlags(node) & modifierMask) | modifierAdditions; if (flags & 512 /* Default */ && !(flags & 1 /* Export */)) { // A non-exported default is a nonsequitor - we usually try to remove all export modifiers @@ -106811,7 +107245,9 @@ var ts; * Else, calls `getSourceFilesToEmit` with the (optional) target source file to determine the list of source files to emit. */ function forEachEmittedFile(host, action, sourceFilesOrTargetSourceFile, forceDtsEmit, onlyBuildInfo, includeBuildInfo) { - if (forceDtsEmit === void 0) { forceDtsEmit = false; } + if (forceDtsEmit === void 0) { + forceDtsEmit = false; + } var sourceFiles = ts.isArray(sourceFilesOrTargetSourceFile) ? sourceFilesOrTargetSourceFile : ts.getSourceFilesToEmit(host, sourceFilesOrTargetSourceFile, forceDtsEmit); var options = host.getCompilerOptions(); if (ts.outFile(options)) { @@ -107532,8 +107968,12 @@ var ts; PipelinePhase[PipelinePhase["Emit"] = 4] = "Emit"; })(PipelinePhase || (PipelinePhase = {})); function createPrinter(printerOptions, handlers) { - if (printerOptions === void 0) { printerOptions = {}; } - if (handlers === void 0) { handlers = {}; } + if (printerOptions === void 0) { + printerOptions = {}; + } + if (handlers === void 0) { + handlers = {}; + } var hasGlobalName = handlers.hasGlobalName, _a = handlers.onEmitNode, onEmitNode = _a === void 0 ? ts.noEmitNotification : _a, isEmitNotificationEnabled = handlers.isEmitNotificationEnabled, _b = handlers.substituteNode, substituteNode = _b === void 0 ? ts.noEmitSubstitution : _b, onBeforeEmitNode = handlers.onBeforeEmitNode, onAfterEmitNode = handlers.onAfterEmitNode, onBeforeEmitNodeArray = handlers.onBeforeEmitNodeArray, onAfterEmitNodeArray = handlers.onAfterEmitNodeArray, onBeforeEmitToken = handlers.onBeforeEmitToken, onAfterEmitToken = handlers.onAfterEmitToken; var extendedDiagnostics = !!printerOptions.extendedDiagnostics; var newLine = ts.getNewLineCharacter(printerOptions); @@ -107907,7 +108347,9 @@ var ts; currentParenthesizerRule = undefined; } function pipelineEmitWithHintWorker(hint, node, allowSnippets) { - if (allowSnippets === void 0) { allowSnippets = true; } + if (allowSnippets === void 0) { + allowSnippets = true; + } if (allowSnippets) { var snippet = ts.getSnippetElement(node); if (snippet) { @@ -110585,8 +111027,12 @@ var ts; emitNodeList(emitExpression, parentNode, children, format, parenthesizerRule, start, count); } function emitNodeList(emit, parentNode, children, format, parenthesizerRule, start, count) { - if (start === void 0) { start = 0; } - if (count === void 0) { count = children ? children.length - start : 0; } + if (start === void 0) { + start = 0; + } + if (count === void 0) { + count = children ? children.length - start : 0; + } var isUndefined = children === undefined; if (isUndefined && format & 16384 /* OptionalIfUndefined */) { return; @@ -110792,7 +111238,9 @@ var ts; } } function writeLine(count) { - if (count === void 0) { count = 1; } + if (count === void 0) { + count = 1; + } for (var i = 0; i < count; i++) { writer.writeLine(i > 0); } @@ -111314,7 +111762,9 @@ var ts; * If `optimistic` is set, the first instance will use 'baseName' verbatim instead of 'baseName_1' */ function makeUniqueName(baseName, checkFn, optimistic, scoped) { - if (checkFn === void 0) { checkFn = isUniqueName; } + if (checkFn === void 0) { + checkFn = isUniqueName; + } if (optimistic) { if (checkFn(baseName)) { if (scoped) { @@ -112412,18 +112862,20 @@ var ts; }; } function createTriggerLoggingAddWatch(key) { - return function (file, cb, flags, options, detailInfo1, detailInfo2) { return plainInvokeFactory[key].call(/*thisArgs*/ undefined, file, function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - var triggerredInfo = "".concat(key === "watchFile" ? "FileWatcher" : "DirectoryWatcher", ":: Triggered with ").concat(args[0], " ").concat(args[1] !== undefined ? args[1] : "", ":: ").concat(getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo)); - log(triggerredInfo); - var start = ts.timestamp(); - cb.call.apply(cb, __spreadArray([/*thisArg*/ undefined], args, false)); - var elapsed = ts.timestamp() - start; - log("Elapsed:: ".concat(elapsed, "ms ").concat(triggerredInfo)); - }, flags, options, detailInfo1, detailInfo2); }; + return function (file, cb, flags, options, detailInfo1, detailInfo2) { + return plainInvokeFactory[key].call(/*thisArgs*/ undefined, file, function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + var triggerredInfo = "".concat(key === "watchFile" ? "FileWatcher" : "DirectoryWatcher", ":: Triggered with ").concat(args[0], " ").concat(args[1] !== undefined ? args[1] : "", ":: ").concat(getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo)); + log(triggerredInfo); + var start = ts.timestamp(); + cb.call.apply(cb, __spreadArray([/*thisArg*/ undefined], args, false)); + var elapsed = ts.timestamp() - start; + log("Elapsed:: ".concat(elapsed, "ms ").concat(triggerredInfo)); + }, flags, options, detailInfo1, detailInfo2); + }; } function getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo) { return "WatchInfo: ".concat(file, " ").concat(flags, " ").concat(JSON.stringify(options), " ").concat(getDetailWatchInfo ? getDetailWatchInfo(detailInfo1, detailInfo2) : detailInfo2 === undefined ? detailInfo1 : "".concat(detailInfo1, " ").concat(detailInfo2)); @@ -112447,7 +112899,9 @@ var ts; var ts; (function (ts) { function findConfigFile(searchPath, fileExists, configName) { - if (configName === void 0) { configName = "tsconfig.json"; } + if (configName === void 0) { + configName = "tsconfig.json"; + } return ts.forEachAncestorDirectory(searchPath, function (ancestor) { var fileName = ts.combinePaths(ancestor, configName); return fileExists(fileName) ? fileName : undefined; @@ -112506,7 +112960,9 @@ var ts; /*@internal*/ // TODO(shkamat): update this after reworking ts build API function createCompilerHostWorker(options, setParentNodes, system) { - if (system === void 0) { system = ts.sys; } + if (system === void 0) { + system = ts.sys; + } var existingDirectories = new ts.Map(); var getCanonicalFileName = ts.createGetCanonicalFileName(system.useCaseSensitiveFileNames); var computeHash = ts.maybeBind(system, system.createHash) || ts.generateDjb2Hash; @@ -112820,7 +113276,9 @@ var ts; } /* @internal */ function formatLocation(file, start, host, color) { - if (color === void 0) { color = formatColorAndReset; } + if (color === void 0) { + color = formatColorAndReset; + } var _a = ts.getLineAndCharacterOfPosition(file, start), firstLine = _a.line, firstLineChar = _a.character; // TODO: GH#18217 var relativeFileName = host ? ts.convertToRelativePath(file.fileName, host.getCurrentDirectory(), function (fileName) { return host.getCanonicalFileName(fileName); }) : file.fileName; var output = ""; @@ -112867,7 +113325,9 @@ var ts; } ts.formatDiagnosticsWithColorAndContext = formatDiagnosticsWithColorAndContext; function flattenDiagnosticMessageText(diag, newLine, indent) { - if (indent === void 0) { indent = 0; } + if (indent === void 0) { + indent = 0; + } if (ts.isString(diag)) { return diag; } @@ -113217,15 +113677,17 @@ var ts; var actualResolveModuleNamesWorker; var hasInvalidatedResolution = host.hasInvalidatedResolution || ts.returnFalse; if (host.resolveModuleNames) { - actualResolveModuleNamesWorker = function (moduleNames, containingFile, containingFileName, reusedNames, redirectedReference) { return host.resolveModuleNames(ts.Debug.checkEachDefined(moduleNames), containingFileName, reusedNames, redirectedReference, options, containingFile).map(function (resolved) { - // An older host may have omitted extension, in which case we should infer it from the file extension of resolvedFileName. - if (!resolved || resolved.extension !== undefined) { - return resolved; - } - var withExtension = ts.clone(resolved); - withExtension.extension = ts.extensionFromPath(resolved.resolvedFileName); - return withExtension; - }); }; + actualResolveModuleNamesWorker = function (moduleNames, containingFile, containingFileName, reusedNames, redirectedReference) { + return host.resolveModuleNames(ts.Debug.checkEachDefined(moduleNames), containingFileName, reusedNames, redirectedReference, options, containingFile).map(function (resolved) { + // An older host may have omitted extension, in which case we should infer it from the file extension of resolvedFileName. + if (!resolved || resolved.extension !== undefined) { + return resolved; + } + var withExtension = ts.clone(resolved); + withExtension.extension = ts.extensionFromPath(resolved.resolvedFileName); + return withExtension; + }); + }; moduleResolutionCache = (_a = host.getModuleResolutionCache) === null || _a === void 0 ? void 0 : _a.call(host); } else { @@ -115857,11 +116319,13 @@ var ts; function directoryExistsIfProjectReferenceDeclDir(dir) { var dirPath = host.toPath(dir); var dirPathWithTrailingDirectorySeparator = "".concat(dirPath).concat(ts.directorySeparator); - return ts.forEachKey(setOfDeclarationDirectories, function (declDirPath) { return dirPath === declDirPath || - // Any parent directory of declaration dir - ts.startsWith(declDirPath, dirPathWithTrailingDirectorySeparator) || - // Any directory inside declaration dir - ts.startsWith(dirPath, "".concat(declDirPath, "/")); }); + return ts.forEachKey(setOfDeclarationDirectories, function (declDirPath) { + return dirPath === declDirPath || + // Any parent directory of declaration dir + ts.startsWith(declDirPath, dirPathWithTrailingDirectorySeparator) || + // Any directory inside declaration dir + ts.startsWith(dirPath, "".concat(declDirPath, "/")); + }); } function handleDirectoryCouldBeSymlink(directory) { var _a; @@ -115960,7 +116424,9 @@ var ts; ts.filterSemanticDiagnostics = filterSemanticDiagnostics; /* @internal */ function parseConfigHostFromCompilerHostLike(host, directoryStructureHost) { - if (directoryStructureHost === void 0) { directoryStructureHost = host; } + if (directoryStructureHost === void 0) { + directoryStructureHost = host; + } return { fileExists: function (f) { return directoryStructureHost.fileExists(f); }, readDirectory: function (root, extensions, excludes, includes, depth) { @@ -116140,7 +116606,9 @@ var ts; set.add(v); } function deleteFromMultimap(map, k, v, removeEmpty) { - if (removeEmpty === void 0) { removeEmpty = true; } + if (removeEmpty === void 0) { + removeEmpty = true; + } var set = map.get(k); if (set === null || set === void 0 ? void 0 : set.delete(v)) { if (removeEmpty && !set.size) { @@ -116353,7 +116821,9 @@ var ts; * Returns if the shape of the signature has changed since last emit */ function updateShapeSignature(state, programOfThisState, sourceFile, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache, useFileVersionAsSignature) { - if (useFileVersionAsSignature === void 0) { useFileVersionAsSignature = state.useFileVersionAsSignature; } + if (useFileVersionAsSignature === void 0) { + useFileVersionAsSignature = state.useFileVersionAsSignature; + } ts.Debug.assert(!!sourceFile); ts.Debug.assert(!exportedModulesMapCache || !!state.exportedModulesMap, "Compute visible to outside map only if visibleToOutsideReferencedMap present in the state"); // If we have cached the result for this file, that means hence forth we should assume file shape is uptodate @@ -117110,10 +117580,12 @@ var ts; }); var referencedMap; if (state.referencedMap) { - referencedMap = ts.arrayFrom(state.referencedMap.keys()).sort(ts.compareStringsCaseSensitive).map(function (key) { return [ - toFileId(key), - toFileIdListId(state.referencedMap.getValues(key)) - ]; }); + referencedMap = ts.arrayFrom(state.referencedMap.keys()).sort(ts.compareStringsCaseSensitive).map(function (key) { + return [ + toFileId(key), + toFileIdListId(state.referencedMap.getValues(key)) + ]; + }); } var exportedModulesMap; if (state.exportedModulesMap) { @@ -117819,8 +118291,10 @@ var ts; } var collected = filesWithInvalidatedResolutions; filesWithInvalidatedResolutions = undefined; - return function (path) { return (!!collected && collected.has(path)) || - isFileWithInvalidatedNonRelativeUnresolvedImports(path); }; + return function (path) { + return (!!collected && collected.has(path)) || + isFileWithInvalidatedNonRelativeUnresolvedImports(path); + }; } function clearPerDirectoryResolutions() { moduleResolutionCache.clear(); @@ -118527,15 +119001,17 @@ var ts; function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFile, host, userPreferences) { var info = getInfo(importingSourceFile.path, host); var preferences = getPreferences(host, userPreferences, compilerOptions, importingSourceFile); - var existingSpecifier = ts.forEach(modulePaths, function (modulePath) { return ts.forEach(host.getFileIncludeReasons().get(ts.toPath(modulePath.path, host.getCurrentDirectory(), info.getCanonicalFileName)), function (reason) { - if (reason.kind !== ts.FileIncludeKind.Import || reason.file !== importingSourceFile.path) - return undefined; - var specifier = ts.getModuleNameStringLiteralAt(importingSourceFile, reason.index).text; - // If the preference is for non relative and the module specifier is relative, ignore it - return preferences.relativePreference !== 1 /* NonRelative */ || !ts.pathIsRelative(specifier) ? - specifier : - undefined; - }); }); + var existingSpecifier = ts.forEach(modulePaths, function (modulePath) { + return ts.forEach(host.getFileIncludeReasons().get(ts.toPath(modulePath.path, host.getCurrentDirectory(), info.getCanonicalFileName)), function (reason) { + if (reason.kind !== ts.FileIncludeKind.Import || reason.file !== importingSourceFile.path) + return undefined; + var specifier = ts.getModuleNameStringLiteralAt(importingSourceFile, reason.index).text; + // If the preference is for non relative and the module specifier is relative, ignore it + return preferences.relativePreference !== 1 /* NonRelative */ || !ts.pathIsRelative(specifier) ? + specifier : + undefined; + }); + }); if (existingSpecifier) { var moduleSpecifiers_2 = [existingSpecifier]; return moduleSpecifiers_2; @@ -118729,7 +119205,9 @@ var ts; */ function getAllModulePaths(importingFilePath, importedFileName, host, preferences, importedFilePath) { var _a; - if (importedFilePath === void 0) { importedFilePath = ts.toPath(importedFileName, host.getCurrentDirectory(), ts.hostGetCanonicalFileName(host)); } + if (importedFilePath === void 0) { + importedFilePath = ts.toPath(importedFileName, host.getCurrentDirectory(), ts.hostGetCanonicalFileName(host)); + } var cache = (_a = host.getModuleSpecifierCache) === null || _a === void 0 ? void 0 : _a.call(host); if (cache) { var cached = cache.get(importingFilePath, importedFilePath, preferences); @@ -118867,7 +119345,9 @@ var ts; MatchingMode[MatchingMode["Pattern"] = 2] = "Pattern"; })(MatchingMode || (MatchingMode = {})); function tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, packageName, exports, conditions, mode) { - if (mode === void 0) { mode = 0 /* Exact */; } + if (mode === void 0) { + mode = 0 /* Exact */; + } if (typeof exports === "string") { var pathOrPattern = ts.getNormalizedAbsolutePath(ts.combinePaths(packageDirectory, exports), /*currentDirectory*/ undefined); var extensionSwappedTarget = ts.hasTSFileExtension(targetFilePath) ? ts.removeFileExtension(targetFilePath) + tryGetJSExtensionForFile(targetFilePath, options) : undefined; @@ -119511,7 +119991,9 @@ var ts; ts.noopFileWatcher = { close: ts.noop }; ts.returnNoopFileWatcher = function () { return ts.noopFileWatcher; }; function createWatchHost(system, reportWatchStatus) { - if (system === void 0) { system = ts.sys; } + if (system === void 0) { + system = ts.sys; + } var onWatchStatusChange = reportWatchStatus || createWatchStatusReporter(system); return { onWatchStatusChange: onWatchStatusChange, @@ -119544,7 +120026,9 @@ var ts; } ts.createWatchFactory = createWatchFactory; function createCompilerHostFromProgramHost(host, getCompilerOptions, directoryStructureHost) { - if (directoryStructureHost === void 0) { directoryStructureHost = host; } + if (directoryStructureHost === void 0) { + directoryStructureHost = host; + } var useCaseSensitiveFileNames = host.useCaseSensitiveFileNames(); var hostGetNewLine = ts.memoize(function () { return host.getNewLine(); }); return { @@ -119647,7 +120131,9 @@ var ts; * Creates the watch compiler host that can be extended with config file or root file names and options host */ function createWatchCompilerHost(system, createProgram, reportDiagnostic, reportWatchStatus) { - if (system === void 0) { system = ts.sys; } + if (system === void 0) { + system = ts.sys; + } var write = function (s) { return system.write(s + system.newLine); }; var result = createProgramHost(system, createProgram); ts.copyProperties(result, createWatchHost(system, reportWatchStatus)); @@ -119724,7 +120210,9 @@ var ts; } ts.readBuilderProgram = readBuilderProgram; function createIncrementalCompilerHost(options, system) { - if (system === void 0) { system = ts.sys; } + if (system === void 0) { + system = ts.sys; + } var host = ts.createCompilerHostWorker(options, /*setParentNodes*/ undefined, system); host.createHash = ts.maybeBind(system, system.createHash); host.disableUseFileVersionAsSignature = system.disableUseFileVersionAsSignature; @@ -120348,32 +120836,34 @@ var ts; }, flags, watchOptions, ts.WatchType.WildcardDirectory); } function updateExtendedConfigFilesWatches(forProjectPath, options, watchOptions, watchType) { - ts.updateSharedExtendedConfigFileWatcher(forProjectPath, options, sharedExtendedConfigFileWatchers || (sharedExtendedConfigFileWatchers = new ts.Map()), function (extendedConfigFileName, extendedConfigFilePath) { return watchFile(extendedConfigFileName, function (_fileName, eventKind) { - var _a; - updateCachedSystemWithFile(extendedConfigFileName, extendedConfigFilePath, eventKind); - // Update extended config cache - if (extendedConfigCache) - ts.cleanExtendedConfigCache(extendedConfigCache, extendedConfigFilePath, toPath); - // Update projects - var projects = (_a = sharedExtendedConfigFileWatchers.get(extendedConfigFilePath)) === null || _a === void 0 ? void 0 : _a.projects; - // If there are no referenced projects this extended config file watcher depend on ignore - if (!(projects === null || projects === void 0 ? void 0 : projects.size)) - return; - projects.forEach(function (projectPath) { - if (toPath(configFileName) === projectPath) { - // If this is the config file of the project, reload completely - reloadLevel = ts.ConfigFileProgramReloadLevel.Full; - } - else { - // Reload config for the referenced projects and remove the resolutions from referenced projects since the config file changed - var config = parsedConfigs === null || parsedConfigs === void 0 ? void 0 : parsedConfigs.get(projectPath); - if (config) - config.reloadLevel = ts.ConfigFileProgramReloadLevel.Full; - resolutionCache.removeResolutionsFromProjectReferenceRedirects(projectPath); - } - scheduleProgramUpdate(); - }); - }, ts.PollingInterval.High, watchOptions, watchType); }, toPath); + ts.updateSharedExtendedConfigFileWatcher(forProjectPath, options, sharedExtendedConfigFileWatchers || (sharedExtendedConfigFileWatchers = new ts.Map()), function (extendedConfigFileName, extendedConfigFilePath) { + return watchFile(extendedConfigFileName, function (_fileName, eventKind) { + var _a; + updateCachedSystemWithFile(extendedConfigFileName, extendedConfigFilePath, eventKind); + // Update extended config cache + if (extendedConfigCache) + ts.cleanExtendedConfigCache(extendedConfigCache, extendedConfigFilePath, toPath); + // Update projects + var projects = (_a = sharedExtendedConfigFileWatchers.get(extendedConfigFilePath)) === null || _a === void 0 ? void 0 : _a.projects; + // If there are no referenced projects this extended config file watcher depend on ignore + if (!(projects === null || projects === void 0 ? void 0 : projects.size)) + return; + projects.forEach(function (projectPath) { + if (toPath(configFileName) === projectPath) { + // If this is the config file of the project, reload completely + reloadLevel = ts.ConfigFileProgramReloadLevel.Full; + } + else { + // Reload config for the referenced projects and remove the resolutions from referenced projects since the config file changed + var config = parsedConfigs === null || parsedConfigs === void 0 ? void 0 : parsedConfigs.get(projectPath); + if (config) + config.reloadLevel = ts.ConfigFileProgramReloadLevel.Full; + resolutionCache.removeResolutionsFromProjectReferenceRedirects(projectPath); + } + scheduleProgramUpdate(); + }); + }, ts.PollingInterval.High, watchOptions, watchType); + }, toPath); } function watchReferencedProject(configFileName, configPath, commandLine) { var _a, _b, _c, _d, _e; @@ -120544,14 +121034,18 @@ var ts; return host; } function createSolutionBuilderHost(system, createProgram, reportDiagnostic, reportSolutionBuilderStatus, reportErrorSummary) { - if (system === void 0) { system = ts.sys; } + if (system === void 0) { + system = ts.sys; + } var host = createSolutionBuilderHostBase(system, createProgram, reportDiagnostic, reportSolutionBuilderStatus); host.reportErrorSummary = reportErrorSummary; return host; } ts.createSolutionBuilderHost = createSolutionBuilderHost; function createSolutionBuilderWithWatchHost(system, createProgram, reportDiagnostic, reportSolutionBuilderStatus, reportWatchStatus) { - if (system === void 0) { system = ts.sys; } + if (system === void 0) { + system = ts.sys; + } var host = createSolutionBuilderHostBase(system, createProgram, reportDiagnostic, reportSolutionBuilderStatus); var watchHost = ts.createWatchHost(system, reportWatchStatus); ts.copyProperties(host, watchHost); @@ -121782,33 +122276,37 @@ var ts; }, ts.PollingInterval.High, parsed === null || parsed === void 0 ? void 0 : parsed.watchOptions, ts.WatchType.ConfigFile, resolved)); } function watchExtendedConfigFiles(state, resolvedPath, parsed) { - ts.updateSharedExtendedConfigFileWatcher(resolvedPath, parsed === null || parsed === void 0 ? void 0 : parsed.options, state.allWatchedExtendedConfigFiles, function (extendedConfigFileName, extendedConfigFilePath) { return state.watchFile(extendedConfigFileName, function () { - var _a; - return (_a = state.allWatchedExtendedConfigFiles.get(extendedConfigFilePath)) === null || _a === void 0 ? void 0 : _a.projects.forEach(function (projectConfigFilePath) { - return invalidateProjectAndScheduleBuilds(state, projectConfigFilePath, ts.ConfigFileProgramReloadLevel.Full); - }); - }, ts.PollingInterval.High, parsed === null || parsed === void 0 ? void 0 : parsed.watchOptions, ts.WatchType.ExtendedConfigFile); }, function (fileName) { return toPath(state, fileName); }); + ts.updateSharedExtendedConfigFileWatcher(resolvedPath, parsed === null || parsed === void 0 ? void 0 : parsed.options, state.allWatchedExtendedConfigFiles, function (extendedConfigFileName, extendedConfigFilePath) { + return state.watchFile(extendedConfigFileName, function () { + var _a; + return (_a = state.allWatchedExtendedConfigFiles.get(extendedConfigFilePath)) === null || _a === void 0 ? void 0 : _a.projects.forEach(function (projectConfigFilePath) { + return invalidateProjectAndScheduleBuilds(state, projectConfigFilePath, ts.ConfigFileProgramReloadLevel.Full); + }); + }, ts.PollingInterval.High, parsed === null || parsed === void 0 ? void 0 : parsed.watchOptions, ts.WatchType.ExtendedConfigFile); + }, function (fileName) { return toPath(state, fileName); }); } function watchWildCardDirectories(state, resolved, resolvedPath, parsed) { if (!state.watch) return; - ts.updateWatchingWildcardDirectories(getOrCreateValueMapFromConfigFileMap(state.allWatchedWildcardDirectories, resolvedPath), new ts.Map(ts.getEntries(parsed.wildcardDirectories)), function (dir, flags) { return state.watchDirectory(dir, function (fileOrDirectory) { - var _a; - if (ts.isIgnoredFileFromWildCardWatching({ - watchedDirPath: toPath(state, dir), - fileOrDirectory: fileOrDirectory, - fileOrDirectoryPath: toPath(state, fileOrDirectory), - configFileName: resolved, - currentDirectory: state.currentDirectory, - options: parsed.options, - program: state.builderPrograms.get(resolvedPath) || ((_a = getCachedParsedConfigFile(state, resolvedPath)) === null || _a === void 0 ? void 0 : _a.fileNames), - useCaseSensitiveFileNames: state.parseConfigFileHost.useCaseSensitiveFileNames, - writeLog: function (s) { return state.writeLog(s); }, - toPath: function (fileName) { return toPath(state, fileName); } - })) - return; - invalidateProjectAndScheduleBuilds(state, resolvedPath, ts.ConfigFileProgramReloadLevel.Partial); - }, flags, parsed === null || parsed === void 0 ? void 0 : parsed.watchOptions, ts.WatchType.WildcardDirectory, resolved); }); + ts.updateWatchingWildcardDirectories(getOrCreateValueMapFromConfigFileMap(state.allWatchedWildcardDirectories, resolvedPath), new ts.Map(ts.getEntries(parsed.wildcardDirectories)), function (dir, flags) { + return state.watchDirectory(dir, function (fileOrDirectory) { + var _a; + if (ts.isIgnoredFileFromWildCardWatching({ + watchedDirPath: toPath(state, dir), + fileOrDirectory: fileOrDirectory, + fileOrDirectoryPath: toPath(state, fileOrDirectory), + configFileName: resolved, + currentDirectory: state.currentDirectory, + options: parsed.options, + program: state.builderPrograms.get(resolvedPath) || ((_a = getCachedParsedConfigFile(state, resolvedPath)) === null || _a === void 0 ? void 0 : _a.fileNames), + useCaseSensitiveFileNames: state.parseConfigFileHost.useCaseSensitiveFileNames, + writeLog: function (s) { return state.writeLog(s); }, + toPath: function (fileName) { return toPath(state, fileName); } + })) + return; + invalidateProjectAndScheduleBuilds(state, resolvedPath, ts.ConfigFileProgramReloadLevel.Partial); + }, flags, parsed === null || parsed === void 0 ? void 0 : parsed.watchOptions, ts.WatchType.WildcardDirectory, resolved); + }); } function watchInputFiles(state, resolved, resolvedPath, parsed) { if (!state.watch) @@ -122918,38 +123416,62 @@ var ts; return false; } function isCallExpressionTarget(node, includeElementAccess, skipPastOuterExpressions) { - if (includeElementAccess === void 0) { includeElementAccess = false; } - if (skipPastOuterExpressions === void 0) { skipPastOuterExpressions = false; } + if (includeElementAccess === void 0) { + includeElementAccess = false; + } + if (skipPastOuterExpressions === void 0) { + skipPastOuterExpressions = false; + } return isCalleeWorker(node, ts.isCallExpression, selectExpressionOfCallOrNewExpressionOrDecorator, includeElementAccess, skipPastOuterExpressions); } ts.isCallExpressionTarget = isCallExpressionTarget; function isNewExpressionTarget(node, includeElementAccess, skipPastOuterExpressions) { - if (includeElementAccess === void 0) { includeElementAccess = false; } - if (skipPastOuterExpressions === void 0) { skipPastOuterExpressions = false; } + if (includeElementAccess === void 0) { + includeElementAccess = false; + } + if (skipPastOuterExpressions === void 0) { + skipPastOuterExpressions = false; + } return isCalleeWorker(node, ts.isNewExpression, selectExpressionOfCallOrNewExpressionOrDecorator, includeElementAccess, skipPastOuterExpressions); } ts.isNewExpressionTarget = isNewExpressionTarget; function isCallOrNewExpressionTarget(node, includeElementAccess, skipPastOuterExpressions) { - if (includeElementAccess === void 0) { includeElementAccess = false; } - if (skipPastOuterExpressions === void 0) { skipPastOuterExpressions = false; } + if (includeElementAccess === void 0) { + includeElementAccess = false; + } + if (skipPastOuterExpressions === void 0) { + skipPastOuterExpressions = false; + } return isCalleeWorker(node, ts.isCallOrNewExpression, selectExpressionOfCallOrNewExpressionOrDecorator, includeElementAccess, skipPastOuterExpressions); } ts.isCallOrNewExpressionTarget = isCallOrNewExpressionTarget; function isTaggedTemplateTag(node, includeElementAccess, skipPastOuterExpressions) { - if (includeElementAccess === void 0) { includeElementAccess = false; } - if (skipPastOuterExpressions === void 0) { skipPastOuterExpressions = false; } + if (includeElementAccess === void 0) { + includeElementAccess = false; + } + if (skipPastOuterExpressions === void 0) { + skipPastOuterExpressions = false; + } return isCalleeWorker(node, ts.isTaggedTemplateExpression, selectTagOfTaggedTemplateExpression, includeElementAccess, skipPastOuterExpressions); } ts.isTaggedTemplateTag = isTaggedTemplateTag; function isDecoratorTarget(node, includeElementAccess, skipPastOuterExpressions) { - if (includeElementAccess === void 0) { includeElementAccess = false; } - if (skipPastOuterExpressions === void 0) { skipPastOuterExpressions = false; } + if (includeElementAccess === void 0) { + includeElementAccess = false; + } + if (skipPastOuterExpressions === void 0) { + skipPastOuterExpressions = false; + } return isCalleeWorker(node, ts.isDecorator, selectExpressionOfCallOrNewExpressionOrDecorator, includeElementAccess, skipPastOuterExpressions); } ts.isDecoratorTarget = isDecoratorTarget; function isJsxOpeningLikeElementTagName(node, includeElementAccess, skipPastOuterExpressions) { - if (includeElementAccess === void 0) { includeElementAccess = false; } - if (skipPastOuterExpressions === void 0) { skipPastOuterExpressions = false; } + if (includeElementAccess === void 0) { + includeElementAccess = false; + } + if (skipPastOuterExpressions === void 0) { + skipPastOuterExpressions = false; + } return isCalleeWorker(node, ts.isJsxOpeningLikeElement, selectTagNameOfJsxOpeningLikeElement, includeElementAccess, skipPastOuterExpressions); } ts.isJsxOpeningLikeElementTagName = isJsxOpeningLikeElementTagName; @@ -124023,7 +124545,9 @@ var ts; } } function isInString(sourceFile, position, previousToken) { - if (previousToken === void 0) { previousToken = findPrecedingToken(position, sourceFile); } + if (previousToken === void 0) { + previousToken = findPrecedingToken(position, sourceFile); + } if (previousToken && ts.isStringTextContainingNode(previousToken)) { var start = previousToken.getStart(sourceFile); var end = previousToken.getEnd(); @@ -124295,7 +124819,9 @@ var ts; return n.kind === 1 /* EndOfFileToken */ ? !!n.jsDoc : n.getWidth(sourceFile) !== 0; } function getNodeModifiers(node, excludeFlags) { - if (excludeFlags === void 0) { excludeFlags = 0 /* None */; } + if (excludeFlags === void 0) { + excludeFlags = 0 /* None */; + } var result = []; var flags = ts.isDeclaration(node) ? ts.getCombinedNodeFlagsAlwaysIncludeJSDoc(node) & ~excludeFlags @@ -125005,21 +125531,27 @@ var ts; } ts.mapToDisplayParts = mapToDisplayParts; function typeToDisplayParts(typechecker, type, enclosingDeclaration, flags) { - if (flags === void 0) { flags = 0 /* None */; } + if (flags === void 0) { + flags = 0 /* None */; + } return mapToDisplayParts(function (writer) { typechecker.writeType(type, enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */ | 16384 /* UseAliasDefinedOutsideCurrentScope */, writer); }); } ts.typeToDisplayParts = typeToDisplayParts; function symbolToDisplayParts(typeChecker, symbol, enclosingDeclaration, meaning, flags) { - if (flags === void 0) { flags = 0 /* None */; } + if (flags === void 0) { + flags = 0 /* None */; + } return mapToDisplayParts(function (writer) { typeChecker.writeSymbol(symbol, enclosingDeclaration, meaning, flags | 8 /* UseAliasDefinedOutsideCurrentScope */, writer); }); } ts.symbolToDisplayParts = symbolToDisplayParts; function signatureToDisplayParts(typechecker, signature, enclosingDeclaration, flags) { - if (flags === void 0) { flags = 0 /* None */; } + if (flags === void 0) { + flags = 0 /* None */; + } flags |= 16384 /* UseAliasDefinedOutsideCurrentScope */ | 1024 /* MultilineObjectLiterals */ | 32 /* WriteTypeArgumentsOfSignature */ | 8192 /* OmitParameterModifiers */; return mapToDisplayParts(function (writer) { typechecker.writeSignature(signature, enclosingDeclaration, flags, /*signatureKind*/ undefined, writer); @@ -125080,7 +125612,9 @@ var ts; * and code fixes (because those are triggered by explicit user actions). */ function getSynthesizedDeepClone(node, includeTrivia) { - if (includeTrivia === void 0) { includeTrivia = true; } + if (includeTrivia === void 0) { + includeTrivia = true; + } var clone = node && getSynthesizedDeepCloneWorker(node); if (clone && !includeTrivia) suppressLeadingAndTrailingTrivia(clone); @@ -125122,7 +125656,9 @@ var ts; return visited; } function getSynthesizedDeepClones(nodes, includeTrivia) { - if (includeTrivia === void 0) { includeTrivia = true; } + if (includeTrivia === void 0) { + includeTrivia = true; + } return nodes && ts.factory.createNodeArray(nodes.map(function (n) { return getSynthesizedDeepClone(n, includeTrivia); }), nodes.hasTrailingComma); } ts.getSynthesizedDeepClones = getSynthesizedDeepClones; @@ -125572,7 +126108,9 @@ var ts; return !!get(dependencyName, inGroups); } }); function get(dependencyName, inGroups) { - if (inGroups === void 0) { inGroups = 15 /* All */; } + if (inGroups === void 0) { + inGroups = 15 /* All */; + } for (var _i = 0, dependencyGroups_1 = dependencyGroups; _i < dependencyGroups_1.length; _i++) { var _a = dependencyGroups_1[_i], group_1 = _a[0], deps = _a[1]; if (deps && (inGroups & group_1)) { @@ -125752,7 +126290,9 @@ var ts; } ts.getFixableErrorSpanExpression = getFixableErrorSpanExpression; function mapOneOrMany(valueOrArray, f, resultSelector) { - if (resultSelector === void 0) { resultSelector = ts.identity; } + if (resultSelector === void 0) { + resultSelector = ts.identity; + } return valueOrArray ? ts.isArray(valueOrArray) ? resultSelector(ts.map(valueOrArray, f)) : f(valueOrArray, 0) : undefined; } ts.mapOneOrMany = mapOneOrMany; @@ -127477,13 +128017,15 @@ var ts; return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: completion.hasIndexSignature, optionalReplacementSpan: optionalReplacementSpan, entries: entries }; } case 2 /* Types */: { - var entries = completion.types.map(function (type) { return ({ - name: type.value, - kindModifiers: "" /* none */, - kind: "string" /* string */, - sortText: Completions.SortText.LocationPriority, - replacementSpan: ts.getReplacementSpanForContextToken(contextToken) - }); }); + var entries = completion.types.map(function (type) { + return ({ + name: type.value, + kindModifiers: "" /* none */, + kind: "string" /* string */, + sortText: Completions.SortText.LocationPriority, + replacementSpan: ts.getReplacementSpanForContextToken(contextToken) + }); + }); return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: completion.isNewIdentifier, optionalReplacementSpan: optionalReplacementSpan, entries: entries }; } default: @@ -127696,7 +128238,9 @@ var ts; }; } function getStringLiteralTypes(type, uniques) { - if (uniques === void 0) { uniques = new ts.Map(); } + if (uniques === void 0) { + uniques = new ts.Map(); + } if (!type) return ts.emptyArray; type = ts.skipConstraint(type); @@ -127733,7 +128277,9 @@ var ts; } } function getExtensionOptions(compilerOptions, includeExtensionsOption) { - if (includeExtensionsOption === void 0) { includeExtensionsOption = 0 /* Exclude */; } + if (includeExtensionsOption === void 0) { + includeExtensionsOption = 0 /* Exclude */; + } return { extensions: ts.flatten(getSupportedExtensionsForModuleResolution(compilerOptions)), includeExtensionsOption: includeExtensionsOption }; } function getCompletionEntriesForRelativeModules(literalValue, scriptDirectory, compilerOptions, host, scriptPath, includeExtensions) { @@ -127782,7 +128328,9 @@ var ts; */ function getCompletionEntriesForDirectoryFragment(fragment, scriptPath, _a, host, exclude, result) { var extensions = _a.extensions, includeExtensionsOption = _a.includeExtensionsOption; - if (result === void 0) { result = []; } + if (result === void 0) { + result = []; + } if (fragment === undefined) { fragment = ""; } @@ -128033,7 +128581,9 @@ var ts; return addReplacementSpans(toComplete, range.pos + prefix.length, names); } function getCompletionEntriesFromTypings(host, options, scriptPath, fragmentDirectory, extensionOptions, result) { - if (result === void 0) { result = []; } + if (result === void 0) { + result = []; + } // Check for typings specified in compiler options var seen = new ts.Map(); var typeRoots = ts.tryAndIgnoreErrors(function () { return ts.getEffectiveTypeRoots(options, host); }) || ts.emptyArray; @@ -131256,7 +131806,9 @@ var ts; ; /** True if symbol is a type or a module containing at least one type. */ function symbolCanBeReferencedAtTypeLocation(symbol, checker, seenModules) { - if (seenModules === void 0) { seenModules = new ts.Map(); } + if (seenModules === void 0) { + seenModules = new ts.Map(); + } var sym = ts.skipAlias(symbol.exportSymbol || symbol, checker); return !!(sym.flags & 788968 /* Type */) || checker.isUnknownSymbol(sym) || !!(sym.flags & 1536 /* Module */) && ts.addToSeen(seenModules, ts.getSymbolId(sym)) && @@ -131415,9 +131967,11 @@ var ts; : undefined; } function getFromAllDeclarations(nodeTest, keywords) { - return useParent(node.parent, nodeTest, function (decl) { return ts.mapDefined(decl.symbol.declarations, function (d) { - return nodeTest(d) ? ts.find(d.getChildren(sourceFile), function (c) { return ts.contains(keywords, c.kind); }) : undefined; - }); }); + return useParent(node.parent, nodeTest, function (decl) { + return ts.mapDefined(decl.symbol.declarations, function (d) { + return nodeTest(d) ? ts.find(d.getChildren(sourceFile), function (c) { return ts.contains(keywords, c.kind); }) : undefined; + }); + }); } function useParent(node, nodeTest, getNodes) { return nodeTest(node) ? highlightSpans(getNodes(node, sourceFile)) : undefined; @@ -131770,7 +132324,9 @@ var ts; ts.createDocumentRegistry = createDocumentRegistry; /*@internal*/ function createDocumentRegistryInternal(useCaseSensitiveFileNames, currentDirectory, externalCache) { - if (currentDirectory === void 0) { currentDirectory = ""; } + if (currentDirectory === void 0) { + currentDirectory = ""; + } // Maps from compiler setting target (ES3, ES5, etc.) to all the cached documents we have // for those settings. var buckets = new ts.Map(); @@ -132060,7 +132616,9 @@ var ts; addIndirectUser(top, /** addTransitiveDependencies */ !!isExported(importCall, /** stopAtAmbientModule */ true)); } function isExported(node, stopAtAmbientModule) { - if (stopAtAmbientModule === void 0) { stopAtAmbientModule = false; } + if (stopAtAmbientModule === void 0) { + stopAtAmbientModule = false; + } return ts.findAncestor(node, function (node) { if (stopAtAmbientModule && isAmbientModuleDeclaration(node)) return "quit"; @@ -132086,7 +132644,9 @@ var ts; } /** Adds a module and all of its transitive dependencies as possible indirect users. */ function addIndirectUser(sourceFileLike, addTransitiveDependencies) { - if (addTransitiveDependencies === void 0) { addTransitiveDependencies = false; } + if (addTransitiveDependencies === void 0) { + addTransitiveDependencies = false; + } ts.Debug.assert(!isAvailableThroughGlobal); var isNew = markSeenIndirectUser(sourceFileLike); if (!isNew) @@ -132569,7 +133129,9 @@ var ts; EntryKind[EntryKind["SearchedPropertyFoundLocal"] = 4] = "SearchedPropertyFoundLocal"; })(EntryKind = FindAllReferences.EntryKind || (FindAllReferences.EntryKind = {})); function nodeEntry(node, kind) { - if (kind === void 0) { kind = 1 /* Node */; } + if (kind === void 0) { + kind = 1 /* Node */; + } return { kind: kind, node: node.name || node, @@ -132785,8 +133347,12 @@ var ts; } FindAllReferences.findReferenceOrRenameEntries = findReferenceOrRenameEntries; function getReferenceEntriesForNode(position, node, program, sourceFiles, cancellationToken, options, sourceFilesSet) { - if (options === void 0) { options = {}; } - if (sourceFilesSet === void 0) { sourceFilesSet = new ts.Set(sourceFiles.map(function (f) { return f.fileName; })); } + if (options === void 0) { + options = {}; + } + if (sourceFilesSet === void 0) { + sourceFilesSet = new ts.Set(sourceFiles.map(function (f) { return f.fileName; })); + } return flattenEntries(Core.getReferencedSymbolsForNode(position, node, program, sourceFiles, cancellationToken, options, sourceFilesSet)); } FindAllReferences.getReferenceEntriesForNode = getReferenceEntriesForNode; @@ -133060,8 +133626,12 @@ var ts; /** Core find-all-references algorithm. Handles special cases before delegating to `getReferencedSymbolsForSymbol`. */ function getReferencedSymbolsForNode(position, node, program, sourceFiles, cancellationToken, options, sourceFilesSet) { var _a, _b; - if (options === void 0) { options = {}; } - if (sourceFilesSet === void 0) { sourceFilesSet = new ts.Set(sourceFiles.map(function (f) { return f.fileName; })); } + if (options === void 0) { + options = {}; + } + if (sourceFilesSet === void 0) { + sourceFilesSet = new ts.Set(sourceFiles.map(function (f) { return f.fileName; })); + } if (options.use === 1 /* References */) { node = ts.getAdjustedReferenceLocation(node); } @@ -133130,7 +133700,9 @@ var ts; Core.getReferencedSymbolsForNode = getReferencedSymbolsForNode; function getReferencesForFileName(fileName, program, sourceFiles, sourceFilesSet) { var _a, _b; - if (sourceFilesSet === void 0) { sourceFilesSet = new ts.Set(sourceFiles.map(function (f) { return f.fileName; })); } + if (sourceFilesSet === void 0) { + sourceFilesSet = new ts.Set(sourceFiles.map(function (f) { return f.fileName; })); + } var moduleSymbol = (_a = program.getSourceFile(fileName)) === null || _a === void 0 ? void 0 : _a.symbol; if (moduleSymbol) { return ((_b = getReferencedSymbolsForModule(program, moduleSymbol, /*excludeImportTypeOfExportEquals*/ false, sourceFiles, sourceFilesSet)[0]) === null || _b === void 0 ? void 0 : _b.references) || ts.emptyArray; @@ -133206,9 +133778,11 @@ var ts; return "continue"; } var symbol = entry.definition.symbol; - var refIndex = ts.findIndex(result, function (ref) { return !!ref.definition && - ref.definition.type === 0 /* Symbol */ && - ref.definition.symbol === symbol; }); + var refIndex = ts.findIndex(result, function (ref) { + return !!ref.definition && + ref.definition.type === 0 /* Symbol */ && + ref.definition.symbol === symbol; + }); if (refIndex === -1) { result.push(entry); return "continue"; @@ -133479,7 +134053,9 @@ var ts; }; /** @param allSearchSymbols set of additional symbols for use by `includes`. */ State.prototype.createSearch = function (location, symbol, comingFrom, searchOptions) { - if (searchOptions === void 0) { searchOptions = {}; } + if (searchOptions === void 0) { + searchOptions = {}; + } // Note: if this is an external module symbol, the name doesn't include quotes. // Note: getLocalSymbolForExportDefault handles `export default class C {}`, but not `export default C` or `export { C as default }`. // The other two forms seem to be handled downstream (e.g. in `skipPastExportOrImportSpecifier`), so special-casing the first form @@ -133687,12 +134263,16 @@ var ts; } /** Used as a quick check for whether a symbol is used at all in a file (besides its definition). */ function isSymbolReferencedInFile(definition, checker, sourceFile, searchContainer) { - if (searchContainer === void 0) { searchContainer = sourceFile; } + if (searchContainer === void 0) { + searchContainer = sourceFile; + } return eachSymbolReferenceInFile(definition, checker, sourceFile, function () { return true; }, searchContainer) || false; } Core.isSymbolReferencedInFile = isSymbolReferencedInFile; function eachSymbolReferenceInFile(definition, checker, sourceFile, cb, searchContainer) { - if (searchContainer === void 0) { searchContainer = sourceFile; } + if (searchContainer === void 0) { + searchContainer = sourceFile; + } var symbol = ts.isParameterPropertyDeclaration(definition.parent, definition.parent.parent) ? ts.first(checker.getSymbolsOfParameterPropertyDeclaration(definition.parent, definition.text)) : checker.getSymbolAtLocation(definition); @@ -133737,11 +134317,15 @@ var ts; } Core.someSignatureUsage = someSignatureUsage; function getPossibleSymbolReferenceNodes(sourceFile, symbolName, container) { - if (container === void 0) { container = sourceFile; } + if (container === void 0) { + container = sourceFile; + } return getPossibleSymbolReferencePositions(sourceFile, symbolName, container).map(function (pos) { return ts.getTouchingPropertyName(sourceFile, pos); }); } function getPossibleSymbolReferencePositions(sourceFile, symbolName, container) { - if (container === void 0) { container = sourceFile; } + if (container === void 0) { + container = sourceFile; + } var positions = []; /// TODO: Cache symbol existence for files to save text search // Also, need to make this work for unicode escapes. @@ -133814,7 +134398,9 @@ var ts; return references.length ? [{ definition: { type: 2 /* Keyword */, node: references[0].node }, references: references }] : undefined; } function getReferencesInSourceFile(sourceFile, search, state, addReferencesHere) { - if (addReferencesHere === void 0) { addReferencesHere = true; } + if (addReferencesHere === void 0) { + addReferencesHere = true; + } state.cancellationToken.throwIfCancellationRequested(); return getReferencesInContainer(sourceFile, sourceFile, search, state, addReferencesHere); } @@ -134488,12 +135074,14 @@ var ts; // } if (!(symbol.flags & (32 /* Class */ | 64 /* Interface */)) || !ts.addToSeen(seen, ts.getSymbolId(symbol))) return; - return ts.firstDefined(symbol.declarations, function (declaration) { return ts.firstDefined(ts.getAllSuperTypeNodes(declaration), function (typeReference) { - var type = checker.getTypeAtLocation(typeReference); - var propertySymbol = type && type.symbol && checker.getPropertyOfType(type, propertyName); - // Visit the typeReference as well to see if it directly or indirectly uses that property - return type && propertySymbol && (ts.firstDefined(checker.getRootSymbols(propertySymbol), cb) || recur(type.symbol)); - }); }); + return ts.firstDefined(symbol.declarations, function (declaration) { + return ts.firstDefined(ts.getAllSuperTypeNodes(declaration), function (typeReference) { + var type = checker.getTypeAtLocation(typeReference); + var propertySymbol = type && type.symbol && checker.getPropertyOfType(type, propertyName); + // Visit the typeReference as well to see if it directly or indirectly uses that property + return type && propertySymbol && (ts.firstDefined(checker.getRootSymbols(propertySymbol), cb) || recur(type.symbol)); + }); + }); } } function isStaticSymbol(symbol) { @@ -135648,7 +136236,7 @@ var ts; var name = ts.getNameOfDeclaration(declaration) || declaration; textSpan = ts.createTextSpanFromNode(name, sourceFile); } - return __assign(__assign({ fileName: sourceFile.fileName, textSpan: textSpan, kind: symbolKind, name: symbolName, containerKind: undefined, // TODO: GH#18217 + return __assign(__assign({ fileName: sourceFile.fileName, textSpan: textSpan, kind: symbolKind, name: symbolName, containerKind: undefined, containerName: containerName }, ts.FindAllReferences.toContextSpan(textSpan, sourceFile, ts.FindAllReferences.getContextNode(declaration))), { isLocal: !isDefinitionVisible(checker, declaration) }); } function isDefinitionVisible(checker, declaration) { @@ -137873,17 +138461,27 @@ var ts; return createOutliningSpanFromBounds(node.getStart(sourceFile), node.getEnd(), "code" /* Code */); } function spanForObjectOrArrayLiteral(node, open) { - if (open === void 0) { open = 18 /* OpenBraceToken */; } + if (open === void 0) { + open = 18 /* OpenBraceToken */; + } // If the block has no leading keywords and is inside an array literal or call expression, // we only want to collapse the span of the block. // Otherwise, the collapsed section will include the end of the previous line. return spanForNode(node, /*autoCollapse*/ false, /*useFullStart*/ !ts.isArrayLiteralExpression(node.parent) && !ts.isCallExpression(node.parent), open); } function spanForNode(hintSpanNode, autoCollapse, useFullStart, open, close) { - if (autoCollapse === void 0) { autoCollapse = false; } - if (useFullStart === void 0) { useFullStart = true; } - if (open === void 0) { open = 18 /* OpenBraceToken */; } - if (close === void 0) { close = open === 18 /* OpenBraceToken */ ? 19 /* CloseBraceToken */ : 23 /* CloseBracketToken */; } + if (autoCollapse === void 0) { + autoCollapse = false; + } + if (useFullStart === void 0) { + useFullStart = true; + } + if (open === void 0) { + open = 18 /* OpenBraceToken */; + } + if (close === void 0) { + close = open === 18 /* OpenBraceToken */ ? 19 /* CloseBraceToken */ : 23 /* CloseBracketToken */; + } var openToken = ts.findChildOfKind(n, open, sourceFile); var closeToken = ts.findChildOfKind(n, close, sourceFile); return openToken && closeToken && spanBetweenTokens(openToken, closeToken, hintSpanNode, sourceFile, autoCollapse, useFullStart); @@ -137898,15 +138496,25 @@ var ts; return openToken && closeToken && spanBetweenTokens(openToken, closeToken, node, sourceFile, /*autoCollapse*/ node.kind !== 213 /* ArrowFunction */); } function spanBetweenTokens(openToken, closeToken, hintSpanNode, sourceFile, autoCollapse, useFullStart) { - if (autoCollapse === void 0) { autoCollapse = false; } - if (useFullStart === void 0) { useFullStart = true; } + if (autoCollapse === void 0) { + autoCollapse = false; + } + if (useFullStart === void 0) { + useFullStart = true; + } var textSpan = ts.createTextSpanFromBounds(useFullStart ? openToken.getFullStart() : openToken.getStart(sourceFile), closeToken.getEnd()); return createOutliningSpan(textSpan, "code" /* Code */, ts.createTextSpanFromNode(hintSpanNode, sourceFile), autoCollapse); } function createOutliningSpan(textSpan, kind, hintSpan, autoCollapse, bannerText) { - if (hintSpan === void 0) { hintSpan = textSpan; } - if (autoCollapse === void 0) { autoCollapse = false; } - if (bannerText === void 0) { bannerText = "..."; } + if (hintSpan === void 0) { + hintSpan = textSpan; + } + if (autoCollapse === void 0) { + autoCollapse = false; + } + if (bannerText === void 0) { + bannerText = "..."; + } return { textSpan: textSpan, kind: kind, hintSpan: hintSpan, bannerText: bannerText, autoCollapse: autoCollapse }; } function tryGetFunctionOpenToken(node, body, sourceFile) { @@ -138098,7 +138706,9 @@ var ts; : ts.compareValues(a.kind, b.kind) || ts.compareBooleans(!a.isCaseSensitive, !b.isCaseSensitive); } function partStartsWith(candidate, candidateSpan, pattern, ignoreCase, patternSpan) { - if (patternSpan === void 0) { patternSpan = { start: 0, length: pattern.length }; } + if (patternSpan === void 0) { + patternSpan = { start: 0, length: pattern.length }; + } return patternSpan.length <= candidateSpan.length // If pattern part is longer than the candidate part there can never be a match. && everyInRange(0, patternSpan.length, function (i) { return equalChars(pattern.charCodeAt(patternSpan.start + i), candidate.charCodeAt(candidateSpan.start + i), ignoreCase); }); } @@ -138374,16 +138984,24 @@ var ts; return true; } function every(s, pred, start, end) { - if (start === void 0) { start = 0; } - if (end === void 0) { end = s.length; } + if (start === void 0) { + start = 0; + } + if (end === void 0) { + end = s.length; + } return everyInRange(start, end, function (i) { return pred(s.charCodeAt(i), i); }); } })(ts || (ts = {})); var ts; (function (ts) { function preProcessFile(sourceText, readImportFiles, detectJavaScriptImports) { - if (readImportFiles === void 0) { readImportFiles = true; } - if (detectJavaScriptImports === void 0) { detectJavaScriptImports = false; } + if (readImportFiles === void 0) { + readImportFiles = true; + } + if (detectJavaScriptImports === void 0) { + detectJavaScriptImports = false; + } var pragmaContext = { languageVersion: 1 /* ES5 */, pragmas: undefined, @@ -138623,7 +139241,9 @@ var ts; return false; } function tryConsumeRequireCall(skipCurrentToken, allowTemplateLiterals) { - if (allowTemplateLiterals === void 0) { allowTemplateLiterals = false; } + if (allowTemplateLiterals === void 0) { + allowTemplateLiterals = false; + } var token = skipCurrentToken ? nextToken() : ts.scanner.getToken(); if (token === 145 /* RequireKeyword */) { token = nextToken(); @@ -139116,7 +139736,9 @@ var ts; * child rather than be included in the right-hand group. */ function splitChildren(children, pivotOn, separateTrailingSemicolon) { - if (separateTrailingSemicolon === void 0) { separateTrailingSemicolon = true; } + if (separateTrailingSemicolon === void 0) { + separateTrailingSemicolon = true; + } if (children.length < 2) { return children; } @@ -139275,8 +139897,10 @@ var ts; var type = declaration.symbol && typeChecker.getTypeOfSymbolAtLocation(declaration.symbol, declaration); var callSignatures = type && type.getCallSignatures(); if (callSignatures && callSignatures.length) { - return typeChecker.runWithCancellationToken(cancellationToken, function (typeChecker) { return createSignatureHelpItems(callSignatures, callSignatures[0], argumentInfo, sourceFile, typeChecker, - /*useFullPrefix*/ true); }); + return typeChecker.runWithCancellationToken(cancellationToken, function (typeChecker) { + return createSignatureHelpItems(callSignatures, callSignatures[0], argumentInfo, sourceFile, typeChecker, + /*useFullPrefix*/ true); + }); } }); }); @@ -139728,12 +140352,14 @@ var ts; var isVariadic = !checker.hasEffectiveRestParameter(candidateSignature) ? function (_) { return false; } : lists.length === 1 ? function (_) { return true; } : function (pList) { return !!(pList.length && pList[pList.length - 1].checkFlags & 32768 /* RestParameter */); }; - return lists.map(function (parameterList) { return ({ - isVariadic: isVariadic(parameterList), - parameters: parameterList.map(function (p) { return createSignatureHelpParameterForParameter(p, checker, enclosingDeclaration, sourceFile, printer); }), - prefix: __spreadArray(__spreadArray([], typeParameterParts, true), [ts.punctuationPart(20 /* OpenParenToken */)], false), - suffix: [ts.punctuationPart(21 /* CloseParenToken */)] - }); }); + return lists.map(function (parameterList) { + return ({ + isVariadic: isVariadic(parameterList), + parameters: parameterList.map(function (p) { return createSignatureHelpParameterForParameter(p, checker, enclosingDeclaration, sourceFile, printer); }), + prefix: __spreadArray(__spreadArray([], typeParameterParts, true), [ts.punctuationPart(20 /* OpenParenToken */)], false), + suffix: [ts.punctuationPart(21 /* CloseParenToken */)] + }); + }); } function createSignatureHelpParameterForParameter(parameter, checker, enclosingDeclaration, sourceFile, printer) { var displayParts = ts.mapToDisplayParts(function (writer) { @@ -140550,7 +141176,9 @@ var ts; // TODO(drosen): Currently completion entry details passes the SemanticMeaning.All instead of using semanticMeaning of location function getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, enclosingDeclaration, location, semanticMeaning, alias) { var _a; - if (semanticMeaning === void 0) { semanticMeaning = ts.getMeaningFromLocation(location); } + if (semanticMeaning === void 0) { + semanticMeaning = ts.getMeaningFromLocation(location); + } var displayParts = []; var documentation = []; var tags = []; @@ -141023,7 +141651,9 @@ var ts; } } function addSignatureDisplayParts(signature, allSignatures, flags) { - if (flags === void 0) { flags = 0 /* None */; } + if (flags === void 0) { + flags = 0 /* None */; + } ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, enclosingDeclaration, flags | 32 /* WriteTypeArgumentsOfSignature */)); if (allSignatures.length > 1) { displayParts.push(ts.spacePart()); @@ -141849,7 +142479,9 @@ var ts; * @param flags whether the rule deletes a line or not, defaults to no-op */ function rule(debugName, left, right, context, action, flags) { - if (flags === void 0) { flags = 0 /* None */; } + if (flags === void 0) { + flags = 0 /* None */; + } return { leftTokenRange: toTokenRange(left), rightTokenRange: toTokenRange(right), rule: { debugName: debugName, context: context, action: action, flags: flags } }; } function tokenRangeFrom(tokens) { @@ -141859,7 +142491,9 @@ var ts; return typeof arg === "number" ? tokenRangeFrom([arg]) : ts.isArray(arg) ? tokenRangeFrom(arg) : arg; } function tokenRangeFromRange(from, to, except) { - if (except === void 0) { except = []; } + if (except === void 0) { + except = []; + } var tokens = []; for (var token = from; token <= to; token++) { if (!ts.contains(except, token)) { @@ -142680,8 +143314,10 @@ var ts; } function formatNodeGivenIndentation(node, sourceFileLike, languageVariant, initialIndentation, delta, formatContext) { var range = { pos: 0, end: sourceFileLike.text.length }; - return formatting.getFormattingScanner(sourceFileLike.text, languageVariant, range.pos, range.end, function (scanner) { return formatSpanWorker(range, node, initialIndentation, delta, scanner, formatContext, 1 /* FormatSelection */, function (_) { return false; }, // assume that node does not have any errors - sourceFileLike); }); + return formatting.getFormattingScanner(sourceFileLike.text, languageVariant, range.pos, range.end, function (scanner) { + return formatSpanWorker(range, node, initialIndentation, delta, scanner, formatContext, 1 /* FormatSelection */, function (_) { return false; }, // assume that node does not have any errors + sourceFileLike); + }); } formatting.formatNodeGivenIndentation = formatNodeGivenIndentation; function formatNodeLines(node, sourceFile, formatContext, requestKind) { @@ -143221,7 +143857,9 @@ var ts; return indentationString !== sourceFile.text.substr(startLinePosition, indentationString.length); } function indentMultilineComment(commentRange, indentation, firstLineIsIndented, indentFinalLine) { - if (indentFinalLine === void 0) { indentFinalLine = true; } + if (indentFinalLine === void 0) { + indentFinalLine = true; + } // split comment in lines var startLine = sourceFile.getLineAndCharacterOfPosition(commentRange.pos).line; var endLine = sourceFile.getLineAndCharacterOfPosition(commentRange.end).line; @@ -143393,7 +144031,9 @@ var ts; * @param precedingToken pass `null` if preceding token was already computed and result was `undefined`. */ function getRangeOfEnclosingComment(sourceFile, position, precedingToken, tokenAtPosition) { - if (tokenAtPosition === void 0) { tokenAtPosition = ts.getTokenAtPosition(sourceFile, position); } + if (tokenAtPosition === void 0) { + tokenAtPosition = ts.getTokenAtPosition(sourceFile, position); + } var jsdoc = ts.findAncestor(tokenAtPosition, ts.isJSDoc); if (jsdoc) tokenAtPosition = jsdoc.parent; @@ -143408,21 +144048,23 @@ var ts; var trailingRangesOfPreviousToken = precedingToken && ts.getTrailingCommentRanges(sourceFile.text, precedingToken.end); var leadingCommentRangesOfNextToken = ts.getLeadingCommentRangesOfNode(tokenAtPosition, sourceFile); var commentRanges = ts.concatenate(trailingRangesOfPreviousToken, leadingCommentRangesOfNextToken); - return commentRanges && ts.find(commentRanges, function (range) { return ts.rangeContainsPositionExclusive(range, position) || - // The end marker of a single-line comment does not include the newline character. - // With caret at `^`, in the following case, we are inside a comment (^ denotes the cursor position): - // - // // asdf ^\n - // - // But for closed multi-line comments, we don't want to be inside the comment in the following case: - // - // /* asdf */^ - // - // However, unterminated multi-line comments *do* contain their end. - // - // Internally, we represent the end of the comment at the newline and closing '/', respectively. - // - position === range.end && (range.kind === 2 /* SingleLineCommentTrivia */ || position === sourceFile.getFullWidth()); }); + return commentRanges && ts.find(commentRanges, function (range) { + return ts.rangeContainsPositionExclusive(range, position) || + // The end marker of a single-line comment does not include the newline character. + // With caret at `^`, in the following case, we are inside a comment (^ denotes the cursor position): + // + // // asdf ^\n + // + // But for closed multi-line comments, we don't want to be inside the comment in the following case: + // + // /* asdf */^ + // + // However, unterminated multi-line comments *do* contain their end. + // + // Internally, we represent the end of the comment at the newline and closing '/', respectively. + // + position === range.end && (range.kind === 2 /* SingleLineCommentTrivia */ || position === sourceFile.getFullWidth()); + }); } formatting.getRangeOfEnclosingComment = getRangeOfEnclosingComment; function getOpenTokenForList(node, list) { @@ -143542,7 +144184,9 @@ var ts; * By default indentation at `position` will be 0 so 'assumeNewLineBeforeCloseBrace' overrides this behavior. */ function getIndentation(position, sourceFile, options, assumeNewLineBeforeCloseBrace) { - if (assumeNewLineBeforeCloseBrace === void 0) { assumeNewLineBeforeCloseBrace = false; } + if (assumeNewLineBeforeCloseBrace === void 0) { + assumeNewLineBeforeCloseBrace = false; + } if (position > sourceFile.text.length) { return getBaseIndentation(options); // past EOF } @@ -144117,7 +144761,9 @@ var ts; * @param isNextChild If true, we are judging indent of a hypothetical child *after* this one, not the current child. */ function shouldIndentChildNode(settings, parent, child, sourceFile, isNextChild) { - if (isNextChild === void 0) { isNextChild = false; } + if (isNextChild === void 0) { + isNextChild = false; + } return nodeWillIndentChild(settings, parent, child, sourceFile, /*indentByDefault*/ false) && !(isNextChild && child && isControlFlowEndingStatement(child.kind, parent)); } @@ -144217,7 +144863,9 @@ var ts; } function getAdjustedStartPosition(sourceFile, node, options, hasTrailingComment) { var _a, _b; - if (hasTrailingComment === void 0) { hasTrailingComment = false; } + if (hasTrailingComment === void 0) { + hasTrailingComment = false; + } var leadingTriviaOption = options.leadingTriviaOption; if (leadingTriviaOption === LeadingTriviaOption.Exclude) { return node.getStart(sourceFile); @@ -144367,11 +145015,15 @@ var ts; this.deletedNodes.push({ sourceFile: sourceFile, node: node }); }; ChangeTracker.prototype.deleteNode = function (sourceFile, node, options) { - if (options === void 0) { options = { leadingTriviaOption: LeadingTriviaOption.IncludeAll }; } + if (options === void 0) { + options = { leadingTriviaOption: LeadingTriviaOption.IncludeAll }; + } this.deleteRange(sourceFile, getAdjustedRange(sourceFile, node, node, options)); }; ChangeTracker.prototype.deleteNodes = function (sourceFile, nodes, options, hasTrailingComment) { - if (options === void 0) { options = { leadingTriviaOption: LeadingTriviaOption.IncludeAll }; } + if (options === void 0) { + options = { leadingTriviaOption: LeadingTriviaOption.IncludeAll }; + } // When deleting multiple nodes we need to track if the end position is including multiline trailing comments. for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) { var node = nodes_1[_i]; @@ -144385,46 +145037,64 @@ var ts; this.deleteRange(sourceFile, { pos: modifier.getStart(sourceFile), end: ts.skipTrivia(sourceFile.text, modifier.end, /*stopAfterLineBreak*/ true) }); }; ChangeTracker.prototype.deleteNodeRange = function (sourceFile, startNode, endNode, options) { - if (options === void 0) { options = { leadingTriviaOption: LeadingTriviaOption.IncludeAll }; } + if (options === void 0) { + options = { leadingTriviaOption: LeadingTriviaOption.IncludeAll }; + } var startPosition = getAdjustedStartPosition(sourceFile, startNode, options); var endPosition = getAdjustedEndPosition(sourceFile, endNode, options); this.deleteRange(sourceFile, { pos: startPosition, end: endPosition }); }; ChangeTracker.prototype.deleteNodeRangeExcludingEnd = function (sourceFile, startNode, afterEndNode, options) { - if (options === void 0) { options = { leadingTriviaOption: LeadingTriviaOption.IncludeAll }; } + if (options === void 0) { + options = { leadingTriviaOption: LeadingTriviaOption.IncludeAll }; + } var startPosition = getAdjustedStartPosition(sourceFile, startNode, options); var endPosition = afterEndNode === undefined ? sourceFile.text.length : getAdjustedStartPosition(sourceFile, afterEndNode, options); this.deleteRange(sourceFile, { pos: startPosition, end: endPosition }); }; ChangeTracker.prototype.replaceRange = function (sourceFile, range, newNode, options) { - if (options === void 0) { options = {}; } + if (options === void 0) { + options = {}; + } this.changes.push({ kind: ChangeKind.ReplaceWithSingleNode, sourceFile: sourceFile, range: range, options: options, node: newNode }); }; ChangeTracker.prototype.replaceNode = function (sourceFile, oldNode, newNode, options) { - if (options === void 0) { options = useNonAdjustedPositions; } + if (options === void 0) { + options = useNonAdjustedPositions; + } this.replaceRange(sourceFile, getAdjustedRange(sourceFile, oldNode, oldNode, options), newNode, options); }; ChangeTracker.prototype.replaceNodeRange = function (sourceFile, startNode, endNode, newNode, options) { - if (options === void 0) { options = useNonAdjustedPositions; } + if (options === void 0) { + options = useNonAdjustedPositions; + } this.replaceRange(sourceFile, getAdjustedRange(sourceFile, startNode, endNode, options), newNode, options); }; ChangeTracker.prototype.replaceRangeWithNodes = function (sourceFile, range, newNodes, options) { - if (options === void 0) { options = {}; } + if (options === void 0) { + options = {}; + } this.changes.push({ kind: ChangeKind.ReplaceWithMultipleNodes, sourceFile: sourceFile, range: range, options: options, nodes: newNodes }); }; ChangeTracker.prototype.replaceNodeWithNodes = function (sourceFile, oldNode, newNodes, options) { - if (options === void 0) { options = useNonAdjustedPositions; } + if (options === void 0) { + options = useNonAdjustedPositions; + } this.replaceRangeWithNodes(sourceFile, getAdjustedRange(sourceFile, oldNode, oldNode, options), newNodes, options); }; ChangeTracker.prototype.replaceNodeWithText = function (sourceFile, oldNode, text) { this.replaceRangeWithText(sourceFile, getAdjustedRange(sourceFile, oldNode, oldNode, useNonAdjustedPositions), text); }; ChangeTracker.prototype.replaceNodeRangeWithNodes = function (sourceFile, startNode, endNode, newNodes, options) { - if (options === void 0) { options = useNonAdjustedPositions; } + if (options === void 0) { + options = useNonAdjustedPositions; + } this.replaceRangeWithNodes(sourceFile, getAdjustedRange(sourceFile, startNode, endNode, options), newNodes, options); }; ChangeTracker.prototype.nodeHasTrailingComment = function (sourceFile, oldNode, configurableEnd) { - if (configurableEnd === void 0) { configurableEnd = useNonAdjustedPositions; } + if (configurableEnd === void 0) { + configurableEnd = useNonAdjustedPositions; + } return !!getEndPositionOfMultilineTrailingComment(sourceFile, oldNode, configurableEnd); }; ChangeTracker.prototype.nextCommaToken = function (sourceFile, node) { @@ -144436,11 +145106,15 @@ var ts; this.replaceNode(sourceFile, oldNode, newNode, { suffix: suffix }); }; ChangeTracker.prototype.insertNodeAt = function (sourceFile, pos, newNode, options) { - if (options === void 0) { options = {}; } + if (options === void 0) { + options = {}; + } this.replaceRange(sourceFile, ts.createRange(pos), newNode, options); }; ChangeTracker.prototype.insertNodesAt = function (sourceFile, pos, newNodes, options) { - if (options === void 0) { options = {}; } + if (options === void 0) { + options = {}; + } this.replaceRangeWithNodes(sourceFile, ts.createRange(pos), newNodes, options); }; ChangeTracker.prototype.insertNodeAtTopOfFile = function (sourceFile, newNode, blankLineBetween) { @@ -144472,12 +145146,18 @@ var ts; } }; ChangeTracker.prototype.insertNodeBefore = function (sourceFile, before, newNode, blankLineBetween, options) { - if (blankLineBetween === void 0) { blankLineBetween = false; } - if (options === void 0) { options = {}; } + if (blankLineBetween === void 0) { + blankLineBetween = false; + } + if (options === void 0) { + options = {}; + } this.insertNodeAt(sourceFile, getAdjustedStartPosition(sourceFile, before, options), newNode, this.getOptionsForInsertNodeBefore(before, newNode, blankLineBetween)); }; ChangeTracker.prototype.insertModifierAt = function (sourceFile, pos, modifier, options) { - if (options === void 0) { options = {}; } + if (options === void 0) { + options = {}; + } this.insertNodeAt(sourceFile, pos, ts.factory.createToken(modifier), options); }; ChangeTracker.prototype.insertModifierBefore = function (sourceFile, modifier, before) { @@ -144751,7 +145431,9 @@ var ts; * Note that separators are part of the node in statements and class elements. */ ChangeTracker.prototype.insertNodeInListAfter = function (sourceFile, after, newNode, containingList) { - if (containingList === void 0) { containingList = ts.formatting.SmartIndenter.getContainingList(after, sourceFile); } + if (containingList === void 0) { + containingList = ts.formatting.SmartIndenter.getContainingList(after, sourceFile); + } if (!containingList) { ts.Debug.fail("node is not a list element"); return; @@ -145447,7 +146129,9 @@ var ts; /** Warning: This deletes comments too. See `copyComments` in `convertFunctionToEs6Class`. */ // Exported for tests only! (TODO: improve tests to not need this) function deleteNode(changes, sourceFile, node, options) { - if (options === void 0) { options = { leadingTriviaOption: LeadingTriviaOption.IncludeAll }; } + if (options === void 0) { + options = { leadingTriviaOption: LeadingTriviaOption.IncludeAll }; + } var startPosition = getAdjustedStartPosition(sourceFile, node, options); var endPosition = getAdjustedEndPosition(sourceFile, node, options); changes.deleteRange(sourceFile, { pos: startPosition, end: endPosition }); @@ -146292,11 +146976,13 @@ var ts; return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Annotate_with_type_from_JSDoc, fixId, ts.Diagnostics.Annotate_everything_with_types_from_JSDoc)]; }, fixIds: [fixId], - getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) { - var decl = getDeclaration(diag.file, diag.start); - if (decl) - doChange(changes, diag.file, decl); - }); }, + getAllCodeActions: function (context) { + return codefix.codeFixAll(context, errorCodes, function (changes, diag) { + var decl = getDeclaration(diag.file, diag.start); + if (decl) + doChange(changes, diag.file, decl); + }); + }, }); function getDeclaration(file, pos) { var name = ts.getTokenAtPosition(file, pos); @@ -146455,9 +147141,11 @@ var ts; return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Convert_function_to_an_ES2015_class, fixId, ts.Diagnostics.Convert_all_constructor_functions_to_classes)]; }, fixIds: [fixId], - getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, err) { - return doChange(changes, err.file, err.start, context.program.getTypeChecker(), context.preferences, context.program.getCompilerOptions()); - }); }, + getAllCodeActions: function (context) { + return codefix.codeFixAll(context, errorCodes, function (changes, err) { + return doChange(changes, err.file, err.start, context.program.getTypeChecker(), context.preferences, context.program.getCompilerOptions()); + }); + }, }); function doChange(changes, sourceFile, position, checker, preferences, compilerOptions) { var ctorSymbol = checker.getSymbolAtLocation(ts.getTokenAtPosition(sourceFile, position)); @@ -147387,12 +148075,18 @@ var ts; return ts.every(bindingName.elements, isEmptyBindingName); } function createSynthIdentifier(identifier, types) { - if (types === void 0) { types = []; } + if (types === void 0) { + types = []; + } return { kind: 0 /* Identifier */, identifier: identifier, types: types, hasBeenDeclared: false, hasBeenReferenced: false }; } function createSynthBindingPattern(bindingPattern, elements, types) { - if (elements === void 0) { elements = ts.emptyArray; } - if (types === void 0) { types = []; } + if (elements === void 0) { + elements = ts.emptyArray; + } + if (types === void 0) { + types = []; + } return { kind: 1 /* BindingPattern */, bindingPattern: bindingPattern, elements: elements, types: types }; } function referenceSynthIdentifier(synthId) { @@ -147926,12 +148620,14 @@ var ts; return [codefix.createCodeFixAction(fixId, changes, [ts.Diagnostics.Rewrite_as_the_indexed_access_type_0, newText], fixId, ts.Diagnostics.Rewrite_all_as_indexed_access_types)]; }, fixIds: [fixId], - getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) { - var q = getQualifiedName(diag.file, diag.start); - if (q) { - doChange(changes, diag.file, q); - } - }); }, + getAllCodeActions: function (context) { + return codefix.codeFixAll(context, errorCodes, function (changes, diag) { + var q = getQualifiedName(diag.file, diag.start); + if (q) { + doChange(changes, diag.file, q); + } + }); + }, }); function getQualifiedName(sourceFile, pos) { var qualifiedName = ts.findAncestor(ts.getTokenAtPosition(sourceFile, pos), ts.isQualifiedName); @@ -148082,12 +148778,14 @@ var ts; return [codefix.createCodeFixAction(fixId, changes, [ts.Diagnostics.Convert_0_to_1_in_0, constraint, name], fixId, ts.Diagnostics.Convert_all_type_literals_to_mapped_type)]; }, fixIds: [fixId], - getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) { - var info = getInfo(diag.file, diag.start); - if (info) { - doChange(changes, diag.file, info); - } - }); } + getAllCodeActions: function (context) { + return codefix.codeFixAll(context, errorCodes, function (changes, diag) { + var info = getInfo(diag.file, diag.start); + if (info) { + doChange(changes, diag.file, info); + } + }); + } }); function getInfo(sourceFile, pos) { var token = ts.getTokenAtPosition(sourceFile, pos); @@ -148976,8 +149674,10 @@ var ts; changes.insertNodeAt(sourceFile, clause.getStart(sourceFile), ts.factory.createIdentifier(defaultImport.name), { suffix: ", " }); } if (namedImports.length) { - var newSpecifiers = ts.stableSort(namedImports.map(function (namedImport) { return ts.factory.createImportSpecifier((!clause.isTypeOnly || promoteFromTypeOnly) && needsTypeOnly(namedImport), - /*propertyName*/ undefined, ts.factory.createIdentifier(namedImport.name)); }), ts.OrganizeImports.compareImportOrExportSpecifiers); + var newSpecifiers = ts.stableSort(namedImports.map(function (namedImport) { + return ts.factory.createImportSpecifier((!clause.isTypeOnly || promoteFromTypeOnly) && needsTypeOnly(namedImport), + /*propertyName*/ undefined, ts.factory.createIdentifier(namedImport.name)); + }), ts.OrganizeImports.compareImportOrExportSpecifiers); if ((existingSpecifiers === null || existingSpecifiers === void 0 ? void 0 : existingSpecifiers.length) && ts.OrganizeImports.importSpecifiersAreSorted(existingSpecifiers)) { for (var _b = 0, newSpecifiers_1 = newSpecifiers; _b < newSpecifiers_1.length; _b++) { var spec = newSpecifiers_1[_b]; @@ -149311,9 +150011,11 @@ var ts; return diagnostic ? [codefix.createCodeFixAction(fixId, changes, diagnostic, fixId, ts.Diagnostics.Fix_all_implicit_this_errors)] : ts.emptyArray; }, fixIds: [fixId], - getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) { - doChange(changes, diag.file, diag.start, context.program.getTypeChecker()); - }); }, + getAllCodeActions: function (context) { + return codefix.codeFixAll(context, errorCodes, function (changes, diag) { + doChange(changes, diag.file, diag.start, context.program.getTypeChecker()); + }); + }, }); function doChange(changes, sourceFile, pos, checker) { var token = ts.getTokenAtPosition(sourceFile, pos); @@ -149433,12 +150135,14 @@ var ts; return [codefix.createCodeFixAction("spelling", changes, [ts.Diagnostics.Change_spelling_to_0, ts.symbolName(suggestedSymbol)], fixId, ts.Diagnostics.Fix_all_detected_spelling_errors)]; }, fixIds: [fixId], - getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) { - var info = getInfo(diag.file, diag.start, context, diag.code); - var target = ts.getEmitScriptTarget(context.host.getCompilationSettings()); - if (info) - doChange(changes, context.sourceFile, info.node, info.suggestedSymbol, target); - }); }, + getAllCodeActions: function (context) { + return codefix.codeFixAll(context, errorCodes, function (changes, diag) { + var info = getInfo(diag.file, diag.start, context, diag.code); + var target = ts.getEmitScriptTarget(context.host.getCompilationSettings()); + if (info) + doChange(changes, context.sourceFile, info.node, info.suggestedSymbol, target); + }); + }, }); function getInfo(sourceFile, pos, context, errorCode) { // This is the identifier of the misspelled word. eg: @@ -149573,28 +150277,30 @@ var ts; return [getActionForfixWrapTheBlockWithParen(context, info.declaration, info.expression)]; } }, - getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) { - var info = getInfo(context.program.getTypeChecker(), diag.file, diag.start, diag.code); - if (!info) - return undefined; - switch (context.fixId) { - case fixIdAddReturnStatement: - addReturnStatement(changes, diag.file, info.expression, info.statement); - break; - case fixRemoveBracesFromArrowFunctionBody: - if (!ts.isArrowFunction(info.declaration)) - return undefined; - removeBlockBodyBrace(changes, diag.file, info.declaration, info.expression, info.commentSource, /* withParen */ false); - break; - case fixIdWrapTheBlockWithParen: - if (!ts.isArrowFunction(info.declaration)) - return undefined; - wrapBlockWithParen(changes, diag.file, info.declaration, info.expression); - break; - default: - ts.Debug.fail(JSON.stringify(context.fixId)); - } - }); }, + getAllCodeActions: function (context) { + return codefix.codeFixAll(context, errorCodes, function (changes, diag) { + var info = getInfo(context.program.getTypeChecker(), diag.file, diag.start, diag.code); + if (!info) + return undefined; + switch (context.fixId) { + case fixIdAddReturnStatement: + addReturnStatement(changes, diag.file, info.expression, info.statement); + break; + case fixRemoveBracesFromArrowFunctionBody: + if (!ts.isArrowFunction(info.declaration)) + return undefined; + removeBlockBodyBrace(changes, diag.file, info.declaration, info.expression, info.commentSource, /* withParen */ false); + break; + case fixIdWrapTheBlockWithParen: + if (!ts.isArrowFunction(info.declaration)) + return undefined; + wrapBlockWithParen(changes, diag.file, info.declaration, info.expression); + break; + default: + ts.Debug.fail(JSON.stringify(context.fixId)); + } + }); + }, }); function createObjectTypeFromLabeledExpression(checker, label, expression) { var member = checker.createSymbol(4 /* Property */, label.escapedText); @@ -150278,9 +150984,11 @@ var ts; return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Add_missing_new_operator_to_call, fixId, ts.Diagnostics.Add_missing_new_operator_to_all_calls)]; }, fixIds: [fixId], - getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) { - return addMissingNewOperator(changes, context.sourceFile, diag); - }); }, + getAllCodeActions: function (context) { + return codefix.codeFixAll(context, errorCodes, function (changes, diag) { + return addMissingNewOperator(changes, context.sourceFile, diag); + }); + }, }); function addMissingNewOperator(changes, sourceFile, span) { var call = ts.cast(findAncestorMatchingSpan(sourceFile, span), ts.isCallExpression); @@ -150487,9 +151195,11 @@ var ts; return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Add_missing_super_call, fixId, ts.Diagnostics.Add_all_missing_super_calls)]; }, fixIds: [fixId], - getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) { - return doChange(changes, context.sourceFile, getNode(diag.file, diag.start)); - }); }, + getAllCodeActions: function (context) { + return codefix.codeFixAll(context, errorCodes, function (changes, diag) { + return doChange(changes, context.sourceFile, getNode(diag.file, diag.start)); + }); + }, }); function getNode(sourceFile, pos) { var token = ts.getTokenAtPosition(sourceFile, pos); @@ -150522,13 +151232,15 @@ var ts; return [codefix.createCodeFixActionWithoutFixAll(fixId, changes, ts.Diagnostics.Enable_the_experimentalDecorators_option_in_your_configuration_file)]; }, fixIds: [fixId], - getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes) { - var configFile = context.program.getCompilerOptions().configFile; - if (configFile === undefined) { - return undefined; - } - doChange(changes, configFile); - }); }, + getAllCodeActions: function (context) { + return codefix.codeFixAll(context, errorCodes, function (changes) { + var configFile = context.program.getCompilerOptions().configFile; + if (configFile === undefined) { + return undefined; + } + doChange(changes, configFile); + }); + }, }); function doChange(changeTracker, configFile) { codefix.setJsonCompilerOptionValue(changeTracker, configFile, "experimentalDecorators", ts.factory.createTrue()); @@ -150667,11 +151379,13 @@ var ts; return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Change_extends_to_implements, fixId, ts.Diagnostics.Change_all_extended_interfaces_to_implements)]; }, fixIds: [fixId], - getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) { - var nodes = getNodes(diag.file, diag.start); - if (nodes) - doChanges(changes, diag.file, nodes.extendsToken, nodes.heritageClauses); - }); }, + getAllCodeActions: function (context) { + return codefix.codeFixAll(context, errorCodes, function (changes, diag) { + var nodes = getNodes(diag.file, diag.start); + if (nodes) + doChanges(changes, diag.file, nodes.extendsToken, nodes.heritageClauses); + }); + }, }); function getNodes(sourceFile, pos) { var token = ts.getTokenAtPosition(sourceFile, pos); @@ -150724,11 +151438,13 @@ var ts; return [codefix.createCodeFixAction(fixId, changes, [ts.Diagnostics.Add_0_to_unresolved_variable, info.className || "this"], fixId, ts.Diagnostics.Add_qualifier_to_all_unresolved_variables_matching_a_member_name)]; }, fixIds: [fixId], - getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) { - var info = getInfo(diag.file, diag.start, diag.code); - if (info) - doChange(changes, context.sourceFile, info); - }); }, + getAllCodeActions: function (context) { + return codefix.codeFixAll(context, errorCodes, function (changes, diag) { + var info = getInfo(diag.file, diag.start, diag.code); + if (info) + doChange(changes, context.sourceFile, info); + }); + }, }); function getInfo(sourceFile, pos, diagCode) { var node = ts.getTokenAtPosition(sourceFile, pos); @@ -151025,7 +151741,9 @@ var ts; } } function tryDeleteParameter(changes, sourceFile, parameter, checker, sourceFiles, program, cancellationToken, isFixAll) { - if (isFixAll === void 0) { isFixAll = false; } + if (isFixAll === void 0) { + isFixAll = false; + } if (mayDeleteParameter(checker, sourceFile, parameter, sourceFiles, program, cancellationToken, isFixAll)) { if (parameter.modifiers && parameter.modifiers.length > 0 && (!ts.isIdentifier(parameter.name) || ts.FindAllReferences.Core.isSymbolReferencedInFile(parameter.name, checker, sourceFile))) { @@ -151308,11 +152026,13 @@ var ts; var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, context.sourceFile, callName); }); return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Add_missing_call_parentheses, fixId, ts.Diagnostics.Add_all_missing_call_parentheses)]; }, - getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) { - var callName = getCallName(diag.file, diag.start); - if (callName) - doChange(changes, diag.file, callName); - }); } + getAllCodeActions: function (context) { + return codefix.codeFixAll(context, errorCodes, function (changes, diag) { + var callName = getCallName(diag.file, diag.start); + if (callName) + doChange(changes, diag.file, callName); + }); + } }); function doChange(changes, sourceFile, name) { changes.replaceNodeWithText(sourceFile, name, "".concat(name.text, "()")); @@ -151432,15 +152152,17 @@ var ts; } }, fixIds: [fixId], - getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) { - var edits = doChange(diag.file, diag.start, diag.length, diag.code, context); - if (edits) { - for (var _i = 0, edits_2 = edits; _i < edits_2.length; _i++) { - var edit = edits_2[_i]; - changes.pushRaw(context.sourceFile, edit); + getAllCodeActions: function (context) { + return codefix.codeFixAll(context, errorCodes, function (changes, diag) { + var edits = doChange(diag.file, diag.start, diag.length, diag.code, context); + if (edits) { + for (var _i = 0, edits_2 = edits; _i < edits_2.length; _i++) { + var edit = edits_2[_i]; + changes.pushRaw(context.sourceFile, edit); + } } - } - }); }, + }); + }, }); function doChange(file, start, length, code, context) { var startPosition; @@ -151794,12 +152516,14 @@ var ts; function addJSDocTags(changes, sourceFile, parent, newTags) { var comments = ts.flatMap(parent.jsDoc, function (j) { return typeof j.comment === "string" ? ts.factory.createJSDocText(j.comment) : j.comment; }); var oldTags = ts.flatMapToMutable(parent.jsDoc, function (j) { return j.tags; }); - var unmergedNewTags = newTags.filter(function (newTag) { return !oldTags || !oldTags.some(function (tag, i) { - var merged = tryMergeJsdocTags(tag, newTag); - if (merged) - oldTags[i] = merged; - return !!merged; - }); }); + var unmergedNewTags = newTags.filter(function (newTag) { + return !oldTags || !oldTags.some(function (tag, i) { + var merged = tryMergeJsdocTags(tag, newTag); + if (merged) + oldTags[i] = merged; + return !!merged; + }); + }); var tag = ts.factory.createJSDocComment(ts.factory.createNodeArray(ts.intersperse(comments, ts.factory.createJSDocText("\n"))), ts.factory.createNodeArray(__spreadArray(__spreadArray([], (oldTags || ts.emptyArray), true), unmergedNewTags, true))); var jsDocNode = parent.kind === 213 /* ArrowFunction */ ? getJsDocNodeForArrowFunction(parent) : parent; jsDocNode.jsDoc = parent.jsDoc; @@ -151842,10 +152566,12 @@ var ts; function inferTypeForParametersFromUsage(func, sourceFile, program, cancellationToken) { var references = getFunctionReferences(func, sourceFile, program, cancellationToken); return references && inferTypeFromReferences(program, references, cancellationToken).parameters(func) || - func.parameters.map(function (p) { return ({ - declaration: p, - type: ts.isIdentifier(p.name) ? inferTypeForVariableFromUsage(p.name, program, cancellationToken) : program.getTypeChecker().getAnyType() - }); }); + func.parameters.map(function (p) { + return ({ + declaration: p, + type: ts.isIdentifier(p.name) ? inferTypeForVariableFromUsage(p.name, program, cancellationToken) : program.getTypeChecker().getAnyType() + }); + }); } function getFunctionReferences(containingFunction, sourceFile, program, cancellationToken) { var searchToken; @@ -152514,12 +153240,14 @@ var ts; return [codefix.createCodeFixAction(fixId, changes, [ts.Diagnostics.Replace_0_with_Promise_1, checker.typeToString(returnType), checker.typeToString(promisedType)], fixId, ts.Diagnostics.Fix_all_incorrect_return_type_of_an_async_functions)]; }, - getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) { - var info = getInfo(diag.file, context.program.getTypeChecker(), diag.start); - if (info) { - doChange(changes, diag.file, info.returnTypeNode, info.promisedTypeNode); - } - }); } + getAllCodeActions: function (context) { + return codefix.codeFixAll(context, errorCodes, function (changes, diag) { + var info = getInfo(diag.file, context.program.getTypeChecker(), diag.start); + if (info) { + doChange(changes, diag.file, info.returnTypeNode, info.promisedTypeNode); + } + }); + } }); function getInfo(sourceFile, checker, pos) { if (ts.isInJSFile(sourceFile)) { @@ -152634,8 +153362,12 @@ var ts; * @param body If defined, this will be the body of the member node passed to `addClassElement`. Otherwise, the body will default to a stub. */ function addNewNodeForMemberSymbol(symbol, enclosingDeclaration, sourceFile, context, preferences, importAdder, addClassElement, body, preserveOptional, isAmbient) { - if (preserveOptional === void 0) { preserveOptional = 3 /* All */; } - if (isAmbient === void 0) { isAmbient = false; } + if (preserveOptional === void 0) { + preserveOptional = 3 /* All */; + } + if (isAmbient === void 0) { + isAmbient = false; + } var declarations = symbol.getDeclarations(); if (!(declarations && declarations.length)) { return undefined; @@ -153096,7 +153828,9 @@ var ts; return modifierFlags; } function getAccessorConvertiblePropertyAtPosition(file, program, start, end, considerEmptySpans) { - if (considerEmptySpans === void 0) { considerEmptySpans = true; } + if (considerEmptySpans === void 0) { + considerEmptySpans = true; + } var node = ts.getTokenAtPosition(file, start); var cursorRequest = start === end && considerEmptySpans; var declaration = ts.findAncestor(node.parent, isAcceptedDeclaration); @@ -153449,12 +154183,14 @@ var ts; return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Convert_require_to_import, fixId, ts.Diagnostics.Convert_all_require_to_import)]; }, fixIds: [fixId], - getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) { - var info = getInfo(diag.file, context.program, diag.start); - if (info) { - doChange(changes, context.sourceFile, info); - } - }); }, + getAllCodeActions: function (context) { + return codefix.codeFixAll(context, errorCodes, function (changes, diag) { + var info = getInfo(diag.file, context.program, diag.start); + if (info) { + doChange(changes, context.sourceFile, info); + } + }); + }, }); function doChange(changes, sourceFile, info) { var allowSyntheticDefaults = info.allowSyntheticDefaults, defaultImportName = info.defaultImportName, namedImports = info.namedImports, statement = info.statement, required = info.required; @@ -153513,11 +154249,13 @@ var ts; return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Convert_to_default_import, fixId, ts.Diagnostics.Convert_all_to_default_imports)]; }, fixIds: [fixId], - getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) { - var info = getInfo(diag.file, diag.start); - if (info) - doChange(changes, diag.file, info, context.preferences); - }); }, + getAllCodeActions: function (context) { + return codefix.codeFixAll(context, errorCodes, function (changes, diag) { + var info = getInfo(diag.file, diag.start); + if (info) + doChange(changes, diag.file, info, context.preferences); + }); + }, }); function getInfo(sourceFile, pos) { var name = ts.getTokenAtPosition(sourceFile, pos); @@ -153587,9 +154325,11 @@ var ts; return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Add_missing_typeof, fixId, ts.Diagnostics.Add_missing_typeof)]; }, fixIds: [fixId], - getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) { - return doChange(changes, context.sourceFile, getImportTypeNode(diag.file, diag.start)); - }); }, + getAllCodeActions: function (context) { + return codefix.codeFixAll(context, errorCodes, function (changes, diag) { + return doChange(changes, context.sourceFile, getImportTypeNode(diag.file, diag.start)); + }); + }, }); function getImportTypeNode(sourceFile, pos) { var token = ts.getTokenAtPosition(sourceFile, pos); @@ -153621,12 +154361,14 @@ var ts; return [codefix.createCodeFixAction(fixID, changes, ts.Diagnostics.Wrap_in_JSX_fragment, fixID, ts.Diagnostics.Wrap_all_unparented_JSX_in_JSX_fragment)]; }, fixIds: [fixID], - getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) { - var node = findNodeToFix(context.sourceFile, diag.start); - if (!node) - return undefined; - doChange(changes, context.sourceFile, node); - }); }, + getAllCodeActions: function (context) { + return codefix.codeFixAll(context, errorCodes, function (changes, diag) { + var node = findNodeToFix(context.sourceFile, diag.start); + if (!node) + return undefined; + doChange(changes, context.sourceFile, node); + }); + }, }); function findNodeToFix(sourceFile, pos) { // The error always at 1st token that is "<" in "" @@ -153699,11 +154441,13 @@ var ts; return [codefix.createCodeFixAction(fixId, changes, [ts.Diagnostics.Convert_0_to_mapped_object_type, name], fixId, [ts.Diagnostics.Convert_0_to_mapped_object_type, name])]; }, fixIds: [fixId], - getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) { - var info = getInfo(diag.file, diag.start); - if (info) - doChange(changes, diag.file, info); - }); } + getAllCodeActions: function (context) { + return codefix.codeFixAll(context, errorCodes, function (changes, diag) { + var info = getInfo(diag.file, diag.start); + if (info) + doChange(changes, diag.file, info); + }); + } }); function getInfo(sourceFile, pos) { var token = ts.getTokenAtPosition(sourceFile, pos); @@ -153818,9 +154562,11 @@ var ts; return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Split_into_two_separate_import_declarations, fixId, ts.Diagnostics.Split_all_invalid_type_only_imports)]; } }, - getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, error) { - splitTypeOnlyImport(changes, getImportDeclaration(context.sourceFile, error), context); - }); }, + getAllCodeActions: function (context) { + return codefix.codeFixAll(context, errorCodes, function (changes, error) { + splitTypeOnlyImport(changes, getImportDeclaration(context.sourceFile, error), context); + }); + }, }); function getImportDeclaration(sourceFile, span) { return ts.findAncestor(ts.getTokenAtPosition(sourceFile, span.start), ts.isImportDeclaration); @@ -153892,11 +154638,13 @@ var ts; return [codefix.createCodeFixAction(fixId, changes, [ts.Diagnostics.Change_0_to_1, ";", ","], fixId, [ts.Diagnostics.Change_0_to_1, ";", ","])]; }, fixIds: [fixId], - getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) { - var info = getInfo(diag.file, diag.start, diag.code); - if (info) - doChange(changes, context.sourceFile, info); - }); }, + getAllCodeActions: function (context) { + return codefix.codeFixAll(context, errorCodes, function (changes, diag) { + var info = getInfo(diag.file, diag.start, diag.code); + if (info) + doChange(changes, context.sourceFile, info); + }); + }, }); function getInfo(sourceFile, pos, _) { var node = ts.getTokenAtPosition(sourceFile, pos); @@ -154045,7 +154793,9 @@ var ts; }); ; function getInfo(context, considerPartialSpans) { - if (considerPartialSpans === void 0) { considerPartialSpans = true; } + if (considerPartialSpans === void 0) { + considerPartialSpans = true; + } var file = context.file, program = context.program; var span = ts.getRefactorContextSpan(context); var token = ts.getTokenAtPosition(file, span.start); @@ -154292,7 +155042,9 @@ var ts; }); // Can convert imports of the form `import * as m from "m";` or `import d, { x, y } from "m";`. function getImportToConvert(context, considerPartialSpans) { - if (considerPartialSpans === void 0) { considerPartialSpans = true; } + if (considerPartialSpans === void 0) { + considerPartialSpans = true; + } var file = context.file; var span = ts.getRefactorContextSpan(context); var token = ts.getTokenAtPosition(file, span.start); @@ -154490,7 +155242,9 @@ var ts; return isValidExpression(node) || isValidStatement(node); } function getInfo(context, considerEmptySpans) { - if (considerEmptySpans === void 0) { considerEmptySpans = true; } + if (considerEmptySpans === void 0) { + considerEmptySpans = true; + } var file = context.file, program = context.program; var span = ts.getRefactorContextSpan(context); var forEmptySpan = span.length === 0; @@ -155089,7 +155843,9 @@ var ts; */ // exported only for tests function getRangeToExtract(sourceFile, span, invoked) { - if (invoked === void 0) { invoked = true; } + if (invoked === void 0) { + invoked = true; + } var length = span.length; if (length === 0 && !invoked) { return { errors: [ts.createFileDiagnostic(sourceFile, span.start, length, Messages.cannotExtractEmpty)] }; @@ -156332,7 +157088,9 @@ var ts; } } function collectUsages(node, valueUsage) { - if (valueUsage === void 0) { valueUsage = 1 /* Read */; } + if (valueUsage === void 0) { + valueUsage = 1 /* Read */; + } if (inGenericContext) { var type = checker.getTypeAtLocation(node); recordTypeParameterUsages(type); @@ -156641,14 +157399,18 @@ var ts; } }); function getRangeToExtract(context, considerEmptySpans) { - if (considerEmptySpans === void 0) { considerEmptySpans = true; } + if (considerEmptySpans === void 0) { + considerEmptySpans = true; + } var file = context.file, startPosition = context.startPosition; var isJS = ts.isSourceFileJS(file); var current = ts.getTokenAtPosition(file, startPosition); var range = ts.createTextRangeFromSpan(ts.getRefactorContextSpan(context)); var cursorRequest = range.pos === range.end && considerEmptySpans; - var selection = ts.findAncestor(current, (function (node) { return node.parent && ts.isTypeNode(node) && !rangeContainsSkipTrivia(range, node.parent, file) && - (cursorRequest || ts.nodeOverlapsWithStartEnd(current, file, range.pos, range.end)); })); + var selection = ts.findAncestor(current, (function (node) { + return node.parent && ts.isTypeNode(node) && !rangeContainsSkipTrivia(range, node.parent, file) && + (cursorRequest || ts.nodeOverlapsWithStartEnd(current, file, range.pos, range.end)); + })); if (!selection || !ts.isTypeNode(selection)) return { error: ts.getLocaleSpecificMessage(ts.Diagnostics.Selection_is_not_a_valid_type_node) }; var checker = context.program.getTypeChecker(); @@ -157137,7 +157899,9 @@ var ts; } } function makeVariableStatement(name, type, initializer, flags) { - if (flags === void 0) { flags = 2 /* Const */; } + if (flags === void 0) { + flags = 2 /* Const */; + } return ts.factory.createVariableStatement(/*modifiers*/ undefined, ts.factory.createVariableDeclarationList([ts.factory.createVariableDeclaration(name, /*exclamationToken*/ undefined, type, initializer)], flags)); } function createRequireCall(moduleSpecifier) { @@ -157660,7 +158424,9 @@ var ts; return { renameFilename: undefined, renameLocation: undefined, edits: edits }; } function getConvertibleArrowFunctionAtPosition(file, startPosition, considerFunctionBodies, kind) { - if (considerFunctionBodies === void 0) { considerFunctionBodies = true; } + if (considerFunctionBodies === void 0) { + considerFunctionBodies = true; + } var node = ts.getTokenAtPosition(file, startPosition); var func = ts.getContainingFunction(node); if (!func) { @@ -158331,11 +159097,13 @@ var ts; } // to copy comments following the operator // "foo" + /* comment */ "bar" - var copyTrailingOperatorComments = function (operators, file) { return function (index, targetNode) { - if (index < operators.length) { - ts.copyTrailingComments(operators[index], targetNode, file, 3 /* MultiLineCommentTrivia */, /* hasTrailingNewLine */ false); - } - }; }; + var copyTrailingOperatorComments = function (operators, file) { + return function (index, targetNode) { + if (index < operators.length) { + ts.copyTrailingComments(operators[index], targetNode, file, 3 /* MultiLineCommentTrivia */, /* hasTrailingNewLine */ false); + } + }; + }; // to copy comments following the string // "foo" /* comment */ + "bar" /* comment */ + "bar2" var copyCommentFromMultiNode = function (nodes, file, copyOperatorComments) { @@ -159687,7 +160455,9 @@ var ts; /** A cancellation that throttles calls to the host */ var ThrottledCancellationToken = /** @class */ (function () { function ThrottledCancellationToken(hostCancellationToken, throttleWaitMilliseconds) { - if (throttleWaitMilliseconds === void 0) { throttleWaitMilliseconds = 20; } + if (throttleWaitMilliseconds === void 0) { + throttleWaitMilliseconds = 20; + } this.hostCancellationToken = hostCancellationToken; this.throttleWaitMilliseconds = throttleWaitMilliseconds; // Store when we last tried to cancel. Checking cancellation can be expensive (as we have @@ -159754,7 +160524,9 @@ var ts; ], false); function createLanguageService(host, documentRegistry, syntaxOnlyOrLanguageServiceMode) { var _a; - if (documentRegistry === void 0) { documentRegistry = ts.createDocumentRegistry(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames(), host.getCurrentDirectory()); } + if (documentRegistry === void 0) { + documentRegistry = ts.createDocumentRegistry(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames(), host.getCurrentDirectory()); + } var languageServiceMode; if (syntaxOnlyOrLanguageServiceMode === undefined) { languageServiceMode = ts.LanguageServiceMode.Semantic; @@ -160076,20 +160848,26 @@ var ts; return __spreadArray(__spreadArray([], program.getOptionsDiagnostics(cancellationToken), true), program.getGlobalDiagnostics(cancellationToken), true); } function getCompletionsAtPosition(fileName, position, options) { - if (options === void 0) { options = ts.emptyOptions; } + if (options === void 0) { + options = ts.emptyOptions; + } // Convert from deprecated options names to new names var fullPreferences = __assign(__assign({}, ts.identity(options)), { includeCompletionsForModuleExports: options.includeCompletionsForModuleExports || options.includeExternalModuleExports, includeCompletionsWithInsertText: options.includeCompletionsWithInsertText || options.includeInsertTextCompletions }); synchronizeHostData(); return ts.Completions.getCompletionsAtPosition(host, program, log, getValidSourceFile(fileName), position, fullPreferences, options.triggerCharacter, options.triggerKind, cancellationToken); } function getCompletionEntryDetails(fileName, position, name, formattingOptions, source, preferences, data) { - if (preferences === void 0) { preferences = ts.emptyOptions; } + if (preferences === void 0) { + preferences = ts.emptyOptions; + } synchronizeHostData(); return ts.Completions.getCompletionEntryDetails(program, log, getValidSourceFile(fileName), position, { name: name, source: source, data: data }, host, (formattingOptions && ts.formatting.getFormatContext(formattingOptions, host)), // TODO: GH#18217 preferences, cancellationToken); } function getCompletionEntrySymbol(fileName, position, name, source, preferences) { - if (preferences === void 0) { preferences = ts.emptyOptions; } + if (preferences === void 0) { + preferences = ts.emptyOptions; + } synchronizeHostData(); return ts.Completions.getCompletionEntrySymbol(program, log, getValidSourceFile(fileName), position, { name: name, source: source }, host, preferences); } @@ -160223,7 +161001,9 @@ var ts; return ts.FindAllReferences.Core.getReferencesForFileName(fileName, program, program.getSourceFiles()).map(function (r) { return ts.FindAllReferences.toReferenceEntry(r, moduleSymbol); }); } function getNavigateToItems(searchValue, maxResultCount, fileName, excludeDtsFiles) { - if (excludeDtsFiles === void 0) { excludeDtsFiles = false; } + if (excludeDtsFiles === void 0) { + excludeDtsFiles = false; + } synchronizeHostData(); var sourceFiles = fileName ? [getValidSourceFile(fileName)] : program.getSourceFiles(); return ts.NavigateTo.getNavigateToItems(sourceFiles, program.getTypeChecker(), cancellationToken, searchValue, maxResultCount, excludeDtsFiles); @@ -160392,7 +161172,9 @@ var ts; return []; } function getCodeFixesAtPosition(fileName, start, end, errorCodes, formatOptions, preferences) { - if (preferences === void 0) { preferences = ts.emptyOptions; } + if (preferences === void 0) { + preferences = ts.emptyOptions; + } synchronizeHostData(); var sourceFile = getValidSourceFile(fileName); var span = ts.createTextSpanFromBounds(start, end); @@ -160403,7 +161185,9 @@ var ts; }); } function getCombinedCodeFix(scope, fixId, formatOptions, preferences) { - if (preferences === void 0) { preferences = ts.emptyOptions; } + if (preferences === void 0) { + preferences = ts.emptyOptions; + } synchronizeHostData(); ts.Debug.assert(scope.type === "file"); var sourceFile = getValidSourceFile(scope.fileName); @@ -160411,7 +161195,9 @@ var ts; return ts.codefix.getAllFixes({ fixId: fixId, sourceFile: sourceFile, program: program, host: host, cancellationToken: cancellationToken, formatContext: formatContext, preferences: preferences }); } function organizeImports(args, formatOptions, preferences) { - if (preferences === void 0) { preferences = ts.emptyOptions; } + if (preferences === void 0) { + preferences = ts.emptyOptions; + } synchronizeHostData(); ts.Debug.assert(args.type === "file"); var sourceFile = getValidSourceFile(args.fileName); @@ -160419,7 +161205,9 @@ var ts; return ts.OrganizeImports.organizeImports(sourceFile, formatContext, host, program, preferences, args.skipDestructiveCodeActions); } function getEditsForFileRename(oldFilePath, newFilePath, formatOptions, preferences) { - if (preferences === void 0) { preferences = ts.emptyOptions; } + if (preferences === void 0) { + preferences = ts.emptyOptions; + } return ts.getEditsForFileRename(getProgram(), oldFilePath, newFilePath, host, ts.formatting.getFormatContext(formatOptions, host), preferences, sourceMapper); } function applyCodeActionCommand(fileName, actionOrFormatSettingsOrUndefined) { @@ -160857,13 +161645,17 @@ var ts; return ts.SmartSelectionRange.getSmartSelectionRange(position, syntaxTreeCache.getCurrentSourceFile(fileName)); } function getApplicableRefactors(fileName, positionOrRange, preferences, triggerReason, kind) { - if (preferences === void 0) { preferences = ts.emptyOptions; } + if (preferences === void 0) { + preferences = ts.emptyOptions; + } synchronizeHostData(); var file = getValidSourceFile(fileName); return ts.refactor.getApplicableRefactors(getRefactorContext(file, positionOrRange, preferences, ts.emptyOptions, triggerReason, kind)); } function getEditsForRefactor(fileName, formatOptions, positionOrRange, refactorName, actionName, preferences) { - if (preferences === void 0) { preferences = ts.emptyOptions; } + if (preferences === void 0) { + preferences = ts.emptyOptions; + } synchronizeHostData(); var file = getValidSourceFile(fileName); return ts.refactor.getEditsForRefactor(getRefactorContext(file, positionOrRange, preferences, formatOptions), refactorName, actionName); @@ -160896,7 +161688,9 @@ var ts; return declaration ? ts.CallHierarchy.getOutgoingCalls(program, declaration) : []; } function provideInlayHints(fileName, span, preferences) { - if (preferences === void 0) { preferences = ts.emptyOptions; } + if (preferences === void 0) { + preferences = ts.emptyOptions; + } synchronizeHostData(); var sourceFile = getValidSourceFile(fileName); return ts.InlayHints.provideInlayHints(getInlayHintsContext(sourceFile, span, preferences)); @@ -162364,12 +163158,16 @@ var ts; } ClassifierShimObject.prototype.getEncodedLexicalClassifications = function (text, lexState, syntacticClassifierAbsent) { var _this = this; - if (syntacticClassifierAbsent === void 0) { syntacticClassifierAbsent = false; } + if (syntacticClassifierAbsent === void 0) { + syntacticClassifierAbsent = false; + } return forwardJSONCall(this.logger, "getEncodedLexicalClassifications", function () { return convertClassifications(_this.classifier.getEncodedLexicalClassifications(text, lexState, syntacticClassifierAbsent)); }, this.logPerformance); }; /// COLORIZATION ClassifierShimObject.prototype.getClassificationsForLine = function (text, lexState, classifyKeywordsInGenerics) { - if (classifyKeywordsInGenerics === void 0) { classifyKeywordsInGenerics = false; } + if (classifyKeywordsInGenerics === void 0) { + classifyKeywordsInGenerics = false; + } var classification = this.classifier.getClassificationsForLine(text, lexState, classifyKeywordsInGenerics); var result = ""; for (var _i = 0, _a = classification.entries; _i < _a.length; _i++) { @@ -163322,7 +164120,9 @@ var ts; }, factoryDeprecation); /** @deprecated Use `factory.updateBinary` or the factory supplied by your transformation context instead. */ ts.updateBinary = ts.Debug.deprecate(function updateBinary(node, left, right, operator) { - if (operator === void 0) { operator = node.operatorToken; } + if (operator === void 0) { + operator = node.operatorToken; + } if (typeof operator === "number") { operator = operator === node.operatorToken.kind ? node.operatorToken : ts.factory.createToken(operator); } @@ -163404,7 +164204,9 @@ var ts; }, factoryDeprecation); /** @deprecated Use `factory.createImportClause` or the factory supplied by your transformation context instead. */ ts.createImportClause = ts.Debug.deprecate(function createImportClause(name, namedBindings, isTypeOnly) { - if (isTypeOnly === void 0) { isTypeOnly = false; } + if (isTypeOnly === void 0) { + isTypeOnly = false; + } return ts.factory.createImportClause(isTypeOnly, name, namedBindings); }, factoryDeprecation); /** @deprecated Use `factory.updateImportClause` or the factory supplied by your transformation context instead. */ @@ -163413,7 +164215,9 @@ var ts; }, factoryDeprecation); /** @deprecated Use `factory.createExportDeclaration` or the factory supplied by your transformation context instead. */ ts.createExportDeclaration = ts.Debug.deprecate(function createExportDeclaration(decorators, modifiers, exportClause, moduleSpecifier, isTypeOnly) { - if (isTypeOnly === void 0) { isTypeOnly = false; } + if (isTypeOnly === void 0) { + isTypeOnly = false; + } return ts.factory.createExportDeclaration(decorators, modifiers, isTypeOnly, exportClause, moduleSpecifier); }, factoryDeprecation); /** @deprecated Use `factory.updateExportDeclaration` or the factory supplied by your transformation context instead. */ @@ -163470,8 +164274,12 @@ var ts; }, factoryDeprecation); /** @deprecated Use an appropriate `factory` method instead. */ ts.createNode = ts.Debug.deprecate(function createNode(kind, pos, end) { - if (pos === void 0) { pos = 0; } - if (end === void 0) { end = 0; } + if (pos === void 0) { + pos = 0; + } + if (end === void 0) { + end = 0; + } return ts.setTextRangePosEnd(kind === 303 /* SourceFile */ ? ts.parseBaseNodeFactory.createBaseSourceFileNode(kind) : kind === 79 /* Identifier */ ? ts.parseBaseNodeFactory.createBaseIdentifierNode(kind) : kind === 80 /* PrivateIdentifier */ ? ts.parseBaseNodeFactory.createBasePrivateIdentifierNode(kind) : @@ -163527,9 +164335,6 @@ var ts; // #endregion Renamed node Tests })(ts || (ts = {})); - - - // MONACOCHANGE // Defining the entire module name because r.js has an issue and cannot bundle this file // correctly with an anonymous define call diff --git a/src/language/typescript/lib/typescriptServices.js b/src/language/typescript/lib/typescriptServices.js index fec0134f6d..e23ed69221 100644 --- a/src/language/typescript/lib/typescriptServices.js +++ b/src/language/typescript/lib/typescriptServices.js @@ -15,63 +15,113 @@ MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ - "use strict"; var __spreadArray = function (to, from, pack) { - if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { - if (ar || !(i in from)) { - if (!ar) ar = Array.prototype.slice.call(from, 0, i); - ar[i] = from[i]; + if (pack || arguments.length === 2) + for (var i = 0, l = from.length, ar; i < l; i++) { + if (ar || !(i in from)) { + if (!ar) + ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; + } } - } return to.concat(ar || Array.prototype.slice.call(from)); }; var __assign = function () { - __assign = Object.assign || function(t) { + __assign = Object.assign || function (t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) - t[p] = s[p]; + for (var p in s) + if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; var __makeTemplateObject = function (cooked, raw) { - if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } + if (Object.defineProperty) { + Object.defineProperty(cooked, "raw", { value: raw }); + } + else { + cooked.raw = raw; + } return cooked; }; var __generator = function (thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + var _ = { label: 0, sent: function () { if (t[0] & 1) + throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function () { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) 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]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; + if (f) + throw new TypeError("Generator is already executing."); + while (_) + 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]) { + case 0: + case 1: + t = op; + break; + case 4: + _.label++; + return { value: op[1], done: false }; + case 5: + _.label++; + y = op[1]; + op = [0]; + continue; + case 7: + op = _.ops.pop(); + _.trys.pop(); + continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { + _ = 0; + continue; + } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { + _.label = op[1]; + break; + } + if (op[0] === 6 && _.label < t[1]) { + _.label = t[1]; + t = op; + break; + } + if (t && _.label < t[2]) { + _.label = t[2]; + _.ops.push(op); + break; + } + if (t[2]) + _.ops.pop(); + _.trys.pop(); + continue; + } + op = body.call(thisArg, _); + } + catch (e) { + op = [6, e]; + y = 0; } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + finally { + f = t = 0; + } + if (op[0] & 5) + throw op[1]; + return { value: op[0] ? op[1] : void 0, done: true }; } }; var __rest = function (s, e) { var t = {}; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) - t[p] = s[p]; + for (var p in s) + if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) @@ -83,7 +133,9 @@ var __extends = (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; + function (d, b) { for (var p in b) + if (Object.prototype.hasOwnProperty.call(b, p)) + d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { @@ -571,7 +623,9 @@ var ts; } ts.findMap = findMap; function contains(array, value, equalityComparer) { - if (equalityComparer === void 0) { equalityComparer = equateValues; } + if (equalityComparer === void 0) { + equalityComparer = equateValues; + } if (array) { for (var _i = 0, array_1 = array; _i < array_1.length; _i++) { var v = array_1[_i]; @@ -584,7 +638,9 @@ var ts; } ts.contains = contains; function arraysEqual(a, b, equalityComparer) { - if (equalityComparer === void 0) { equalityComparer = equateValues; } + if (equalityComparer === void 0) { + equalityComparer = equateValues; + } return a.length === b.length && a.every(function (x, i) { return equalityComparer(x, b[i]); }); } ts.arraysEqual = arraysEqual; @@ -1090,7 +1146,9 @@ var ts; } ts.arrayIsSorted = arrayIsSorted; function arrayIsEqualTo(array1, array2, equalityComparer) { - if (equalityComparer === void 0) { equalityComparer = equateValues; } + if (equalityComparer === void 0) { + equalityComparer = equateValues; + } if (!array1 || !array2) { return array1 === array2; } @@ -1541,7 +1599,9 @@ var ts; * @param right A map-like whose properties should be compared. */ function equalOwnProperties(left, right, equalityComparer) { - if (equalityComparer === void 0) { equalityComparer = equateValues; } + if (equalityComparer === void 0) { + equalityComparer = equateValues; + } if (left === right) return true; if (!left || !right) @@ -1564,7 +1624,9 @@ var ts; } ts.equalOwnProperties = equalOwnProperties; function arrayToMap(array, makeKey, makeValue) { - if (makeValue === void 0) { makeValue = identity; } + if (makeValue === void 0) { + makeValue = identity; + } var result = new ts.Map(); for (var _i = 0, array_6 = array; _i < array_6.length; _i++) { var value = array_6[_i]; @@ -1576,7 +1638,9 @@ var ts; } ts.arrayToMap = arrayToMap; function arrayToNumericMap(array, makeKey, makeValue) { - if (makeValue === void 0) { makeValue = identity; } + if (makeValue === void 0) { + makeValue = identity; + } var result = []; for (var _i = 0, array_7 = array; _i < array_7.length; _i++) { var value = array_7[_i]; @@ -1586,7 +1650,9 @@ var ts; } ts.arrayToNumericMap = arrayToNumericMap; function arrayToMultiMap(values, makeKey, makeValue) { - if (makeValue === void 0) { makeValue = identity; } + if (makeValue === void 0) { + makeValue = identity; + } var result = createMultiMap(); for (var _i = 0, values_1 = values; _i < values_1.length; _i++) { var value = values_1[_i]; @@ -1596,7 +1662,9 @@ var ts; } ts.arrayToMultiMap = arrayToMultiMap; function group(values, getGroupId, resultSelector) { - if (resultSelector === void 0) { resultSelector = identity; } + if (resultSelector === void 0) { + resultSelector = identity; + } return arrayFrom(arrayToMultiMap(values, getGroupId).values(), resultSelector); } ts.group = group; @@ -2279,7 +2347,9 @@ var ts; } ts.removePrefix = removePrefix; function tryRemovePrefix(str, prefix, getCanonicalFileName) { - if (getCanonicalFileName === void 0) { getCanonicalFileName = identity; } + if (getCanonicalFileName === void 0) { + getCanonicalFileName = identity; + } return startsWith(getCanonicalFileName(str), getCanonicalFileName(prefix)) ? str.substring(prefix.length) : undefined; } ts.tryRemovePrefix = tryRemovePrefix; @@ -2408,7 +2478,9 @@ var ts; * @param padString Character to use as padding (default " "). */ function padLeft(s, length, padString) { - if (padString === void 0) { padString = " "; } + if (padString === void 0) { + padString = " "; + } return length <= s.length ? s : padString.repeat(length - s.length) + s; } ts.padLeft = padLeft; @@ -2420,7 +2492,9 @@ var ts; * @param padString Character to use as padding (default " "). */ function padRight(s, length, padString) { - if (padString === void 0) { padString = " "; } + if (padString === void 0) { + padString = " "; + } return length <= s.length ? s : s + padString.repeat(length - s.length); } ts.padRight = padRight; @@ -2638,7 +2712,9 @@ var ts; */ Debug.assertEachDefined = checkEachDefined; function assertNever(member, message, stackCrawlMark) { - if (message === void 0) { message = "Illegal value:"; } + if (message === void 0) { + message = "Illegal value:"; + } var detail = typeof member === "object" && ts.hasProperty(member, "kind") && ts.hasProperty(member, "pos") && formatSyntaxKind ? "SyntaxKind: " + formatSyntaxKind(member.kind) : JSON.stringify(member); return fail("".concat(message, " ").concat(detail), stackCrawlMark || assertNever); } @@ -2703,7 +2779,9 @@ var ts; * Formats an enum value as a string for debugging and debug assertions. */ function formatEnum(value, enumObject, isFlags) { - if (value === void 0) { value = 0; } + if (value === void 0) { + value = 0; + } var members = getEnumMembers(enumObject); if (value === 0) { return members.length > 0 && members[0][0] === 0 ? members[0][1] : "0"; @@ -3058,9 +3136,7 @@ var ts; try { if (ts.sys && ts.sys.require) { var basePath = ts.getDirectoryPath(ts.resolvePath(ts.sys.getExecutingFilePath())); - // MONACOCHANGE - var result = undefined; - // END MONACOCHANGE + var result = ts.sys.require(basePath, "./compiler-debug"); if (!result.error) { result.module.init(ts); extendedDebugModule = result.module; @@ -3098,7 +3174,9 @@ var ts; } function createDeprecation(name, options) { var _a, _b; - if (options === void 0) { options = {}; } + if (options === void 0) { + options = {}; + } var version = typeof options.typeScriptVersion === "string" ? new ts.Version(options.typeScriptVersion) : (_a = options.typeScriptVersion) !== null && _a !== void 0 ? _a : getTypeScriptVersion(); var errorAfter = typeof options.errorAfter === "string" ? new ts.Version(options.errorAfter) : options.errorAfter; var warnAfter = typeof options.warnAfter === "string" ? new ts.Version(options.warnAfter) : options.warnAfter; @@ -3152,10 +3230,18 @@ var ts; */ var Version = /** @class */ (function () { function Version(major, minor, patch, prerelease, build) { - if (minor === void 0) { minor = 0; } - if (patch === void 0) { patch = 0; } - if (prerelease === void 0) { prerelease = ""; } - if (build === void 0) { build = ""; } + if (minor === void 0) { + minor = 0; + } + if (patch === void 0) { + patch = 0; + } + if (prerelease === void 0) { + prerelease = ""; + } + if (build === void 0) { + build = ""; + } if (typeof major === "string") { var result = ts.Debug.checkDefined(tryParseComponents(major), "Invalid version"); (major = result.major, minor = result.minor, patch = result.patch, prerelease = result.prerelease, build = result.build); @@ -3512,10 +3598,10 @@ var ts; } } function tryGetNodePerformanceHooks() { - if (typeof process !== "undefined" && process.nextTick && !process.browser && typeof module === "object" && /* MONACOCHANGE */false/* END MONACOCHANGE */) { + if (typeof process !== "undefined" && process.nextTick && !process.browser && typeof module === "object" && /* MONACOCHANGE */ false /* END MONACOCHANGE */) { try { var performance_1; - var _a /* MONACOCHANGE */= {}/* END MONACOCHANGE */, nodePerformance_1 = _a.performance, PerformanceObserver_1 = _a.PerformanceObserver; + var _a = (function MONACOCHANGE_require() { })("perf_hooks"), nodePerformance_1 = _a.performance, PerformanceObserver_1 = _a.PerformanceObserver; if (hasRequiredAPI(nodePerformance_1, PerformanceObserver_1)) { performance_1 = nodePerformance_1; // There is a bug in Node's performance.measure prior to 12.16.3/13.13.0 that does not @@ -3530,7 +3616,9 @@ var ts; now: function () { return nodePerformance_1.now(); }, mark: function (name) { return nodePerformance_1.mark(name); }, measure: function (name, start, end) { - if (start === void 0) { start = "nodeStart"; } + if (start === void 0) { + start = "nodeStart"; + } if (end === undefined) { end = "__performance.measure-fix__"; nodePerformance_1.mark(end); @@ -3682,7 +3770,9 @@ var ts; /** Enables (and resets) performance measurements for the compiler. */ function enable(system) { var _a; - if (system === void 0) { system = ts.sys; } + if (system === void 0) { + system = ts.sys; + } if (!enabled) { enabled = true; perfHooks || (perfHooks = ts.tryGetNativePerformanceHooks()); @@ -3746,9 +3836,7 @@ var ts; var etwModulePath = (_a = process.env.TS_ETW_MODULE_PATH) !== null && _a !== void 0 ? _a : "./node_modules/@microsoft/typescript-etw"; // require() will throw an exception if the module is not found // It may also return undefined if not installed properly - // MONACOCHANGE - etwModule = undefined; - // END MONACOCHANGE + etwModule = (function MONACOCHANGE_require() { })(etwModulePath); } catch (e) { etwModule = undefined; @@ -3777,9 +3865,7 @@ var ts; ts.Debug.assert(!ts.tracing, "Tracing already started"); if (fs === undefined) { try { - // MONACOCHANGE - fs = undefined; - // END MONACOCHANGE + fs = (function MONACOCHANGE_require() { })("fs"); } catch (e) { throw new Error("tracing requires having fs\n(original error: ".concat(e.message || e, ")")); @@ -3858,7 +3944,9 @@ var ts; * these operations. */ function push(phase, name, args, separateBeginAndEnd) { - if (separateBeginAndEnd === void 0) { separateBeginAndEnd = false; } + if (separateBeginAndEnd === void 0) { + separateBeginAndEnd = false; + } if (separateBeginAndEnd) { writeEvent("B", phase, name, args); } @@ -3892,7 +3980,9 @@ var ts; } } function writeEvent(eventType, phase, name, args, extras, time) { - if (time === void 0) { time = 1000 * ts.timestamp(); } + if (time === void 0) { + time = 1000 * ts.timestamp(); + } // In server mode, there's no easy way to dump type information, so we drop events that would require it. if (mode === "server" && phase === "checkTypes" /* CheckTypes */) return; @@ -5324,7 +5414,9 @@ var ts; })(DiagnosticCategory = ts.DiagnosticCategory || (ts.DiagnosticCategory = {})); /* @internal */ function diagnosticCategoryName(d, lowerCase) { - if (lowerCase === void 0) { lowerCase = true; } + if (lowerCase === void 0) { + lowerCase = true; + } var name = DiagnosticCategory[d.category]; return lowerCase ? name.toLowerCase() : name; } @@ -6248,7 +6340,9 @@ var ts; * getPathComponents("file://") === ["file://"] */ function getPathComponents(path, currentDirectory) { - if (currentDirectory === void 0) { currentDirectory = ""; } + if (currentDirectory === void 0) { + currentDirectory = ""; + } path = combinePaths(currentDirectory, path); return pathComponents(path, getRootLength(path)); } @@ -7055,9 +7149,11 @@ var ts; var timerToUpdateChildWatches; var filePathComparer = ts.getStringComparer(!useCaseSensitiveFileNames); var toCanonicalFilePath = ts.createGetCanonicalFileName(useCaseSensitiveFileNames); - return function (dirName, callback, recursive, options) { return recursive ? - createDirectoryWatcher(dirName, options, callback) : - watchDirectory(dirName, callback, recursive, options); }; + return function (dirName, callback, recursive, options) { + return recursive ? + createDirectoryWatcher(dirName, options, callback) : + watchDirectory(dirName, callback, recursive, options); + }; /** * Create the directory watcher for the dirPath. */ @@ -7463,9 +7559,24 @@ var ts; ts.getNodeMajorVersion = getNodeMajorVersion; // TODO: GH#18217 this is used as if it's certainly defined in many places. // eslint-disable-next-line prefer-const - // MONACOCHANGE - ts.sys = undefined; - // END MONACOCHANGE + ts.sys = (function () { + // NodeJS detects "\uFEFF" at the start of the string and *replaces* it with the actual + // byte order mark from the specified encoding. Using any other byte order mark does + // not actually work. + var byteOrderMarkIndicator = "\uFEFF"; + function getNodeSystem() { } + var sys; + if (typeof process !== "undefined" && process.nextTick && !process.browser && /* MONACOCHANGE */ false /* END MONACOCHANGE */) { + // process and process.nextTick checks if current environment is node-like + // process.browser check excludes webpack and browserify + sys = getNodeSystem(); + } + if (sys) { + // patch writefile to create folder before writing the file + patchWriteFileEnsuringDirectory(sys); + } + return sys; + })(); /*@internal*/ function setSys(s) { ts.sys = s; @@ -9301,20 +9412,20 @@ var ts; ts.tokenIsIdentifierOrKeywordOrGreaterThan = tokenIsIdentifierOrKeywordOrGreaterThan; /** @internal */ ts.textToKeywordObj = (_a = { - abstract: 126 /* AbstractKeyword */, - any: 130 /* AnyKeyword */, - as: 127 /* AsKeyword */, - asserts: 128 /* AssertsKeyword */, - assert: 129 /* AssertKeyword */, - bigint: 157 /* BigIntKeyword */, - boolean: 133 /* BooleanKeyword */, - break: 81 /* BreakKeyword */, - case: 82 /* CaseKeyword */, - catch: 83 /* CatchKeyword */, - class: 84 /* ClassKeyword */, - continue: 86 /* ContinueKeyword */, - const: 85 /* ConstKeyword */ - }, + abstract: 126 /* AbstractKeyword */, + any: 130 /* AnyKeyword */, + as: 127 /* AsKeyword */, + asserts: 128 /* AssertsKeyword */, + assert: 129 /* AssertKeyword */, + bigint: 157 /* BigIntKeyword */, + boolean: 133 /* BooleanKeyword */, + break: 81 /* BreakKeyword */, + case: 82 /* CaseKeyword */, + catch: 83 /* CatchKeyword */, + class: 84 /* ClassKeyword */, + continue: 86 /* ContinueKeyword */, + const: 85 /* ConstKeyword */ + }, _a["" + "constructor"] = 134 /* ConstructorKeyword */, _a.debugger = 87 /* DebuggerKeyword */, _a.declare = 135 /* DeclareKeyword */, @@ -10032,7 +10143,9 @@ var ts; ts.isIdentifierText = isIdentifierText; // Creates a scanner over a (possibly unspecified) range of a piece of text. function createScanner(languageVersion, skipTrivia, languageVariant, textInitial, onError, start, length) { - if (languageVariant === void 0) { languageVariant = 0 /* Standard */; } + if (languageVariant === void 0) { + languageVariant = 0 /* Standard */; + } var text = textInitial; // Current position (end position of text of current token) var pos; @@ -10103,7 +10216,9 @@ var ts; } return scanner; function error(message, errPos, length) { - if (errPos === void 0) { errPos = pos; } + if (errPos === void 0) { + errPos = pos; + } if (onError) { var oldPos = pos; pos = errPos; @@ -10283,7 +10398,9 @@ var ts; return String.fromCharCode.apply(String, valueChars); } function scanString(jsxAttributeString) { - if (jsxAttributeString === void 0) { jsxAttributeString = false; } + if (jsxAttributeString === void 0) { + jsxAttributeString = false; + } var quote = text.charCodeAt(pos); pos++; var result = ""; @@ -11232,7 +11349,9 @@ var ts; return token = scanTemplateAndSetTokenValue(/* isTaggedTemplate */ true); } function reScanJsxToken(allowMultilineJsxText) { - if (allowMultilineJsxText === void 0) { allowMultilineJsxText = true; } + if (allowMultilineJsxText === void 0) { + allowMultilineJsxText = true; + } pos = tokenPos = startPos; return token = scanJsxToken(allowMultilineJsxText); } @@ -11256,7 +11375,9 @@ var ts; return token = 57 /* QuestionToken */; } function scanJsxToken(allowMultilineJsxText) { - if (allowMultilineJsxText === void 0) { allowMultilineJsxText = true; } + if (allowMultilineJsxText === void 0) { + allowMultilineJsxText = true; + } startPos = tokenPos = pos; if (pos >= end) { return token = 1 /* EndOfFileToken */; @@ -13913,10 +14034,12 @@ var ts; } ts.isPinnedComment = isPinnedComment; function createCommentDirectivesMap(sourceFile, commentDirectives) { - var directivesByLine = new ts.Map(commentDirectives.map(function (commentDirective) { return ([ - "".concat(ts.getLineAndCharacterOfPosition(sourceFile, commentDirective.range.end).line), - commentDirective, - ]); })); + var directivesByLine = new ts.Map(commentDirectives.map(function (commentDirective) { + return ([ + "".concat(ts.getLineAndCharacterOfPosition(sourceFile, commentDirective.range.end).line), + commentDirective, + ]); + })); var usedLines = new ts.Map(); return { getUnusedExpectations: getUnusedExpectations, markUsed: markUsed }; function getUnusedExpectations() { @@ -13972,7 +14095,9 @@ var ts; } ts.getNonDecoratorTokenPosOfNode = getNonDecoratorTokenPosOfNode; function getSourceTextOfNodeFromSourceFile(sourceFile, node, includeTrivia) { - if (includeTrivia === void 0) { includeTrivia = false; } + if (includeTrivia === void 0) { + includeTrivia = false; + } return getTextOfNodeFromSourceText(sourceFile.text, node, includeTrivia); } ts.getSourceTextOfNodeFromSourceFile = getSourceTextOfNodeFromSourceFile; @@ -13984,7 +14109,9 @@ var ts; } ts.isExportNamespaceAsDefaultDeclaration = isExportNamespaceAsDefaultDeclaration; function getTextOfNodeFromSourceText(sourceText, node, includeTrivia) { - if (includeTrivia === void 0) { includeTrivia = false; } + if (includeTrivia === void 0) { + includeTrivia = false; + } if (nodeIsMissing(node)) { return ""; } @@ -13997,7 +14124,9 @@ var ts; } ts.getTextOfNodeFromSourceText = getTextOfNodeFromSourceText; function getTextOfNode(node, includeTrivia) { - if (includeTrivia === void 0) { includeTrivia = false; } + if (includeTrivia === void 0) { + includeTrivia = false; + } return getSourceTextOfNodeFromSourceFile(getSourceFileOfNode(node), node, includeTrivia); } ts.getTextOfNode = getTextOfNode; @@ -18485,7 +18614,9 @@ var ts; * @param end The end position. */ function createRange(pos, end) { - if (end === void 0) { end = pos; } + if (end === void 0) { + end = pos; + } ts.Debug.assert(end >= pos || end === -1); return { pos: pos, end: end }; } @@ -18600,7 +18731,9 @@ var ts; } ts.getLinesBetweenPositionAndNextNonWhitespaceCharacter = getLinesBetweenPositionAndNextNonWhitespaceCharacter; function getPreviousNonWhitespacePosition(pos, stopPos, sourceFile) { - if (stopPos === void 0) { stopPos = 0; } + if (stopPos === void 0) { + stopPos = 0; + } while (pos-- > stopPos) { if (!ts.isWhiteSpaceLike(sourceFile.text.charCodeAt(pos))) { return pos; @@ -18644,7 +18777,9 @@ var ts; } ts.getCheckFlags = getCheckFlags; function getDeclarationModifierFlagsFromSymbol(s, isWrite) { - if (isWrite === void 0) { isWrite = false; } + if (isWrite === void 0) { + isWrite = false; + } if (s.valueDeclaration) { var declaration = (isWrite && s.declarations && ts.find(s.declarations, function (d) { return d.kind === 172 /* SetAccessor */; })) || s.valueDeclaration; var flags = ts.getCombinedModifierFlags(declaration); @@ -18854,7 +18989,9 @@ var ts; } ts.getLastChild = getLastChild; function addToSeen(seen, key, value) { - if (value === void 0) { value = true; } + if (value === void 0) { + value = true; + } if (seen.has(key)) { return false; } @@ -19028,7 +19165,9 @@ var ts; } ts.setObjectAllocator = setObjectAllocator; function formatStringFromArgs(text, args, baseIndex) { - if (baseIndex === void 0) { baseIndex = 0; } + if (baseIndex === void 0) { + baseIndex = 0; + } return text.replace(/{(\d+)}/g, function (_match, index) { return "" + ts.Debug.checkDefined(args[+index + baseIndex]); }); } ts.formatStringFromArgs = formatStringFromArgs; @@ -20154,7 +20293,9 @@ var ts; } ts.isIdentifierTypeReference = isIdentifierTypeReference; function arrayIsHomogeneous(array, comparer) { - if (comparer === void 0) { comparer = ts.equateValues; } + if (comparer === void 0) { + comparer = ts.equateValues; + } if (array.length < 2) return true; var first = array[0]; @@ -21631,7 +21772,9 @@ var ts; } // @api function createNumericLiteral(value, numericLiteralFlags) { - if (numericLiteralFlags === void 0) { numericLiteralFlags = 0 /* None */; } + if (numericLiteralFlags === void 0) { + numericLiteralFlags = 0 /* None */; + } var node = createBaseLiteral(8 /* NumericLiteral */, typeof value === "number" ? value + "" : value); node.numericLiteralFlags = numericLiteralFlags; if (numericLiteralFlags & 384 /* BinaryOrOctalSpecifier */) @@ -21742,7 +21885,9 @@ var ts; /** Create a unique name based on the supplied text. */ // @api function createUniqueName(text, flags) { - if (flags === void 0) { flags = 0 /* None */; } + if (flags === void 0) { + flags = 0 /* None */; + } ts.Debug.assert(!(flags & 7 /* KindMask */), "Argument out of range: flags"); ts.Debug.assert((flags & (16 /* Optimistic */ | 32 /* FileLevel */)) !== 32 /* FileLevel */, "GeneratedIdentifierFlags.FileLevel cannot be set without also setting GeneratedIdentifierFlags.Optimistic"); return createBaseGeneratedIdentifier(text, 3 /* Unique */ | flags); @@ -21750,7 +21895,9 @@ var ts; /** Create a unique name generated for a node. */ // @api function getGeneratedNameForNode(node, flags) { - if (flags === void 0) { flags = 0; } + if (flags === void 0) { + flags = 0; + } ts.Debug.assert(!(flags & 7 /* KindMask */), "Argument out of range: flags"); var name = createBaseGeneratedIdentifier(node && ts.isIdentifier(node) ? ts.idText(node) : "", 4 /* Node */ | flags); name.original = node; @@ -22500,7 +22647,9 @@ var ts; } // @api function createImportTypeNode(argument, qualifier, typeArguments, isTypeOf) { - if (isTypeOf === void 0) { isTypeOf = false; } + if (isTypeOf === void 0) { + isTypeOf = false; + } var node = createBaseNode(199 /* ImportType */); node.argument = argument; node.qualifier = qualifier; @@ -22511,7 +22660,9 @@ var ts; } // @api function updateImportTypeNode(node, argument, qualifier, typeArguments, isTypeOf) { - if (isTypeOf === void 0) { isTypeOf = node.isTypeOf; } + if (isTypeOf === void 0) { + isTypeOf = node.isTypeOf; + } return node.argument !== argument || node.qualifier !== qualifier || node.typeArguments !== typeArguments @@ -23238,7 +23389,9 @@ var ts; : node; } function createTemplateLiteralLikeNodeChecked(kind, text, rawText, templateFlags) { - if (templateFlags === void 0) { templateFlags = 0 /* None */; } + if (templateFlags === void 0) { + templateFlags = 0 /* None */; + } ts.Debug.assert(!(templateFlags & ~2048 /* TemplateLiteralLikeFlags */), "Unsupported template flags."); // NOTE: without the assignment to `undefined`, we don't narrow the initial type of `cooked`. // eslint-disable-next-line no-undef-init @@ -23801,7 +23954,9 @@ var ts; } // @api function createVariableDeclarationList(declarations, flags) { - if (flags === void 0) { flags = 0 /* None */; } + if (flags === void 0) { + flags = 0 /* None */; + } var node = createBaseNode(254 /* VariableDeclarationList */); node.flags |= flags & 3 /* BlockScoped */; node.declarations = createNodeArray(declarations); @@ -23940,7 +24095,9 @@ var ts; } // @api function createModuleDeclaration(decorators, modifiers, name, body, flags) { - if (flags === void 0) { flags = 0 /* None */; } + if (flags === void 0) { + flags = 0 /* None */; + } var node = createBaseDeclaration(260 /* ModuleDeclaration */, decorators, modifiers); node.flags |= flags & (16 /* Namespace */ | 4 /* NestedNamespace */ | 1024 /* GlobalAugmentation */); node.name = name; @@ -24316,7 +24473,9 @@ var ts; } // @api function createJSDocTypeLiteral(propertyTags, isArrayType) { - if (isArrayType === void 0) { isArrayType = false; } + if (isArrayType === void 0) { + isArrayType = false; + } var node = createBaseNode(320 /* JSDocTypeLiteral */); node.jsDocPropertyTags = asNodeArray(propertyTags); node.isArrayType = isArrayType; @@ -24379,7 +24538,9 @@ var ts; } // @api function updateJSDocTemplateTag(node, tagName, constraint, typeParameters, comment) { - if (tagName === void 0) { tagName = getDefaultTagName(node); } + if (tagName === void 0) { + tagName = getDefaultTagName(node); + } return node.tagName !== tagName || node.constraint !== constraint || node.typeParameters !== typeParameters @@ -24397,7 +24558,9 @@ var ts; } // @api function updateJSDocTypedefTag(node, tagName, typeExpression, fullName, comment) { - if (tagName === void 0) { tagName = getDefaultTagName(node); } + if (tagName === void 0) { + tagName = getDefaultTagName(node); + } return node.tagName !== tagName || node.typeExpression !== typeExpression || node.fullName !== fullName @@ -24416,7 +24579,9 @@ var ts; } // @api function updateJSDocParameterTag(node, tagName, name, isBracketed, typeExpression, isNameFirst, comment) { - if (tagName === void 0) { tagName = getDefaultTagName(node); } + if (tagName === void 0) { + tagName = getDefaultTagName(node); + } return node.tagName !== tagName || node.name !== name || node.isBracketed !== isBracketed @@ -24437,7 +24602,9 @@ var ts; } // @api function updateJSDocPropertyTag(node, tagName, name, isBracketed, typeExpression, isNameFirst, comment) { - if (tagName === void 0) { tagName = getDefaultTagName(node); } + if (tagName === void 0) { + tagName = getDefaultTagName(node); + } return node.tagName !== tagName || node.name !== name || node.isBracketed !== isBracketed @@ -24457,7 +24624,9 @@ var ts; } // @api function updateJSDocCallbackTag(node, tagName, typeExpression, fullName, comment) { - if (tagName === void 0) { tagName = getDefaultTagName(node); } + if (tagName === void 0) { + tagName = getDefaultTagName(node); + } return node.tagName !== tagName || node.typeExpression !== typeExpression || node.fullName !== fullName @@ -24473,7 +24642,9 @@ var ts; } // @api function updateJSDocAugmentsTag(node, tagName, className, comment) { - if (tagName === void 0) { tagName = getDefaultTagName(node); } + if (tagName === void 0) { + tagName = getDefaultTagName(node); + } return node.tagName !== tagName || node.class !== className || node.comment !== comment @@ -24570,7 +24741,9 @@ var ts; } // @api function updateJSDocImplementsTag(node, tagName, className, comment) { - if (tagName === void 0) { tagName = getDefaultTagName(node); } + if (tagName === void 0) { + tagName = getDefaultTagName(node); + } return node.tagName !== tagName || node.class !== className || node.comment !== comment @@ -24598,7 +24771,9 @@ var ts; // updateJSDocReadonlyTag // updateJSDocDeprecatedTag function updateJSDocSimpleTagWorker(kind, node, tagName, comment) { - if (tagName === void 0) { tagName = getDefaultTagName(node); } + if (tagName === void 0) { + tagName = getDefaultTagName(node); + } return node.tagName !== tagName || node.comment !== comment ? update(createJSDocSimpleTagWorker(kind, tagName, comment), node) : @@ -24620,7 +24795,9 @@ var ts; // updateJSDocThisTag // updateJSDocEnumTag function updateJSDocTypeLikeTagWorker(kind, node, tagName, typeExpression, comment) { - if (tagName === void 0) { tagName = getDefaultTagName(node); } + if (tagName === void 0) { + tagName = getDefaultTagName(node); + } return node.tagName !== tagName || node.typeExpression !== typeExpression || node.comment !== comment @@ -25093,11 +25270,21 @@ var ts; } // @api function updateSourceFile(node, statements, isDeclarationFile, referencedFiles, typeReferenceDirectives, hasNoDefaultLib, libReferenceDirectives) { - if (isDeclarationFile === void 0) { isDeclarationFile = node.isDeclarationFile; } - if (referencedFiles === void 0) { referencedFiles = node.referencedFiles; } - if (typeReferenceDirectives === void 0) { typeReferenceDirectives = node.typeReferenceDirectives; } - if (hasNoDefaultLib === void 0) { hasNoDefaultLib = node.hasNoDefaultLib; } - if (libReferenceDirectives === void 0) { libReferenceDirectives = node.libReferenceDirectives; } + if (isDeclarationFile === void 0) { + isDeclarationFile = node.isDeclarationFile; + } + if (referencedFiles === void 0) { + referencedFiles = node.referencedFiles; + } + if (typeReferenceDirectives === void 0) { + typeReferenceDirectives = node.typeReferenceDirectives; + } + if (hasNoDefaultLib === void 0) { + hasNoDefaultLib = node.hasNoDefaultLib; + } + if (libReferenceDirectives === void 0) { + libReferenceDirectives = node.libReferenceDirectives; + } return node.statements !== statements || node.isDeclarationFile !== isDeclarationFile || node.referencedFiles !== referencedFiles @@ -25109,7 +25296,9 @@ var ts; } // @api function createBundle(sourceFiles, prepends) { - if (prepends === void 0) { prepends = ts.emptyArray; } + if (prepends === void 0) { + prepends = ts.emptyArray; + } var node = createBaseNode(304 /* Bundle */); node.prepends = prepends; node.sourceFiles = sourceFiles; @@ -25117,7 +25306,9 @@ var ts; } // @api function updateBundle(node, sourceFiles, prepends) { - if (prepends === void 0) { prepends = ts.emptyArray; } + if (prepends === void 0) { + prepends = ts.emptyArray; + } return node.sourceFiles !== sourceFiles || node.prepends !== prepends ? update(createBundle(sourceFiles, prepends), node) @@ -25174,7 +25365,9 @@ var ts; // // @api function createSyntheticExpression(type, isSpread, tupleNameSource) { - if (isSpread === void 0) { isSpread = false; } + if (isSpread === void 0) { + isSpread = false; + } var node = createBaseNode(231 /* SyntheticExpression */); node.type = type; node.isSpread = isSpread; @@ -25446,7 +25639,9 @@ var ts; && !ts.some(ts.getSyntheticTrailingComments(node)); } function restoreOuterExpressions(outerExpression, innerExpression, kinds) { - if (kinds === void 0) { kinds = 15 /* All */; } + if (kinds === void 0) { + kinds = 15 /* All */; + } if (outerExpression && ts.isOuterExpression(outerExpression, kinds) && !isIgnorableParen(outerExpression)) { return updateOuterExpression(outerExpression, restoreOuterExpressions(outerExpression.expression, innerExpression)); } @@ -25487,7 +25682,9 @@ var ts; } } function createCallBinding(expression, recordTempVariable, languageVersion, cacheIdentifiers) { - if (cacheIdentifiers === void 0) { cacheIdentifiers = false; } + if (cacheIdentifiers === void 0) { + cacheIdentifiers = false; + } var callee = ts.skipOuterExpressions(expression, 15 /* All */); var thisArg; var target; @@ -25561,7 +25758,9 @@ var ts; : ts.reduceLeft(expressions, factory.createComma); } function getName(node, allowComments, allowSourceMaps, emitFlags) { - if (emitFlags === void 0) { emitFlags = 0; } + if (emitFlags === void 0) { + emitFlags = 0; + } var nodeName = ts.getNameOfDeclaration(node); if (nodeName && ts.isIdentifier(nodeName) && !ts.isGeneratedIdentifier(nodeName)) { // TODO(rbuckton): Does this need to be parented? @@ -25711,7 +25910,9 @@ var ts; return statementOffset; } function copyCustomPrologue(source, target, statementOffset, visitor, filter) { - if (filter === void 0) { filter = ts.returnTrue; } + if (filter === void 0) { + filter = ts.returnTrue; + } var numStatements = source.length; while (statementOffset !== undefined && statementOffset < numStatements) { var statement = source[statementOffset]; @@ -26863,7 +27064,9 @@ var ts; /*typeArguments*/ undefined, [expression]); } function createExportStarHelper(moduleExpression, exportsExpression) { - if (exportsExpression === void 0) { exportsExpression = factory.createIdentifier("exports"); } + if (exportsExpression === void 0) { + exportsExpression = factory.createIdentifier("exports"); + } context.requestEmitHelper(ts.exportStarHelper); context.requestEmitHelper(ts.createBindingHelper); return factory.createCallExpression(getUnscopedHelperName("__exportStar"), @@ -28565,7 +28768,9 @@ var ts; } ts.getJSDocTypeAssertionType = getJSDocTypeAssertionType; function isOuterExpression(node, kinds) { - if (kinds === void 0) { kinds = 15 /* All */; } + if (kinds === void 0) { + kinds = 15 /* All */; + } switch (node.kind) { case 211 /* ParenthesizedExpression */: if (kinds & 16 /* ExcludeJSDocTypeAssertion */ && isJSDocTypeAssertion(node)) { @@ -28584,7 +28789,9 @@ var ts; } ts.isOuterExpression = isOuterExpression; function skipOuterExpressions(node, kinds) { - if (kinds === void 0) { kinds = 15 /* All */; } + if (kinds === void 0) { + kinds = 15 /* All */; + } while (isOuterExpression(node, kinds)) { node = node.expression; } @@ -28633,9 +28840,11 @@ var ts; helperNames.sort(ts.compareStringsCaseSensitive); // Alias the imports if the names are used somewhere in the file. // NOTE: We don't need to care about global import collisions as this is a module. - namedBindings = nodeFactory.createNamedImports(ts.map(helperNames, function (name) { return ts.isFileLevelUniqueName(sourceFile, name) - ? nodeFactory.createImportSpecifier(/*isTypeOnly*/ false, /*propertyName*/ undefined, nodeFactory.createIdentifier(name)) - : nodeFactory.createImportSpecifier(/*isTypeOnly*/ false, nodeFactory.createIdentifier(name), helperFactory.getUnscopedHelperName(name)); })); + namedBindings = nodeFactory.createNamedImports(ts.map(helperNames, function (name) { + return ts.isFileLevelUniqueName(sourceFile, name) + ? nodeFactory.createImportSpecifier(/*isTypeOnly*/ false, /*propertyName*/ undefined, nodeFactory.createIdentifier(name)) + : nodeFactory.createImportSpecifier(/*isTypeOnly*/ false, nodeFactory.createIdentifier(name), helperFactory.getUnscopedHelperName(name)); + })); var parseNode = ts.getOriginalNode(sourceFile, ts.isSourceFile); var emitNode = ts.getOrCreateEmitNode(parseNode); emitNode.externalHelpers = true; @@ -29905,7 +30114,9 @@ var ts; } } function createSourceFile(fileName, sourceText, languageVersion, setParentNodes, scriptKind) { - if (setParentNodes === void 0) { setParentNodes = false; } + if (setParentNodes === void 0) { + setParentNodes = false; + } ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("parse" /* Parse */, "createSourceFile", { path: fileName }, /*separateBeginAndEnd*/ true); ts.performance.mark("beforeParse"); var result; @@ -29951,7 +30162,9 @@ var ts; // becoming detached from any SourceFile). It is recommended that this SourceFile not // be used once 'update' is called on it. function updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks) { - if (aggressiveChecks === void 0) { aggressiveChecks = false; } + if (aggressiveChecks === void 0) { + aggressiveChecks = false; + } var newSourceFile = IncrementalParser.updateSourceFile(sourceFile, newText, textChangeRange, aggressiveChecks); // Because new source file node is created, it may not have the flag PossiblyContainDynamicImport. This is the case if there is no new edit to add dynamic import. // We will manually port the flag to the new source file. @@ -30102,7 +30315,9 @@ var ts; var parseErrorBeforeNextFinishedNode = false; function parseSourceFile(fileName, sourceText, languageVersion, syntaxCursor, setParentNodes, scriptKind) { var _a; - if (setParentNodes === void 0) { setParentNodes = false; } + if (setParentNodes === void 0) { + setParentNodes = false; + } scriptKind = ts.ensureScriptKind(fileName, scriptKind); if (scriptKind === 6 /* JSON */) { var result_3 = parseJsonText(fileName, sourceText, languageVersion, syntaxCursor, setParentNodes); @@ -30133,8 +30348,12 @@ var ts; } Parser.parseIsolatedEntityName = parseIsolatedEntityName; function parseJsonText(fileName, sourceText, languageVersion, syntaxCursor, setParentNodes) { - if (languageVersion === void 0) { languageVersion = 2 /* ES2015 */; } - if (setParentNodes === void 0) { setParentNodes = false; } + if (languageVersion === void 0) { + languageVersion = 2 /* ES2015 */; + } + if (setParentNodes === void 0) { + setParentNodes = false; + } initializeState(fileName, sourceText, languageVersion, syntaxCursor, 6 /* JSON */); sourceFlags = contextFlags; // Prime the scanner. @@ -30690,7 +30909,9 @@ var ts; return token() > 116 /* LastReservedWord */; } function parseExpected(kind, diagnosticMessage, shouldAdvance) { - if (shouldAdvance === void 0) { shouldAdvance = true; } + if (shouldAdvance === void 0) { + shouldAdvance = true; + } if (token() === kind) { if (shouldAdvance) { nextToken(); @@ -36049,7 +36270,9 @@ var ts; PropertyLikeParse[PropertyLikeParse["CallbackParameter"] = 4] = "CallbackParameter"; })(PropertyLikeParse || (PropertyLikeParse = {})); function parseJSDocCommentWorker(start, length) { - if (start === void 0) { start = 0; } + if (start === void 0) { + start = 0; + } var content = sourceText; var end = length === undefined ? content.length : start + length; length = end - start; @@ -39021,7 +39244,9 @@ var ts; ts.parseCustomTypeOption = parseCustomTypeOption; /* @internal */ function parseListTypeOption(opt, value, errors) { - if (value === void 0) { value = ""; } + if (value === void 0) { + value = ""; + } value = ts.trimString(value); if (ts.startsWith(value, "-")) { return undefined; @@ -39219,7 +39444,9 @@ var ts; } ts.getOptionFromName = getOptionFromName; function getOptionDeclarationFromName(getOptionNameMap, optionName, allowShort) { - if (allowShort === void 0) { allowShort = false; } + if (allowShort === void 0) { + allowShort = false; + } optionName = optionName.toLowerCase(); var _a = getOptionNameMap(), optionsNameMap = _a.optionsNameMap, shortOptionNames = _a.shortOptionNames; // Try to translate short option names to their full equivalents. @@ -39982,9 +40209,15 @@ var ts; * @param resolutionStack Only present for backwards-compatibility. Should be empty. */ function parseJsonConfigFileContentWorker(json, sourceFile, host, basePath, existingOptions, existingWatchOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache) { - if (existingOptions === void 0) { existingOptions = {}; } - if (resolutionStack === void 0) { resolutionStack = []; } - if (extraFileExtensions === void 0) { extraFileExtensions = []; } + if (existingOptions === void 0) { + existingOptions = {}; + } + if (resolutionStack === void 0) { + resolutionStack = []; + } + if (extraFileExtensions === void 0) { + extraFileExtensions = []; + } ts.Debug.assert((json === undefined && sourceFile !== undefined) || (json !== undefined && sourceFile === undefined)); var errors = []; var parsedConfig = parseConfig(json, sourceFile, host, basePath, configFileName, resolutionStack, errors, extendedConfigCache); @@ -40506,7 +40739,9 @@ var ts; */ /* @internal */ function getFileNamesFromConfigSpecs(configFileSpecs, basePath, options, host, extraFileExtensions) { - if (extraFileExtensions === void 0) { extraFileExtensions = ts.emptyArray; } + if (extraFileExtensions === void 0) { + extraFileExtensions = ts.emptyArray; + } basePath = ts.normalizePath(basePath); var keyMapper = ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames); // Literal file names (provided via the "files" array in tsconfig.json) are stored in a @@ -42055,7 +42290,9 @@ var ts; return undefined; } function loadNodeModuleFromDirectory(extensions, candidate, onlyRecordFailures, state, considerPackageJson) { - if (considerPackageJson === void 0) { considerPackageJson = true; } + if (considerPackageJson === void 0) { + considerPackageJson = true; + } var packageInfo = considerPackageJson ? getPackageJsonInfo(candidate, onlyRecordFailures, state) : undefined; var packageJsonContent = packageInfo && packageInfo.packageJsonContent; var versionPaths = packageInfo && packageInfo.versionPaths; @@ -42694,7 +42931,9 @@ var ts; } ts.getModuleInstanceState = getModuleInstanceState; function getModuleInstanceStateCached(node, visited) { - if (visited === void 0) { visited = new ts.Map(); } + if (visited === void 0) { + visited = new ts.Map(); + } var nodeId = ts.getNodeId(node); if (visited.has(nodeId)) { return visited.get(nodeId) || 0 /* NonInstantiated */; @@ -43346,7 +43585,9 @@ var ts; bindEach(nodes, function (n) { return n.kind !== 255 /* FunctionDeclaration */ ? bind(n) : undefined; }); } function bindEach(nodes, bindFunction) { - if (bindFunction === void 0) { bindFunction = bind; } + if (bindFunction === void 0) { + bindFunction = bind; + } if (nodes === undefined) { return; } @@ -45618,7 +45859,9 @@ var ts; return expr.parent; } function lookupSymbolForPropertyAccess(node, lookupContainer) { - if (lookupContainer === void 0) { lookupContainer = container; } + if (lookupContainer === void 0) { + lookupContainer = container; + } if (ts.isIdentifier(node)) { return lookupSymbolForName(lookupContainer, node.escapedText); } @@ -45923,7 +46166,9 @@ var ts; function createGetSymbolWalker(getRestTypeOfSignature, getTypePredicateOfSignature, getReturnTypeOfSignature, getBaseTypes, resolveStructuredTypeMembers, getTypeOfSymbol, getResolvedSymbol, getConstraintOfTypeParameter, getFirstIdentifier, getTypeArguments) { return getSymbolWalker; function getSymbolWalker(accept) { - if (accept === void 0) { accept = function () { return true; }; } + if (accept === void 0) { + accept = function () { return true; }; + } var visitedTypes = []; // Sparse array from id to type var visitedSymbols = []; // Sparse array from id to symbol return { @@ -46440,12 +46685,14 @@ var ts; getSymbolCount: function () { return ts.sum(host.getSourceFiles(), "symbolCount") + symbolCount; }, getTypeCount: function () { return typeCount; }, getInstantiationCount: function () { return totalInstantiationCount; }, - getRelationCacheSizes: function () { return ({ - assignable: assignableRelation.size, - identity: identityRelation.size, - subtype: subtypeRelation.size, - strictSubtype: strictSubtypeRelation.size, - }); }, + getRelationCacheSizes: function () { + return ({ + assignable: assignableRelation.size, + identity: identityRelation.size, + subtype: subtypeRelation.size, + strictSubtype: strictSubtypeRelation.size, + }); + }, isUndefinedSymbol: function (symbol) { return symbol === undefinedSymbol; }, isArgumentsSymbol: function (symbol) { return symbol === argumentsSymbol; }, isUnknownSymbol: function (symbol) { return symbol === unknownSymbol; }, @@ -47242,7 +47489,9 @@ var ts; * If target is not transient, mergeSymbol will produce a transient clone, mutate that and return it. */ function mergeSymbol(target, source, unidirectional) { - if (unidirectional === void 0) { unidirectional = false; } + if (unidirectional === void 0) { + unidirectional = false; + } if (!(target.flags & getExcludedSymbolFlags(source.flags)) || (source.flags | target.flags) & 67108864 /* Assignment */) { if (source === target) { @@ -47363,7 +47612,9 @@ var ts; return combined; } function mergeSymbolTable(target, source, unidirectional) { - if (unidirectional === void 0) { unidirectional = false; } + if (unidirectional === void 0) { + unidirectional = false; + } source.forEach(function (sourceSymbol, id) { var targetSymbol = target.get(id); target.set(id, targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol, unidirectional) : sourceSymbol); @@ -47739,8 +47990,12 @@ var ts; * @param isUse If true, this will count towards --noUnusedLocals / --noUnusedParameters. */ function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggstions) { - if (excludeGlobals === void 0) { excludeGlobals = false; } - if (getSpellingSuggstions === void 0) { getSpellingSuggstions = true; } + if (excludeGlobals === void 0) { + excludeGlobals = false; + } + if (getSpellingSuggstions === void 0) { + getSpellingSuggstions = true; + } return resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggstions, getSymbol); } function resolveNameHelper(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, getSpellingSuggestions, lookup) { @@ -48694,7 +48949,9 @@ var ts; } function getExternalModuleMember(node, specifier, dontResolveAlias) { var _a, _b; - if (dontResolveAlias === void 0) { dontResolveAlias = false; } + if (dontResolveAlias === void 0) { + dontResolveAlias = false; + } var moduleSpecifier = ts.getExternalModuleRequireArgument(node) || node.moduleSpecifier; var moduleSymbol = resolveExternalModuleName(node, moduleSpecifier); // TODO: GH#18217 var name = !ts.isPropertyAccessExpression(specifier) && specifier.propertyName || specifier.name; @@ -48855,7 +49112,9 @@ var ts; return getTargetOfAliasLikeExpression(node.parent.right, dontRecursivelyResolve); } function getTargetOfAliasDeclaration(node, dontRecursivelyResolve) { - if (dontRecursivelyResolve === void 0) { dontRecursivelyResolve = false; } + if (dontRecursivelyResolve === void 0) { + dontRecursivelyResolve = false; + } switch (node.kind) { case 264 /* ImportEqualsDeclaration */: case 253 /* VariableDeclaration */: @@ -48892,7 +49151,9 @@ var ts; * OR Is a JSContainer which may merge an alias with a local declaration */ function isNonLocalAlias(symbol, excludes) { - if (excludes === void 0) { excludes = 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */; } + if (excludes === void 0) { + excludes = 111551 /* Value */ | 788968 /* Type */ | 1920 /* Namespace */; + } if (!symbol) return false; return (symbol.flags & (2097152 /* Alias */ | excludes)) === 2097152 /* Alias */ || !!(symbol.flags & 2097152 /* Alias */ && symbol.flags & 67108864 /* Assignment */); @@ -49232,14 +49493,18 @@ var ts; return resolveExternalModuleNameWorker(location, moduleReferenceExpression, ignoreErrors ? undefined : errorMessage); } function resolveExternalModuleNameWorker(location, moduleReferenceExpression, moduleNotFoundError, isForAugmentation) { - if (isForAugmentation === void 0) { isForAugmentation = false; } + if (isForAugmentation === void 0) { + isForAugmentation = false; + } return ts.isStringLiteralLike(moduleReferenceExpression) ? resolveExternalModule(location, moduleReferenceExpression.text, moduleNotFoundError, moduleReferenceExpression, isForAugmentation) : undefined; } function resolveExternalModule(location, moduleReference, moduleNotFoundError, errorNode, isForAugmentation) { var _a, _b, _c, _d, _e, _f, _g; - if (isForAugmentation === void 0) { isForAugmentation = false; } + if (isForAugmentation === void 0) { + isForAugmentation = false; + } if (ts.startsWith(moduleReference, "@types/")) { var diag = ts.Diagnostics.Cannot_import_type_declaration_files_Consider_importing_0_instead_of_1; var withoutAtTypePrefix = ts.removePrefix(moduleReference, "@types/"); @@ -49795,7 +50060,9 @@ var ts; return new Type(checker, flags); } function createIntrinsicType(kind, intrinsicName, objectFlags) { - if (objectFlags === void 0) { objectFlags = 0; } + if (objectFlags === void 0) { + objectFlags = 0; + } var type = createType(kind); type.intrinsicName = intrinsicName; type.objectFlags = objectFlags; @@ -49936,7 +50203,9 @@ var ts; return rightMeaning === 111551 /* Value */ ? 111551 /* Value */ : 1920 /* Namespace */; } function getAccessibleSymbolChain(symbol, enclosingDeclaration, meaning, useOnlyExternalAliasing, visitedSymbolTablesMap) { - if (visitedSymbolTablesMap === void 0) { visitedSymbolTablesMap = new ts.Map(); } + if (visitedSymbolTablesMap === void 0) { + visitedSymbolTablesMap = new ts.Map(); + } if (!(symbol && !isPropertyOrMethodDeclarationSymbol(symbol))) { return undefined; } @@ -50278,7 +50547,9 @@ var ts; }; } function symbolToString(symbol, enclosingDeclaration, meaning, flags, writer) { - if (flags === void 0) { flags = 4 /* AllowAnyNodeKind */; } + if (flags === void 0) { + flags = 4 /* AllowAnyNodeKind */; + } var nodeFlags = 70221824 /* IgnoreErrors */; if (flags & 2 /* UseOnlyExternalAliasing */) { nodeFlags |= 128 /* UseOnlyExternalAliasing */; @@ -50304,7 +50575,9 @@ var ts; } } function signatureToString(signature, enclosingDeclaration, flags, kind, writer) { - if (flags === void 0) { flags = 0 /* None */; } + if (flags === void 0) { + flags = 0 /* None */; + } return writer ? signatureToStringWorker(writer).getText() : ts.usingSingleLineStringWriter(signatureToStringWorker); function signatureToStringWorker(writer) { var sigOutput; @@ -50322,8 +50595,12 @@ var ts; } } function typeToString(type, enclosingDeclaration, flags, writer) { - if (flags === void 0) { flags = 1048576 /* AllowUniqueESSymbolType */ | 16384 /* UseAliasDefinedOutsideCurrentScope */; } - if (writer === void 0) { writer = ts.createTextWriter(""); } + if (flags === void 0) { + flags = 1048576 /* AllowUniqueESSymbolType */ | 16384 /* UseAliasDefinedOutsideCurrentScope */; + } + if (writer === void 0) { + writer = ts.createTextWriter(""); + } var noTruncation = compilerOptions.noErrorTruncation || flags & 1 /* NoTruncation */; var typeNode = nodeBuilder.typeToTypeNode(type, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* IgnoreErrors */ | (noTruncation ? 1 /* NoTruncation */ : 0), writer); if (typeNode === undefined) @@ -50357,7 +50634,9 @@ var ts; return symbol && !!symbol.valueDeclaration && ts.isExpression(symbol.valueDeclaration) && !isContextSensitive(symbol.valueDeclaration); } function toNodeBuilderFlags(flags) { - if (flags === void 0) { flags = 0 /* None */; } + if (flags === void 0) { + flags = 0 /* None */; + } return flags & 814775659 /* NodeBuilderFlagsMask */; } function isClassInstanceSide(type) { @@ -51334,7 +51613,9 @@ var ts; return ts.factory.createTypeParameterDeclaration(name, constraintNode, defaultParameterNode); } function typeParameterToDeclaration(type, context, constraint) { - if (constraint === void 0) { constraint = getConstraintOfTypeParameter(type); } + if (constraint === void 0) { + constraint = getConstraintOfTypeParameter(type); + } var constraintNode = constraint && typeToTypeNodeHelper(constraint, context); return typeParameterToDeclarationWithConstraint(type, context, constraintNode); } @@ -51978,16 +52259,20 @@ var ts; if (ts.isJSDocFunctionType(node)) { if (ts.isJSDocConstructSignature(node)) { var newTypeNode_1; - return ts.factory.createConstructorTypeNode(node.modifiers, ts.visitNodes(node.typeParameters, visitExistingNodeTreeSymbols), ts.mapDefined(node.parameters, function (p, i) { return p.name && ts.isIdentifier(p.name) && p.name.escapedText === "new" ? (newTypeNode_1 = p.type, undefined) : ts.factory.createParameterDeclaration( - /*decorators*/ undefined, - /*modifiers*/ undefined, getEffectiveDotDotDotForParameter(p), getNameForJSDocFunctionParameter(p, i), p.questionToken, ts.visitNode(p.type, visitExistingNodeTreeSymbols), - /*initializer*/ undefined); }), ts.visitNode(newTypeNode_1 || node.type, visitExistingNodeTreeSymbols) || ts.factory.createKeywordTypeNode(130 /* AnyKeyword */)); + return ts.factory.createConstructorTypeNode(node.modifiers, ts.visitNodes(node.typeParameters, visitExistingNodeTreeSymbols), ts.mapDefined(node.parameters, function (p, i) { + return p.name && ts.isIdentifier(p.name) && p.name.escapedText === "new" ? (newTypeNode_1 = p.type, undefined) : ts.factory.createParameterDeclaration( + /*decorators*/ undefined, + /*modifiers*/ undefined, getEffectiveDotDotDotForParameter(p), getNameForJSDocFunctionParameter(p, i), p.questionToken, ts.visitNode(p.type, visitExistingNodeTreeSymbols), + /*initializer*/ undefined); + }), ts.visitNode(newTypeNode_1 || node.type, visitExistingNodeTreeSymbols) || ts.factory.createKeywordTypeNode(130 /* AnyKeyword */)); } else { - return ts.factory.createFunctionTypeNode(ts.visitNodes(node.typeParameters, visitExistingNodeTreeSymbols), ts.map(node.parameters, function (p, i) { return ts.factory.createParameterDeclaration( - /*decorators*/ undefined, - /*modifiers*/ undefined, getEffectiveDotDotDotForParameter(p), getNameForJSDocFunctionParameter(p, i), p.questionToken, ts.visitNode(p.type, visitExistingNodeTreeSymbols), - /*initializer*/ undefined); }), ts.visitNode(node.type, visitExistingNodeTreeSymbols) || ts.factory.createKeywordTypeNode(130 /* AnyKeyword */)); + return ts.factory.createFunctionTypeNode(ts.visitNodes(node.typeParameters, visitExistingNodeTreeSymbols), ts.map(node.parameters, function (p, i) { + return ts.factory.createParameterDeclaration( + /*decorators*/ undefined, + /*modifiers*/ undefined, getEffectiveDotDotDotForParameter(p), getNameForJSDocFunctionParameter(p, i), p.questionToken, ts.visitNode(p.type, visitExistingNodeTreeSymbols), + /*initializer*/ undefined); + }), ts.visitNode(node.type, visitExistingNodeTreeSymbols) || ts.factory.createKeywordTypeNode(130 /* AnyKeyword */)); } } if (ts.isTypeReferenceNode(node) && ts.isInJSDoc(node) && (!existingTypeNodeIsNotReferenceOrIsReferenceWithCompatibleTypeArgumentCount(node, getTypeFromTypeNode(node)) || getIntendedTypeFromJSDocTypeReference(node) || unknownSymbol === resolveTypeReferenceName(node, 788968 /* Type */, /*ignoreErrors*/ true))) { @@ -52649,10 +52934,12 @@ var ts; var declarations = results; results = oldResults; // replace namespace with synthetic version - var defaultReplaced = ts.map(declarations, function (d) { return ts.isExportAssignment(d) && !d.isExportEquals && ts.isIdentifier(d.expression) ? ts.factory.createExportDeclaration( - /*decorators*/ undefined, - /*modifiers*/ undefined, - /*isTypeOnly*/ false, ts.factory.createNamedExports([ts.factory.createExportSpecifier(/*isTypeOnly*/ false, d.expression, ts.factory.createIdentifier("default" /* Default */))])) : d; }); + var defaultReplaced = ts.map(declarations, function (d) { + return ts.isExportAssignment(d) && !d.isExportEquals && ts.isIdentifier(d.expression) ? ts.factory.createExportDeclaration( + /*decorators*/ undefined, + /*modifiers*/ undefined, + /*isTypeOnly*/ false, ts.factory.createNamedExports([ts.factory.createExportSpecifier(/*isTypeOnly*/ false, d.expression, ts.factory.createIdentifier("default" /* Default */))])) : d; + }); var exportModifierStripped = ts.every(defaultReplaced, function (d) { return ts.hasSyntacticModifier(d, 1 /* Export */); }) ? ts.map(defaultReplaced, removeExportModifier) : defaultReplaced; fakespace = ts.factory.updateModuleDeclaration(fakespace, fakespace.decorators, fakespace.modifiers, fakespace.name, ts.factory.createModuleBlock(exportModifierStripped)); addResult(fakespace, modifierFlags); // namespaces can never be default exported @@ -53269,7 +53556,9 @@ var ts; } } function typePredicateToString(typePredicate, enclosingDeclaration, flags, writer) { - if (flags === void 0) { flags = 16384 /* UseAliasDefinedOutsideCurrentScope */; } + if (flags === void 0) { + flags = 16384 /* UseAliasDefinedOutsideCurrentScope */; + } return writer ? typePredicateToStringWorker(writer).getText() : ts.usingSingleLineStringWriter(typePredicateToStringWorker); function typePredicateToStringWorker(writer) { var predicate = ts.factory.createTypePredicateNode(typePredicate.kind === 2 /* AssertsThis */ || typePredicate.kind === 3 /* AssertsIdentifier */ ? ts.factory.createToken(128 /* AssertsKeyword */) : undefined, typePredicate.kind === 1 /* Identifier */ || typePredicate.kind === 3 /* AssertsIdentifier */ ? ts.factory.createIdentifier(typePredicate.parameterName) : ts.factory.createThisTypeNode(), typePredicate.type && nodeBuilder.typeToTypeNode(typePredicate.type, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* IgnoreErrors */ | 512 /* WriteTypeParametersInQualifiedName */) // TODO: GH#18217 @@ -53843,8 +54132,12 @@ var ts; return expr.kind === 203 /* ArrayLiteralExpression */ && expr.elements.length === 0; } function addOptionality(type, isProperty, isOptional) { - if (isProperty === void 0) { isProperty = false; } - if (isOptional === void 0) { isOptional = true; } + if (isProperty === void 0) { + isProperty = false; + } + if (isOptional === void 0) { + isOptional = true; + } return strictNullChecks && isOptional ? getOptionalType(type, isProperty) : type; } // Return the inferred type for a variable, parameter, or property declaration @@ -54374,8 +54667,12 @@ var ts; // parameter with no type annotation or initializer, the type implied by the binding pattern becomes the type of // the parameter. function getTypeFromBindingPattern(pattern, includePatternInType, reportErrors) { - if (includePatternInType === void 0) { includePatternInType = false; } - if (reportErrors === void 0) { reportErrors = false; } + if (includePatternInType === void 0) { + includePatternInType = false; + } + if (reportErrors === void 0) { + reportErrors = false; + } return pattern.kind === 200 /* ObjectBindingPattern */ ? getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors) : getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors); @@ -54601,7 +54898,9 @@ var ts; return links.writeType || (links.writeType = getTypeOfAccessorsWorker(symbol, /*writing*/ true)); } function getTypeOfAccessorsWorker(symbol, writing) { - if (writing === void 0) { writing = false; } + if (writing === void 0) { + writing = false; + } if (!pushTypeResolution(symbol, 0 /* Type */)) { return errorType; } @@ -54616,7 +54915,9 @@ var ts; return type; } function resolveTypeOfAccessors(symbol, writing) { - if (writing === void 0) { writing = false; } + if (writing === void 0) { + writing = false; + } var getter = ts.getDeclarationOfKind(symbol, 171 /* GetAccessor */); var setter = ts.getDeclarationOfKind(symbol, 172 /* SetAccessor */); var setterType = getAnnotatedAccessorType(setter); @@ -56341,9 +56642,11 @@ var ts; var classType_1 = getDeclaredTypeOfClassOrInterface(symbol); var constructSignatures = symbol.members ? getSignaturesOfSymbol(symbol.members.get("__constructor" /* Constructor */)) : ts.emptyArray; if (symbol.flags & 16 /* Function */) { - constructSignatures = ts.addRange(constructSignatures.slice(), ts.mapDefined(type.callSignatures, function (sig) { return isJSConstructor(sig.declaration) ? - createSignature(sig.declaration, sig.typeParameters, sig.thisParameter, sig.parameters, classType_1, /*resolvedTypePredicate*/ undefined, sig.minArgumentCount, sig.flags & 39 /* PropagatingFlags */) : - undefined; })); + constructSignatures = ts.addRange(constructSignatures.slice(), ts.mapDefined(type.callSignatures, function (sig) { + return isJSConstructor(sig.declaration) ? + createSignature(sig.declaration, sig.typeParameters, sig.thisParameter, sig.parameters, classType_1, /*resolvedTypePredicate*/ undefined, sig.minArgumentCount, sig.flags & 39 /* PropagatingFlags */) : + undefined; + })); } if (!constructSignatures.length) { constructSignatures = getDefaultConstructSignatures(classType_1); @@ -58598,7 +58901,9 @@ var ts; return (deferredGlobalIteratorReturnResultType || (deferredGlobalIteratorReturnResultType = getGlobalType("IteratorReturnResult", /*arity*/ 1, reportErrors))) || emptyGenericType; } function getGlobalTypeOrUndefined(name, arity) { - if (arity === void 0) { arity = 0; } + if (arity === void 0) { + arity = 0; + } var symbol = getGlobalSymbol(name, 788968 /* Type */, /*diagnostic*/ undefined); return symbol && getTypeOfGlobalSymbol(symbol, arity); } @@ -58744,7 +59049,9 @@ var ts; return ts.isTypeOperatorNode(node) && node.operator === 144 /* ReadonlyKeyword */; } function createTupleType(elementTypes, elementFlags, readonly, namedMemberDeclarations) { - if (readonly === void 0) { readonly = false; } + if (readonly === void 0) { + readonly = false; + } var tupleTarget = getTupleTargetType(elementFlags || ts.map(elementTypes, function (_) { return 1 /* Required */; }), readonly, namedMemberDeclarations); return tupleTarget === emptyGenericType ? emptyObjectType : elementTypes.length ? createNormalizedTypeReference(tupleTarget, elementTypes) : @@ -58927,7 +59234,9 @@ var ts; } } function sliceTupleType(type, index, endSkipCount) { - if (endSkipCount === void 0) { endSkipCount = 0; } + if (endSkipCount === void 0) { + endSkipCount = 0; + } var target = type.target; var endIndex = getTypeReferenceArity(type) - endSkipCount; return index > target.fixedLength ? getRestArrayTypeOfTupleType(type) || createTupleType(ts.emptyArray) : @@ -59120,7 +59429,9 @@ var ts; // circularly reference themselves and therefore cannot be subtype reduced during their declaration. // For example, "type Item = string | (() => Item" is a named type that circularly references itself. function getUnionType(types, unionReduction, aliasSymbol, aliasTypeArguments, origin) { - if (unionReduction === void 0) { unionReduction = 1 /* Literal */; } + if (unionReduction === void 0) { + unionReduction = 1 /* Literal */; + } if (types.length === 0) { return neverType; } @@ -59679,13 +59990,17 @@ var ts; function getLiteralTypeFromProperties(type, include, includeOrigin) { var origin = includeOrigin && (ts.getObjectFlags(type) & (3 /* ClassOrInterface */ | 4 /* Reference */) || type.aliasSymbol) ? createOriginIndexType(type) : undefined; var propertyTypes = ts.map(getPropertiesOfType(type), function (prop) { return getLiteralTypeFromProperty(prop, include); }); - var indexKeyTypes = ts.map(getIndexInfosOfType(type), function (info) { return info !== enumNumberIndexInfo && isKeyTypeIncluded(info.keyType, include) ? - info.keyType === stringType && include & 8 /* Number */ ? stringOrNumberType : info.keyType : neverType; }); + var indexKeyTypes = ts.map(getIndexInfosOfType(type), function (info) { + return info !== enumNumberIndexInfo && isKeyTypeIncluded(info.keyType, include) ? + info.keyType === stringType && include & 8 /* Number */ ? stringOrNumberType : info.keyType : neverType; + }); return getUnionType(ts.concatenate(propertyTypes, indexKeyTypes), 1 /* Literal */, /*aliasSymbol*/ undefined, /*aliasTypeArguments*/ undefined, origin); } function getIndexType(type, stringsOnly, noIndexSignatures) { - if (stringsOnly === void 0) { stringsOnly = keyofStringsOnly; } + if (stringsOnly === void 0) { + stringsOnly = keyofStringsOnly; + } type = getReducedType(type); return type.flags & 1048576 /* Union */ ? getIntersectionType(ts.map(type.types, function (t) { return getIndexType(t, stringsOnly, noIndexSignatures); })) : type.flags & 2097152 /* Intersection */ ? getUnionType(ts.map(type.types, function (t) { return getIndexType(t, stringsOnly, noIndexSignatures); })) : @@ -60199,7 +60514,9 @@ var ts; return instantiateType(getTemplateTypeFromMappedType(objectType), templateMapper); } function getIndexedAccessType(objectType, indexType, accessFlags, accessNode, aliasSymbol, aliasTypeArguments) { - if (accessFlags === void 0) { accessFlags = 0 /* None */; } + if (accessFlags === void 0) { + accessFlags = 0 /* None */; + } return getIndexedAccessTypeOrUndefined(objectType, indexType, accessFlags, accessNode, aliasSymbol, aliasTypeArguments) || (accessNode ? errorType : unknownType); } function indexTypeLessThan(indexType, limit) { @@ -60215,7 +60532,9 @@ var ts; }); } function getIndexedAccessTypeOrUndefined(objectType, indexType, accessFlags, accessNode, aliasSymbol, aliasTypeArguments) { - if (accessFlags === void 0) { accessFlags = 0 /* None */; } + if (accessFlags === void 0) { + accessFlags = 0 /* None */; + } if (objectType === wildcardType || indexType === wildcardType) { return wildcardType; } @@ -61834,7 +62153,8 @@ var ts; _i = 0, _a = node.properties; _b.label = 1; case 1: - if (!(_i < _a.length)) return [3 /*break*/, 4]; + if (!(_i < _a.length)) + return [3 /*break*/, 4]; prop = _a[_i]; if (ts.isJsxSpreadAttribute(prop) || isHyphenatedJsxName(ts.idText(prop.name))) return [3 /*break*/, 3]; @@ -61860,11 +62180,13 @@ var ts; i = 0; _a.label = 1; case 1: - if (!(i < node.children.length)) return [3 /*break*/, 5]; + if (!(i < node.children.length)) + return [3 /*break*/, 5]; child = node.children[i]; nameType = getNumberLiteralType(i - memberOffset); elem = getElaborationElementForJsxChild(child, nameType, getInvalidTextDiagnostic); - if (!elem) return [3 /*break*/, 3]; + if (!elem) + return [3 /*break*/, 3]; return [4 /*yield*/, elem]; case 2: _a.sent(); @@ -61935,14 +62257,16 @@ var ts; var child = validChildren[0]; var elem_1 = getElaborationElementForJsxChild(child, childrenNameType, getInvalidTextualChildDiagnostic); if (elem_1) { - result = elaborateElementwise((function () { return __generator(this, function (_a) { - switch (_a.label) { - case 0: return [4 /*yield*/, elem_1]; - case 1: - _a.sent(); - return [2 /*return*/]; - } - }); })(), source, target, relation, containingMessageChain, errorOutputContainer) || result; + result = elaborateElementwise((function () { + return __generator(this, function (_a) { + switch (_a.label) { + case 0: return [4 /*yield*/, elem_1]; + case 1: + _a.sent(); + return [2 /*return*/]; + } + }); + })(), source, target, relation, containingMessageChain, errorOutputContainer) || result; } } else if (!isTypeRelatedTo(getIndexedAccessType(source, childrenNameType), childrenTargetType, relation)) { @@ -61979,7 +62303,8 @@ var ts; i = 0; _a.label = 1; case 1: - if (!(i < len)) return [3 /*break*/, 4]; + if (!(i < len)) + return [3 /*break*/, 4]; // Skip elements which do not exist in the target - a length error on the tuple overall is likely better than an error on a mismatched index signature if (isTupleLikeType(target) && !getPropertyOfType(target, ("" + i))) return [3 /*break*/, 3]; @@ -62030,7 +62355,8 @@ var ts; _i = 0, _a = node.properties; _c.label = 1; case 1: - if (!(_i < _a.length)) return [3 /*break*/, 8]; + if (!(_i < _a.length)) + return [3 /*break*/, 8]; prop = _a[_i]; if (ts.isSpreadAssignment(prop)) return [3 /*break*/, 7]; @@ -62731,9 +63057,15 @@ var ts; * * Ternary.False if they are not related. */ function isRelatedTo(originalSource, originalTarget, recursionFlags, reportErrors, headMessage, intersectionState) { - if (recursionFlags === void 0) { recursionFlags = 3 /* Both */; } - if (reportErrors === void 0) { reportErrors = false; } - if (intersectionState === void 0) { intersectionState = 0 /* None */; } + if (recursionFlags === void 0) { + recursionFlags = 3 /* Both */; + } + if (reportErrors === void 0) { + reportErrors = false; + } + if (intersectionState === void 0) { + intersectionState = 0 /* None */; + } // Before normalization: if `source` is type an object type, and `target` is primitive, // skip all the checks we don't need and just return `isSimpleTypeRelatedTo` result if (originalSource.flags & 524288 /* Object */ && originalTarget.flags & 131068 /* Primitive */) { @@ -63163,9 +63495,15 @@ var ts; return result; } function typeArgumentsRelatedTo(sources, targets, variances, reportErrors, intersectionState) { - if (sources === void 0) { sources = ts.emptyArray; } - if (targets === void 0) { targets = ts.emptyArray; } - if (variances === void 0) { variances = ts.emptyArray; } + if (sources === void 0) { + sources = ts.emptyArray; + } + if (targets === void 0) { + targets = ts.emptyArray; + } + if (variances === void 0) { + variances = ts.emptyArray; + } if (sources.length !== targets.length && relation === identityRelation) { return 0 /* False */; } @@ -64609,7 +64947,9 @@ var ts; return getPropertiesOfType(type).filter(function (targetProp) { return containsMissingType(getTypeOfSymbol(targetProp)); }); } function getBestMatchingType(source, target, isRelatedTo) { - if (isRelatedTo === void 0) { isRelatedTo = compareTypesAssignable; } + if (isRelatedTo === void 0) { + isRelatedTo = compareTypesAssignable; + } return findMatchingDiscriminantType(source, target, isRelatedTo, /*skipPartial*/ true) || findMatchingTypeReferenceOrTypeAliasReference(source, target) || findBestTypeForObjectLiteral(source, target) || @@ -64699,7 +65039,9 @@ var ts; // returns the emptyArray singleton when invoked recursively for the given generic type. function getVariancesWorker(typeParameters, cache, createMarkerType) { var _a, _b, _c; - if (typeParameters === void 0) { typeParameters = ts.emptyArray; } + if (typeParameters === void 0) { + typeParameters = ts.emptyArray; + } var variances = cache.variances; if (!variances) { ts.tracing === null || ts.tracing === void 0 ? void 0 : ts.tracing.push("checkTypes" /* CheckTypes */, "getVariancesWorker", { arity: typeParameters.length, id: (_c = (_a = cache.id) !== null && _a !== void 0 ? _a : (_b = cache.declaredType) === null || _b === void 0 ? void 0 : _b.id) !== null && _c !== void 0 ? _c : -1 }); @@ -64780,7 +65122,9 @@ var ts; // getTypeReferenceId(A) returns "111=0-12=1" // where A.id=111 and number.id=12 function getTypeReferenceId(type, depth) { - if (depth === void 0) { depth = 0; } + if (depth === void 0) { + depth = 0; + } var result = "" + type.target.id; for (var _i = 0, _a = getTypeArguments(type); _i < _a.length; _i++) { var t = _a[_i]; @@ -64858,14 +65202,18 @@ var ts; } // Return true if source property is a valid override of protected parts of target property. function isValidOverrideOf(sourceProp, targetProp) { - return !forEachProperty(targetProp, function (tp) { return ts.getDeclarationModifierFlagsFromSymbol(tp) & 16 /* Protected */ ? - !isPropertyInClassDerivedFrom(sourceProp, getDeclaringClass(tp)) : false; }); + return !forEachProperty(targetProp, function (tp) { + return ts.getDeclarationModifierFlagsFromSymbol(tp) & 16 /* Protected */ ? + !isPropertyInClassDerivedFrom(sourceProp, getDeclaringClass(tp)) : false; + }); } // Return true if the given class derives from each of the declaring classes of the protected // constituents of the given property. function isClassDerivedFromDeclaringClasses(checkClass, prop, writing) { - return forEachProperty(prop, function (p) { return ts.getDeclarationModifierFlagsFromSymbol(p, writing) & 16 /* Protected */ ? - !hasBaseType(checkClass, getDeclaringClass(p)) : false; }) ? undefined : checkClass; + return forEachProperty(prop, function (p) { + return ts.getDeclarationModifierFlagsFromSymbol(p, writing) & 16 /* Protected */ ? + !hasBaseType(checkClass, getDeclaringClass(p)) : false; + }) ? undefined : checkClass; } // Return true if the given type is deeply nested. We consider this to be the case when structural type comparisons // for maxDepth or more occurrences or instantiations of the type have been recorded on the given stack. It is possible, @@ -64880,7 +65228,9 @@ var ts; // has expanded into `[A>>>>>]`. In such cases we need // to terminate the expansion, and we do so here. function isDeeplyNestedType(type, stack, depth, maxDepth) { - if (maxDepth === void 0) { maxDepth = 3; } + if (maxDepth === void 0) { + maxDepth = 3; + } if (depth >= maxDepth) { var identity_1 = getRecursionIdentity(type); var count = 0; @@ -65256,8 +65606,12 @@ var ts; return restType && createArrayType(restType); } function getElementTypeOfSliceOfTupleType(type, index, endSkipCount, writing) { - if (endSkipCount === void 0) { endSkipCount = 0; } - if (writing === void 0) { writing = false; } + if (endSkipCount === void 0) { + endSkipCount = 0; + } + if (writing === void 0) { + writing = false; + } var length = getTypeReferenceArity(type) - endSkipCount; if (index < length) { var typeArguments = getTypeArguments(type); @@ -65330,7 +65684,9 @@ var ts; getUnionType([type, undefinedType, nullType]); } function getOptionalType(type, isProperty) { - if (isProperty === void 0) { isProperty = false; } + if (isProperty === void 0) { + isProperty = false; + } ts.Debug.assert(strictNullChecks); return type.flags & 32768 /* Undefined */ ? type : getUnionType([type, isProperty ? missingType : undefinedType]); } @@ -65726,7 +66082,9 @@ var ts; return createInferenceContextWorker(typeParameters.map(createInferenceInfo), signature, flags, compareTypes || compareTypesAssignable); } function cloneInferenceContext(context, extraFlags) { - if (extraFlags === void 0) { extraFlags = 0; } + if (extraFlags === void 0) { + extraFlags = 0; + } return context && createInferenceContextWorker(ts.map(context.inferences, cloneInferenceInfo), context.signature, context.flags | extraFlags, context.compareTypes); } function createInferenceContextWorker(inferences, signature, flags, compareTypes) { @@ -65922,25 +66280,31 @@ var ts; _i = 0, properties_2 = properties; _a.label = 1; case 1: - if (!(_i < properties_2.length)) return [3 /*break*/, 6]; + if (!(_i < properties_2.length)) + return [3 /*break*/, 6]; targetProp = properties_2[_i]; // TODO: remove this when we support static private identifier fields and find other solutions to get privateNamesAndStaticFields test to pass if (isStaticPrivateIdentifierProperty(targetProp)) { return [3 /*break*/, 5]; } - if (!(requireOptionalProperties || !(targetProp.flags & 16777216 /* Optional */ || ts.getCheckFlags(targetProp) & 48 /* Partial */))) return [3 /*break*/, 5]; + if (!(requireOptionalProperties || !(targetProp.flags & 16777216 /* Optional */ || ts.getCheckFlags(targetProp) & 48 /* Partial */))) + return [3 /*break*/, 5]; sourceProp = getPropertyOfType(source, targetProp.escapedName); - if (!!sourceProp) return [3 /*break*/, 3]; + if (!!sourceProp) + return [3 /*break*/, 3]; return [4 /*yield*/, targetProp]; case 2: _a.sent(); return [3 /*break*/, 5]; case 3: - if (!matchDiscriminantProperties) return [3 /*break*/, 5]; + if (!matchDiscriminantProperties) + return [3 /*break*/, 5]; targetType = getTypeOfSymbol(targetProp); - if (!(targetType.flags & 109440 /* Unit */)) return [3 /*break*/, 5]; + if (!(targetType.flags & 109440 /* Unit */)) + return [3 /*break*/, 5]; sourceType = getTypeOfSymbol(sourceProp); - if (!!(sourceType.flags & 1 /* Any */ || getRegularTypeOfLiteralType(sourceType) === getRegularTypeOfLiteralType(targetType))) return [3 /*break*/, 5]; + if (!!(sourceType.flags & 1 /* Any */ || getRegularTypeOfLiteralType(sourceType) === getRegularTypeOfLiteralType(targetType))) + return [3 /*break*/, 5]; return [4 /*yield*/, targetProp]; case 4: _a.sent(); @@ -66113,8 +66477,12 @@ var ts; } } function inferTypes(inferences, originalSource, originalTarget, priority, contravariant) { - if (priority === void 0) { priority = 0; } - if (contravariant === void 0) { contravariant = false; } + if (priority === void 0) { + priority = 0; + } + if (contravariant === void 0) { + contravariant = false; + } var bivariant = false; var propagationType; var inferencePriority = 2048 /* MaxValue */; @@ -67154,8 +67522,10 @@ var ts; } function getMatchingUnionConstituentForObjectLiteral(unionType, node) { var keyPropertyName = getKeyPropertyName(unionType); - var propNode = keyPropertyName && ts.find(node.properties, function (p) { return p.symbol && p.kind === 294 /* PropertyAssignment */ && - p.symbol.escapedName === keyPropertyName && isPossiblyDiscriminantValue(p.initializer); }); + var propNode = keyPropertyName && ts.find(node.properties, function (p) { + return p.symbol && p.kind === 294 /* PropertyAssignment */ && + p.symbol.escapedName === keyPropertyName && isPossiblyDiscriminantValue(p.initializer); + }); var propType = propNode && getContextFreeTypeOfExpression(propNode.initializer); return propType && getConstituentTypeForKeyType(unionType, propType); } @@ -67226,7 +67596,9 @@ var ts; resolved.members.get("bind") && isTypeSubtypeOf(type, globalFunctionType)); } function getTypeFacts(type, ignoreObjects) { - if (ignoreObjects === void 0) { ignoreObjects = false; } + if (ignoreObjects === void 0) { + ignoreObjects = false; + } var flags = type.flags; if (flags & 4 /* String */) { return strictNullChecks ? 16317953 /* StringStrictFacts */ : 16776705 /* StringFacts */; @@ -67924,7 +68296,9 @@ var ts; return false; } function getFlowTypeOfReference(reference, declaredType, initialType, flowContainer) { - if (initialType === void 0) { initialType = declaredType; } + if (initialType === void 0) { + initialType = declaredType; + } var key; var isKeySet = false; var flowDepth = 0; @@ -69485,8 +69859,12 @@ var ts; return type || anyType; } function tryGetThisTypeAt(node, includeGlobalThis, container) { - if (includeGlobalThis === void 0) { includeGlobalThis = true; } - if (container === void 0) { container = ts.getThisContainer(node, /*includeArrowFunctions*/ false); } + if (includeGlobalThis === void 0) { + includeGlobalThis = true; + } + if (container === void 0) { + container = ts.getThisContainer(node, /*includeArrowFunctions*/ false); + } var isInJS = ts.isInJSFile(node); if (ts.isFunctionLike(container) && (!isInParameterInitializerBeforeContainingFunction(node) || ts.getThisParameter(container))) { @@ -70214,7 +70592,9 @@ var ts; } } function isPossiblyAliasedThisProperty(declaration, kind) { - if (kind === void 0) { kind = ts.getAssignmentDeclarationKind(declaration); } + if (kind === void 0) { + kind = ts.getAssignmentDeclarationKind(declaration); + } if (kind === 4 /* ThisProperty */) { return true; } @@ -71831,7 +72211,9 @@ var ts; * @param prop The symbol for the property being accessed. */ function checkPropertyAccessibility(node, isSuper, writing, type, prop, reportError) { - if (reportError === void 0) { reportError = true; } + if (reportError === void 0) { + reportError = true; + } var errorNode = !reportError ? undefined : node.kind === 160 /* QualifiedName */ ? node.right : node.kind === 199 /* ImportType */ ? node : @@ -72496,9 +72878,11 @@ var ts; return symbol; var candidates; if (symbols === globals) { - var primitives = ts.mapDefined(["string", "number", "boolean", "object", "bigint", "symbol"], function (s) { return symbols.has((s.charAt(0).toUpperCase() + s.slice(1))) - ? createSymbol(524288 /* TypeAlias */, s) - : undefined; }); + var primitives = ts.mapDefined(["string", "number", "boolean", "object", "bigint", "symbol"], function (s) { + return symbols.has((s.charAt(0).toUpperCase() + s.slice(1))) + ? createSymbol(524288 /* TypeAlias */, s) + : undefined; + }); candidates = primitives.concat(ts.arrayFrom(symbols.values())); } else { @@ -72828,7 +73212,9 @@ var ts; return !!(t.flags & (16384 /* Void */ | 32768 /* Undefined */ | 2 /* Unknown */ | 1 /* Any */)); } function hasCorrectArity(node, args, signature, signatureHelpTrailingComma) { - if (signatureHelpTrailingComma === void 0) { signatureHelpTrailingComma = false; } + if (signatureHelpTrailingComma === void 0) { + signatureHelpTrailingComma = false; + } var argCount; var callIsIncomplete = false; // In incomplete call we want to be lenient when we have too few arguments var effectiveParameterCount = getParameterCount(signature); @@ -73721,7 +74107,9 @@ var ts; candidateForTypeArgumentError = oldCandidateForTypeArgumentError; } function chooseOverload(candidates, relation, isSingleNonGenericCandidate, signatureHelpTrailingComma) { - if (signatureHelpTrailingComma === void 0) { signatureHelpTrailingComma = false; } + if (signatureHelpTrailingComma === void 0) { + signatureHelpTrailingComma = false; + } candidatesForArgumentError = undefined; candidateForArgumentArityError = undefined; candidateForTypeArgumentError = undefined; @@ -73820,9 +74208,11 @@ var ts; var _a = ts.minAndMax(candidates, getNumNonRestParameters), minArgumentCount = _a.min, maxNonRestParam = _a.max; var parameters = []; var _loop_25 = function (i) { - var symbols = ts.mapDefined(candidates, function (s) { return signatureHasRestParameter(s) ? - i < s.parameters.length - 1 ? s.parameters[i] : ts.last(s.parameters) : - i < s.parameters.length ? s.parameters[i] : undefined; }); + var symbols = ts.mapDefined(candidates, function (s) { + return signatureHasRestParameter(s) ? + i < s.parameters.length - 1 ? s.parameters[i] : ts.last(s.parameters) : + i < s.parameters.length ? s.parameters[i] : undefined; + }); ts.Debug.assert(symbols.length !== 0); parameters.push(createCombinedSymbolFromTypes(symbols, ts.mapDefined(candidates, function (candidate) { return tryGetTypeAtPosition(candidate, i); }))); }; @@ -75645,7 +76035,9 @@ var ts; } } function checkArithmeticOperandType(operand, type, diagnostic, isAwaitValid) { - if (isAwaitValid === void 0) { isAwaitValid = false; } + if (isAwaitValid === void 0) { + isAwaitValid = false; + } if (!isTypeAssignableTo(type, numberOrBigIntType)) { var awaitedType = isAwaitValid && getAwaitedTypeOfPromise(type); errorAndMaybeSuggestAwait(operand, !!awaitedType && isTypeAssignableTo(awaitedType, numberOrBigIntType), diagnostic); @@ -76045,7 +76437,9 @@ var ts; } /** Note: If property cannot be a SpreadAssignment, then allProperties does not need to be provided */ function checkObjectLiteralDestructuringPropertyAssignment(node, objectLiteralType, propertyIndex, allProperties, rightIsThis) { - if (rightIsThis === void 0) { rightIsThis = false; } + if (rightIsThis === void 0) { + rightIsThis = false; + } var properties = node.properties; var property = properties[propertyIndex]; if (property.kind === 294 /* PropertyAssignment */ || property.kind === 295 /* ShorthandPropertyAssignment */) { @@ -80381,9 +80775,15 @@ var ts; // `yieldType` and `returnType` are defaulted to `neverType` they each will be combined // via `getUnionType` when merging iteration types. `nextType` is defined as `unknownType` // as it is combined via `getIntersectionType` when merging iteration types. - if (yieldType === void 0) { yieldType = neverType; } - if (returnType === void 0) { returnType = neverType; } - if (nextType === void 0) { nextType = unknownType; } + if (yieldType === void 0) { + yieldType = neverType; + } + if (returnType === void 0) { + returnType = neverType; + } + if (nextType === void 0) { + nextType = unknownType; + } // Use the cache only for intrinsic types to keep it small as they are likely to be // more frequently created (i.e. `Iterator`). Iteration types // are also cached on the type they are requested for, so we shouldn't need to maintain @@ -81456,7 +81856,9 @@ var ts; * Note: `member` cannot be a synthetic node. */ function checkExistingMemberForOverrideModifier(node, staticType, baseStaticType, baseWithThis, type, typeWithThis, member, memberIsParameterProperty, reportErrors) { - if (reportErrors === void 0) { reportErrors = true; } + if (reportErrors === void 0) { + reportErrors = true; + } var declaredProp = member.name && getSymbolAtLocation(member.name) || getSymbolAtLocation(member); @@ -81545,8 +81947,10 @@ var ts; var prop = getPropertyOfType(typeWithThis, declaredProp.escapedName); var baseProp = getPropertyOfType(baseWithThis, declaredProp.escapedName); if (prop && baseProp) { - var rootChain = function () { return ts.chainDiagnosticMessages( - /*details*/ undefined, ts.Diagnostics.Property_0_in_type_1_is_not_assignable_to_the_same_property_in_base_type_2, symbolToString(declaredProp), typeToString(typeWithThis), typeToString(baseWithThis)); }; + var rootChain = function () { + return ts.chainDiagnosticMessages( + /*details*/ undefined, ts.Diagnostics.Property_0_in_type_1_is_not_assignable_to_the_same_property_in_base_type_2, symbolToString(declaredProp), typeToString(typeWithThis), typeToString(baseWithThis)); + }; if (!checkTypeAssignableTo(getTypeOfSymbol(prop), getTypeOfSymbol(baseProp), member.name || member, /*message*/ undefined, rootChain)) { issuedMemberError = true; } @@ -85151,7 +85555,9 @@ var ts; return grammarErrorOnNode(asyncModifier, ts.Diagnostics._0_modifier_cannot_be_used_here, "async"); } function checkGrammarForDisallowedTrailingComma(list, diag) { - if (diag === void 0) { diag = ts.Diagnostics.Trailing_comma_not_allowed; } + if (diag === void 0) { + diag = ts.Diagnostics.Trailing_comma_not_allowed; + } if (list && list.hasTrailingComma) { return grammarErrorAtPos(list[0], list.end - ",".length, ",".length, diag); } @@ -86517,7 +86923,9 @@ var ts; * and merging hoisted declarations upon completion. */ function visitLexicalEnvironment(statements, visitor, context, start, ensureUseStrict, nodesVisitor) { - if (nodesVisitor === void 0) { nodesVisitor = visitNodes; } + if (nodesVisitor === void 0) { + nodesVisitor = visitNodes; + } context.startLexicalEnvironment(); statements = nodesVisitor(statements, visitor, ts.isStatement, start); if (ensureUseStrict) @@ -86526,7 +86934,9 @@ var ts; } ts.visitLexicalEnvironment = visitLexicalEnvironment; function visitParameterList(nodes, visitor, context, nodesVisitor) { - if (nodesVisitor === void 0) { nodesVisitor = visitNodes; } + if (nodesVisitor === void 0) { + nodesVisitor = visitNodes; + } var updated; context.startLexicalEnvironment(); if (nodes) { @@ -86595,7 +87005,9 @@ var ts; /*initializer*/ undefined); } function visitFunctionBody(node, visitor, context, nodeVisitor) { - if (nodeVisitor === void 0) { nodeVisitor = visitNode; } + if (nodeVisitor === void 0) { + nodeVisitor = visitNode; + } context.resumeLexicalEnvironment(); var updated = nodeVisitor(node, visitor, ts.isConciseBody); var declarations = context.endLexicalEnvironment(); @@ -86629,8 +87041,12 @@ var ts; } ts.visitIterationBody = visitIterationBody; function visitEachChild(node, visitor, context, nodesVisitor, tokenVisitor, nodeVisitor) { - if (nodesVisitor === void 0) { nodesVisitor = visitNodes; } - if (nodeVisitor === void 0) { nodeVisitor = visitNode; } + if (nodesVisitor === void 0) { + nodesVisitor = visitNodes; + } + if (nodeVisitor === void 0) { + nodeVisitor = visitNode; + } if (node === undefined) { return undefined; } @@ -88233,7 +88649,9 @@ var ts; * @param level Indicates the extent to which flattening should occur. */ function flattenDestructuringBinding(node, visitor, context, level, rval, hoistTempVariables, skipInitializer) { - if (hoistTempVariables === void 0) { hoistTempVariables = false; } + if (hoistTempVariables === void 0) { + hoistTempVariables = false; + } var pendingExpressions; var pendingDeclarations = []; var declarations = []; @@ -94848,9 +95266,11 @@ var ts; function transformJsxAttributesToExpression(attrs, children) { // Map spans of JsxAttribute nodes into object literals and spans // of JsxSpreadAttribute nodes into expressions. - var expressions = ts.flatten(ts.spanMap(attrs, ts.isJsxSpreadAttribute, function (attrs, isSpread) { return isSpread - ? ts.map(attrs, transformJsxSpreadAttributeToExpression) - : factory.createObjectLiteralExpression(ts.map(attrs, transformJsxAttributeToObjectLiteralElement)); })); + var expressions = ts.flatten(ts.spanMap(attrs, ts.isJsxSpreadAttribute, function (attrs, isSpread) { + return isSpread + ? ts.map(attrs, transformJsxSpreadAttributeToExpression) + : factory.createObjectLiteralExpression(ts.map(attrs, transformJsxAttributeToObjectLiteralElement)); + })); if (ts.isJsxSpreadAttribute(attrs[0])) { // We must always emit at least one object literal before a spread // argument.factory.createObjectLiteral @@ -99553,7 +99973,9 @@ var ts; return ts.visitEachChild(node, visitor, context); } function transformAndEmitStatements(statements, start) { - if (start === void 0) { start = 0; } + if (start === void 0) { + start = 0; + } var numStatements = statements.length; for (var i = start; i < numStatements; i++) { transformAndEmitStatement(statements[i]); @@ -105079,12 +105501,14 @@ var ts; } function transformDeclarationsForJS(sourceFile, bundled) { var oldDiag = getSymbolAccessibilityDiagnostic; - getSymbolAccessibilityDiagnostic = function (s) { return (s.errorNode && ts.canProduceDiagnostics(s.errorNode) ? ts.createGetSymbolAccessibilityDiagnosticForNode(s.errorNode)(s) : ({ - diagnosticMessage: s.errorModuleName - ? ts.Diagnostics.Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotation_may_unblock_declaration_emit - : ts.Diagnostics.Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_declaration_emit, - errorNode: s.errorNode || sourceFile - })); }; + getSymbolAccessibilityDiagnostic = function (s) { + return (s.errorNode && ts.canProduceDiagnostics(s.errorNode) ? ts.createGetSymbolAccessibilityDiagnosticForNode(s.errorNode)(s) : ({ + diagnosticMessage: s.errorModuleName + ? ts.Diagnostics.Declaration_emit_for_this_file_requires_using_private_name_0_from_module_1_An_explicit_type_annotation_may_unblock_declaration_emit + : ts.Diagnostics.Declaration_emit_for_this_file_requires_using_private_name_0_An_explicit_type_annotation_may_unblock_declaration_emit, + errorNode: s.errorNode || sourceFile + })); + }; var result = resolver.getDeclarationStatementsForSourceFile(sourceFile, declarationEmitNodeBuilderFlags, symbolTracker, bundled); getSymbolAccessibilityDiagnostic = oldDiag; return result; @@ -105791,10 +106215,12 @@ var ts; } else { var newId = factory.createUniqueName("_default", 16 /* Optimistic */); - getSymbolAccessibilityDiagnostic = function () { return ({ - diagnosticMessage: ts.Diagnostics.Default_export_of_the_module_has_or_is_using_private_name_0, - errorNode: input - }); }; + getSymbolAccessibilityDiagnostic = function () { + return ({ + diagnosticMessage: ts.Diagnostics.Default_export_of_the_module_has_or_is_using_private_name_0, + errorNode: input + }); + }; errorFallbackNode = input; var varDecl = factory.createVariableDeclaration(newId, /*exclamationToken*/ undefined, resolver.createTypeOfExpression(input.expression, input, declarationEmitNodeBuilderFlags, symbolTracker), /*initializer*/ undefined); errorFallbackNode = undefined; @@ -106024,11 +106450,13 @@ var ts; // We must add a temporary declaration for the extends clause expression var oldId = input.name ? ts.unescapeLeadingUnderscores(input.name.escapedText) : "default"; var newId_1 = factory.createUniqueName("".concat(oldId, "_base"), 16 /* Optimistic */); - getSymbolAccessibilityDiagnostic = function () { return ({ - diagnosticMessage: ts.Diagnostics.extends_clause_of_exported_class_0_has_or_is_using_private_name_1, - errorNode: extendsClause_1, - typeName: input.name - }); }; + getSymbolAccessibilityDiagnostic = function () { + return ({ + diagnosticMessage: ts.Diagnostics.extends_clause_of_exported_class_0_has_or_is_using_private_name_1, + errorNode: extendsClause_1, + typeName: input.name + }); + }; var varDecl = factory.createVariableDeclaration(newId_1, /*exclamationToken*/ undefined, resolver.createTypeOfExpression(extendsClause_1.expression, input, declarationEmitNodeBuilderFlags, symbolTracker), /*initializer*/ undefined); var statement = factory.createVariableStatement(needsDeclare ? [factory.createModifier(135 /* DeclareKeyword */)] : [], factory.createVariableDeclarationList([varDecl], 2 /* Const */)); var heritageClauses = factory.createNodeArray(ts.map(input.heritageClauses, function (clause) { @@ -106167,9 +106595,11 @@ var ts; return accessorType; } function transformHeritageClauses(nodes) { - return factory.createNodeArray(ts.filter(ts.map(nodes, function (clause) { return factory.updateHeritageClause(clause, ts.visitNodes(factory.createNodeArray(ts.filter(clause.types, function (t) { - return ts.isEntityNameExpression(t.expression) || (clause.token === 94 /* ExtendsKeyword */ && t.expression.kind === 104 /* NullKeyword */); - })), visitDeclarationSubtree)); }), function (clause) { return clause.types && !!clause.types.length; })); + return factory.createNodeArray(ts.filter(ts.map(nodes, function (clause) { + return factory.updateHeritageClause(clause, ts.visitNodes(factory.createNodeArray(ts.filter(clause.types, function (t) { + return ts.isEntityNameExpression(t.expression) || (clause.token === 94 /* ExtendsKeyword */ && t.expression.kind === 104 /* NullKeyword */); + })), visitDeclarationSubtree)); + }), function (clause) { return clause.types && !!clause.types.length; })); } } ts.transformDeclarations = transformDeclarations; @@ -106184,8 +106614,12 @@ var ts; return ts.factory.createModifiersFromModifierFlags(maskModifierFlags(node, modifierMask, modifierAdditions)); } function maskModifierFlags(node, modifierMask, modifierAdditions) { - if (modifierMask === void 0) { modifierMask = 27647 /* All */ ^ 4 /* Public */; } - if (modifierAdditions === void 0) { modifierAdditions = 0 /* None */; } + if (modifierMask === void 0) { + modifierMask = 27647 /* All */ ^ 4 /* Public */; + } + if (modifierAdditions === void 0) { + modifierAdditions = 0 /* None */; + } var flags = (ts.getEffectiveModifierFlags(node) & modifierMask) | modifierAdditions; if (flags & 512 /* Default */ && !(flags & 1 /* Export */)) { // A non-exported default is a nonsequitor - we usually try to remove all export modifiers @@ -106811,7 +107245,9 @@ var ts; * Else, calls `getSourceFilesToEmit` with the (optional) target source file to determine the list of source files to emit. */ function forEachEmittedFile(host, action, sourceFilesOrTargetSourceFile, forceDtsEmit, onlyBuildInfo, includeBuildInfo) { - if (forceDtsEmit === void 0) { forceDtsEmit = false; } + if (forceDtsEmit === void 0) { + forceDtsEmit = false; + } var sourceFiles = ts.isArray(sourceFilesOrTargetSourceFile) ? sourceFilesOrTargetSourceFile : ts.getSourceFilesToEmit(host, sourceFilesOrTargetSourceFile, forceDtsEmit); var options = host.getCompilerOptions(); if (ts.outFile(options)) { @@ -107532,8 +107968,12 @@ var ts; PipelinePhase[PipelinePhase["Emit"] = 4] = "Emit"; })(PipelinePhase || (PipelinePhase = {})); function createPrinter(printerOptions, handlers) { - if (printerOptions === void 0) { printerOptions = {}; } - if (handlers === void 0) { handlers = {}; } + if (printerOptions === void 0) { + printerOptions = {}; + } + if (handlers === void 0) { + handlers = {}; + } var hasGlobalName = handlers.hasGlobalName, _a = handlers.onEmitNode, onEmitNode = _a === void 0 ? ts.noEmitNotification : _a, isEmitNotificationEnabled = handlers.isEmitNotificationEnabled, _b = handlers.substituteNode, substituteNode = _b === void 0 ? ts.noEmitSubstitution : _b, onBeforeEmitNode = handlers.onBeforeEmitNode, onAfterEmitNode = handlers.onAfterEmitNode, onBeforeEmitNodeArray = handlers.onBeforeEmitNodeArray, onAfterEmitNodeArray = handlers.onAfterEmitNodeArray, onBeforeEmitToken = handlers.onBeforeEmitToken, onAfterEmitToken = handlers.onAfterEmitToken; var extendedDiagnostics = !!printerOptions.extendedDiagnostics; var newLine = ts.getNewLineCharacter(printerOptions); @@ -107907,7 +108347,9 @@ var ts; currentParenthesizerRule = undefined; } function pipelineEmitWithHintWorker(hint, node, allowSnippets) { - if (allowSnippets === void 0) { allowSnippets = true; } + if (allowSnippets === void 0) { + allowSnippets = true; + } if (allowSnippets) { var snippet = ts.getSnippetElement(node); if (snippet) { @@ -110585,8 +111027,12 @@ var ts; emitNodeList(emitExpression, parentNode, children, format, parenthesizerRule, start, count); } function emitNodeList(emit, parentNode, children, format, parenthesizerRule, start, count) { - if (start === void 0) { start = 0; } - if (count === void 0) { count = children ? children.length - start : 0; } + if (start === void 0) { + start = 0; + } + if (count === void 0) { + count = children ? children.length - start : 0; + } var isUndefined = children === undefined; if (isUndefined && format & 16384 /* OptionalIfUndefined */) { return; @@ -110792,7 +111238,9 @@ var ts; } } function writeLine(count) { - if (count === void 0) { count = 1; } + if (count === void 0) { + count = 1; + } for (var i = 0; i < count; i++) { writer.writeLine(i > 0); } @@ -111314,7 +111762,9 @@ var ts; * If `optimistic` is set, the first instance will use 'baseName' verbatim instead of 'baseName_1' */ function makeUniqueName(baseName, checkFn, optimistic, scoped) { - if (checkFn === void 0) { checkFn = isUniqueName; } + if (checkFn === void 0) { + checkFn = isUniqueName; + } if (optimistic) { if (checkFn(baseName)) { if (scoped) { @@ -112412,18 +112862,20 @@ var ts; }; } function createTriggerLoggingAddWatch(key) { - return function (file, cb, flags, options, detailInfo1, detailInfo2) { return plainInvokeFactory[key].call(/*thisArgs*/ undefined, file, function () { - var args = []; - for (var _i = 0; _i < arguments.length; _i++) { - args[_i] = arguments[_i]; - } - var triggerredInfo = "".concat(key === "watchFile" ? "FileWatcher" : "DirectoryWatcher", ":: Triggered with ").concat(args[0], " ").concat(args[1] !== undefined ? args[1] : "", ":: ").concat(getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo)); - log(triggerredInfo); - var start = ts.timestamp(); - cb.call.apply(cb, __spreadArray([/*thisArg*/ undefined], args, false)); - var elapsed = ts.timestamp() - start; - log("Elapsed:: ".concat(elapsed, "ms ").concat(triggerredInfo)); - }, flags, options, detailInfo1, detailInfo2); }; + return function (file, cb, flags, options, detailInfo1, detailInfo2) { + return plainInvokeFactory[key].call(/*thisArgs*/ undefined, file, function () { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + var triggerredInfo = "".concat(key === "watchFile" ? "FileWatcher" : "DirectoryWatcher", ":: Triggered with ").concat(args[0], " ").concat(args[1] !== undefined ? args[1] : "", ":: ").concat(getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo)); + log(triggerredInfo); + var start = ts.timestamp(); + cb.call.apply(cb, __spreadArray([/*thisArg*/ undefined], args, false)); + var elapsed = ts.timestamp() - start; + log("Elapsed:: ".concat(elapsed, "ms ").concat(triggerredInfo)); + }, flags, options, detailInfo1, detailInfo2); + }; } function getWatchInfo(file, flags, options, detailInfo1, detailInfo2, getDetailWatchInfo) { return "WatchInfo: ".concat(file, " ").concat(flags, " ").concat(JSON.stringify(options), " ").concat(getDetailWatchInfo ? getDetailWatchInfo(detailInfo1, detailInfo2) : detailInfo2 === undefined ? detailInfo1 : "".concat(detailInfo1, " ").concat(detailInfo2)); @@ -112447,7 +112899,9 @@ var ts; var ts; (function (ts) { function findConfigFile(searchPath, fileExists, configName) { - if (configName === void 0) { configName = "tsconfig.json"; } + if (configName === void 0) { + configName = "tsconfig.json"; + } return ts.forEachAncestorDirectory(searchPath, function (ancestor) { var fileName = ts.combinePaths(ancestor, configName); return fileExists(fileName) ? fileName : undefined; @@ -112506,7 +112960,9 @@ var ts; /*@internal*/ // TODO(shkamat): update this after reworking ts build API function createCompilerHostWorker(options, setParentNodes, system) { - if (system === void 0) { system = ts.sys; } + if (system === void 0) { + system = ts.sys; + } var existingDirectories = new ts.Map(); var getCanonicalFileName = ts.createGetCanonicalFileName(system.useCaseSensitiveFileNames); var computeHash = ts.maybeBind(system, system.createHash) || ts.generateDjb2Hash; @@ -112820,7 +113276,9 @@ var ts; } /* @internal */ function formatLocation(file, start, host, color) { - if (color === void 0) { color = formatColorAndReset; } + if (color === void 0) { + color = formatColorAndReset; + } var _a = ts.getLineAndCharacterOfPosition(file, start), firstLine = _a.line, firstLineChar = _a.character; // TODO: GH#18217 var relativeFileName = host ? ts.convertToRelativePath(file.fileName, host.getCurrentDirectory(), function (fileName) { return host.getCanonicalFileName(fileName); }) : file.fileName; var output = ""; @@ -112867,7 +113325,9 @@ var ts; } ts.formatDiagnosticsWithColorAndContext = formatDiagnosticsWithColorAndContext; function flattenDiagnosticMessageText(diag, newLine, indent) { - if (indent === void 0) { indent = 0; } + if (indent === void 0) { + indent = 0; + } if (ts.isString(diag)) { return diag; } @@ -113217,15 +113677,17 @@ var ts; var actualResolveModuleNamesWorker; var hasInvalidatedResolution = host.hasInvalidatedResolution || ts.returnFalse; if (host.resolveModuleNames) { - actualResolveModuleNamesWorker = function (moduleNames, containingFile, containingFileName, reusedNames, redirectedReference) { return host.resolveModuleNames(ts.Debug.checkEachDefined(moduleNames), containingFileName, reusedNames, redirectedReference, options, containingFile).map(function (resolved) { - // An older host may have omitted extension, in which case we should infer it from the file extension of resolvedFileName. - if (!resolved || resolved.extension !== undefined) { - return resolved; - } - var withExtension = ts.clone(resolved); - withExtension.extension = ts.extensionFromPath(resolved.resolvedFileName); - return withExtension; - }); }; + actualResolveModuleNamesWorker = function (moduleNames, containingFile, containingFileName, reusedNames, redirectedReference) { + return host.resolveModuleNames(ts.Debug.checkEachDefined(moduleNames), containingFileName, reusedNames, redirectedReference, options, containingFile).map(function (resolved) { + // An older host may have omitted extension, in which case we should infer it from the file extension of resolvedFileName. + if (!resolved || resolved.extension !== undefined) { + return resolved; + } + var withExtension = ts.clone(resolved); + withExtension.extension = ts.extensionFromPath(resolved.resolvedFileName); + return withExtension; + }); + }; moduleResolutionCache = (_a = host.getModuleResolutionCache) === null || _a === void 0 ? void 0 : _a.call(host); } else { @@ -115857,11 +116319,13 @@ var ts; function directoryExistsIfProjectReferenceDeclDir(dir) { var dirPath = host.toPath(dir); var dirPathWithTrailingDirectorySeparator = "".concat(dirPath).concat(ts.directorySeparator); - return ts.forEachKey(setOfDeclarationDirectories, function (declDirPath) { return dirPath === declDirPath || - // Any parent directory of declaration dir - ts.startsWith(declDirPath, dirPathWithTrailingDirectorySeparator) || - // Any directory inside declaration dir - ts.startsWith(dirPath, "".concat(declDirPath, "/")); }); + return ts.forEachKey(setOfDeclarationDirectories, function (declDirPath) { + return dirPath === declDirPath || + // Any parent directory of declaration dir + ts.startsWith(declDirPath, dirPathWithTrailingDirectorySeparator) || + // Any directory inside declaration dir + ts.startsWith(dirPath, "".concat(declDirPath, "/")); + }); } function handleDirectoryCouldBeSymlink(directory) { var _a; @@ -115960,7 +116424,9 @@ var ts; ts.filterSemanticDiagnostics = filterSemanticDiagnostics; /* @internal */ function parseConfigHostFromCompilerHostLike(host, directoryStructureHost) { - if (directoryStructureHost === void 0) { directoryStructureHost = host; } + if (directoryStructureHost === void 0) { + directoryStructureHost = host; + } return { fileExists: function (f) { return directoryStructureHost.fileExists(f); }, readDirectory: function (root, extensions, excludes, includes, depth) { @@ -116140,7 +116606,9 @@ var ts; set.add(v); } function deleteFromMultimap(map, k, v, removeEmpty) { - if (removeEmpty === void 0) { removeEmpty = true; } + if (removeEmpty === void 0) { + removeEmpty = true; + } var set = map.get(k); if (set === null || set === void 0 ? void 0 : set.delete(v)) { if (removeEmpty && !set.size) { @@ -116353,7 +116821,9 @@ var ts; * Returns if the shape of the signature has changed since last emit */ function updateShapeSignature(state, programOfThisState, sourceFile, cacheToUpdateSignature, cancellationToken, computeHash, exportedModulesMapCache, useFileVersionAsSignature) { - if (useFileVersionAsSignature === void 0) { useFileVersionAsSignature = state.useFileVersionAsSignature; } + if (useFileVersionAsSignature === void 0) { + useFileVersionAsSignature = state.useFileVersionAsSignature; + } ts.Debug.assert(!!sourceFile); ts.Debug.assert(!exportedModulesMapCache || !!state.exportedModulesMap, "Compute visible to outside map only if visibleToOutsideReferencedMap present in the state"); // If we have cached the result for this file, that means hence forth we should assume file shape is uptodate @@ -117110,10 +117580,12 @@ var ts; }); var referencedMap; if (state.referencedMap) { - referencedMap = ts.arrayFrom(state.referencedMap.keys()).sort(ts.compareStringsCaseSensitive).map(function (key) { return [ - toFileId(key), - toFileIdListId(state.referencedMap.getValues(key)) - ]; }); + referencedMap = ts.arrayFrom(state.referencedMap.keys()).sort(ts.compareStringsCaseSensitive).map(function (key) { + return [ + toFileId(key), + toFileIdListId(state.referencedMap.getValues(key)) + ]; + }); } var exportedModulesMap; if (state.exportedModulesMap) { @@ -117819,8 +118291,10 @@ var ts; } var collected = filesWithInvalidatedResolutions; filesWithInvalidatedResolutions = undefined; - return function (path) { return (!!collected && collected.has(path)) || - isFileWithInvalidatedNonRelativeUnresolvedImports(path); }; + return function (path) { + return (!!collected && collected.has(path)) || + isFileWithInvalidatedNonRelativeUnresolvedImports(path); + }; } function clearPerDirectoryResolutions() { moduleResolutionCache.clear(); @@ -118527,15 +119001,17 @@ var ts; function computeModuleSpecifiers(modulePaths, compilerOptions, importingSourceFile, host, userPreferences) { var info = getInfo(importingSourceFile.path, host); var preferences = getPreferences(host, userPreferences, compilerOptions, importingSourceFile); - var existingSpecifier = ts.forEach(modulePaths, function (modulePath) { return ts.forEach(host.getFileIncludeReasons().get(ts.toPath(modulePath.path, host.getCurrentDirectory(), info.getCanonicalFileName)), function (reason) { - if (reason.kind !== ts.FileIncludeKind.Import || reason.file !== importingSourceFile.path) - return undefined; - var specifier = ts.getModuleNameStringLiteralAt(importingSourceFile, reason.index).text; - // If the preference is for non relative and the module specifier is relative, ignore it - return preferences.relativePreference !== 1 /* NonRelative */ || !ts.pathIsRelative(specifier) ? - specifier : - undefined; - }); }); + var existingSpecifier = ts.forEach(modulePaths, function (modulePath) { + return ts.forEach(host.getFileIncludeReasons().get(ts.toPath(modulePath.path, host.getCurrentDirectory(), info.getCanonicalFileName)), function (reason) { + if (reason.kind !== ts.FileIncludeKind.Import || reason.file !== importingSourceFile.path) + return undefined; + var specifier = ts.getModuleNameStringLiteralAt(importingSourceFile, reason.index).text; + // If the preference is for non relative and the module specifier is relative, ignore it + return preferences.relativePreference !== 1 /* NonRelative */ || !ts.pathIsRelative(specifier) ? + specifier : + undefined; + }); + }); if (existingSpecifier) { var moduleSpecifiers_2 = [existingSpecifier]; return moduleSpecifiers_2; @@ -118729,7 +119205,9 @@ var ts; */ function getAllModulePaths(importingFilePath, importedFileName, host, preferences, importedFilePath) { var _a; - if (importedFilePath === void 0) { importedFilePath = ts.toPath(importedFileName, host.getCurrentDirectory(), ts.hostGetCanonicalFileName(host)); } + if (importedFilePath === void 0) { + importedFilePath = ts.toPath(importedFileName, host.getCurrentDirectory(), ts.hostGetCanonicalFileName(host)); + } var cache = (_a = host.getModuleSpecifierCache) === null || _a === void 0 ? void 0 : _a.call(host); if (cache) { var cached = cache.get(importingFilePath, importedFilePath, preferences); @@ -118867,7 +119345,9 @@ var ts; MatchingMode[MatchingMode["Pattern"] = 2] = "Pattern"; })(MatchingMode || (MatchingMode = {})); function tryGetModuleNameFromExports(options, targetFilePath, packageDirectory, packageName, exports, conditions, mode) { - if (mode === void 0) { mode = 0 /* Exact */; } + if (mode === void 0) { + mode = 0 /* Exact */; + } if (typeof exports === "string") { var pathOrPattern = ts.getNormalizedAbsolutePath(ts.combinePaths(packageDirectory, exports), /*currentDirectory*/ undefined); var extensionSwappedTarget = ts.hasTSFileExtension(targetFilePath) ? ts.removeFileExtension(targetFilePath) + tryGetJSExtensionForFile(targetFilePath, options) : undefined; @@ -119511,7 +119991,9 @@ var ts; ts.noopFileWatcher = { close: ts.noop }; ts.returnNoopFileWatcher = function () { return ts.noopFileWatcher; }; function createWatchHost(system, reportWatchStatus) { - if (system === void 0) { system = ts.sys; } + if (system === void 0) { + system = ts.sys; + } var onWatchStatusChange = reportWatchStatus || createWatchStatusReporter(system); return { onWatchStatusChange: onWatchStatusChange, @@ -119544,7 +120026,9 @@ var ts; } ts.createWatchFactory = createWatchFactory; function createCompilerHostFromProgramHost(host, getCompilerOptions, directoryStructureHost) { - if (directoryStructureHost === void 0) { directoryStructureHost = host; } + if (directoryStructureHost === void 0) { + directoryStructureHost = host; + } var useCaseSensitiveFileNames = host.useCaseSensitiveFileNames(); var hostGetNewLine = ts.memoize(function () { return host.getNewLine(); }); return { @@ -119647,7 +120131,9 @@ var ts; * Creates the watch compiler host that can be extended with config file or root file names and options host */ function createWatchCompilerHost(system, createProgram, reportDiagnostic, reportWatchStatus) { - if (system === void 0) { system = ts.sys; } + if (system === void 0) { + system = ts.sys; + } var write = function (s) { return system.write(s + system.newLine); }; var result = createProgramHost(system, createProgram); ts.copyProperties(result, createWatchHost(system, reportWatchStatus)); @@ -119724,7 +120210,9 @@ var ts; } ts.readBuilderProgram = readBuilderProgram; function createIncrementalCompilerHost(options, system) { - if (system === void 0) { system = ts.sys; } + if (system === void 0) { + system = ts.sys; + } var host = ts.createCompilerHostWorker(options, /*setParentNodes*/ undefined, system); host.createHash = ts.maybeBind(system, system.createHash); host.disableUseFileVersionAsSignature = system.disableUseFileVersionAsSignature; @@ -120348,32 +120836,34 @@ var ts; }, flags, watchOptions, ts.WatchType.WildcardDirectory); } function updateExtendedConfigFilesWatches(forProjectPath, options, watchOptions, watchType) { - ts.updateSharedExtendedConfigFileWatcher(forProjectPath, options, sharedExtendedConfigFileWatchers || (sharedExtendedConfigFileWatchers = new ts.Map()), function (extendedConfigFileName, extendedConfigFilePath) { return watchFile(extendedConfigFileName, function (_fileName, eventKind) { - var _a; - updateCachedSystemWithFile(extendedConfigFileName, extendedConfigFilePath, eventKind); - // Update extended config cache - if (extendedConfigCache) - ts.cleanExtendedConfigCache(extendedConfigCache, extendedConfigFilePath, toPath); - // Update projects - var projects = (_a = sharedExtendedConfigFileWatchers.get(extendedConfigFilePath)) === null || _a === void 0 ? void 0 : _a.projects; - // If there are no referenced projects this extended config file watcher depend on ignore - if (!(projects === null || projects === void 0 ? void 0 : projects.size)) - return; - projects.forEach(function (projectPath) { - if (toPath(configFileName) === projectPath) { - // If this is the config file of the project, reload completely - reloadLevel = ts.ConfigFileProgramReloadLevel.Full; - } - else { - // Reload config for the referenced projects and remove the resolutions from referenced projects since the config file changed - var config = parsedConfigs === null || parsedConfigs === void 0 ? void 0 : parsedConfigs.get(projectPath); - if (config) - config.reloadLevel = ts.ConfigFileProgramReloadLevel.Full; - resolutionCache.removeResolutionsFromProjectReferenceRedirects(projectPath); - } - scheduleProgramUpdate(); - }); - }, ts.PollingInterval.High, watchOptions, watchType); }, toPath); + ts.updateSharedExtendedConfigFileWatcher(forProjectPath, options, sharedExtendedConfigFileWatchers || (sharedExtendedConfigFileWatchers = new ts.Map()), function (extendedConfigFileName, extendedConfigFilePath) { + return watchFile(extendedConfigFileName, function (_fileName, eventKind) { + var _a; + updateCachedSystemWithFile(extendedConfigFileName, extendedConfigFilePath, eventKind); + // Update extended config cache + if (extendedConfigCache) + ts.cleanExtendedConfigCache(extendedConfigCache, extendedConfigFilePath, toPath); + // Update projects + var projects = (_a = sharedExtendedConfigFileWatchers.get(extendedConfigFilePath)) === null || _a === void 0 ? void 0 : _a.projects; + // If there are no referenced projects this extended config file watcher depend on ignore + if (!(projects === null || projects === void 0 ? void 0 : projects.size)) + return; + projects.forEach(function (projectPath) { + if (toPath(configFileName) === projectPath) { + // If this is the config file of the project, reload completely + reloadLevel = ts.ConfigFileProgramReloadLevel.Full; + } + else { + // Reload config for the referenced projects and remove the resolutions from referenced projects since the config file changed + var config = parsedConfigs === null || parsedConfigs === void 0 ? void 0 : parsedConfigs.get(projectPath); + if (config) + config.reloadLevel = ts.ConfigFileProgramReloadLevel.Full; + resolutionCache.removeResolutionsFromProjectReferenceRedirects(projectPath); + } + scheduleProgramUpdate(); + }); + }, ts.PollingInterval.High, watchOptions, watchType); + }, toPath); } function watchReferencedProject(configFileName, configPath, commandLine) { var _a, _b, _c, _d, _e; @@ -120544,14 +121034,18 @@ var ts; return host; } function createSolutionBuilderHost(system, createProgram, reportDiagnostic, reportSolutionBuilderStatus, reportErrorSummary) { - if (system === void 0) { system = ts.sys; } + if (system === void 0) { + system = ts.sys; + } var host = createSolutionBuilderHostBase(system, createProgram, reportDiagnostic, reportSolutionBuilderStatus); host.reportErrorSummary = reportErrorSummary; return host; } ts.createSolutionBuilderHost = createSolutionBuilderHost; function createSolutionBuilderWithWatchHost(system, createProgram, reportDiagnostic, reportSolutionBuilderStatus, reportWatchStatus) { - if (system === void 0) { system = ts.sys; } + if (system === void 0) { + system = ts.sys; + } var host = createSolutionBuilderHostBase(system, createProgram, reportDiagnostic, reportSolutionBuilderStatus); var watchHost = ts.createWatchHost(system, reportWatchStatus); ts.copyProperties(host, watchHost); @@ -121782,33 +122276,37 @@ var ts; }, ts.PollingInterval.High, parsed === null || parsed === void 0 ? void 0 : parsed.watchOptions, ts.WatchType.ConfigFile, resolved)); } function watchExtendedConfigFiles(state, resolvedPath, parsed) { - ts.updateSharedExtendedConfigFileWatcher(resolvedPath, parsed === null || parsed === void 0 ? void 0 : parsed.options, state.allWatchedExtendedConfigFiles, function (extendedConfigFileName, extendedConfigFilePath) { return state.watchFile(extendedConfigFileName, function () { - var _a; - return (_a = state.allWatchedExtendedConfigFiles.get(extendedConfigFilePath)) === null || _a === void 0 ? void 0 : _a.projects.forEach(function (projectConfigFilePath) { - return invalidateProjectAndScheduleBuilds(state, projectConfigFilePath, ts.ConfigFileProgramReloadLevel.Full); - }); - }, ts.PollingInterval.High, parsed === null || parsed === void 0 ? void 0 : parsed.watchOptions, ts.WatchType.ExtendedConfigFile); }, function (fileName) { return toPath(state, fileName); }); + ts.updateSharedExtendedConfigFileWatcher(resolvedPath, parsed === null || parsed === void 0 ? void 0 : parsed.options, state.allWatchedExtendedConfigFiles, function (extendedConfigFileName, extendedConfigFilePath) { + return state.watchFile(extendedConfigFileName, function () { + var _a; + return (_a = state.allWatchedExtendedConfigFiles.get(extendedConfigFilePath)) === null || _a === void 0 ? void 0 : _a.projects.forEach(function (projectConfigFilePath) { + return invalidateProjectAndScheduleBuilds(state, projectConfigFilePath, ts.ConfigFileProgramReloadLevel.Full); + }); + }, ts.PollingInterval.High, parsed === null || parsed === void 0 ? void 0 : parsed.watchOptions, ts.WatchType.ExtendedConfigFile); + }, function (fileName) { return toPath(state, fileName); }); } function watchWildCardDirectories(state, resolved, resolvedPath, parsed) { if (!state.watch) return; - ts.updateWatchingWildcardDirectories(getOrCreateValueMapFromConfigFileMap(state.allWatchedWildcardDirectories, resolvedPath), new ts.Map(ts.getEntries(parsed.wildcardDirectories)), function (dir, flags) { return state.watchDirectory(dir, function (fileOrDirectory) { - var _a; - if (ts.isIgnoredFileFromWildCardWatching({ - watchedDirPath: toPath(state, dir), - fileOrDirectory: fileOrDirectory, - fileOrDirectoryPath: toPath(state, fileOrDirectory), - configFileName: resolved, - currentDirectory: state.currentDirectory, - options: parsed.options, - program: state.builderPrograms.get(resolvedPath) || ((_a = getCachedParsedConfigFile(state, resolvedPath)) === null || _a === void 0 ? void 0 : _a.fileNames), - useCaseSensitiveFileNames: state.parseConfigFileHost.useCaseSensitiveFileNames, - writeLog: function (s) { return state.writeLog(s); }, - toPath: function (fileName) { return toPath(state, fileName); } - })) - return; - invalidateProjectAndScheduleBuilds(state, resolvedPath, ts.ConfigFileProgramReloadLevel.Partial); - }, flags, parsed === null || parsed === void 0 ? void 0 : parsed.watchOptions, ts.WatchType.WildcardDirectory, resolved); }); + ts.updateWatchingWildcardDirectories(getOrCreateValueMapFromConfigFileMap(state.allWatchedWildcardDirectories, resolvedPath), new ts.Map(ts.getEntries(parsed.wildcardDirectories)), function (dir, flags) { + return state.watchDirectory(dir, function (fileOrDirectory) { + var _a; + if (ts.isIgnoredFileFromWildCardWatching({ + watchedDirPath: toPath(state, dir), + fileOrDirectory: fileOrDirectory, + fileOrDirectoryPath: toPath(state, fileOrDirectory), + configFileName: resolved, + currentDirectory: state.currentDirectory, + options: parsed.options, + program: state.builderPrograms.get(resolvedPath) || ((_a = getCachedParsedConfigFile(state, resolvedPath)) === null || _a === void 0 ? void 0 : _a.fileNames), + useCaseSensitiveFileNames: state.parseConfigFileHost.useCaseSensitiveFileNames, + writeLog: function (s) { return state.writeLog(s); }, + toPath: function (fileName) { return toPath(state, fileName); } + })) + return; + invalidateProjectAndScheduleBuilds(state, resolvedPath, ts.ConfigFileProgramReloadLevel.Partial); + }, flags, parsed === null || parsed === void 0 ? void 0 : parsed.watchOptions, ts.WatchType.WildcardDirectory, resolved); + }); } function watchInputFiles(state, resolved, resolvedPath, parsed) { if (!state.watch) @@ -122918,38 +123416,62 @@ var ts; return false; } function isCallExpressionTarget(node, includeElementAccess, skipPastOuterExpressions) { - if (includeElementAccess === void 0) { includeElementAccess = false; } - if (skipPastOuterExpressions === void 0) { skipPastOuterExpressions = false; } + if (includeElementAccess === void 0) { + includeElementAccess = false; + } + if (skipPastOuterExpressions === void 0) { + skipPastOuterExpressions = false; + } return isCalleeWorker(node, ts.isCallExpression, selectExpressionOfCallOrNewExpressionOrDecorator, includeElementAccess, skipPastOuterExpressions); } ts.isCallExpressionTarget = isCallExpressionTarget; function isNewExpressionTarget(node, includeElementAccess, skipPastOuterExpressions) { - if (includeElementAccess === void 0) { includeElementAccess = false; } - if (skipPastOuterExpressions === void 0) { skipPastOuterExpressions = false; } + if (includeElementAccess === void 0) { + includeElementAccess = false; + } + if (skipPastOuterExpressions === void 0) { + skipPastOuterExpressions = false; + } return isCalleeWorker(node, ts.isNewExpression, selectExpressionOfCallOrNewExpressionOrDecorator, includeElementAccess, skipPastOuterExpressions); } ts.isNewExpressionTarget = isNewExpressionTarget; function isCallOrNewExpressionTarget(node, includeElementAccess, skipPastOuterExpressions) { - if (includeElementAccess === void 0) { includeElementAccess = false; } - if (skipPastOuterExpressions === void 0) { skipPastOuterExpressions = false; } + if (includeElementAccess === void 0) { + includeElementAccess = false; + } + if (skipPastOuterExpressions === void 0) { + skipPastOuterExpressions = false; + } return isCalleeWorker(node, ts.isCallOrNewExpression, selectExpressionOfCallOrNewExpressionOrDecorator, includeElementAccess, skipPastOuterExpressions); } ts.isCallOrNewExpressionTarget = isCallOrNewExpressionTarget; function isTaggedTemplateTag(node, includeElementAccess, skipPastOuterExpressions) { - if (includeElementAccess === void 0) { includeElementAccess = false; } - if (skipPastOuterExpressions === void 0) { skipPastOuterExpressions = false; } + if (includeElementAccess === void 0) { + includeElementAccess = false; + } + if (skipPastOuterExpressions === void 0) { + skipPastOuterExpressions = false; + } return isCalleeWorker(node, ts.isTaggedTemplateExpression, selectTagOfTaggedTemplateExpression, includeElementAccess, skipPastOuterExpressions); } ts.isTaggedTemplateTag = isTaggedTemplateTag; function isDecoratorTarget(node, includeElementAccess, skipPastOuterExpressions) { - if (includeElementAccess === void 0) { includeElementAccess = false; } - if (skipPastOuterExpressions === void 0) { skipPastOuterExpressions = false; } + if (includeElementAccess === void 0) { + includeElementAccess = false; + } + if (skipPastOuterExpressions === void 0) { + skipPastOuterExpressions = false; + } return isCalleeWorker(node, ts.isDecorator, selectExpressionOfCallOrNewExpressionOrDecorator, includeElementAccess, skipPastOuterExpressions); } ts.isDecoratorTarget = isDecoratorTarget; function isJsxOpeningLikeElementTagName(node, includeElementAccess, skipPastOuterExpressions) { - if (includeElementAccess === void 0) { includeElementAccess = false; } - if (skipPastOuterExpressions === void 0) { skipPastOuterExpressions = false; } + if (includeElementAccess === void 0) { + includeElementAccess = false; + } + if (skipPastOuterExpressions === void 0) { + skipPastOuterExpressions = false; + } return isCalleeWorker(node, ts.isJsxOpeningLikeElement, selectTagNameOfJsxOpeningLikeElement, includeElementAccess, skipPastOuterExpressions); } ts.isJsxOpeningLikeElementTagName = isJsxOpeningLikeElementTagName; @@ -124023,7 +124545,9 @@ var ts; } } function isInString(sourceFile, position, previousToken) { - if (previousToken === void 0) { previousToken = findPrecedingToken(position, sourceFile); } + if (previousToken === void 0) { + previousToken = findPrecedingToken(position, sourceFile); + } if (previousToken && ts.isStringTextContainingNode(previousToken)) { var start = previousToken.getStart(sourceFile); var end = previousToken.getEnd(); @@ -124295,7 +124819,9 @@ var ts; return n.kind === 1 /* EndOfFileToken */ ? !!n.jsDoc : n.getWidth(sourceFile) !== 0; } function getNodeModifiers(node, excludeFlags) { - if (excludeFlags === void 0) { excludeFlags = 0 /* None */; } + if (excludeFlags === void 0) { + excludeFlags = 0 /* None */; + } var result = []; var flags = ts.isDeclaration(node) ? ts.getCombinedNodeFlagsAlwaysIncludeJSDoc(node) & ~excludeFlags @@ -125005,21 +125531,27 @@ var ts; } ts.mapToDisplayParts = mapToDisplayParts; function typeToDisplayParts(typechecker, type, enclosingDeclaration, flags) { - if (flags === void 0) { flags = 0 /* None */; } + if (flags === void 0) { + flags = 0 /* None */; + } return mapToDisplayParts(function (writer) { typechecker.writeType(type, enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */ | 16384 /* UseAliasDefinedOutsideCurrentScope */, writer); }); } ts.typeToDisplayParts = typeToDisplayParts; function symbolToDisplayParts(typeChecker, symbol, enclosingDeclaration, meaning, flags) { - if (flags === void 0) { flags = 0 /* None */; } + if (flags === void 0) { + flags = 0 /* None */; + } return mapToDisplayParts(function (writer) { typeChecker.writeSymbol(symbol, enclosingDeclaration, meaning, flags | 8 /* UseAliasDefinedOutsideCurrentScope */, writer); }); } ts.symbolToDisplayParts = symbolToDisplayParts; function signatureToDisplayParts(typechecker, signature, enclosingDeclaration, flags) { - if (flags === void 0) { flags = 0 /* None */; } + if (flags === void 0) { + flags = 0 /* None */; + } flags |= 16384 /* UseAliasDefinedOutsideCurrentScope */ | 1024 /* MultilineObjectLiterals */ | 32 /* WriteTypeArgumentsOfSignature */ | 8192 /* OmitParameterModifiers */; return mapToDisplayParts(function (writer) { typechecker.writeSignature(signature, enclosingDeclaration, flags, /*signatureKind*/ undefined, writer); @@ -125080,7 +125612,9 @@ var ts; * and code fixes (because those are triggered by explicit user actions). */ function getSynthesizedDeepClone(node, includeTrivia) { - if (includeTrivia === void 0) { includeTrivia = true; } + if (includeTrivia === void 0) { + includeTrivia = true; + } var clone = node && getSynthesizedDeepCloneWorker(node); if (clone && !includeTrivia) suppressLeadingAndTrailingTrivia(clone); @@ -125122,7 +125656,9 @@ var ts; return visited; } function getSynthesizedDeepClones(nodes, includeTrivia) { - if (includeTrivia === void 0) { includeTrivia = true; } + if (includeTrivia === void 0) { + includeTrivia = true; + } return nodes && ts.factory.createNodeArray(nodes.map(function (n) { return getSynthesizedDeepClone(n, includeTrivia); }), nodes.hasTrailingComma); } ts.getSynthesizedDeepClones = getSynthesizedDeepClones; @@ -125572,7 +126108,9 @@ var ts; return !!get(dependencyName, inGroups); } }); function get(dependencyName, inGroups) { - if (inGroups === void 0) { inGroups = 15 /* All */; } + if (inGroups === void 0) { + inGroups = 15 /* All */; + } for (var _i = 0, dependencyGroups_1 = dependencyGroups; _i < dependencyGroups_1.length; _i++) { var _a = dependencyGroups_1[_i], group_1 = _a[0], deps = _a[1]; if (deps && (inGroups & group_1)) { @@ -125752,7 +126290,9 @@ var ts; } ts.getFixableErrorSpanExpression = getFixableErrorSpanExpression; function mapOneOrMany(valueOrArray, f, resultSelector) { - if (resultSelector === void 0) { resultSelector = ts.identity; } + if (resultSelector === void 0) { + resultSelector = ts.identity; + } return valueOrArray ? ts.isArray(valueOrArray) ? resultSelector(ts.map(valueOrArray, f)) : f(valueOrArray, 0) : undefined; } ts.mapOneOrMany = mapOneOrMany; @@ -127477,13 +128017,15 @@ var ts; return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: completion.hasIndexSignature, optionalReplacementSpan: optionalReplacementSpan, entries: entries }; } case 2 /* Types */: { - var entries = completion.types.map(function (type) { return ({ - name: type.value, - kindModifiers: "" /* none */, - kind: "string" /* string */, - sortText: Completions.SortText.LocationPriority, - replacementSpan: ts.getReplacementSpanForContextToken(contextToken) - }); }); + var entries = completion.types.map(function (type) { + return ({ + name: type.value, + kindModifiers: "" /* none */, + kind: "string" /* string */, + sortText: Completions.SortText.LocationPriority, + replacementSpan: ts.getReplacementSpanForContextToken(contextToken) + }); + }); return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: completion.isNewIdentifier, optionalReplacementSpan: optionalReplacementSpan, entries: entries }; } default: @@ -127696,7 +128238,9 @@ var ts; }; } function getStringLiteralTypes(type, uniques) { - if (uniques === void 0) { uniques = new ts.Map(); } + if (uniques === void 0) { + uniques = new ts.Map(); + } if (!type) return ts.emptyArray; type = ts.skipConstraint(type); @@ -127733,7 +128277,9 @@ var ts; } } function getExtensionOptions(compilerOptions, includeExtensionsOption) { - if (includeExtensionsOption === void 0) { includeExtensionsOption = 0 /* Exclude */; } + if (includeExtensionsOption === void 0) { + includeExtensionsOption = 0 /* Exclude */; + } return { extensions: ts.flatten(getSupportedExtensionsForModuleResolution(compilerOptions)), includeExtensionsOption: includeExtensionsOption }; } function getCompletionEntriesForRelativeModules(literalValue, scriptDirectory, compilerOptions, host, scriptPath, includeExtensions) { @@ -127782,7 +128328,9 @@ var ts; */ function getCompletionEntriesForDirectoryFragment(fragment, scriptPath, _a, host, exclude, result) { var extensions = _a.extensions, includeExtensionsOption = _a.includeExtensionsOption; - if (result === void 0) { result = []; } + if (result === void 0) { + result = []; + } if (fragment === undefined) { fragment = ""; } @@ -128033,7 +128581,9 @@ var ts; return addReplacementSpans(toComplete, range.pos + prefix.length, names); } function getCompletionEntriesFromTypings(host, options, scriptPath, fragmentDirectory, extensionOptions, result) { - if (result === void 0) { result = []; } + if (result === void 0) { + result = []; + } // Check for typings specified in compiler options var seen = new ts.Map(); var typeRoots = ts.tryAndIgnoreErrors(function () { return ts.getEffectiveTypeRoots(options, host); }) || ts.emptyArray; @@ -131256,7 +131806,9 @@ var ts; ; /** True if symbol is a type or a module containing at least one type. */ function symbolCanBeReferencedAtTypeLocation(symbol, checker, seenModules) { - if (seenModules === void 0) { seenModules = new ts.Map(); } + if (seenModules === void 0) { + seenModules = new ts.Map(); + } var sym = ts.skipAlias(symbol.exportSymbol || symbol, checker); return !!(sym.flags & 788968 /* Type */) || checker.isUnknownSymbol(sym) || !!(sym.flags & 1536 /* Module */) && ts.addToSeen(seenModules, ts.getSymbolId(sym)) && @@ -131415,9 +131967,11 @@ var ts; : undefined; } function getFromAllDeclarations(nodeTest, keywords) { - return useParent(node.parent, nodeTest, function (decl) { return ts.mapDefined(decl.symbol.declarations, function (d) { - return nodeTest(d) ? ts.find(d.getChildren(sourceFile), function (c) { return ts.contains(keywords, c.kind); }) : undefined; - }); }); + return useParent(node.parent, nodeTest, function (decl) { + return ts.mapDefined(decl.symbol.declarations, function (d) { + return nodeTest(d) ? ts.find(d.getChildren(sourceFile), function (c) { return ts.contains(keywords, c.kind); }) : undefined; + }); + }); } function useParent(node, nodeTest, getNodes) { return nodeTest(node) ? highlightSpans(getNodes(node, sourceFile)) : undefined; @@ -131770,7 +132324,9 @@ var ts; ts.createDocumentRegistry = createDocumentRegistry; /*@internal*/ function createDocumentRegistryInternal(useCaseSensitiveFileNames, currentDirectory, externalCache) { - if (currentDirectory === void 0) { currentDirectory = ""; } + if (currentDirectory === void 0) { + currentDirectory = ""; + } // Maps from compiler setting target (ES3, ES5, etc.) to all the cached documents we have // for those settings. var buckets = new ts.Map(); @@ -132060,7 +132616,9 @@ var ts; addIndirectUser(top, /** addTransitiveDependencies */ !!isExported(importCall, /** stopAtAmbientModule */ true)); } function isExported(node, stopAtAmbientModule) { - if (stopAtAmbientModule === void 0) { stopAtAmbientModule = false; } + if (stopAtAmbientModule === void 0) { + stopAtAmbientModule = false; + } return ts.findAncestor(node, function (node) { if (stopAtAmbientModule && isAmbientModuleDeclaration(node)) return "quit"; @@ -132086,7 +132644,9 @@ var ts; } /** Adds a module and all of its transitive dependencies as possible indirect users. */ function addIndirectUser(sourceFileLike, addTransitiveDependencies) { - if (addTransitiveDependencies === void 0) { addTransitiveDependencies = false; } + if (addTransitiveDependencies === void 0) { + addTransitiveDependencies = false; + } ts.Debug.assert(!isAvailableThroughGlobal); var isNew = markSeenIndirectUser(sourceFileLike); if (!isNew) @@ -132569,7 +133129,9 @@ var ts; EntryKind[EntryKind["SearchedPropertyFoundLocal"] = 4] = "SearchedPropertyFoundLocal"; })(EntryKind = FindAllReferences.EntryKind || (FindAllReferences.EntryKind = {})); function nodeEntry(node, kind) { - if (kind === void 0) { kind = 1 /* Node */; } + if (kind === void 0) { + kind = 1 /* Node */; + } return { kind: kind, node: node.name || node, @@ -132785,8 +133347,12 @@ var ts; } FindAllReferences.findReferenceOrRenameEntries = findReferenceOrRenameEntries; function getReferenceEntriesForNode(position, node, program, sourceFiles, cancellationToken, options, sourceFilesSet) { - if (options === void 0) { options = {}; } - if (sourceFilesSet === void 0) { sourceFilesSet = new ts.Set(sourceFiles.map(function (f) { return f.fileName; })); } + if (options === void 0) { + options = {}; + } + if (sourceFilesSet === void 0) { + sourceFilesSet = new ts.Set(sourceFiles.map(function (f) { return f.fileName; })); + } return flattenEntries(Core.getReferencedSymbolsForNode(position, node, program, sourceFiles, cancellationToken, options, sourceFilesSet)); } FindAllReferences.getReferenceEntriesForNode = getReferenceEntriesForNode; @@ -133060,8 +133626,12 @@ var ts; /** Core find-all-references algorithm. Handles special cases before delegating to `getReferencedSymbolsForSymbol`. */ function getReferencedSymbolsForNode(position, node, program, sourceFiles, cancellationToken, options, sourceFilesSet) { var _a, _b; - if (options === void 0) { options = {}; } - if (sourceFilesSet === void 0) { sourceFilesSet = new ts.Set(sourceFiles.map(function (f) { return f.fileName; })); } + if (options === void 0) { + options = {}; + } + if (sourceFilesSet === void 0) { + sourceFilesSet = new ts.Set(sourceFiles.map(function (f) { return f.fileName; })); + } if (options.use === 1 /* References */) { node = ts.getAdjustedReferenceLocation(node); } @@ -133130,7 +133700,9 @@ var ts; Core.getReferencedSymbolsForNode = getReferencedSymbolsForNode; function getReferencesForFileName(fileName, program, sourceFiles, sourceFilesSet) { var _a, _b; - if (sourceFilesSet === void 0) { sourceFilesSet = new ts.Set(sourceFiles.map(function (f) { return f.fileName; })); } + if (sourceFilesSet === void 0) { + sourceFilesSet = new ts.Set(sourceFiles.map(function (f) { return f.fileName; })); + } var moduleSymbol = (_a = program.getSourceFile(fileName)) === null || _a === void 0 ? void 0 : _a.symbol; if (moduleSymbol) { return ((_b = getReferencedSymbolsForModule(program, moduleSymbol, /*excludeImportTypeOfExportEquals*/ false, sourceFiles, sourceFilesSet)[0]) === null || _b === void 0 ? void 0 : _b.references) || ts.emptyArray; @@ -133206,9 +133778,11 @@ var ts; return "continue"; } var symbol = entry.definition.symbol; - var refIndex = ts.findIndex(result, function (ref) { return !!ref.definition && - ref.definition.type === 0 /* Symbol */ && - ref.definition.symbol === symbol; }); + var refIndex = ts.findIndex(result, function (ref) { + return !!ref.definition && + ref.definition.type === 0 /* Symbol */ && + ref.definition.symbol === symbol; + }); if (refIndex === -1) { result.push(entry); return "continue"; @@ -133479,7 +134053,9 @@ var ts; }; /** @param allSearchSymbols set of additional symbols for use by `includes`. */ State.prototype.createSearch = function (location, symbol, comingFrom, searchOptions) { - if (searchOptions === void 0) { searchOptions = {}; } + if (searchOptions === void 0) { + searchOptions = {}; + } // Note: if this is an external module symbol, the name doesn't include quotes. // Note: getLocalSymbolForExportDefault handles `export default class C {}`, but not `export default C` or `export { C as default }`. // The other two forms seem to be handled downstream (e.g. in `skipPastExportOrImportSpecifier`), so special-casing the first form @@ -133687,12 +134263,16 @@ var ts; } /** Used as a quick check for whether a symbol is used at all in a file (besides its definition). */ function isSymbolReferencedInFile(definition, checker, sourceFile, searchContainer) { - if (searchContainer === void 0) { searchContainer = sourceFile; } + if (searchContainer === void 0) { + searchContainer = sourceFile; + } return eachSymbolReferenceInFile(definition, checker, sourceFile, function () { return true; }, searchContainer) || false; } Core.isSymbolReferencedInFile = isSymbolReferencedInFile; function eachSymbolReferenceInFile(definition, checker, sourceFile, cb, searchContainer) { - if (searchContainer === void 0) { searchContainer = sourceFile; } + if (searchContainer === void 0) { + searchContainer = sourceFile; + } var symbol = ts.isParameterPropertyDeclaration(definition.parent, definition.parent.parent) ? ts.first(checker.getSymbolsOfParameterPropertyDeclaration(definition.parent, definition.text)) : checker.getSymbolAtLocation(definition); @@ -133737,11 +134317,15 @@ var ts; } Core.someSignatureUsage = someSignatureUsage; function getPossibleSymbolReferenceNodes(sourceFile, symbolName, container) { - if (container === void 0) { container = sourceFile; } + if (container === void 0) { + container = sourceFile; + } return getPossibleSymbolReferencePositions(sourceFile, symbolName, container).map(function (pos) { return ts.getTouchingPropertyName(sourceFile, pos); }); } function getPossibleSymbolReferencePositions(sourceFile, symbolName, container) { - if (container === void 0) { container = sourceFile; } + if (container === void 0) { + container = sourceFile; + } var positions = []; /// TODO: Cache symbol existence for files to save text search // Also, need to make this work for unicode escapes. @@ -133814,7 +134398,9 @@ var ts; return references.length ? [{ definition: { type: 2 /* Keyword */, node: references[0].node }, references: references }] : undefined; } function getReferencesInSourceFile(sourceFile, search, state, addReferencesHere) { - if (addReferencesHere === void 0) { addReferencesHere = true; } + if (addReferencesHere === void 0) { + addReferencesHere = true; + } state.cancellationToken.throwIfCancellationRequested(); return getReferencesInContainer(sourceFile, sourceFile, search, state, addReferencesHere); } @@ -134488,12 +135074,14 @@ var ts; // } if (!(symbol.flags & (32 /* Class */ | 64 /* Interface */)) || !ts.addToSeen(seen, ts.getSymbolId(symbol))) return; - return ts.firstDefined(symbol.declarations, function (declaration) { return ts.firstDefined(ts.getAllSuperTypeNodes(declaration), function (typeReference) { - var type = checker.getTypeAtLocation(typeReference); - var propertySymbol = type && type.symbol && checker.getPropertyOfType(type, propertyName); - // Visit the typeReference as well to see if it directly or indirectly uses that property - return type && propertySymbol && (ts.firstDefined(checker.getRootSymbols(propertySymbol), cb) || recur(type.symbol)); - }); }); + return ts.firstDefined(symbol.declarations, function (declaration) { + return ts.firstDefined(ts.getAllSuperTypeNodes(declaration), function (typeReference) { + var type = checker.getTypeAtLocation(typeReference); + var propertySymbol = type && type.symbol && checker.getPropertyOfType(type, propertyName); + // Visit the typeReference as well to see if it directly or indirectly uses that property + return type && propertySymbol && (ts.firstDefined(checker.getRootSymbols(propertySymbol), cb) || recur(type.symbol)); + }); + }); } } function isStaticSymbol(symbol) { @@ -135648,7 +136236,7 @@ var ts; var name = ts.getNameOfDeclaration(declaration) || declaration; textSpan = ts.createTextSpanFromNode(name, sourceFile); } - return __assign(__assign({ fileName: sourceFile.fileName, textSpan: textSpan, kind: symbolKind, name: symbolName, containerKind: undefined, // TODO: GH#18217 + return __assign(__assign({ fileName: sourceFile.fileName, textSpan: textSpan, kind: symbolKind, name: symbolName, containerKind: undefined, containerName: containerName }, ts.FindAllReferences.toContextSpan(textSpan, sourceFile, ts.FindAllReferences.getContextNode(declaration))), { isLocal: !isDefinitionVisible(checker, declaration) }); } function isDefinitionVisible(checker, declaration) { @@ -137873,17 +138461,27 @@ var ts; return createOutliningSpanFromBounds(node.getStart(sourceFile), node.getEnd(), "code" /* Code */); } function spanForObjectOrArrayLiteral(node, open) { - if (open === void 0) { open = 18 /* OpenBraceToken */; } + if (open === void 0) { + open = 18 /* OpenBraceToken */; + } // If the block has no leading keywords and is inside an array literal or call expression, // we only want to collapse the span of the block. // Otherwise, the collapsed section will include the end of the previous line. return spanForNode(node, /*autoCollapse*/ false, /*useFullStart*/ !ts.isArrayLiteralExpression(node.parent) && !ts.isCallExpression(node.parent), open); } function spanForNode(hintSpanNode, autoCollapse, useFullStart, open, close) { - if (autoCollapse === void 0) { autoCollapse = false; } - if (useFullStart === void 0) { useFullStart = true; } - if (open === void 0) { open = 18 /* OpenBraceToken */; } - if (close === void 0) { close = open === 18 /* OpenBraceToken */ ? 19 /* CloseBraceToken */ : 23 /* CloseBracketToken */; } + if (autoCollapse === void 0) { + autoCollapse = false; + } + if (useFullStart === void 0) { + useFullStart = true; + } + if (open === void 0) { + open = 18 /* OpenBraceToken */; + } + if (close === void 0) { + close = open === 18 /* OpenBraceToken */ ? 19 /* CloseBraceToken */ : 23 /* CloseBracketToken */; + } var openToken = ts.findChildOfKind(n, open, sourceFile); var closeToken = ts.findChildOfKind(n, close, sourceFile); return openToken && closeToken && spanBetweenTokens(openToken, closeToken, hintSpanNode, sourceFile, autoCollapse, useFullStart); @@ -137898,15 +138496,25 @@ var ts; return openToken && closeToken && spanBetweenTokens(openToken, closeToken, node, sourceFile, /*autoCollapse*/ node.kind !== 213 /* ArrowFunction */); } function spanBetweenTokens(openToken, closeToken, hintSpanNode, sourceFile, autoCollapse, useFullStart) { - if (autoCollapse === void 0) { autoCollapse = false; } - if (useFullStart === void 0) { useFullStart = true; } + if (autoCollapse === void 0) { + autoCollapse = false; + } + if (useFullStart === void 0) { + useFullStart = true; + } var textSpan = ts.createTextSpanFromBounds(useFullStart ? openToken.getFullStart() : openToken.getStart(sourceFile), closeToken.getEnd()); return createOutliningSpan(textSpan, "code" /* Code */, ts.createTextSpanFromNode(hintSpanNode, sourceFile), autoCollapse); } function createOutliningSpan(textSpan, kind, hintSpan, autoCollapse, bannerText) { - if (hintSpan === void 0) { hintSpan = textSpan; } - if (autoCollapse === void 0) { autoCollapse = false; } - if (bannerText === void 0) { bannerText = "..."; } + if (hintSpan === void 0) { + hintSpan = textSpan; + } + if (autoCollapse === void 0) { + autoCollapse = false; + } + if (bannerText === void 0) { + bannerText = "..."; + } return { textSpan: textSpan, kind: kind, hintSpan: hintSpan, bannerText: bannerText, autoCollapse: autoCollapse }; } function tryGetFunctionOpenToken(node, body, sourceFile) { @@ -138098,7 +138706,9 @@ var ts; : ts.compareValues(a.kind, b.kind) || ts.compareBooleans(!a.isCaseSensitive, !b.isCaseSensitive); } function partStartsWith(candidate, candidateSpan, pattern, ignoreCase, patternSpan) { - if (patternSpan === void 0) { patternSpan = { start: 0, length: pattern.length }; } + if (patternSpan === void 0) { + patternSpan = { start: 0, length: pattern.length }; + } return patternSpan.length <= candidateSpan.length // If pattern part is longer than the candidate part there can never be a match. && everyInRange(0, patternSpan.length, function (i) { return equalChars(pattern.charCodeAt(patternSpan.start + i), candidate.charCodeAt(candidateSpan.start + i), ignoreCase); }); } @@ -138374,16 +138984,24 @@ var ts; return true; } function every(s, pred, start, end) { - if (start === void 0) { start = 0; } - if (end === void 0) { end = s.length; } + if (start === void 0) { + start = 0; + } + if (end === void 0) { + end = s.length; + } return everyInRange(start, end, function (i) { return pred(s.charCodeAt(i), i); }); } })(ts || (ts = {})); var ts; (function (ts) { function preProcessFile(sourceText, readImportFiles, detectJavaScriptImports) { - if (readImportFiles === void 0) { readImportFiles = true; } - if (detectJavaScriptImports === void 0) { detectJavaScriptImports = false; } + if (readImportFiles === void 0) { + readImportFiles = true; + } + if (detectJavaScriptImports === void 0) { + detectJavaScriptImports = false; + } var pragmaContext = { languageVersion: 1 /* ES5 */, pragmas: undefined, @@ -138623,7 +139241,9 @@ var ts; return false; } function tryConsumeRequireCall(skipCurrentToken, allowTemplateLiterals) { - if (allowTemplateLiterals === void 0) { allowTemplateLiterals = false; } + if (allowTemplateLiterals === void 0) { + allowTemplateLiterals = false; + } var token = skipCurrentToken ? nextToken() : ts.scanner.getToken(); if (token === 145 /* RequireKeyword */) { token = nextToken(); @@ -139116,7 +139736,9 @@ var ts; * child rather than be included in the right-hand group. */ function splitChildren(children, pivotOn, separateTrailingSemicolon) { - if (separateTrailingSemicolon === void 0) { separateTrailingSemicolon = true; } + if (separateTrailingSemicolon === void 0) { + separateTrailingSemicolon = true; + } if (children.length < 2) { return children; } @@ -139275,8 +139897,10 @@ var ts; var type = declaration.symbol && typeChecker.getTypeOfSymbolAtLocation(declaration.symbol, declaration); var callSignatures = type && type.getCallSignatures(); if (callSignatures && callSignatures.length) { - return typeChecker.runWithCancellationToken(cancellationToken, function (typeChecker) { return createSignatureHelpItems(callSignatures, callSignatures[0], argumentInfo, sourceFile, typeChecker, - /*useFullPrefix*/ true); }); + return typeChecker.runWithCancellationToken(cancellationToken, function (typeChecker) { + return createSignatureHelpItems(callSignatures, callSignatures[0], argumentInfo, sourceFile, typeChecker, + /*useFullPrefix*/ true); + }); } }); }); @@ -139728,12 +140352,14 @@ var ts; var isVariadic = !checker.hasEffectiveRestParameter(candidateSignature) ? function (_) { return false; } : lists.length === 1 ? function (_) { return true; } : function (pList) { return !!(pList.length && pList[pList.length - 1].checkFlags & 32768 /* RestParameter */); }; - return lists.map(function (parameterList) { return ({ - isVariadic: isVariadic(parameterList), - parameters: parameterList.map(function (p) { return createSignatureHelpParameterForParameter(p, checker, enclosingDeclaration, sourceFile, printer); }), - prefix: __spreadArray(__spreadArray([], typeParameterParts, true), [ts.punctuationPart(20 /* OpenParenToken */)], false), - suffix: [ts.punctuationPart(21 /* CloseParenToken */)] - }); }); + return lists.map(function (parameterList) { + return ({ + isVariadic: isVariadic(parameterList), + parameters: parameterList.map(function (p) { return createSignatureHelpParameterForParameter(p, checker, enclosingDeclaration, sourceFile, printer); }), + prefix: __spreadArray(__spreadArray([], typeParameterParts, true), [ts.punctuationPart(20 /* OpenParenToken */)], false), + suffix: [ts.punctuationPart(21 /* CloseParenToken */)] + }); + }); } function createSignatureHelpParameterForParameter(parameter, checker, enclosingDeclaration, sourceFile, printer) { var displayParts = ts.mapToDisplayParts(function (writer) { @@ -140550,7 +141176,9 @@ var ts; // TODO(drosen): Currently completion entry details passes the SemanticMeaning.All instead of using semanticMeaning of location function getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, enclosingDeclaration, location, semanticMeaning, alias) { var _a; - if (semanticMeaning === void 0) { semanticMeaning = ts.getMeaningFromLocation(location); } + if (semanticMeaning === void 0) { + semanticMeaning = ts.getMeaningFromLocation(location); + } var displayParts = []; var documentation = []; var tags = []; @@ -141023,7 +141651,9 @@ var ts; } } function addSignatureDisplayParts(signature, allSignatures, flags) { - if (flags === void 0) { flags = 0 /* None */; } + if (flags === void 0) { + flags = 0 /* None */; + } ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, enclosingDeclaration, flags | 32 /* WriteTypeArgumentsOfSignature */)); if (allSignatures.length > 1) { displayParts.push(ts.spacePart()); @@ -141849,7 +142479,9 @@ var ts; * @param flags whether the rule deletes a line or not, defaults to no-op */ function rule(debugName, left, right, context, action, flags) { - if (flags === void 0) { flags = 0 /* None */; } + if (flags === void 0) { + flags = 0 /* None */; + } return { leftTokenRange: toTokenRange(left), rightTokenRange: toTokenRange(right), rule: { debugName: debugName, context: context, action: action, flags: flags } }; } function tokenRangeFrom(tokens) { @@ -141859,7 +142491,9 @@ var ts; return typeof arg === "number" ? tokenRangeFrom([arg]) : ts.isArray(arg) ? tokenRangeFrom(arg) : arg; } function tokenRangeFromRange(from, to, except) { - if (except === void 0) { except = []; } + if (except === void 0) { + except = []; + } var tokens = []; for (var token = from; token <= to; token++) { if (!ts.contains(except, token)) { @@ -142680,8 +143314,10 @@ var ts; } function formatNodeGivenIndentation(node, sourceFileLike, languageVariant, initialIndentation, delta, formatContext) { var range = { pos: 0, end: sourceFileLike.text.length }; - return formatting.getFormattingScanner(sourceFileLike.text, languageVariant, range.pos, range.end, function (scanner) { return formatSpanWorker(range, node, initialIndentation, delta, scanner, formatContext, 1 /* FormatSelection */, function (_) { return false; }, // assume that node does not have any errors - sourceFileLike); }); + return formatting.getFormattingScanner(sourceFileLike.text, languageVariant, range.pos, range.end, function (scanner) { + return formatSpanWorker(range, node, initialIndentation, delta, scanner, formatContext, 1 /* FormatSelection */, function (_) { return false; }, // assume that node does not have any errors + sourceFileLike); + }); } formatting.formatNodeGivenIndentation = formatNodeGivenIndentation; function formatNodeLines(node, sourceFile, formatContext, requestKind) { @@ -143221,7 +143857,9 @@ var ts; return indentationString !== sourceFile.text.substr(startLinePosition, indentationString.length); } function indentMultilineComment(commentRange, indentation, firstLineIsIndented, indentFinalLine) { - if (indentFinalLine === void 0) { indentFinalLine = true; } + if (indentFinalLine === void 0) { + indentFinalLine = true; + } // split comment in lines var startLine = sourceFile.getLineAndCharacterOfPosition(commentRange.pos).line; var endLine = sourceFile.getLineAndCharacterOfPosition(commentRange.end).line; @@ -143393,7 +144031,9 @@ var ts; * @param precedingToken pass `null` if preceding token was already computed and result was `undefined`. */ function getRangeOfEnclosingComment(sourceFile, position, precedingToken, tokenAtPosition) { - if (tokenAtPosition === void 0) { tokenAtPosition = ts.getTokenAtPosition(sourceFile, position); } + if (tokenAtPosition === void 0) { + tokenAtPosition = ts.getTokenAtPosition(sourceFile, position); + } var jsdoc = ts.findAncestor(tokenAtPosition, ts.isJSDoc); if (jsdoc) tokenAtPosition = jsdoc.parent; @@ -143408,21 +144048,23 @@ var ts; var trailingRangesOfPreviousToken = precedingToken && ts.getTrailingCommentRanges(sourceFile.text, precedingToken.end); var leadingCommentRangesOfNextToken = ts.getLeadingCommentRangesOfNode(tokenAtPosition, sourceFile); var commentRanges = ts.concatenate(trailingRangesOfPreviousToken, leadingCommentRangesOfNextToken); - return commentRanges && ts.find(commentRanges, function (range) { return ts.rangeContainsPositionExclusive(range, position) || - // The end marker of a single-line comment does not include the newline character. - // With caret at `^`, in the following case, we are inside a comment (^ denotes the cursor position): - // - // // asdf ^\n - // - // But for closed multi-line comments, we don't want to be inside the comment in the following case: - // - // /* asdf */^ - // - // However, unterminated multi-line comments *do* contain their end. - // - // Internally, we represent the end of the comment at the newline and closing '/', respectively. - // - position === range.end && (range.kind === 2 /* SingleLineCommentTrivia */ || position === sourceFile.getFullWidth()); }); + return commentRanges && ts.find(commentRanges, function (range) { + return ts.rangeContainsPositionExclusive(range, position) || + // The end marker of a single-line comment does not include the newline character. + // With caret at `^`, in the following case, we are inside a comment (^ denotes the cursor position): + // + // // asdf ^\n + // + // But for closed multi-line comments, we don't want to be inside the comment in the following case: + // + // /* asdf */^ + // + // However, unterminated multi-line comments *do* contain their end. + // + // Internally, we represent the end of the comment at the newline and closing '/', respectively. + // + position === range.end && (range.kind === 2 /* SingleLineCommentTrivia */ || position === sourceFile.getFullWidth()); + }); } formatting.getRangeOfEnclosingComment = getRangeOfEnclosingComment; function getOpenTokenForList(node, list) { @@ -143542,7 +144184,9 @@ var ts; * By default indentation at `position` will be 0 so 'assumeNewLineBeforeCloseBrace' overrides this behavior. */ function getIndentation(position, sourceFile, options, assumeNewLineBeforeCloseBrace) { - if (assumeNewLineBeforeCloseBrace === void 0) { assumeNewLineBeforeCloseBrace = false; } + if (assumeNewLineBeforeCloseBrace === void 0) { + assumeNewLineBeforeCloseBrace = false; + } if (position > sourceFile.text.length) { return getBaseIndentation(options); // past EOF } @@ -144117,7 +144761,9 @@ var ts; * @param isNextChild If true, we are judging indent of a hypothetical child *after* this one, not the current child. */ function shouldIndentChildNode(settings, parent, child, sourceFile, isNextChild) { - if (isNextChild === void 0) { isNextChild = false; } + if (isNextChild === void 0) { + isNextChild = false; + } return nodeWillIndentChild(settings, parent, child, sourceFile, /*indentByDefault*/ false) && !(isNextChild && child && isControlFlowEndingStatement(child.kind, parent)); } @@ -144217,7 +144863,9 @@ var ts; } function getAdjustedStartPosition(sourceFile, node, options, hasTrailingComment) { var _a, _b; - if (hasTrailingComment === void 0) { hasTrailingComment = false; } + if (hasTrailingComment === void 0) { + hasTrailingComment = false; + } var leadingTriviaOption = options.leadingTriviaOption; if (leadingTriviaOption === LeadingTriviaOption.Exclude) { return node.getStart(sourceFile); @@ -144367,11 +145015,15 @@ var ts; this.deletedNodes.push({ sourceFile: sourceFile, node: node }); }; ChangeTracker.prototype.deleteNode = function (sourceFile, node, options) { - if (options === void 0) { options = { leadingTriviaOption: LeadingTriviaOption.IncludeAll }; } + if (options === void 0) { + options = { leadingTriviaOption: LeadingTriviaOption.IncludeAll }; + } this.deleteRange(sourceFile, getAdjustedRange(sourceFile, node, node, options)); }; ChangeTracker.prototype.deleteNodes = function (sourceFile, nodes, options, hasTrailingComment) { - if (options === void 0) { options = { leadingTriviaOption: LeadingTriviaOption.IncludeAll }; } + if (options === void 0) { + options = { leadingTriviaOption: LeadingTriviaOption.IncludeAll }; + } // When deleting multiple nodes we need to track if the end position is including multiline trailing comments. for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) { var node = nodes_1[_i]; @@ -144385,46 +145037,64 @@ var ts; this.deleteRange(sourceFile, { pos: modifier.getStart(sourceFile), end: ts.skipTrivia(sourceFile.text, modifier.end, /*stopAfterLineBreak*/ true) }); }; ChangeTracker.prototype.deleteNodeRange = function (sourceFile, startNode, endNode, options) { - if (options === void 0) { options = { leadingTriviaOption: LeadingTriviaOption.IncludeAll }; } + if (options === void 0) { + options = { leadingTriviaOption: LeadingTriviaOption.IncludeAll }; + } var startPosition = getAdjustedStartPosition(sourceFile, startNode, options); var endPosition = getAdjustedEndPosition(sourceFile, endNode, options); this.deleteRange(sourceFile, { pos: startPosition, end: endPosition }); }; ChangeTracker.prototype.deleteNodeRangeExcludingEnd = function (sourceFile, startNode, afterEndNode, options) { - if (options === void 0) { options = { leadingTriviaOption: LeadingTriviaOption.IncludeAll }; } + if (options === void 0) { + options = { leadingTriviaOption: LeadingTriviaOption.IncludeAll }; + } var startPosition = getAdjustedStartPosition(sourceFile, startNode, options); var endPosition = afterEndNode === undefined ? sourceFile.text.length : getAdjustedStartPosition(sourceFile, afterEndNode, options); this.deleteRange(sourceFile, { pos: startPosition, end: endPosition }); }; ChangeTracker.prototype.replaceRange = function (sourceFile, range, newNode, options) { - if (options === void 0) { options = {}; } + if (options === void 0) { + options = {}; + } this.changes.push({ kind: ChangeKind.ReplaceWithSingleNode, sourceFile: sourceFile, range: range, options: options, node: newNode }); }; ChangeTracker.prototype.replaceNode = function (sourceFile, oldNode, newNode, options) { - if (options === void 0) { options = useNonAdjustedPositions; } + if (options === void 0) { + options = useNonAdjustedPositions; + } this.replaceRange(sourceFile, getAdjustedRange(sourceFile, oldNode, oldNode, options), newNode, options); }; ChangeTracker.prototype.replaceNodeRange = function (sourceFile, startNode, endNode, newNode, options) { - if (options === void 0) { options = useNonAdjustedPositions; } + if (options === void 0) { + options = useNonAdjustedPositions; + } this.replaceRange(sourceFile, getAdjustedRange(sourceFile, startNode, endNode, options), newNode, options); }; ChangeTracker.prototype.replaceRangeWithNodes = function (sourceFile, range, newNodes, options) { - if (options === void 0) { options = {}; } + if (options === void 0) { + options = {}; + } this.changes.push({ kind: ChangeKind.ReplaceWithMultipleNodes, sourceFile: sourceFile, range: range, options: options, nodes: newNodes }); }; ChangeTracker.prototype.replaceNodeWithNodes = function (sourceFile, oldNode, newNodes, options) { - if (options === void 0) { options = useNonAdjustedPositions; } + if (options === void 0) { + options = useNonAdjustedPositions; + } this.replaceRangeWithNodes(sourceFile, getAdjustedRange(sourceFile, oldNode, oldNode, options), newNodes, options); }; ChangeTracker.prototype.replaceNodeWithText = function (sourceFile, oldNode, text) { this.replaceRangeWithText(sourceFile, getAdjustedRange(sourceFile, oldNode, oldNode, useNonAdjustedPositions), text); }; ChangeTracker.prototype.replaceNodeRangeWithNodes = function (sourceFile, startNode, endNode, newNodes, options) { - if (options === void 0) { options = useNonAdjustedPositions; } + if (options === void 0) { + options = useNonAdjustedPositions; + } this.replaceRangeWithNodes(sourceFile, getAdjustedRange(sourceFile, startNode, endNode, options), newNodes, options); }; ChangeTracker.prototype.nodeHasTrailingComment = function (sourceFile, oldNode, configurableEnd) { - if (configurableEnd === void 0) { configurableEnd = useNonAdjustedPositions; } + if (configurableEnd === void 0) { + configurableEnd = useNonAdjustedPositions; + } return !!getEndPositionOfMultilineTrailingComment(sourceFile, oldNode, configurableEnd); }; ChangeTracker.prototype.nextCommaToken = function (sourceFile, node) { @@ -144436,11 +145106,15 @@ var ts; this.replaceNode(sourceFile, oldNode, newNode, { suffix: suffix }); }; ChangeTracker.prototype.insertNodeAt = function (sourceFile, pos, newNode, options) { - if (options === void 0) { options = {}; } + if (options === void 0) { + options = {}; + } this.replaceRange(sourceFile, ts.createRange(pos), newNode, options); }; ChangeTracker.prototype.insertNodesAt = function (sourceFile, pos, newNodes, options) { - if (options === void 0) { options = {}; } + if (options === void 0) { + options = {}; + } this.replaceRangeWithNodes(sourceFile, ts.createRange(pos), newNodes, options); }; ChangeTracker.prototype.insertNodeAtTopOfFile = function (sourceFile, newNode, blankLineBetween) { @@ -144472,12 +145146,18 @@ var ts; } }; ChangeTracker.prototype.insertNodeBefore = function (sourceFile, before, newNode, blankLineBetween, options) { - if (blankLineBetween === void 0) { blankLineBetween = false; } - if (options === void 0) { options = {}; } + if (blankLineBetween === void 0) { + blankLineBetween = false; + } + if (options === void 0) { + options = {}; + } this.insertNodeAt(sourceFile, getAdjustedStartPosition(sourceFile, before, options), newNode, this.getOptionsForInsertNodeBefore(before, newNode, blankLineBetween)); }; ChangeTracker.prototype.insertModifierAt = function (sourceFile, pos, modifier, options) { - if (options === void 0) { options = {}; } + if (options === void 0) { + options = {}; + } this.insertNodeAt(sourceFile, pos, ts.factory.createToken(modifier), options); }; ChangeTracker.prototype.insertModifierBefore = function (sourceFile, modifier, before) { @@ -144751,7 +145431,9 @@ var ts; * Note that separators are part of the node in statements and class elements. */ ChangeTracker.prototype.insertNodeInListAfter = function (sourceFile, after, newNode, containingList) { - if (containingList === void 0) { containingList = ts.formatting.SmartIndenter.getContainingList(after, sourceFile); } + if (containingList === void 0) { + containingList = ts.formatting.SmartIndenter.getContainingList(after, sourceFile); + } if (!containingList) { ts.Debug.fail("node is not a list element"); return; @@ -145447,7 +146129,9 @@ var ts; /** Warning: This deletes comments too. See `copyComments` in `convertFunctionToEs6Class`. */ // Exported for tests only! (TODO: improve tests to not need this) function deleteNode(changes, sourceFile, node, options) { - if (options === void 0) { options = { leadingTriviaOption: LeadingTriviaOption.IncludeAll }; } + if (options === void 0) { + options = { leadingTriviaOption: LeadingTriviaOption.IncludeAll }; + } var startPosition = getAdjustedStartPosition(sourceFile, node, options); var endPosition = getAdjustedEndPosition(sourceFile, node, options); changes.deleteRange(sourceFile, { pos: startPosition, end: endPosition }); @@ -146292,11 +146976,13 @@ var ts; return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Annotate_with_type_from_JSDoc, fixId, ts.Diagnostics.Annotate_everything_with_types_from_JSDoc)]; }, fixIds: [fixId], - getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) { - var decl = getDeclaration(diag.file, diag.start); - if (decl) - doChange(changes, diag.file, decl); - }); }, + getAllCodeActions: function (context) { + return codefix.codeFixAll(context, errorCodes, function (changes, diag) { + var decl = getDeclaration(diag.file, diag.start); + if (decl) + doChange(changes, diag.file, decl); + }); + }, }); function getDeclaration(file, pos) { var name = ts.getTokenAtPosition(file, pos); @@ -146455,9 +147141,11 @@ var ts; return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Convert_function_to_an_ES2015_class, fixId, ts.Diagnostics.Convert_all_constructor_functions_to_classes)]; }, fixIds: [fixId], - getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, err) { - return doChange(changes, err.file, err.start, context.program.getTypeChecker(), context.preferences, context.program.getCompilerOptions()); - }); }, + getAllCodeActions: function (context) { + return codefix.codeFixAll(context, errorCodes, function (changes, err) { + return doChange(changes, err.file, err.start, context.program.getTypeChecker(), context.preferences, context.program.getCompilerOptions()); + }); + }, }); function doChange(changes, sourceFile, position, checker, preferences, compilerOptions) { var ctorSymbol = checker.getSymbolAtLocation(ts.getTokenAtPosition(sourceFile, position)); @@ -147387,12 +148075,18 @@ var ts; return ts.every(bindingName.elements, isEmptyBindingName); } function createSynthIdentifier(identifier, types) { - if (types === void 0) { types = []; } + if (types === void 0) { + types = []; + } return { kind: 0 /* Identifier */, identifier: identifier, types: types, hasBeenDeclared: false, hasBeenReferenced: false }; } function createSynthBindingPattern(bindingPattern, elements, types) { - if (elements === void 0) { elements = ts.emptyArray; } - if (types === void 0) { types = []; } + if (elements === void 0) { + elements = ts.emptyArray; + } + if (types === void 0) { + types = []; + } return { kind: 1 /* BindingPattern */, bindingPattern: bindingPattern, elements: elements, types: types }; } function referenceSynthIdentifier(synthId) { @@ -147926,12 +148620,14 @@ var ts; return [codefix.createCodeFixAction(fixId, changes, [ts.Diagnostics.Rewrite_as_the_indexed_access_type_0, newText], fixId, ts.Diagnostics.Rewrite_all_as_indexed_access_types)]; }, fixIds: [fixId], - getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) { - var q = getQualifiedName(diag.file, diag.start); - if (q) { - doChange(changes, diag.file, q); - } - }); }, + getAllCodeActions: function (context) { + return codefix.codeFixAll(context, errorCodes, function (changes, diag) { + var q = getQualifiedName(diag.file, diag.start); + if (q) { + doChange(changes, diag.file, q); + } + }); + }, }); function getQualifiedName(sourceFile, pos) { var qualifiedName = ts.findAncestor(ts.getTokenAtPosition(sourceFile, pos), ts.isQualifiedName); @@ -148082,12 +148778,14 @@ var ts; return [codefix.createCodeFixAction(fixId, changes, [ts.Diagnostics.Convert_0_to_1_in_0, constraint, name], fixId, ts.Diagnostics.Convert_all_type_literals_to_mapped_type)]; }, fixIds: [fixId], - getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) { - var info = getInfo(diag.file, diag.start); - if (info) { - doChange(changes, diag.file, info); - } - }); } + getAllCodeActions: function (context) { + return codefix.codeFixAll(context, errorCodes, function (changes, diag) { + var info = getInfo(diag.file, diag.start); + if (info) { + doChange(changes, diag.file, info); + } + }); + } }); function getInfo(sourceFile, pos) { var token = ts.getTokenAtPosition(sourceFile, pos); @@ -148976,8 +149674,10 @@ var ts; changes.insertNodeAt(sourceFile, clause.getStart(sourceFile), ts.factory.createIdentifier(defaultImport.name), { suffix: ", " }); } if (namedImports.length) { - var newSpecifiers = ts.stableSort(namedImports.map(function (namedImport) { return ts.factory.createImportSpecifier((!clause.isTypeOnly || promoteFromTypeOnly) && needsTypeOnly(namedImport), - /*propertyName*/ undefined, ts.factory.createIdentifier(namedImport.name)); }), ts.OrganizeImports.compareImportOrExportSpecifiers); + var newSpecifiers = ts.stableSort(namedImports.map(function (namedImport) { + return ts.factory.createImportSpecifier((!clause.isTypeOnly || promoteFromTypeOnly) && needsTypeOnly(namedImport), + /*propertyName*/ undefined, ts.factory.createIdentifier(namedImport.name)); + }), ts.OrganizeImports.compareImportOrExportSpecifiers); if ((existingSpecifiers === null || existingSpecifiers === void 0 ? void 0 : existingSpecifiers.length) && ts.OrganizeImports.importSpecifiersAreSorted(existingSpecifiers)) { for (var _b = 0, newSpecifiers_1 = newSpecifiers; _b < newSpecifiers_1.length; _b++) { var spec = newSpecifiers_1[_b]; @@ -149311,9 +150011,11 @@ var ts; return diagnostic ? [codefix.createCodeFixAction(fixId, changes, diagnostic, fixId, ts.Diagnostics.Fix_all_implicit_this_errors)] : ts.emptyArray; }, fixIds: [fixId], - getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) { - doChange(changes, diag.file, diag.start, context.program.getTypeChecker()); - }); }, + getAllCodeActions: function (context) { + return codefix.codeFixAll(context, errorCodes, function (changes, diag) { + doChange(changes, diag.file, diag.start, context.program.getTypeChecker()); + }); + }, }); function doChange(changes, sourceFile, pos, checker) { var token = ts.getTokenAtPosition(sourceFile, pos); @@ -149433,12 +150135,14 @@ var ts; return [codefix.createCodeFixAction("spelling", changes, [ts.Diagnostics.Change_spelling_to_0, ts.symbolName(suggestedSymbol)], fixId, ts.Diagnostics.Fix_all_detected_spelling_errors)]; }, fixIds: [fixId], - getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) { - var info = getInfo(diag.file, diag.start, context, diag.code); - var target = ts.getEmitScriptTarget(context.host.getCompilationSettings()); - if (info) - doChange(changes, context.sourceFile, info.node, info.suggestedSymbol, target); - }); }, + getAllCodeActions: function (context) { + return codefix.codeFixAll(context, errorCodes, function (changes, diag) { + var info = getInfo(diag.file, diag.start, context, diag.code); + var target = ts.getEmitScriptTarget(context.host.getCompilationSettings()); + if (info) + doChange(changes, context.sourceFile, info.node, info.suggestedSymbol, target); + }); + }, }); function getInfo(sourceFile, pos, context, errorCode) { // This is the identifier of the misspelled word. eg: @@ -149573,28 +150277,30 @@ var ts; return [getActionForfixWrapTheBlockWithParen(context, info.declaration, info.expression)]; } }, - getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) { - var info = getInfo(context.program.getTypeChecker(), diag.file, diag.start, diag.code); - if (!info) - return undefined; - switch (context.fixId) { - case fixIdAddReturnStatement: - addReturnStatement(changes, diag.file, info.expression, info.statement); - break; - case fixRemoveBracesFromArrowFunctionBody: - if (!ts.isArrowFunction(info.declaration)) - return undefined; - removeBlockBodyBrace(changes, diag.file, info.declaration, info.expression, info.commentSource, /* withParen */ false); - break; - case fixIdWrapTheBlockWithParen: - if (!ts.isArrowFunction(info.declaration)) - return undefined; - wrapBlockWithParen(changes, diag.file, info.declaration, info.expression); - break; - default: - ts.Debug.fail(JSON.stringify(context.fixId)); - } - }); }, + getAllCodeActions: function (context) { + return codefix.codeFixAll(context, errorCodes, function (changes, diag) { + var info = getInfo(context.program.getTypeChecker(), diag.file, diag.start, diag.code); + if (!info) + return undefined; + switch (context.fixId) { + case fixIdAddReturnStatement: + addReturnStatement(changes, diag.file, info.expression, info.statement); + break; + case fixRemoveBracesFromArrowFunctionBody: + if (!ts.isArrowFunction(info.declaration)) + return undefined; + removeBlockBodyBrace(changes, diag.file, info.declaration, info.expression, info.commentSource, /* withParen */ false); + break; + case fixIdWrapTheBlockWithParen: + if (!ts.isArrowFunction(info.declaration)) + return undefined; + wrapBlockWithParen(changes, diag.file, info.declaration, info.expression); + break; + default: + ts.Debug.fail(JSON.stringify(context.fixId)); + } + }); + }, }); function createObjectTypeFromLabeledExpression(checker, label, expression) { var member = checker.createSymbol(4 /* Property */, label.escapedText); @@ -150278,9 +150984,11 @@ var ts; return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Add_missing_new_operator_to_call, fixId, ts.Diagnostics.Add_missing_new_operator_to_all_calls)]; }, fixIds: [fixId], - getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) { - return addMissingNewOperator(changes, context.sourceFile, diag); - }); }, + getAllCodeActions: function (context) { + return codefix.codeFixAll(context, errorCodes, function (changes, diag) { + return addMissingNewOperator(changes, context.sourceFile, diag); + }); + }, }); function addMissingNewOperator(changes, sourceFile, span) { var call = ts.cast(findAncestorMatchingSpan(sourceFile, span), ts.isCallExpression); @@ -150487,9 +151195,11 @@ var ts; return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Add_missing_super_call, fixId, ts.Diagnostics.Add_all_missing_super_calls)]; }, fixIds: [fixId], - getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) { - return doChange(changes, context.sourceFile, getNode(diag.file, diag.start)); - }); }, + getAllCodeActions: function (context) { + return codefix.codeFixAll(context, errorCodes, function (changes, diag) { + return doChange(changes, context.sourceFile, getNode(diag.file, diag.start)); + }); + }, }); function getNode(sourceFile, pos) { var token = ts.getTokenAtPosition(sourceFile, pos); @@ -150522,13 +151232,15 @@ var ts; return [codefix.createCodeFixActionWithoutFixAll(fixId, changes, ts.Diagnostics.Enable_the_experimentalDecorators_option_in_your_configuration_file)]; }, fixIds: [fixId], - getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes) { - var configFile = context.program.getCompilerOptions().configFile; - if (configFile === undefined) { - return undefined; - } - doChange(changes, configFile); - }); }, + getAllCodeActions: function (context) { + return codefix.codeFixAll(context, errorCodes, function (changes) { + var configFile = context.program.getCompilerOptions().configFile; + if (configFile === undefined) { + return undefined; + } + doChange(changes, configFile); + }); + }, }); function doChange(changeTracker, configFile) { codefix.setJsonCompilerOptionValue(changeTracker, configFile, "experimentalDecorators", ts.factory.createTrue()); @@ -150667,11 +151379,13 @@ var ts; return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Change_extends_to_implements, fixId, ts.Diagnostics.Change_all_extended_interfaces_to_implements)]; }, fixIds: [fixId], - getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) { - var nodes = getNodes(diag.file, diag.start); - if (nodes) - doChanges(changes, diag.file, nodes.extendsToken, nodes.heritageClauses); - }); }, + getAllCodeActions: function (context) { + return codefix.codeFixAll(context, errorCodes, function (changes, diag) { + var nodes = getNodes(diag.file, diag.start); + if (nodes) + doChanges(changes, diag.file, nodes.extendsToken, nodes.heritageClauses); + }); + }, }); function getNodes(sourceFile, pos) { var token = ts.getTokenAtPosition(sourceFile, pos); @@ -150724,11 +151438,13 @@ var ts; return [codefix.createCodeFixAction(fixId, changes, [ts.Diagnostics.Add_0_to_unresolved_variable, info.className || "this"], fixId, ts.Diagnostics.Add_qualifier_to_all_unresolved_variables_matching_a_member_name)]; }, fixIds: [fixId], - getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) { - var info = getInfo(diag.file, diag.start, diag.code); - if (info) - doChange(changes, context.sourceFile, info); - }); }, + getAllCodeActions: function (context) { + return codefix.codeFixAll(context, errorCodes, function (changes, diag) { + var info = getInfo(diag.file, diag.start, diag.code); + if (info) + doChange(changes, context.sourceFile, info); + }); + }, }); function getInfo(sourceFile, pos, diagCode) { var node = ts.getTokenAtPosition(sourceFile, pos); @@ -151025,7 +151741,9 @@ var ts; } } function tryDeleteParameter(changes, sourceFile, parameter, checker, sourceFiles, program, cancellationToken, isFixAll) { - if (isFixAll === void 0) { isFixAll = false; } + if (isFixAll === void 0) { + isFixAll = false; + } if (mayDeleteParameter(checker, sourceFile, parameter, sourceFiles, program, cancellationToken, isFixAll)) { if (parameter.modifiers && parameter.modifiers.length > 0 && (!ts.isIdentifier(parameter.name) || ts.FindAllReferences.Core.isSymbolReferencedInFile(parameter.name, checker, sourceFile))) { @@ -151308,11 +152026,13 @@ var ts; var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return doChange(t, context.sourceFile, callName); }); return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Add_missing_call_parentheses, fixId, ts.Diagnostics.Add_all_missing_call_parentheses)]; }, - getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) { - var callName = getCallName(diag.file, diag.start); - if (callName) - doChange(changes, diag.file, callName); - }); } + getAllCodeActions: function (context) { + return codefix.codeFixAll(context, errorCodes, function (changes, diag) { + var callName = getCallName(diag.file, diag.start); + if (callName) + doChange(changes, diag.file, callName); + }); + } }); function doChange(changes, sourceFile, name) { changes.replaceNodeWithText(sourceFile, name, "".concat(name.text, "()")); @@ -151432,15 +152152,17 @@ var ts; } }, fixIds: [fixId], - getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) { - var edits = doChange(diag.file, diag.start, diag.length, diag.code, context); - if (edits) { - for (var _i = 0, edits_2 = edits; _i < edits_2.length; _i++) { - var edit = edits_2[_i]; - changes.pushRaw(context.sourceFile, edit); + getAllCodeActions: function (context) { + return codefix.codeFixAll(context, errorCodes, function (changes, diag) { + var edits = doChange(diag.file, diag.start, diag.length, diag.code, context); + if (edits) { + for (var _i = 0, edits_2 = edits; _i < edits_2.length; _i++) { + var edit = edits_2[_i]; + changes.pushRaw(context.sourceFile, edit); + } } - } - }); }, + }); + }, }); function doChange(file, start, length, code, context) { var startPosition; @@ -151794,12 +152516,14 @@ var ts; function addJSDocTags(changes, sourceFile, parent, newTags) { var comments = ts.flatMap(parent.jsDoc, function (j) { return typeof j.comment === "string" ? ts.factory.createJSDocText(j.comment) : j.comment; }); var oldTags = ts.flatMapToMutable(parent.jsDoc, function (j) { return j.tags; }); - var unmergedNewTags = newTags.filter(function (newTag) { return !oldTags || !oldTags.some(function (tag, i) { - var merged = tryMergeJsdocTags(tag, newTag); - if (merged) - oldTags[i] = merged; - return !!merged; - }); }); + var unmergedNewTags = newTags.filter(function (newTag) { + return !oldTags || !oldTags.some(function (tag, i) { + var merged = tryMergeJsdocTags(tag, newTag); + if (merged) + oldTags[i] = merged; + return !!merged; + }); + }); var tag = ts.factory.createJSDocComment(ts.factory.createNodeArray(ts.intersperse(comments, ts.factory.createJSDocText("\n"))), ts.factory.createNodeArray(__spreadArray(__spreadArray([], (oldTags || ts.emptyArray), true), unmergedNewTags, true))); var jsDocNode = parent.kind === 213 /* ArrowFunction */ ? getJsDocNodeForArrowFunction(parent) : parent; jsDocNode.jsDoc = parent.jsDoc; @@ -151842,10 +152566,12 @@ var ts; function inferTypeForParametersFromUsage(func, sourceFile, program, cancellationToken) { var references = getFunctionReferences(func, sourceFile, program, cancellationToken); return references && inferTypeFromReferences(program, references, cancellationToken).parameters(func) || - func.parameters.map(function (p) { return ({ - declaration: p, - type: ts.isIdentifier(p.name) ? inferTypeForVariableFromUsage(p.name, program, cancellationToken) : program.getTypeChecker().getAnyType() - }); }); + func.parameters.map(function (p) { + return ({ + declaration: p, + type: ts.isIdentifier(p.name) ? inferTypeForVariableFromUsage(p.name, program, cancellationToken) : program.getTypeChecker().getAnyType() + }); + }); } function getFunctionReferences(containingFunction, sourceFile, program, cancellationToken) { var searchToken; @@ -152514,12 +153240,14 @@ var ts; return [codefix.createCodeFixAction(fixId, changes, [ts.Diagnostics.Replace_0_with_Promise_1, checker.typeToString(returnType), checker.typeToString(promisedType)], fixId, ts.Diagnostics.Fix_all_incorrect_return_type_of_an_async_functions)]; }, - getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) { - var info = getInfo(diag.file, context.program.getTypeChecker(), diag.start); - if (info) { - doChange(changes, diag.file, info.returnTypeNode, info.promisedTypeNode); - } - }); } + getAllCodeActions: function (context) { + return codefix.codeFixAll(context, errorCodes, function (changes, diag) { + var info = getInfo(diag.file, context.program.getTypeChecker(), diag.start); + if (info) { + doChange(changes, diag.file, info.returnTypeNode, info.promisedTypeNode); + } + }); + } }); function getInfo(sourceFile, checker, pos) { if (ts.isInJSFile(sourceFile)) { @@ -152634,8 +153362,12 @@ var ts; * @param body If defined, this will be the body of the member node passed to `addClassElement`. Otherwise, the body will default to a stub. */ function addNewNodeForMemberSymbol(symbol, enclosingDeclaration, sourceFile, context, preferences, importAdder, addClassElement, body, preserveOptional, isAmbient) { - if (preserveOptional === void 0) { preserveOptional = 3 /* All */; } - if (isAmbient === void 0) { isAmbient = false; } + if (preserveOptional === void 0) { + preserveOptional = 3 /* All */; + } + if (isAmbient === void 0) { + isAmbient = false; + } var declarations = symbol.getDeclarations(); if (!(declarations && declarations.length)) { return undefined; @@ -153096,7 +153828,9 @@ var ts; return modifierFlags; } function getAccessorConvertiblePropertyAtPosition(file, program, start, end, considerEmptySpans) { - if (considerEmptySpans === void 0) { considerEmptySpans = true; } + if (considerEmptySpans === void 0) { + considerEmptySpans = true; + } var node = ts.getTokenAtPosition(file, start); var cursorRequest = start === end && considerEmptySpans; var declaration = ts.findAncestor(node.parent, isAcceptedDeclaration); @@ -153449,12 +154183,14 @@ var ts; return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Convert_require_to_import, fixId, ts.Diagnostics.Convert_all_require_to_import)]; }, fixIds: [fixId], - getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) { - var info = getInfo(diag.file, context.program, diag.start); - if (info) { - doChange(changes, context.sourceFile, info); - } - }); }, + getAllCodeActions: function (context) { + return codefix.codeFixAll(context, errorCodes, function (changes, diag) { + var info = getInfo(diag.file, context.program, diag.start); + if (info) { + doChange(changes, context.sourceFile, info); + } + }); + }, }); function doChange(changes, sourceFile, info) { var allowSyntheticDefaults = info.allowSyntheticDefaults, defaultImportName = info.defaultImportName, namedImports = info.namedImports, statement = info.statement, required = info.required; @@ -153513,11 +154249,13 @@ var ts; return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Convert_to_default_import, fixId, ts.Diagnostics.Convert_all_to_default_imports)]; }, fixIds: [fixId], - getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) { - var info = getInfo(diag.file, diag.start); - if (info) - doChange(changes, diag.file, info, context.preferences); - }); }, + getAllCodeActions: function (context) { + return codefix.codeFixAll(context, errorCodes, function (changes, diag) { + var info = getInfo(diag.file, diag.start); + if (info) + doChange(changes, diag.file, info, context.preferences); + }); + }, }); function getInfo(sourceFile, pos) { var name = ts.getTokenAtPosition(sourceFile, pos); @@ -153587,9 +154325,11 @@ var ts; return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Add_missing_typeof, fixId, ts.Diagnostics.Add_missing_typeof)]; }, fixIds: [fixId], - getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) { - return doChange(changes, context.sourceFile, getImportTypeNode(diag.file, diag.start)); - }); }, + getAllCodeActions: function (context) { + return codefix.codeFixAll(context, errorCodes, function (changes, diag) { + return doChange(changes, context.sourceFile, getImportTypeNode(diag.file, diag.start)); + }); + }, }); function getImportTypeNode(sourceFile, pos) { var token = ts.getTokenAtPosition(sourceFile, pos); @@ -153621,12 +154361,14 @@ var ts; return [codefix.createCodeFixAction(fixID, changes, ts.Diagnostics.Wrap_in_JSX_fragment, fixID, ts.Diagnostics.Wrap_all_unparented_JSX_in_JSX_fragment)]; }, fixIds: [fixID], - getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) { - var node = findNodeToFix(context.sourceFile, diag.start); - if (!node) - return undefined; - doChange(changes, context.sourceFile, node); - }); }, + getAllCodeActions: function (context) { + return codefix.codeFixAll(context, errorCodes, function (changes, diag) { + var node = findNodeToFix(context.sourceFile, diag.start); + if (!node) + return undefined; + doChange(changes, context.sourceFile, node); + }); + }, }); function findNodeToFix(sourceFile, pos) { // The error always at 1st token that is "<" in "" @@ -153699,11 +154441,13 @@ var ts; return [codefix.createCodeFixAction(fixId, changes, [ts.Diagnostics.Convert_0_to_mapped_object_type, name], fixId, [ts.Diagnostics.Convert_0_to_mapped_object_type, name])]; }, fixIds: [fixId], - getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) { - var info = getInfo(diag.file, diag.start); - if (info) - doChange(changes, diag.file, info); - }); } + getAllCodeActions: function (context) { + return codefix.codeFixAll(context, errorCodes, function (changes, diag) { + var info = getInfo(diag.file, diag.start); + if (info) + doChange(changes, diag.file, info); + }); + } }); function getInfo(sourceFile, pos) { var token = ts.getTokenAtPosition(sourceFile, pos); @@ -153818,9 +154562,11 @@ var ts; return [codefix.createCodeFixAction(fixId, changes, ts.Diagnostics.Split_into_two_separate_import_declarations, fixId, ts.Diagnostics.Split_all_invalid_type_only_imports)]; } }, - getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, error) { - splitTypeOnlyImport(changes, getImportDeclaration(context.sourceFile, error), context); - }); }, + getAllCodeActions: function (context) { + return codefix.codeFixAll(context, errorCodes, function (changes, error) { + splitTypeOnlyImport(changes, getImportDeclaration(context.sourceFile, error), context); + }); + }, }); function getImportDeclaration(sourceFile, span) { return ts.findAncestor(ts.getTokenAtPosition(sourceFile, span.start), ts.isImportDeclaration); @@ -153892,11 +154638,13 @@ var ts; return [codefix.createCodeFixAction(fixId, changes, [ts.Diagnostics.Change_0_to_1, ";", ","], fixId, [ts.Diagnostics.Change_0_to_1, ";", ","])]; }, fixIds: [fixId], - getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, diag) { - var info = getInfo(diag.file, diag.start, diag.code); - if (info) - doChange(changes, context.sourceFile, info); - }); }, + getAllCodeActions: function (context) { + return codefix.codeFixAll(context, errorCodes, function (changes, diag) { + var info = getInfo(diag.file, diag.start, diag.code); + if (info) + doChange(changes, context.sourceFile, info); + }); + }, }); function getInfo(sourceFile, pos, _) { var node = ts.getTokenAtPosition(sourceFile, pos); @@ -154045,7 +154793,9 @@ var ts; }); ; function getInfo(context, considerPartialSpans) { - if (considerPartialSpans === void 0) { considerPartialSpans = true; } + if (considerPartialSpans === void 0) { + considerPartialSpans = true; + } var file = context.file, program = context.program; var span = ts.getRefactorContextSpan(context); var token = ts.getTokenAtPosition(file, span.start); @@ -154292,7 +155042,9 @@ var ts; }); // Can convert imports of the form `import * as m from "m";` or `import d, { x, y } from "m";`. function getImportToConvert(context, considerPartialSpans) { - if (considerPartialSpans === void 0) { considerPartialSpans = true; } + if (considerPartialSpans === void 0) { + considerPartialSpans = true; + } var file = context.file; var span = ts.getRefactorContextSpan(context); var token = ts.getTokenAtPosition(file, span.start); @@ -154490,7 +155242,9 @@ var ts; return isValidExpression(node) || isValidStatement(node); } function getInfo(context, considerEmptySpans) { - if (considerEmptySpans === void 0) { considerEmptySpans = true; } + if (considerEmptySpans === void 0) { + considerEmptySpans = true; + } var file = context.file, program = context.program; var span = ts.getRefactorContextSpan(context); var forEmptySpan = span.length === 0; @@ -155089,7 +155843,9 @@ var ts; */ // exported only for tests function getRangeToExtract(sourceFile, span, invoked) { - if (invoked === void 0) { invoked = true; } + if (invoked === void 0) { + invoked = true; + } var length = span.length; if (length === 0 && !invoked) { return { errors: [ts.createFileDiagnostic(sourceFile, span.start, length, Messages.cannotExtractEmpty)] }; @@ -156332,7 +157088,9 @@ var ts; } } function collectUsages(node, valueUsage) { - if (valueUsage === void 0) { valueUsage = 1 /* Read */; } + if (valueUsage === void 0) { + valueUsage = 1 /* Read */; + } if (inGenericContext) { var type = checker.getTypeAtLocation(node); recordTypeParameterUsages(type); @@ -156641,14 +157399,18 @@ var ts; } }); function getRangeToExtract(context, considerEmptySpans) { - if (considerEmptySpans === void 0) { considerEmptySpans = true; } + if (considerEmptySpans === void 0) { + considerEmptySpans = true; + } var file = context.file, startPosition = context.startPosition; var isJS = ts.isSourceFileJS(file); var current = ts.getTokenAtPosition(file, startPosition); var range = ts.createTextRangeFromSpan(ts.getRefactorContextSpan(context)); var cursorRequest = range.pos === range.end && considerEmptySpans; - var selection = ts.findAncestor(current, (function (node) { return node.parent && ts.isTypeNode(node) && !rangeContainsSkipTrivia(range, node.parent, file) && - (cursorRequest || ts.nodeOverlapsWithStartEnd(current, file, range.pos, range.end)); })); + var selection = ts.findAncestor(current, (function (node) { + return node.parent && ts.isTypeNode(node) && !rangeContainsSkipTrivia(range, node.parent, file) && + (cursorRequest || ts.nodeOverlapsWithStartEnd(current, file, range.pos, range.end)); + })); if (!selection || !ts.isTypeNode(selection)) return { error: ts.getLocaleSpecificMessage(ts.Diagnostics.Selection_is_not_a_valid_type_node) }; var checker = context.program.getTypeChecker(); @@ -157137,7 +157899,9 @@ var ts; } } function makeVariableStatement(name, type, initializer, flags) { - if (flags === void 0) { flags = 2 /* Const */; } + if (flags === void 0) { + flags = 2 /* Const */; + } return ts.factory.createVariableStatement(/*modifiers*/ undefined, ts.factory.createVariableDeclarationList([ts.factory.createVariableDeclaration(name, /*exclamationToken*/ undefined, type, initializer)], flags)); } function createRequireCall(moduleSpecifier) { @@ -157660,7 +158424,9 @@ var ts; return { renameFilename: undefined, renameLocation: undefined, edits: edits }; } function getConvertibleArrowFunctionAtPosition(file, startPosition, considerFunctionBodies, kind) { - if (considerFunctionBodies === void 0) { considerFunctionBodies = true; } + if (considerFunctionBodies === void 0) { + considerFunctionBodies = true; + } var node = ts.getTokenAtPosition(file, startPosition); var func = ts.getContainingFunction(node); if (!func) { @@ -158331,11 +159097,13 @@ var ts; } // to copy comments following the operator // "foo" + /* comment */ "bar" - var copyTrailingOperatorComments = function (operators, file) { return function (index, targetNode) { - if (index < operators.length) { - ts.copyTrailingComments(operators[index], targetNode, file, 3 /* MultiLineCommentTrivia */, /* hasTrailingNewLine */ false); - } - }; }; + var copyTrailingOperatorComments = function (operators, file) { + return function (index, targetNode) { + if (index < operators.length) { + ts.copyTrailingComments(operators[index], targetNode, file, 3 /* MultiLineCommentTrivia */, /* hasTrailingNewLine */ false); + } + }; + }; // to copy comments following the string // "foo" /* comment */ + "bar" /* comment */ + "bar2" var copyCommentFromMultiNode = function (nodes, file, copyOperatorComments) { @@ -159687,7 +160455,9 @@ var ts; /** A cancellation that throttles calls to the host */ var ThrottledCancellationToken = /** @class */ (function () { function ThrottledCancellationToken(hostCancellationToken, throttleWaitMilliseconds) { - if (throttleWaitMilliseconds === void 0) { throttleWaitMilliseconds = 20; } + if (throttleWaitMilliseconds === void 0) { + throttleWaitMilliseconds = 20; + } this.hostCancellationToken = hostCancellationToken; this.throttleWaitMilliseconds = throttleWaitMilliseconds; // Store when we last tried to cancel. Checking cancellation can be expensive (as we have @@ -159754,7 +160524,9 @@ var ts; ], false); function createLanguageService(host, documentRegistry, syntaxOnlyOrLanguageServiceMode) { var _a; - if (documentRegistry === void 0) { documentRegistry = ts.createDocumentRegistry(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames(), host.getCurrentDirectory()); } + if (documentRegistry === void 0) { + documentRegistry = ts.createDocumentRegistry(host.useCaseSensitiveFileNames && host.useCaseSensitiveFileNames(), host.getCurrentDirectory()); + } var languageServiceMode; if (syntaxOnlyOrLanguageServiceMode === undefined) { languageServiceMode = ts.LanguageServiceMode.Semantic; @@ -160076,20 +160848,26 @@ var ts; return __spreadArray(__spreadArray([], program.getOptionsDiagnostics(cancellationToken), true), program.getGlobalDiagnostics(cancellationToken), true); } function getCompletionsAtPosition(fileName, position, options) { - if (options === void 0) { options = ts.emptyOptions; } + if (options === void 0) { + options = ts.emptyOptions; + } // Convert from deprecated options names to new names var fullPreferences = __assign(__assign({}, ts.identity(options)), { includeCompletionsForModuleExports: options.includeCompletionsForModuleExports || options.includeExternalModuleExports, includeCompletionsWithInsertText: options.includeCompletionsWithInsertText || options.includeInsertTextCompletions }); synchronizeHostData(); return ts.Completions.getCompletionsAtPosition(host, program, log, getValidSourceFile(fileName), position, fullPreferences, options.triggerCharacter, options.triggerKind, cancellationToken); } function getCompletionEntryDetails(fileName, position, name, formattingOptions, source, preferences, data) { - if (preferences === void 0) { preferences = ts.emptyOptions; } + if (preferences === void 0) { + preferences = ts.emptyOptions; + } synchronizeHostData(); return ts.Completions.getCompletionEntryDetails(program, log, getValidSourceFile(fileName), position, { name: name, source: source, data: data }, host, (formattingOptions && ts.formatting.getFormatContext(formattingOptions, host)), // TODO: GH#18217 preferences, cancellationToken); } function getCompletionEntrySymbol(fileName, position, name, source, preferences) { - if (preferences === void 0) { preferences = ts.emptyOptions; } + if (preferences === void 0) { + preferences = ts.emptyOptions; + } synchronizeHostData(); return ts.Completions.getCompletionEntrySymbol(program, log, getValidSourceFile(fileName), position, { name: name, source: source }, host, preferences); } @@ -160223,7 +161001,9 @@ var ts; return ts.FindAllReferences.Core.getReferencesForFileName(fileName, program, program.getSourceFiles()).map(function (r) { return ts.FindAllReferences.toReferenceEntry(r, moduleSymbol); }); } function getNavigateToItems(searchValue, maxResultCount, fileName, excludeDtsFiles) { - if (excludeDtsFiles === void 0) { excludeDtsFiles = false; } + if (excludeDtsFiles === void 0) { + excludeDtsFiles = false; + } synchronizeHostData(); var sourceFiles = fileName ? [getValidSourceFile(fileName)] : program.getSourceFiles(); return ts.NavigateTo.getNavigateToItems(sourceFiles, program.getTypeChecker(), cancellationToken, searchValue, maxResultCount, excludeDtsFiles); @@ -160392,7 +161172,9 @@ var ts; return []; } function getCodeFixesAtPosition(fileName, start, end, errorCodes, formatOptions, preferences) { - if (preferences === void 0) { preferences = ts.emptyOptions; } + if (preferences === void 0) { + preferences = ts.emptyOptions; + } synchronizeHostData(); var sourceFile = getValidSourceFile(fileName); var span = ts.createTextSpanFromBounds(start, end); @@ -160403,7 +161185,9 @@ var ts; }); } function getCombinedCodeFix(scope, fixId, formatOptions, preferences) { - if (preferences === void 0) { preferences = ts.emptyOptions; } + if (preferences === void 0) { + preferences = ts.emptyOptions; + } synchronizeHostData(); ts.Debug.assert(scope.type === "file"); var sourceFile = getValidSourceFile(scope.fileName); @@ -160411,7 +161195,9 @@ var ts; return ts.codefix.getAllFixes({ fixId: fixId, sourceFile: sourceFile, program: program, host: host, cancellationToken: cancellationToken, formatContext: formatContext, preferences: preferences }); } function organizeImports(args, formatOptions, preferences) { - if (preferences === void 0) { preferences = ts.emptyOptions; } + if (preferences === void 0) { + preferences = ts.emptyOptions; + } synchronizeHostData(); ts.Debug.assert(args.type === "file"); var sourceFile = getValidSourceFile(args.fileName); @@ -160419,7 +161205,9 @@ var ts; return ts.OrganizeImports.organizeImports(sourceFile, formatContext, host, program, preferences, args.skipDestructiveCodeActions); } function getEditsForFileRename(oldFilePath, newFilePath, formatOptions, preferences) { - if (preferences === void 0) { preferences = ts.emptyOptions; } + if (preferences === void 0) { + preferences = ts.emptyOptions; + } return ts.getEditsForFileRename(getProgram(), oldFilePath, newFilePath, host, ts.formatting.getFormatContext(formatOptions, host), preferences, sourceMapper); } function applyCodeActionCommand(fileName, actionOrFormatSettingsOrUndefined) { @@ -160857,13 +161645,17 @@ var ts; return ts.SmartSelectionRange.getSmartSelectionRange(position, syntaxTreeCache.getCurrentSourceFile(fileName)); } function getApplicableRefactors(fileName, positionOrRange, preferences, triggerReason, kind) { - if (preferences === void 0) { preferences = ts.emptyOptions; } + if (preferences === void 0) { + preferences = ts.emptyOptions; + } synchronizeHostData(); var file = getValidSourceFile(fileName); return ts.refactor.getApplicableRefactors(getRefactorContext(file, positionOrRange, preferences, ts.emptyOptions, triggerReason, kind)); } function getEditsForRefactor(fileName, formatOptions, positionOrRange, refactorName, actionName, preferences) { - if (preferences === void 0) { preferences = ts.emptyOptions; } + if (preferences === void 0) { + preferences = ts.emptyOptions; + } synchronizeHostData(); var file = getValidSourceFile(fileName); return ts.refactor.getEditsForRefactor(getRefactorContext(file, positionOrRange, preferences, formatOptions), refactorName, actionName); @@ -160896,7 +161688,9 @@ var ts; return declaration ? ts.CallHierarchy.getOutgoingCalls(program, declaration) : []; } function provideInlayHints(fileName, span, preferences) { - if (preferences === void 0) { preferences = ts.emptyOptions; } + if (preferences === void 0) { + preferences = ts.emptyOptions; + } synchronizeHostData(); var sourceFile = getValidSourceFile(fileName); return ts.InlayHints.provideInlayHints(getInlayHintsContext(sourceFile, span, preferences)); @@ -162364,12 +163158,16 @@ var ts; } ClassifierShimObject.prototype.getEncodedLexicalClassifications = function (text, lexState, syntacticClassifierAbsent) { var _this = this; - if (syntacticClassifierAbsent === void 0) { syntacticClassifierAbsent = false; } + if (syntacticClassifierAbsent === void 0) { + syntacticClassifierAbsent = false; + } return forwardJSONCall(this.logger, "getEncodedLexicalClassifications", function () { return convertClassifications(_this.classifier.getEncodedLexicalClassifications(text, lexState, syntacticClassifierAbsent)); }, this.logPerformance); }; /// COLORIZATION ClassifierShimObject.prototype.getClassificationsForLine = function (text, lexState, classifyKeywordsInGenerics) { - if (classifyKeywordsInGenerics === void 0) { classifyKeywordsInGenerics = false; } + if (classifyKeywordsInGenerics === void 0) { + classifyKeywordsInGenerics = false; + } var classification = this.classifier.getClassificationsForLine(text, lexState, classifyKeywordsInGenerics); var result = ""; for (var _i = 0, _a = classification.entries; _i < _a.length; _i++) { @@ -163322,7 +164120,9 @@ var ts; }, factoryDeprecation); /** @deprecated Use `factory.updateBinary` or the factory supplied by your transformation context instead. */ ts.updateBinary = ts.Debug.deprecate(function updateBinary(node, left, right, operator) { - if (operator === void 0) { operator = node.operatorToken; } + if (operator === void 0) { + operator = node.operatorToken; + } if (typeof operator === "number") { operator = operator === node.operatorToken.kind ? node.operatorToken : ts.factory.createToken(operator); } @@ -163404,7 +164204,9 @@ var ts; }, factoryDeprecation); /** @deprecated Use `factory.createImportClause` or the factory supplied by your transformation context instead. */ ts.createImportClause = ts.Debug.deprecate(function createImportClause(name, namedBindings, isTypeOnly) { - if (isTypeOnly === void 0) { isTypeOnly = false; } + if (isTypeOnly === void 0) { + isTypeOnly = false; + } return ts.factory.createImportClause(isTypeOnly, name, namedBindings); }, factoryDeprecation); /** @deprecated Use `factory.updateImportClause` or the factory supplied by your transformation context instead. */ @@ -163413,7 +164215,9 @@ var ts; }, factoryDeprecation); /** @deprecated Use `factory.createExportDeclaration` or the factory supplied by your transformation context instead. */ ts.createExportDeclaration = ts.Debug.deprecate(function createExportDeclaration(decorators, modifiers, exportClause, moduleSpecifier, isTypeOnly) { - if (isTypeOnly === void 0) { isTypeOnly = false; } + if (isTypeOnly === void 0) { + isTypeOnly = false; + } return ts.factory.createExportDeclaration(decorators, modifiers, isTypeOnly, exportClause, moduleSpecifier); }, factoryDeprecation); /** @deprecated Use `factory.updateExportDeclaration` or the factory supplied by your transformation context instead. */ @@ -163470,8 +164274,12 @@ var ts; }, factoryDeprecation); /** @deprecated Use an appropriate `factory` method instead. */ ts.createNode = ts.Debug.deprecate(function createNode(kind, pos, end) { - if (pos === void 0) { pos = 0; } - if (end === void 0) { end = 0; } + if (pos === void 0) { + pos = 0; + } + if (end === void 0) { + end = 0; + } return ts.setTextRangePosEnd(kind === 303 /* SourceFile */ ? ts.parseBaseNodeFactory.createBaseSourceFileNode(kind) : kind === 79 /* Identifier */ ? ts.parseBaseNodeFactory.createBaseIdentifierNode(kind) : kind === 80 /* PrivateIdentifier */ ? ts.parseBaseNodeFactory.createBasePrivateIdentifierNode(kind) : @@ -163527,9 +164335,6 @@ var ts; // #endregion Renamed node Tests })(ts || (ts = {})); - - - // MONACOCHANGE export var createClassifier = ts.createClassifier; export var createLanguageService = ts.createLanguageService; From 5c130f328d9845f04e86028497b289e6cbef7dc2 Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Wed, 5 Oct 2022 16:31:24 -0700 Subject: [PATCH 6/7] Global regex replace to do all --- build/importTypescript.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build/importTypescript.ts b/build/importTypescript.ts index 58539eeea0..3e98353867 100644 --- a/build/importTypescript.ts +++ b/build/importTypescript.ts @@ -114,20 +114,20 @@ export const typescriptVersion = "${typeScriptDependencyVersion}";\n` tsServices = transformed.outputText; tsServices = tsServices.replace( - /^( +)debugger;$/m, + /^( +)debugger;$/gm, '$1// MONACOCHANGE\n$1// debugger;\n$1// END MONACOCHANGE' ); tsServices = tsServices.replace( - /typeof require === "function"/m, + /typeof require === "function"/g, '/* MONACOCHANGE */ false /* END MONACOCHANGE */' ); tsServices = tsServices.replace( - /typeof require !== "undefined"/m, + /typeof require !== "undefined"/g, '/* MONACOCHANGE */ false /* END MONACOCHANGE */' ); tsServices = tsServices.replace( - /module.exports = ts;/m, + /module.exports = ts;/g, '/* MONACOCHANGE */ /*module.exports = ts;*/ /* END MONACOCHANGE */' ); From 506918b32057d97aaa05cee01226ffd313712dba Mon Sep 17 00:00:00 2001 From: Jake Bailey <5341706+jakebailey@users.noreply.github.com> Date: Wed, 5 Oct 2022 16:40:32 -0700 Subject: [PATCH 7/7] Add comment to change --- build/importTypescript.ts | 25 ++++++++++++++++--- .../typescript/lib/typescriptServices-amd.js | 2 +- .../typescript/lib/typescriptServices.js | 2 +- 3 files changed, 23 insertions(+), 6 deletions(-) diff --git a/build/importTypescript.ts b/build/importTypescript.ts index 3e98353867..c030c8f8a3 100644 --- a/build/importTypescript.ts +++ b/build/importTypescript.ts @@ -40,7 +40,8 @@ export const typescriptVersion = "${typeScriptDependencyVersion}";\n` const transformed = ts.transpileModule(tsServices, { compilerOptions: { - target: ts.ScriptTarget.Latest + target: ts.ScriptTarget.Latest, + removeComments: false }, transformers: { after: [ @@ -75,7 +76,23 @@ export const typescriptVersion = "${typeScriptDependencyVersion}";\n` // Ensure we never run into the node system... if (ts.isFunctionDeclaration(node) && node.name?.escapedText === 'getNodeSystem') { - // HACK: don't call the deprecated method when the new one is available. + const returnStatement = context.factory.createReturnStatement( + context.factory.createIdentifier('undefined') + ); + ts.addSyntheticLeadingComment( + returnStatement, + ts.SyntaxKind.MultiLineCommentTrivia, + ' MONACOCHANGE ' + ); + ts.addSyntheticTrailingComment( + returnStatement, + ts.SyntaxKind.MultiLineCommentTrivia, + ' END MONACOCHANGE ' + ); + + const block = context.factory.createBlock([returnStatement]); + + // Don't call the deprecated method when the new one is available. if (parseFloat(ts.versionMajorMinor) < 4.8) { return context.factory.updateFunctionDeclaration( node, @@ -86,7 +103,7 @@ export const typescriptVersion = "${typeScriptDependencyVersion}";\n` node.typeParameters, node.parameters, node.type, - context.factory.createBlock([]) + block ); } else { return (context.factory.updateFunctionDeclaration as any)( @@ -97,7 +114,7 @@ export const typescriptVersion = "${typeScriptDependencyVersion}";\n` node.typeParameters, node.parameters, node.type, - context.factory.createBlock([]) + block ); } } diff --git a/src/language/typescript/lib/typescriptServices-amd.js b/src/language/typescript/lib/typescriptServices-amd.js index d44945288e..4f10ae9319 100644 --- a/src/language/typescript/lib/typescriptServices-amd.js +++ b/src/language/typescript/lib/typescriptServices-amd.js @@ -7564,7 +7564,7 @@ var ts; // byte order mark from the specified encoding. Using any other byte order mark does // not actually work. var byteOrderMarkIndicator = "\uFEFF"; - function getNodeSystem() { } + function getNodeSystem() { /* MONACOCHANGE */ return undefined; /* END MONACOCHANGE */ } var sys; if (typeof process !== "undefined" && process.nextTick && !process.browser && /* MONACOCHANGE */ false /* END MONACOCHANGE */) { // process and process.nextTick checks if current environment is node-like diff --git a/src/language/typescript/lib/typescriptServices.js b/src/language/typescript/lib/typescriptServices.js index e23ed69221..ac4e2b8a9d 100644 --- a/src/language/typescript/lib/typescriptServices.js +++ b/src/language/typescript/lib/typescriptServices.js @@ -7564,7 +7564,7 @@ var ts; // byte order mark from the specified encoding. Using any other byte order mark does // not actually work. var byteOrderMarkIndicator = "\uFEFF"; - function getNodeSystem() { } + function getNodeSystem() { /* MONACOCHANGE */ return undefined; /* END MONACOCHANGE */ } var sys; if (typeof process !== "undefined" && process.nextTick && !process.browser && /* MONACOCHANGE */ false /* END MONACOCHANGE */) { // process and process.nextTick checks if current environment is node-like