typescript-to-lua 1.25.1 → 1.25.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -12,8 +12,8 @@ const createModulePath = (pathToResolve, program) => (0, LuaPrinter_1.escapeStri
|
|
|
12
12
|
// Override `require` to read from ____modules table.
|
|
13
13
|
function requireOverride(options) {
|
|
14
14
|
const runModule = options.luaTarget === CompilerOptions_1.LuaTarget.Lua50
|
|
15
|
-
? "(table.getn(arg) > 0)
|
|
16
|
-
: '(select("#", ...) > 0)
|
|
15
|
+
? "if (table.getn(arg) > 0) then value = module(unpack(arg)) else value = module(file) end"
|
|
16
|
+
: 'if (select("#", ...) > 0) then value = module(...) else value = module(file) end';
|
|
17
17
|
return `
|
|
18
18
|
local ____modules = {}
|
|
19
19
|
local ____moduleCache = {}
|
|
@@ -24,8 +24,10 @@ local function require(file, ...)
|
|
|
24
24
|
end
|
|
25
25
|
if ____modules[file] then
|
|
26
26
|
local module = ____modules[file]
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
local value = nil
|
|
28
|
+
${runModule}
|
|
29
|
+
____moduleCache[file] = { value = value }
|
|
30
|
+
return value
|
|
29
31
|
else
|
|
30
32
|
if ____originalRequire then
|
|
31
33
|
return ____originalRequire(file)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "typescript-to-lua",
|
|
3
|
-
"version": "1.25.
|
|
3
|
+
"version": "1.25.2",
|
|
4
4
|
"description": "A generic TypeScript to Lua transpiler. Write your code in TypeScript and publish Lua!",
|
|
5
5
|
"repository": "https://github.com/TypeScriptToLua/TypeScriptToLua",
|
|
6
6
|
"homepage": "https://typescripttolua.github.io/",
|