MCPcopy Index your code
hub / github.com/TypeScriptToLua/TypeScriptToLua / fallbackResolve

Function fallbackResolve

src/transpilation/resolve.ts:462–470  ·  view source on GitHub ↗
(required: LuaRequire, sourceRootDir: string, fileDir: string)

Source from the content-addressed store, hash-verified

460
461// Transform an import path to a lua require that is probably not correct, but can be used as fallback when regular resolution fails
462function fallbackResolve(required: LuaRequire, sourceRootDir: string, fileDir: string): string {
463 return formatPathToLuaPath(
464 path
465 .normalize(path.join(path.relative(sourceRootDir, fileDir), required.requirePath))
466 .split(path.sep)
467 .filter(s => s !== "." && s !== "..")
468 .join(path.sep)
469 );
470}
471
472function luaRequireToPath(requirePath: string): string {
473 return requirePath.replace(/\./g, path.sep);

Callers 1

couldNotResolveImportMethod · 0.85

Calls 1

formatPathToLuaPathFunction · 0.90

Tested by

no test coverage detected