(required: LuaRequire, sourceRootDir: string, fileDir: string)
| 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 |
| 462 | function 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 | |
| 472 | function luaRequireToPath(requirePath: string): string { |
| 473 | return requirePath.replace(/\./g, path.sep); |
no test coverage detected