@lvce-editor/ipc 3.0.0 → 3.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.
@@ -0,0 +1,20 @@
1
+ interface IpcChild {
2
+ readonly listen: any
3
+ readonly wrap: any
4
+ }
5
+
6
+ export const IpcChildWithElectronMessagePort: IpcChild
7
+ export const IpcChildWithElectronUtilityProcess: IpcChild
8
+ export const IpcChildWithNodeForkedProcess: IpcChild
9
+ export const IpcChildWithWebSocket: IpcChild
10
+ export const IpcChildWithModuleWorkerAndMessagePort: IpcChild
11
+ export const IpcChildWithModuleWorker: IpcChild
12
+
13
+ interface IpcParent {
14
+ readonly create: any
15
+ readonly wrap: any
16
+ }
17
+
18
+ export const IpcParentWithElectronUtilityProcess: IpcParent
19
+ export const IpcParentWithNodeForkedProcess: IpcParent
20
+ export const IpcParentWithNodeWorker: IpcParent
package/dist/index.js CHANGED
@@ -1,7 +1,5 @@
1
1
  import { VError } from '@lvce-editor/verror';
2
2
  import { string, array } from '@lvce-editor/assert';
3
- import { fork } from 'node:child_process';
4
- import { Worker } from 'node:worker_threads';
5
3
 
6
4
  const E_INCOMPATIBLE_NATIVE_MODULE = 'E_INCOMPATIBLE_NATIVE_MODULE';
7
5
  const E_MODULES_NOT_SUPPORTED_IN_ELECTRON = 'E_MODULES_NOT_SUPPORTED_IN_ELECTRON';
@@ -9,14 +7,14 @@ const ERR_MODULE_NOT_FOUND = 'ERR_MODULE_NOT_FOUND';
9
7
 
10
8
  const NewLine = '\n';
11
9
 
12
- const splitLines = lines => {
13
- return lines.split(NewLine);
14
- };
15
-
16
10
  const joinLines = lines => {
17
11
  return lines.join(NewLine);
18
12
  };
19
13
 
14
+ const splitLines = lines => {
15
+ return lines.split(NewLine);
16
+ };
17
+
20
18
  const RE_NATIVE_MODULE_ERROR = /^innerError Error: Cannot find module '.*.node'/;
21
19
  const RE_NATIVE_MODULE_ERROR_2 = /was compiled against a different Node.js version/;
22
20
  const RE_MESSAGE_CODE_BLOCK_START = /^Error: The module '.*'$/;
@@ -53,7 +51,7 @@ const isModulesSyntaxError = stderr => {
53
51
  }
54
52
  return stderr.includes('SyntaxError: Cannot use import statement outside a module');
55
53
  };
