typescript 5.6.0-dev.20240813 → 5.6.0-dev.20240814
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 +47 -38
- package/lib/typescript.d.ts +1 -0
- package/lib/typescript.js +90 -60
- package/package.json +3 -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.20240814`;
|
|
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 */;
|
|
@@ -11186,7 +11186,7 @@ function getNodeFlags(node) {
|
|
|
11186
11186
|
var supportedLocaleDirectories = ["cs", "de", "es", "fr", "it", "ja", "ko", "pl", "pt-br", "ru", "tr", "zh-cn", "zh-tw"];
|
|
11187
11187
|
function validateLocaleAndSetLanguage(locale, sys2, errors) {
|
|
11188
11188
|
const lowerCaseLocale = locale.toLowerCase();
|
|
11189
|
-
const matchResult = /^([a-z]+)([_-]([a-z]+))?$/.exec(lowerCaseLocale);
|
|
11189
|
+
const matchResult = /^([a-z]+)(?:[_-]([a-z]+))?$/.exec(lowerCaseLocale);
|
|
11190
11190
|
if (!matchResult) {
|
|
11191
11191
|
if (errors) {
|
|
11192
11192
|
errors.push(createCompilerDiagnostic(Diagnostics.Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1, "en", "ja-jp"));
|
|
@@ -11194,7 +11194,7 @@ function validateLocaleAndSetLanguage(locale, sys2, errors) {
|
|
|
11194
11194
|
return;
|
|
11195
11195
|
}
|
|
11196
11196
|
const language = matchResult[1];
|
|
11197
|
-
const territory = matchResult[
|
|
11197
|
+
const territory = matchResult[2];
|
|
11198
11198
|
if (contains(supportedLocaleDirectories, lowerCaseLocale) && !trySetLanguageAndTerritory(language, territory, errors)) {
|
|
11199
11199
|
trySetLanguageAndTerritory(
|
|
11200
11200
|
language,
|
|
@@ -13870,12 +13870,12 @@ function getJSDocCommentRanges(node, text) {
|
|
|
13870
13870
|
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
13871
|
text.charCodeAt(comment.pos + 1) === 42 /* asterisk */ && text.charCodeAt(comment.pos + 2) === 42 /* asterisk */ && text.charCodeAt(comment.pos + 3) !== 47 /* slash */);
|
|
13872
13872
|
}
|
|
13873
|
-
var fullTripleSlashReferencePathRegEx =
|
|
13874
|
-
var fullTripleSlashReferenceTypeReferenceDirectiveRegEx =
|
|
13875
|
-
var fullTripleSlashLibReferenceRegEx =
|
|
13876
|
-
var fullTripleSlashAMDReferencePathRegEx =
|
|
13877
|
-
var fullTripleSlashAMDModuleRegEx = /^\/\/\/\s*<amd-module\s
|
|
13878
|
-
var defaultLibReferenceRegEx =
|
|
13873
|
+
var fullTripleSlashReferencePathRegEx = /^\/\/\/\s*<reference\s+path\s*=\s*(?:'[^']*'|"[^"]*").*?\/>/;
|
|
13874
|
+
var fullTripleSlashReferenceTypeReferenceDirectiveRegEx = /^\/\/\/\s*<reference\s+types\s*=\s*(?:'[^']*'|"[^"]*").*?\/>/;
|
|
13875
|
+
var fullTripleSlashLibReferenceRegEx = /^\/\/\/\s*<reference\s+lib\s*=\s*(?:'[^']*'|"[^"]*").*?\/>/;
|
|
13876
|
+
var fullTripleSlashAMDReferencePathRegEx = /^\/\/\/\s*<amd-dependency\s+path\s*=\s*(?:'[^']*'|"[^"]*").*?\/>/;
|
|
13877
|
+
var fullTripleSlashAMDModuleRegEx = /^\/\/\/\s*<amd-module\s+(?:\S.*?)??\/>/;
|
|
13878
|
+
var defaultLibReferenceRegEx = /^\/\/\/\s*<reference\s+no-default-lib\s*=\s*(?:'[^']*'|"[^"]*")\s*\/>/;
|
|
13879
13879
|
function isPartOfTypeNode(node) {
|
|
13880
13880
|
if (182 /* FirstTypeNode */ <= node.kind && node.kind <= 205 /* LastTypeNode */) {
|
|
13881
13881
|
return true;
|
|
@@ -15926,9 +15926,9 @@ function containsInvalidEscapeFlag(node) {
|
|
|
15926
15926
|
function hasInvalidEscape(template) {
|
|
15927
15927
|
return template && !!(isNoSubstitutionTemplateLiteral(template) ? containsInvalidEscapeFlag(template) : containsInvalidEscapeFlag(template.head) || some(template.templateSpans, (span) => containsInvalidEscapeFlag(span.literal)));
|
|
15928
15928
|
}
|
|
15929
|
-
var doubleQuoteEscapedCharsRegExp = /[\\"\u0000-\u001f\
|
|
15930
|
-
var singleQuoteEscapedCharsRegExp = /[\\'\u0000-\u001f\
|
|
15931
|
-
var backtickQuoteEscapedCharsRegExp = /\r\n|[\\`\u0000-\u001f\
|
|
15929
|
+
var doubleQuoteEscapedCharsRegExp = /[\\"\u0000-\u001f\u2028\u2029\u0085]/g;
|
|
15930
|
+
var singleQuoteEscapedCharsRegExp = /[\\'\u0000-\u001f\u2028\u2029\u0085]/g;
|
|
15931
|
+
var backtickQuoteEscapedCharsRegExp = /\r\n|[\\`\u0000-\u001f\u2028\u2029\u0085]/g;
|
|
15932
15932
|
var escapedCharsMap = new Map(Object.entries({
|
|
15933
15933
|
" ": "\\t",
|
|
15934
15934
|
"\v": "\\v",
|
|
@@ -17331,7 +17331,7 @@ var objectAllocator = {
|
|
|
17331
17331
|
getSourceMapSourceConstructor: () => SourceMapSource
|
|
17332
17332
|
};
|
|
17333
17333
|
function formatStringFromArgs(text, args) {
|
|
17334
|
-
return text.replace(
|
|
17334
|
+
return text.replace(/\{(\d+)\}/g, (_match, index) => "" + Debug.checkDefined(args[+index]));
|
|
17335
17335
|
}
|
|
17336
17336
|
var localizedDiagnosticMessages;
|
|
17337
17337
|
function setLocalizedDiagnosticMessages(messages) {
|
|
@@ -35462,8 +35462,8 @@ function getNamedArgRegEx(name) {
|
|
|
35462
35462
|
namedArgRegExCache.set(name, result);
|
|
35463
35463
|
return result;
|
|
35464
35464
|
}
|
|
35465
|
-
var tripleSlashXMLCommentStartRegEx = /^\/\/\/\s*<(\S+)\s.*?\/>/
|
|
35466
|
-
var singleLinePragmaRegEx = /^\/\/\/?\s*@([^\s:]+)(.*)
|
|
35465
|
+
var tripleSlashXMLCommentStartRegEx = /^\/\/\/\s*<(\S+)\s.*?\/>/m;
|
|
35466
|
+
var singleLinePragmaRegEx = /^\/\/\/?\s*@([^\s:]+)((?:[^\S\r\n]|:).*)?$/m;
|
|
35467
35467
|
function extractPragmas(pragmas, range, text) {
|
|
35468
35468
|
const tripleSlash = range.kind === 2 /* SingleLineCommentTrivia */ && tripleSlashXMLCommentStartRegEx.exec(text);
|
|
35469
35469
|
if (tripleSlash) {
|
|
@@ -35504,7 +35504,7 @@ function extractPragmas(pragmas, range, text) {
|
|
|
35504
35504
|
return addPragmaForMatch(pragmas, range, 2 /* SingleLine */, singleLine);
|
|
35505
35505
|
}
|
|
35506
35506
|
if (range.kind === 3 /* MultiLineCommentTrivia */) {
|
|
35507
|
-
const multiLinePragmaRegEx = /@(\S+)(\s
|
|
35507
|
+
const multiLinePragmaRegEx = /@(\S+)(\s+(?:\S.*)?)?$/gm;
|
|
35508
35508
|
let multiLineMatch;
|
|
35509
35509
|
while (multiLineMatch = multiLinePragmaRegEx.exec(text)) {
|
|
35510
35510
|
addPragmaForMatch(pragmas, range, 4 /* MultiLine */, multiLineMatch);
|
|
@@ -38576,7 +38576,7 @@ function convertJsonOptionOfCustomType(opt, value, errors, valueExpression, sour
|
|
|
38576
38576
|
function convertJsonOptionOfListType(option, values, basePath, errors, propertyAssignment, valueExpression, sourceFile) {
|
|
38577
38577
|
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
38578
|
}
|
|
38579
|
-
var invalidTrailingRecursionPattern = /(
|
|
38579
|
+
var invalidTrailingRecursionPattern = /(?:^|\/)\*\*\/?$/;
|
|
38580
38580
|
var wildcardDirectoryPattern = /^[^*?]*(?=\/[^/]*[*?])/;
|
|
38581
38581
|
function getFileNamesFromConfigSpecs(configFileSpecs, basePath, options, host, extraFileExtensions = emptyArray) {
|
|
38582
38582
|
basePath = normalizePath(basePath);
|
|
@@ -53908,7 +53908,7 @@ function createTypeChecker(host) {
|
|
|
53908
53908
|
} else if (localName === "export=" /* ExportEquals */) {
|
|
53909
53909
|
localName = "_exports";
|
|
53910
53910
|
}
|
|
53911
|
-
localName = isIdentifierText(localName, languageVersion) && !isStringANonContextualKeyword(localName) ? localName : "_" + localName.replace(/[^a-
|
|
53911
|
+
localName = isIdentifierText(localName, languageVersion) && !isStringANonContextualKeyword(localName) ? localName : "_" + localName.replace(/[^a-z0-9]/gi, "_");
|
|
53912
53912
|
return localName;
|
|
53913
53913
|
}
|
|
53914
53914
|
function getInternalSymbolName(symbol, localName) {
|
|
@@ -73593,7 +73593,7 @@ function createTypeChecker(host) {
|
|
|
73593
73593
|
addErrorOrSuggestion(!isUncheckedJS || errorInfo.code !== Diagnostics.Property_0_may_not_exist_on_type_1_Did_you_mean_2.code, resultDiagnostic);
|
|
73594
73594
|
}
|
|
73595
73595
|
function containerSeemsToBeEmptyDomElement(containingType) {
|
|
73596
|
-
return compilerOptions.lib && !compilerOptions.lib.includes("dom") && everyContainedType(containingType, (type) => type.symbol && /^(EventTarget|Node|(
|
|
73596
|
+
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
73597
|
}
|
|
73598
73598
|
function typeHasStaticProperty(propName, containingType) {
|
|
73599
73599
|
const prop = containingType.symbol && getPropertyOfType(getTypeOfSymbol(containingType.symbol), propName);
|
|
@@ -81452,7 +81452,7 @@ function createTypeChecker(host) {
|
|
|
81452
81452
|
);
|
|
81453
81453
|
if (globalAsyncDisposableType !== emptyObjectType && globalDisposableType !== emptyObjectType) {
|
|
81454
81454
|
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);
|
|
81455
|
+
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
81456
|
}
|
|
81457
81457
|
} else if (blockScopeKind === 4 /* Using */) {
|
|
81458
81458
|
const globalDisposableType = getGlobalDisposableType(
|
|
@@ -81461,7 +81461,7 @@ function createTypeChecker(host) {
|
|
|
81461
81461
|
);
|
|
81462
81462
|
if (globalDisposableType !== emptyObjectType) {
|
|
81463
81463
|
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);
|
|
81464
|
+
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
81465
|
}
|
|
81466
81466
|
}
|
|
81467
81467
|
}
|
|
@@ -101724,7 +101724,7 @@ function transformJsx(context) {
|
|
|
101724
101724
|
const name = node.name;
|
|
101725
101725
|
if (isIdentifier(name)) {
|
|
101726
101726
|
const text = idText(name);
|
|
101727
|
-
return /^[A-
|
|
101727
|
+
return /^[A-Z_]\w*$/i.test(text) ? name : factory2.createStringLiteral(text);
|
|
101728
101728
|
}
|
|
101729
101729
|
return factory2.createStringLiteral(idText(name.namespace) + ":" + idText(name.name));
|
|
101730
101730
|
}
|
|
@@ -116687,7 +116687,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
116687
116687
|
if (node.comment) {
|
|
116688
116688
|
const text = getTextOfJSDocComment(node.comment);
|
|
116689
116689
|
if (text) {
|
|
116690
|
-
const lines = text.split(/\r\n?|\n/
|
|
116690
|
+
const lines = text.split(/\r\n?|\n/);
|
|
116691
116691
|
for (const line of lines) {
|
|
116692
116692
|
writeLine();
|
|
116693
116693
|
writeSpace();
|
|
@@ -117114,7 +117114,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
117114
117114
|
if (isFunctionLike(parentNode) && parentNode.typeArguments) {
|
|
117115
117115
|
return emitTypeArguments(parentNode, parentNode.typeArguments);
|
|
117116
117116
|
}
|
|
117117
|
-
emitList(parentNode, typeParameters, 53776 /* TypeParameters */);
|
|
117117
|
+
emitList(parentNode, typeParameters, 53776 /* TypeParameters */ | (isArrowFunction(parentNode) ? 64 /* AllowTrailingComma */ : 0 /* None */));
|
|
117118
117118
|
}
|
|
117119
117119
|
function emitParameters(parentNode, parameters) {
|
|
117120
117120
|
emitList(parentNode, parameters, 2576 /* Parameters */);
|
|
@@ -117382,7 +117382,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
117382
117382
|
}
|
|
117383
117383
|
}
|
|
117384
117384
|
function writeLines(text) {
|
|
117385
|
-
const lines = text.split(/\r\n?|\n/
|
|
117385
|
+
const lines = text.split(/\r\n?|\n/);
|
|
117386
117386
|
const indentation = guessIndentation(lines);
|
|
117387
117387
|
for (const lineText of lines) {
|
|
117388
117388
|
const line = indentation ? lineText.slice(indentation) : lineText;
|
|
@@ -118708,6 +118708,12 @@ function createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensi
|
|
|
118708
118708
|
function realpath(s) {
|
|
118709
118709
|
return host.realpath ? host.realpath(s) : s;
|
|
118710
118710
|
}
|
|
118711
|
+
function clearFirstAncestorEntry(fileOrDirectoryPath) {
|
|
118712
|
+
forEachAncestorDirectory(
|
|
118713
|
+
getDirectoryPath(fileOrDirectoryPath),
|
|
118714
|
+
(ancestor) => cachedReadDirectoryResult.delete(ensureTrailingDirectorySeparator(ancestor)) ? true : void 0
|
|
118715
|
+
);
|
|
118716
|
+
}
|
|
118711
118717
|
function addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath) {
|
|
118712
118718
|
const existingResult = getCachedFileSystemEntries(fileOrDirectoryPath);
|
|
118713
118719
|
if (existingResult !== void 0) {
|
|
@@ -118716,6 +118722,7 @@ function createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensi
|
|
|
118716
118722
|
}
|
|
118717
118723
|
const parentResult = getCachedFileSystemEntriesForBaseDir(fileOrDirectoryPath);
|
|
118718
118724
|
if (!parentResult) {
|
|
118725
|
+
clearFirstAncestorEntry(fileOrDirectoryPath);
|
|
118719
118726
|
return void 0;
|
|
118720
118727
|
}
|
|
118721
118728
|
if (!host.directoryExists) {
|
|
@@ -118741,6 +118748,8 @@ function createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensi
|
|
|
118741
118748
|
const parentResult = getCachedFileSystemEntriesForBaseDir(filePath);
|
|
118742
118749
|
if (parentResult) {
|
|
118743
118750
|
updateFilesOfFileSystemEntry(parentResult, getBaseNameOfFileName(fileName), eventKind === 0 /* Created */);
|
|
118751
|
+
} else {
|
|
118752
|
+
clearFirstAncestorEntry(filePath);
|
|
118744
118753
|
}
|
|
118745
118754
|
}
|
|
118746
118755
|
function updateFilesOfFileSystemEntry(parentResult, baseName, fileExists2) {
|
|
@@ -121012,7 +121021,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
121012
121021
|
return line;
|
|
121013
121022
|
}
|
|
121014
121023
|
const lineText = file.text.slice(lineStarts[line], lineStarts[line + 1]).trim();
|
|
121015
|
-
if (lineText !== "" &&
|
|
121024
|
+
if (lineText !== "" && !/^\s*\/\/.*$/.test(lineText)) {
|
|
121016
121025
|
return -1;
|
|
121017
121026
|
}
|
|
121018
121027
|
line--;
|
|
@@ -125013,9 +125022,9 @@ function removeIgnoredPath(path) {
|
|
|
125013
125022
|
function perceivedOsRootLengthForWatching(pathComponents2, length2) {
|
|
125014
125023
|
if (length2 <= 1) return 1;
|
|
125015
125024
|
let indexAfterOsRoot = 1;
|
|
125016
|
-
let isDosStyle = pathComponents2[0].search(/[a-
|
|
125025
|
+
let isDosStyle = pathComponents2[0].search(/[a-z]:/i) === 0;
|
|
125017
125026
|
if (pathComponents2[0] !== directorySeparator && !isDosStyle && // Non dos style paths
|
|
125018
|
-
pathComponents2[1].search(/[a-
|
|
125027
|
+
pathComponents2[1].search(/[a-z]\$$/i) === 0) {
|
|
125019
125028
|
if (length2 === 2) return 2;
|
|
125020
125029
|
indexAfterOsRoot = 2;
|
|
125021
125030
|
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.20240814`;
|
|
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 */;
|
|
@@ -14718,7 +14718,7 @@ function getNodeFlags(node) {
|
|
|
14718
14718
|
var supportedLocaleDirectories = ["cs", "de", "es", "fr", "it", "ja", "ko", "pl", "pt-br", "ru", "tr", "zh-cn", "zh-tw"];
|
|
14719
14719
|
function validateLocaleAndSetLanguage(locale, sys2, errors) {
|
|
14720
14720
|
const lowerCaseLocale = locale.toLowerCase();
|
|
14721
|
-
const matchResult = /^([a-z]+)([_-]([a-z]+))?$/.exec(lowerCaseLocale);
|
|
14721
|
+
const matchResult = /^([a-z]+)(?:[_-]([a-z]+))?$/.exec(lowerCaseLocale);
|
|
14722
14722
|
if (!matchResult) {
|
|
14723
14723
|
if (errors) {
|
|
14724
14724
|
errors.push(createCompilerDiagnostic(Diagnostics.Locale_must_be_of_the_form_language_or_language_territory_For_example_0_or_1, "en", "ja-jp"));
|
|
@@ -14726,7 +14726,7 @@ function validateLocaleAndSetLanguage(locale, sys2, errors) {
|
|
|
14726
14726
|
return;
|
|
14727
14727
|
}
|
|
14728
14728
|
const language = matchResult[1];
|
|
14729
|
-
const territory = matchResult[
|
|
14729
|
+
const territory = matchResult[2];
|
|
14730
14730
|
if (contains(supportedLocaleDirectories, lowerCaseLocale) && !trySetLanguageAndTerritory(language, territory, errors)) {
|
|
14731
14731
|
trySetLanguageAndTerritory(
|
|
14732
14732
|
language,
|
|
@@ -17565,12 +17565,12 @@ function getJSDocCommentRanges(node, text) {
|
|
|
17565
17565
|
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
17566
|
text.charCodeAt(comment.pos + 1) === 42 /* asterisk */ && text.charCodeAt(comment.pos + 2) === 42 /* asterisk */ && text.charCodeAt(comment.pos + 3) !== 47 /* slash */);
|
|
17567
17567
|
}
|
|
17568
|
-
var fullTripleSlashReferencePathRegEx =
|
|
17569
|
-
var fullTripleSlashReferenceTypeReferenceDirectiveRegEx =
|
|
17570
|
-
var fullTripleSlashLibReferenceRegEx =
|
|
17571
|
-
var fullTripleSlashAMDReferencePathRegEx =
|
|
17572
|
-
var fullTripleSlashAMDModuleRegEx = /^\/\/\/\s*<amd-module\s
|
|
17573
|
-
var defaultLibReferenceRegEx =
|
|
17568
|
+
var fullTripleSlashReferencePathRegEx = /^\/\/\/\s*<reference\s+path\s*=\s*(?:'[^']*'|"[^"]*").*?\/>/;
|
|
17569
|
+
var fullTripleSlashReferenceTypeReferenceDirectiveRegEx = /^\/\/\/\s*<reference\s+types\s*=\s*(?:'[^']*'|"[^"]*").*?\/>/;
|
|
17570
|
+
var fullTripleSlashLibReferenceRegEx = /^\/\/\/\s*<reference\s+lib\s*=\s*(?:'[^']*'|"[^"]*").*?\/>/;
|
|
17571
|
+
var fullTripleSlashAMDReferencePathRegEx = /^\/\/\/\s*<amd-dependency\s+path\s*=\s*(?:'[^']*'|"[^"]*").*?\/>/;
|
|
17572
|
+
var fullTripleSlashAMDModuleRegEx = /^\/\/\/\s*<amd-module\s+(?:\S.*?)??\/>/;
|
|
17573
|
+
var defaultLibReferenceRegEx = /^\/\/\/\s*<reference\s+no-default-lib\s*=\s*(?:'[^']*'|"[^"]*")\s*\/>/;
|
|
17574
17574
|
function isPartOfTypeNode(node) {
|
|
17575
17575
|
if (182 /* FirstTypeNode */ <= node.kind && node.kind <= 205 /* LastTypeNode */) {
|
|
17576
17576
|
return true;
|
|
@@ -19740,9 +19740,9 @@ function containsInvalidEscapeFlag(node) {
|
|
|
19740
19740
|
function hasInvalidEscape(template) {
|
|
19741
19741
|
return template && !!(isNoSubstitutionTemplateLiteral(template) ? containsInvalidEscapeFlag(template) : containsInvalidEscapeFlag(template.head) || some(template.templateSpans, (span) => containsInvalidEscapeFlag(span.literal)));
|
|
19742
19742
|
}
|
|
19743
|
-
var doubleQuoteEscapedCharsRegExp = /[\\"\u0000-\u001f\
|
|
19744
|
-
var singleQuoteEscapedCharsRegExp = /[\\'\u0000-\u001f\
|
|
19745
|
-
var backtickQuoteEscapedCharsRegExp = /\r\n|[\\`\u0000-\u001f\
|
|
19743
|
+
var doubleQuoteEscapedCharsRegExp = /[\\"\u0000-\u001f\u2028\u2029\u0085]/g;
|
|
19744
|
+
var singleQuoteEscapedCharsRegExp = /[\\'\u0000-\u001f\u2028\u2029\u0085]/g;
|
|
19745
|
+
var backtickQuoteEscapedCharsRegExp = /\r\n|[\\`\u0000-\u001f\u2028\u2029\u0085]/g;
|
|
19746
19746
|
var escapedCharsMap = new Map(Object.entries({
|
|
19747
19747
|
" ": "\\t",
|
|
19748
19748
|
"\v": "\\v",
|
|
@@ -21290,7 +21290,7 @@ function setObjectAllocator(alloc) {
|
|
|
21290
21290
|
forEach(objectAllocatorPatchers, (fn) => fn(objectAllocator));
|
|
21291
21291
|
}
|
|
21292
21292
|
function formatStringFromArgs(text, args) {
|
|
21293
|
-
return text.replace(
|
|
21293
|
+
return text.replace(/\{(\d+)\}/g, (_match, index) => "" + Debug.checkDefined(args[+index]));
|
|
21294
21294
|
}
|
|
21295
21295
|
var localizedDiagnosticMessages;
|
|
21296
21296
|
function setLocalizedDiagnosticMessages(messages) {
|
|
@@ -22786,7 +22786,7 @@ function isFunctionExpressionOrArrowFunction(node) {
|
|
|
22786
22786
|
return node.kind === 218 /* FunctionExpression */ || node.kind === 219 /* ArrowFunction */;
|
|
22787
22787
|
}
|
|
22788
22788
|
function escapeSnippetText(text) {
|
|
22789
|
-
return text.replace(/\$/
|
|
22789
|
+
return text.replace(/\$/g, () => "\\$");
|
|
22790
22790
|
}
|
|
22791
22791
|
function isNumericLiteralName(name) {
|
|
22792
22792
|
return (+name).toString() === name;
|
|
@@ -39732,8 +39732,8 @@ function getNamedArgRegEx(name) {
|
|
|
39732
39732
|
namedArgRegExCache.set(name, result);
|
|
39733
39733
|
return result;
|
|
39734
39734
|
}
|
|
39735
|
-
var tripleSlashXMLCommentStartRegEx = /^\/\/\/\s*<(\S+)\s.*?\/>/
|
|
39736
|
-
var singleLinePragmaRegEx = /^\/\/\/?\s*@([^\s:]+)(.*)
|
|
39735
|
+
var tripleSlashXMLCommentStartRegEx = /^\/\/\/\s*<(\S+)\s.*?\/>/m;
|
|
39736
|
+
var singleLinePragmaRegEx = /^\/\/\/?\s*@([^\s:]+)((?:[^\S\r\n]|:).*)?$/m;
|
|
39737
39737
|
function extractPragmas(pragmas, range, text) {
|
|
39738
39738
|
const tripleSlash = range.kind === 2 /* SingleLineCommentTrivia */ && tripleSlashXMLCommentStartRegEx.exec(text);
|
|
39739
39739
|
if (tripleSlash) {
|
|
@@ -39774,7 +39774,7 @@ function extractPragmas(pragmas, range, text) {
|
|
|
39774
39774
|
return addPragmaForMatch(pragmas, range, 2 /* SingleLine */, singleLine);
|
|
39775
39775
|
}
|
|
39776
39776
|
if (range.kind === 3 /* MultiLineCommentTrivia */) {
|
|
39777
|
-
const multiLinePragmaRegEx = /@(\S+)(\s
|
|
39777
|
+
const multiLinePragmaRegEx = /@(\S+)(\s+(?:\S.*)?)?$/gm;
|
|
39778
39778
|
let multiLineMatch;
|
|
39779
39779
|
while (multiLineMatch = multiLinePragmaRegEx.exec(text)) {
|
|
39780
39780
|
addPragmaForMatch(pragmas, range, 4 /* MultiLine */, multiLineMatch);
|
|
@@ -42881,7 +42881,7 @@ function convertJsonOptionOfCustomType(opt, value, errors, valueExpression, sour
|
|
|
42881
42881
|
function convertJsonOptionOfListType(option, values, basePath, errors, propertyAssignment, valueExpression, sourceFile) {
|
|
42882
42882
|
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
42883
|
}
|
|
42884
|
-
var invalidTrailingRecursionPattern = /(
|
|
42884
|
+
var invalidTrailingRecursionPattern = /(?:^|\/)\*\*\/?$/;
|
|
42885
42885
|
var wildcardDirectoryPattern = /^[^*?]*(?=\/[^/]*[*?])/;
|
|
42886
42886
|
function getFileNamesFromConfigSpecs(configFileSpecs, basePath, options, host, extraFileExtensions = emptyArray) {
|
|
42887
42887
|
basePath = normalizePath(basePath);
|
|
@@ -58527,7 +58527,7 @@ function createTypeChecker(host) {
|
|
|
58527
58527
|
} else if (localName === "export=" /* ExportEquals */) {
|
|
58528
58528
|
localName = "_exports";
|
|
58529
58529
|
}
|
|
58530
|
-
localName = isIdentifierText(localName, languageVersion) && !isStringANonContextualKeyword(localName) ? localName : "_" + localName.replace(/[^a-
|
|
58530
|
+
localName = isIdentifierText(localName, languageVersion) && !isStringANonContextualKeyword(localName) ? localName : "_" + localName.replace(/[^a-z0-9]/gi, "_");
|
|
58531
58531
|
return localName;
|
|
58532
58532
|
}
|
|
58533
58533
|
function getInternalSymbolName(symbol, localName) {
|
|
@@ -78212,7 +78212,7 @@ function createTypeChecker(host) {
|
|
|
78212
78212
|
addErrorOrSuggestion(!isUncheckedJS || errorInfo.code !== Diagnostics.Property_0_may_not_exist_on_type_1_Did_you_mean_2.code, resultDiagnostic);
|
|
78213
78213
|
}
|
|
78214
78214
|
function containerSeemsToBeEmptyDomElement(containingType) {
|
|
78215
|
-
return compilerOptions.lib && !compilerOptions.lib.includes("dom") && everyContainedType(containingType, (type) => type.symbol && /^(EventTarget|Node|(
|
|
78215
|
+
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
78216
|
}
|
|
78217
78217
|
function typeHasStaticProperty(propName, containingType) {
|
|
78218
78218
|
const prop = containingType.symbol && getPropertyOfType(getTypeOfSymbol(containingType.symbol), propName);
|
|
@@ -86071,7 +86071,7 @@ function createTypeChecker(host) {
|
|
|
86071
86071
|
);
|
|
86072
86072
|
if (globalAsyncDisposableType !== emptyObjectType && globalDisposableType !== emptyObjectType) {
|
|
86073
86073
|
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);
|
|
86074
|
+
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
86075
|
}
|
|
86076
86076
|
} else if (blockScopeKind === 4 /* Using */) {
|
|
86077
86077
|
const globalDisposableType = getGlobalDisposableType(
|
|
@@ -86080,7 +86080,7 @@ function createTypeChecker(host) {
|
|
|
86080
86080
|
);
|
|
86081
86081
|
if (globalDisposableType !== emptyObjectType) {
|
|
86082
86082
|
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);
|
|
86083
|
+
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
86084
|
}
|
|
86085
86085
|
}
|
|
86086
86086
|
}
|
|
@@ -106525,7 +106525,7 @@ function transformJsx(context) {
|
|
|
106525
106525
|
const name = node.name;
|
|
106526
106526
|
if (isIdentifier(name)) {
|
|
106527
106527
|
const text = idText(name);
|
|
106528
|
-
return /^[A-
|
|
106528
|
+
return /^[A-Z_]\w*$/i.test(text) ? name : factory2.createStringLiteral(text);
|
|
106529
106529
|
}
|
|
106530
106530
|
return factory2.createStringLiteral(idText(name.namespace) + ":" + idText(name.name));
|
|
106531
106531
|
}
|
|
@@ -121499,7 +121499,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
121499
121499
|
if (node.comment) {
|
|
121500
121500
|
const text = getTextOfJSDocComment(node.comment);
|
|
121501
121501
|
if (text) {
|
|
121502
|
-
const lines = text.split(/\r\n?|\n/
|
|
121502
|
+
const lines = text.split(/\r\n?|\n/);
|
|
121503
121503
|
for (const line of lines) {
|
|
121504
121504
|
writeLine();
|
|
121505
121505
|
writeSpace();
|
|
@@ -121926,7 +121926,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
121926
121926
|
if (isFunctionLike(parentNode) && parentNode.typeArguments) {
|
|
121927
121927
|
return emitTypeArguments(parentNode, parentNode.typeArguments);
|
|
121928
121928
|
}
|
|
121929
|
-
emitList(parentNode, typeParameters, 53776 /* TypeParameters */);
|
|
121929
|
+
emitList(parentNode, typeParameters, 53776 /* TypeParameters */ | (isArrowFunction(parentNode) ? 64 /* AllowTrailingComma */ : 0 /* None */));
|
|
121930
121930
|
}
|
|
121931
121931
|
function emitParameters(parentNode, parameters) {
|
|
121932
121932
|
emitList(parentNode, parameters, 2576 /* Parameters */);
|
|
@@ -122194,7 +122194,7 @@ function createPrinter(printerOptions = {}, handlers = {}) {
|
|
|
122194
122194
|
}
|
|
122195
122195
|
}
|
|
122196
122196
|
function writeLines(text) {
|
|
122197
|
-
const lines = text.split(/\r\n?|\n/
|
|
122197
|
+
const lines = text.split(/\r\n?|\n/);
|
|
122198
122198
|
const indentation = guessIndentation(lines);
|
|
122199
122199
|
for (const lineText of lines) {
|
|
122200
122200
|
const line = indentation ? lineText.slice(indentation) : lineText;
|
|
@@ -123520,6 +123520,12 @@ function createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensi
|
|
|
123520
123520
|
function realpath(s) {
|
|
123521
123521
|
return host.realpath ? host.realpath(s) : s;
|
|
123522
123522
|
}
|
|
123523
|
+
function clearFirstAncestorEntry(fileOrDirectoryPath) {
|
|
123524
|
+
forEachAncestorDirectory(
|
|
123525
|
+
getDirectoryPath(fileOrDirectoryPath),
|
|
123526
|
+
(ancestor) => cachedReadDirectoryResult.delete(ensureTrailingDirectorySeparator(ancestor)) ? true : void 0
|
|
123527
|
+
);
|
|
123528
|
+
}
|
|
123523
123529
|
function addOrDeleteFileOrDirectory(fileOrDirectory, fileOrDirectoryPath) {
|
|
123524
123530
|
const existingResult = getCachedFileSystemEntries(fileOrDirectoryPath);
|
|
123525
123531
|
if (existingResult !== void 0) {
|
|
@@ -123528,6 +123534,7 @@ function createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensi
|
|
|
123528
123534
|
}
|
|
123529
123535
|
const parentResult = getCachedFileSystemEntriesForBaseDir(fileOrDirectoryPath);
|
|
123530
123536
|
if (!parentResult) {
|
|
123537
|
+
clearFirstAncestorEntry(fileOrDirectoryPath);
|
|
123531
123538
|
return void 0;
|
|
123532
123539
|
}
|
|
123533
123540
|
if (!host.directoryExists) {
|
|
@@ -123553,6 +123560,8 @@ function createCachedDirectoryStructureHost(host, currentDirectory, useCaseSensi
|
|
|
123553
123560
|
const parentResult = getCachedFileSystemEntriesForBaseDir(filePath);
|
|
123554
123561
|
if (parentResult) {
|
|
123555
123562
|
updateFilesOfFileSystemEntry(parentResult, getBaseNameOfFileName(fileName), eventKind === 0 /* Created */);
|
|
123563
|
+
} else {
|
|
123564
|
+
clearFirstAncestorEntry(filePath);
|
|
123556
123565
|
}
|
|
123557
123566
|
}
|
|
123558
123567
|
function updateFilesOfFileSystemEntry(parentResult, baseName, fileExists2) {
|
|
@@ -125870,7 +125879,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
|
125870
125879
|
return line;
|
|
125871
125880
|
}
|
|
125872
125881
|
const lineText = file.text.slice(lineStarts[line], lineStarts[line + 1]).trim();
|
|
125873
|
-
if (lineText !== "" &&
|
|
125882
|
+
if (lineText !== "" && !/^\s*\/\/.*$/.test(lineText)) {
|
|
125874
125883
|
return -1;
|
|
125875
125884
|
}
|
|
125876
125885
|
line--;
|
|
@@ -129932,9 +129941,9 @@ function removeIgnoredPath(path) {
|
|
|
129932
129941
|
function perceivedOsRootLengthForWatching(pathComponents2, length2) {
|
|
129933
129942
|
if (length2 <= 1) return 1;
|
|
129934
129943
|
let indexAfterOsRoot = 1;
|
|
129935
|
-
let isDosStyle = pathComponents2[0].search(/[a-
|
|
129944
|
+
let isDosStyle = pathComponents2[0].search(/[a-z]:/i) === 0;
|
|
129936
129945
|
if (pathComponents2[0] !== directorySeparator && !isDosStyle && // Non dos style paths
|
|
129937
|
-
pathComponents2[1].search(/[a-
|
|
129946
|
+
pathComponents2[1].search(/[a-z]\$$/i) === 0) {
|
|
129938
129947
|
if (length2 === 2) return 2;
|
|
129939
129948
|
indexAfterOsRoot = 2;
|
|
129940
129949
|
isDosStyle = true;
|
|
@@ -140175,8 +140184,8 @@ function getEncodedSyntacticClassifications(cancellationToken, sourceFile, span)
|
|
|
140175
140184
|
}
|
|
140176
140185
|
}
|
|
140177
140186
|
function tryClassifyTripleSlashComment(start, width) {
|
|
140178
|
-
const tripleSlashXMLCommentRegEx = /^(\/\/\/\s*)(<)(?:(\S+)((?:[^/]|\/[^>])*)(\/>)?)?/
|
|
140179
|
-
const attributeRegex = /(\s)(\S+)(\s*)(=)(\s*)('[^']+'|"[^"]+")/
|
|
140187
|
+
const tripleSlashXMLCommentRegEx = /^(\/\/\/\s*)(<)(?:(\S+)((?:[^/]|\/[^>])*)(\/>)?)?/m;
|
|
140188
|
+
const attributeRegex = /(\s)(\S+)(\s*)(=)(\s*)('[^']+'|"[^"]+")/g;
|
|
140180
140189
|
const text = sourceFile.text.substr(start, width);
|
|
140181
140190
|
const match = tripleSlashXMLCommentRegEx.exec(text);
|
|
140182
140191
|
if (!match) {
|
|
@@ -141889,7 +141898,7 @@ function preProcessFile(sourceText, readImportFiles = true, detectJavaScriptImpo
|
|
|
141889
141898
|
}
|
|
141890
141899
|
|
|
141891
141900
|
// src/services/sourcemaps.ts
|
|
141892
|
-
var base64UrlRegExp = /^data:(?:application\/json
|
|
141901
|
+
var base64UrlRegExp = /^data:(?:application\/json;charset=[uU][tT][fF]-8;base64,([A-Za-z0-9+/=]+)$)?/;
|
|
141893
141902
|
function getSourceMapper(host) {
|
|
141894
141903
|
const getCanonicalFileName = createGetCanonicalFileName(host.useCaseSensitiveFileNames());
|
|
141895
141904
|
const currentDirectory = host.getCurrentDirectory();
|
|
@@ -143275,7 +143284,7 @@ function isFunctionOrClassExpression(node) {
|
|
|
143275
143284
|
}
|
|
143276
143285
|
function cleanText(text) {
|
|
143277
143286
|
text = text.length > maxLength ? text.substring(0, maxLength) + "..." : text;
|
|
143278
|
-
return text.replace(/\\?(
|
|
143287
|
+
return text.replace(/\\?(?:\r?\n|[\r\u2028\u2029])/g, "");
|
|
143279
143288
|
}
|
|
143280
143289
|
|
|
143281
143290
|
// src/services/_namespaces/ts.refactor.ts
|
|
@@ -150711,7 +150720,7 @@ function createLanguageService(host, documentRegistry = createDocumentRegistry(h
|
|
|
150711
150720
|
return str.replace(/[-[\]/{}()*+?.\\^$|]/g, "\\$&");
|
|
150712
150721
|
}
|
|
150713
150722
|
function getTodoCommentsRegExp() {
|
|
150714
|
-
const singleLineCommentStart = /(
|
|
150723
|
+
const singleLineCommentStart = /(?:\/{2,}\s*)/.source;
|
|
150715
150724
|
const multiLineCommentStart = /(?:\/\*+\s*)/.source;
|
|
150716
150725
|
const anyNumberOfSpacesAndAsterisksAtStartOfLine = /(?:^(?:\s|\*)*)/.source;
|
|
150717
150726
|
const preamble = "(" + anyNumberOfSpacesAndAsterisksAtStartOfLine + "|" + singleLineCommentStart + "|" + multiLineCommentStart + ")";
|
|
@@ -154760,7 +154769,7 @@ function getLeftAndRightSiblings(typedefNode) {
|
|
|
154760
154769
|
function findEndOfTextBetween(jsDocComment, from, to) {
|
|
154761
154770
|
const comment = jsDocComment.getText().substring(from - jsDocComment.getStart(), to - jsDocComment.getStart());
|
|
154762
154771
|
for (let i = comment.length; i > 0; i--) {
|
|
154763
|
-
if (!/[*/\s]
|
|
154772
|
+
if (!/[*/\s]/.test(comment.substring(i - 1, i))) {
|
|
154764
154773
|
return from + i;
|
|
154765
154774
|
}
|
|
154766
154775
|
}
|
|
@@ -173364,11 +173373,11 @@ function addRegionOutliningSpans(sourceFile, out) {
|
|
|
173364
173373
|
for (const currentLineStart of lineStarts) {
|
|
173365
173374
|
const lineEnd = sourceFile.getLineEndOfPosition(currentLineStart);
|
|
173366
173375
|
const lineText = sourceFile.text.substring(currentLineStart, lineEnd);
|
|
173367
|
-
const result =
|
|
173376
|
+
const result = parseRegionDelimiter(lineText);
|
|
173368
173377
|
if (!result || isInComment(sourceFile, currentLineStart)) {
|
|
173369
173378
|
continue;
|
|
173370
173379
|
}
|
|
173371
|
-
if (
|
|
173380
|
+
if (result.isStart) {
|
|
173372
173381
|
const span = createTextSpanFromBounds(sourceFile.text.indexOf("//", currentLineStart), lineEnd);
|
|
173373
173382
|
regions.push(createOutliningSpan(
|
|
173374
173383
|
span,
|
|
@@ -173376,7 +173385,7 @@ function addRegionOutliningSpans(sourceFile, out) {
|
|
|
173376
173385
|
span,
|
|
173377
173386
|
/*autoCollapse*/
|
|
173378
173387
|
false,
|
|
173379
|
-
result
|
|
173388
|
+
result.name || "#region"
|
|
173380
173389
|
));
|
|
173381
173390
|
} else {
|
|
173382
173391
|
const region = regions.pop();
|
|
@@ -173388,14 +173397,18 @@ function addRegionOutliningSpans(sourceFile, out) {
|
|
|
173388
173397
|
}
|
|
173389
173398
|
}
|
|
173390
173399
|
}
|
|
173391
|
-
var regionDelimiterRegExp = /^#(end)?region(
|
|
173392
|
-
function
|
|
173400
|
+
var regionDelimiterRegExp = /^#(end)?region(.*)\r?$/;
|
|
173401
|
+
function parseRegionDelimiter(lineText) {
|
|
173393
173402
|
lineText = lineText.trimStart();
|
|
173394
173403
|
if (!startsWith(lineText, "//")) {
|
|
173395
173404
|
return null;
|
|
173396
173405
|
}
|
|
173397
173406
|
lineText = lineText.slice(2).trim();
|
|
173398
|
-
|
|
173407
|
+
const result = regionDelimiterRegExp.exec(lineText);
|
|
173408
|
+
if (result) {
|
|
173409
|
+
return { isStart: !result[1], name: result[2].trim() };
|
|
173410
|
+
}
|
|
173411
|
+
return void 0;
|
|
173399
173412
|
}
|
|
173400
173413
|
function addOutliningForLeadingCommentsForPos(pos, sourceFile, cancellationToken, out) {
|
|
173401
173414
|
const comments = getLeadingCommentRanges(sourceFile.text, pos);
|
|
@@ -173409,7 +173422,7 @@ function addOutliningForLeadingCommentsForPos(pos, sourceFile, cancellationToken
|
|
|
173409
173422
|
switch (kind) {
|
|
173410
173423
|
case 2 /* SingleLineCommentTrivia */:
|
|
173411
173424
|
const commentText = sourceText.slice(pos2, end);
|
|
173412
|
-
if (
|
|
173425
|
+
if (parseRegionDelimiter(commentText)) {
|
|
173413
173426
|
combineAndAddMultipleSingleLineComments();
|
|
173414
173427
|
singleLineCommentCount = 0;
|
|
173415
173428
|
break;
|
|
@@ -186499,6 +186512,9 @@ var _ProjectService = class _ProjectService {
|
|
|
186499
186512
|
this.packageJsonCache.addOrUpdate(file, fileOrDirectoryPath);
|
|
186500
186513
|
this.watchPackageJsonFile(file, fileOrDirectoryPath, wildCardWatcher);
|
|
186501
186514
|
}
|
|
186515
|
+
if (!(fsResult == null ? void 0 : fsResult.fileExists)) {
|
|
186516
|
+
this.sendSourceFileChange(fileOrDirectoryPath);
|
|
186517
|
+
}
|
|
186502
186518
|
const configuredProjectForConfig = this.findConfiguredProjectByProjectName(configFileName);
|
|
186503
186519
|
if (isIgnoredFileFromWildCardWatching({
|
|
186504
186520
|
watchedDirPath: this.toPath(directory),
|
|
@@ -188030,20 +188046,34 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
188030
188046
|
closeLog() {
|
|
188031
188047
|
this.logger.close();
|
|
188032
188048
|
}
|
|
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.");
|
|
188049
|
+
sendSourceFileChange(inPath) {
|
|
188039
188050
|
this.filenameToScriptInfo.forEach((info) => {
|
|
188040
188051
|
if (this.openFiles.has(info.path)) return;
|
|
188041
188052
|
if (!info.fileWatcher) return;
|
|
188053
|
+
const eventKind = memoize(
|
|
188054
|
+
() => this.host.fileExists(info.fileName) ? info.deferredDelete ? 0 /* Created */ : 1 /* Changed */ : 2 /* Deleted */
|
|
188055
|
+
);
|
|
188056
|
+
if (inPath) {
|
|
188057
|
+
if (isScriptInfoWatchedFromNodeModules(info) || !info.path.startsWith(inPath)) return;
|
|
188058
|
+
if (eventKind() === 2 /* Deleted */ && info.deferredDelete) return;
|
|
188059
|
+
this.logger.info(`Invoking sourceFileChange on ${info.fileName}:: ${eventKind()}`);
|
|
188060
|
+
}
|
|
188042
188061
|
this.onSourceFileChanged(
|
|
188043
188062
|
info,
|
|
188044
|
-
|
|
188063
|
+
eventKind()
|
|
188045
188064
|
);
|
|
188046
188065
|
});
|
|
188066
|
+
}
|
|
188067
|
+
/**
|
|
188068
|
+
* This function rebuilds the project for every file opened by the client
|
|
188069
|
+
* This does not reload contents of open files from disk. But we could do that if needed
|
|
188070
|
+
*/
|
|
188071
|
+
reloadProjects() {
|
|
188072
|
+
this.logger.info("reload projects.");
|
|
188073
|
+
this.sendSourceFileChange(
|
|
188074
|
+
/*inPath*/
|
|
188075
|
+
void 0
|
|
188076
|
+
);
|
|
188047
188077
|
this.pendingProjectUpdates.forEach((_project, projectName) => {
|
|
188048
188078
|
this.throttledOperations.cancel(projectName);
|
|
188049
188079
|
this.pendingProjectUpdates.delete(projectName);
|
|
@@ -188920,7 +188950,7 @@ Dynamic files must always be opened with service's current directory or service
|
|
|
188920
188950
|
return;
|
|
188921
188951
|
}
|
|
188922
188952
|
this.logger.info(`Enabling plugin ${pluginConfigEntry.name} from candidate paths: ${searchPaths.join(",")}`);
|
|
188923
|
-
if (!pluginConfigEntry.name || isExternalModuleNameRelative(pluginConfigEntry.name) || /[\\/]\.\.?(
|
|
188953
|
+
if (!pluginConfigEntry.name || isExternalModuleNameRelative(pluginConfigEntry.name) || /[\\/]\.\.?(?:$|[\\/])/.test(pluginConfigEntry.name)) {
|
|
188924
188954
|
this.logger.info(`Skipped loading plugin ${pluginConfigEntry.name || JSON.stringify(pluginConfigEntry)} because only package name is allowed plugin name`);
|
|
188925
188955
|
return;
|
|
188926
188956
|
}
|
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.20240814",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|
|
@@ -64,6 +64,7 @@
|
|
|
64
64
|
"esbuild": "^0.23.0",
|
|
65
65
|
"eslint": "^9.9.0",
|
|
66
66
|
"eslint-formatter-autolinkable-stylish": "^1.4.0",
|
|
67
|
+
"eslint-plugin-regexp": "^2.6.0",
|
|
67
68
|
"fast-xml-parser": "^4.4.1",
|
|
68
69
|
"glob": "^10.4.5",
|
|
69
70
|
"globals": "^15.9.0",
|
|
@@ -115,5 +116,5 @@
|
|
|
115
116
|
"node": "20.1.0",
|
|
116
117
|
"npm": "8.19.4"
|
|
117
118
|
},
|
|
118
|
-
"gitHead": "
|
|
119
|
+
"gitHead": "77534875918d98c75006123a910ebf89fd4fb1be"
|
|
119
120
|
}
|