typescript 5.1.0-dev.20230509 → 5.1.0-dev.20230511
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 +227 -116
- package/lib/tsserver.js +241 -126
- package/lib/tsserverlibrary.d.ts +4 -4
- package/lib/tsserverlibrary.js +240 -126
- package/lib/typescript.d.ts +4 -4
- package/lib/typescript.js +239 -126
- package/lib/typingsInstaller.js +18 -6
- package/package.json +5 -5
package/lib/tsserverlibrary.js
CHANGED
|
@@ -35,7 +35,7 @@ var ts = (() => {
|
|
|
35
35
|
"src/compiler/corePublic.ts"() {
|
|
36
36
|
"use strict";
|
|
37
37
|
versionMajorMinor = "5.1";
|
|
38
|
-
version = `${versionMajorMinor}.0-dev.
|
|
38
|
+
version = `${versionMajorMinor}.0-dev.20230511`;
|
|
39
39
|
Comparison = /* @__PURE__ */ ((Comparison3) => {
|
|
40
40
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
|
41
41
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
|
@@ -12387,7 +12387,6 @@ ${lanes.join("\n")}
|
|
|
12387
12387
|
case 283 /* JsxElement */:
|
|
12388
12388
|
case 284 /* JsxSelfClosingElement */:
|
|
12389
12389
|
case 287 /* JsxFragment */:
|
|
12390
|
-
case 294 /* JsxNamespacedName */:
|
|
12391
12390
|
case 214 /* TaggedTemplateExpression */:
|
|
12392
12391
|
case 208 /* ArrayLiteralExpression */:
|
|
12393
12392
|
case 216 /* ParenthesizedExpression */:
|
|
@@ -12951,7 +12950,39 @@ ${lanes.join("\n")}
|
|
|
12951
12950
|
return oldRef.path === newRef.path && !oldRef.prepend === !newRef.prepend && !oldRef.circular === !newRef.circular;
|
|
12952
12951
|
}
|
|
12953
12952
|
function moduleResolutionIsEqualTo(oldResolution, newResolution) {
|
|
12954
|
-
return oldResolution === newResolution || oldResolution.resolvedModule === newResolution.resolvedModule || !!oldResolution.resolvedModule && !!newResolution.resolvedModule && oldResolution.resolvedModule.isExternalLibraryImport === newResolution.resolvedModule.isExternalLibraryImport && oldResolution.resolvedModule.extension === newResolution.resolvedModule.extension && oldResolution.resolvedModule.resolvedFileName === newResolution.resolvedModule.resolvedFileName && oldResolution.resolvedModule.originalPath === newResolution.resolvedModule.originalPath && packageIdIsEqual(oldResolution.resolvedModule.packageId, newResolution.resolvedModule.packageId);
|
|
12953
|
+
return oldResolution === newResolution || oldResolution.resolvedModule === newResolution.resolvedModule || !!oldResolution.resolvedModule && !!newResolution.resolvedModule && oldResolution.resolvedModule.isExternalLibraryImport === newResolution.resolvedModule.isExternalLibraryImport && oldResolution.resolvedModule.extension === newResolution.resolvedModule.extension && oldResolution.resolvedModule.resolvedFileName === newResolution.resolvedModule.resolvedFileName && oldResolution.resolvedModule.originalPath === newResolution.resolvedModule.originalPath && packageIdIsEqual(oldResolution.resolvedModule.packageId, newResolution.resolvedModule.packageId) && oldResolution.node10Result === newResolution.node10Result;
|
|
12954
|
+
}
|
|
12955
|
+
function createModuleNotFoundChain(sourceFile, host, moduleReference, mode, packageName) {
|
|
12956
|
+
var _a, _b;
|
|
12957
|
+
const node10Result = (_b = (_a = sourceFile.resolvedModules) == null ? void 0 : _a.get(moduleReference, mode)) == null ? void 0 : _b.node10Result;
|
|
12958
|
+
const result = node10Result ? chainDiagnosticMessages(
|
|
12959
|
+
/*details*/
|
|
12960
|
+
void 0,
|
|
12961
|
+
Diagnostics.There_are_types_at_0_but_this_result_could_not_be_resolved_when_respecting_package_json_exports_The_1_library_may_need_to_update_its_package_json_or_typings,
|
|
12962
|
+
node10Result,
|
|
12963
|
+
node10Result.indexOf(nodeModulesPathPart + "@types/") > -1 ? `@types/${mangleScopedPackageName(packageName)}` : packageName
|
|
12964
|
+
) : host.typesPackageExists(packageName) ? chainDiagnosticMessages(
|
|
12965
|
+
/*details*/
|
|
12966
|
+
void 0,
|
|
12967
|
+
Diagnostics.If_the_0_package_actually_exposes_this_module_consider_sending_a_pull_request_to_amend_https_Colon_Slash_Slashgithub_com_SlashDefinitelyTyped_SlashDefinitelyTyped_Slashtree_Slashmaster_Slashtypes_Slash_1,
|
|
12968
|
+
packageName,
|
|
12969
|
+
mangleScopedPackageName(packageName)
|
|
12970
|
+
) : host.packageBundlesTypes(packageName) ? chainDiagnosticMessages(
|
|
12971
|
+
/*details*/
|
|
12972
|
+
void 0,
|
|
12973
|
+
Diagnostics.If_the_0_package_actually_exposes_this_module_try_adding_a_new_declaration_d_ts_file_containing_declare_module_1,
|
|
12974
|
+
packageName,
|
|
12975
|
+
moduleReference
|
|
12976
|
+
) : chainDiagnosticMessages(
|
|
12977
|
+
/*details*/
|
|
12978
|
+
void 0,
|
|
12979
|
+
Diagnostics.Try_npm_i_save_dev_types_Slash_1_if_it_exists_or_add_a_new_declaration_d_ts_file_containing_declare_module_0,
|
|
12980
|
+
moduleReference,
|
|
12981
|
+
mangleScopedPackageName(packageName)
|
|
12982
|
+
);
|
|
12983
|
+
if (result)
|
|
12984
|
+
result.repopulateInfo = () => ({ moduleReference, mode, packageName: packageName === moduleReference ? void 0 : packageName });
|
|
12985
|
+
return result;
|
|
12955
12986
|
}
|
|
12956
12987
|
function packageIdIsEqual(a, b) {
|
|
12957
12988
|
return a === b || !!a && !!b && a.name === b.name && a.subModuleName === b.subModuleName && a.version === b.version;
|
|
@@ -13898,6 +13929,8 @@ ${lanes.join("\n")}
|
|
|
13898
13929
|
if (isStringOrNumericLiteralLike(name.expression))
|
|
13899
13930
|
return escapeLeadingUnderscores(name.expression.text);
|
|
13900
13931
|
return void 0;
|
|
13932
|
+
case 294 /* JsxNamespacedName */:
|
|
13933
|
+
return getEscapedTextOfJsxNamespacedName(name);
|
|
13901
13934
|
default:
|
|
13902
13935
|
return Debug.assertNever(name);
|
|
13903
13936
|
}
|
|
@@ -15863,6 +15896,8 @@ ${lanes.join("\n")}
|
|
|
15863
15896
|
return nameExpression.operand.text;
|
|
15864
15897
|
}
|
|
15865
15898
|
return void 0;
|
|
15899
|
+
case 294 /* JsxNamespacedName */:
|
|
15900
|
+
return getEscapedTextOfJsxNamespacedName(name);
|
|
15866
15901
|
default:
|
|
15867
15902
|
return Debug.assertNever(name);
|
|
15868
15903
|
}
|
|
@@ -15879,10 +15914,10 @@ ${lanes.join("\n")}
|
|
|
15879
15914
|
}
|
|
15880
15915
|
}
|
|
15881
15916
|
function getTextOfIdentifierOrLiteral(node) {
|
|
15882
|
-
return isMemberName(node) ? idText(node) : node.text;
|
|
15917
|
+
return isMemberName(node) ? idText(node) : isJsxNamespacedName(node) ? getTextOfJsxNamespacedName(node) : node.text;
|
|
15883
15918
|
}
|
|
15884
15919
|
function getEscapedTextOfIdentifierOrLiteral(node) {
|
|
15885
|
-
return isMemberName(node) ? node.escapedText : escapeLeadingUnderscores(node.text);
|
|
15920
|
+
return isMemberName(node) ? node.escapedText : isJsxNamespacedName(node) ? getEscapedTextOfJsxNamespacedName(node) : escapeLeadingUnderscores(node.text);
|
|
15886
15921
|
}
|
|
15887
15922
|
function getPropertyNameForUniqueESSymbol(symbol) {
|
|
15888
15923
|
return `__@${getSymbolId(symbol)}@${symbol.escapedName}`;
|
|
@@ -17112,6 +17147,8 @@ ${lanes.join("\n")}
|
|
|
17112
17147
|
}
|
|
17113
17148
|
} else if (isIdentifier(expr)) {
|
|
17114
17149
|
return unescapeLeadingUnderscores(expr.escapedText);
|
|
17150
|
+
} else if (isJsxNamespacedName(expr)) {
|
|
17151
|
+
return getTextOfJsxNamespacedName(expr);
|
|
17115
17152
|
}
|
|
17116
17153
|
return void 0;
|
|
17117
17154
|
}
|
|
@@ -32063,7 +32100,11 @@ ${lanes.join("\n")}
|
|
|
32063
32100
|
}
|
|
32064
32101
|
function parseJsxElementName() {
|
|
32065
32102
|
const pos = getNodePos();
|
|
32066
|
-
|
|
32103
|
+
const initialExpression = parseJsxTagName();
|
|
32104
|
+
if (isJsxNamespacedName(initialExpression)) {
|
|
32105
|
+
return initialExpression;
|
|
32106
|
+
}
|
|
32107
|
+
let expression = initialExpression;
|
|
32067
32108
|
while (parseOptional(25 /* DotToken */)) {
|
|
32068
32109
|
expression = finishNode(factoryCreatePropertyAccessExpression(expression, parseRightSideOfDot(
|
|
32069
32110
|
/*allowIdentifierNames*/
|
|
@@ -39889,8 +39930,6 @@ ${lanes.join("\n")}
|
|
|
39889
39930
|
const diagnosticState = {
|
|
39890
39931
|
...state,
|
|
39891
39932
|
features: state.features & ~8 /* Exports */,
|
|
39892
|
-
failedLookupLocations: [],
|
|
39893
|
-
affectingLocations: [],
|
|
39894
39933
|
reportDiagnostic: noop
|
|
39895
39934
|
};
|
|
39896
39935
|
const diagnosticResult = tryResolve(extensions & (1 /* TypeScript */ | 4 /* Declaration */), diagnosticState);
|
|
@@ -44918,7 +44957,10 @@ ${lanes.join("\n")}
|
|
|
44918
44957
|
const mainFileRelative = packageJsonContent.typings || packageJsonContent.types || packageJsonContent.main || "index.js";
|
|
44919
44958
|
if (isString(mainFileRelative) && !(maybeBlockedByTypesVersions && matchPatternOrExact(tryParsePatterns(versionPaths.paths), mainFileRelative))) {
|
|
44920
44959
|
const mainExportFile = toPath(mainFileRelative, packageRootPath, getCanonicalFileName);
|
|
44921
|
-
|
|
44960
|
+
const canonicalModuleFileToTry = getCanonicalFileName(moduleFileToTry);
|
|
44961
|
+
if (removeFileExtension(mainExportFile) === removeFileExtension(canonicalModuleFileToTry)) {
|
|
44962
|
+
return { packageRootPath, moduleFileToTry };
|
|
44963
|
+
} else if (packageJsonContent.type !== "module" && !fileExtensionIsOneOf(canonicalModuleFileToTry, extensionsNotSupportingExtensionlessResolution) && startsWith(canonicalModuleFileToTry, mainExportFile) && getDirectoryPath(canonicalModuleFileToTry) === removeTrailingDirectorySeparator(mainExportFile) && removeFileExtension(getBaseFileName(canonicalModuleFileToTry)) === "index") {
|
|
44922
44964
|
return { packageRootPath, moduleFileToTry };
|
|
44923
44965
|
}
|
|
44924
44966
|
}
|
|
@@ -45086,18 +45128,6 @@ ${lanes.join("\n")}
|
|
|
45086
45128
|
return moduleState === 1 /* Instantiated */ || preserveConstEnums && moduleState === 2 /* ConstEnumOnly */;
|
|
45087
45129
|
}
|
|
45088
45130
|
function createTypeChecker(host) {
|
|
45089
|
-
var getPackagesMap = memoize(() => {
|
|
45090
|
-
var map2 = /* @__PURE__ */ new Map();
|
|
45091
|
-
host.getSourceFiles().forEach((sf) => {
|
|
45092
|
-
if (!sf.resolvedModules)
|
|
45093
|
-
return;
|
|
45094
|
-
sf.resolvedModules.forEach(({ resolvedModule }) => {
|
|
45095
|
-
if (resolvedModule == null ? void 0 : resolvedModule.packageId)
|
|
45096
|
-
map2.set(resolvedModule.packageId.name, resolvedModule.extension === ".d.ts" /* Dts */ || !!map2.get(resolvedModule.packageId.name));
|
|
45097
|
-
});
|
|
45098
|
-
});
|
|
45099
|
-
return map2;
|
|
45100
|
-
});
|
|
45101
45131
|
var deferredDiagnosticsCallbacks = [];
|
|
45102
45132
|
var addLazyDiagnostic = (arg) => {
|
|
45103
45133
|
deferredDiagnosticsCallbacks.push(arg);
|
|
@@ -46880,7 +46910,7 @@ ${lanes.join("\n")}
|
|
|
46880
46910
|
if (!result) {
|
|
46881
46911
|
if (nameNotFoundMessage) {
|
|
46882
46912
|
addLazyDiagnostic(() => {
|
|
46883
|
-
if (!errorLocation || !checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) && // TODO: GH#18217
|
|
46913
|
+
if (!errorLocation || errorLocation.parent.kind !== 330 /* JSDocLink */ && !checkAndReportErrorForMissingPrefix(errorLocation, name, nameArg) && // TODO: GH#18217
|
|
46884
46914
|
!checkAndReportErrorForInvalidInitializer() && !checkAndReportErrorForExtendingInterface(errorLocation) && !checkAndReportErrorForUsingTypeAsNamespace(errorLocation, name, meaning) && !checkAndReportErrorForExportingPrimitiveType(errorLocation, name) && !checkAndReportErrorForUsingNamespaceAsTypeOrValue(errorLocation, name, meaning) && !checkAndReportErrorForUsingTypeAsValue(errorLocation, name, meaning) && !checkAndReportErrorForUsingValueAsType(errorLocation, name, meaning)) {
|
|
46885
46915
|
let suggestion;
|
|
46886
46916
|
let suggestedLib;
|
|
@@ -48433,35 +48463,9 @@ ${lanes.join("\n")}
|
|
|
48433
48463
|
}
|
|
48434
48464
|
}
|
|
48435
48465
|
function errorOnImplicitAnyModule(isError, errorNode, sourceFile, mode, { packageId, resolvedFileName }, moduleReference) {
|
|
48436
|
-
var _a, _b;
|
|
48437
48466
|
let errorInfo;
|
|
48438
48467
|
if (!isExternalModuleNameRelative(moduleReference) && packageId) {
|
|
48439
|
-
|
|
48440
|
-
errorInfo = node10Result ? chainDiagnosticMessages(
|
|
48441
|
-
/*details*/
|
|
48442
|
-
void 0,
|
|
48443
|
-
Diagnostics.There_are_types_at_0_but_this_result_could_not_be_resolved_when_respecting_package_json_exports_The_1_library_may_need_to_update_its_package_json_or_typings,
|
|
48444
|
-
node10Result,
|
|
48445
|
-
node10Result.indexOf(nodeModulesPathPart + "@types/") > -1 ? `@types/${mangleScopedPackageName(packageId.name)}` : packageId.name
|
|
48446
|
-
) : typesPackageExists(packageId.name) ? chainDiagnosticMessages(
|
|
48447
|
-
/*details*/
|
|
48448
|
-
void 0,
|
|
48449
|
-
Diagnostics.If_the_0_package_actually_exposes_this_module_consider_sending_a_pull_request_to_amend_https_Colon_Slash_Slashgithub_com_SlashDefinitelyTyped_SlashDefinitelyTyped_Slashtree_Slashmaster_Slashtypes_Slash_1,
|
|
48450
|
-
packageId.name,
|
|
48451
|
-
mangleScopedPackageName(packageId.name)
|
|
48452
|
-
) : packageBundlesTypes(packageId.name) ? chainDiagnosticMessages(
|
|
48453
|
-
/*details*/
|
|
48454
|
-
void 0,
|
|
48455
|
-
Diagnostics.If_the_0_package_actually_exposes_this_module_try_adding_a_new_declaration_d_ts_file_containing_declare_module_1,
|
|
48456
|
-
packageId.name,
|
|
48457
|
-
moduleReference
|
|
48458
|
-
) : chainDiagnosticMessages(
|
|
48459
|
-
/*details*/
|
|
48460
|
-
void 0,
|
|
48461
|
-
Diagnostics.Try_npm_i_save_dev_types_Slash_1_if_it_exists_or_add_a_new_declaration_d_ts_file_containing_declare_module_0,
|
|
48462
|
-
moduleReference,
|
|
48463
|
-
mangleScopedPackageName(packageId.name)
|
|
48464
|
-
);
|
|
48468
|
+
errorInfo = createModuleNotFoundChain(sourceFile, host, moduleReference, mode, packageId.name);
|
|
48465
48469
|
}
|
|
48466
48470
|
errorOrSuggestion(isError, errorNode, chainDiagnosticMessages(
|
|
48467
48471
|
errorInfo,
|
|
@@ -48470,12 +48474,6 @@ ${lanes.join("\n")}
|
|
|
48470
48474
|
resolvedFileName
|
|
48471
48475
|
));
|
|
48472
48476
|
}
|
|
48473
|
-
function typesPackageExists(packageName) {
|
|
48474
|
-
return getPackagesMap().has(getTypesPackageName(packageName));
|
|
48475
|
-
}
|
|
48476
|
-
function packageBundlesTypes(packageName) {
|
|
48477
|
-
return !!getPackagesMap().get(packageName);
|
|
48478
|
-
}
|
|
48479
48477
|
function resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) {
|
|
48480
48478
|
if (moduleSymbol == null ? void 0 : moduleSymbol.exports) {
|
|
48481
48479
|
const exportEquals = resolveSymbol(moduleSymbol.exports.get("export=" /* ExportEquals */), dontResolveAlias);
|
|
@@ -58986,7 +58984,20 @@ ${lanes.join("\n")}
|
|
|
58986
58984
|
if (isPrivateIdentifier(name)) {
|
|
58987
58985
|
return neverType;
|
|
58988
58986
|
}
|
|
58989
|
-
|
|
58987
|
+
if (isNumericLiteral(name)) {
|
|
58988
|
+
return getRegularTypeOfLiteralType(checkExpression(name));
|
|
58989
|
+
}
|
|
58990
|
+
if (isComputedPropertyName(name)) {
|
|
58991
|
+
return getRegularTypeOfLiteralType(checkComputedPropertyName(name));
|
|
58992
|
+
}
|
|
58993
|
+
const propertyName = getPropertyNameForPropertyNameNode(name);
|
|
58994
|
+
if (propertyName !== void 0) {
|
|
58995
|
+
return getStringLiteralType(unescapeLeadingUnderscores(propertyName));
|
|
58996
|
+
}
|
|
58997
|
+
if (isExpression(name)) {
|
|
58998
|
+
return getRegularTypeOfLiteralType(checkExpression(name));
|
|
58999
|
+
}
|
|
59000
|
+
return neverType;
|
|
58990
59001
|
}
|
|
58991
59002
|
function getLiteralTypeFromProperty(prop, include, includeNonPublic) {
|
|
58992
59003
|
if (includeNonPublic || !(getDeclarationModifierFlagsFromSymbol(prop) & 24 /* NonPublicAccessibilityModifier */)) {
|
|
@@ -72116,7 +72127,7 @@ ${lanes.join("\n")}
|
|
|
72116
72127
|
if (getJsxNamespaceContainerForImplicitImport(node)) {
|
|
72117
72128
|
return true;
|
|
72118
72129
|
}
|
|
72119
|
-
const tagType = isJsxOpeningElement(node) || isJsxSelfClosingElement(node) && !isJsxIntrinsicTagName(node.tagName) ? checkExpression(node.tagName) : void 0;
|
|
72130
|
+
const tagType = (isJsxOpeningElement(node) || isJsxSelfClosingElement(node)) && !(isJsxIntrinsicTagName(node.tagName) || isJsxNamespacedName(node.tagName)) ? checkExpression(node.tagName) : void 0;
|
|
72120
72131
|
if (!tagType) {
|
|
72121
72132
|
return true;
|
|
72122
72133
|
}
|
|
@@ -82698,7 +82709,7 @@ ${lanes.join("\n")}
|
|
|
82698
82709
|
name,
|
|
82699
82710
|
meaning,
|
|
82700
82711
|
/*ignoreErrors*/
|
|
82701
|
-
|
|
82712
|
+
true,
|
|
82702
82713
|
/*dontResolveAlias*/
|
|
82703
82714
|
true,
|
|
82704
82715
|
getHostSignatureFromJSDoc(name)
|
|
@@ -82709,7 +82720,7 @@ ${lanes.join("\n")}
|
|
|
82709
82720
|
return resolveJSDocMemberName(
|
|
82710
82721
|
name,
|
|
82711
82722
|
/*ignoreErrors*/
|
|
82712
|
-
|
|
82723
|
+
true,
|
|
82713
82724
|
getSymbolOfDeclaration(container)
|
|
82714
82725
|
);
|
|
82715
82726
|
}
|
|
@@ -111280,6 +111291,8 @@ ${lanes.join("\n")}
|
|
|
111280
111291
|
return emitJsxSpreadAttribute(node);
|
|
111281
111292
|
case 293 /* JsxExpression */:
|
|
111282
111293
|
return emitJsxExpression(node);
|
|
111294
|
+
case 294 /* JsxNamespacedName */:
|
|
111295
|
+
return emitJsxNamespacedName(node);
|
|
111283
111296
|
case 295 /* CaseClause */:
|
|
111284
111297
|
return emitCaseClause(node);
|
|
111285
111298
|
case 296 /* DefaultClause */:
|
|
@@ -111475,8 +111488,6 @@ ${lanes.join("\n")}
|
|
|
111475
111488
|
return emitJsxSelfClosingElement(node);
|
|
111476
111489
|
case 287 /* JsxFragment */:
|
|
111477
111490
|
return emitJsxFragment(node);
|
|
111478
|
-
case 294 /* JsxNamespacedName */:
|
|
111479
|
-
return emitJsxNamespacedName(node);
|
|
111480
111491
|
case 357 /* SyntaxList */:
|
|
111481
111492
|
return Debug.fail("SyntaxList should not be printed");
|
|
111482
111493
|
case 358 /* NotEmittedStatement */:
|
|
@@ -114308,6 +114319,10 @@ ${lanes.join("\n")}
|
|
|
114308
114319
|
if (!canUseSourceFile || getSourceFileOfNode(node) !== getOriginalNode(sourceFile)) {
|
|
114309
114320
|
return idText(node);
|
|
114310
114321
|
}
|
|
114322
|
+
} else if (isJsxNamespacedName(node)) {
|
|
114323
|
+
if (!canUseSourceFile || getSourceFileOfNode(node) !== getOriginalNode(sourceFile)) {
|
|
114324
|
+
return getTextOfJsxNamespacedName(node);
|
|
114325
|
+
}
|
|
114311
114326
|
} else {
|
|
114312
114327
|
Debug.assertNode(node, isLiteralExpression);
|
|
114313
114328
|
if (!canUseSourceFile) {
|
|
@@ -114319,7 +114334,7 @@ ${lanes.join("\n")}
|
|
|
114319
114334
|
function getLiteralTextOfNode(node, neverAsciiEscape, jsxAttributeEscape) {
|
|
114320
114335
|
if (node.kind === 11 /* StringLiteral */ && node.textSourceNode) {
|
|
114321
114336
|
const textSourceNode = node.textSourceNode;
|
|
114322
|
-
if (isIdentifier(textSourceNode) || isPrivateIdentifier(textSourceNode) || isNumericLiteral(textSourceNode)) {
|
|
114337
|
+
if (isIdentifier(textSourceNode) || isPrivateIdentifier(textSourceNode) || isNumericLiteral(textSourceNode) || isJsxNamespacedName(textSourceNode)) {
|
|
114323
114338
|
const text = isNumericLiteral(textSourceNode) ? textSourceNode.text : getTextOfNode2(textSourceNode);
|
|
114324
114339
|
return jsxAttributeEscape ? `"${escapeJsxAttributeString(text)}"` : neverAsciiEscape || getEmitFlags(node) & 16777216 /* NoAsciiEscaping */ ? `"${escapeString(text)}"` : `"${escapeNonAsciiString(text)}"`;
|
|
114325
114340
|
} else {
|
|
@@ -116529,6 +116544,7 @@ ${lanes.join("\n")}
|
|
|
116529
116544
|
let automaticTypeDirectiveResolutions;
|
|
116530
116545
|
let resolvedLibReferences;
|
|
116531
116546
|
let resolvedLibProcessing;
|
|
116547
|
+
let packageMap;
|
|
116532
116548
|
const maxNodeModuleJsDepth = typeof options.maxNodeModuleJsDepth === "number" ? options.maxNodeModuleJsDepth : 0;
|
|
116533
116549
|
let currentNodeModulesDepth = 0;
|
|
116534
116550
|
const modulesWithElidedImports = /* @__PURE__ */ new Map();
|
|
@@ -116833,6 +116849,9 @@ ${lanes.join("\n")}
|
|
|
116833
116849
|
redirectTargetsMap,
|
|
116834
116850
|
usesUriStyleNodeCoreModules,
|
|
116835
116851
|
resolvedLibReferences,
|
|
116852
|
+
getCurrentPackagesMap: () => packageMap,
|
|
116853
|
+
typesPackageExists,
|
|
116854
|
+
packageBundlesTypes,
|
|
116836
116855
|
isEmittedFile,
|
|
116837
116856
|
getConfigFileParsingDiagnostics: getConfigFileParsingDiagnostics2,
|
|
116838
116857
|
getProjectReferences,
|
|
@@ -116873,6 +116892,26 @@ ${lanes.join("\n")}
|
|
|
116873
116892
|
measure("Program", "beforeProgram", "afterProgram");
|
|
116874
116893
|
(_p = tracing) == null ? void 0 : _p.pop();
|
|
116875
116894
|
return program;
|
|
116895
|
+
function getPackagesMap() {
|
|
116896
|
+
if (packageMap)
|
|
116897
|
+
return packageMap;
|
|
116898
|
+
packageMap = /* @__PURE__ */ new Map();
|
|
116899
|
+
files.forEach((sf) => {
|
|
116900
|
+
if (!sf.resolvedModules)
|
|
116901
|
+
return;
|
|
116902
|
+
sf.resolvedModules.forEach(({ resolvedModule }) => {
|
|
116903
|
+
if (resolvedModule == null ? void 0 : resolvedModule.packageId)
|
|
116904
|
+
packageMap.set(resolvedModule.packageId.name, resolvedModule.extension === ".d.ts" /* Dts */ || !!packageMap.get(resolvedModule.packageId.name));
|
|
116905
|
+
});
|
|
116906
|
+
});
|
|
116907
|
+
return packageMap;
|
|
116908
|
+
}
|
|
116909
|
+
function typesPackageExists(packageName) {
|
|
116910
|
+
return getPackagesMap().has(getTypesPackageName(packageName));
|
|
116911
|
+
}
|
|
116912
|
+
function packageBundlesTypes(packageName) {
|
|
116913
|
+
return !!getPackagesMap().get(packageName);
|
|
116914
|
+
}
|
|
116876
116915
|
function addResolutionDiagnostics(resolution) {
|
|
116877
116916
|
var _a2;
|
|
116878
116917
|
if (!((_a2 = resolution.resolutionDiagnostics) == null ? void 0 : _a2.length))
|
|
@@ -117361,6 +117400,7 @@ ${lanes.join("\n")}
|
|
|
117361
117400
|
redirectTargetsMap = oldProgram.redirectTargetsMap;
|
|
117362
117401
|
usesUriStyleNodeCoreModules = oldProgram.usesUriStyleNodeCoreModules;
|
|
117363
117402
|
resolvedLibReferences = oldProgram.resolvedLibReferences;
|
|
117403
|
+
packageMap = oldProgram.getCurrentPackagesMap();
|
|
117364
117404
|
return 2 /* Completely */;
|
|
117365
117405
|
}
|
|
117366
117406
|
function getEmitHost(writeFileCallback) {
|
|
@@ -120366,7 +120406,10 @@ ${lanes.join("\n")}
|
|
|
120366
120406
|
return;
|
|
120367
120407
|
const diagnostics = oldState.semanticDiagnosticsPerFile.get(sourceFilePath);
|
|
120368
120408
|
if (diagnostics) {
|
|
120369
|
-
state.semanticDiagnosticsPerFile.set(
|
|
120409
|
+
state.semanticDiagnosticsPerFile.set(
|
|
120410
|
+
sourceFilePath,
|
|
120411
|
+
oldState.hasReusableDiagnostic ? convertToDiagnostics(diagnostics, newProgram) : repopulateDiagnostics(diagnostics, newProgram)
|
|
120412
|
+
);
|
|
120370
120413
|
if (!state.semanticDiagnosticsFromOldState) {
|
|
120371
120414
|
state.semanticDiagnosticsFromOldState = /* @__PURE__ */ new Set();
|
|
120372
120415
|
}
|
|
@@ -120437,6 +120480,33 @@ ${lanes.join("\n")}
|
|
|
120437
120480
|
isString(oldEmitSignature) ? [oldEmitSignature] : oldEmitSignature[0]
|
|
120438
120481
|
);
|
|
120439
120482
|
}
|
|
120483
|
+
function repopulateDiagnostics(diagnostics, newProgram) {
|
|
120484
|
+
if (!diagnostics.length)
|
|
120485
|
+
return diagnostics;
|
|
120486
|
+
return sameMap(diagnostics, (diag2) => {
|
|
120487
|
+
if (isString(diag2.messageText))
|
|
120488
|
+
return diag2;
|
|
120489
|
+
const repopulatedChain = convertOrRepopulateDiagnosticMessageChain(diag2.messageText, diag2.file, newProgram, (chain) => {
|
|
120490
|
+
var _a;
|
|
120491
|
+
return (_a = chain.repopulateInfo) == null ? void 0 : _a.call(chain);
|
|
120492
|
+
});
|
|
120493
|
+
return repopulatedChain === diag2.messageText ? diag2 : { ...diag2, messageText: repopulatedChain };
|
|
120494
|
+
});
|
|
120495
|
+
}
|
|
120496
|
+
function convertOrRepopulateDiagnosticMessageChain(chain, sourceFile, newProgram, repopulateInfo) {
|
|
120497
|
+
const info = repopulateInfo(chain);
|
|
120498
|
+
if (info) {
|
|
120499
|
+
return {
|
|
120500
|
+
...createModuleNotFoundChain(sourceFile, newProgram, info.moduleReference, info.mode, info.packageName || info.moduleReference),
|
|
120501
|
+
next: convertOrRepopulateDiagnosticMessageChainArray(chain.next, sourceFile, newProgram, repopulateInfo)
|
|
120502
|
+
};
|
|
120503
|
+
}
|
|
120504
|
+
const next = convertOrRepopulateDiagnosticMessageChainArray(chain.next, sourceFile, newProgram, repopulateInfo);
|
|
120505
|
+
return next === chain.next ? chain : { ...chain, next };
|
|
120506
|
+
}
|
|
120507
|
+
function convertOrRepopulateDiagnosticMessageChainArray(array, sourceFile, newProgram, repopulateInfo) {
|
|
120508
|
+
return sameMap(array, (chain) => convertOrRepopulateDiagnosticMessageChain(chain, sourceFile, newProgram, repopulateInfo));
|
|
120509
|
+
}
|
|
120440
120510
|
function convertToDiagnostics(diagnostics, newProgram) {
|
|
120441
120511
|
if (!diagnostics.length)
|
|
120442
120512
|
return emptyArray;
|
|
@@ -120458,9 +120528,11 @@ ${lanes.join("\n")}
|
|
|
120458
120528
|
}
|
|
120459
120529
|
function convertToDiagnosticRelatedInformation(diagnostic, newProgram, toPath3) {
|
|
120460
120530
|
const { file } = diagnostic;
|
|
120531
|
+
const sourceFile = file ? newProgram.getSourceFileByPath(toPath3(file)) : void 0;
|
|
120461
120532
|
return {
|
|
120462
120533
|
...diagnostic,
|
|
120463
|
-
file:
|
|
120534
|
+
file: sourceFile,
|
|
120535
|
+
messageText: isString(diagnostic.messageText) ? diagnostic.messageText : convertOrRepopulateDiagnosticMessageChain(diagnostic.messageText, sourceFile, newProgram, (chain) => chain.info)
|
|
120464
120536
|
};
|
|
120465
120537
|
}
|
|
120466
120538
|
function releaseCache(state) {
|
|
@@ -121002,9 +121074,35 @@ ${lanes.join("\n")}
|
|
|
121002
121074
|
const { file } = diagnostic;
|
|
121003
121075
|
return {
|
|
121004
121076
|
...diagnostic,
|
|
121005
|
-
file: file ? relativeToBuildInfo(file.resolvedPath) : void 0
|
|
121077
|
+
file: file ? relativeToBuildInfo(file.resolvedPath) : void 0,
|
|
121078
|
+
messageText: isString(diagnostic.messageText) ? diagnostic.messageText : convertToReusableDiagnosticMessageChain(diagnostic.messageText)
|
|
121006
121079
|
};
|
|
121007
121080
|
}
|
|
121081
|
+
function convertToReusableDiagnosticMessageChain(chain) {
|
|
121082
|
+
if (chain.repopulateInfo) {
|
|
121083
|
+
return {
|
|
121084
|
+
info: chain.repopulateInfo(),
|
|
121085
|
+
next: convertToReusableDiagnosticMessageChainArray(chain.next)
|
|
121086
|
+
};
|
|
121087
|
+
}
|
|
121088
|
+
const next = convertToReusableDiagnosticMessageChainArray(chain.next);
|
|
121089
|
+
return next === chain.next ? chain : { ...chain, next };
|
|
121090
|
+
}
|
|
121091
|
+
function convertToReusableDiagnosticMessageChainArray(array) {
|
|
121092
|
+
if (!array)
|
|
121093
|
+
return array;
|
|
121094
|
+
return forEach(array, (chain, index) => {
|
|
121095
|
+
const reusable = convertToReusableDiagnosticMessageChain(chain);
|
|
121096
|
+
if (chain === reusable)
|
|
121097
|
+
return void 0;
|
|
121098
|
+
const result = index > 0 ? array.slice(0, index - 1) : [];
|
|
121099
|
+
result.push(reusable);
|
|
121100
|
+
for (let i = index + 1; i < array.length; i++) {
|
|
121101
|
+
result.push(convertToReusableDiagnosticMessageChain(array[i]));
|
|
121102
|
+
}
|
|
121103
|
+
return result;
|
|
121104
|
+
}) || array;
|
|
121105
|
+
}
|
|
121008
121106
|
function getBuilderCreationParameters(newProgramOrRootNames, hostOrOptions, oldProgramOrHost, configFileParsingDiagnosticsOrOldProgram, configFileParsingDiagnostics, projectReferences) {
|
|
121009
121107
|
let host;
|
|
121010
121108
|
let newProgram;
|
|
@@ -122131,45 +122229,51 @@ ${lanes.join("\n")}
|
|
|
122131
122229
|
}
|
|
122132
122230
|
(resolution.files ?? (resolution.files = /* @__PURE__ */ new Set())).add(filePath);
|
|
122133
122231
|
}
|
|
122232
|
+
function watchFailedLookupLocation(failedLookupLocation, setAtRoot) {
|
|
122233
|
+
const failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
|
|
122234
|
+
const toWatch = getDirectoryToWatchFailedLookupLocation(
|
|
122235
|
+
failedLookupLocation,
|
|
122236
|
+
failedLookupLocationPath,
|
|
122237
|
+
rootDir,
|
|
122238
|
+
rootPath,
|
|
122239
|
+
rootPathComponents,
|
|
122240
|
+
getCurrentDirectory
|
|
122241
|
+
);
|
|
122242
|
+
if (toWatch) {
|
|
122243
|
+
const { dir, dirPath, nonRecursive } = toWatch;
|
|
122244
|
+
if (dirPath === rootPath) {
|
|
122245
|
+
Debug.assert(nonRecursive);
|
|
122246
|
+
setAtRoot = true;
|
|
122247
|
+
} else {
|
|
122248
|
+
setDirectoryWatcher(dir, dirPath, nonRecursive);
|
|
122249
|
+
}
|
|
122250
|
+
}
|
|
122251
|
+
return setAtRoot;
|
|
122252
|
+
}
|
|
122134
122253
|
function watchFailedLookupLocationOfResolution(resolution) {
|
|
122135
122254
|
Debug.assert(!!resolution.refCount);
|
|
122136
|
-
const { failedLookupLocations, affectingLocations } = resolution;
|
|
122137
|
-
if (!(failedLookupLocations == null ? void 0 : failedLookupLocations.length) && !(affectingLocations == null ? void 0 : affectingLocations.length))
|
|
122255
|
+
const { failedLookupLocations, affectingLocations, node10Result } = resolution;
|
|
122256
|
+
if (!(failedLookupLocations == null ? void 0 : failedLookupLocations.length) && !(affectingLocations == null ? void 0 : affectingLocations.length) && !node10Result)
|
|
122138
122257
|
return;
|
|
122139
|
-
if (failedLookupLocations == null ? void 0 : failedLookupLocations.length)
|
|
122258
|
+
if ((failedLookupLocations == null ? void 0 : failedLookupLocations.length) || node10Result)
|
|
122140
122259
|
resolutionsWithFailedLookups.add(resolution);
|
|
122141
122260
|
let setAtRoot = false;
|
|
122142
122261
|
if (failedLookupLocations) {
|
|
122143
122262
|
for (const failedLookupLocation of failedLookupLocations) {
|
|
122144
|
-
|
|
122145
|
-
const toWatch = getDirectoryToWatchFailedLookupLocation(
|
|
122146
|
-
failedLookupLocation,
|
|
122147
|
-
failedLookupLocationPath,
|
|
122148
|
-
rootDir,
|
|
122149
|
-
rootPath,
|
|
122150
|
-
rootPathComponents,
|
|
122151
|
-
getCurrentDirectory
|
|
122152
|
-
);
|
|
122153
|
-
if (toWatch) {
|
|
122154
|
-
const { dir, dirPath, nonRecursive } = toWatch;
|
|
122155
|
-
if (dirPath === rootPath) {
|
|
122156
|
-
Debug.assert(nonRecursive);
|
|
122157
|
-
setAtRoot = true;
|
|
122158
|
-
} else {
|
|
122159
|
-
setDirectoryWatcher(dir, dirPath, nonRecursive);
|
|
122160
|
-
}
|
|
122161
|
-
}
|
|
122162
|
-
}
|
|
122163
|
-
if (setAtRoot) {
|
|
122164
|
-
setDirectoryWatcher(
|
|
122165
|
-
rootDir,
|
|
122166
|
-
rootPath,
|
|
122167
|
-
/*nonRecursive*/
|
|
122168
|
-
true
|
|
122169
|
-
);
|
|
122263
|
+
setAtRoot = watchFailedLookupLocation(failedLookupLocation, setAtRoot);
|
|
122170
122264
|
}
|
|
122171
122265
|
}
|
|
122172
|
-
|
|
122266
|
+
if (node10Result)
|
|
122267
|
+
setAtRoot = watchFailedLookupLocation(node10Result, setAtRoot);
|
|
122268
|
+
if (setAtRoot) {
|
|
122269
|
+
setDirectoryWatcher(
|
|
122270
|
+
rootDir,
|
|
122271
|
+
rootPath,
|
|
122272
|
+
/*nonRecursive*/
|
|
122273
|
+
true
|
|
122274
|
+
);
|
|
122275
|
+
}
|
|
122276
|
+
watchAffectingLocationsOfResolution(resolution, !(failedLookupLocations == null ? void 0 : failedLookupLocations.length) && !node10Result);
|
|
122173
122277
|
}
|
|
122174
122278
|
function watchAffectingLocationsOfResolution(resolution, addToResolutionsWithOnlyAffectingLocations) {
|
|
122175
122279
|
Debug.assert(!!resolution.refCount);
|
|
@@ -122263,6 +122367,26 @@ ${lanes.join("\n")}
|
|
|
122263
122367
|
directoryWatchesOfFailedLookups.set(dirPath, { watcher: createDirectoryWatcher(dir, dirPath, nonRecursive), refCount: 1, nonRecursive });
|
|
122264
122368
|
}
|
|
122265
122369
|
}
|
|
122370
|
+
function stopWatchFailedLookupLocation(failedLookupLocation, removeAtRoot) {
|
|
122371
|
+
const failedLookupLocationPath = resolutionHost.toPath(failedLookupLocation);
|
|
122372
|
+
const toWatch = getDirectoryToWatchFailedLookupLocation(
|
|
122373
|
+
failedLookupLocation,
|
|
122374
|
+
failedLookupLocationPath,
|
|
122375
|
+
rootDir,
|
|
122376
|
+
rootPath,
|
|
122377
|
+
rootPathComponents,
|
|
122378
|
+
getCurrentDirectory
|
|
122379
|
+
);
|
|
122380
|
+
if (toWatch) {
|
|
122381
|
+
const { dirPath } = toWatch;
|
|
122382
|
+
if (dirPath === rootPath) {
|
|
122383
|
+
removeAtRoot = true;
|
|
122384
|
+
} else {
|
|
122385
|
+
removeDirectoryWatcher(dirPath);
|
|
122386
|
+
}
|
|
122387
|
+
}
|
|
122388
|
+
return removeAtRoot;
|
|
122389
|
+
}
|
|
122266
122390
|
function stopWatchFailedLookupLocationOfResolution(resolution, filePath, getResolutionWithResolvedFileName) {
|
|
122267
122391
|
Debug.checkDefined(resolution.files).delete(filePath);
|
|
122268
122392
|
resolution.refCount--;
|
|
@@ -122276,31 +122400,18 @@ ${lanes.join("\n")}
|
|
|
122276
122400
|
if ((resolutions == null ? void 0 : resolutions.delete(resolution)) && !resolutions.size)
|
|
122277
122401
|
resolvedFileToResolution.delete(key);
|
|
122278
122402
|
}
|
|
122279
|
-
const { failedLookupLocations, affectingLocations } = resolution;
|
|
122403
|
+
const { failedLookupLocations, affectingLocations, node10Result } = resolution;
|
|
122280
122404
|
if (resolutionsWithFailedLookups.delete(resolution)) {
|
|
122281
122405
|
let removeAtRoot = false;
|
|
122282
|
-
|
|
122283
|
-
const
|
|
122284
|
-
|
|
122285
|
-
failedLookupLocation,
|
|
122286
|
-
failedLookupLocationPath,
|
|
122287
|
-
rootDir,
|
|
122288
|
-
rootPath,
|
|
122289
|
-
rootPathComponents,
|
|
122290
|
-
getCurrentDirectory
|
|
122291
|
-
);
|
|
122292
|
-
if (toWatch) {
|
|
122293
|
-
const { dirPath } = toWatch;
|
|
122294
|
-
if (dirPath === rootPath) {
|
|
122295
|
-
removeAtRoot = true;
|
|
122296
|
-
} else {
|
|
122297
|
-
removeDirectoryWatcher(dirPath);
|
|
122298
|
-
}
|
|
122406
|
+
if (failedLookupLocations) {
|
|
122407
|
+
for (const failedLookupLocation of failedLookupLocations) {
|
|
122408
|
+
removeAtRoot = stopWatchFailedLookupLocation(failedLookupLocation, removeAtRoot);
|
|
122299
122409
|
}
|
|
122300
122410
|
}
|
|
122301
|
-
if (
|
|
122411
|
+
if (node10Result)
|
|
122412
|
+
removeAtRoot = stopWatchFailedLookupLocation(node10Result, removeAtRoot);
|
|
122413
|
+
if (removeAtRoot)
|
|
122302
122414
|
removeDirectoryWatcher(rootPath);
|
|
122303
|
-
}
|
|
122304
122415
|
} else if (affectingLocations == null ? void 0 : affectingLocations.length) {
|
|
122305
122416
|
resolutionsWithOnlyAffectingLocations.delete(resolution);
|
|
122306
122417
|
}
|
|
@@ -122454,7 +122565,7 @@ ${lanes.join("\n")}
|
|
|
122454
122565
|
return true;
|
|
122455
122566
|
if (!failedLookupChecks && !startsWithPathChecks && !isInDirectoryChecks)
|
|
122456
122567
|
return false;
|
|
122457
|
-
return (_a = resolution.failedLookupLocations) == null ? void 0 : _a.some((location) => isInvalidatedFailedLookup(resolutionHost.toPath(location)));
|
|
122568
|
+
return ((_a = resolution.failedLookupLocations) == null ? void 0 : _a.some((location) => isInvalidatedFailedLookup(resolutionHost.toPath(location)))) || !!resolution.node10Result && isInvalidatedFailedLookup(resolutionHost.toPath(resolution.node10Result));
|
|
122458
122569
|
}
|
|
122459
122570
|
function isInvalidatedFailedLookup(locationPath) {
|
|
122460
122571
|
return (failedLookupChecks == null ? void 0 : failedLookupChecks.has(locationPath)) || firstDefinedIterator((startsWithPathChecks == null ? void 0 : startsWithPathChecks.keys()) || [], (fileOrDirectoryPath) => startsWith(locationPath, fileOrDirectoryPath) ? true : void 0) || firstDefinedIterator((isInDirectoryChecks == null ? void 0 : isInDirectoryChecks.keys()) || [], (dirPath) => locationPath.length > dirPath.length && startsWith(locationPath, dirPath) && (isDiskPathRoot(dirPath) || locationPath[dirPath.length] === directorySeparator) ? true : void 0);
|
|
@@ -166022,8 +166133,9 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
166022
166133
|
}
|
|
166023
166134
|
const textChanges2 = mapDefined(normalized, (c) => {
|
|
166024
166135
|
const span = createTextSpanFromRange(c.range);
|
|
166025
|
-
const
|
|
166026
|
-
|
|
166136
|
+
const targetSourceFile = c.kind === 1 /* ReplaceWithSingleNode */ ? getSourceFileOfNode(getOriginalNode(c.node)) ?? c.sourceFile : c.kind === 2 /* ReplaceWithMultipleNodes */ ? getSourceFileOfNode(getOriginalNode(c.nodes[0])) ?? c.sourceFile : c.sourceFile;
|
|
166137
|
+
const newText = computeNewText(c, targetSourceFile, sourceFile, newLineCharacter, formatContext, validate);
|
|
166138
|
+
if (span.length === newText.length && stringContainsAt(targetSourceFile.text, newText, span.start)) {
|
|
166027
166139
|
return void 0;
|
|
166028
166140
|
}
|
|
166029
166141
|
return createTextChange(span, newText);
|
|
@@ -166051,7 +166163,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
166051
166163
|
return applyChanges(nonFormattedText, changes) + newLineCharacter;
|
|
166052
166164
|
}
|
|
166053
166165
|
changesToText2.newFileChangesWorker = newFileChangesWorker;
|
|
166054
|
-
function computeNewText(change, sourceFile, newLineCharacter, formatContext, validate) {
|
|
166166
|
+
function computeNewText(change, targetSourceFile, sourceFile, newLineCharacter, formatContext, validate) {
|
|
166055
166167
|
var _a;
|
|
166056
166168
|
if (change.kind === 0 /* Remove */) {
|
|
166057
166169
|
return "";
|
|
@@ -166060,17 +166172,17 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
166060
166172
|
return change.text;
|
|
166061
166173
|
}
|
|
166062
166174
|
const { options = {}, range: { pos } } = change;
|
|
166063
|
-
const format = (n) => getFormattedTextOfNode(n, sourceFile, pos, options, newLineCharacter, formatContext, validate);
|
|
166175
|
+
const format = (n) => getFormattedTextOfNode(n, targetSourceFile, sourceFile, pos, options, newLineCharacter, formatContext, validate);
|
|
166064
166176
|
const text = change.kind === 2 /* ReplaceWithMultipleNodes */ ? change.nodes.map((n) => removeSuffix(format(n), newLineCharacter)).join(((_a = change.options) == null ? void 0 : _a.joiner) || newLineCharacter) : format(change.node);
|
|
166065
|
-
const noIndent = options.indentation !== void 0 || getLineStartPositionForPosition(pos,
|
|
166177
|
+
const noIndent = options.indentation !== void 0 || getLineStartPositionForPosition(pos, targetSourceFile) === pos ? text : text.replace(/^\s+/, "");
|
|
166066
166178
|
return (options.prefix || "") + noIndent + (!options.suffix || endsWith(noIndent, options.suffix) ? "" : options.suffix);
|
|
166067
166179
|
}
|
|
166068
|
-
function getFormattedTextOfNode(nodeIn, sourceFile, pos, { indentation, prefix, delta }, newLineCharacter, formatContext, validate) {
|
|
166069
|
-
const { node, text } = getNonformattedText(nodeIn,
|
|
166180
|
+
function getFormattedTextOfNode(nodeIn, targetSourceFile, sourceFile, pos, { indentation, prefix, delta }, newLineCharacter, formatContext, validate) {
|
|
166181
|
+
const { node, text } = getNonformattedText(nodeIn, targetSourceFile, newLineCharacter);
|
|
166070
166182
|
if (validate)
|
|
166071
166183
|
validate(node, text);
|
|
166072
|
-
const formatOptions = getFormatCodeSettingsForWriting(formatContext,
|
|
166073
|
-
const initialIndentation = indentation !== void 0 ? indentation : ts_formatting_exports.SmartIndenter.getIndentation(pos, sourceFile, formatOptions, prefix === newLineCharacter || getLineStartPositionForPosition(pos,
|
|
166184
|
+
const formatOptions = getFormatCodeSettingsForWriting(formatContext, targetSourceFile);
|
|
166185
|
+
const initialIndentation = indentation !== void 0 ? indentation : ts_formatting_exports.SmartIndenter.getIndentation(pos, sourceFile, formatOptions, prefix === newLineCharacter || getLineStartPositionForPosition(pos, targetSourceFile) === pos);
|
|
166074
166186
|
if (delta === void 0) {
|
|
166075
166187
|
delta = ts_formatting_exports.SmartIndenter.shouldIndentChildNode(formatOptions, nodeIn) ? formatOptions.indentSize || 0 : 0;
|
|
166076
166188
|
}
|
|
@@ -166080,7 +166192,7 @@ ${options.prefix}` : "\n" : options.prefix
|
|
|
166080
166192
|
return getLineAndCharacterOfPosition(this, pos2);
|
|
166081
166193
|
}
|
|
166082
166194
|
};
|
|
166083
|
-
const changes = ts_formatting_exports.formatNodeGivenIndentation(node, file,
|
|
166195
|
+
const changes = ts_formatting_exports.formatNodeGivenIndentation(node, file, targetSourceFile.languageVariant, initialIndentation, delta, { ...formatContext, options: formatOptions });
|
|
166084
166196
|
return applyChanges(text, changes);
|
|
166085
166197
|
}
|
|
166086
166198
|
function getNonformattedText(node, sourceFile, newLineCharacter) {
|
|
@@ -180965,6 +181077,7 @@ ${e.message}`;
|
|
|
180965
181077
|
createMemberAccessForPropertyName: () => createMemberAccessForPropertyName,
|
|
180966
181078
|
createModeAwareCache: () => createModeAwareCache,
|
|
180967
181079
|
createModeAwareCacheKey: () => createModeAwareCacheKey,
|
|
181080
|
+
createModuleNotFoundChain: () => createModuleNotFoundChain,
|
|
180968
181081
|
createModuleResolutionCache: () => createModuleResolutionCache,
|
|
180969
181082
|
createModuleResolutionLoader: () => createModuleResolutionLoader,
|
|
180970
181083
|
createModuleSpecifierResolutionHost: () => createModuleSpecifierResolutionHost,
|
|
@@ -183343,6 +183456,7 @@ ${e.message}`;
|
|
|
183343
183456
|
createMemberAccessForPropertyName: () => createMemberAccessForPropertyName,
|
|
183344
183457
|
createModeAwareCache: () => createModeAwareCache,
|
|
183345
183458
|
createModeAwareCacheKey: () => createModeAwareCacheKey,
|
|
183459
|
+
createModuleNotFoundChain: () => createModuleNotFoundChain,
|
|
183346
183460
|
createModuleResolutionCache: () => createModuleResolutionCache,
|
|
183347
183461
|
createModuleResolutionLoader: () => createModuleResolutionLoader,
|
|
183348
183462
|
createModuleSpecifierResolutionHost: () => createModuleSpecifierResolutionHost,
|