56
- const getModuleSyntaxError = stderr => {
54
+ const getModuleSyntaxError = () => {
57
55
  return {
58
56
  message: `ES Modules are not supported in electron`,
59
57
  code: E_MODULES_NOT_SUPPORTED_IN_ELECTRON
@@ -122,6 +120,7 @@ const getHelpfulChildProcessError = (stdout, stderr) => {
122
120
  };
123
121
 
124
122
  class IpcError extends VError {
123
+ // @ts-ignore
125
124
  constructor(message, stdout = '', stderr = '') {
126
125
  if (stdout || stderr) {
127
126
  // @ts-ignore
@@ -151,7 +150,8 @@ const isMessagePortMain = value => {
151
150
  return value && value.constructor && value.constructor.name === 'MessagePortMain';
152
151
  };
153
152
 
154
- const listen$3 = ({
153
+ // @ts-ignore
154
+ const listen$5 = ({
155
155
  messagePort
156
156
  }) => {
157
157
  if (!isMessagePortMain(messagePort)) {
@@ -159,6 +159,8 @@ const listen$3 = ({
159
159
  }
160
160
  return messagePort;
161
161
  };
162
+
163
+ // @ts-ignore
162
164
  const getActualData$1 = event => {
163
165
  const {
164
166
  data,
@@ -172,11 +174,15 @@ const getActualData$1 = event => {
172
174
  params: [...ports, ...data.params]
173
175
  };
174
176
  };
175
- const wrap$6 = messagePort => {
177
+
178
+ // @ts-ignore
179
+ const wrap$8 = messagePort => {
176
180
  return {
177
181
  messagePort,
182
+ // @ts-ignore
178
183
  on(event, listener) {
179
184
  if (event === 'message') {
185
+ // @ts-ignore
180
186
  const wrappedListener = event => {
181
187
  const actualData = getActualData$1(event);
182
188
  listener(actualData);
@@ -188,9 +194,11 @@ const wrap$6 = messagePort => {
188
194
  throw new Error('unsupported event type');
189
195
  }
190
196
  },
197
+ // @ts-ignore
191
198
  off(event, listener) {
192
199
  this.messagePort.off(event, listener);
193
200
  },
201
+ // @ts-ignore
194
202
  send(message) {
195
203
  this.messagePort.postMessage(message);
196
204
  },
@@ -205,10 +213,11 @@ const wrap$6 = messagePort => {
205
213
 
206
214
  const IpcChildWithElectronMessagePort = {
207
215
  __proto__: null,
208
- listen: listen$3,
209
- wrap: wrap$6
216
+ listen: listen$5,
217
+ wrap: wrap$8
210
218
  };
211
219
 
220
+ // @ts-ignore
212
221
  const getUtilityProcessPortData = event => {
213
222
  const {
214
223
  data,
@@ -223,7 +232,7 @@ const getUtilityProcessPortData = event => {
223
232
  };
224
233
  };
225
234
 
226
- const listen$2 = () => {
235
+ const listen$4 = () => {
227
236
  // @ts-ignore
228
237
  const {
229
238
  parentPort
@@ -233,14 +242,20 @@ const listen$2 = () => {
233
242
  }
234
243
  return parentPort;
235
244
  };
236
- const signal$1 = parentPort => {
245
+
246
+ // @ts-ignore
247
+ const signal$2 = parentPort => {
237
248
  parentPort.postMessage('ready');
238
249
  };
239
- const wrap$5 = parentPort => {
250
+
251
+ // @ts-ignore
252
+ const wrap$7 = parentPort => {
240
253
  return {
241
254
  parentPort,
255
+ // @ts-ignore
242
256
  on(event, listener) {
243
257
  if (event === 'message') {
258
+ // @ts-ignore
244
259
  const wrappedListener = event => {
245
260
  const actualData = getUtilityProcessPortData(event);
246
261
  listener(actualData);
@@ -252,12 +267,15 @@ const wrap$5 = parentPort => {
252
267
  throw new Error('unsupported event type');
253
268
  }
254
269
  },
270
+ // @ts-ignore
255
271
  off(event, listener) {
256
272
  this.parentPort.off(event, listener);
257
273
  },
274
+ // @ts-ignore
258
275
  send(message) {
259
276
  this.parentPort.postMessage(message);
260
277
  },
278
+ // @ts-ignore
261
279
  sendAndTransfer(message, transfer) {
262
280
  this.parentPort.postMessage(message, transfer);
263
281
  },
@@ -269,8 +287,146 @@ const wrap$5 = parentPort => {
269
287
 
270
288
  const IpcChildWithElectronUtilityProcess = {
271
289
  __proto__: null,
272
- listen: listen$2,
290
+ listen: listen$4,
291
+ signal: signal$2,
292
+ wrap: wrap$7
293
+ };
294
+
295
+ const getData = event => {
296
+ return event.data;
297
+ };
298
+
299
+ const listen$3 = () => {
300
+ // @ts-ignore
301
+ if (typeof WorkerGlobalScope === 'undefined') {
302
+ throw new TypeError('module is not in web worker scope');
303
+ }
304
+ // @ts-ignore
305
+ globalThis.postMessage('ready');
306
+ return globalThis;
307
+ };
308
+ const signal$1 = global => {
309
+ global.postMessage('ready');
310
+ };
311
+ const wrap$6 = global => {
312
+ return {
313
+ global,
314
+ /**
315
+ * @type {any}
316
+ */
317
+ listener: undefined,
318
+ send(message) {
319
+ this.global.postMessage(message);
320
+ },
321
+ sendAndTransfer(message, transferables) {
322
+ this.global.postMessage(message, transferables);
323
+ },
324
+ get onmessage() {
325
+ return this.listener;
326
+ },
327
+ set onmessage(listener) {
328
+ const wrappedListener = event => {
329
+ const data = getData(event);
330
+ // @ts-expect-error
331
+ listener({
332
+ data,
333
+ target: this
334
+ });
335
+ };
336
+ this.listener = listener;
337
+ this.global.onmessage = wrappedListener;
338
+ }
339
+ };
340
+ };
341
+
342
+ const IpcChildWithModuleWorker = {
343
+ __proto__: null,
344
+ listen: listen$3,
273
345
  signal: signal$1,
346
+ wrap: wrap$6
347
+ };
348
+
349
+ const withResolvers = () => {
350
+ let _resolve;
351
+ const promise = new Promise(resolve => {
352
+ _resolve = resolve;
353
+ });
354
+ return {
355
+ resolve: _resolve,
356
+ promise
357
+ };
358
+ };
359
+
360
+ const waitForFirstMessage = async port => {
361
+ const {
362
+ resolve,
363
+ promise
364
+ } = withResolvers();
365
+ const cleanup = value => {
366
+ port.onmessage = null;
367
+ resolve(value);
368
+ };
369
+ const handleMessage = event => {
370
+ cleanup(event);
371
+ };
372
+ port.onmessage = handleMessage;
373
+ const event = await promise;
374
+ // @ts-expect-error
375
+ return event.data;
376
+ };
377
+
378
+ const listen$2 = async () => {
379
+ const parentIpcRaw = listen$3();
380
+ const parentIpc = wrap$6(parentIpcRaw);
381
+ const firstMessage = await waitForFirstMessage(parentIpc);
382
+ if (firstMessage.method !== 'initialize') {
383
+ throw new IpcError('unexpected first message');
384
+ }
385
+ const type = firstMessage.params[0];
386
+ if (type === 'message-port') {
387
+ const port = firstMessage.params[1];
388
+ return port;
389
+ }
390
+ return globalThis;
391
+ };
392
+ const wrap$5 = port => {
393
+ return {
394
+ port,
395
+ /**
396
+ * @type {any}
397
+ */
398
+ wrappedListener: undefined,
399
+ send(message) {
400
+ this.port.postMessage(message);
401
+ },
402
+ sendAndTransfer(message, transferables) {
403
+ this.port.postMessage(message, transferables);
404
+ },
405
+ get onmessage() {
406
+ return this.wrappedListener;
407
+ },
408
+ set onmessage(listener) {
409
+ if (listener) {
410
+ // @ts-expect-error
411
+ this.wrappedListener = event => {
412
+ const data = getData(event);
413
+ // @ts-expect-error
414
+ listener({
415
+ data,
416
+ target: this
417
+ });
418
+ };
419
+ } else {
420
+ this.wrappedListener = undefined;
421
+ }
422
+ this.port.onmessage = this.wrappedListener;
423
+ }
424
+ };
425
+ };
426
+
427
+ const IpcChildWithModuleWorkerAndMessagePort = {
428
+ __proto__: null,
429
+ listen: listen$2,
274
430
  wrap: wrap$5
275
431
  };
276
432
 
@@ -280,9 +436,13 @@ const listen$1 = async () => {
280
436
  }
281
437
  return process;
282
438
  };
439
+
440
+ // @ts-ignore
283
441
  const signal = process => {
284
442
  process.send('ready');
285
443
  };
444
+
445
+ // @ts-ignore
286
446
  const getActualData = (message, handle) => {
287
447
  if (handle) {
288
448
  return {
@@ -292,11 +452,15 @@ const getActualData = (message, handle) => {
292
452
  }
293
453
  return message;
294
454
  };
455
+
456
+ // @ts-ignore
295
457
  const wrap$4 = process => {
296
458
  return {
297
459
  process,
460
+ // @ts-ignore
298
461
  on(event, listener) {
299
462
  if (event === 'message') {
463
+ // @ts-ignore
300
464
  const wrappedListener = (event, handle) => {
301
465
  const actualData = getActualData(event, handle);
302
466
  listener(actualData);
@@ -308,9 +472,11 @@ const wrap$4 = process => {
308
472
  throw new Error('unsupported event type');
309
473
  }
310
474
  },
475
+ // @ts-ignore
311
476
  off(event, listener) {
312
477
  this.process.off(event, listener);
313
478
  },
479
+ // @ts-ignore
314
480
  send(message) {
315
481
  this.process.send(message);
316
482
  },
@@ -328,39 +494,23 @@ const IpcChildWithNodeForkedProcess = {
328
494
  const Open = 1;
329
495
  const Close = 2;
330
496
 
331
- const withResolvers = () => {
332
- /**
333
- * @type {any}
334
- */
335
- let _resolve;
336
- /**
337
- * @type {any}
338
- */
339
- let _reject;
340
- const promise = new Promise((resolve, reject) => {
341
- _resolve = resolve;
342
- _reject = reject;
343
- });
344
- return {
345
- resolve: _resolve,
346
- reject: _reject,
347
- promise
348
- };
349
- };
350
-
497
+ // @ts-ignore
351
498
  const getFirstEvent = (eventEmitter, eventMap) => {
352
499
  const {
353
500
  resolve,
354
501
  promise
355
502
  } = withResolvers();
356
503
  const listenerMap = Object.create(null);
504
+ // @ts-ignore
357
505
  const cleanup = value => {
358
506
  for (const event of Object.keys(eventMap)) {
359
507
  eventEmitter.off(event, listenerMap[event]);
360
508
  }
509
+ // @ts-ignore
361
510
  resolve(value);
362
511
  };
363
512
  for (const [event, type] of Object.entries(eventMap)) {
513
+ // @ts-ignore
364
514
  const listener = event => {
365
515
  cleanup({
366
516
  type,
@@ -373,7 +523,9 @@ const getFirstEvent = (eventEmitter, eventMap) => {
373
523
  return promise;
374
524
  };
375
525
 
526
+ // @ts-ignore
376
527
  const getFirstWebSocketEvent = async webSocket => {
528
+ // @ts-ignore
377
529
  const {
378
530
  WebSocket
379
531
  } = await import('ws');
@@ -403,26 +555,33 @@ const getFirstWebSocketEvent = async webSocket => {
403
555
  };
404
556
  };
405
557
 
558
+ // @ts-ignore
406
559
  const isWebSocketOpen = async webSocket => {
560
+ // @ts-ignore
407
561
  const {
408
562
  WebSocket
409
563
  } = await import('ws');
410
564
  return webSocket.readyState === WebSocket.OPEN;
411
565
  };
412
566
 
567
+ // @ts-ignore
413
568
  const serialize = message => {
414
569
  return JSON.stringify(message);
415
570
  };
571
+
572
+ // @ts-ignore
416
573
  const deserialize = message => {
417
574
  return JSON.parse(message.toString());
418
575
  };
419
576
 
577
+ // @ts-ignore
420
578
  const handleUpgrade = async (...args) => {
421
579
  const module = await import('@lvce-editor/web-socket-server');
422
580
  // @ts-ignore
423
581
  return module.handleUpgrade(...args);
424
582
  };
425
583
 
584
+ // @ts-ignore
426
585
  const listen = async ({
427
586
  request,
428
587
  handle
@@ -440,6 +599,8 @@ const listen = async ({
440
599
  }
441
600
  return webSocket;
442
601
  };
602
+
603
+ // @ts-ignore
443
604
  const wrap$3 = webSocket => {
444
605
  return {
445
606
  webSocket,
@@ -447,9 +608,11 @@ const wrap$3 = webSocket => {
447
608
  * @type {any}
448
609
  */
449
610
  wrappedListener: undefined,
611
+ // @ts-ignore
450
612
  on(event, listener) {
451
613
  switch (event) {
452
614
  case 'message':
615
+ // @ts-ignore
453
616
  const wrappedListener = message => {
454
617
  const data = deserialize(message);
455
618
  listener(data);
@@ -463,9 +626,11 @@ const wrap$3 = webSocket => {
463
626
  throw new Error('unknown event listener type');
464
627
  }
465
628
  },
629
+ // @ts-ignore
466
630
  off(event, listener) {
467
631
  this.webSocket.off(event, listener);
468
632
  },
633
+ // @ts-ignore
469
634
  send(message) {
470
635
  const stringifiedMessage = serialize(message);
471
636
  this.webSocket.send(stringifiedMessage);
@@ -494,6 +659,7 @@ const Message = 3;
494
659
  * @param {any} utilityProcess
495
660
  * @returns
496
661
  */
662
+ // @ts-ignore
497
663
  const getFirstUtilityProcessEvent = async utilityProcess => {
498
664
  const {
499
665
  resolve,
@@ -501,6 +667,7 @@ const getFirstUtilityProcessEvent = async utilityProcess => {
501
667
  } = withResolvers();
502
668
  let stdout = '';
503
669
  let stderr = '';
670
+ // @ts-ignore
504
671
  const cleanup = value => {
505
672
  // @ts-ignore
506
673
  utilityProcess.stderr.off('data', handleStdErrData);
@@ -508,14 +675,18 @@ const getFirstUtilityProcessEvent = async utilityProcess => {
508
675
  utilityProcess.stdout.off('data', handleStdoutData);
509
676
  utilityProcess.off('message', handleMessage);
510
677
  utilityProcess.off('exit', handleExit);
678
+ // @ts-ignore
511
679
  resolve(value);
512
680
  };
681
+ // @ts-ignore
513
682
  const handleStdErrData = data => {
514
683
  stderr += data;
515
684
  };
685
+ // @ts-ignore
516
686
  const handleStdoutData = data => {
517
687
  stdout += data;
518
688
  };
689
+ // @ts-ignore
519
690
  const handleMessage = event => {
520
691
  cleanup({
521
692
  type: Message,
@@ -524,6 +695,7 @@ const getFirstUtilityProcessEvent = async utilityProcess => {
524
695
  stderr
525
696
  });
526
697
  };
698
+ // @ts-ignore
527
699
  const handleExit = event => {
528
700
  cleanup({
529
701
  type: Exit,
@@ -551,6 +723,7 @@ const getFirstUtilityProcessEvent = async utilityProcess => {
551
723
  };
552
724
  };
553
725
 
726
+ // @ts-ignore
554
727
  const create$2 = async ({
555
728
  path,
556
729
  argv = [],
@@ -583,15 +756,20 @@ const create$2 = async ({
583
756
  childProcess.stderr.pipe(process.stderr);
584
757
  return childProcess;
585
758
  };
759
+
760
+ // @ts-ignore
586
761
  const wrap$2 = process => {
587
762
  return {
588
763
  process,
764
+ // @ts-ignore
589
765
  on(event, listener) {
590
766
  this.process.on(event, listener);
591
767
  },
768
+ // @ts-ignore
592
769
  send(message) {
593
770
  this.process.postMessage(message);
594
771
  },
772
+ // @ts-ignore
595
773
  sendAndTransfer(message, transfer) {
596
774
  array(transfer);
597
775
  this.process.postMessage(message, transfer);
@@ -609,6 +787,7 @@ const IpcParentWithElectronUtilityProcess = {
609
787
  };
610
788
 
611
789
  class ChildProcessError extends Error {
790
+ // @ts-ignore
612
791
  constructor(stderr) {
613
792
  // @ts-ignore
614
793
  const {
@@ -623,6 +802,7 @@ class ChildProcessError extends Error {
623
802
  this.code = code;
624
803
  }
625
804
  if (stack) {
805
+ // @ts-ignore
626
806
  const lines = splitLines(this.stack);
627
807
  const [firstLine, ...stackLines] = lines;
628
808
  const newStackLines = [firstLine, ...stack, ...stackLines];
@@ -632,6 +812,7 @@ class ChildProcessError extends Error {
632
812
  }
633
813
  }
634
814
 
815
+ // @ts-ignore
635
816
  const getFirstNodeChildProcessEvent = async childProcess => {
636
817
  // @ts-ignore
637
818
  const {
@@ -642,6 +823,7 @@ const getFirstNodeChildProcessEvent = async childProcess => {
642
823
  } = await new Promise((resolve, reject) => {
643
824
  let stderr = '';
644
825
  let stdout = '';
826
+ // @ts-ignore
645
827
  const cleanup = value => {
646
828
  if (childProcess.stdout && childProcess.stderr) {
647
829
  childProcess.stderr.off('data', handleStdErrData);
@@ -652,12 +834,15 @@ const getFirstNodeChildProcessEvent = async childProcess => {
652
834
  childProcess.off('error', handleError);
653
835
  resolve(value);
654
836
  };
837
+ // @ts-ignore
655
838
  const handleStdErrData = data => {
656
839
  stderr += data;
657
840
  };
841
+ // @ts-ignore
658
842
  const handleStdoutData = data => {
659
843
  stdout += data;
660
844
  };
845
+ // @ts-ignore
661
846
  const handleMessage = event => {
662
847
  cleanup({
663
848
  type: Message,
@@ -666,6 +851,7 @@ const getFirstNodeChildProcessEvent = async childProcess => {
666
851
  stderr
667
852
  });
668
853
  };
854
+ // @ts-ignore
669
855
  const handleExit = event => {
670
856
  cleanup({
671
857
  type: Exit,
@@ -674,6 +860,7 @@ const getFirstNodeChildProcessEvent = async childProcess => {
674
860
  stderr
675
861
  });
676
862
  };
863
+ // @ts-ignore
677
864
  const handleError = event => {
678
865
  cleanup({
679
866
  type: Error$1,
@@ -698,6 +885,7 @@ const getFirstNodeChildProcessEvent = async childProcess => {
698
885
  };
699
886
  };
700
887
 
888
+ // @ts-ignore
701
889
  const create$1 = async ({
702
890
  path,
703
891
  argv = [],
@@ -706,9 +894,13 @@ const create$1 = async ({
706
894
  stdio = 'inherit',
707
895
  name = 'child process'
708
896
  }) => {
897
+ // @ts-ignore
709
898
  try {
710
899
  string(path);
711
900
  const actualArgv = ['--ipc-type=node-forked-process', ...argv];
901
+ const {
902
+ fork
903
+ } = await import('node:child_process');
712
904
  const childProcess = fork(path, actualArgv, {
713
905
  env,
714
906
  execArgv,
@@ -735,18 +927,24 @@ const create$1 = async ({
735
927
  throw new VError(error, `Failed to launch ${name}`);
736
928
  }
737
929
  };
930
+
931
+ // @ts-ignore
738
932
  const wrap$1 = childProcess => {
739
933
  return {
740
934
  childProcess,
935
+ // @ts-ignore
741
936
  on(event, listener) {
742
937
  this.childProcess.on(event, listener);
743
938
  },
939
+ // @ts-ignore
744
940
  off(event, listener) {
745
941
  this.childProcess.off(event, listener);
746
942
  },
943
+ // @ts-ignore
747
944
  send(message) {
748
945
  this.childProcess.send(message);
749
946
  },
947
+ // @ts-ignore
750
948
  sendAndTransfer(message, handle) {
751
949
  this.childProcess.send(message, handle);
752
950
  },
@@ -763,6 +961,7 @@ const IpcParentWithNodeForkedProcess = {
763
961
  wrap: wrap$1
764
962
  };
765
963
 
964
+ // @ts-ignore
766
965
  const getFirstNodeWorkerEvent = worker => {
767
966
  return getFirstEvent(worker, {
768
967
  exit: Exit,
@@ -770,18 +969,23 @@ const getFirstNodeWorkerEvent = worker => {
770
969
  });
771
970
  };
772
971
 
972
+ // @ts-ignore
773
973
  const create = async ({
774
974
  path,
775
975
  argv = [],
776
976
  env = process.env,
777
977
  execArgv = []
778
978
  }) => {
979
+ // @ts-ignore
779
980
  string(path);
780
981
  const actualArgv = ['--ipc-type=node-worker', ...argv];
781
982
  const actualEnv = {
782
983
  ...env,
783
984
  ELECTRON_RUN_AS_NODE: '1'
784
985
  };
986
+ const {
987
+ Worker
988
+ } = await import('node:worker_threads');
785
989
  const worker = new Worker(path, {
786
990
  argv: actualArgv,
787
991
  env: actualEnv,
@@ -803,15 +1007,20 @@ const create = async ({
803
1007
  }
804
1008
  return worker;
805
1009
  };
1010
+
1011
+ // @ts-ignore
806
1012
  const wrap = worker => {
807
1013
  return {
808
1014
  worker,
1015
+ // @ts-ignore
809
1016
  on(event, listener) {
810
1017
  this.worker.on(event, listener);
811
1018
  },
1019
+ // @ts-ignore
812
1020
  send(message) {
813
1021
  this.worker.postMessage(message);
814
1022
  },
1023
+ // @ts-ignore
815
1024
  sendAndTransfer(message, transfer) {
816
1025
  array(transfer);
817
1026
  this.worker.postMessage(message, transfer);
@@ -828,4 +1037,4 @@ const IpcParentWithNodeWorker = {
828
1037
  wrap
829
1038
  };
830
1039
 
831
- export { IpcChildWithElectronMessagePort, IpcChildWithElectronUtilityProcess, IpcChildWithNodeForkedProcess, IpcChildWithWebSocket, IpcParentWithElectronUtilityProcess, IpcParentWithNodeForkedProcess, IpcParentWithNodeWorker };
1040
+ export { IpcChildWithElectronMessagePort, IpcChildWithElectronUtilityProcess, IpcChildWithModuleWorker, IpcChildWithModuleWorkerAndMessagePort, IpcChildWithNodeForkedProcess, IpcChildWithWebSocket, IpcParentWithElectronUtilityProcess, IpcParentWithNodeForkedProcess, IpcParentWithNodeWorker };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/ipc",
3
- "version": "3.0.0",
3
+ "version": "3.2.0",
4
4
  "description": "Inter Process Communication for Lvce Editor",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -20,5 +20,6 @@
20
20
  },
21
21
  "engines": {
22
22
  "node": ">=18"
23
- }
23
+ },
24
+ "types": "dist/index.d.ts"
24
25
  }