typescript-to-lua 1.29.1 → 1.30.0
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.
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as ts from "typescript";
|
|
2
|
+
import { Plugin } from "./transpilation/plugins";
|
|
2
3
|
type OmitIndexSignature<T> = {
|
|
3
4
|
[K in keyof T as string extends K ? never : number extends K ? never : K]: T[K];
|
|
4
5
|
};
|
|
@@ -15,6 +16,10 @@ export interface LuaPluginImport {
|
|
|
15
16
|
import?: string;
|
|
16
17
|
[option: string]: any;
|
|
17
18
|
}
|
|
19
|
+
export interface InMemoryLuaPlugin {
|
|
20
|
+
plugin: Plugin | ((options: Record<string, any>) => Plugin);
|
|
21
|
+
[option: string]: any;
|
|
22
|
+
}
|
|
18
23
|
export interface TypeScriptToLuaOptions {
|
|
19
24
|
buildMode?: BuildMode;
|
|
20
25
|
extension?: string;
|
|
@@ -22,7 +27,7 @@ export interface TypeScriptToLuaOptions {
|
|
|
22
27
|
luaBundleEntry?: string;
|
|
23
28
|
luaTarget?: LuaTarget;
|
|
24
29
|
luaLibImport?: LuaLibImportKind;
|
|
25
|
-
luaPlugins?: LuaPluginImport
|
|
30
|
+
luaPlugins?: Array<LuaPluginImport | InMemoryLuaPlugin>;
|
|
26
31
|
noImplicitGlobalVariables?: boolean;
|
|
27
32
|
noImplicitSelf?: boolean;
|
|
28
33
|
noHeader?: boolean;
|
|
@@ -11,9 +11,17 @@ function getPlugins(program) {
|
|
|
11
11
|
const options = program.getCompilerOptions();
|
|
12
12
|
for (const [index, pluginOption] of ((_a = options.luaPlugins) !== null && _a !== void 0 ? _a : []).entries()) {
|
|
13
13
|
const optionName = `tstl.luaPlugins[${index}]`;
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
const factory = (() => {
|
|
15
|
+
if ("plugin" in pluginOption) {
|
|
16
|
+
return pluginOption.plugin;
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
const { error: resolveError, result: factory } = (0, utils_1.resolvePlugin)("plugin", `${optionName}.name`, (0, utils_1.getConfigDirectory)(options), pluginOption.name, pluginOption.import);
|
|
20
|
+
if (resolveError)
|
|
21
|
+
diagnostics.push(resolveError);
|
|
22
|
+
return factory;
|
|
23
|
+
}
|
|
24
|
+
})();
|
|
17
25
|
if (factory === undefined)
|
|
18
26
|
continue;
|
|
19
27
|
const plugin = typeof factory === "function" ? factory(pluginOption) : factory;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "typescript-to-lua",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.30.0",
|
|
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/",
|