Skip to content

Commit a059334

Browse files
committed
support extends "tstl" object tsconfig.json in node_modules
upgrade typescript to 5.0.4 to fix extends resolving. microsoft/TypeScript#53443
1 parent 2813e66 commit a059334

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/cli/tsconfig.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,11 @@ export function parseConfigFileWithSystem(
5858
return updateParsedConfigFile(parsedConfigFile);
5959
}
6060

61-
function resolveJsonConfig(
61+
function pathIsRelative(path: string): boolean {
62+
return /^\.\.?($|[\\/])/.test(path);
63+
}
64+
65+
function resolveModuleConfig(
6266
moduleName: string,
6367
configRootDir: string,
6468
host: ts.ModuleResolutionHost
@@ -75,7 +79,11 @@ function getExtendedTstlOptions(
7579
cycleCache: Set<string>,
7680
system: ts.System
7781
): TypeScriptToLuaOptions {
78-
const absolutePath = resolveJsonConfig(configFilePath, configRootDir, system);
82+
const absolutePath = path.isAbsolute(configFilePath)
83+
? configFilePath
84+
: pathIsRelative(configFilePath)
85+
? path.resolve(configRootDir, configFilePath)
86+
: resolveModuleConfig(configFilePath, configRootDir, system);
7987

8088
if (!absolutePath) {
8189
return {};

0 commit comments

Comments
 (0)