@lvce-editor/file-system-process 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.
- package/dist/index.js +34 -26
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -12,37 +12,45 @@ class AssertionError extends Error {
|
|
|
12
12
|
this.name = 'AssertionError';
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
+
const Object$1 = 1;
|
|
16
|
+
const Number = 2;
|
|
17
|
+
const Array$1 = 3;
|
|
18
|
+
const String = 4;
|
|
19
|
+
const Boolean$1 = 5;
|
|
20
|
+
const Function = 6;
|
|
21
|
+
const Null = 7;
|
|
22
|
+
const Unknown$1 = 8;
|
|
15
23
|
const getType = value => {
|
|
16
24
|
switch (typeof value) {
|
|
17
25
|
case 'number':
|
|
18
|
-
return
|
|
26
|
+
return Number;
|
|
19
27
|
case 'function':
|
|
20
|
-
return
|
|
28
|
+
return Function;
|
|
21
29
|
case 'string':
|
|
22
|
-
return
|
|
30
|
+
return String;
|
|
23
31
|
case 'object':
|
|
24
32
|
if (value === null) {
|
|
25
|
-
return
|
|
33
|
+
return Null;
|
|
26
34
|
}
|
|
27
35
|
if (Array.isArray(value)) {
|
|
28
|
-
return
|
|
36
|
+
return Array$1;
|
|
29
37
|
}
|
|
30
|
-
return
|
|
38
|
+
return Object$1;
|
|
31
39
|
case 'boolean':
|
|
32
|
-
return
|
|
40
|
+
return Boolean$1;
|
|
33
41
|
default:
|
|
34
|
-
return
|
|
42
|
+
return Unknown$1;
|
|
35
43
|
}
|
|
36
44
|
};
|
|
37
45
|
const object = value => {
|
|
38
46
|
const type = getType(value);
|
|
39
|
-
if (type !==
|
|
47
|
+
if (type !== Object$1) {
|
|
40
48
|
throw new AssertionError('expected value to be of type object');
|
|
41
49
|
}
|
|
42
50
|
};
|
|
43
51
|
const string = value => {
|
|
44
52
|
const type = getType(value);
|
|
45
|
-
if (type !==
|
|
53
|
+
if (type !== String) {
|
|
46
54
|
throw new AssertionError('expected value to be of type string');
|
|
47
55
|
}
|
|
48
56
|
};
|
|
@@ -198,7 +206,7 @@ const isEnoentError = error => {
|
|
|
198
206
|
};
|
|
199
207
|
|
|
200
208
|
const rpcs = Object.create(null);
|
|
201
|
-
const set$
|
|
209
|
+
const set$g = (id, rpc) => {
|
|
202
210
|
rpcs[id] = rpc;
|
|
203
211
|
};
|
|
204
212
|
const get$1 = id => {
|
|
@@ -207,7 +215,7 @@ const get$1 = id => {
|
|
|
207
215
|
|
|
208
216
|
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
|
209
217
|
|
|
210
|
-
const create$
|
|
218
|
+
const create$5 = rpcId => {
|
|
211
219
|
return {
|
|
212
220
|
// @ts-ignore
|
|
213
221
|
invoke(method, ...params) {
|
|
@@ -222,7 +230,7 @@ const create$6 = rpcId => {
|
|
|
222
230
|
return rpc.invokeAndTransfer(method, ...params);
|
|
223
231
|
},
|
|
224
232
|
set(rpc) {
|
|
225
|
-
set$
|
|
233
|
+
set$g(rpcId, rpc);
|
|
226
234
|
},
|
|
227
235
|
async dispose() {
|
|
228
236
|
const rpc = get$1(rpcId);
|
|
@@ -233,7 +241,7 @@ const create$6 = rpcId => {
|
|
|
233
241
|
const MainProcess$1 = -5;
|
|
234
242
|
const {
|
|
235
243
|
invoke: invoke$6,
|
|
236
|
-
set: set$6} = create$
|
|
244
|
+
set: set$6} = create$5(MainProcess$1);
|
|
237
245
|
const MainProcess = {
|
|
238
246
|
__proto__: null,
|
|
239
247
|
invoke: invoke$6,
|
|
@@ -1084,7 +1092,7 @@ const IpcChildWithWebSocket = {
|
|
|
1084
1092
|
};
|
|
1085
1093
|
|
|
1086
1094
|
const Two = '2.0';
|
|
1087
|
-
const create$4
|
|
1095
|
+
const create$4 = (method, params) => {
|
|
1088
1096
|
return {
|
|
1089
1097
|
jsonrpc: Two,
|
|
1090
1098
|
method,
|
|
@@ -1452,7 +1460,7 @@ const invokeHelper = async (ipc, method, params, useSendAndTransfer) => {
|
|
|
1452
1460
|
return unwrapJsonRpcResult(responseMessage);
|
|
1453
1461
|
};
|
|
1454
1462
|
const send = (transport, method, ...params) => {
|
|
1455
|
-
const message = create$4
|
|
1463
|
+
const message = create$4(method, params);
|
|
1456
1464
|
transport.send(message);
|
|
1457
1465
|
};
|
|
1458
1466
|
const invoke = (ipc, method, ...params) => {
|
|
@@ -1529,7 +1537,7 @@ const listen$2 = async (module, options) => {
|
|
|
1529
1537
|
const ipc = module.wrap(rawIpc);
|
|
1530
1538
|
return ipc;
|
|
1531
1539
|
};
|
|
1532
|
-
const create$
|
|
1540
|
+
const create$g = async ({
|
|
1533
1541
|
commandMap,
|
|
1534
1542
|
messagePort,
|
|
1535
1543
|
requiresSocket
|
|
@@ -1548,9 +1556,9 @@ const create$e = async ({
|
|
|
1548
1556
|
};
|
|
1549
1557
|
const ElectronMessagePortRpcClient = {
|
|
1550
1558
|
__proto__: null,
|
|
1551
|
-
create: create$
|
|
1559
|
+
create: create$g
|
|
1552
1560
|
};
|
|
1553
|
-
const create$
|
|
1561
|
+
const create$f = async ({
|
|
1554
1562
|
commandMap
|
|
1555
1563
|
}) => {
|
|
1556
1564
|
// TODO create a commandMap per rpc instance
|
|
@@ -1562,9 +1570,9 @@ const create$d = async ({
|
|
|
1562
1570
|
};
|
|
1563
1571
|
const ElectronUtilityProcessRpcClient = {
|
|
1564
1572
|
__proto__: null,
|
|
1565
|
-
create: create$
|
|
1573
|
+
create: create$f
|
|
1566
1574
|
};
|
|
1567
|
-
const create$
|
|
1575
|
+
const create$9 = async ({
|
|
1568
1576
|
commandMap
|
|
1569
1577
|
}) => {
|
|
1570
1578
|
// TODO create a commandMap per rpc instance
|
|
@@ -1576,9 +1584,9 @@ const create$7 = async ({
|
|
|
1576
1584
|
};
|
|
1577
1585
|
const NodeForkedProcessRpcClient = {
|
|
1578
1586
|
__proto__: null,
|
|
1579
|
-
create: create$
|
|
1587
|
+
create: create$9
|
|
1580
1588
|
};
|
|
1581
|
-
const create$
|
|
1589
|
+
const create$7 = async ({
|
|
1582
1590
|
commandMap,
|
|
1583
1591
|
request,
|
|
1584
1592
|
handle,
|
|
@@ -1599,9 +1607,9 @@ const create$5 = async ({
|
|
|
1599
1607
|
};
|
|
1600
1608
|
const NodeWebSocketRpcClient = {
|
|
1601
1609
|
__proto__: null,
|
|
1602
|
-
create: create$
|
|
1610
|
+
create: create$7
|
|
1603
1611
|
};
|
|
1604
|
-
const create$
|
|
1612
|
+
const create$6 = async ({
|
|
1605
1613
|
commandMap
|
|
1606
1614
|
}) => {
|
|
1607
1615
|
// TODO create a commandMap per rpc instance
|
|
@@ -1613,7 +1621,7 @@ const create$4 = async ({
|
|
|
1613
1621
|
};
|
|
1614
1622
|
const NodeWorkerRpcClient = {
|
|
1615
1623
|
__proto__: null,
|
|
1616
|
-
create: create$
|
|
1624
|
+
create: create$6
|
|
1617
1625
|
};
|
|
1618
1626
|
|
|
1619
1627
|
const NodeWorker = 1;
|