MCPcopy Index your code
hub / github.com/nodejs/node / getPreferences

Function getPreferences

test/fixtures/snapshot/typescript.js:121938–121956  ·  view source on GitHub ↗
(host, _a, compilerOptions, importingSourceFile)

Source from the content-addressed store, hash-verified

121936 Ending[Ending["JsExtension"] = 2] = "JsExtension";
121937 })(Ending || (Ending = {}));
121938 function getPreferences(host, _a, compilerOptions, importingSourceFile) {
121939 var importModuleSpecifierPreference = _a.importModuleSpecifierPreference, importModuleSpecifierEnding = _a.importModuleSpecifierEnding;
121940 return {
121941 relativePreference: importModuleSpecifierPreference === "relative" ? 0 /* RelativePreference.Relative */ :
121942 importModuleSpecifierPreference === "non-relative" ? 1 /* RelativePreference.NonRelative */ :
121943 importModuleSpecifierPreference === "project-relative" ? 3 /* RelativePreference.ExternalNonRelative */ :
121944 2 /* RelativePreference.Shortest */,
121945 ending: getEnding(),
121946 };
121947 function getEnding() {
121948 switch (importModuleSpecifierEnding) {
121949 case "minimal": return 0 /* Ending.Minimal */;
121950 case "index": return 1 /* Ending.Index */;
121951 case "js": return 2 /* Ending.JsExtension */;
121952 default: return usesJsExtensionOnImports(importingSourceFile) || isFormatRequiringExtensions(compilerOptions, importingSourceFile.path, host) ? 2 /* Ending.JsExtension */
121953 : ts.getEmitModuleResolutionKind(compilerOptions) !== ts.ModuleResolutionKind.NodeJs ? 1 /* Ending.Index */ : 0 /* Ending.Minimal */;
121954 }
121955 }
121956 }
121957 function getPreferencesForUpdate(compilerOptions, oldImportSpecifier, importingSourceFileName, host) {
121958 return {
121959 relativePreference: ts.isExternalModuleNameRelative(oldImportSpecifier) ? 0 /* RelativePreference.Relative */ : 1 /* RelativePreference.NonRelative */,

Callers 3

getModuleSpecifierFunction · 0.85
computeModuleSpecifiersFunction · 0.85

Calls 1

getEndingFunction · 0.85

Tested by

no test coverage detected