@biuxiu/codegen 0.2.10 → 0.2.12
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/code/nest.js +0 -1
- package/dist/config.d.ts +2 -1
- package/dist/config.js +3 -4
- package/dist/gen-type.js +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +12 -4
- package/package.json +1 -1
package/dist/code/nest.js
CHANGED
package/dist/config.d.ts
CHANGED
@@ -3,8 +3,9 @@ declare const CodegenConfig: {
|
|
3
3
|
apiDir: string;
|
4
4
|
reverse: boolean;
|
5
5
|
};
|
6
|
-
export type ConfigType = Partial<typeof CodegenConfig>;
|
6
|
+
export type ConfigType = Omit<Partial<typeof CodegenConfig>, 'reverse'>;
|
7
7
|
export declare function setConfig(config: ConfigType): void;
|
8
|
+
export declare const setReverse: (reverse: boolean) => boolean;
|
8
9
|
export declare const getWebDir: () => string;
|
9
10
|
export declare const getApiDir: () => string;
|
10
11
|
export declare const isReverse: () => boolean;
|
package/dist/config.js
CHANGED
@@ -11,10 +11,8 @@ function setConfig(config) {
|
|
11
11
|
if (config.apiDir) {
|
12
12
|
CodegenConfig.apiDir = config.apiDir;
|
13
13
|
}
|
14
|
-
if (config.reverse !== void 0) {
|
15
|
-
CodegenConfig.reverse = config.reverse;
|
16
|
-
}
|
17
14
|
}
|
15
|
+
const setReverse = (reverse) => CodegenConfig.reverse = reverse;
|
18
16
|
const getWebDir = () => CodegenConfig.webDir;
|
19
17
|
const getApiDir = () => CodegenConfig.apiDir;
|
20
18
|
const isReverse = () => CodegenConfig.reverse;
|
@@ -22,5 +20,6 @@ export {
|
|
22
20
|
getApiDir,
|
23
21
|
getWebDir,
|
24
22
|
isReverse,
|
25
|
-
setConfig
|
23
|
+
setConfig,
|
24
|
+
setReverse
|
26
25
|
};
|
package/dist/gen-type.js
CHANGED
package/dist/index.d.ts
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
import { genLuaTypes } from './gen-type';
|
2
2
|
import { ConfigType } from './config';
|
3
|
-
declare
|
4
|
-
|
3
|
+
declare const startGen: (filePath: string, config?: ConfigType) => Promise<undefined>;
|
4
|
+
declare const startRemove: (filePath: string, config?: ConfigType) => Promise<undefined>;
|
5
|
+
export { startGen, startRemove, genLuaTypes };
|
package/dist/index.js
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
import { compileToByte } from "./compile";
|
2
2
|
import { existsSync } from "fs";
|
3
3
|
import { genLuaTypes } from "./gen-type";
|
4
|
-
import { setConfig } from "./config";
|
5
|
-
async function startRun(filePath, config) {
|
4
|
+
import { setConfig, setReverse } from "./config";
|
5
|
+
async function startRun(filePath, isDelete, config) {
|
6
6
|
if (config) setConfig(config);
|
7
|
+
setReverse(isDelete);
|
7
8
|
if (existsSync(filePath)) {
|
8
9
|
try {
|
9
10
|
const data = await compileToByte(filePath);
|
10
11
|
const { run } = await import("./lua_codegen");
|
11
|
-
run(new Uint8Array(data), filePath);
|
12
|
+
run(new Uint8Array(data), filePath);
|
12
13
|
} catch (error) {
|
13
14
|
return Promise.reject(error);
|
14
15
|
}
|
@@ -16,7 +17,14 @@ run(new Uint8Array(data), filePath);
|
|
16
17
|
return Promise.reject(`${filePath}\u6587\u4EF6\u5B58\u5728`);
|
17
18
|
}
|
18
19
|
}
|
20
|
+
const startGen = (filePath, config) => {
|
21
|
+
return startRun(filePath, false, config);
|
22
|
+
};
|
23
|
+
const startRemove = (filePath, config) => {
|
24
|
+
return startRun(filePath, true, config);
|
25
|
+
};
|
19
26
|
export {
|
20
27
|
genLuaTypes,
|
21
|
-
|
28
|
+
startGen,
|
29
|
+
startRemove
|
22
30
|
};
|