typescript 5.6.0-dev.20240813 → 5.6.0-dev.20240815
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/tsc.js +95 -58
- package/lib/typescript.d.ts +1 -0
- package/lib/typescript.js +149 -87
- package/package.json +4 -2
package/lib/tsc.js
CHANGED
|
@@ -18,7 +18,7 @@ and limitations under the License.
|
|
|
18
18
|
|
|
19
19
|
// src/compiler/corePublic.ts
|
|
20
20
|
var versionMajorMinor = "5.6";
|
|
21
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
21
|
+
var version = `${versionMajorMinor}.0-dev.20240815`;
|
|
22
22
|
|
|
23
23
|
// src/compiler/core.ts
|
|
24
24
|
var emptyArray = [];
|
|
@@ -1688,7 +1688,7 @@ Node ${formatSyntaxKind(node.kind)} was unexpected.`,
|
|
|
1688
1688
|
Object.defineProperties(array, {
|
|
1689
1689
|
__tsDebuggerDisplay: {
|
|
1690
1690
|
value(defaultValue) {
|
|
1691
|
-
defaultValue = String(defaultValue).replace(/(?:,[\s\w
|
|
1691
|
+
defaultValue = String(defaultValue).replace(/(?:,[\s\w]+:[^,]+)+\]$/, "]");
|
|
1692
1692
|
return `NodeArray ${defaultValue}`;
|
|
1693
1693
|
}
|
|
1694
1694
|
}
|
|
@@ -2231,7 +2231,7 @@ var prereleaseRegExp = /^(?:0|[1-9]\d*|[a-z-][a-z0-9-]*)(?:\.(?:0|[1-9]\d*|[a-z-
|
|
|
2231
2231
|
var prereleasePartRegExp = /^(?:0|[1-9]\d*|[a-z-][a-z0-9-]*)$/i;
|
|
2232
2232
|
var buildRegExp = /^[a-z0-9-]+(?:\.[a-z0-9-]+)*$/i;
|
|
2233
2233
|
var buildPartRegExp = /^[a-z0-9-]+$/i;
|
|
2234
|
-
var numericIdentifierRegExp = /^(0|[1-9]\d*)$/;
|
|
2234
|
+
var numericIdentifierRegExp = /^(?:0|[1-9]\d*)$/;
|
|
2235
2235
|
var _Version = class _Version {
|
|
2236
2236
|
constructor(major, minor = 0, patch = 0, prerelease = "", build2 = "") {
|
|
2237
2237
|
if (typeof major === "string") {
|
|
@@ -2354,11 +2354,11 @@ var VersionRange = class _VersionRange {
|
|
|
2354
2354
|
return formatDisjunction(this._alternatives);
|
|
2355
2355
|
}
|
|
2356
2356
|
};
|
|
2357
|
-
var logicalOrRegExp =
|
|
2358
|
-
var whitespaceRegExp = /\s
|
|
2359
|
-
var partialRegExp = /^([
|
|
2357
|
+
var logicalOrRegExp = /\|\|/;
|
|
2358
|
+
var whitespaceRegExp = /\s+/;
|
|
2359
|
+
var partialRegExp = /^([x*0]|[1-9]\d*)(?:\.([x*0]|[1-9]\d*)(?:\.([x*0]|[1-9]\d*)(?:-([a-z0-9-.]+))?(?:\+([a-z0-9-.]+))?)?)?$/i;
|
|
2360
2360
|
var hyphenRegExp = /^\s*([a-z0-9-+.*]+)\s+-\s+([a-z0-9-+.*]+)\s*$/i;
|
|
2361
|
-
var rangeRegExp = /^(
|
|
2361
|
+
var rangeRegExp = /^([~^<>=]|<=|>=)?\s*([a-z0-9-+.*]+)$/i;
|
|
2362
2362
|
function parseRange(text) {
|
|
2363
2363
|
const alternatives = [];
|
|
2364
2364
|
for (let range of text.trim().split(logicalOrRegExp)) {
|
|
@@ -4843,7 +4843,7 @@ function patchWriteFileEnsuringDirectory(sys2) {
|
|
|
4843
4843
|
var sys = (() => {
|
|
4844
4844
|
const byteOrderMarkIndicator = "\uFEFF";
|
|
4845
4845
|
function getNodeSystem() {
|
|
4846
|
-
const nativePattern = /^native |^\([^)]+\)$|^(internal[\\/]|[
|
|
4846
|
+
const nativePattern = /^native |^\([^)]+\)$|^(?:internal[\\/]|[\w\s]+(?:\.js)?$)/;
|
|
4847
4847
|
const _fs = require("fs");
|
|
4848
4848
|
const _path = require("path");
|
|
4849
4849
|
const _os = require("os");
|
|
@@ -4954,7 +4954,7 @@ var sys = (() => {
|
|
|
4954
4954
|
disableCPUProfiler,
|
|
4955
4955
|
cpuProfilingEnabled: () => !!activeSession || contains(process.execArgv, "--cpu-prof") || contains(process.execArgv, "--prof"),
|
|
4956
4956
|
realpath,
|
|
4957
|
-
debugMode: !!process.env.NODE_INSPECTOR_IPC || !!process.env.VSCODE_INSPECTOR_OPTIONS || some(process.execArgv, (arg) => /^--(inspect|debug)(
|
|
4957
|
+
debugMode: !!process.env.NODE_INSPECTOR_IPC || !!process.env.VSCODE_INSPECTOR_OPTIONS || some(process.execArgv, (arg) => /^--(?:inspect|debug)(?:-brk)?(?:=\d+)?$/i.test(arg)) || !!process.recordreplay,
|
|
4958
4958
|
tryEnableSourceMapsForHost() {
|
|
4959
4959
|
try {
|
|
4960
4960
|
require("source-map-support").install();
|
|
@@ -5301,7 +5301,7 @@ function pathIsAbsolute(path) {
|
|
|
5301
5301
|
return getEncodedRootLength(path) !== 0;
|
|
5302
5302
|
}
|
|
5303
5303
|
function pathIsRelative(path) {
|
|
5304
|
-
return /^\.\.?(
|
|
5304
|
+
return /^\.\.?(?:$|[\\/])/.test(path);
|
|
5305
5305
|
}
|
|
5306
5306
|
function pathIsBareSpecifier(path) {
|
|
5307
5307
|
return !pathIsAbsolute(path) && !pathIsRelative(path);
|
|
@@ -5534,7 +5534,7 @@ function changeFullExtension(path, newExtension) {
|
|
|
5534
5534
|
}
|
|
5535
5535
|
return changeAnyExtension(path, newExtension);
|
|
5536
5536
|
}
|
|
5537
|
-
var relativePathSegmentRegExp =
|
|
5537
|
+
var relativePathSegmentRegExp = /\/\/|(?:^|\/)\.\.?(?:$|\/)/;
|
|
5538
5538
|
function comparePathsWorker(a, b, componentComparer) {
|
|
5539
5539
|
if (a === b) return 0 /* EqualTo */;
|
|
5540
5540
|
if (a === void 0) return -1 /* LessThan */;
|
|
@@ -7390,6 +7390,7 @@ var Diagnostics = {
|
|
|
7390
7390
|
Do_not_transform_or_elide_any_imports_or_exports_not_marked_as_type_only_ensuring_they_are_written_in_the_output_file_s_format_based_on_the_module_setting: diag(6804, 3 /* Message */, "Do_not_transform_or_elide_any_imports_or_exports_not_marked_as_type_only_ensuring_they_are_written_i_6804", "Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting."),
|
|
7391
7391
|
Disable_full_type_checking_only_critical_parse_and_emit_errors_will_be_reported: diag(6805, 3 /* Message */, "Disable_full_type_checking_only_critical_parse_and_emit_errors_will_be_reported_6805", "Disable full type checking (only critical parse and emit errors will be reported)."),
|
|
7392
7392
|
Check_side_effect_imports: diag(6806, 3 /* Message */, "Check_side_effect_imports_6806", "Check side effect imports."),
|
|
7393
|
+
This_operation_can_be_simplified_This_shift_is_identical_to_0_1_2: diag(6807, 1 /* Error */, "This_operation_can_be_simplified_This_shift_is_identical_to_0_1_2_6807", "This operation can be simplified. This shift is identical to `{0} {1} {2}`."),
|
|
7393
7394
|
one_of_Colon: diag(6900, 3 /* Message */, "one_of_Colon_6900", "one of:"),
|
|
7394
7395
|
one_or_more_Colon: diag(6901, 3 /* Message */, "one_or_more_Colon_6901", "one or more:"),
|
|
7395
7396
|
type_Colon: diag(6902, 3 /* Message */, "type_Colon_6902", "type:"),
|
|
@@ -11186,7 +11187,7 @@ function getNodeFlags(node) {
|
|
|
11186
11187
|
var supportedLocaleDirectories = ["cs", "de", "es", "fr", "it", "ja", "ko", "pl", "pt-br", "ru", "tr", "zh-cn", "zh-tw"];
|
|
11187
11188
|
function validateLocaleAndSetLanguage(locale, sys2, errors) {
|
|
11188
11189
|
const lowerCaseLocale = locale.toLowerCase();
|
|
11189
|
-
const matchResult = /^([a-z]+)([_-]([a-z]+))?$/.exec(lowerCaseLocale);
|
|
11190
|
+
const matchResult = /^([a-z]+)(?:[_-]([a-z]+))?$/.exec(lowerCaseLocale);
|
|
11190
11191
|
if (!matchResult) {
|
|
11191
11192
|
if (errors) {
|
|
11192
11193
|
errors.push(createCompilerDiagnostic(Diagnostics.Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1, "en", "ja-jp"));
|
|
@@ -11194,7 +11195,7 @@ function validateLocaleAndSetLanguage(locale, sys2, errors) {
|
|
|
11194
11195
|
return;
|
|
11195
11196
|
}
|
|
11196
11197
|
const language = matchResult[1];
|
|
11197
|
-
const territory = matchResult[
|
|
11198
|
+
const territory = matchResult[2];
|
|
11198
11199
|
if (contains(supportedLocaleDirectories, lowerCaseLocale) && !trySetLanguageAndTerritory(language, territory, errors)) {
|
|
11199
11200
|
trySetLanguageAndTerritory(
|
|
11200
11201
|
language,
|
|
@@ -13870,12 +13871,12 @@ function getJSDocCommentRanges(node, text) {
|
|
|
13870
13871
|
return filter(commentRanges, (comment) => comment.end <= node.end && // Due to parse errors sometime empty parameter may get comments assigned to it that end up not in parameter range
|
|
13871
13872
|
text.charCodeAt(comment.pos + 1) === 42 /* asterisk */ && text.charCodeAt(comment.pos + 2) === 42 /* asterisk */ && text.charCodeAt(comment.pos + 3) !== 47 /* slash */);
|
|
13872
13873
|
}
|
|
13873
|
-
var fullTripleSlashReferencePathRegEx =
|
|
13874
|
-
var fullTripleSlashReferenceTypeReferenceDirectiveRegEx =
|
|
13875
|
-
var fullTripleSlashLibReferenceRegEx =
|
|
13876
|
-
var fullTripleSlashAMDReferencePathRegEx =
|
|
13877
|
-
var fullTripleSlashAMDModuleRegEx = /^\/\/\/\s*<amd-module\s
|
|
13878
|
-
var defaultLibReferenceRegEx =
|
|
13874
|
+
var fullTripleSlashReferencePathRegEx = /^\/\/\/\s*<reference\s+path\s*=\s*(?:'[^']*'|"[^"]*").*?\/>/;
|
|
13875
|
+
var fullTripleSlashReferenceTypeReferenceDirectiveRegEx = /^\/\/\/\s*<reference\s+types\s*=\s*(?:'[^']*'|"[^"]*").*?\/>/;
|
|
13876
|
+
var fullTripleSlashLibReferenceRegEx = /^\/\/\/\s*<reference\s+lib\s*=\s*(?:'[^']*'|"[^"]*").*?\/>/;
|
|
13877
|
+
var fullTripleSlashAMDReferencePathRegEx = /^\/\/\/\s*<amd-dependency\s+path\s*=\s*(?:'[^']*'|"[^"]*").*?\/>/;
|
|
13878
|
+
var fullTripleSlashAMDModuleRegEx = /^\/\/\/\s*<amd-module\s+(?:\S.*?)??\/>/;
|
|
13879
|
+
var defaultLibReferenceRegEx = /^\/\/\/\s*<reference\s+no-default-lib\s*=\s*(?:'[^']*'|"[^"]*")\s*\/>/;
|
|
13879
13880
|
function isPartOfTypeNode(node) {
|
|
13880
13881
|
if (182 /* FirstTypeNode */ <= node.kind && node.kind <= 205 /* LastTypeNode */) {
|
|
13881
13882
|
return true;
|
|
@@ -15926,9 +15927,9 @@ function containsInvalidEscapeFlag(node) {
|
|
|
15926
15927
|
function hasInvalidEscape(template) {
|
|
15927
15928
|
return template && !!(isNoSubstitutionTemplateLiteral(template) ? containsInvalidEscapeFlag(template) : containsInvalidEscapeFlag(template.head) || some(template.templateSpans, (span) => containsInvalidEscapeFlag(span.literal)));
|
|
15928
15929
|
}
|
|
15929
|
-
var doubleQuoteEscapedCharsRegExp = /[\\"\u0000-\u001f\
|
|
15930
|
-
var singleQuoteEscapedCharsRegExp = /[\\'\u0000-\u001f\
|
|
15931
|
-
var backtickQuoteEscapedCharsRegExp = /\r\n|[\\`\u0000-\u001f\
|
|
15930
|
+
var doubleQuoteEscapedCharsRegExp = /[\\"\u0000-\u001f\u2028\u2029\u0085]/g;
|
|
15931
|
+
var singleQuoteEscapedCharsRegExp = /[\\'\u0000-\u001f\u2028\u2029\u0085]/g;
|
|
15932
|
+
var backtickQuoteEscapedCharsRegExp = /\r\n|[\\`\u0000-\u001f\u2028\u2029\u0085]/g;
|
|
15932
15933
|
var escapedCharsMap = new Map(Object.entries({
|
|
15933
15934
|
" ": "\\t",
|
|
15934
15935
|
"\v": "\\v",
|
|
@@ -17331,7 +17332,7 @@ var objectAllocator = {
|
|
|
17331
17332
|
getSourceMapSourceConstructor: () => SourceMapSource
|
|
17332
17333
|
};
|
|
17333
17334
|
function formatStringFromArgs(text, args) {
|
|
17334
|
-
return text.replace(
|
|
17335
|
+
return text.replace(/\{(\d+)\}/g, (_match, index) => "" + Debug.checkDefined(args[+index]));
|
|
17335
17336
|
}
|
|
17336
17337
|
var localizedDiagnosticMessages;
|
|
17337
17338
|
function setLocalizedDiagnosticMessages(messages) {
|
|
@@ -35462,8 +35463,8 @@ function getNamedArgRegEx(name) {
|
|
|
35462
35463
|
namedArgRegExCache.set(name, result);
|
|
35463
35464
|
return result;
|
|
35464
35465
|
}
|
|
35465
|
-
var tripleSlashXMLCommentStartRegEx = /^\/\/\/\s*<(\S+)\s.*?\/>/
|
|
35466
|
-
var singleLinePragmaRegEx = /^\/\/\/?\s*@([^\s:]+)(.*)
|
|
35466
|
+
var tripleSlashXMLCommentStartRegEx = /^\/\/\/\s*<(\S+)\s.*?\/>/m;
|
|
35467
|
+
var singleLinePragmaRegEx = /^\/\/\/?\s*@([^\s:]+)((?:[^\S\r\n]|:).*)?$/m;
|
|
35467
35468
|
function extractPragmas(pragmas, range, text) {
|
|
35468
35469
|
const tripleSlash = range.kind === 2 /* SingleLineCommentTrivia */ && tripleSlashXMLCommentStartRegEx.exec(text);
|
|
35469
35470
|
if (tripleSlash) {
|
|
@@ -35504,7 +35505,7 @@ function extractPragmas(pragmas, range, text) {
|
|
|
35504
35505
|
return addPragmaForMatch(pragmas, range, 2 /* SingleLine */, singleLine);
|
|
35505
35506
|
}
|
|
35506
35507
|
if (range.kind === 3 /* MultiLineCommentTrivia */) {
|
|
35507
|
-
const multiLinePragmaRegEx = /@(\S+)(\s
|
|
35508
|
+
const multiLinePragmaRegEx = /@(\S+)(\s+(?:\S.*)?)?$/gm;
|
|
35508
35509
|
let multiLineMatch;
|
|
35509
35510
|
while (multiLineMatch = multiLinePragmaRegEx.exec(text)) {
|
|
35510
35511
|
addPragmaForMatch(pragmas, range, 4 /* MultiLine */, multiLineMatch);
|
|
@@ -38576,7 +38577,7 @@ function convertJsonOptionOfCustomType(opt, value, errors, valueExpression, sour
|
|
|
38576
38577
|
function convertJsonOptionOfListType(option, values, basePath, errors, propertyAssignment, valueExpression, sourceFile) {
|
|
38577
38578
|
return filter(map(values, (v, index) => convertJsonOption(option.element, v, basePath, errors, propertyAssignment, valueExpression == null ? void 0 : valueExpression.elements[index], sourceFile)), (v) => option.listPreserveFalsyValues ? true : !!v);
|
|
38578
38579
|
}
|
|
38579
|
-
var invalidTrailingRecursionPattern = /(
|
|
38580
|
+
var invalidTrailingRecursionPattern = /(?:^|\/)\*\*\/?$/;
|
|
38580
38581
|
var wildcardDirectoryPattern = /^[^*?]*(?=\/[^/]*[*?])/;
|
|
38581
38582
|
function getFileNamesFromConfigSpecs(configFileSpecs, basePath, options, host, extraFileExtensions = emptyArray) {
|
|
38582
38583
|
basePath = normalizePath(basePath);
|
|
@@ -44067,21 +44068,25 @@ function createBinder() {
|
|
|
44067
44068
|
const reportError = (
|
|
44068
44069
|
// report error on all statements except empty ones
|
|
44069
44070
|
isStatementButNotDeclaration(node) && node.kind !== 242 /* EmptyStatement */ || // report error on class declarations
|
|
44070
|
-
node.kind === 263 /* ClassDeclaration */ || // report
|
|
44071
|
+
node.kind === 263 /* ClassDeclaration */ || // report errors on enums with preserved emit
|
|
44072
|
+
isEnumDeclarationWithPreservedEmit(node, options) || // report error on instantiated modules
|
|
44071
44073
|
node.kind === 267 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)
|
|
44072
44074
|
);
|
|
44073
44075
|
if (reportError) {
|
|
44074
44076
|
currentFlow = reportedUnreachableFlow;
|
|
44075
44077
|
if (!options.allowUnreachableCode) {
|
|
44076
44078
|
const isError = unreachableCodeIsError(options) && !(node.flags & 33554432 /* Ambient */) && (!isVariableStatement(node) || !!(getCombinedNodeFlags(node.declarationList) & 7 /* BlockScoped */) || node.declarationList.declarations.some((d) => !!d.initializer));
|
|
44077
|
-
eachUnreachableRange(node, (start, end) => errorOrSuggestionOnRange(isError, start, end, Diagnostics.Unreachable_code_detected));
|
|
44079
|
+
eachUnreachableRange(node, options, (start, end) => errorOrSuggestionOnRange(isError, start, end, Diagnostics.Unreachable_code_detected));
|
|
44078
44080
|
}
|
|
44079
44081
|
}
|
|
44080
44082
|
}
|
|
44081
44083
|
return true;
|
|
44082
44084
|
}
|
|
44083
44085
|
}
|
|
44084
|
-
function
|
|
44086
|
+
function isEnumDeclarationWithPreservedEmit(node, options) {
|
|
44087
|
+
return node.kind === 266 /* EnumDeclaration */ && (!isEnumConst(node) || shouldPreserveConstEnums(options));
|
|
44088
|
+
}
|
|
44089
|
+
function eachUnreachableRange(node, options, cb) {
|
|
44085
44090
|
if (isStatement(node) && isExecutableStatement(node) && isBlock(node.parent)) {
|
|
44086
44091
|
const { statements } = node.parent;
|
|
44087
44092
|
const slice = sliceAfter(statements, node);
|
|
@@ -44089,22 +44094,22 @@ function eachUnreachableRange(node, cb) {
|
|
|
44089
44094
|
} else {
|
|
44090
44095
|
cb(node, node);
|
|
44091
44096
|
}
|
|
44092
|
-
|
|
44093
|
-
|
|
44094
|
-
|
|
44095
|
-
|
|
44096
|
-
|
|
44097
|
-
|
|
44098
|
-
|
|
44099
|
-
|
|
44100
|
-
|
|
44101
|
-
|
|
44102
|
-
|
|
44103
|
-
|
|
44104
|
-
|
|
44105
|
-
|
|
44106
|
-
|
|
44107
|
-
|
|
44097
|
+
function isExecutableStatement(s) {
|
|
44098
|
+
return !isFunctionDeclaration(s) && !isPurelyTypeDeclaration(s) && // `var x;` may declare a variable used above
|
|
44099
|
+
!(isVariableStatement(s) && !(getCombinedNodeFlags(s) & 7 /* BlockScoped */) && s.declarationList.declarations.some((d) => !d.initializer));
|
|
44100
|
+
}
|
|
44101
|
+
function isPurelyTypeDeclaration(s) {
|
|
44102
|
+
switch (s.kind) {
|
|
44103
|
+
case 264 /* InterfaceDeclaration */:
|
|
44104
|
+
case 265 /* TypeAliasDeclaration */:
|
|
44105
|
+
return true;
|
|
44106
|
+
case 267 /* ModuleDeclaration */:
|
|
44107
|
+
return getModuleInstanceState(s) !== 1 /* Instantiated */;
|
|
44108
|
+
case 266 /* EnumDeclaration */:
|
|
44109
|
+
return !isEnumDeclarationWithPreservedEmit(s, options);
|
|
44110
|
+
default:
|
|
44111
|
+
return false;
|
|
44112
|
+
}
|
|
44108
44113
|
}
|
|
44109
44114
|
}
|
|
44110
44115
|
function isExportsOrModuleExportsOrAlias(sourceFile, node) {
|
|
@@ -53908,7 +53913,7 @@ function createTypeChecker(host) {
|
|
|
53908
53913
|
} else if (localName === "export=" /* ExportEquals */) {
|
|
53909
53914
|
localName = "_exports";
|
|
53910
53915
|
}
|
|
53911
|
-
localName = isIdentifierText(localName, languageVersion) && !isStringANonContextualKeyword(localName) ? localName : "_" + localName.replace(/[^a-
|
|
53916
|
+
localName = isIdentifierText(localName, languageVersion) && !isStringANonContextualKeyword(localName) ? localName : "_" + localName.replace(/[^a-z0-9]/gi, "_");
|
|
53912
53917
|
return localName;
|
|
53913
53918
|
}
|
|
53914
53919
|
function getInternalSymbolName(symbol, localName) {
|
|
@@ -60239,7 +60244,7 @@ function createTypeChecker(host) {
|
|
|
60239
60244
|
} else if (every(typeSet, (t) => !!(t.flags & 1048576 /* Union */ && (t.types[0].flags & 65536 /* Null */ || t.types[1].flags & 65536 /* Null */)))) {
|
|
60240
60245
|
removeFromEach(typeSet, 65536 /* Null */);
|
|
60241
60246
|
result = getUnionType([getIntersectionType(typeSet, flags), nullType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
|
|
60242
|
-
} else if (typeSet.length >=
|
|
60247
|
+
} else if (typeSet.length >= 3 && types.length > 2) {
|
|
60243
60248
|
const middle = Math.floor(typeSet.length / 2);
|
|
60244
60249
|
result = getIntersectionType([getIntersectionType(typeSet.slice(0, middle), flags), getIntersectionType(typeSet.slice(middle), flags)], flags, aliasSymbol, aliasTypeArguments);
|
|
60245
60250
|
} else {
|
|
@@ -73593,7 +73598,7 @@ function createTypeChecker(host) {
|
|
|
73593
73598
|
addErrorOrSuggestion(!isUncheckedJS || errorInfo.code !== Diagnostics.Property_0_may_not_exist_on_type_1_Did_you_mean_2.code, resultDiagnostic);
|
|
73594
73599
|
}
|
|
73595
73600
|
function containerSeemsToBeEmptyDomElement(containingType) {
|
|
73596
|
-
return compilerOptions.lib && !compilerOptions.lib.includes("dom") && everyContainedType(containingType, (type) => type.symbol && /^(EventTarget|Node|(
|
|
73601
|
+
return compilerOptions.lib && !compilerOptions.lib.includes("dom") && everyContainedType(containingType, (type) => type.symbol && /^(?:EventTarget|Node|(?:HTML[a-zA-Z]*)?Element)$/.test(unescapeLeadingUnderscores(type.symbol.escapedName))) && isEmptyObjectType(containingType);
|
|
73597
73602
|
}
|
|
73598
73603
|
function typeHasStaticProperty(propName, containingType) {
|
|
73599
73604
|
const prop = containingType.symbol && getPropertyOfType(getTypeOfSymbol(containingType.symbol), propName);
|
|
@@ -78136,6 +78141,29 @@ function createTypeChecker(host) {
|
|
|
78136
78141
|
}
|
|
78137
78142
|
if (leftOk && rightOk) {
|
|
78138
78143
|
checkAssignmentOperator(resultType2);
|
|
78144
|
+
switch (operator) {
|
|
78145
|
+
case 48 /* LessThanLessThanToken */:
|
|
78146
|
+
case 71 /* LessThanLessThanEqualsToken */:
|
|
78147
|
+
case 49 /* GreaterThanGreaterThanToken */:
|
|
78148
|
+
case 72 /* GreaterThanGreaterThanEqualsToken */:
|
|
78149
|
+
case 50 /* GreaterThanGreaterThanGreaterThanToken */:
|
|
78150
|
+
case 73 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
|
|
78151
|
+
const rhsEval = evaluate(right);
|
|
78152
|
+
if (typeof rhsEval.value === "number" && Math.abs(rhsEval.value) >= 32) {
|
|
78153
|
+
errorOrSuggestion(
|
|
78154
|
+
isEnumMember(walkUpParenthesizedExpressions(right.parent.parent)),
|
|
78155
|
+
// elevate from suggestion to error within an enum member
|
|
78156
|
+
errorNode || operatorToken,
|
|
78157
|
+
Diagnostics.This_operation_can_be_simplified_This_shift_is_identical_to_0_1_2,
|
|
78158
|
+
getTextOfNode(left),
|
|
78159
|
+
tokenToString(operator),
|
|
78160
|
+
rhsEval.value % 32
|
|
78161
|
+
);
|
|
78162
|
+
}
|
|
78163
|
+
break;
|
|
78164
|
+
default:
|
|
78165
|
+
break;
|
|
78166
|
+
}
|
|
78139
78167
|
}
|
|
78140
78168
|
return resultType2;
|
|
78141
78169
|
}
|
|
@@ -81452,7 +81480,7 @@ function createTypeChecker(host) {
|
|
|
81452
81480
|
);
|
|
81453
81481
|
if (globalAsyncDisposableType !== emptyObjectType && globalDisposableType !== emptyObjectType) {
|
|
81454
81482
|
const optionalDisposableType = getUnionType([globalAsyncDisposableType, globalDisposableType, nullType, undefinedType]);
|
|
81455
|
-
checkTypeAssignableTo(initializerType, optionalDisposableType, initializer, Diagnostics.The_initializer_of_an_await_using_declaration_must_be_either_an_object_with_a_Symbol_asyncDispose_or_Symbol_dispose_method_or_be_null_or_undefined);
|
|
81483
|
+
checkTypeAssignableTo(widenTypeForVariableLikeDeclaration(initializerType, node), optionalDisposableType, initializer, Diagnostics.The_initializer_of_an_await_using_declaration_must_be_either_an_object_with_a_Symbol_asyncDispose_or_Symbol_dispose_method_or_be_null_or_undefined);
|
|
81456
81484
|
}
|
|
81457
81485
|
} else if (blockScopeKind === 4 /* Using */) {
|
|
81458
81486
|
const globalDisposableType = getGlobalDisposableType(
|
|
@@ -81461,7 +81489,7 @@ function createTypeChecker(host) {
|
|
|
81461
81489
|
);
|
|
81462
81490
|
if (globalDisposableType !== emptyObjectType) {
|
|
81463
81491
|
const optionalDisposableType = getUnionType([globalDisposableType, nullType, undefinedType]);
|
|
81464
|
-
checkTypeAssignableTo(initializerType, optionalDisposableType, initializer, Diagnostics.The_initializer_of_a_using_declaration_must_be_either_an_object_with_a_Symbol_dispose_method_or_be_null_or_undefined);
|
|
81492
|
+
checkTypeAssignableTo(widenTypeForVariableLikeDeclaration(initializerType, node), optionalDisposableType, initializer, Diagnostics.The_initializer_of_a_using_declaration_must_be_either_an_object_with_a_Symbol_dispose_method_or_be_null_or_undefined);
|
|
81465
81493
|
}
|
|
81466
81494
|
}
|
|
81467
81495
|
}
|
|
@@ -101724,7 +101752,7 @@ function transformJsx(context) {
|
|
|
101724
101752
|
const name = node.name;
|
|
101725
101753
|
if (isIdentifier(name)) {
|
|
101726
101754
|
const text = idText(name);
|
|
101727
|
-
return /^[A-
|
|
101755
|
+
return /^[A-Z_]\w*$/i.test(text) ? name : factory2.createStringLiteral(text);
|
|
101728
101756
|
}
|
|
101729
101757
|
return factory2.createStringLiteral(idText(name.namespace) + ":" + idText(name.name));
|
|
101730
101758
|
}
|
|
@@ -116687,7 +116715,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
116687
116715
|
if (node.comment) {
|
|
116688
116716
|
const text = getTextOfJSDocComment(node.comment);
|
|
116689
116717
|
if (text) {
|
|
116690
|
-
const lines = text.split(/\r\n?|\n/
|
|
116718
|
+
const lines = text.split(/\r\n?|\n/);
|
|
116691
116719
|
for (const line of lines) {
|
|
116692
116720
|
writeLine();
|
|
116693
116721
|
writeSpace();
|
|
@@ -117114,7 +117142,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
117114
117142
|
if (isFunctionLike(parentNode) && parentNode.typeArguments) {
|
|
117115
117143
|
return emitTypeArguments(parentNode, parentNode.typeArguments);
|
|
117116
117144
|
}
|
|
117117
|
-
emitList(parentNode, typeParameters, 53776 /* TypeParameters */);
|
|
117145
|
+
emitList(parentNode, typeParameters, 53776 /* TypeParameters */ | (isArrowFunction(parentNode) ? 64 /* AllowTrailingComma */ : 0 /* None */));
|
|
117118
117146
|
}
|
|
117119
117147
|
function emitParameters(parentNode, parameters) {
|
|
117120
117148
|
emitList(parentNode, parameters, 2576 /* Parameters */);
|
|
@@ -117382,7 +117410,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
117382
117410
|
}
|
|
117383
117411
|
}
|
|
117384
117412
|
function writeLines(text) {
|
|
117385
|
-
const lines = text.split(/\r\n?|\n/
|
|
117413
|
+
const lines = text.split(/\r\n?|\n/);
|
|
117386
117414
|
const indentation = guessIndentation(lines);
|
|
117387
117415
|
for (const lineText of lines) {
|
|
117388
117416
|
const line = indentation ? lineText.slice(indentation) : lineText;
|
|
@@ -118708,6 +118736,12 @@ function createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensi
|
|
|
118708
118736
|
function realpath(s) {
|
|
118709
118737
|
return host.realpath ? host.realpath(s) : s;
|
|
118710
118738
|
}
|
|
118739
|
+
function clearFirstAncestorEntry(fileOrDirectoryPath) {
|
|
118740
|
+
forEachAncestorDirectory(
|
|
118741
|
+
getDirectoryPath(fileOrDirectoryPath),
|
|
118742
|
+
(ancestor) => cachedReadDirectoryResult.delete(ensureTrailingDirectorySeparator(ancestor)) ? true : void 0
|
|
118743
|
+
);
|
|
118744
|
+
}
|
|
118711
118745
|
function addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath) {
|
|
118712
118746
|
const existingResult = getCachedFileSystemEntries(fileOrDirectoryPath);
|
|
118713
118747
|
if (existingResult !== void 0) {
|
|
@@ -118716,6 +118750,7 @@ function createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensi
|
|
|
118716
118750
|
}
|
|
118717
118751
|
const parentResult = getCachedFileSystemEntriesForBaseDir(fileOrDirectoryPath);
|
|
118718
118752
|
if (!parentResult) {
|
|
118753
|
+
clearFirstAncestorEntry(fileOrDirectoryPath);
|
|
118719
118754
|
return void 0;
|
|
118720
118755
|
}
|
|
118721
118756
|
if (!host.directoryExists) {
|
|
@@ -118741,6 +118776,8 @@ function createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensi
|
|
|
118741
118776
|
const parentResult = getCachedFileSystemEntriesForBaseDir(filePath);
|
|
118742
118777
|
if (parentResult) {
|
|
118743
118778
|
updateFilesOfFileSystemEntry(parentResult, getBaseNameOfFileName(fileName), eventKind === 0 /* Created */);
|
|
118779
|
+
} else {
|
|
118780
|
+
clearFirstAncestorEntry(filePath);
|
|
118744
118781
|
}
|
|
118745
118782
|
}
|
|
118746
118783
|
function updateFilesOfFileSystemEntry(parentResult, baseName, fileExists2) {
|
|
@@ -121012,7 +121049,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121012
121049
|
return line;
|
|
121013
121050
|
}
|
|
121014
121051
|
const lineText = file.text.slice(lineStarts[line], lineStarts[line + 1]).trim();
|
|
121015
|
-
if (lineText !== "" &&
|
|
121052
|
+
if (lineText !== "" && !/^\s*\/\/.*$/.test(lineText)) {
|
|
121016
121053
|
return -1;
|
|
121017
121054
|
}
|
|
121018
121055
|
line--;
|
|
@@ -125013,9 +125050,9 @@ function removeIgnoredPath(path) {
|
|
|
125013
125050
|
function perceivedOsRootLengthForWatching(pathComponents2, length2) {
|
|
125014
125051
|
if (length2 <= 1) return 1;
|
|
125015
125052
|
let indexAfterOsRoot = 1;
|
|
125016
|
-
let isDosStyle = pathComponents2[0].search(/[a-
|
|
125053
|
+
let isDosStyle = pathComponents2[0].search(/[a-z]:/i) === 0;
|
|
125017
125054
|
if (pathComponents2[0] !== directorySeparator && !isDosStyle && // Non dos style paths
|
|
125018
|
-
pathComponents2[1].search(/[a-
|
|
125055
|
+
pathComponents2[1].search(/[a-z]\$$/i) === 0) {
|
|
125019
125056
|
if (length2 === 2) return 2;
|
|
125020
125057
|
indexAfterOsRoot = 2;
|
|
125021
125058
|
isDosStyle = true;
|
package/lib/typescript.d.ts
CHANGED
|
@@ -3318,6 +3318,7 @@ declare namespace ts {
|
|
|
3318
3318
|
setHostConfiguration(args: protocol.ConfigureRequestArguments): void;
|
|
3319
3319
|
private getWatchOptionsFromProjectWatchOptions;
|
|
3320
3320
|
closeLog(): void;
|
|
3321
|
+
private sendSourceFileChange;
|
|
3321
3322
|
/**
|
|
3322
3323
|
* This function rebuilds the project for every file opened by the client
|
|
3323
3324
|
* This does not reload contents of open files from disk. But we could do that if needed
|
package/lib/typescript.js
CHANGED
|
@@ -2262,7 +2262,7 @@ module.exports = __toCommonJS(typescript_exports);
|
|
|
2262
2262
|
|
|
2263
2263
|
// src/compiler/corePublic.ts
|
|
2264
2264
|
var versionMajorMinor = "5.6";
|
|
2265
|
-
var version = `${versionMajorMinor}.0-dev.
|
|
2265
|
+
var version = `${versionMajorMinor}.0-dev.20240815`;
|
|
2266
2266
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
2267
2267
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
2268
2268
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -4235,7 +4235,7 @@ Node ${formatSyntaxKind(node.kind)} was unexpected.`,
|
|
|
4235
4235
|
Object.defineProperties(array, {
|
|
4236
4236
|
__tsDebuggerDisplay: {
|
|
4237
4237
|
value(defaultValue) {
|
|
4238
|
-
defaultValue = String(defaultValue).replace(/(?:,[\s\w
|
|
4238
|
+
defaultValue = String(defaultValue).replace(/(?:,[\s\w]+:[^,]+)+\]$/, "]");
|
|
4239
4239
|
return `NodeArray ${defaultValue}`;
|
|
4240
4240
|
}
|
|
4241
4241
|
}
|
|
@@ -4778,7 +4778,7 @@ var prereleaseRegExp = /^(?:0|[1-9]\d*|[a-z-][a-z0-9-]*)(?:\.(?:0|[1-9]\d*|[a-z-
|
|
|
4778
4778
|
var prereleasePartRegExp = /^(?:0|[1-9]\d*|[a-z-][a-z0-9-]*)$/i;
|
|
4779
4779
|
var buildRegExp = /^[a-z0-9-]+(?:\.[a-z0-9-]+)*$/i;
|
|
4780
4780
|
var buildPartRegExp = /^[a-z0-9-]+$/i;
|
|
4781
|
-
var numericIdentifierRegExp = /^(0|[1-9]\d*)$/;
|
|
4781
|
+
var numericIdentifierRegExp = /^(?:0|[1-9]\d*)$/;
|
|
4782
4782
|
var _Version = class _Version {
|
|
4783
4783
|
constructor(major, minor = 0, patch = 0, prerelease = "", build2 = "") {
|
|
4784
4784
|
if (typeof major === "string") {
|
|
@@ -4901,11 +4901,11 @@ var VersionRange = class _VersionRange {
|
|
|
4901
4901
|
return formatDisjunction(this._alternatives);
|
|
4902
4902
|
}
|
|
4903
4903
|
};
|
|
4904
|
-
var logicalOrRegExp =
|
|
4905
|
-
var whitespaceRegExp = /\s
|
|
4906
|
-
var partialRegExp = /^([
|
|
4904
|
+
var logicalOrRegExp = /\|\|/;
|
|
4905
|
+
var whitespaceRegExp = /\s+/;
|
|
4906
|
+
var partialRegExp = /^([x*0]|[1-9]\d*)(?:\.([x*0]|[1-9]\d*)(?:\.([x*0]|[1-9]\d*)(?:-([a-z0-9-.]+))?(?:\+([a-z0-9-.]+))?)?)?$/i;
|
|
4907
4907
|
var hyphenRegExp = /^\s*([a-z0-9-+.*]+)\s+-\s+([a-z0-9-+.*]+)\s*$/i;
|
|
4908
|
-
var rangeRegExp = /^(
|
|
4908
|
+
var rangeRegExp = /^([~^<>=]|<=|>=)?\s*([a-z0-9-+.*]+)$/i;
|
|
4909
4909
|
function parseRange(text) {
|
|
4910
4910
|
const alternatives = [];
|
|
4911
4911
|
for (let range of text.trim().split(logicalOrRegExp)) {
|
|
@@ -8228,7 +8228,7 @@ function patchWriteFileEnsuringDirectory(sys2) {
|
|
|
8228
8228
|
var sys = (() => {
|
|
8229
8229
|
const byteOrderMarkIndicator = "\uFEFF";
|
|
8230
8230
|
function getNodeSystem() {
|
|
8231
|
-
const nativePattern = /^native |^\([^)]+\)$|^(internal[\\/]|[
|
|
8231
|
+
const nativePattern = /^native |^\([^)]+\)$|^(?:internal[\\/]|[\w\s]+(?:\.js)?$)/;
|
|
8232
8232
|
const _fs = require("fs");
|
|
8233
8233
|
const _path = require("path");
|
|
8234
8234
|
const _os = require("os");
|
|
@@ -8339,7 +8339,7 @@ var sys = (() => {
|
|
|
8339
8339
|
disableCPUProfiler,
|
|
8340
8340
|
cpuProfilingEnabled: () => !!activeSession || contains(process.execArgv, "--cpu-prof") || contains(process.execArgv, "--prof"),
|
|
8341
8341
|
realpath,
|
|
8342
|
-
debugMode: !!process.env.NODE_INSPECTOR_IPC || !!process.env.VSCODE_INSPECTOR_OPTIONS || some(process.execArgv, (arg) => /^--(inspect|debug)(
|
|
8342
|
+
debugMode: !!process.env.NODE_INSPECTOR_IPC || !!process.env.VSCODE_INSPECTOR_OPTIONS || some(process.execArgv, (arg) => /^--(?:inspect|debug)(?:-brk)?(?:=\d+)?$/i.test(arg)) || !!process.recordreplay,
|
|
8343
8343
|
tryEnableSourceMapsForHost() {
|
|
8344
8344
|
try {
|
|
8345
8345
|
require("source-map-support").install();
|
|
@@ -8692,7 +8692,7 @@ function pathIsAbsolute(path) {
|
|
|
8692
8692
|
return getEncodedRootLength(path) !== 0;
|
|
8693
8693
|
}
|
|
8694
8694
|
function pathIsRelative(path) {
|
|
8695
|
-
return /^\.\.?(
|
|
8695
|
+
return /^\.\.?(?:$|[\\/])/.test(path);
|
|
8696
8696
|
}
|
|
8697
8697
|
function pathIsBareSpecifier(path) {
|
|
8698
8698
|
return !pathIsAbsolute(path) && !pathIsRelative(path);
|
|
@@ -8925,7 +8925,7 @@ function changeFullExtension(path, newExtension) {
|
|
|
8925
8925
|
}
|
|
8926
8926
|
return changeAnyExtension(path, newExtension);
|
|
8927
8927
|
}
|
|
8928
|
-
var relativePathSegmentRegExp =
|
|
8928
|
+
var relativePathSegmentRegExp = /\/\/|(?:^|\/)\.\.?(?:$|\/)/;
|
|
8929
8929
|
function comparePathsWorker(a, b, componentComparer) {
|
|
8930
8930
|
if (a === b) return 0 /* EqualTo */;
|
|
8931
8931
|
if (a === void 0) return -1 /* LessThan */;
|
|
@@ -10787,6 +10787,7 @@ var Diagnostics = {
|
|
|
10787
10787
|
Do_not_transform_or_elide_any_imports_or_exports_not_marked_as_type_only_ensuring_they_are_written_in_the_output_file_s_format_based_on_the_module_setting: diag(6804, 3 /* Message */, "Do_not_transform_or_elide_any_imports_or_exports_not_marked_as_type_only_ensuring_they_are_written_i_6804", "Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting."),
|
|
10788
10788
|
Disable_full_type_checking_only_critical_parse_and_emit_errors_will_be_reported: diag(6805, 3 /* Message */, "Disable_full_type_checking_only_critical_parse_and_emit_errors_will_be_reported_6805", "Disable full type checking (only critical parse and emit errors will be reported)."),
|
|
10789
10789
|
Check_side_effect_imports: diag(6806, 3 /* Message */, "Check_side_effect_imports_6806", "Check side effect imports."),
|
|
10790
|
+
This_operation_can_be_simplified_This_shift_is_identical_to_0_1_2: diag(6807, 1 /* Error */, "This_operation_can_be_simplified_This_shift_is_identical_to_0_1_2_6807", "This operation can be simplified. This shift is identical to `{0} {1} {2}`."),
|
|
10790
10791
|
one_of_Colon: diag(6900, 3 /* Message */, "one_of_Colon_6900", "one of:"),
|
|
10791
10792
|
one_or_more_Colon: diag(6901, 3 /* Message */, "one_or_more_Colon_6901", "one or more:"),
|
|
10792
10793
|
type_Colon: diag(6902, 3 /* Message */, "type_Colon_6902", "type:"),
|
|
@@ -14718,7 +14719,7 @@ function getNodeFlags(node) {
|
|
|
14718
14719
|
var supportedLocaleDirectories = ["cs", "de", "es", "fr", "it", "ja", "ko", "pl", "pt-br", "ru", "tr", "zh-cn", "zh-tw"];
|
|
14719
14720
|
function validateLocaleAndSetLanguage(locale, sys2, errors) {
|
|
14720
14721
|
const lowerCaseLocale = locale.toLowerCase();
|
|
14721
|
-
const matchResult = /^([a-z]+)([_-]([a-z]+))?$/.exec(lowerCaseLocale);
|
|
14722
|
+
const matchResult = /^([a-z]+)(?:[_-]([a-z]+))?$/.exec(lowerCaseLocale);
|
|
14722
14723
|
if (!matchResult) {
|
|
14723
14724
|
if (errors) {
|
|
14724
14725
|
errors.push(createCompilerDiagnostic(Diagnostics.Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1, "en", "ja-jp"));
|
|
@@ -14726,7 +14727,7 @@ function validateLocaleAndSetLanguage(locale, sys2, errors) {
|
|
|
14726
14727
|
return;
|
|
14727
14728
|
}
|
|
14728
14729
|
const language = matchResult[1];
|
|
14729
|
-
const territory = matchResult[
|
|
14730
|
+
const territory = matchResult[2];
|
|
14730
14731
|
if (contains(supportedLocaleDirectories, lowerCaseLocale) && !trySetLanguageAndTerritory(language, territory, errors)) {
|
|
14731
14732
|
trySetLanguageAndTerritory(
|
|
14732
14733
|
language,
|
|
@@ -17565,12 +17566,12 @@ function getJSDocCommentRanges(node, text) {
|
|
|
17565
17566
|
return filter(commentRanges, (comment) => comment.end <= node.end && // Due to parse errors sometime empty parameter may get comments assigned to it that end up not in parameter range
|
|
17566
17567
|
text.charCodeAt(comment.pos + 1) === 42 /* asterisk */ && text.charCodeAt(comment.pos + 2) === 42 /* asterisk */ && text.charCodeAt(comment.pos + 3) !== 47 /* slash */);
|
|
17567
17568
|
}
|
|
17568
|
-
var fullTripleSlashReferencePathRegEx =
|
|
17569
|
-
var fullTripleSlashReferenceTypeReferenceDirectiveRegEx =
|
|
17570
|
-
var fullTripleSlashLibReferenceRegEx =
|
|
17571
|
-
var fullTripleSlashAMDReferencePathRegEx =
|
|
17572
|
-
var fullTripleSlashAMDModuleRegEx = /^\/\/\/\s*<amd-module\s
|
|
17573
|
-
var defaultLibReferenceRegEx =
|
|
17569
|
+
var fullTripleSlashReferencePathRegEx = /^\/\/\/\s*<reference\s+path\s*=\s*(?:'[^']*'|"[^"]*").*?\/>/;
|
|
17570
|
+
var fullTripleSlashReferenceTypeReferenceDirectiveRegEx = /^\/\/\/\s*<reference\s+types\s*=\s*(?:'[^']*'|"[^"]*").*?\/>/;
|
|
17571
|
+
var fullTripleSlashLibReferenceRegEx = /^\/\/\/\s*<reference\s+lib\s*=\s*(?:'[^']*'|"[^"]*").*?\/>/;
|
|
17572
|
+
var fullTripleSlashAMDReferencePathRegEx = /^\/\/\/\s*<amd-dependency\s+path\s*=\s*(?:'[^']*'|"[^"]*").*?\/>/;
|
|
17573
|
+
var fullTripleSlashAMDModuleRegEx = /^\/\/\/\s*<amd-module\s+(?:\S.*?)??\/>/;
|
|
17574
|
+
var defaultLibReferenceRegEx = /^\/\/\/\s*<reference\s+no-default-lib\s*=\s*(?:'[^']*'|"[^"]*")\s*\/>/;
|
|
17574
17575
|
function isPartOfTypeNode(node) {
|
|
17575
17576
|
if (182 /* FirstTypeNode */ <= node.kind && node.kind <= 205 /* LastTypeNode */) {
|
|
17576
17577
|
return true;
|
|
@@ -19740,9 +19741,9 @@ function containsInvalidEscapeFlag(node) {
|
|
|
19740
19741
|
function hasInvalidEscape(template) {
|
|
19741
19742
|
return template && !!(isNoSubstitutionTemplateLiteral(template) ? containsInvalidEscapeFlag(template) : containsInvalidEscapeFlag(template.head) || some(template.templateSpans, (span) => containsInvalidEscapeFlag(span.literal)));
|
|
19742
19743
|
}
|
|
19743
|
-
var doubleQuoteEscapedCharsRegExp = /[\\"\u0000-\u001f\
|
|
19744
|
-
var singleQuoteEscapedCharsRegExp = /[\\'\u0000-\u001f\
|
|
19745
|
-
var backtickQuoteEscapedCharsRegExp = /\r\n|[\\`\u0000-\u001f\
|
|
19744
|
+
var doubleQuoteEscapedCharsRegExp = /[\\"\u0000-\u001f\u2028\u2029\u0085]/g;
|
|
19745
|
+
var singleQuoteEscapedCharsRegExp = /[\\'\u0000-\u001f\u2028\u2029\u0085]/g;
|
|
19746
|
+
var backtickQuoteEscapedCharsRegExp = /\r\n|[\\`\u0000-\u001f\u2028\u2029\u0085]/g;
|
|
19746
19747
|
var escapedCharsMap = new Map(Object.entries({
|
|
19747
19748
|
" ": "\\t",
|
|
19748
19749
|
"\v": "\\v",
|
|
@@ -21290,7 +21291,7 @@ function setObjectAllocator(alloc) {
|
|
|
21290
21291
|
forEach(objectAllocatorPatchers, (fn) => fn(objectAllocator));
|
|
21291
21292
|
}
|
|
21292
21293
|
function formatStringFromArgs(text, args) {
|
|
21293
|
-
return text.replace(
|
|
21294
|
+
return text.replace(/\{(\d+)\}/g, (_match, index) => "" + Debug.checkDefined(args[+index]));
|
|
21294
21295
|
}
|
|
21295
21296
|
var localizedDiagnosticMessages;
|
|
21296
21297
|
function setLocalizedDiagnosticMessages(messages) {
|
|
@@ -22786,7 +22787,7 @@ function isFunctionExpressionOrArrowFunction(node) {
|
|
|
22786
22787
|
return node.kind === 218 /* FunctionExpression */ || node.kind === 219 /* ArrowFunction */;
|
|
22787
22788
|
}
|
|
22788
22789
|
function escapeSnippetText(text) {
|
|
22789
|
-
return text.replace(/\$/
|
|
22790
|
+
return text.replace(/\$/g, () => "\\$");
|
|
22790
22791
|
}
|
|
22791
22792
|
function isNumericLiteralName(name) {
|
|
22792
22793
|
return (+name).toString() === name;
|
|
@@ -39732,8 +39733,8 @@ function getNamedArgRegEx(name) {
|
|
|
39732
39733
|
namedArgRegExCache.set(name, result);
|
|
39733
39734
|
return result;
|
|
39734
39735
|
}
|
|
39735
|
-
var tripleSlashXMLCommentStartRegEx = /^\/\/\/\s*<(\S+)\s.*?\/>/
|
|
39736
|
-
var singleLinePragmaRegEx = /^\/\/\/?\s*@([^\s:]+)(.*)
|
|
39736
|
+
var tripleSlashXMLCommentStartRegEx = /^\/\/\/\s*<(\S+)\s.*?\/>/m;
|
|
39737
|
+
var singleLinePragmaRegEx = /^\/\/\/?\s*@([^\s:]+)((?:[^\S\r\n]|:).*)?$/m;
|
|
39737
39738
|
function extractPragmas(pragmas, range, text) {
|
|
39738
39739
|
const tripleSlash = range.kind === 2 /* SingleLineCommentTrivia */ && tripleSlashXMLCommentStartRegEx.exec(text);
|
|
39739
39740
|
if (tripleSlash) {
|
|
@@ -39774,7 +39775,7 @@ function extractPragmas(pragmas, range, text) {
|
|
|
39774
39775
|
return addPragmaForMatch(pragmas, range, 2 /* SingleLine */, singleLine);
|
|
39775
39776
|
}
|
|
39776
39777
|
if (range.kind === 3 /* MultiLineCommentTrivia */) {
|
|
39777
|
-
const multiLinePragmaRegEx = /@(\S+)(\s
|
|
39778
|
+
const multiLinePragmaRegEx = /@(\S+)(\s+(?:\S.*)?)?$/gm;
|
|
39778
39779
|
let multiLineMatch;
|
|
39779
39780
|
while (multiLineMatch = multiLinePragmaRegEx.exec(text)) {
|
|
39780
39781
|
addPragmaForMatch(pragmas, range, 4 /* MultiLine */, multiLineMatch);
|
|
@@ -42881,7 +42882,7 @@ function convertJsonOptionOfCustomType(opt, value, errors, valueExpression, sour
|
|
|
42881
42882
|
function convertJsonOptionOfListType(option, values, basePath, errors, propertyAssignment, valueExpression, sourceFile) {
|
|
42882
42883
|
return filter(map(values, (v, index) => convertJsonOption(option.element, v, basePath, errors, propertyAssignment, valueExpression == null ? void 0 : valueExpression.elements[index], sourceFile)), (v) => option.listPreserveFalsyValues ? true : !!v);
|
|
42883
42884
|
}
|
|
42884
|
-
var invalidTrailingRecursionPattern = /(
|
|
42885
|
+
var invalidTrailingRecursionPattern = /(?:^|\/)\*\*\/?$/;
|
|
42885
42886
|
var wildcardDirectoryPattern = /^[^*?]*(?=\/[^/]*[*?])/;
|
|
42886
42887
|
function getFileNamesFromConfigSpecs(configFileSpecs, basePath, options, host, extraFileExtensions = emptyArray) {
|
|
42887
42888
|
basePath = normalizePath(basePath);
|
|
@@ -48586,21 +48587,25 @@ function createBinder() {
|
|
|
48586
48587
|
const reportError = (
|
|
48587
48588
|
// report error on all statements except empty ones
|
|
48588
48589
|
isStatementButNotDeclaration(node) && node.kind !== 242 /* EmptyStatement */ || // report error on class declarations
|
|
48589
|
-
node.kind === 263 /* ClassDeclaration */ || // report
|
|
48590
|
+
node.kind === 263 /* ClassDeclaration */ || // report errors on enums with preserved emit
|
|
48591
|
+
isEnumDeclarationWithPreservedEmit(node, options) || // report error on instantiated modules
|
|
48590
48592
|
node.kind === 267 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node)
|
|
48591
48593
|
);
|
|
48592
48594
|
if (reportError) {
|
|
48593
48595
|
currentFlow = reportedUnreachableFlow;
|
|
48594
48596
|
if (!options.allowUnreachableCode) {
|
|
48595
48597
|
const isError = unreachableCodeIsError(options) && !(node.flags & 33554432 /* Ambient */) && (!isVariableStatement(node) || !!(getCombinedNodeFlags(node.declarationList) & 7 /* BlockScoped */) || node.declarationList.declarations.some((d) => !!d.initializer));
|
|
48596
|
-
eachUnreachableRange(node, (start, end) => errorOrSuggestionOnRange(isError, start, end, Diagnostics.Unreachable_code_detected));
|
|
48598
|
+
eachUnreachableRange(node, options, (start, end) => errorOrSuggestionOnRange(isError, start, end, Diagnostics.Unreachable_code_detected));
|
|
48597
48599
|
}
|
|
48598
48600
|
}
|
|
48599
48601
|
}
|
|
48600
48602
|
return true;
|
|
48601
48603
|
}
|
|
48602
48604
|
}
|
|
48603
|
-
function
|
|
48605
|
+
function isEnumDeclarationWithPreservedEmit(node, options) {
|
|
48606
|
+
return node.kind === 266 /* EnumDeclaration */ && (!isEnumConst(node) || shouldPreserveConstEnums(options));
|
|
48607
|
+
}
|
|
48608
|
+
function eachUnreachableRange(node, options, cb) {
|
|
48604
48609
|
if (isStatement(node) && isExecutableStatement(node) && isBlock(node.parent)) {
|
|
48605
48610
|
const { statements } = node.parent;
|
|
48606
48611
|
const slice = sliceAfter(statements, node);
|
|
@@ -48608,22 +48613,22 @@ function eachUnreachableRange(node, cb) {
|
|
|
48608
48613
|
} else {
|
|
48609
48614
|
cb(node, node);
|
|
48610
48615
|
}
|
|
48611
|
-
|
|
48612
|
-
|
|
48613
|
-
|
|
48614
|
-
|
|
48615
|
-
|
|
48616
|
-
|
|
48617
|
-
|
|
48618
|
-
|
|
48619
|
-
|
|
48620
|
-
|
|
48621
|
-
|
|
48622
|
-
|
|
48623
|
-
|
|
48624
|
-
|
|
48625
|
-
|
|
48626
|
-
|
|
48616
|
+
function isExecutableStatement(s) {
|
|
48617
|
+
return !isFunctionDeclaration(s) && !isPurelyTypeDeclaration(s) && // `var x;` may declare a variable used above
|
|
48618
|
+
!(isVariableStatement(s) && !(getCombinedNodeFlags(s) & 7 /* BlockScoped */) && s.declarationList.declarations.some((d) => !d.initializer));
|
|
48619
|
+
}
|
|
48620
|
+
function isPurelyTypeDeclaration(s) {
|
|
48621
|
+
switch (s.kind) {
|
|
48622
|
+
case 264 /* InterfaceDeclaration */:
|
|
48623
|
+
case 265 /* TypeAliasDeclaration */:
|
|
48624
|
+
return true;
|
|
48625
|
+
case 267 /* ModuleDeclaration */:
|
|
48626
|
+
return getModuleInstanceState(s) !== 1 /* Instantiated */;
|
|
48627
|
+
case 266 /* EnumDeclaration */:
|
|
48628
|
+
return !isEnumDeclarationWithPreservedEmit(s, options);
|
|
48629
|
+
default:
|
|
48630
|
+
return false;
|
|
48631
|
+
}
|
|
48627
48632
|
}
|
|
48628
48633
|
}
|
|
48629
48634
|
function isExportsOrModuleExportsOrAlias(sourceFile, node) {
|
|
@@ -58527,7 +58532,7 @@ function createTypeChecker(host) {
|
|
|
58527
58532
|
} else if (localName === "export=" /* ExportEquals */) {
|
|
58528
58533
|
localName = "_exports";
|
|
58529
58534
|
}
|
|
58530
|
-
localName = isIdentifierText(localName, languageVersion) && !isStringANonContextualKeyword(localName) ? localName : "_" + localName.replace(/[^a-
|
|
58535
|
+
localName = isIdentifierText(localName, languageVersion) && !isStringANonContextualKeyword(localName) ? localName : "_" + localName.replace(/[^a-z0-9]/gi, "_");
|
|
58531
58536
|
return localName;
|
|
58532
58537
|
}
|
|
58533
58538
|
function getInternalSymbolName(symbol, localName) {
|
|
@@ -64858,7 +64863,7 @@ function createTypeChecker(host) {
|
|
|
64858
64863
|
} else if (every(typeSet, (t) => !!(t.flags & 1048576 /* Union */ && (t.types[0].flags & 65536 /* Null */ || t.types[1].flags & 65536 /* Null */)))) {
|
|
64859
64864
|
removeFromEach(typeSet, 65536 /* Null */);
|
|
64860
64865
|
result = getUnionType([getIntersectionType(typeSet, flags), nullType], 1 /* Literal */, aliasSymbol, aliasTypeArguments);
|
|
64861
|
-
} else if (typeSet.length >=
|
|
64866
|
+
} else if (typeSet.length >= 3 && types.length > 2) {
|
|
64862
64867
|
const middle = Math.floor(typeSet.length / 2);
|
|
64863
64868
|
result = getIntersectionType([getIntersectionType(typeSet.slice(0, middle), flags), getIntersectionType(typeSet.slice(middle), flags)], flags, aliasSymbol, aliasTypeArguments);
|
|
64864
64869
|
} else {
|
|
@@ -78212,7 +78217,7 @@ function createTypeChecker(host) {
|
|
|
78212
78217
|
addErrorOrSuggestion(!isUncheckedJS || errorInfo.code !== Diagnostics.Property_0_may_not_exist_on_type_1_Did_you_mean_2.code, resultDiagnostic);
|
|
78213
78218
|
}
|
|
78214
78219
|
function containerSeemsToBeEmptyDomElement(containingType) {
|
|
78215
|
-
return compilerOptions.lib && !compilerOptions.lib.includes("dom") && everyContainedType(containingType, (type) => type.symbol && /^(EventTarget|Node|(
|
|
78220
|
+
return compilerOptions.lib && !compilerOptions.lib.includes("dom") && everyContainedType(containingType, (type) => type.symbol && /^(?:EventTarget|Node|(?:HTML[a-zA-Z]*)?Element)$/.test(unescapeLeadingUnderscores(type.symbol.escapedName))) && isEmptyObjectType(containingType);
|
|
78216
78221
|
}
|
|
78217
78222
|
function typeHasStaticProperty(propName, containingType) {
|
|
78218
78223
|
const prop = containingType.symbol && getPropertyOfType(getTypeOfSymbol(containingType.symbol), propName);
|
|
@@ -82755,6 +82760,29 @@ function createTypeChecker(host) {
|
|
|
82755
82760
|
}
|
|
82756
82761
|
if (leftOk && rightOk) {
|
|
82757
82762
|
checkAssignmentOperator(resultType2);
|
|
82763
|
+
switch (operator) {
|
|
82764
|
+
case 48 /* LessThanLessThanToken */:
|
|
82765
|
+
case 71 /* LessThanLessThanEqualsToken */:
|
|
82766
|
+
case 49 /* GreaterThanGreaterThanToken */:
|
|
82767
|
+
case 72 /* GreaterThanGreaterThanEqualsToken */:
|
|
82768
|
+
case 50 /* GreaterThanGreaterThanGreaterThanToken */:
|
|
82769
|
+
case 73 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
|
|
82770
|
+
const rhsEval = evaluate(right);
|
|
82771
|
+
if (typeof rhsEval.value === "number" && Math.abs(rhsEval.value) >= 32) {
|
|
82772
|
+
errorOrSuggestion(
|
|
82773
|
+
isEnumMember(walkUpParenthesizedExpressions(right.parent.parent)),
|
|
82774
|
+
// elevate from suggestion to error within an enum member
|
|
82775
|
+
errorNode || operatorToken,
|
|
82776
|
+
Diagnostics.This_operation_can_be_simplified_This_shift_is_identical_to_0_1_2,
|
|
82777
|
+
getTextOfNode(left),
|
|
82778
|
+
tokenToString(operator),
|
|
82779
|
+
rhsEval.value % 32
|
|
82780
|
+
);
|
|
82781
|
+
}
|
|
82782
|
+
break;
|
|
82783
|
+
default:
|
|
82784
|
+
break;
|
|
82785
|
+
}
|
|
82758
82786
|
}
|
|
82759
82787
|
return resultType2;
|
|
82760
82788
|
}
|
|
@@ -86071,7 +86099,7 @@ function createTypeChecker(host) {
|
|
|
86071
86099
|
);
|
|
86072
86100
|
if (globalAsyncDisposableType !== emptyObjectType && globalDisposableType !== emptyObjectType) {
|
|
86073
86101
|
const optionalDisposableType = getUnionType([globalAsyncDisposableType, globalDisposableType, nullType, undefinedType]);
|
|
86074
|
-
checkTypeAssignableTo(initializerType, optionalDisposableType, initializer, Diagnostics.The_initializer_of_an_await_using_declaration_must_be_either_an_object_with_a_Symbol_asyncDispose_or_Symbol_dispose_method_or_be_null_or_undefined);
|
|
86102
|
+
checkTypeAssignableTo(widenTypeForVariableLikeDeclaration(initializerType, node), optionalDisposableType, initializer, Diagnostics.The_initializer_of_an_await_using_declaration_must_be_either_an_object_with_a_Symbol_asyncDispose_or_Symbol_dispose_method_or_be_null_or_undefined);
|
|
86075
86103
|
}
|
|
86076
86104
|
} else if (blockScopeKind === 4 /* Using */) {
|
|
86077
86105
|
const globalDisposableType = getGlobalDisposableType(
|
|
@@ -86080,7 +86108,7 @@ function createTypeChecker(host) {
|
|
|
86080
86108
|
);
|
|
86081
86109
|
if (globalDisposableType !== emptyObjectType) {
|
|
86082
86110
|
const optionalDisposableType = getUnionType([globalDisposableType, nullType, undefinedType]);
|
|
86083
|
-
checkTypeAssignableTo(initializerType, optionalDisposableType, initializer, Diagnostics.The_initializer_of_a_using_declaration_must_be_either_an_object_with_a_Symbol_dispose_method_or_be_null_or_undefined);
|
|
86111
|
+
checkTypeAssignableTo(widenTypeForVariableLikeDeclaration(initializerType, node), optionalDisposableType, initializer, Diagnostics.The_initializer_of_a_using_declaration_must_be_either_an_object_with_a_Symbol_dispose_method_or_be_null_or_undefined);
|
|
86084
86112
|
}
|
|
86085
86113
|
}
|
|
86086
86114
|
}
|
|
@@ -106525,7 +106553,7 @@ function transformJsx(context) {
|
|
|
106525
106553
|
const name = node.name;
|
|
106526
106554
|
if (isIdentifier(name)) {
|
|
106527
106555
|
const text = idText(name);
|
|
106528
|
-
return /^[A-
|
|
106556
|
+
return /^[A-Z_]\w*$/i.test(text) ? name : factory2.createStringLiteral(text);
|
|
106529
106557
|
}
|
|
106530
106558
|
return factory2.createStringLiteral(idText(name.namespace) + ":" + idText(name.name));
|
|
106531
106559
|
}
|
|
@@ -121499,7 +121527,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
121499
121527
|
if (node.comment) {
|
|
121500
121528
|
const text = getTextOfJSDocComment(node.comment);
|
|
121501
121529
|
if (text) {
|
|
121502
|
-
const lines = text.split(/\r\n?|\n/
|
|
121530
|
+
const lines = text.split(/\r\n?|\n/);
|
|
121503
121531
|
for (const line of lines) {
|
|
121504
121532
|
writeLine();
|
|
121505
121533
|
writeSpace();
|
|
@@ -121926,7 +121954,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
121926
121954
|
if (isFunctionLike(parentNode) && parentNode.typeArguments) {
|
|
121927
121955
|
return emitTypeArguments(parentNode, parentNode.typeArguments);
|
|
121928
121956
|
}
|
|
121929
|
-
emitList(parentNode, typeParameters, 53776 /* TypeParameters */);
|
|
121957
|
+
emitList(parentNode, typeParameters, 53776 /* TypeParameters */ | (isArrowFunction(parentNode) ? 64 /* AllowTrailingComma */ : 0 /* None */));
|
|
121930
121958
|
}
|
|
121931
121959
|
function emitParameters(parentNode, parameters) {
|
|
121932
121960
|
emitList(parentNode, parameters, 2576 /* Parameters */);
|
|
@@ -122194,7 +122222,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
122194
122222
|
}
|
|
122195
122223
|
}
|
|
122196
122224
|
function writeLines(text) {
|
|
122197
|
-
const lines = text.split(/\r\n?|\n/
|
|
122225
|
+
const lines = text.split(/\r\n?|\n/);
|
|
122198
122226
|
const indentation = guessIndentation(lines);
|
|
122199
122227
|
for (const lineText of lines) {
|
|
122200
122228
|
const line = indentation ? lineText.slice(indentation) : lineText;
|
|
@@ -123520,6 +123548,12 @@ function createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensi
|
|
|
123520
123548
|
function realpath(s) {
|
|
123521
123549
|
return host.realpath ? host.realpath(s) : s;
|
|
123522
123550
|
}
|
|
123551
|
+
function clearFirstAncestorEntry(fileOrDirectoryPath) {
|
|
123552
|
+
forEachAncestorDirectory(
|
|
123553
|
+
getDirectoryPath(fileOrDirectoryPath),
|
|
123554
|
+
(ancestor) => cachedReadDirectoryResult.delete(ensureTrailingDirectorySeparator(ancestor)) ? true : void 0
|
|
123555
|
+
);
|
|
123556
|
+
}
|
|
123523
123557
|
function addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath) {
|
|
123524
123558
|
const existingResult = getCachedFileSystemEntries(fileOrDirectoryPath);
|
|
123525
123559
|
if (existingResult !== void 0) {
|
|
@@ -123528,6 +123562,7 @@ function createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensi
|
|
|
123528
123562
|
}
|
|
123529
123563
|
const parentResult = getCachedFileSystemEntriesForBaseDir(fileOrDirectoryPath);
|
|
123530
123564
|
if (!parentResult) {
|
|
123565
|
+
clearFirstAncestorEntry(fileOrDirectoryPath);
|
|
123531
123566
|
return void 0;
|
|
123532
123567
|
}
|
|
123533
123568
|
if (!host.directoryExists) {
|
|
@@ -123553,6 +123588,8 @@ function createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensi
|
|
|
123553
123588
|
const parentResult = getCachedFileSystemEntriesForBaseDir(filePath);
|
|
123554
123589
|
if (parentResult) {
|
|
123555
123590
|
updateFilesOfFileSystemEntry(parentResult, getBaseNameOfFileName(fileName), eventKind === 0 /* Created */);
|
|
123591
|
+
} else {
|
|
123592
|
+
clearFirstAncestorEntry(filePath);
|
|
123556
123593
|
}
|
|
123557
123594
|
}
|
|
123558
123595
|
function updateFilesOfFileSystemEntry(parentResult, baseName, fileExists2) {
|
|
@@ -125870,7 +125907,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
125870
125907
|
return line;
|
|
125871
125908
|
}
|
|
125872
125909
|
const lineText = file.text.slice(lineStarts[line], lineStarts[line + 1]).trim();
|
|
125873
|
-
if (lineText !== "" &&
|
|
125910
|
+
if (lineText !== "" && !/^\s*\/\/.*$/.test(lineText)) {
|
|
125874
125911
|
return -1;
|
|
125875
125912
|
}
|
|
125876
125913
|
line--;
|
|
@@ -129932,9 +129969,9 @@ function removeIgnoredPath(path) {
|
|
|
129932
129969
|
function perceivedOsRootLengthForWatching(pathComponents2, length2) {
|
|
129933
129970
|
if (length2 <= 1) return 1;
|
|
129934
129971
|
let indexAfterOsRoot = 1;
|
|
129935
|
-
let isDosStyle = pathComponents2[0].search(/[a-
|
|
129972
|
+
let isDosStyle = pathComponents2[0].search(/[a-z]:/i) === 0;
|
|
129936
129973
|
if (pathComponents2[0] !== directorySeparator && !isDosStyle && // Non dos style paths
|
|
129937
|
-
pathComponents2[1].search(/[a-
|
|
129974
|
+
pathComponents2[1].search(/[a-z]\$$/i) === 0) {
|
|
129938
129975
|
if (length2 === 2) return 2;
|
|
129939
129976
|
indexAfterOsRoot = 2;
|
|
129940
129977
|
isDosStyle = true;
|
|
@@ -140175,8 +140212,8 @@ function getEncodedSyntacticClassifications(cancellationToken, sourceFile, span)
|
|
|
140175
140212
|
}
|
|
140176
140213
|
}
|
|
140177
140214
|
function tryClassifyTripleSlashComment(start, width) {
|
|
140178
|
-
const tripleSlashXMLCommentRegEx = /^(\/\/\/\s*)(<)(?:(\S+)((?:[^/]|\/[^>])*)(\/>)?)?/
|
|
140179
|
-
const attributeRegex = /(\s)(\S+)(\s*)(=)(\s*)('[^']+'|"[^"]+")/
|
|
140215
|
+
const tripleSlashXMLCommentRegEx = /^(\/\/\/\s*)(<)(?:(\S+)((?:[^/]|\/[^>])*)(\/>)?)?/m;
|
|
140216
|
+
const attributeRegex = /(\s)(\S+)(\s*)(=)(\s*)('[^']+'|"[^"]+")/g;
|
|
140180
140217
|
const text = sourceFile.text.substr(start, width);
|
|
140181
140218
|
const match = tripleSlashXMLCommentRegEx.exec(text);
|
|
140182
140219
|
if (!match) {
|
|
@@ -141889,7 +141926,7 @@ function preProcessFile(sourceText, readImportFiles = true, detectJavaScriptImpo
|
|
|
141889
141926
|
}
|
|
141890
141927
|
|
|
141891
141928
|
// src/services/sourcemaps.ts
|
|
141892
|
-
var base64UrlRegExp = /^data:(?:application\/json
|
|
141929
|
+
var base64UrlRegExp = /^data:(?:application\/json;charset=[uU][tT][fF]-8;base64,([A-Za-z0-9+/=]+)$)?/;
|
|
141893
141930
|
function getSourceMapper(host) {
|
|
141894
141931
|
const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames());
|
|
141895
141932
|
const currentDirectory = host.getCurrentDirectory();
|
|
@@ -142054,7 +142091,8 @@ function computeSuggestionDiagnostics(sourceFile, program, cancellationToken) {
|
|
|
142054
142091
|
}
|
|
142055
142092
|
addRange(diags, sourceFile.bindSuggestionDiagnostics);
|
|
142056
142093
|
addRange(diags, program.getSuggestionDiagnostics(sourceFile, cancellationToken));
|
|
142057
|
-
|
|
142094
|
+
diags.sort((d1, d2) => d1.start - d2.start);
|
|
142095
|
+
return diags;
|
|
142058
142096
|
function check(node) {
|
|
142059
142097
|
if (isJsFile) {
|
|
142060
142098
|
if (canBeConvertedToClass(node, checker)) {
|
|
@@ -142495,7 +142533,8 @@ function getContainers(declaration) {
|
|
|
142495
142533
|
}
|
|
142496
142534
|
container = getContainerNode(container);
|
|
142497
142535
|
}
|
|
142498
|
-
|
|
142536
|
+
containers.reverse();
|
|
142537
|
+
return containers;
|
|
142499
142538
|
}
|
|
142500
142539
|
function compareNavigateToItems(i1, i2) {
|
|
142501
142540
|
return compareValues(i1.matchKind, i2.matchKind) || compareStringsCaseSensitiveUI(i1.name, i2.name);
|
|
@@ -143275,7 +143314,7 @@ function isFunctionOrClassExpression(node) {
|
|
|
143275
143314
|
}
|
|
143276
143315
|
function cleanText(text) {
|
|
143277
143316
|
text = text.length > maxLength ? text.substring(0, maxLength) + "..." : text;
|
|
143278
|
-
return text.replace(/\\?(
|
|
143317
|
+
return text.replace(/\\?(?:\r?\n|[\r\u2028\u2029])/g, "");
|
|
143279
143318
|
}
|
|
143280
143319
|
|
|
143281
143320
|
// src/services/_namespaces/ts.refactor.ts
|
|
@@ -147395,8 +147434,8 @@ function extractFunctionInScope(node, scope, { usages: usagesInScope, typeParame
|
|
|
147395
147434
|
callArguments.push(factory.createIdentifier(name));
|
|
147396
147435
|
});
|
|
147397
147436
|
const typeParametersAndDeclarations = arrayFrom(typeParameterUsages.values(), (type) => ({ type, declaration: getFirstDeclarationBeforePosition(type, context.startPosition) }));
|
|
147398
|
-
|
|
147399
|
-
const typeParameters =
|
|
147437
|
+
typeParametersAndDeclarations.sort(compareTypesByDeclarationOrder);
|
|
147438
|
+
const typeParameters = typeParametersAndDeclarations.length === 0 ? void 0 : mapDefined(typeParametersAndDeclarations, ({ declaration }) => declaration);
|
|
147400
147439
|
const callTypeArguments = typeParameters !== void 0 ? typeParameters.map((decl) => factory.createTypeReferenceNode(
|
|
147401
147440
|
decl.name,
|
|
147402
147441
|
/*typeArguments*/
|
|
@@ -150711,7 +150750,7 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
|
|
|
150711
150750
|
return str.replace(/[-[\]/{}()*+?.\\^$|]/g, "\\$&");
|
|
150712
150751
|
}
|
|
150713
150752
|
function getTodoCommentsRegExp() {
|
|
150714
|
-
const singleLineCommentStart = /(
|
|
150753
|
+
const singleLineCommentStart = /(?:\/{2,}\s*)/.source;
|
|
150715
150754
|
const multiLineCommentStart = /(?:\/\*+\s*)/.source;
|
|
150716
150755
|
const anyNumberOfSpacesAndAsterisksAtStartOfLine = /(?:^(?:\s|\*)*)/.source;
|
|
150717
150756
|
const preamble = "(" + anyNumberOfSpacesAndAsterisksAtStartOfLine + "|" + singleLineCommentStart + "|" + multiLineCommentStart + ")";
|
|
@@ -154760,7 +154799,7 @@ function getLeftAndRightSiblings(typedefNode) {
|
|
|
154760
154799
|
function findEndOfTextBetween(jsDocComment, from, to) {
|
|
154761
154800
|
const comment = jsDocComment.getText().substring(from - jsDocComment.getStart(), to - jsDocComment.getStart());
|
|
154762
154801
|
for (let i = comment.length; i > 0; i--) {
|
|
154763
|
-
if (!/[*/\s]
|
|
154802
|
+
if (!/[*/\s]/.test(comment.substring(i - 1, i))) {
|
|
154764
154803
|
return from + i;
|
|
154765
154804
|
}
|
|
154766
154805
|
}
|
|
@@ -172485,9 +172524,10 @@ ${content}
|
|
|
172485
172524
|
parsedNodes.push({ sourceFile: sourceFile2, body: bod });
|
|
172486
172525
|
}
|
|
172487
172526
|
}
|
|
172488
|
-
|
|
172527
|
+
parsedNodes.sort(
|
|
172489
172528
|
(a, b) => a.sourceFile.parseDiagnostics.length - b.sourceFile.parseDiagnostics.length
|
|
172490
|
-
)
|
|
172529
|
+
);
|
|
172530
|
+
const { body } = parsedNodes[0];
|
|
172491
172531
|
return body;
|
|
172492
172532
|
}
|
|
172493
172533
|
function placeNodeGroup(originalFile, changeTracker, changes, focusLocations) {
|
|
@@ -173298,7 +173338,8 @@ function collectElements(sourceFile, cancellationToken) {
|
|
|
173298
173338
|
const res = [];
|
|
173299
173339
|
addNodeOutliningSpans(sourceFile, cancellationToken, res);
|
|
173300
173340
|
addRegionOutliningSpans(sourceFile, res);
|
|
173301
|
-
|
|
173341
|
+
res.sort((span1, span2) => span1.textSpan.start - span2.textSpan.start);
|
|
173342
|
+
return res;
|
|
173302
173343
|
}
|
|
173303
173344
|
function addNodeOutliningSpans(sourceFile, cancellationToken, out) {
|
|
173304
173345
|
let depthRemaining = 40;
|
|
@@ -173364,11 +173405,11 @@ function addRegionOutliningSpans(sourceFile, out) {
|
|
|
173364
173405
|
for (const currentLineStart of lineStarts) {
|
|
173365
173406
|
const lineEnd = sourceFile.getLineEndOfPosition(currentLineStart);
|
|
173366
173407
|
const lineText = sourceFile.text.substring(currentLineStart, lineEnd);
|
|
173367
|
-
const result =
|
|
173408
|
+
const result = parseRegionDelimiter(lineText);
|
|
173368
173409
|
if (!result || isInComment(sourceFile, currentLineStart)) {
|
|
173369
173410
|
continue;
|
|
173370
173411
|
}
|
|
173371
|
-
if (
|
|
173412
|
+
if (result.isStart) {
|
|
173372
173413
|
const span = createTextSpanFromBounds(sourceFile.text.indexOf("//", currentLineStart), lineEnd);
|
|
173373
173414
|
regions.push(createOutliningSpan(
|
|
173374
173415
|
span,
|
|
@@ -173376,7 +173417,7 @@ function addRegionOutliningSpans(sourceFile, out) {
|
|
|
173376
173417
|
span,
|
|
173377
173418
|
/*autoCollapse*/
|
|
173378
173419
|
false,
|
|
173379
|
-
result
|
|
173420
|
+
result.name || "#region"
|
|
173380
173421
|
));
|
|
173381
173422
|
} else {
|
|
173382
173423
|
const region = regions.pop();
|
|
@@ -173388,14 +173429,18 @@ function addRegionOutliningSpans(sourceFile, out) {
|
|
|
173388
173429
|
}
|
|
173389
173430
|
}
|
|
173390
173431
|
}
|
|
173391
|
-
var regionDelimiterRegExp = /^#(end)?region(
|
|
173392
|
-
function
|
|
173432
|
+
var regionDelimiterRegExp = /^#(end)?region(.*)\r?$/;
|
|
173433
|
+
function parseRegionDelimiter(lineText) {
|
|
173393
173434
|
lineText = lineText.trimStart();
|
|
173394
173435
|
if (!startsWith(lineText, "//")) {
|
|
173395
173436
|
return null;
|
|
173396
173437
|
}
|
|
173397
173438
|
lineText = lineText.slice(2).trim();
|
|
173398
|
-
|
|
173439
|
+
const result = regionDelimiterRegExp.exec(lineText);
|
|
173440
|
+
if (result) {
|
|
173441
|
+
return { isStart: !result[1], name: result[2].trim() };
|
|
173442
|
+
}
|
|
173443
|
+
return void 0;
|
|
173399
173444
|
}
|
|
173400
173445
|
function addOutliningForLeadingCommentsForPos(pos, sourceFile, cancellationToken, out) {
|
|
173401
173446
|
const comments = getLeadingCommentRanges(sourceFile.text, pos);
|
|
@@ -173409,7 +173454,7 @@ function addOutliningForLeadingCommentsForPos(pos, sourceFile, cancellationToken
|
|
|
173409
173454
|
switch (kind) {
|
|
173410
173455
|
case 2 /* SingleLineCommentTrivia */:
|
|
173411
173456
|
const commentText = sourceText.slice(pos2, end);
|
|
173412
|
-
if (
|
|
173457
|
+
if (parseRegionDelimiter(commentText)) {
|
|
173413
173458
|
combineAndAddMultipleSingleLineComments();
|
|
173414
173459
|
singleLineCommentCount = 0;
|
|
173415
173460
|
break;
|
|
@@ -186499,6 +186544,9 @@ var _ProjectService = class _ProjectService {
|
|
|
186499
186544
|
this.packageJsonCache.addOrUpdate(file, fileOrDirectoryPath);
|
|
186500
186545
|
this.watchPackageJsonFile(file, fileOrDirectoryPath, wildCardWatcher);
|
|
186501
186546
|
}
|
|
186547
|
+
if (!(fsResult == null ? void 0 : fsResult.fileExists)) {
|
|
186548
|
+
this.sendSourceFileChange(fileOrDirectoryPath);
|
|
186549
|
+
}
|
|
186502
186550
|
const configuredProjectForConfig = this.findConfiguredProjectByProjectName(configFileName);
|
|
186503
186551
|
if (isIgnoredFileFromWildCardWatching({
|
|
186504
186552
|
watchedDirPath: this.toPath(directory),
|
|
@@ -188030,20 +188078,34 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
188030
188078
|
closeLog() {
|
|
188031
188079
|
this.logger.close();
|
|
188032
188080
|
}
|
|
188033
|
-
|
|
188034
|
-
* This function rebuilds the project for every file opened by the client
|
|
188035
|
-
* This does not reload contents of open files from disk. But we could do that if needed
|
|
188036
|
-
*/
|
|
188037
|
-
reloadProjects() {
|
|
188038
|
-
this.logger.info("reload projects.");
|
|
188081
|
+
sendSourceFileChange(inPath) {
|
|
188039
188082
|
this.filenameToScriptInfo.forEach((info) => {
|
|
188040
188083
|
if (this.openFiles.has(info.path)) return;
|
|
188041
188084
|
if (!info.fileWatcher) return;
|
|
188085
|
+
const eventKind = memoize(
|
|
188086
|
+
() => this.host.fileExists(info.fileName) ? info.deferredDelete ? 0 /* Created */ : 1 /* Changed */ : 2 /* Deleted */
|
|
188087
|
+
);
|
|
188088
|
+
if (inPath) {
|
|
188089
|
+
if (isScriptInfoWatchedFromNodeModules(info) || !info.path.startsWith(inPath)) return;
|
|
188090
|
+
if (eventKind() === 2 /* Deleted */ && info.deferredDelete) return;
|
|
188091
|
+
this.logger.info(`Invoking sourceFileChange on ${info.fileName}:: ${eventKind()}`);
|
|
188092
|
+
}
|
|
188042
188093
|
this.onSourceFileChanged(
|
|
188043
188094
|
info,
|
|
188044
|
-
|
|
188095
|
+
eventKind()
|
|
188045
188096
|
);
|
|
188046
188097
|
});
|
|
188098
|
+
}
|
|
188099
|
+
/**
|
|
188100
|
+
* This function rebuilds the project for every file opened by the client
|
|
188101
|
+
* This does not reload contents of open files from disk. But we could do that if needed
|
|
188102
|
+
*/
|
|
188103
|
+
reloadProjects() {
|
|
188104
|
+
this.logger.info("reload projects.");
|
|
188105
|
+
this.sendSourceFileChange(
|
|
188106
|
+
/*inPath*/
|
|
188107
|
+
void 0
|
|
188108
|
+
);
|
|
188047
188109
|
this.pendingProjectUpdates.forEach((_project, projectName) => {
|
|
188048
188110
|
this.throttledOperations.cancel(projectName);
|
|
188049
188111
|
this.pendingProjectUpdates.delete(projectName);
|
|
@@ -188920,7 +188982,7 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
188920
188982
|
return;
|
|
188921
188983
|
}
|
|
188922
188984
|
this.logger.info(`Enabling plugin ${pluginConfigEntry.name} from candidate paths: ${searchPaths.join(",")}`);
|
|
188923
|
-
if (!pluginConfigEntry.name || isExternalModuleNameRelative(pluginConfigEntry.name) || /[\\/]\.\.?(
|
|
188985
|
+
if (!pluginConfigEntry.name || isExternalModuleNameRelative(pluginConfigEntry.name) || /[\\/]\.\.?(?:$|[\\/])/.test(pluginConfigEntry.name)) {
|
|
188924
188986
|
this.logger.info(`Skipped loading plugin ${pluginConfigEntry.name || JSON.stringify(pluginConfigEntry)} because only package name is allowed plugin name`);
|
|
188925
188987
|
return;
|
|
188926
188988
|
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "typescript",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "5.6.0-dev.
|
|
5
|
+
"version": "5.6.0-dev.20240815",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|
|
@@ -53,6 +53,7 @@
|
|
|
53
53
|
"@types/source-map-support": "^0.5.10",
|
|
54
54
|
"@types/which": "^3.0.4",
|
|
55
55
|
"@typescript-eslint/rule-tester": "^8.1.0",
|
|
56
|
+
"@typescript-eslint/type-utils": "^8.1.0",
|
|
56
57
|
"@typescript-eslint/utils": "^8.1.0",
|
|
57
58
|
"azure-devops-node-api": "^14.0.2",
|
|
58
59
|
"c8": "^10.1.2",
|
|
@@ -64,6 +65,7 @@
|
|
|
64
65
|
"esbuild": "^0.23.0",
|
|
65
66
|
"eslint": "^9.9.0",
|
|
66
67
|
"eslint-formatter-autolinkable-stylish": "^1.4.0",
|
|
68
|
+
"eslint-plugin-regexp": "^2.6.0",
|
|
67
69
|
"fast-xml-parser": "^4.4.1",
|
|
68
70
|
"glob": "^10.4.5",
|
|
69
71
|
"globals": "^15.9.0",
|
|
@@ -115,5 +117,5 @@
|
|
|
115
117
|
"node": "20.1.0",
|
|
116
118
|
"npm": "8.19.4"
|
|
117
119
|
},
|
|
118
|
-
"gitHead": "
|
|
120
|
+
"gitHead": "3ed2e8ed34419890228935f0cd59df80e7a10f1f"
|
|
119
121
|
}
|