@lvce-editor/ipc 14.3.0 → 14.5.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 +11 -6
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -351,7 +351,7 @@ const listen$a = () => {
351
351
  parentPort
352
352
  } = process;
353
353
  if (!parentPort) {
354
- throw new Error('parent port must be defined');
354
+ throw new IpcError('parent port must be defined');
355
355
  }
356
356
  return parentPort;
357
357
  };
@@ -621,7 +621,7 @@ const getTransferrablesNode = value => {
621
621
 
622
622
  const listen$5 = async () => {
623
623
  if (!process.send) {
624
- throw new Error('process.send must be defined');
624
+ throw new IpcError('process.send must be defined');
625
625
  }
626
626
  return process;
627
627
  };
@@ -1563,7 +1563,7 @@ const create$2 = async ({
1563
1563
  throw new ChildProcessError(stderr);
1564
1564
  }
1565
1565
  if (type === Error$2) {
1566
- throw new Error(`child process had an error ${event}`);
1566
+ throw new IpcError(`child process had an error ${event}`);
1567
1567
  }
1568
1568
  if (stdio === 'inherit' && childProcess.stdout && childProcess.stderr) {
1569
1569
  childProcess.stdout.pipe(process.stdout);
@@ -1631,12 +1631,13 @@ const getFirstNodeWorkerEvent = worker => {
1631
1631
  });
1632
1632
  };
1633
1633
 
1634
- // @ts-ignore
1635
1634
  const create$1 = async ({
1636
1635
  path,
1637
1636
  argv = [],
1638
1637
  env = process.env,
1639
- execArgv = []
1638
+ execArgv = [],
1639
+ stdio,
1640
+ name
1640
1641
  }) => {
1641
1642
  string(path);
1642
1643
  const actualArgv = ['--ipc-type=node-worker', ...argv];
@@ -1644,13 +1645,17 @@ const create$1 = async ({
1644
1645
  ...env,
1645
1646
  ELECTRON_RUN_AS_NODE: '1'
1646
1647
  };
1648
+ const ignoreStdio = stdio === 'inherit' ? undefined : true;
1647
1649
  const {
1648
1650
  Worker
1649
1651
  } = await import('node:worker_threads');
1650
1652
  const worker = new Worker(path, {
1651
1653
  argv: actualArgv,
1652
1654
  env: actualEnv,
1653
- execArgv
1655
+ execArgv,
1656
+ stdout: ignoreStdio,
1657
+ stderr: ignoreStdio,
1658
+ name
1654
1659
  });
1655
1660
  const {
1656
1661
  type,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/ipc",
3
- "version": "14.3.0",
3
+ "version": "14.5.0",
4
4
  "description": "Inter Process Communication for Lvce Editor",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -15,7 +15,7 @@
15
15
  "url": "https://github.com/lvce-editor/ipc.git"
16
16
  },
17
17
  "dependencies": {
18
- "@lvce-editor/assert": "^1.3.0",
18
+ "@lvce-editor/assert": "^1.4.0",
19
19
  "@lvce-editor/verror": "^1.7.0",
20
20
  "@lvce-editor/web-socket-server": "^2.1.0"
21
21
  },