Skip to content

Commit e482e97

Browse files
committed
Apply code formatting
1 parent e05430e commit e482e97

File tree

2 files changed

+19
-18
lines changed

2 files changed

+19
-18
lines changed

src/compiler/moduleNameResolver.ts

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1484,24 +1484,25 @@ export function resolveModuleName(moduleName: string, containingFile: string, co
14841484
if (redirectedReference) {
14851485
projectDir = getDirectoryPath(redirectedReference.sourceFile.fileName);
14861486
options = redirectedReference.commandLine.options;
1487-
} else {
1487+
}
1488+
else {
14881489
projectDir = getDirectoryPath(containingFile);
14891490
options = compilerOptions;
14901491
}
14911492

14921493
let currentDir = projectDir;
14931494
let packageJsonInfo: PackageJsonInfoCacheEntry | undefined;
14941495
while (currentDir) {
1495-
const packageJsonPath = combinePaths(currentDir, "package.json");
1496-
packageJsonInfo = cache?.getPackageJsonInfo(packageJsonPath);
1497-
if (isPackageJsonInfo(packageJsonInfo)) break;
1498-
const parent = getDirectoryPath(currentDir);
1499-
if (parent === currentDir) break;
1500-
currentDir = parent;
1496+
const packageJsonPath = combinePaths(currentDir, "package.json");
1497+
packageJsonInfo = cache?.getPackageJsonInfo(packageJsonPath);
1498+
if (isPackageJsonInfo(packageJsonInfo)) break;
1499+
const parent = getDirectoryPath(currentDir);
1500+
if (parent === currentDir) break;
1501+
currentDir = parent;
15011502
}
15021503

15031504
if (isPackageJsonInfo(packageJsonInfo) && packageJsonInfo.contents.packageJsonContent.name === moduleName) {
1504-
if (options) {
1505+
if (options) {
15051506
let outputDts: string | undefined;
15061507
if (options.outFile) {
15071508
outputDts = changeAnyExtension(options.outFile, ".d.ts");
@@ -1510,16 +1511,16 @@ export function resolveModuleName(moduleName: string, containingFile: string, co
15101511
const getCanonicalFileName = createGetCanonicalFileName(
15111512
typeof host.useCaseSensitiveFileNames === "function"
15121513
? host.useCaseSensitiveFileNames()
1513-
: host.useCaseSensitiveFileNames ?? true
1514+
: host.useCaseSensitiveFileNames ?? true,
15141515
);
15151516

15161517
let rootDir = options.rootDir;
15171518
if (!rootDir && redirectedReference) {
1518-
rootDir = getCommonSourceDirectory(
1519+
rootDir = getCommonSourceDirectory(
15191520
options,
15201521
() => redirectedReference.commandLine.fileNames,
15211522
host.getCurrentDirectory ? host.getCurrentDirectory() : "",
1522-
getCanonicalFileName
1523+
getCanonicalFileName,
15231524
);
15241525
}
15251526

@@ -1533,7 +1534,7 @@ export function resolveModuleName(moduleName: string, containingFile: string, co
15331534
result.resolvedModule.resolvedFileName = outputDts;
15341535
result.resolvedModule.extension = Extension.Dts;
15351536
}
1536-
}
1537+
}
15371538
}
15381539
}
15391540
}

src/testRunner/unittests/tsbuild/moduleResolution.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -266,19 +266,19 @@ describe("unittests:: tsbuild:: moduleResolution:: self-import in .d.ts with pro
266266
exports: {
267267
".": {
268268
types: "./dist/index.d.ts",
269-
default: "./dist/index.js"
270-
}
271-
}
269+
default: "./dist/index.js",
270+
},
271+
},
272272
}),
273273
"/home/src/workspaces/project/packages/pkg1/tsconfig.json": jsonToReadableText({
274274
compilerOptions: {
275275
composite: true,
276276
outDir: "dist",
277277
rootDir: "src",
278278
module: "nodenext",
279-
moduleResolution: "nodenext"
279+
moduleResolution: "nodenext",
280280
},
281-
include: ["src"]
281+
include: ["src"],
282282
}),
283283
"/home/src/workspaces/project/packages/pkg1/src/index.ts": `export class C {}`,
284284
"/home/src/workspaces/project/packages/pkg1/src/other.d.ts": dedent`
@@ -288,7 +288,7 @@ describe("unittests:: tsbuild:: moduleResolution:: self-import in .d.ts with pro
288288
"/home/src/workspaces/project/packages/pkg1/src/usage.ts": dedent`
289289
import { c } from "./other";
290290
export const usage = c;
291-
`
291+
`,
292292
}),
293293
commandLineArgs: ["-b", "packages/pkg1", "--verbose", "--traceResolution"],
294294
});

0 commit comments

Comments
 (0)