@typescript-deploys/pr-build 5.0.0-pr-50996-2 → 5.0.0-pr-51492-2
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 -55
- package/lib/tsserver.js +64 -311
- package/lib/tsserverlibrary.d.ts +25 -24
- package/lib/tsserverlibrary.js +65 -312
- package/lib/typescript.d.ts +23 -22
- package/lib/typescript.js +52 -295
- package/package.json +1 -1
package/lib/typescript.js
CHANGED
|
@@ -4719,19 +4719,19 @@ ${lanes.join("\n")}
|
|
|
4719
4719
|
PollingWatchKind2[PollingWatchKind2["FixedChunkSize"] = 3] = "FixedChunkSize";
|
|
4720
4720
|
return PollingWatchKind2;
|
|
4721
4721
|
})(PollingWatchKind || {});
|
|
4722
|
-
ModuleKind = /* @__PURE__ */ ((
|
|
4723
|
-
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
|
|
4730
|
-
|
|
4731
|
-
|
|
4732
|
-
|
|
4733
|
-
|
|
4734
|
-
return
|
|
4722
|
+
ModuleKind = /* @__PURE__ */ ((ModuleKind2) => {
|
|
4723
|
+
ModuleKind2[ModuleKind2["None"] = 0] = "None";
|
|
4724
|
+
ModuleKind2[ModuleKind2["CommonJS"] = 1] = "CommonJS";
|
|
4725
|
+
ModuleKind2[ModuleKind2["AMD"] = 2] = "AMD";
|
|
4726
|
+
ModuleKind2[ModuleKind2["UMD"] = 3] = "UMD";
|
|
4727
|
+
ModuleKind2[ModuleKind2["System"] = 4] = "System";
|
|
4728
|
+
ModuleKind2[ModuleKind2["ES2015"] = 5] = "ES2015";
|
|
4729
|
+
ModuleKind2[ModuleKind2["ES2020"] = 6] = "ES2020";
|
|
4730
|
+
ModuleKind2[ModuleKind2["ES2022"] = 7] = "ES2022";
|
|
4731
|
+
ModuleKind2[ModuleKind2["ESNext"] = 99] = "ESNext";
|
|
4732
|
+
ModuleKind2[ModuleKind2["Node16"] = 100] = "Node16";
|
|
4733
|
+
ModuleKind2[ModuleKind2["NodeNext"] = 199] = "NodeNext";
|
|
4734
|
+
return ModuleKind2;
|
|
4735
4735
|
})(ModuleKind || {});
|
|
4736
4736
|
JsxEmit = /* @__PURE__ */ ((JsxEmit2) => {
|
|
4737
4737
|
JsxEmit2[JsxEmit2["None"] = 0] = "None";
|
|
@@ -17142,32 +17142,6 @@ ${lanes.join("\n")}
|
|
|
17142
17142
|
function pseudoBigIntToString({ negative, base10Value }) {
|
|
17143
17143
|
return (negative && base10Value !== "0" ? "-" : "") + base10Value;
|
|
17144
17144
|
}
|
|
17145
|
-
function parseBigInt(text) {
|
|
17146
|
-
if (!isValidBigIntString(text, false)) {
|
|
17147
|
-
return void 0;
|
|
17148
|
-
}
|
|
17149
|
-
return parseValidBigInt(text);
|
|
17150
|
-
}
|
|
17151
|
-
function parseValidBigInt(text) {
|
|
17152
|
-
const negative = text.startsWith("-");
|
|
17153
|
-
const base10Value = parsePseudoBigInt(`${negative ? text.slice(1) : text}n`);
|
|
17154
|
-
return { negative, base10Value };
|
|
17155
|
-
}
|
|
17156
|
-
function isValidBigIntString(s, roundTripOnly) {
|
|
17157
|
-
if (s === "")
|
|
17158
|
-
return false;
|
|
17159
|
-
const scanner2 = createScanner(99 /* ESNext */, false);
|
|
17160
|
-
let success = true;
|
|
17161
|
-
scanner2.setOnError(() => success = false);
|
|
17162
|
-
scanner2.setText(s + "n");
|
|
17163
|
-
let result = scanner2.scan();
|
|
17164
|
-
const negative = result === 40 /* MinusToken */;
|
|
17165
|
-
if (negative) {
|
|
17166
|
-
result = scanner2.scan();
|
|
17167
|
-
}
|
|
17168
|
-
const flags = scanner2.getTokenFlags();
|
|
17169
|
-
return success && result === 9 /* BigIntLiteral */ && scanner2.getTextPos() === s.length + 1 && !(flags & 512 /* ContainsSeparator */) && (!roundTripOnly || s === pseudoBigIntToString({ negative, base10Value: parsePseudoBigInt(scanner2.getTokenValue()) }));
|
|
17170
|
-
}
|
|
17171
17145
|
function isValidTypeOnlyAliasUseSite(useSite) {
|
|
17172
17146
|
return !!(useSite.flags & 16777216 /* Ambient */) || isPartOfTypeQuery(useSite) || isIdentifierInNonEmittingHeritageClause(useSite) || isPartOfPossiblyValidTypeOrAbstractComputedPropertyName(useSite) || !(isExpressionNode(useSite) || isShorthandPropertyNameUseSite(useSite));
|
|
17173
17147
|
}
|
|
@@ -17494,10 +17468,6 @@ ${lanes.join("\n")}
|
|
|
17494
17468
|
const { isBracketed, typeExpression } = node;
|
|
17495
17469
|
return isBracketed || !!typeExpression && typeExpression.type.kind === 319 /* JSDocOptionalType */;
|
|
17496
17470
|
}
|
|
17497
|
-
function canUsePropertyAccess(name, languageVersion) {
|
|
17498
|
-
const firstChar = name.charCodeAt(0);
|
|
17499
|
-
return firstChar === 35 /* hash */ ? name.length > 1 && isIdentifierStart(name.charCodeAt(1), languageVersion) : isIdentifierStart(firstChar, languageVersion);
|
|
17500
|
-
}
|
|
17501
17471
|
var resolvingEmptyArray, externalHelpersModuleNameText, defaultMaximumTruncationLength, noTruncationMaximumTruncationLength, stringWriter, GetLiteralTextFlags, fullTripleSlashReferencePathRegEx, fullTripleSlashReferenceTypeReferenceDirectiveRegEx, fullTripleSlashAMDReferencePathRegEx, defaultLibReferenceRegEx, AssignmentKind, FunctionFlags, Associativity, OperatorPrecedence, templateSubstitutionRegExp, doubleQuoteEscapedCharsRegExp, singleQuoteEscapedCharsRegExp, backtickQuoteEscapedCharsRegExp, escapedCharsMap, nonAsciiCharacters, jsxDoubleQuoteEscapedCharsRegExp, jsxSingleQuoteEscapedCharsRegExp, jsxEscapedCharsMap, indentStrings, base64Digits, carriageReturnLineFeed, lineFeed, AccessKind, objectAllocator, localizedDiagnosticMessages, reservedCharacterPattern, wildcardCharCodes, commonPackageFolders, implicitExcludePathRegexPattern, filesMatcher, directoriesMatcher, excludeMatcher, wildcardMatchers, supportedTSExtensions, supportedTSExtensionsFlat, supportedTSExtensionsWithJson, supportedTSExtensionsForExtractExtension, supportedJSExtensions, supportedJSExtensionsFlat, allSupportedExtensions, allSupportedExtensionsWithJson, supportedDeclarationExtensions, extensionsToRemove, emptyFileSystemEntries;
|
|
17502
17472
|
var init_utilities = __esm({
|
|
17503
17473
|
"src/compiler/utilities.ts"() {
|
|
@@ -39925,11 +39895,11 @@ ${lanes.join("\n")}
|
|
|
39925
39895
|
if (specifier && modulePath.isRedirect) {
|
|
39926
39896
|
return nodeModulesSpecifiers;
|
|
39927
39897
|
}
|
|
39928
|
-
if (!specifier
|
|
39898
|
+
if (!specifier) {
|
|
39929
39899
|
const local = getLocalModuleSpecifier(modulePath.path, info, compilerOptions, host, options.overrideImportMode || importingSourceFile.impliedNodeFormat, preferences);
|
|
39930
39900
|
if (pathIsBareSpecifier(local)) {
|
|
39931
39901
|
pathsSpecifiers = append(pathsSpecifiers, local);
|
|
39932
|
-
} else if (!importedFileIsInNodeModules || modulePath.isInNodeModules) {
|
|
39902
|
+
} else if (!modulePath.isRedirect && (!importedFileIsInNodeModules || modulePath.isInNodeModules)) {
|
|
39933
39903
|
relativeSpecifiers = append(relativeSpecifiers, local);
|
|
39934
39904
|
}
|
|
39935
39905
|
}
|
|
@@ -39954,31 +39924,29 @@ ${lanes.join("\n")}
|
|
|
39954
39924
|
return relativePath;
|
|
39955
39925
|
}
|
|
39956
39926
|
const fromPaths = paths && tryGetModuleNameFromPaths(relativeToBaseUrl, paths, getAllowedEndings(ending, compilerOptions, importMode), host, compilerOptions);
|
|
39957
|
-
const
|
|
39958
|
-
if (!
|
|
39927
|
+
const maybeNonRelative = fromPaths === void 0 && baseUrl !== void 0 ? removeExtensionAndIndexPostFix(relativeToBaseUrl, ending, compilerOptions) : fromPaths;
|
|
39928
|
+
if (!maybeNonRelative) {
|
|
39959
39929
|
return relativePath;
|
|
39960
39930
|
}
|
|
39961
|
-
if (relativePreference === 1 /* NonRelative */) {
|
|
39962
|
-
return
|
|
39931
|
+
if (relativePreference === 1 /* NonRelative */ && !pathIsRelative(maybeNonRelative)) {
|
|
39932
|
+
return maybeNonRelative;
|
|
39963
39933
|
}
|
|
39964
|
-
if (relativePreference === 3 /* ExternalNonRelative */) {
|
|
39934
|
+
if (relativePreference === 3 /* ExternalNonRelative */ && !pathIsRelative(maybeNonRelative)) {
|
|
39965
39935
|
const projectDirectory = compilerOptions.configFilePath ? toPath(getDirectoryPath(compilerOptions.configFilePath), host.getCurrentDirectory(), info.getCanonicalFileName) : info.getCanonicalFileName(host.getCurrentDirectory());
|
|
39966
39936
|
const modulePath = toPath(moduleFileName, projectDirectory, getCanonicalFileName);
|
|
39967
39937
|
const sourceIsInternal = startsWith(sourceDirectory, projectDirectory);
|
|
39968
39938
|
const targetIsInternal = startsWith(modulePath, projectDirectory);
|
|
39969
39939
|
if (sourceIsInternal && !targetIsInternal || !sourceIsInternal && targetIsInternal) {
|
|
39970
|
-
return
|
|
39940
|
+
return maybeNonRelative;
|
|
39971
39941
|
}
|
|
39972
39942
|
const nearestTargetPackageJson = getNearestAncestorDirectoryWithPackageJson(host, getDirectoryPath(modulePath));
|
|
39973
39943
|
const nearestSourcePackageJson = getNearestAncestorDirectoryWithPackageJson(host, sourceDirectory);
|
|
39974
39944
|
if (nearestSourcePackageJson !== nearestTargetPackageJson) {
|
|
39975
|
-
return
|
|
39945
|
+
return maybeNonRelative;
|
|
39976
39946
|
}
|
|
39977
39947
|
return relativePath;
|
|
39978
39948
|
}
|
|
39979
|
-
|
|
39980
|
-
Debug.assertNever(relativePreference);
|
|
39981
|
-
return isPathRelativeToParent(nonRelative) || countPathComponents(relativePath) < countPathComponents(nonRelative) ? relativePath : nonRelative;
|
|
39949
|
+
return isPathRelativeToParent(maybeNonRelative) || countPathComponents(relativePath) < countPathComponents(maybeNonRelative) ? relativePath : maybeNonRelative;
|
|
39982
39950
|
}
|
|
39983
39951
|
function countPathComponents(path) {
|
|
39984
39952
|
let count = 0;
|
|
@@ -45487,7 +45455,8 @@ ${lanes.join("\n")}
|
|
|
45487
45455
|
if (isSingleOrDoubleQuote(firstChar) && some(symbol2.declarations, hasNonGlobalAugmentationExternalModuleSymbol)) {
|
|
45488
45456
|
return factory.createStringLiteral(getSpecifierForModuleSymbol(symbol2, context));
|
|
45489
45457
|
}
|
|
45490
|
-
|
|
45458
|
+
const canUsePropertyAccess = firstChar === 35 /* hash */ ? symbolName2.length > 1 && isIdentifierStart(symbolName2.charCodeAt(1), languageVersion) : isIdentifierStart(firstChar, languageVersion);
|
|
45459
|
+
if (index === 0 || canUsePropertyAccess) {
|
|
45491
45460
|
const identifier = setEmitFlags(factory.createIdentifier(symbolName2, typeParameterNodes), 16777216 /* NoAsciiEscaping */);
|
|
45492
45461
|
identifier.symbol = symbol2;
|
|
45493
45462
|
return index > 0 ? factory.createPropertyAccessExpression(createExpressionFromSymbolChain(chain2, index - 1), identifier) : identifier;
|
|
@@ -57543,7 +57512,24 @@ ${lanes.join("\n")}
|
|
|
57543
57512
|
return isFinite(n) && (!roundTripOnly || "" + n === s);
|
|
57544
57513
|
}
|
|
57545
57514
|
function parseBigIntLiteralType(text) {
|
|
57546
|
-
|
|
57515
|
+
const negative = text.startsWith("-");
|
|
57516
|
+
const base10Value = parsePseudoBigInt(`${negative ? text.slice(1) : text}n`);
|
|
57517
|
+
return getBigIntLiteralType({ negative, base10Value });
|
|
57518
|
+
}
|
|
57519
|
+
function isValidBigIntString(s, roundTripOnly) {
|
|
57520
|
+
if (s === "")
|
|
57521
|
+
return false;
|
|
57522
|
+
const scanner2 = createScanner(99 /* ESNext */, false);
|
|
57523
|
+
let success = true;
|
|
57524
|
+
scanner2.setOnError(() => success = false);
|
|
57525
|
+
scanner2.setText(s + "n");
|
|
57526
|
+
let result = scanner2.scan();
|
|
57527
|
+
const negative = result === 40 /* MinusToken */;
|
|
57528
|
+
if (negative) {
|
|
57529
|
+
result = scanner2.scan();
|
|
57530
|
+
}
|
|
57531
|
+
const flags = scanner2.getTokenFlags();
|
|
57532
|
+
return success && result === 9 /* BigIntLiteral */ && scanner2.getTextPos() === s.length + 1 && !(flags & 512 /* ContainsSeparator */) && (!roundTripOnly || s === pseudoBigIntToString({ negative, base10Value: parsePseudoBigInt(scanner2.getTokenValue()) }));
|
|
57547
57533
|
}
|
|
57548
57534
|
function isMemberOfStringMapping(source, target) {
|
|
57549
57535
|
if (target.flags & (4 /* String */ | 1 /* Any */)) {
|
|
@@ -105080,12 +105066,12 @@ ${lanes.join("\n")}
|
|
|
105080
105066
|
const resolved = getResolutionWithResolvedFileName(resolution);
|
|
105081
105067
|
trace(
|
|
105082
105068
|
host,
|
|
105083
|
-
loader === resolveModuleName2 ? (resolved == null ? void 0 : resolved.resolvedFileName) ? resolved.
|
|
105069
|
+
loader === resolveModuleName2 ? (resolved == null ? void 0 : resolved.resolvedFileName) ? resolved.packageId ? Diagnostics.Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3_with_Package_ID_4 : Diagnostics.Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3 : Diagnostics.Reusing_resolution_of_module_0_from_1_found_in_cache_from_location_2_it_was_not_resolved : (resolved == null ? void 0 : resolved.resolvedFileName) ? resolved.packageId ? Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3_with_Package_ID_4 : Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_successfully_resolved_to_3 : Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_found_in_cache_from_location_2_it_was_not_resolved,
|
|
105084
105070
|
name,
|
|
105085
105071
|
containingFile,
|
|
105086
105072
|
getDirectoryPath(containingFile),
|
|
105087
105073
|
resolved == null ? void 0 : resolved.resolvedFileName,
|
|
105088
|
-
(resolved == null ? void 0 : resolved.
|
|
105074
|
+
(resolved == null ? void 0 : resolved.packageId) && packageIdToString(resolved.packageId)
|
|
105089
105075
|
);
|
|
105090
105076
|
}
|
|
105091
105077
|
} else {
|
|
@@ -105110,11 +105096,11 @@ ${lanes.join("\n")}
|
|
|
105110
105096
|
const resolved = getResolutionWithResolvedFileName(resolution);
|
|
105111
105097
|
trace(
|
|
105112
105098
|
host,
|
|
105113
|
-
loader === resolveModuleName2 ? (resolved == null ? void 0 : resolved.resolvedFileName) ? resolved.
|
|
105099
|
+
loader === resolveModuleName2 ? (resolved == null ? void 0 : resolved.resolvedFileName) ? resolved.packageId ? Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 : Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_successfully_resolved_to_2 : Diagnostics.Reusing_resolution_of_module_0_from_1_of_old_program_it_was_not_resolved : (resolved == null ? void 0 : resolved.resolvedFileName) ? resolved.packageId ? Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved_to_2_with_Package_ID_3 : Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_successfully_resolved_to_2 : Diagnostics.Reusing_resolution_of_type_reference_directive_0_from_1_of_old_program_it_was_not_resolved,
|
|
105114
105100
|
name,
|
|
105115
105101
|
containingFile,
|
|
105116
105102
|
resolved == null ? void 0 : resolved.resolvedFileName,
|
|
105117
|
-
(resolved == null ? void 0 : resolved.
|
|
105103
|
+
(resolved == null ? void 0 : resolved.packageId) && packageIdToString(resolved.packageId)
|
|
105118
105104
|
);
|
|
105119
105105
|
}
|
|
105120
105106
|
}
|
|
@@ -129593,13 +129579,6 @@ ${lanes.join("\n")}
|
|
|
129593
129579
|
if (!isChecked) {
|
|
129594
129580
|
getJSCompletionEntries(sourceFile, location.pos, uniqueNames, getEmitScriptTarget(compilerOptions), entries);
|
|
129595
129581
|
}
|
|
129596
|
-
let caseBlock;
|
|
129597
|
-
if (preferences.includeCompletionsWithInsertText && contextToken && (caseBlock = findAncestor(contextToken, isCaseBlock))) {
|
|
129598
|
-
const cases = getExhaustiveCaseSnippets(caseBlock, sourceFile, preferences, compilerOptions, host, program, formatContext);
|
|
129599
|
-
if (cases) {
|
|
129600
|
-
entries.push(cases.entry);
|
|
129601
|
-
}
|
|
129602
|
-
}
|
|
129603
129582
|
return {
|
|
129604
129583
|
flags: completionData.flags,
|
|
129605
129584
|
isGlobalCompletion: isInSnippetScope,
|
|
@@ -129613,194 +129592,6 @@ ${lanes.join("\n")}
|
|
|
129613
129592
|
function isCheckedFile(sourceFile, compilerOptions) {
|
|
129614
129593
|
return !isSourceFileJS(sourceFile) || !!isCheckJsEnabledForFile(sourceFile, compilerOptions);
|
|
129615
129594
|
}
|
|
129616
|
-
function getExhaustiveCaseSnippets(caseBlock, sourceFile, preferences, options, host, program, formatContext) {
|
|
129617
|
-
const clauses = caseBlock.clauses;
|
|
129618
|
-
const checker = program.getTypeChecker();
|
|
129619
|
-
const switchType = checker.getTypeAtLocation(caseBlock.parent.expression);
|
|
129620
|
-
if (switchType && switchType.isUnion() && every(switchType.types, (type) => type.isLiteral())) {
|
|
129621
|
-
const tracker = newCaseClauseTracker(checker);
|
|
129622
|
-
for (const clause of clauses) {
|
|
129623
|
-
if (!isDefaultClause(clause)) {
|
|
129624
|
-
tracker.addClause(clause);
|
|
129625
|
-
}
|
|
129626
|
-
}
|
|
129627
|
-
const target = getEmitScriptTarget(options);
|
|
129628
|
-
const quotePreference = getQuotePreference(sourceFile, preferences);
|
|
129629
|
-
const importAdder = ts_codefix_exports.createImportAdder(sourceFile, program, preferences, host);
|
|
129630
|
-
const elements = [];
|
|
129631
|
-
for (const type of switchType.types) {
|
|
129632
|
-
if (type.flags & 1024 /* EnumLiteral */) {
|
|
129633
|
-
Debug.assert(type.symbol, "An enum member type should have a symbol");
|
|
129634
|
-
Debug.assert(type.symbol.parent, "An enum member type should have a parent symbol (the enum symbol)");
|
|
129635
|
-
const enumValue = type.symbol.valueDeclaration && checker.getConstantValue(type.symbol.valueDeclaration);
|
|
129636
|
-
if (enumValue !== void 0) {
|
|
129637
|
-
if (tracker.hasValue(enumValue)) {
|
|
129638
|
-
continue;
|
|
129639
|
-
}
|
|
129640
|
-
tracker.addValue(enumValue);
|
|
129641
|
-
}
|
|
129642
|
-
const typeNode = ts_codefix_exports.typeToAutoImportableTypeNode(checker, importAdder, type, caseBlock, target);
|
|
129643
|
-
if (!typeNode) {
|
|
129644
|
-
return void 0;
|
|
129645
|
-
}
|
|
129646
|
-
const expr = typeNodeToExpression(typeNode, target, quotePreference);
|
|
129647
|
-
if (!expr) {
|
|
129648
|
-
return void 0;
|
|
129649
|
-
}
|
|
129650
|
-
elements.push(expr);
|
|
129651
|
-
} else if (!tracker.hasValue(type.value)) {
|
|
129652
|
-
switch (typeof type.value) {
|
|
129653
|
-
case "object":
|
|
129654
|
-
elements.push(factory.createBigIntLiteral(type.value));
|
|
129655
|
-
break;
|
|
129656
|
-
case "number":
|
|
129657
|
-
elements.push(factory.createNumericLiteral(type.value));
|
|
129658
|
-
break;
|
|
129659
|
-
case "string":
|
|
129660
|
-
elements.push(factory.createStringLiteral(type.value));
|
|
129661
|
-
break;
|
|
129662
|
-
}
|
|
129663
|
-
}
|
|
129664
|
-
}
|
|
129665
|
-
if (elements.length === 0) {
|
|
129666
|
-
return void 0;
|
|
129667
|
-
}
|
|
129668
|
-
const newClauses = map(elements, (element) => {
|
|
129669
|
-
return factory.createCaseClause(element, []);
|
|
129670
|
-
});
|
|
129671
|
-
const printer = createSnippetPrinter({
|
|
129672
|
-
removeComments: true,
|
|
129673
|
-
module: options.module,
|
|
129674
|
-
target: options.target,
|
|
129675
|
-
newLine: getNewLineKind(getNewLineCharacter(options, maybeBind(host, host.getNewLine)))
|
|
129676
|
-
});
|
|
129677
|
-
const insertText = formatContext ? printer.printAndFormatSnippetList(
|
|
129678
|
-
1 /* MultiLine */ | 131072 /* NoTrailingNewLine */,
|
|
129679
|
-
factory.createNodeArray(newClauses),
|
|
129680
|
-
sourceFile,
|
|
129681
|
-
formatContext
|
|
129682
|
-
) : printer.printSnippetList(
|
|
129683
|
-
1 /* MultiLine */ | 131072 /* NoTrailingNewLine */,
|
|
129684
|
-
factory.createNodeArray(newClauses),
|
|
129685
|
-
sourceFile
|
|
129686
|
-
);
|
|
129687
|
-
const firstClause = printer.printSnippetList(0 /* SingleLine */, factory.createNodeArray([first(newClauses)]), sourceFile);
|
|
129688
|
-
return {
|
|
129689
|
-
entry: {
|
|
129690
|
-
name: `${firstClause} ...`,
|
|
129691
|
-
kind: "" /* unknown */,
|
|
129692
|
-
sortText: SortText.GlobalsOrKeywords,
|
|
129693
|
-
insertText,
|
|
129694
|
-
hasAction: importAdder.hasFixes() || void 0,
|
|
129695
|
-
source: "SwitchCases/" /* SwitchCases */
|
|
129696
|
-
},
|
|
129697
|
-
importAdder
|
|
129698
|
-
};
|
|
129699
|
-
}
|
|
129700
|
-
return void 0;
|
|
129701
|
-
}
|
|
129702
|
-
function newCaseClauseTracker(checker) {
|
|
129703
|
-
const existingStrings = /* @__PURE__ */ new Set();
|
|
129704
|
-
const existingNumbers = /* @__PURE__ */ new Set();
|
|
129705
|
-
const existingBigInts = /* @__PURE__ */ new Set();
|
|
129706
|
-
return {
|
|
129707
|
-
addValue,
|
|
129708
|
-
addClause,
|
|
129709
|
-
hasValue
|
|
129710
|
-
};
|
|
129711
|
-
function addClause(clause) {
|
|
129712
|
-
if (isLiteralExpression(clause.expression)) {
|
|
129713
|
-
const expression = clause.expression;
|
|
129714
|
-
switch (expression.kind) {
|
|
129715
|
-
case 14 /* NoSubstitutionTemplateLiteral */:
|
|
129716
|
-
case 10 /* StringLiteral */:
|
|
129717
|
-
existingStrings.add(expression.text);
|
|
129718
|
-
break;
|
|
129719
|
-
case 8 /* NumericLiteral */:
|
|
129720
|
-
existingNumbers.add(parseInt(expression.text));
|
|
129721
|
-
break;
|
|
129722
|
-
case 9 /* BigIntLiteral */:
|
|
129723
|
-
const parsedBigInt = parseBigInt(endsWith(expression.text, "n") ? expression.text.slice(0, -1) : expression.text);
|
|
129724
|
-
if (parsedBigInt) {
|
|
129725
|
-
existingBigInts.add(pseudoBigIntToString(parsedBigInt));
|
|
129726
|
-
}
|
|
129727
|
-
break;
|
|
129728
|
-
}
|
|
129729
|
-
} else {
|
|
129730
|
-
const symbol = checker.getSymbolAtLocation(clause.expression);
|
|
129731
|
-
if (symbol && symbol.valueDeclaration && isEnumMember(symbol.valueDeclaration)) {
|
|
129732
|
-
const enumValue = checker.getConstantValue(symbol.valueDeclaration);
|
|
129733
|
-
if (enumValue !== void 0) {
|
|
129734
|
-
addValue(enumValue);
|
|
129735
|
-
}
|
|
129736
|
-
}
|
|
129737
|
-
}
|
|
129738
|
-
}
|
|
129739
|
-
function addValue(value) {
|
|
129740
|
-
switch (typeof value) {
|
|
129741
|
-
case "string":
|
|
129742
|
-
existingStrings.add(value);
|
|
129743
|
-
break;
|
|
129744
|
-
case "number":
|
|
129745
|
-
existingNumbers.add(value);
|
|
129746
|
-
}
|
|
129747
|
-
}
|
|
129748
|
-
function hasValue(value) {
|
|
129749
|
-
switch (typeof value) {
|
|
129750
|
-
case "string":
|
|
129751
|
-
return existingStrings.has(value);
|
|
129752
|
-
case "number":
|
|
129753
|
-
return existingNumbers.has(value);
|
|
129754
|
-
case "object":
|
|
129755
|
-
return existingBigInts.has(pseudoBigIntToString(value));
|
|
129756
|
-
}
|
|
129757
|
-
}
|
|
129758
|
-
}
|
|
129759
|
-
function typeNodeToExpression(typeNode, languageVersion, quotePreference) {
|
|
129760
|
-
switch (typeNode.kind) {
|
|
129761
|
-
case 180 /* TypeReference */:
|
|
129762
|
-
const typeName = typeNode.typeName;
|
|
129763
|
-
return entityNameToExpression(typeName, languageVersion, quotePreference);
|
|
129764
|
-
case 196 /* IndexedAccessType */:
|
|
129765
|
-
const objectExpression = typeNodeToExpression(typeNode.objectType, languageVersion, quotePreference);
|
|
129766
|
-
const indexExpression = typeNodeToExpression(typeNode.indexType, languageVersion, quotePreference);
|
|
129767
|
-
return objectExpression && indexExpression && factory.createElementAccessExpression(objectExpression, indexExpression);
|
|
129768
|
-
case 198 /* LiteralType */:
|
|
129769
|
-
const literal = typeNode.literal;
|
|
129770
|
-
switch (literal.kind) {
|
|
129771
|
-
case 10 /* StringLiteral */:
|
|
129772
|
-
return factory.createStringLiteral(literal.text, quotePreference === 0 /* Single */);
|
|
129773
|
-
case 8 /* NumericLiteral */:
|
|
129774
|
-
return factory.createNumericLiteral(literal.text, literal.numericLiteralFlags);
|
|
129775
|
-
}
|
|
129776
|
-
return void 0;
|
|
129777
|
-
case 193 /* ParenthesizedType */:
|
|
129778
|
-
const exp = typeNodeToExpression(typeNode.type, languageVersion, quotePreference);
|
|
129779
|
-
return exp && (isIdentifier(exp) ? exp : factory.createParenthesizedExpression(exp));
|
|
129780
|
-
case 183 /* TypeQuery */:
|
|
129781
|
-
return entityNameToExpression(typeNode.exprName, languageVersion, quotePreference);
|
|
129782
|
-
case 202 /* ImportType */:
|
|
129783
|
-
Debug.fail(`We should not get an import type after calling 'codefix.typeToAutoImportableTypeNode'.`);
|
|
129784
|
-
}
|
|
129785
|
-
return void 0;
|
|
129786
|
-
}
|
|
129787
|
-
function entityNameToExpression(entityName, languageVersion, quotePreference) {
|
|
129788
|
-
if (isIdentifier(entityName)) {
|
|
129789
|
-
return entityName;
|
|
129790
|
-
}
|
|
129791
|
-
const realName = unescapeLeadingUnderscores(entityName.right.escapedText);
|
|
129792
|
-
if (canUsePropertyAccess(realName, languageVersion)) {
|
|
129793
|
-
return factory.createPropertyAccessExpression(
|
|
129794
|
-
entityNameToExpression(entityName.left, languageVersion, quotePreference),
|
|
129795
|
-
realName
|
|
129796
|
-
);
|
|
129797
|
-
} else {
|
|
129798
|
-
return factory.createElementAccessExpression(
|
|
129799
|
-
entityNameToExpression(entityName.left, languageVersion, quotePreference),
|
|
129800
|
-
factory.createStringLiteral(realName, quotePreference === 0 /* Single */)
|
|
129801
|
-
);
|
|
129802
|
-
}
|
|
129803
|
-
}
|
|
129804
129595
|
function isMemberCompletionKind(kind) {
|
|
129805
129596
|
switch (kind) {
|
|
129806
129597
|
case CompletionKind.ObjectPropertyDeclaration:
|
|
@@ -130459,9 +130250,6 @@ ${lanes.join("\n")}
|
|
|
130459
130250
|
return entries;
|
|
130460
130251
|
}
|
|
130461
130252
|
function getSymbolCompletionFromEntryId(program, log, sourceFile, position, entryId, host, preferences) {
|
|
130462
|
-
if (entryId.source === "SwitchCases/" /* SwitchCases */) {
|
|
130463
|
-
return { type: "cases" };
|
|
130464
|
-
}
|
|
130465
130253
|
if (entryId.data) {
|
|
130466
130254
|
const autoImport = getAutoImportSymbolFromCompletionEntryData(entryId.name, entryId.data, program, host);
|
|
130467
130255
|
if (autoImport) {
|
|
@@ -130500,9 +130288,9 @@ ${lanes.join("\n")}
|
|
|
130500
130288
|
const typeChecker = program.getTypeChecker();
|
|
130501
130289
|
const compilerOptions = program.getCompilerOptions();
|
|
130502
130290
|
const { name, source, data } = entryId;
|
|
130503
|
-
const
|
|
130504
|
-
if (isInString(sourceFile, position,
|
|
130505
|
-
return ts_Completions_StringCompletions_exports.getStringLiteralCompletionDetails(name, sourceFile, position,
|
|
130291
|
+
const contextToken = findPrecedingToken(position, sourceFile);
|
|
130292
|
+
if (isInString(sourceFile, position, contextToken)) {
|
|
130293
|
+
return ts_Completions_StringCompletions_exports.getStringLiteralCompletionDetails(name, sourceFile, position, contextToken, typeChecker, compilerOptions, host, cancellationToken, preferences);
|
|
130506
130294
|
}
|
|
130507
130295
|
const symbolCompletion = getSymbolCompletionFromEntryId(program, log, sourceFile, position, entryId, host, preferences);
|
|
130508
130296
|
switch (symbolCompletion.type) {
|
|
@@ -130522,40 +130310,14 @@ ${lanes.join("\n")}
|
|
|
130522
130310
|
}
|
|
130523
130311
|
}
|
|
130524
130312
|
case "symbol": {
|
|
130525
|
-
const { symbol, location, contextToken: contextToken2, origin, previousToken
|
|
130526
|
-
const { codeActions, sourceDisplay } = getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken2, origin, symbol, program, host, compilerOptions, sourceFile, position,
|
|
130313
|
+
const { symbol, location, contextToken: contextToken2, origin, previousToken } = symbolCompletion;
|
|
130314
|
+
const { codeActions, sourceDisplay } = getCompletionEntryCodeActionsAndSourceDisplay(name, location, contextToken2, origin, symbol, program, host, compilerOptions, sourceFile, position, previousToken, formatContext, preferences, data, source, cancellationToken);
|
|
130527
130315
|
return createCompletionDetailsForSymbol(symbol, typeChecker, sourceFile, location, cancellationToken, codeActions, sourceDisplay);
|
|
130528
130316
|
}
|
|
130529
130317
|
case "literal": {
|
|
130530
130318
|
const { literal } = symbolCompletion;
|
|
130531
130319
|
return createSimpleDetails(completionNameForLiteral(sourceFile, preferences, literal), "string" /* string */, typeof literal === "string" ? 8 /* stringLiteral */ : 7 /* numericLiteral */);
|
|
130532
130320
|
}
|
|
130533
|
-
case "cases": {
|
|
130534
|
-
const { entry, importAdder } = getExhaustiveCaseSnippets(
|
|
130535
|
-
contextToken.parent,
|
|
130536
|
-
sourceFile,
|
|
130537
|
-
preferences,
|
|
130538
|
-
program.getCompilerOptions(),
|
|
130539
|
-
host,
|
|
130540
|
-
program,
|
|
130541
|
-
void 0
|
|
130542
|
-
);
|
|
130543
|
-
const changes = ts_textChanges_exports.ChangeTracker.with(
|
|
130544
|
-
{ host, formatContext, preferences },
|
|
130545
|
-
importAdder.writeFixes
|
|
130546
|
-
);
|
|
130547
|
-
return {
|
|
130548
|
-
name: entry.name,
|
|
130549
|
-
kind: "" /* unknown */,
|
|
130550
|
-
kindModifiers: "",
|
|
130551
|
-
displayParts: [],
|
|
130552
|
-
sourceDisplay: void 0,
|
|
130553
|
-
codeActions: [{
|
|
130554
|
-
changes,
|
|
130555
|
-
description: diagnosticToString([Diagnostics.Includes_imports_of_types_referenced_by_0, name])
|
|
130556
|
-
}]
|
|
130557
|
-
};
|
|
130558
|
-
}
|
|
130559
130321
|
case "none":
|
|
130560
130322
|
return allKeywordsCompletions().some((c) => c.name === name) ? createSimpleDetails(name, "keyword" /* keyword */, 5 /* keyword */) : void 0;
|
|
130561
130323
|
default:
|
|
@@ -132442,7 +132204,6 @@ ${lanes.join("\n")}
|
|
|
132442
132204
|
CompletionSource2["ClassMemberSnippet"] = "ClassMemberSnippet/";
|
|
132443
132205
|
CompletionSource2["TypeOnlyAlias"] = "TypeOnlyAlias/";
|
|
132444
132206
|
CompletionSource2["ObjectLiteralMethodSnippet"] = "ObjectLiteralMethodSnippet/";
|
|
132445
|
-
CompletionSource2["SwitchCases"] = "SwitchCases/";
|
|
132446
132207
|
return CompletionSource2;
|
|
132447
132208
|
})(CompletionSource || {});
|
|
132448
132209
|
SymbolOriginInfoKind = /* @__PURE__ */ ((SymbolOriginInfoKind2) => {
|
|
@@ -148648,7 +148409,6 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
148648
148409
|
canHaveModifiers: () => canHaveModifiers,
|
|
148649
148410
|
canJsonReportNoInputFiles: () => canJsonReportNoInputFiles,
|
|
148650
148411
|
canProduceDiagnostics: () => canProduceDiagnostics,
|
|
148651
|
-
canUsePropertyAccess: () => canUsePropertyAccess,
|
|
148652
148412
|
canWatchDirectoryOrFile: () => canWatchDirectoryOrFile,
|
|
148653
148413
|
cartesianProduct: () => cartesianProduct,
|
|
148654
148414
|
cast: () => cast,
|
|
@@ -150324,7 +150084,6 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
150324
150084
|
isUnparsedSource: () => isUnparsedSource,
|
|
150325
150085
|
isUnparsedTextLike: () => isUnparsedTextLike,
|
|
150326
150086
|
isUrl: () => isUrl,
|
|
150327
|
-
isValidBigIntString: () => isValidBigIntString,
|
|
150328
150087
|
isValidESSymbolDeclaration: () => isValidESSymbolDeclaration,
|
|
150329
150088
|
isValidTypeOnlyAliasUseSite: () => isValidTypeOnlyAliasUseSite,
|
|
150330
150089
|
isValueSignatureDeclaration: () => isValueSignatureDeclaration,
|
|
@@ -150456,7 +150215,6 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
150456
150215
|
parameterIsThisKeyword: () => parameterIsThisKeyword,
|
|
150457
150216
|
parameterNamePart: () => parameterNamePart,
|
|
150458
150217
|
parseBaseNodeFactory: () => parseBaseNodeFactory,
|
|
150459
|
-
parseBigInt: () => parseBigInt,
|
|
150460
150218
|
parseBuildCommand: () => parseBuildCommand,
|
|
150461
150219
|
parseCommandLine: () => parseCommandLine,
|
|
150462
150220
|
parseCommandLineWorker: () => parseCommandLineWorker,
|
|
@@ -150475,7 +150233,6 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
150475
150233
|
parseNodeModuleFromPath: () => parseNodeModuleFromPath,
|
|
150476
150234
|
parsePackageName: () => parsePackageName,
|
|
150477
150235
|
parsePseudoBigInt: () => parsePseudoBigInt,
|
|
150478
|
-
parseValidBigInt: () => parseValidBigInt,
|
|
150479
150236
|
patchWriteFileEnsuringDirectory: () => patchWriteFileEnsuringDirectory,
|
|
150480
150237
|
pathContainsNodeModules: () => pathContainsNodeModules,
|
|
150481
150238
|
pathIsAbsolute: () => pathIsAbsolute,
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@typescript-deploys/pr-build",
|
|
3
3
|
"author": "Microsoft Corp.",
|
|
4
4
|
"homepage": "https://www.typescriptlang.org/",
|
|
5
|
-
"version": "5.0.0-pr-
|
|
5
|
+
"version": "5.0.0-pr-51492-2",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"description": "TypeScript is a language for application scale JavaScript development",
|
|
8
8
|
"keywords": [
|