@lvce-editor/main-process 2.16.0 → 2.18.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.
@@ -2046,7 +2046,7 @@ const listen$a = () => {
2046
2046
  parentPort
2047
2047
  } = process;
2048
2048
  if (!parentPort) {
2049
- throw new Error('parent port must be defined');
2049
+ throw new IpcError('parent port must be defined');
2050
2050
  }
2051
2051
  return parentPort;
2052
2052
  };
@@ -2104,7 +2104,7 @@ const getTransferrablesNode = value => {
2104
2104
  };
2105
2105
  const listen$5 = async () => {
2106
2106
  if (!process.send) {
2107
- throw new Error('process.send must be defined');
2107
+ throw new IpcError('process.send must be defined');
2108
2108
  }
2109
2109
  return process;
2110
2110
  };
@@ -2572,7 +2572,7 @@ const create$2$2 = async ({
2572
2572
  throw new ChildProcessError(stderr);
2573
2573
  }
2574
2574
  if (type === Error$2) {
2575
- throw new Error(`child process had an error ${event}`);
2575
+ throw new IpcError(`child process had an error ${event}`);
2576
2576
  }
2577
2577
  if (stdio === 'inherit' && childProcess.stdout && childProcess.stderr) {
2578
2578
  childProcess.stdout.pipe(process.stdout);
@@ -2636,13 +2636,13 @@ const getFirstNodeWorkerEvent = worker => {
2636
2636
  error: Error$2
2637
2637
  });
2638
2638
  };
2639
-
2640
- // @ts-ignore
2641
2639
  const create$1$2 = async ({
2642
2640
  path,
2643
2641
  argv = [],
2644
2642
  env = process.env,
2645
- execArgv = []
2643
+ execArgv = [],
2644
+ stdio,
2645
+ name
2646
2646
  }) => {
2647
2647
  string(path);
2648
2648
  const actualArgv = ['--ipc-type=node-worker', ...argv];
@@ -2650,13 +2650,17 @@ const create$1$2 = async ({
2650
2650
  ...env,
2651
2651
  ELECTRON_RUN_AS_NODE: '1'
2652
2652
  };
2653
+ const ignoreStdio = stdio === 'inherit' ? undefined : true;
2653
2654
  const {
2654
2655
  Worker
2655
2656
  } = await import('node:worker_threads');
2656
2657
  const worker = new Worker(path, {
2657
2658
  argv: actualArgv,
2658
2659
  env: actualEnv,
2659
- execArgv
2660
+ execArgv,
2661
+ stdout: ignoreStdio,
2662
+ stderr: ignoreStdio,
2663
+ name
2660
2664
  });
2661
2665
  const {
2662
2666
  type,
@@ -2814,7 +2818,8 @@ const splitLines = lines => {
2814
2818
  return lines.split(NewLine);
2815
2819
  };
2816
2820
  const getCurrentStack = () => {
2817
- const currentStack = joinLines(splitLines(new Error().stack || '').slice(2));
2821
+ const stackLinesToSkip = 3;
2822
+ const currentStack = joinLines(splitLines(new Error().stack || '').slice(stackLinesToSkip));
2818
2823
  return currentStack;
2819
2824
  };
2820
2825
  const getNewLineIndex = (string, startIndex = undefined) => {
@@ -3085,6 +3090,12 @@ const invokeAndTransfer$1 = (ipc, method, ...params) => {
3085
3090
  return invokeHelper(ipc, method, params, true);
3086
3091
  };
3087
3092
 
3093
+ let CommandNotFoundError$1 = class CommandNotFoundError extends Error {
3094
+ constructor(command) {
3095
+ super(`Command not found ${command}`);
3096
+ this.name = 'CommandNotFoundError';
3097
+ }
3098
+ };
3088
3099
  const commands = Object.create(null);
3089
3100
  const register$1 = commandMap => {
3090
3101
  Object.assign(commands, commandMap);
@@ -3095,7 +3106,7 @@ const getCommand = key => {
3095
3106
  const execute$1 = (command, ...args) => {
3096
3107
  const fn = getCommand(command);
3097
3108
  if (!fn) {
3098
- throw new Error(`command not found ${command}`);
3109
+ throw new CommandNotFoundError$1(command);
3099
3110
  }
3100
3111
  return fn(...args);
3101
3112
  };
@@ -3152,7 +3163,7 @@ const listen$1 = async (module, options) => {
3152
3163
  const ipc = module.wrap(rawIpc);
3153
3164
  return ipc;
3154
3165
  };
3155
- const create$j = async ({
3166
+ const create$k = async ({
3156
3167
  commandMap,
3157
3168
  messagePort,
3158
3169
  requiresSocket
@@ -3171,9 +3182,9 @@ const create$j = async ({
3171
3182
  };
3172
3183
  const ElectronMessagePortRpcClient = {
3173
3184
  __proto__: null,
3174
- create: create$j
3185
+ create: create$k
3175
3186
  };
3176
- const create$h = async ({
3187
+ const create$i = async ({
3177
3188
  commandMap,
3178
3189
  env,
3179
3190
  argv,
@@ -3202,9 +3213,9 @@ const create$h = async ({
3202
3213
  };
3203
3214
  const ElectronUtilityProcessRpcParent = {
3204
3215
  __proto__: null,
3205
- create: create$h
3216
+ create: create$i
3206
3217
  };
3207
- const create$g = async ({
3218
+ const create$h = async ({
3208
3219
  commandMap,
3209
3220
  webContents,
3210
3221
  requiresSocket
@@ -3222,7 +3233,7 @@ const create$g = async ({
3222
3233
  };
3223
3234
  const ElectronWebContentsRpcClient = {
3224
3235
  __proto__: null,
3225
- create: create$g
3236
+ create: create$h
3226
3237
  };
3227
3238
 
3228
3239
  const commandMapRef = Object.create(null);
package/package.json CHANGED
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/main-process",
3
- "version": "2.16.0",
4
- "description": "",
3
+ "version": "2.18.0",
5
4
  "keywords": [
6
5
  "lvce-editor",
7
6
  "electron"
@@ -15,7 +14,7 @@
15
14
  "type": "module",
16
15
  "main": "dist/mainProcessMain.js",
17
16
  "dependencies": {
18
- "electron": "37.2.3"
17
+ "electron": "37.4.0"
19
18
  },
20
19
  "engines": {
21
20
  "node": ">=22"