diff --git a/src/LuaLib.ts b/src/LuaLib.ts index e77498936..e5df8927a 100644 --- a/src/LuaLib.ts +++ b/src/LuaLib.ts @@ -130,8 +130,11 @@ export function readLuaLibFeature(feature: LuaLibFeature, emitHost: EmitHost): s return luaLibFeature; } -export function resolveRecursiveLualibFeatures(features: Iterable, emitHost: EmitHost): LuaLibFeature[] { - const luaLibModulesInfo = getLuaLibModulesInfo(emitHost); +export function resolveRecursiveLualibFeatures( + features: Iterable, + emitHost: EmitHost, + luaLibModulesInfo: LuaLibModulesInfo = getLuaLibModulesInfo(emitHost) +): LuaLibFeature[] { const loadedFeatures = new Set(); const result: LuaLibFeature[] = []; diff --git a/src/lualib-build/plugin.ts b/src/lualib-build/plugin.ts index 14f068f71..a14c8917a 100644 --- a/src/lualib-build/plugin.ts +++ b/src/lualib-build/plugin.ts @@ -48,7 +48,7 @@ class LuaLibPlugin implements tstl.Plugin { // Figure out the order required in the bundle by recursively resolving all dependency features const allFeatures = Object.values(LuaLibFeature) as LuaLibFeature[]; - const orderedFeatures = resolveRecursiveLualibFeatures(allFeatures, emitHost); + const orderedFeatures = resolveRecursiveLualibFeatures(allFeatures, emitHost, luaLibModuleInfo); // Concatenate lualib files into bundle with exports table and add lualib_bundle.lua to results let lualibBundle = orderedFeatures.map(f => exportedLualibFeatures.get(LuaLibFeature[f])).join("\n"); diff --git a/src/lualib/tsconfig.json b/src/lualib/tsconfig.json index beca82ecd..8acde4cca 100644 --- a/src/lualib/tsconfig.json +++ b/src/lualib/tsconfig.json @@ -12,6 +12,6 @@ "tstl": { "luaLibImport": "none", "noHeader": true, - "luaPlugins": [{ "name": "../lualib-build/plugin.ts" }] + "luaPlugins": [{ "name": "../../dist/lualib-build/plugin.js" }] } }