@lvce-editor/typescript-compile-process 1.4.0 → 1.5.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.
Files changed (2) hide show
  1. package/dist/index.js +3 -22
  2. package/package.json +2 -1
package/dist/index.js CHANGED
@@ -1,29 +1,10 @@
1
+ import * as Command from '@lvce-editor/command';
2
+ import { execute } from '@lvce-editor/command';
1
3
  import { object, string } from '@lvce-editor/assert';
2
4
  import { handleJsonRpcMessage, resolve } from '@lvce-editor/json-rpc';
3
5
  import { IpcChildWithWebSocket, IpcChildWithElectronMessagePort, IpcChildWithElectronUtilityProcess, IpcChildWithNodeWorker, IpcChildWithNodeForkedProcess } from '@lvce-editor/ipc';
4
6
  import { VError } from '@lvce-editor/verror';
5
7
 
6
- const commands = Object.create(null);
7
- const registerCommand = (key, fn) => {
8
- commands[key] = fn;
9
- };
10
- const registerCommands = commandMap => {
11
- for (const [key, value] of Object.entries(commandMap)) {
12
- registerCommand(key, value);
13
- }
14
- };
15
- const getCommand = key => {
16
- return commands[key];
17
- };
18
-
19
- const execute = (command, ...args) => {
20
- const fn = getCommand(command);
21
- if (!fn) {
22
- throw new Error(`Command not found ${command}`);
23
- }
24
- return fn(...args);
25
- };
26
-
27
8
  const prepare = error => {
28
9
  return error;
29
10
  };
@@ -164,7 +145,7 @@ const listen = async () => {
164
145
  };
165
146
 
166
147
  const main = async () => {
167
- registerCommands(commandMap);
148
+ Command.register(commandMap);
168
149
  await listen();
169
150
  };
170
151
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/typescript-compile-process",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "description": "TypeScript Compile Process",
5
5
  "main": "dist/index.js",
6
6
  "bin": "bin/typescriptCompileProcess.js",
@@ -19,6 +19,7 @@
19
19
  },
20
20
  "dependencies": {
21
21
  "@lvce-editor/assert": "^1.3.0",
22
+ "@lvce-editor/command": "^1.1.0",
22
23
  "@lvce-editor/ipc": "^11.0.1",
23
24
  "@lvce-editor/json-rpc": "^4.2.0",
24
25
  "@lvce-editor/verror": "^1.4.0"