@lvce-editor/ipc 13.0.0 → 13.1.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.d.ts +1 -0
- package/dist/index.js +190 -120
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -33,3 +33,4 @@ export const IpcParentWithElectronMessagePort: IpcParent
|
|
|
33
33
|
export const IpcParentWithMessagePort: IpcParent
|
|
34
34
|
export const IpcParentWithWebSocket: IpcParent
|
|
35
35
|
export const IpcParentWithModuleWorker: IpcParent
|
|
36
|
+
export const IpcParentWithModuleWorkerAndWorkaroundForChromeDevtoolsBug: IpcParent
|
package/dist/index.js
CHANGED
|
@@ -139,36 +139,41 @@ const ERR_MODULE_NOT_FOUND = 'ERR_MODULE_NOT_FOUND';
|
|
|
139
139
|
|
|
140
140
|
const NewLine = '\n';
|
|
141
141
|
|
|
142
|
-
const
|
|
143
|
-
return lines.
|
|
142
|
+
const joinLines = lines => {
|
|
143
|
+
return lines.join(NewLine);
|
|
144
144
|
};
|
|
145
145
|
|
|
146
|
-
const
|
|
147
|
-
|
|
146
|
+
const RE_AT = /^\s+at/;
|
|
147
|
+
const RE_AT_PROMISE_INDEX = /^\s*at async Promise.all \(index \d+\)$/;
|
|
148
|
+
const isNormalStackLine = line => {
|
|
149
|
+
return RE_AT.test(line) && !RE_AT_PROMISE_INDEX.test(line);
|
|
148
150
|
};
|
|
149
|
-
const
|
|
150
|
-
const
|
|
151
|
-
|
|
152
|
-
|
|
151
|
+
const getDetails = lines => {
|
|
152
|
+
const index = lines.findIndex(isNormalStackLine);
|
|
153
|
+
if (index === -1) {
|
|
154
|
+
return {
|
|
155
|
+
actualMessage: joinLines(lines),
|
|
156
|
+
rest: []
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
let lastIndex = index - 1;
|
|
160
|
+
while (++lastIndex < lines.length) {
|
|
161
|
+
if (!isNormalStackLine(lines[lastIndex])) {
|
|
162
|
+
break;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
153
165
|
return {
|
|
154
|
-
|
|
155
|
-
|
|
166
|
+
actualMessage: lines[index - 1],
|
|
167
|
+
rest: lines.slice(index, lastIndex)
|
|
156
168
|
};
|
|
157
169
|
};
|
|
158
170
|
|
|
159
|
-
const
|
|
160
|
-
return lines.
|
|
171
|
+
const splitLines = lines => {
|
|
172
|
+
return lines.split(NewLine);
|
|
161
173
|
};
|
|
162
174
|
|
|
163
|
-
const RE_NATIVE_MODULE_ERROR = /^innerError Error: Cannot find module '.*.node'/;
|
|
164
|
-
const RE_NATIVE_MODULE_ERROR_2 = /was compiled against a different Node.js version/;
|
|
165
175
|
const RE_MESSAGE_CODE_BLOCK_START = /^Error: The module '.*'$/;
|
|
166
176
|
const RE_MESSAGE_CODE_BLOCK_END = /^\s* at/;
|
|
167
|
-
const RE_AT = /^\s+at/;
|
|
168
|
-
const RE_AT_PROMISE_INDEX = /^\s*at async Promise.all \(index \d+\)$/;
|
|
169
|
-
const isUnhelpfulNativeModuleError = stderr => {
|
|
170
|
-
return RE_NATIVE_MODULE_ERROR.test(stderr) && RE_NATIVE_MODULE_ERROR_2.test(stderr);
|
|
171
|
-
};
|
|
172
177
|
const isMessageCodeBlockStartIndex = line => {
|
|
173
178
|
return RE_MESSAGE_CODE_BLOCK_START.test(line);
|
|
174
179
|
};
|
|
@@ -183,51 +188,51 @@ const getMessageCodeBlock = stderr => {
|
|
|
183
188
|
const relevantMessage = relevantLines.join(' ').slice('Error: '.length);
|
|
184
189
|
return relevantMessage;
|
|
185
190
|
};
|
|
186
|
-
|
|
187
|
-
|
|
191
|
+
|
|
192
|
+
const isModuleNotFoundMessage = line => {
|
|
193
|
+
return line.includes('[ERR_MODULE_NOT_FOUND]');
|
|
194
|
+
};
|
|
195
|
+
const getModuleNotFoundError = stderr => {
|
|
196
|
+
const lines = splitLines(stderr);
|
|
197
|
+
const messageIndex = lines.findIndex(isModuleNotFoundMessage);
|
|
198
|
+
const message = lines[messageIndex];
|
|
188
199
|
return {
|
|
189
|
-
message
|
|
190
|
-
code:
|
|
200
|
+
message,
|
|
201
|
+
code: ERR_MODULE_NOT_FOUND
|
|
191
202
|
};
|
|
192
203
|
};
|
|
193
|
-
|
|
204
|
+
|
|
205
|
+
const isModuleNotFoundError = stderr => {
|
|
194
206
|
if (!stderr) {
|
|
195
207
|
return false;
|
|
196
208
|
}
|
|
197
|
-
return stderr.includes('
|
|
198
|
-
};
|
|
199
|
-
const getModuleSyntaxError = () => {
|
|
200
|
-
return {
|
|
201
|
-
message: `ES Modules are not supported in electron`,
|
|
202
|
-
code: E_MODULES_NOT_SUPPORTED_IN_ELECTRON
|
|
203
|
-
};
|
|
209
|
+
return stderr.includes('ERR_MODULE_NOT_FOUND');
|
|
204
210
|
};
|
|
205
|
-
|
|
211
|
+
|
|
212
|
+
const isModulesSyntaxError = stderr => {
|
|
206
213
|
if (!stderr) {
|
|
207
214
|
return false;
|
|
208
215
|
}
|
|
209
|
-
return stderr.includes('
|
|
216
|
+
return stderr.includes('SyntaxError: Cannot use import statement outside a module');
|
|
210
217
|
};
|
|
211
|
-
|
|
212
|
-
|
|
218
|
+
|
|
219
|
+
const RE_NATIVE_MODULE_ERROR = /^innerError Error: Cannot find module '.*.node'/;
|
|
220
|
+
const RE_NATIVE_MODULE_ERROR_2 = /was compiled against a different Node.js version/;
|
|
221
|
+
const isUnhelpfulNativeModuleError = stderr => {
|
|
222
|
+
return RE_NATIVE_MODULE_ERROR.test(stderr) && RE_NATIVE_MODULE_ERROR_2.test(stderr);
|
|
213
223
|
};
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
return {
|
|
218
|
-
actualMessage: joinLines(lines),
|
|
219
|
-
rest: []
|
|
220
|
-
};
|
|
221
|
-
}
|
|
222
|
-
let lastIndex = index - 1;
|
|
223
|
-
while (++lastIndex < lines.length) {
|
|
224
|
-
if (!isNormalStackLine(lines[lastIndex])) {
|
|
225
|
-
break;
|
|
226
|
-
}
|
|
227
|
-
}
|
|
224
|
+
|
|
225
|
+
const getNativeModuleErrorMessage = stderr => {
|
|
226
|
+
const message = getMessageCodeBlock(stderr);
|
|
228
227
|
return {
|
|
229
|
-
|
|
230
|
-
|
|
228
|
+
message: `Incompatible native node module: ${message}`,
|
|
229
|
+
code: E_INCOMPATIBLE_NATIVE_MODULE
|
|
230
|
+
};
|
|
231
|
+
};
|
|
232
|
+
const getModuleSyntaxError = () => {
|
|
233
|
+
return {
|
|
234
|
+
message: `ES Modules are not supported in electron`,
|
|
235
|
+
code: E_MODULES_NOT_SUPPORTED_IN_ELECTRON
|
|
231
236
|
};
|
|
232
237
|
};
|
|
233
238
|
const getHelpfulChildProcessError = (stdout, stderr) => {
|
|
@@ -287,7 +292,7 @@ const listen$b = ({
|
|
|
287
292
|
}
|
|
288
293
|
return messagePort;
|
|
289
294
|
};
|
|
290
|
-
const signal$
|
|
295
|
+
const signal$c = messagePort => {
|
|
291
296
|
messagePort.start();
|
|
292
297
|
};
|
|
293
298
|
class IpcChildWithElectronMessagePort extends Ipc {
|
|
@@ -312,15 +317,15 @@ class IpcChildWithElectronMessagePort extends Ipc {
|
|
|
312
317
|
this._rawIpc.on('close', callback);
|
|
313
318
|
}
|
|
314
319
|
}
|
|
315
|
-
const wrap$
|
|
320
|
+
const wrap$j = messagePort => {
|
|
316
321
|
return new IpcChildWithElectronMessagePort(messagePort);
|
|
317
322
|
};
|
|
318
323
|
|
|
319
324
|
const IpcChildWithElectronMessagePort$1 = {
|
|
320
325
|
__proto__: null,
|
|
321
326
|
listen: listen$b,
|
|
322
|
-
signal: signal$
|
|
323
|
-
wrap: wrap$
|
|
327
|
+
signal: signal$c,
|
|
328
|
+
wrap: wrap$j
|
|
324
329
|
};
|
|
325
330
|
|
|
326
331
|
// @ts-ignore
|
|
@@ -350,7 +355,7 @@ const listen$a = () => {
|
|
|
350
355
|
}
|
|
351
356
|
return parentPort;
|
|
352
357
|
};
|
|
353
|
-
const signal$
|
|
358
|
+
const signal$b = parentPort => {
|
|
354
359
|
parentPort.postMessage(readyMessage);
|
|
355
360
|
};
|
|
356
361
|
class IpcChildWithElectronUtilityProcess extends Ipc {
|
|
@@ -377,15 +382,15 @@ class IpcChildWithElectronUtilityProcess extends Ipc {
|
|
|
377
382
|
this._rawIpc.on('message', callback);
|
|
378
383
|
}
|
|
379
384
|
}
|
|
380
|
-
const wrap$
|
|
385
|
+
const wrap$i = parentPort => {
|
|
381
386
|
return new IpcChildWithElectronUtilityProcess(parentPort);
|
|
382
387
|
};
|
|
383
388
|
|
|
384
389
|
const IpcChildWithElectronUtilityProcess$1 = {
|
|
385
390
|
__proto__: null,
|
|
386
391
|
listen: listen$a,
|
|
387
|
-
signal: signal$
|
|
388
|
-
wrap: wrap$
|
|
392
|
+
signal: signal$b,
|
|
393
|
+
wrap: wrap$i
|
|
389
394
|
};
|
|
390
395
|
|
|
391
396
|
const getData$2 = event => {
|
|
@@ -395,7 +400,7 @@ const getData$2 = event => {
|
|
|
395
400
|
const listen$9 = () => {
|
|
396
401
|
return window;
|
|
397
402
|
};
|
|
398
|
-
const signal$
|
|
403
|
+
const signal$a = global => {
|
|
399
404
|
global.postMessage(readyMessage);
|
|
400
405
|
};
|
|
401
406
|
class IpcChildWithElectronWindow extends Ipc {
|
|
@@ -432,15 +437,15 @@ class IpcChildWithElectronWindow extends Ipc {
|
|
|
432
437
|
this._rawIpc.addEventListener('message', wrapped);
|
|
433
438
|
}
|
|
434
439
|
}
|
|
435
|
-
const wrap$
|
|
440
|
+
const wrap$h = window => {
|
|
436
441
|
return new IpcChildWithElectronWindow(window);
|
|
437
442
|
};
|
|
438
443
|
|
|
439
444
|
const IpcChildWithElectronWindow$1 = {
|
|
440
445
|
__proto__: null,
|
|
441
446
|
listen: listen$9,
|
|
442
|
-
signal: signal$
|
|
443
|
-
wrap: wrap$
|
|
447
|
+
signal: signal$a,
|
|
448
|
+
wrap: wrap$h
|
|
444
449
|
};
|
|
445
450
|
|
|
446
451
|
const listen$8 = ({
|
|
@@ -448,7 +453,7 @@ const listen$8 = ({
|
|
|
448
453
|
}) => {
|
|
449
454
|
return port;
|
|
450
455
|
};
|
|
451
|
-
const signal$
|
|
456
|
+
const signal$9 = port => {
|
|
452
457
|
port.postMessage(readyMessage);
|
|
453
458
|
};
|
|
454
459
|
class IpcChildWithMessagePort extends Ipc {
|
|
@@ -473,15 +478,15 @@ class IpcChildWithMessagePort extends Ipc {
|
|
|
473
478
|
this._rawIpc.start();
|
|
474
479
|
}
|
|
475
480
|
}
|
|
476
|
-
const wrap$
|
|
481
|
+
const wrap$g = port => {
|
|
477
482
|
return new IpcChildWithMessagePort(port);
|
|
478
483
|
};
|
|
479
484
|
|
|
480
485
|
const IpcChildWithMessagePort$1 = {
|
|
481
486
|
__proto__: null,
|
|
482
487
|
listen: listen$8,
|
|
483
|
-
signal: signal$
|
|
484
|
-
wrap: wrap$
|
|
488
|
+
signal: signal$9,
|
|
489
|
+
wrap: wrap$g
|
|
485
490
|
};
|
|
486
491
|
|
|
487
492
|
const listen$7 = () => {
|
|
@@ -491,7 +496,7 @@ const listen$7 = () => {
|
|
|
491
496
|
}
|
|
492
497
|
return globalThis;
|
|
493
498
|
};
|
|
494
|
-
const signal$
|
|
499
|
+
const signal$8 = global => {
|
|
495
500
|
global.postMessage(readyMessage);
|
|
496
501
|
};
|
|
497
502
|
class IpcChildWithModuleWorker extends Ipc {
|
|
@@ -517,15 +522,15 @@ class IpcChildWithModuleWorker extends Ipc {
|
|
|
517
522
|
this._rawIpc.addEventListener('message', callback);
|
|
518
523
|
}
|
|
519
524
|
}
|
|
520
|
-
const wrap$
|
|
525
|
+
const wrap$f = global => {
|
|
521
526
|
return new IpcChildWithModuleWorker(global);
|
|
522
527
|
};
|
|
523
528
|
|
|
524
529
|
const IpcChildWithModuleWorker$1 = {
|
|
525
530
|
__proto__: null,
|
|
526
531
|
listen: listen$7,
|
|
527
|
-
signal: signal$
|
|
528
|
-
wrap: wrap$
|
|
532
|
+
signal: signal$8,
|
|
533
|
+
wrap: wrap$f
|
|
529
534
|
};
|
|
530
535
|
|
|
531
536
|
const withResolvers = () => {
|
|
@@ -555,8 +560,8 @@ const waitForFirstMessage = async port => {
|
|
|
555
560
|
|
|
556
561
|
const listen$6 = async () => {
|
|
557
562
|
const parentIpcRaw = listen$7();
|
|
558
|
-
signal$
|
|
559
|
-
const parentIpc = wrap$
|
|
563
|
+
signal$8(parentIpcRaw);
|
|
564
|
+
const parentIpc = wrap$f(parentIpcRaw);
|
|
560
565
|
const firstMessage = await waitForFirstMessage(parentIpc);
|
|
561
566
|
if (firstMessage.method !== 'initialize') {
|
|
562
567
|
throw new IpcError('unexpected first message');
|
|
@@ -598,14 +603,14 @@ class IpcChildWithModuleWorkerAndMessagePort extends Ipc {
|
|
|
598
603
|
this._rawIpc.start();
|
|
599
604
|
}
|
|
600
605
|
}
|
|
601
|
-
const wrap$
|
|
606
|
+
const wrap$e = port => {
|
|
602
607
|
return new IpcChildWithModuleWorkerAndMessagePort(port);
|
|
603
608
|
};
|
|
604
609
|
|
|
605
610
|
const IpcChildWithModuleWorkerAndMessagePort$1 = {
|
|
606
611
|
__proto__: null,
|
|
607
612
|
listen: listen$6,
|
|
608
|
-
wrap: wrap$
|
|
613
|
+
wrap: wrap$e
|
|
609
614
|
};
|
|
610
615
|
|
|
611
616
|
const getActualData = (message, handle) => {
|
|
@@ -632,7 +637,7 @@ const listen$5 = async () => {
|
|
|
632
637
|
}
|
|
633
638
|
return process;
|
|
634
639
|
};
|
|
635
|
-
const signal$
|
|
640
|
+
const signal$7 = process => {
|
|
636
641
|
process.send(readyMessage);
|
|
637
642
|
};
|
|
638
643
|
class IpcChildWithNodeForkedProcess extends Ipc {
|
|
@@ -656,15 +661,15 @@ class IpcChildWithNodeForkedProcess extends Ipc {
|
|
|
656
661
|
// ignore
|
|
657
662
|
}
|
|
658
663
|
}
|
|
659
|
-
const wrap$
|
|
664
|
+
const wrap$d = process => {
|
|
660
665
|
return new IpcChildWithNodeForkedProcess(process);
|
|
661
666
|
};
|
|
662
667
|
|
|
663
668
|
const IpcChildWithNodeForkedProcess$1 = {
|
|
664
669
|
__proto__: null,
|
|
665
670
|
listen: listen$5,
|
|
666
|
-
signal: signal$
|
|
667
|
-
wrap: wrap$
|
|
671
|
+
signal: signal$7,
|
|
672
|
+
wrap: wrap$d
|
|
668
673
|
};
|
|
669
674
|
|
|
670
675
|
const listen$4 = async ({
|
|
@@ -675,10 +680,10 @@ const listen$4 = async ({
|
|
|
675
680
|
}
|
|
676
681
|
return messagePort;
|
|
677
682
|
};
|
|
678
|
-
const signal$
|
|
683
|
+
const signal$6 = messagePort => {
|
|
679
684
|
messagePort.start();
|
|
680
685
|
};
|
|
681
|
-
const wrap$
|
|
686
|
+
const wrap$c = port => {
|
|
682
687
|
return {
|
|
683
688
|
port,
|
|
684
689
|
on(event, listener) {
|
|
@@ -709,8 +714,8 @@ const wrap$b = port => {
|
|
|
709
714
|
const IpcChildWithNodeMessagePort = {
|
|
710
715
|
__proto__: null,
|
|
711
716
|
listen: listen$4,
|
|
712
|
-
signal: signal$
|
|
713
|
-
wrap: wrap$
|
|
717
|
+
signal: signal$6,
|
|
718
|
+
wrap: wrap$c
|
|
714
719
|
};
|
|
715
720
|
|
|
716
721
|
const listen$3 = async () => {
|
|
@@ -722,7 +727,7 @@ const listen$3 = async () => {
|
|
|
722
727
|
}
|
|
723
728
|
return parentPort;
|
|
724
729
|
};
|
|
725
|
-
const signal$
|
|
730
|
+
const signal$5 = parentPort => {
|
|
726
731
|
parentPort.postMessage(readyMessage);
|
|
727
732
|
};
|
|
728
733
|
class IpcChildWithNodeWorker extends Ipc {
|
|
@@ -746,15 +751,15 @@ class IpcChildWithNodeWorker extends Ipc {
|
|
|
746
751
|
this._rawIpc.close();
|
|
747
752
|
}
|
|
748
753
|
}
|
|
749
|
-
const wrap$
|
|
754
|
+
const wrap$b = parentPort => {
|
|
750
755
|
return new IpcChildWithNodeWorker(parentPort);
|
|
751
756
|
};
|
|
752
757
|
|
|
753
758
|
const IpcChildWithNodeWorker$1 = {
|
|
754
759
|
__proto__: null,
|
|
755
760
|
listen: listen$3,
|
|
756
|
-
signal: signal$
|
|
757
|
-
wrap: wrap$
|
|
761
|
+
signal: signal$5,
|
|
762
|
+
wrap: wrap$b
|
|
758
763
|
};
|
|
759
764
|
|
|
760
765
|
const preloadChannelType = 'port';
|
|
@@ -795,18 +800,19 @@ class IpcChildWithRendererProcess2 extends Ipc {
|
|
|
795
800
|
this._rawIpc.on('destroyed', callback);
|
|
796
801
|
}
|
|
797
802
|
}
|
|
798
|
-
const wrap$
|
|
803
|
+
const wrap$a = webContents => {
|
|
799
804
|
return new IpcChildWithRendererProcess2(webContents);
|
|
800
805
|
};
|
|
801
806
|
|
|
802
807
|
const IpcChildWithRendererProcess2$1 = {
|
|
803
808
|
__proto__: null,
|
|
804
809
|
listen: listen$2,
|
|
805
|
-
wrap: wrap$
|
|
810
|
+
wrap: wrap$a
|
|
806
811
|
};
|
|
807
812
|
|
|
808
|
-
const
|
|
809
|
-
const
|
|
813
|
+
const Error$3 = 1;
|
|
814
|
+
const Open = 2;
|
|
815
|
+
const Close = 3;
|
|
810
816
|
|
|
811
817
|
const addListener = (emitter, type, callback) => {
|
|
812
818
|
if ('addEventListener' in emitter) {
|
|
@@ -923,12 +929,12 @@ const listen$1 = async ({
|
|
|
923
929
|
}
|
|
924
930
|
return webSocket;
|
|
925
931
|
};
|
|
926
|
-
const signal$
|
|
932
|
+
const signal$4 = webSocket => {
|
|
927
933
|
webSocket.resume();
|
|
928
934
|
};
|
|
929
935
|
|
|
930
936
|
// @ts-ignore
|
|
931
|
-
const wrap$
|
|
937
|
+
const wrap$9 = webSocket => {
|
|
932
938
|
return {
|
|
933
939
|
webSocket,
|
|
934
940
|
/**
|
|
@@ -978,14 +984,14 @@ const wrap$8 = webSocket => {
|
|
|
978
984
|
const IpcChildWithWebSocket = {
|
|
979
985
|
__proto__: null,
|
|
980
986
|
listen: listen$1,
|
|
981
|
-
signal: signal$
|
|
982
|
-
wrap: wrap$
|
|
987
|
+
signal: signal$4,
|
|
988
|
+
wrap: wrap$9
|
|
983
989
|
};
|
|
984
990
|
|
|
985
991
|
const listen = () => {
|
|
986
992
|
return window;
|
|
987
993
|
};
|
|
988
|
-
const signal$
|
|
994
|
+
const signal$3 = global => {
|
|
989
995
|
global.postMessage(readyMessage);
|
|
990
996
|
};
|
|
991
997
|
class IpcChildWithWindow extends Ipc {
|
|
@@ -1019,18 +1025,18 @@ class IpcChildWithWindow extends Ipc {
|
|
|
1019
1025
|
this._rawIpc.addEventListener('message', wrapped);
|
|
1020
1026
|
}
|
|
1021
1027
|
}
|
|
1022
|
-
const wrap$
|
|
1028
|
+
const wrap$8 = window => {
|
|
1023
1029
|
return new IpcChildWithWindow(window);
|
|
1024
1030
|
};
|
|
1025
1031
|
|
|
1026
1032
|
const IpcChildWithWindow$1 = {
|
|
1027
1033
|
__proto__: null,
|
|
1028
1034
|
listen,
|
|
1029
|
-
signal: signal$
|
|
1030
|
-
wrap: wrap$
|
|
1035
|
+
signal: signal$3,
|
|
1036
|
+
wrap: wrap$8
|
|
1031
1037
|
};
|
|
1032
1038
|
|
|
1033
|
-
const create$
|
|
1039
|
+
const create$7 = ({
|
|
1034
1040
|
messagePort
|
|
1035
1041
|
}) => {
|
|
1036
1042
|
if (!isMessagePortMain(messagePort)) {
|
|
@@ -1038,7 +1044,7 @@ const create$6 = ({
|
|
|
1038
1044
|
}
|
|
1039
1045
|
return messagePort;
|
|
1040
1046
|
};
|
|
1041
|
-
const signal$
|
|
1047
|
+
const signal$2 = messagePort => {
|
|
1042
1048
|
messagePort.start();
|
|
1043
1049
|
};
|
|
1044
1050
|
class IpcParentWithElectronMessagePort extends Ipc {
|
|
@@ -1063,15 +1069,15 @@ class IpcParentWithElectronMessagePort extends Ipc {
|
|
|
1063
1069
|
this._rawIpc.on('close', callback);
|
|
1064
1070
|
}
|
|
1065
1071
|
}
|
|
1066
|
-
const wrap$
|
|
1072
|
+
const wrap$7 = messagePort => {
|
|
1067
1073
|
return new IpcParentWithElectronMessagePort(messagePort);
|
|
1068
1074
|
};
|
|
1069
1075
|
|
|
1070
1076
|
const IpcParentWithElectronMessagePort$1 = {
|
|
1071
1077
|
__proto__: null,
|
|
1072
|
-
create: create$
|
|
1073
|
-
signal: signal$
|
|
1074
|
-
wrap: wrap$
|
|
1078
|
+
create: create$7,
|
|
1079
|
+
signal: signal$2,
|
|
1080
|
+
wrap: wrap$7
|
|
1075
1081
|
};
|
|
1076
1082
|
|
|
1077
1083
|
const Exit = 1;
|
|
@@ -1134,7 +1140,7 @@ const getFirstUtilityProcessEvent = async utilityProcess => {
|
|
|
1134
1140
|
};
|
|
1135
1141
|
};
|
|
1136
1142
|
|
|
1137
|
-
const create$
|
|
1143
|
+
const create$6 = async ({
|
|
1138
1144
|
path,
|
|
1139
1145
|
argv = [],
|
|
1140
1146
|
execArgv = [],
|
|
@@ -1197,17 +1203,17 @@ class IpcParentWithElectronUtilityProcess extends Ipc {
|
|
|
1197
1203
|
this._rawIpc.on('message', callback);
|
|
1198
1204
|
}
|
|
1199
1205
|
}
|
|
1200
|
-
const wrap$
|
|
1206
|
+
const wrap$6 = process => {
|
|
1201
1207
|
return new IpcParentWithElectronUtilityProcess(process);
|
|
1202
1208
|
};
|
|
1203
1209
|
|
|
1204
1210
|
const IpcParentWithElectronUtilityProcess$1 = {
|
|
1205
1211
|
__proto__: null,
|
|
1206
|
-
create: create$
|
|
1207
|
-
wrap: wrap$
|
|
1212
|
+
create: create$6,
|
|
1213
|
+
wrap: wrap$6
|
|
1208
1214
|
};
|
|
1209
1215
|
|
|
1210
|
-
const create$
|
|
1216
|
+
const create$5 = async ({
|
|
1211
1217
|
messagePort,
|
|
1212
1218
|
isMessagePortOpen
|
|
1213
1219
|
}) => {
|
|
@@ -1228,7 +1234,7 @@ const create$4 = async ({
|
|
|
1228
1234
|
}
|
|
1229
1235
|
return messagePort;
|
|
1230
1236
|
};
|
|
1231
|
-
const signal = messagePort => {
|
|
1237
|
+
const signal$1 = messagePort => {
|
|
1232
1238
|
messagePort.start();
|
|
1233
1239
|
};
|
|
1234
1240
|
class IpcParentWithMessagePort extends Ipc {
|
|
@@ -1247,15 +1253,15 @@ class IpcParentWithMessagePort extends Ipc {
|
|
|
1247
1253
|
}
|
|
1248
1254
|
onClose(callback) {}
|
|
1249
1255
|
}
|
|
1250
|
-
const wrap$
|
|
1256
|
+
const wrap$5 = messagePort => {
|
|
1251
1257
|
return new IpcParentWithMessagePort(messagePort);
|
|
1252
1258
|
};
|
|
1253
1259
|
|
|
1254
1260
|
const IpcParentWithMessagePort$1 = {
|
|
1255
1261
|
__proto__: null,
|
|
1256
|
-
create: create$
|
|
1257
|
-
signal,
|
|
1258
|
-
wrap: wrap$
|
|
1262
|
+
create: create$5,
|
|
1263
|
+
signal: signal$1,
|
|
1264
|
+
wrap: wrap$5
|
|
1259
1265
|
};
|
|
1260
1266
|
|
|
1261
1267
|
const Message = 'message';
|
|
@@ -1303,7 +1309,7 @@ ${relevant}`;
|
|
|
1303
1309
|
|
|
1304
1310
|
const Module = 'module';
|
|
1305
1311
|
|
|
1306
|
-
const create$
|
|
1312
|
+
const create$4 = async ({
|
|
1307
1313
|
url,
|
|
1308
1314
|
name
|
|
1309
1315
|
}) => {
|
|
@@ -1360,13 +1366,74 @@ class IpcParentWithModuleWorker extends Ipc {
|
|
|
1360
1366
|
this._rawIpc.addEventListener('message', callback);
|
|
1361
1367
|
}
|
|
1362
1368
|
}
|
|
1363
|
-
const wrap$
|
|
1369
|
+
const wrap$4 = worker => {
|
|
1364
1370
|
return new IpcParentWithModuleWorker(worker);
|
|
1365
1371
|
};
|
|
1366
1372
|
|
|
1367
1373
|
const IpcParentWithModuleWorker$1 = {
|
|
1374
|
+
__proto__: null,
|
|
1375
|
+
create: create$4,
|
|
1376
|
+
wrap: wrap$4
|
|
1377
|
+
};
|
|
1378
|
+
|
|
1379
|
+
const getPortTuple = () => {
|
|
1380
|
+
const {
|
|
1381
|
+
port1,
|
|
1382
|
+
port2
|
|
1383
|
+
} = new MessageChannel();
|
|
1384
|
+
return {
|
|
1385
|
+
port1,
|
|
1386
|
+
port2
|
|
1387
|
+
};
|
|
1388
|
+
};
|
|
1389
|
+
|
|
1390
|
+
const create$3 = async ({
|
|
1391
|
+
sendPort,
|
|
1392
|
+
url,
|
|
1393
|
+
name
|
|
1394
|
+
}) => {
|
|
1395
|
+
const {
|
|
1396
|
+
port1,
|
|
1397
|
+
port2
|
|
1398
|
+
} = getPortTuple();
|
|
1399
|
+
await sendPort({
|
|
1400
|
+
port: port1,
|
|
1401
|
+
name,
|
|
1402
|
+
url
|
|
1403
|
+
});
|
|
1404
|
+
return port2;
|
|
1405
|
+
};
|
|
1406
|
+
const signal = messagePort => {
|
|
1407
|
+
messagePort.start();
|
|
1408
|
+
};
|
|
1409
|
+
class IpcParentWithModuleWorkerAndWorkaroundForChromeDevtoolsBug extends Ipc {
|
|
1410
|
+
getData = getData$2;
|
|
1411
|
+
send(message) {
|
|
1412
|
+
this._rawIpc.postMessage(message);
|
|
1413
|
+
}
|
|
1414
|
+
sendAndTransfer(message) {
|
|
1415
|
+
const transfer = getTransferrables(message);
|
|
1416
|
+
this._rawIpc.postMessage(message, transfer);
|
|
1417
|
+
}
|
|
1418
|
+
dispose() {
|
|
1419
|
+
this._rawIpc.close();
|
|
1420
|
+
}
|
|
1421
|
+
onMessage(callback) {
|
|
1422
|
+
this._rawIpc.addEventListener('message', callback);
|
|
1423
|
+
this._rawIpc.start();
|
|
1424
|
+
}
|
|
1425
|
+
onClose(callback) {
|
|
1426
|
+
// ignore
|
|
1427
|
+
}
|
|
1428
|
+
}
|
|
1429
|
+
const wrap$3 = messagePort => {
|
|
1430
|
+
return new IpcParentWithModuleWorkerAndWorkaroundForChromeDevtoolsBug(messagePort);
|
|
1431
|
+
};
|
|
1432
|
+
|
|
1433
|
+
const IpcParentWithModuleWorkerAndWorkaroundForChromeDevtoolsBug$1 = {
|
|
1368
1434
|
__proto__: null,
|
|
1369
1435
|
create: create$3,
|
|
1436
|
+
signal,
|
|
1370
1437
|
wrap: wrap$3
|
|
1371
1438
|
};
|
|
1372
1439
|
|
|
@@ -1660,7 +1727,8 @@ const parse = content => {
|
|
|
1660
1727
|
const waitForWebSocketToBeOpen = webSocket => {
|
|
1661
1728
|
return getFirstEvent(webSocket, {
|
|
1662
1729
|
open: Open,
|
|
1663
|
-
close: Close
|
|
1730
|
+
close: Close,
|
|
1731
|
+
error: Error$3
|
|
1664
1732
|
});
|
|
1665
1733
|
};
|
|
1666
1734
|
|
|
@@ -1668,7 +1736,9 @@ const create = async ({
|
|
|
1668
1736
|
webSocket
|
|
1669
1737
|
}) => {
|
|
1670
1738
|
const firstWebSocketEvent = await waitForWebSocketToBeOpen(webSocket);
|
|
1671
|
-
|
|
1739
|
+
if (firstWebSocketEvent.type === Error$3) {
|
|
1740
|
+
throw new IpcError(`WebSocket connection error`);
|
|
1741
|
+
}
|
|
1672
1742
|
if (firstWebSocketEvent.type === Close) {
|
|
1673
1743
|
throw new IpcError('Websocket connection was immediately closed');
|
|
1674
1744
|
}
|
|
@@ -1704,4 +1774,4 @@ const IpcParentWithWebSocket$1 = {
|
|
|
1704
1774
|
wrap
|
|
1705
1775
|
};
|
|
1706
1776
|
|
|
1707
|
-
export { IpcChildWithElectronMessagePort$1 as IpcChildWithElectronMessagePort, IpcChildWithElectronUtilityProcess$1 as IpcChildWithElectronUtilityProcess, IpcChildWithElectronWindow$1 as IpcChildWithElectronWindow, IpcChildWithMessagePort$1 as IpcChildWithMessagePort, IpcChildWithModuleWorker$1 as IpcChildWithModuleWorker, IpcChildWithModuleWorkerAndMessagePort$1 as IpcChildWithModuleWorkerAndMessagePort, IpcChildWithNodeForkedProcess$1 as IpcChildWithNodeForkedProcess, IpcChildWithNodeMessagePort, IpcChildWithNodeWorker$1 as IpcChildWithNodeWorker, IpcChildWithRendererProcess2$1 as IpcChildWithRendererProcess2, IpcChildWithWebSocket, IpcChildWithWindow$1 as IpcChildWithWindow, IpcParentWithElectronMessagePort$1 as IpcParentWithElectronMessagePort, IpcParentWithElectronUtilityProcess$1 as IpcParentWithElectronUtilityProcess, IpcParentWithMessagePort$1 as IpcParentWithMessagePort, IpcParentWithModuleWorker$1 as IpcParentWithModuleWorker, IpcParentWithNodeForkedProcess$1 as IpcParentWithNodeForkedProcess, IpcParentWithNodeWorker$1 as IpcParentWithNodeWorker, IpcParentWithWebSocket$1 as IpcParentWithWebSocket };
|
|
1777
|
+
export { IpcChildWithElectronMessagePort$1 as IpcChildWithElectronMessagePort, IpcChildWithElectronUtilityProcess$1 as IpcChildWithElectronUtilityProcess, IpcChildWithElectronWindow$1 as IpcChildWithElectronWindow, IpcChildWithMessagePort$1 as IpcChildWithMessagePort, IpcChildWithModuleWorker$1 as IpcChildWithModuleWorker, IpcChildWithModuleWorkerAndMessagePort$1 as IpcChildWithModuleWorkerAndMessagePort, IpcChildWithNodeForkedProcess$1 as IpcChildWithNodeForkedProcess, IpcChildWithNodeMessagePort, IpcChildWithNodeWorker$1 as IpcChildWithNodeWorker, IpcChildWithRendererProcess2$1 as IpcChildWithRendererProcess2, IpcChildWithWebSocket, IpcChildWithWindow$1 as IpcChildWithWindow, IpcParentWithElectronMessagePort$1 as IpcParentWithElectronMessagePort, IpcParentWithElectronUtilityProcess$1 as IpcParentWithElectronUtilityProcess, IpcParentWithMessagePort$1 as IpcParentWithMessagePort, IpcParentWithModuleWorker$1 as IpcParentWithModuleWorker, IpcParentWithModuleWorkerAndWorkaroundForChromeDevtoolsBug$1 as IpcParentWithModuleWorkerAndWorkaroundForChromeDevtoolsBug, IpcParentWithNodeForkedProcess$1 as IpcParentWithNodeForkedProcess, IpcParentWithNodeWorker$1 as IpcParentWithNodeWorker, IpcParentWithWebSocket$1 as IpcParentWithWebSocket };
|