(feature: LuaLibFeature, luaTarget: LuaTarget, emitHost: EmitHost)
| 176 | const lualibFeatureCache = new Map<LuaTarget, Map<LuaLibFeature, string>>(); |
| 177 | |
| 178 | export function readLuaLibFeature(feature: LuaLibFeature, luaTarget: LuaTarget, emitHost: EmitHost): string { |
| 179 | const featureMap = getOrUpdate(lualibFeatureCache, luaTarget, () => new Map()); |
| 180 | if (!featureMap.has(feature)) { |
| 181 | const featurePath = path.join(resolveLuaLibDir(luaTarget), `${feature}.lua`); |
| 182 | const luaLibFeature = emitHost.readFile(featurePath); |
| 183 | if (luaLibFeature === undefined) { |
| 184 | throw new Error(`Could not load lualib feature from '${featurePath}'`); |
| 185 | } |
| 186 | featureMap.set(feature, luaLibFeature); |
| 187 | } |
| 188 | return featureMap.get(feature)!; |
| 189 | } |
| 190 | |
| 191 | export function resolveRecursiveLualibFeatures( |
| 192 | features: Iterable<LuaLibFeature>, |
no test coverage detected