@lvce-editor/process-explorer 2.3.0 → 2.4.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 +17 -19
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -7,25 +7,20 @@ import { execFile as execFile$1 } from 'node:child_process';
7
7
  import { promisify } from 'node:util';
8
8
 
9
9
  const Two = '2.0';
10
- const state$2 = {
11
- callbacks: Object.create(null)
12
- };
10
+ const callbacks = Object.create(null);
13
11
  const set = (id, fn) => {
14
- state$2.callbacks[id] = fn;
12
+ callbacks[id] = fn;
15
13
  };
16
14
  const get = id => {
17
- return state$2.callbacks[id];
15
+ return callbacks[id];
18
16
  };
19
17
  const remove = id => {
20
- delete state$2.callbacks[id];
18
+ delete callbacks[id];
21
19
  };
22
20
  let id = 0;
23
21
  const create$3 = () => {
24
22
  return ++id;
25
23
  };
26
- const warn = (...args) => {
27
- console.warn(...args);
28
- };
29
24
  const registerPromise = () => {
30
25
  const id = create$3();
31
26
  const {
@@ -38,16 +33,6 @@ const registerPromise = () => {
38
33
  promise
39
34
  };
40
35
  };
41
- const resolve = (id, response) => {
42
- const fn = get(id);
43
- if (!fn) {
44
- console.log(response);
45
- warn(`callback ${id} may already be disposed`);
46
- return;
47
- }
48
- fn(response);
49
- remove(id);
50
- };
51
36
  const create$2 = (method, params) => {
52
37
  const {
53
38
  id,
@@ -195,6 +180,19 @@ const unwrapJsonRpcResult = responseMessage => {
195
180
  }
196
181
  throw new JsonRpcError('unexpected response message');
197
182
  };
183
+ const warn = (...args) => {
184
+ console.warn(...args);
185
+ };
186
+ const resolve = (id, response) => {
187
+ const fn = get(id);
188
+ if (!fn) {
189
+ console.log(response);
190
+ warn(`callback ${id} may already be disposed`);
191
+ return;
192
+ }
193
+ fn(response);
194
+ remove(id);
195
+ };
198
196
  const E_COMMAND_NOT_FOUND = 'E_COMMAND_NOT_FOUND';
199
197
  const getErrorType = prettyError => {
200
198
  if (prettyError && prettyError.type) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/process-explorer",
3
- "version": "2.3.0",
3
+ "version": "2.4.0",
4
4
  "description": "Process Explorer",
5
5
  "main": "dist/index.js",
6
6
  "bin": "bin/processExplorer.js",
@@ -19,8 +19,8 @@
19
19
  },
20
20
  "dependencies": {
21
21
  "@lvce-editor/assert": "^1.3.0",
22
- "@lvce-editor/ipc": "^11.4.0",
23
- "@lvce-editor/json-rpc": "^5.2.0",
22
+ "@lvce-editor/ipc": "^13.7.0",
23
+ "@lvce-editor/json-rpc": "^5.4.0",
24
24
  "@lvce-editor/verror": "^1.6.0"
25
25
  },
26
26
  "optionalDependencies": {