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

Function requirePathForFile

src/transpilation/resolve.ts:413–422  ·  view source on GitHub ↗
(filePath: string, extension = ".lua")

Source from the content-addressed store, hash-verified

411}
412
413function requirePathForFile(filePath: string, extension = ".lua"): string {
414 if (!extension.startsWith(".")) {
415 extension = `.${extension}`;
416 }
417 if (filePath.endsWith(extension)) {
418 return formatPathToLuaPath(filePath.substring(0, filePath.length - extension.length));
419 } else {
420 return formatPathToLuaPath(filePath);
421 }
422}
423
424function replaceInSourceMap(node: SourceNode, parent: SourceNode, require: string, resolvedRequire: string): boolean {
425 if ((!node.children || node.children.length === 0) && node.toString() === require) {

Callers 2

replaceRequireInCodeFunction · 0.85

Calls 1

formatPathToLuaPathFunction · 0.90

Tested by

no test coverage detected