@lvce-editor/ipc 10.0.4 → 10.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/dist/browser.js +13 -12
- package/dist/electron.js +80 -18
- package/dist/index.d.ts +1 -0
- package/dist/index.js +126 -79
- package/package.json +2 -2
package/dist/browser.js
CHANGED
|
@@ -143,6 +143,19 @@ const splitLines = lines => {
|
|
|
143
143
|
return lines.split(NewLine$1);
|
|
144
144
|
};
|
|
145
145
|
|
|
146
|
+
const isModuleNotFoundMessage = line => {
|
|
147
|
+
return line.includes('[ERR_MODULE_NOT_FOUND]');
|
|
148
|
+
};
|
|
149
|
+
const getModuleNotFoundError = stderr => {
|
|
150
|
+
const lines = splitLines(stderr);
|
|
151
|
+
const messageIndex = lines.findIndex(isModuleNotFoundMessage);
|
|
152
|
+
const message = lines[messageIndex];
|
|
153
|
+
return {
|
|
154
|
+
message,
|
|
155
|
+
code: ERR_MODULE_NOT_FOUND
|
|
156
|
+
};
|
|
157
|
+
};
|
|
158
|
+
|
|
146
159
|
const RE_NATIVE_MODULE_ERROR = /^innerError Error: Cannot find module '.*.node'/;
|
|
147
160
|
const RE_NATIVE_MODULE_ERROR_2 = /was compiled against a different Node.js version/;
|
|
148
161
|
const RE_MESSAGE_CODE_BLOCK_START = /^Error: The module '.*'$/;
|
|
@@ -191,18 +204,6 @@ const isModuleNotFoundError = stderr => {
|
|
|
191
204
|
}
|
|
192
205
|
return stderr.includes('ERR_MODULE_NOT_FOUND');
|
|
193
206
|
};
|
|
194
|
-
const isModuleNotFoundMessage = line => {
|
|
195
|
-
return line.includes('ERR_MODULE_NOT_FOUND');
|
|
196
|
-
};
|
|
197
|
-
const getModuleNotFoundError = stderr => {
|
|
198
|
-
const lines = splitLines(stderr);
|
|
199
|
-
const messageIndex = lines.findIndex(isModuleNotFoundMessage);
|
|
200
|
-
const message = lines[messageIndex];
|
|
201
|
-
return {
|
|
202
|
-
message,
|
|
203
|
-
code: ERR_MODULE_NOT_FOUND
|
|
204
|
-
};
|
|
205
|
-
};
|
|
206
207
|
const isNormalStackLine = line => {
|
|
207
208
|
return RE_AT.test(line) && !RE_AT_PROMISE_INDEX.test(line);
|
|
208
209
|
};
|
package/dist/electron.js
CHANGED
|
@@ -249,6 +249,19 @@ const splitLines = lines => {
|
|
|
249
249
|
return lines.split(NewLine$1);
|
|
250
250
|
};
|
|
251
251
|
|
|
252
|
+
const isModuleNotFoundMessage = line => {
|
|
253
|
+
return line.includes('[ERR_MODULE_NOT_FOUND]');
|
|
254
|
+
};
|
|
255
|
+
const getModuleNotFoundError = stderr => {
|
|
256
|
+
const lines = splitLines(stderr);
|
|
257
|
+
const messageIndex = lines.findIndex(isModuleNotFoundMessage);
|
|
258
|
+
const message = lines[messageIndex];
|
|
259
|
+
return {
|
|
260
|
+
message,
|
|
261
|
+
code: ERR_MODULE_NOT_FOUND
|
|
262
|
+
};
|
|
263
|
+
};
|
|
264
|
+
|
|
252
265
|
const RE_NATIVE_MODULE_ERROR = /^innerError Error: Cannot find module '.*.node'/;
|
|
253
266
|
const RE_NATIVE_MODULE_ERROR_2 = /was compiled against a different Node.js version/;
|
|
254
267
|
const RE_MESSAGE_CODE_BLOCK_START = /^Error: The module '.*'$/;
|
|
@@ -297,18 +310,6 @@ const isModuleNotFoundError = stderr => {
|
|
|
297
310
|
}
|
|
298
311
|
return stderr.includes('ERR_MODULE_NOT_FOUND');
|
|
299
312
|
};
|
|
300
|
-
const isModuleNotFoundMessage = line => {
|
|
301
|
-
return line.includes('ERR_MODULE_NOT_FOUND');
|
|
302
|
-
};
|
|
303
|
-
const getModuleNotFoundError = stderr => {
|
|
304
|
-
const lines = splitLines(stderr);
|
|
305
|
-
const messageIndex = lines.findIndex(isModuleNotFoundMessage);
|
|
306
|
-
const message = lines[messageIndex];
|
|
307
|
-
return {
|
|
308
|
-
message,
|
|
309
|
-
code: ERR_MODULE_NOT_FOUND
|
|
310
|
-
};
|
|
311
|
-
};
|
|
312
313
|
const isNormalStackLine = line => {
|
|
313
314
|
return RE_AT.test(line) && !RE_AT_PROMISE_INDEX.test(line);
|
|
314
315
|
};
|
|
@@ -500,14 +501,14 @@ class IpcParentWithElectronUtilityProcess extends Ipc {
|
|
|
500
501
|
this._rawIpc.on('message', callback);
|
|
501
502
|
}
|
|
502
503
|
}
|
|
503
|
-
const wrap$
|
|
504
|
+
const wrap$3 = process => {
|
|
504
505
|
return new IpcParentWithElectronUtilityProcess(process);
|
|
505
506
|
};
|
|
506
507
|
|
|
507
508
|
const IpcParentWithElectronUtilityProcess$1 = {
|
|
508
509
|
__proto__: null,
|
|
509
510
|
create: create$2,
|
|
510
|
-
wrap: wrap$
|
|
511
|
+
wrap: wrap$3
|
|
511
512
|
};
|
|
512
513
|
|
|
513
514
|
class ChildProcessError extends Error {
|
|
@@ -692,14 +693,14 @@ class IpcParentWithNodeForkedProcess extends Ipc {
|
|
|
692
693
|
this._rawIpc.on('message', callback);
|
|
693
694
|
}
|
|
694
695
|
}
|
|
695
|
-
const wrap$
|
|
696
|
+
const wrap$2 = childProcess => {
|
|
696
697
|
return new IpcParentWithNodeForkedProcess(childProcess);
|
|
697
698
|
};
|
|
698
699
|
|
|
699
700
|
const IpcParentWithNodeForkedProcess$1 = {
|
|
700
701
|
__proto__: null,
|
|
701
702
|
create: create$1,
|
|
702
|
-
wrap: wrap$
|
|
703
|
+
wrap: wrap$2
|
|
703
704
|
};
|
|
704
705
|
|
|
705
706
|
const addListener = (emitter, type, callback) => {
|
|
@@ -791,7 +792,7 @@ const create = async ({
|
|
|
791
792
|
};
|
|
792
793
|
|
|
793
794
|
// @ts-ignore
|
|
794
|
-
const wrap = worker => {
|
|
795
|
+
const wrap$1 = worker => {
|
|
795
796
|
return {
|
|
796
797
|
worker,
|
|
797
798
|
// @ts-ignore
|
|
@@ -826,7 +827,68 @@ const wrap = worker => {
|
|
|
826
827
|
const IpcParentWithNodeWorker = {
|
|
827
828
|
__proto__: null,
|
|
828
829
|
create,
|
|
830
|
+
wrap: wrap$1
|
|
831
|
+
};
|
|
832
|
+
|
|
833
|
+
const getActualDataElectron = event => {
|
|
834
|
+
const {
|
|
835
|
+
data,
|
|
836
|
+
ports
|
|
837
|
+
} = event;
|
|
838
|
+
if (ports.length === 0) {
|
|
839
|
+
return data;
|
|
840
|
+
}
|
|
841
|
+
return {
|
|
842
|
+
...data,
|
|
843
|
+
params: [...ports, ...data.params]
|
|
844
|
+
};
|
|
845
|
+
};
|
|
846
|
+
|
|
847
|
+
const listen = ({
|
|
848
|
+
messagePort
|
|
849
|
+
}) => {
|
|
850
|
+
if (!isMessagePortMain(messagePort)) {
|
|
851
|
+
throw new IpcError('port must be of type MessagePortMain');
|
|
852
|
+
}
|
|
853
|
+
return messagePort;
|
|
854
|
+
};
|
|
855
|
+
const signal = messagePort => {
|
|
856
|
+
messagePort.start();
|
|
857
|
+
};
|
|
858
|
+
class IpcParentWithElectronMessagePort extends Ipc {
|
|
859
|
+
constructor(port) {
|
|
860
|
+
super(port);
|
|
861
|
+
}
|
|
862
|
+
getData = getActualDataElectron;
|
|
863
|
+
send(message) {
|
|
864
|
+
this._rawIpc.postMessage(message);
|
|
865
|
+
}
|
|
866
|
+
sendAndTransfer(message) {
|
|
867
|
+
const {
|
|
868
|
+
newValue,
|
|
869
|
+
transfer
|
|
870
|
+
} = fixElectronParameters(message);
|
|
871
|
+
this._rawIpc.postMessage(newValue, transfer);
|
|
872
|
+
}
|
|
873
|
+
dispose() {
|
|
874
|
+
this._rawIpc.close();
|
|
875
|
+
}
|
|
876
|
+
onMessage(callback) {
|
|
877
|
+
this._rawIpc.on('message', callback);
|
|
878
|
+
}
|
|
879
|
+
onClose(callback) {
|
|
880
|
+
this._rawIpc.on('close', callback);
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
const wrap = messagePort => {
|
|
884
|
+
return new IpcParentWithElectronMessagePort(messagePort);
|
|
885
|
+
};
|
|
886
|
+
|
|
887
|
+
const IpcParentWithElectronMessagePort$1 = {
|
|
888
|
+
__proto__: null,
|
|
889
|
+
listen,
|
|
890
|
+
signal,
|
|
829
891
|
wrap
|
|
830
892
|
};
|
|
831
893
|
|
|
832
|
-
export { IpcParentWithElectronUtilityProcess$1 as IpcParentWithElectronUtilityProcess, IpcParentWithNodeForkedProcess$1 as IpcParentWithNodeForkedProcess, IpcParentWithNodeWorker };
|
|
894
|
+
export { IpcParentWithElectronMessagePort$1 as IpcParentWithElectronMessagePort, IpcParentWithElectronUtilityProcess$1 as IpcParentWithElectronUtilityProcess, IpcParentWithNodeForkedProcess$1 as IpcParentWithNodeForkedProcess, IpcParentWithNodeWorker };
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -97,6 +97,20 @@ const fixElectronParameters = value => {
|
|
|
97
97
|
};
|
|
98
98
|
};
|
|
99
99
|
|
|
100
|
+
const getActualDataElectron = event => {
|
|
101
|
+
const {
|
|
102
|
+
data,
|
|
103
|
+
ports
|
|
104
|
+
} = event;
|
|
105
|
+
if (ports.length === 0) {
|
|
106
|
+
return data;
|
|
107
|
+
}
|
|
108
|
+
return {
|
|
109
|
+
...data,
|
|
110
|
+
params: [...ports, ...data.params]
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
|
|
100
114
|
const attachEvents = that => {
|
|
101
115
|
const handleMessage = (...args) => {
|
|
102
116
|
const data = that.getData(...args);
|
|
@@ -133,6 +147,19 @@ const splitLines = lines => {
|
|
|
133
147
|
return lines.split(NewLine);
|
|
134
148
|
};
|
|
135
149
|
|
|
150
|
+
const isModuleNotFoundMessage = line => {
|
|
151
|
+
return line.includes('[ERR_MODULE_NOT_FOUND]');
|
|
152
|
+
};
|
|
153
|
+
const getModuleNotFoundError = stderr => {
|
|
154
|
+
const lines = splitLines(stderr);
|
|
155
|
+
const messageIndex = lines.findIndex(isModuleNotFoundMessage);
|
|
156
|
+
const message = lines[messageIndex];
|
|
157
|
+
return {
|
|
158
|
+
message,
|
|
159
|
+
code: ERR_MODULE_NOT_FOUND
|
|
160
|
+
};
|
|
161
|
+
};
|
|
162
|
+
|
|
136
163
|
const RE_NATIVE_MODULE_ERROR = /^innerError Error: Cannot find module '.*.node'/;
|
|
137
164
|
const RE_NATIVE_MODULE_ERROR_2 = /was compiled against a different Node.js version/;
|
|
138
165
|
const RE_MESSAGE_CODE_BLOCK_START = /^Error: The module '.*'$/;
|
|
@@ -181,18 +208,6 @@ const isModuleNotFoundError = stderr => {
|
|
|
181
208
|
}
|
|
182
209
|
return stderr.includes('ERR_MODULE_NOT_FOUND');
|
|
183
210
|
};
|
|
184
|
-
const isModuleNotFoundMessage = line => {
|
|
185
|
-
return line.includes('ERR_MODULE_NOT_FOUND');
|
|
186
|
-
};
|
|
187
|
-
const getModuleNotFoundError = stderr => {
|
|
188
|
-
const lines = splitLines(stderr);
|
|
189
|
-
const messageIndex = lines.findIndex(isModuleNotFoundMessage);
|
|
190
|
-
const message = lines[messageIndex];
|
|
191
|
-
return {
|
|
192
|
-
message,
|
|
193
|
-
code: ERR_MODULE_NOT_FOUND
|
|
194
|
-
};
|
|
195
|
-
};
|
|
196
211
|
const isNormalStackLine = line => {
|
|
197
212
|
return RE_AT.test(line) && !RE_AT_PROMISE_INDEX.test(line);
|
|
198
213
|
};
|
|
@@ -264,7 +279,7 @@ class IpcError extends VError {
|
|
|
264
279
|
}
|
|
265
280
|
}
|
|
266
281
|
|
|
267
|
-
const listen$
|
|
282
|
+
const listen$9 = ({
|
|
268
283
|
messagePort
|
|
269
284
|
}) => {
|
|
270
285
|
if (!isMessagePortMain(messagePort)) {
|
|
@@ -272,29 +287,14 @@ const listen$8 = ({
|
|
|
272
287
|
}
|
|
273
288
|
return messagePort;
|
|
274
289
|
};
|
|
275
|
-
const signal$
|
|
290
|
+
const signal$7 = messagePort => {
|
|
276
291
|
messagePort.start();
|
|
277
292
|
};
|
|
278
|
-
const getActualData$1 = event => {
|
|
279
|
-
const {
|
|
280
|
-
data,
|
|
281
|
-
ports
|
|
282
|
-
} = event;
|
|
283
|
-
if (ports.length === 0) {
|
|
284
|
-
return data;
|
|
285
|
-
}
|
|
286
|
-
return {
|
|
287
|
-
...data,
|
|
288
|
-
params: [...ports, ...data.params]
|
|
289
|
-
};
|
|
290
|
-
};
|
|
291
293
|
class IpcChildWithElectronMessagePort extends Ipc {
|
|
292
294
|
constructor(port) {
|
|
293
295
|
super(port);
|
|
294
296
|
}
|
|
295
|
-
getData
|
|
296
|
-
return getActualData$1(event);
|
|
297
|
-
}
|
|
297
|
+
getData = getActualDataElectron;
|
|
298
298
|
send(message) {
|
|
299
299
|
this._rawIpc.postMessage(message);
|
|
300
300
|
}
|
|
@@ -315,15 +315,15 @@ class IpcChildWithElectronMessagePort extends Ipc {
|
|
|
315
315
|
this._rawIpc.on('close', callback);
|
|
316
316
|
}
|
|
317
317
|
}
|
|
318
|
-
const wrap$
|
|
318
|
+
const wrap$c = messagePort => {
|
|
319
319
|
return new IpcChildWithElectronMessagePort(messagePort);
|
|
320
320
|
};
|
|
321
321
|
|
|
322
322
|
const IpcChildWithElectronMessagePort$1 = {
|
|
323
323
|
__proto__: null,
|
|
324
|
-
listen: listen$
|
|
325
|
-
signal: signal$
|
|
326
|
-
wrap: wrap$
|
|
324
|
+
listen: listen$9,
|
|
325
|
+
signal: signal$7,
|
|
326
|
+
wrap: wrap$c
|
|
327
327
|
};
|
|
328
328
|
|
|
329
329
|
// @ts-ignore
|
|
@@ -343,7 +343,7 @@ const getUtilityProcessPortData = event => {
|
|
|
343
343
|
|
|
344
344
|
const readyMessage = 'ready';
|
|
345
345
|
|
|
346
|
-
const listen$
|
|
346
|
+
const listen$8 = () => {
|
|
347
347
|
// @ts-ignore
|
|
348
348
|
const {
|
|
349
349
|
parentPort
|
|
@@ -353,7 +353,7 @@ const listen$7 = () => {
|
|
|
353
353
|
}
|
|
354
354
|
return parentPort;
|
|
355
355
|
};
|
|
356
|
-
const signal$
|
|
356
|
+
const signal$6 = parentPort => {
|
|
357
357
|
parentPort.postMessage(readyMessage);
|
|
358
358
|
};
|
|
359
359
|
class IpcChildWithElectronUtilityProcess extends Ipc {
|
|
@@ -380,29 +380,29 @@ class IpcChildWithElectronUtilityProcess extends Ipc {
|
|
|
380
380
|
this._rawIpc.on('message', callback);
|
|
381
381
|
}
|
|
382
382
|
}
|
|
383
|
-
const wrap$
|
|
383
|
+
const wrap$b = parentPort => {
|
|
384
384
|
return new IpcChildWithElectronUtilityProcess(parentPort);
|
|
385
385
|
};
|
|
386
386
|
|
|
387
387
|
const IpcChildWithElectronUtilityProcess$1 = {
|
|
388
388
|
__proto__: null,
|
|
389
|
-
listen: listen$
|
|
390
|
-
signal: signal$
|
|
391
|
-
wrap: wrap$
|
|
389
|
+
listen: listen$8,
|
|
390
|
+
signal: signal$6,
|
|
391
|
+
wrap: wrap$b
|
|
392
392
|
};
|
|
393
393
|
|
|
394
394
|
const getData$1 = event => {
|
|
395
395
|
return event.data;
|
|
396
396
|
};
|
|
397
397
|
|
|
398
|
-
const listen$
|
|
398
|
+
const listen$7 = () => {
|
|
399
399
|
// @ts-ignore
|
|
400
400
|
if (typeof WorkerGlobalScope === 'undefined') {
|
|
401
401
|
throw new TypeError('module is not in web worker scope');
|
|
402
402
|
}
|
|
403
403
|
return globalThis;
|
|
404
404
|
};
|
|
405
|
-
const signal$
|
|
405
|
+
const signal$5 = global => {
|
|
406
406
|
global.postMessage(readyMessage);
|
|
407
407
|
};
|
|
408
408
|
class IpcChildWithModuleWorker extends Ipc {
|
|
@@ -428,15 +428,15 @@ class IpcChildWithModuleWorker extends Ipc {
|
|
|
428
428
|
this._rawIpc.addEventListener('message', callback);
|
|
429
429
|
}
|
|
430
430
|
}
|
|
431
|
-
const wrap$
|
|
431
|
+
const wrap$a = global => {
|
|
432
432
|
return new IpcChildWithModuleWorker(global);
|
|
433
433
|
};
|
|
434
434
|
|
|
435
435
|
const IpcChildWithModuleWorker$1 = {
|
|
436
436
|
__proto__: null,
|
|
437
|
-
listen: listen$
|
|
438
|
-
signal: signal$
|
|
439
|
-
wrap: wrap$
|
|
437
|
+
listen: listen$7,
|
|
438
|
+
signal: signal$5,
|
|
439
|
+
wrap: wrap$a
|
|
440
440
|
};
|
|
441
441
|
|
|
442
442
|
const withResolvers = () => {
|
|
@@ -463,10 +463,10 @@ const waitForFirstMessage = async port => {
|
|
|
463
463
|
return event.data;
|
|
464
464
|
};
|
|
465
465
|
|
|
466
|
-
const listen$
|
|
467
|
-
const parentIpcRaw = listen$
|
|
468
|
-
signal$
|
|
469
|
-
const parentIpc = wrap$
|
|
466
|
+
const listen$6 = async () => {
|
|
467
|
+
const parentIpcRaw = listen$7();
|
|
468
|
+
signal$5(parentIpcRaw);
|
|
469
|
+
const parentIpc = wrap$a(parentIpcRaw);
|
|
470
470
|
const firstMessage = await waitForFirstMessage(parentIpc);
|
|
471
471
|
if (firstMessage.method !== 'initialize') {
|
|
472
472
|
throw new IpcError('unexpected first message');
|
|
@@ -506,14 +506,14 @@ class IpcChildWithModuleWorkerAndMessagePort extends Ipc {
|
|
|
506
506
|
this._rawIpc.start();
|
|
507
507
|
}
|
|
508
508
|
}
|
|
509
|
-
const wrap$
|
|
509
|
+
const wrap$9 = port => {
|
|
510
510
|
return new IpcChildWithModuleWorkerAndMessagePort(port);
|
|
511
511
|
};
|
|
512
512
|
|
|
513
513
|
const IpcChildWithModuleWorkerAndMessagePort$1 = {
|
|
514
514
|
__proto__: null,
|
|
515
|
-
listen: listen$
|
|
516
|
-
wrap: wrap$
|
|
515
|
+
listen: listen$6,
|
|
516
|
+
wrap: wrap$9
|
|
517
517
|
};
|
|
518
518
|
|
|
519
519
|
const getTransferrablesNode = value => {
|
|
@@ -534,13 +534,13 @@ const getActualData = (message, handle) => {
|
|
|
534
534
|
return message;
|
|
535
535
|
};
|
|
536
536
|
|
|
537
|
-
const listen$
|
|
537
|
+
const listen$5 = async () => {
|
|
538
538
|
if (!process.send) {
|
|
539
539
|
throw new Error('process.send must be defined');
|
|
540
540
|
}
|
|
541
541
|
return process;
|
|
542
542
|
};
|
|
543
|
-
const signal$
|
|
543
|
+
const signal$4 = process => {
|
|
544
544
|
process.send(readyMessage);
|
|
545
545
|
};
|
|
546
546
|
class IpcChildWithNodeForkedProcess extends Ipc {
|
|
@@ -567,18 +567,18 @@ class IpcChildWithNodeForkedProcess extends Ipc {
|
|
|
567
567
|
// ignore
|
|
568
568
|
}
|
|
569
569
|
}
|
|
570
|
-
const wrap$
|
|
570
|
+
const wrap$8 = process => {
|
|
571
571
|
return new IpcChildWithNodeForkedProcess(process);
|
|
572
572
|
};
|
|
573
573
|
|
|
574
574
|
const IpcChildWithNodeForkedProcess$1 = {
|
|
575
575
|
__proto__: null,
|
|
576
|
-
listen: listen$
|
|
577
|
-
signal: signal$
|
|
578
|
-
wrap: wrap$
|
|
576
|
+
listen: listen$5,
|
|
577
|
+
signal: signal$4,
|
|
578
|
+
wrap: wrap$8
|
|
579
579
|
};
|
|
580
580
|
|
|
581
|
-
const listen$
|
|
581
|
+
const listen$4 = async ({
|
|
582
582
|
messagePort
|
|
583
583
|
}) => {
|
|
584
584
|
if (!isMessagePort(messagePort)) {
|
|
@@ -586,10 +586,10 @@ const listen$3 = async ({
|
|
|
586
586
|
}
|
|
587
587
|
return messagePort;
|
|
588
588
|
};
|
|
589
|
-
const signal$
|
|
589
|
+
const signal$3 = messagePort => {
|
|
590
590
|
messagePort.start();
|
|
591
591
|
};
|
|
592
|
-
const wrap$
|
|
592
|
+
const wrap$7 = port => {
|
|
593
593
|
return {
|
|
594
594
|
port,
|
|
595
595
|
on(event, listener) {
|
|
@@ -619,12 +619,12 @@ const wrap$6 = port => {
|
|
|
619
619
|
|
|
620
620
|
const IpcChildWithNodeMessagePort = {
|
|
621
621
|
__proto__: null,
|
|
622
|
-
listen: listen$
|
|
623
|
-
signal: signal$
|
|
624
|
-
wrap: wrap$
|
|
622
|
+
listen: listen$4,
|
|
623
|
+
signal: signal$3,
|
|
624
|
+
wrap: wrap$7
|
|
625
625
|
};
|
|
626
626
|
|
|
627
|
-
const listen$
|
|
627
|
+
const listen$3 = async () => {
|
|
628
628
|
const {
|
|
629
629
|
parentPort
|
|
630
630
|
} = await import('node:worker_threads');
|
|
@@ -633,10 +633,10 @@ const listen$2 = async () => {
|
|
|
633
633
|
}
|
|
634
634
|
return parentPort;
|
|
635
635
|
};
|
|
636
|
-
const signal$
|
|
636
|
+
const signal$2 = parentPort => {
|
|
637
637
|
parentPort.postMessage(readyMessage);
|
|
638
638
|
};
|
|
639
|
-
const wrap$
|
|
639
|
+
const wrap$6 = parentPort => {
|
|
640
640
|
return {
|
|
641
641
|
parentPort,
|
|
642
642
|
on(event, listener) {
|
|
@@ -663,13 +663,13 @@ const wrap$5 = parentPort => {
|
|
|
663
663
|
|
|
664
664
|
const IpcChildWithNodeWorker = {
|
|
665
665
|
__proto__: null,
|
|
666
|
-
listen: listen$
|
|
667
|
-
signal: signal$
|
|
668
|
-
wrap: wrap$
|
|
666
|
+
listen: listen$3,
|
|
667
|
+
signal: signal$2,
|
|
668
|
+
wrap: wrap$6
|
|
669
669
|
};
|
|
670
670
|
|
|
671
671
|
const preloadChannelType = 'port';
|
|
672
|
-
const listen$
|
|
672
|
+
const listen$2 = ({
|
|
673
673
|
webContents
|
|
674
674
|
}) => {
|
|
675
675
|
return webContents;
|
|
@@ -706,14 +706,14 @@ class IpcChildWithRendererProcess2 extends Ipc {
|
|
|
706
706
|
this._rawIpc.on('destroyed', callback);
|
|
707
707
|
}
|
|
708
708
|
}
|
|
709
|
-
const wrap$
|
|
709
|
+
const wrap$5 = webContents => {
|
|
710
710
|
return new IpcChildWithRendererProcess2(webContents);
|
|
711
711
|
};
|
|
712
712
|
|
|
713
713
|
const IpcChildWithRendererProcess2$1 = {
|
|
714
714
|
__proto__: null,
|
|
715
|
-
listen: listen$
|
|
716
|
-
wrap: wrap$
|
|
715
|
+
listen: listen$2,
|
|
716
|
+
wrap: wrap$5
|
|
717
717
|
};
|
|
718
718
|
|
|
719
719
|
const Open = 1;
|
|
@@ -817,7 +817,7 @@ const handleUpgrade = async (...args) => {
|
|
|
817
817
|
};
|
|
818
818
|
|
|
819
819
|
// @ts-ignore
|
|
820
|
-
const listen = async ({
|
|
820
|
+
const listen$1 = async ({
|
|
821
821
|
request,
|
|
822
822
|
handle
|
|
823
823
|
}) => {
|
|
@@ -834,12 +834,12 @@ const listen = async ({
|
|
|
834
834
|
}
|
|
835
835
|
return webSocket;
|
|
836
836
|
};
|
|
837
|
-
const signal = webSocket => {
|
|
837
|
+
const signal$1 = webSocket => {
|
|
838
838
|
webSocket.resume();
|
|
839
839
|
};
|
|
840
840
|
|
|
841
841
|
// @ts-ignore
|
|
842
|
-
const wrap$
|
|
842
|
+
const wrap$4 = webSocket => {
|
|
843
843
|
return {
|
|
844
844
|
webSocket,
|
|
845
845
|
/**
|
|
@@ -887,6 +887,53 @@ const wrap$3 = webSocket => {
|
|
|
887
887
|
};
|
|
888
888
|
|
|
889
889
|
const IpcChildWithWebSocket = {
|
|
890
|
+
__proto__: null,
|
|
891
|
+
listen: listen$1,
|
|
892
|
+
signal: signal$1,
|
|
893
|
+
wrap: wrap$4
|
|
894
|
+
};
|
|
895
|
+
|
|
896
|
+
const listen = ({
|
|
897
|
+
messagePort
|
|
898
|
+
}) => {
|
|
899
|
+
if (!isMessagePortMain(messagePort)) {
|
|
900
|
+
throw new IpcError('port must be of type MessagePortMain');
|
|
901
|
+
}
|
|
902
|
+
return messagePort;
|
|
903
|
+
};
|
|
904
|
+
const signal = messagePort => {
|
|
905
|
+
messagePort.start();
|
|
906
|
+
};
|
|
907
|
+
class IpcParentWithElectronMessagePort extends Ipc {
|
|
908
|
+
constructor(port) {
|
|
909
|
+
super(port);
|
|
910
|
+
}
|
|
911
|
+
getData = getActualDataElectron;
|
|
912
|
+
send(message) {
|
|
913
|
+
this._rawIpc.postMessage(message);
|
|
914
|
+
}
|
|
915
|
+
sendAndTransfer(message) {
|
|
916
|
+
const {
|
|
917
|
+
newValue,
|
|
918
|
+
transfer
|
|
919
|
+
} = fixElectronParameters(message);
|
|
920
|
+
this._rawIpc.postMessage(newValue, transfer);
|
|
921
|
+
}
|
|
922
|
+
dispose() {
|
|
923
|
+
this._rawIpc.close();
|
|
924
|
+
}
|
|
925
|
+
onMessage(callback) {
|
|
926
|
+
this._rawIpc.on('message', callback);
|
|
927
|
+
}
|
|
928
|
+
onClose(callback) {
|
|
929
|
+
this._rawIpc.on('close', callback);
|
|
930
|
+
}
|
|
931
|
+
}
|
|
932
|
+
const wrap$3 = messagePort => {
|
|
933
|
+
return new IpcParentWithElectronMessagePort(messagePort);
|
|
934
|
+
};
|
|
935
|
+
|
|
936
|
+
const IpcParentWithElectronMessagePort$1 = {
|
|
890
937
|
__proto__: null,
|
|
891
938
|
listen,
|
|
892
939
|
signal,
|
|
@@ -1318,4 +1365,4 @@ const IpcParentWithNodeWorker = {
|
|
|
1318
1365
|
wrap
|
|
1319
1366
|
};
|
|
1320
1367
|
|
|
1321
|
-
export { IpcChildWithElectronMessagePort$1 as IpcChildWithElectronMessagePort, IpcChildWithElectronUtilityProcess$1 as IpcChildWithElectronUtilityProcess, IpcChildWithModuleWorker$1 as IpcChildWithModuleWorker, IpcChildWithModuleWorkerAndMessagePort$1 as IpcChildWithModuleWorkerAndMessagePort, IpcChildWithNodeForkedProcess$1 as IpcChildWithNodeForkedProcess, IpcChildWithNodeMessagePort, IpcChildWithNodeWorker, IpcChildWithRendererProcess2$1 as IpcChildWithRendererProcess2, IpcChildWithWebSocket, IpcParentWithElectronUtilityProcess$1 as IpcParentWithElectronUtilityProcess, IpcParentWithNodeForkedProcess$1 as IpcParentWithNodeForkedProcess, IpcParentWithNodeWorker };
|
|
1368
|
+
export { IpcChildWithElectronMessagePort$1 as IpcChildWithElectronMessagePort, IpcChildWithElectronUtilityProcess$1 as IpcChildWithElectronUtilityProcess, IpcChildWithModuleWorker$1 as IpcChildWithModuleWorker, IpcChildWithModuleWorkerAndMessagePort$1 as IpcChildWithModuleWorkerAndMessagePort, IpcChildWithNodeForkedProcess$1 as IpcChildWithNodeForkedProcess, IpcChildWithNodeMessagePort, IpcChildWithNodeWorker, IpcChildWithRendererProcess2$1 as IpcChildWithRendererProcess2, IpcChildWithWebSocket, IpcParentWithElectronMessagePort$1 as IpcParentWithElectronMessagePort, IpcParentWithElectronUtilityProcess$1 as IpcParentWithElectronUtilityProcess, IpcParentWithNodeForkedProcess$1 as IpcParentWithNodeForkedProcess, IpcParentWithNodeWorker };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lvce-editor/ipc",
|
|
3
|
-
"version": "10.0
|
|
3
|
+
"version": "10.2.0",
|
|
4
4
|
"description": "Inter Process Communication for Lvce Editor",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"url": "https://github.com/lvce-editor/ipc.git"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@lvce-editor/assert": "^1.
|
|
17
|
+
"@lvce-editor/assert": "^1.3.0",
|
|
18
18
|
"@lvce-editor/verror": "^1.4.0",
|
|
19
19
|
"@lvce-editor/web-socket-server": "^1.3.0"
|
|
20
20
|
},
|