@lvce-editor/typescript-compile-process 1.1.0 → 1.2.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.
- package/README.md +1 -0
- package/dist/index.js +9 -7
- package/package.json +1 -2
package/README.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -3,11 +3,9 @@ import { handleJsonRpcMessage, resolve } from '@lvce-editor/json-rpc';
|
|
|
3
3
|
import { IpcChildWithWebSocket, IpcChildWithElectronMessagePort, IpcChildWithElectronUtilityProcess, IpcChildWithNodeWorker, IpcChildWithNodeForkedProcess } from '@lvce-editor/ipc';
|
|
4
4
|
import { VError } from '@lvce-editor/verror';
|
|
5
5
|
|
|
6
|
-
const
|
|
7
|
-
commands: Object.create(null)
|
|
8
|
-
};
|
|
6
|
+
const commands = Object.create(null);
|
|
9
7
|
const registerCommand = (key, fn) => {
|
|
10
|
-
|
|
8
|
+
commands[key] = fn;
|
|
11
9
|
};
|
|
12
10
|
const registerCommands = commandMap => {
|
|
13
11
|
for (const [key, value] of Object.entries(commandMap)) {
|
|
@@ -15,7 +13,7 @@ const registerCommands = commandMap => {
|
|
|
15
13
|
}
|
|
16
14
|
};
|
|
17
15
|
const getCommand = key => {
|
|
18
|
-
return
|
|
16
|
+
return commands[key];
|
|
19
17
|
};
|
|
20
18
|
|
|
21
19
|
const execute = (command, ...args) => {
|
|
@@ -32,7 +30,7 @@ const prepare = error => {
|
|
|
32
30
|
const requiresSocket = method => {
|
|
33
31
|
return false;
|
|
34
32
|
};
|
|
35
|
-
const logError =
|
|
33
|
+
const logError = error => {
|
|
36
34
|
console.error(error);
|
|
37
35
|
};
|
|
38
36
|
const handleMessage = event => {
|
|
@@ -109,9 +107,13 @@ const handleElectronMessagePort = async (messagePort, ipcId) => {
|
|
|
109
107
|
handleIpc(ipc);
|
|
110
108
|
};
|
|
111
109
|
|
|
110
|
+
const importScript = async url => {
|
|
111
|
+
return await import(url);
|
|
112
|
+
};
|
|
113
|
+
|
|
112
114
|
const loadTypeScript = async typescriptPath => {
|
|
113
115
|
try {
|
|
114
|
-
const typescript = await
|
|
116
|
+
const typescript = await importScript(typescriptPath);
|
|
115
117
|
const actual = typescript.default;
|
|
116
118
|
if (!actual) {
|
|
117
119
|
throw new Error('missing default export');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lvce-editor/typescript-compile-process",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "TypeScript Compile Process",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": "bin/typescriptCompileProcess.js",
|
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
"@lvce-editor/assert": "^1.2.0",
|
|
22
22
|
"@lvce-editor/ipc": "^9.1.0",
|
|
23
23
|
"@lvce-editor/json-rpc": "^1.3.0",
|
|
24
|
-
"@lvce-editor/pretty-error": "^1.5.0",
|
|
25
24
|
"@lvce-editor/verror": "^1.3.0"
|
|
26
25
|
},
|
|
27
26
|
"xo": {
|