@lvce-editor/main-process 1.0.3 → 1.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/mainProcessMain.js +130 -181
- package/package.json +8 -8
package/dist/mainProcessMain.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as Electron from 'electron';
|
|
2
|
-
import Electron__default, {
|
|
2
|
+
import Electron__default, { dialog, app, clipboard, BrowserWindow, MessageChannelMain, Menu, shell, desktopCapturer, contentTracing, net, netLog, powerSaveBlocker, safeStorage, screen, webContents, WebContentsView } from 'electron';
|
|
3
3
|
import process$1 from 'node:process';
|
|
4
4
|
import { inspect } from 'node:util';
|
|
5
5
|
import { spawn } from 'node:child_process';
|
|
@@ -479,18 +479,6 @@ function requireLodash_debounce () {
|
|
|
479
479
|
var lodash_debounceExports = requireLodash_debounce();
|
|
480
480
|
const debounce = /*@__PURE__*/getDefaultExportFromCjs(lodash_debounceExports);
|
|
481
481
|
|
|
482
|
-
const list = [
|
|
483
|
-
// Native ES errors https://262.ecma-international.org/12.0/#sec-well-known-intrinsic-objects
|
|
484
|
-
EvalError, RangeError, ReferenceError, SyntaxError, TypeError, URIError,
|
|
485
|
-
// Built-in errors
|
|
486
|
-
globalThis.DOMException,
|
|
487
|
-
// Node-specific errors
|
|
488
|
-
// https://nodejs.org/api/errors.html
|
|
489
|
-
globalThis.AssertionError, globalThis.SystemError]
|
|
490
|
-
// Non-native Errors are used with `globalThis` because they might be missing. This filter drops them when undefined.
|
|
491
|
-
.filter(Boolean).map(constructor => [constructor.name, constructor]);
|
|
492
|
-
const errorConstructors = new Map(list);
|
|
493
|
-
|
|
494
482
|
const commonProperties = [{
|
|
495
483
|
property: 'name',
|
|
496
484
|
enumerable: false
|
|
@@ -514,7 +502,6 @@ const toJSON = from => {
|
|
|
514
502
|
toJsonWasCalled.delete(from);
|
|
515
503
|
return json;
|
|
516
504
|
};
|
|
517
|
-
const getErrorConstructor$1 = name => errorConstructors.get(name) ?? Error;
|
|
518
505
|
|
|
519
506
|
// eslint-disable-next-line complexity
|
|
520
507
|
const destroyCircular = ({
|
|
@@ -530,9 +517,6 @@ const destroyCircular = ({
|
|
|
530
517
|
if (!to) {
|
|
531
518
|
if (Array.isArray(from)) {
|
|
532
519
|
to = [];
|
|
533
|
-
} else if (!serialize && isErrorLike(from)) {
|
|
534
|
-
const Error = getErrorConstructor$1(from.name);
|
|
535
|
-
to = new Error();
|
|
536
520
|
} else {
|
|
537
521
|
to = {};
|
|
538
522
|
}
|
|
@@ -588,7 +572,7 @@ const destroyCircular = ({
|
|
|
588
572
|
if (typeof from[property] !== 'undefined' && from[property] !== null) {
|
|
589
573
|
Object.defineProperty(to, property, {
|
|
590
574
|
value: isErrorLike(from[property]) ? continueDestroyCircular(from[property]) : from[property],
|
|
591
|
-
enumerable:
|
|
575
|
+
enumerable: true ,
|
|
592
576
|
configurable: true,
|
|
593
577
|
writable: true
|
|
594
578
|
});
|
|
@@ -1698,7 +1682,7 @@ function requireConversions() {
|
|
|
1698
1682
|
var b;
|
|
1699
1683
|
r = x * 3.2406 + y * -1.5372 + z * -0.4986;
|
|
1700
1684
|
g = x * -0.9689 + y * 1.8758 + z * 0.0415;
|
|
1701
|
-
b = x * 0.0557 + y * -0.
|
|
1685
|
+
b = x * 0.0557 + y * -0.204 + z * 1.0570;
|
|
1702
1686
|
|
|
1703
1687
|
// assume sRGB
|
|
1704
1688
|
r = r > 0.0031308 ? 1.055 * Math.pow(r, 1.0 / 2.4) - 0.055 : r * 12.92;
|
|
@@ -3654,7 +3638,7 @@ const getErrorResponse = (message, error, preparePrettyError, logError) => {
|
|
|
3654
3638
|
const errorProperty = getErrorProperty(error, prettyError);
|
|
3655
3639
|
return create$1$2(message, errorProperty);
|
|
3656
3640
|
};
|
|
3657
|
-
const create$
|
|
3641
|
+
const create$5 = (message, result) => {
|
|
3658
3642
|
return {
|
|
3659
3643
|
jsonrpc: Two,
|
|
3660
3644
|
id: message.id,
|
|
@@ -3663,7 +3647,7 @@ const create$7 = (message, result) => {
|
|
|
3663
3647
|
};
|
|
3664
3648
|
const getSuccessResponse = (message, result) => {
|
|
3665
3649
|
const resultProperty = result ?? null;
|
|
3666
|
-
return create$
|
|
3650
|
+
return create$5(message, resultProperty);
|
|
3667
3651
|
};
|
|
3668
3652
|
const getResponse = async (message, ipc, execute, preparePrettyError, logError, requiresSocket) => {
|
|
3669
3653
|
try {
|
|
@@ -4081,27 +4065,6 @@ class VError extends Error {
|
|
|
4081
4065
|
}
|
|
4082
4066
|
}
|
|
4083
4067
|
|
|
4084
|
-
const walkValue = (value, transferrables, isTransferrable) => {
|
|
4085
|
-
if (!value) {
|
|
4086
|
-
return;
|
|
4087
|
-
}
|
|
4088
|
-
if (isTransferrable(value)) {
|
|
4089
|
-
transferrables.push(value);
|
|
4090
|
-
return;
|
|
4091
|
-
}
|
|
4092
|
-
if (Array.isArray(value)) {
|
|
4093
|
-
for (const item of value) {
|
|
4094
|
-
walkValue(item, transferrables, isTransferrable);
|
|
4095
|
-
}
|
|
4096
|
-
return;
|
|
4097
|
-
}
|
|
4098
|
-
if (typeof value === 'object') {
|
|
4099
|
-
for (const property of Object.values(value)) {
|
|
4100
|
-
walkValue(property, transferrables, isTransferrable);
|
|
4101
|
-
}
|
|
4102
|
-
return;
|
|
4103
|
-
}
|
|
4104
|
-
};
|
|
4105
4068
|
const isMessagePort = value => {
|
|
4106
4069
|
return value && value instanceof MessagePort;
|
|
4107
4070
|
};
|
|
@@ -4126,6 +4089,27 @@ const isTransferrable = value => {
|
|
|
4126
4089
|
}
|
|
4127
4090
|
return false;
|
|
4128
4091
|
};
|
|
4092
|
+
const walkValue = (value, transferrables, isTransferrable) => {
|
|
4093
|
+
if (!value) {
|
|
4094
|
+
return;
|
|
4095
|
+
}
|
|
4096
|
+
if (isTransferrable(value)) {
|
|
4097
|
+
transferrables.push(value);
|
|
4098
|
+
return;
|
|
4099
|
+
}
|
|
4100
|
+
if (Array.isArray(value)) {
|
|
4101
|
+
for (const item of value) {
|
|
4102
|
+
walkValue(item, transferrables, isTransferrable);
|
|
4103
|
+
}
|
|
4104
|
+
return;
|
|
4105
|
+
}
|
|
4106
|
+
if (typeof value === 'object') {
|
|
4107
|
+
for (const property of Object.values(value)) {
|
|
4108
|
+
walkValue(property, transferrables, isTransferrable);
|
|
4109
|
+
}
|
|
4110
|
+
return;
|
|
4111
|
+
}
|
|
4112
|
+
};
|
|
4129
4113
|
const getTransferrables = value => {
|
|
4130
4114
|
const transferrables = [];
|
|
4131
4115
|
walkValue(value, transferrables, isTransferrable);
|
|
@@ -4207,30 +4191,35 @@ const NewLine = '\n';
|
|
|
4207
4191
|
const joinLines = lines => {
|
|
4208
4192
|
return lines.join(NewLine);
|
|
4209
4193
|
};
|
|
4210
|
-
const
|
|
4211
|
-
|
|
4212
|
-
|
|
4213
|
-
|
|
4214
|
-
return line.includes('[ERR_MODULE_NOT_FOUND]');
|
|
4194
|
+
const RE_AT = /^\s+at/;
|
|
4195
|
+
const RE_AT_PROMISE_INDEX = /^\s*at async Promise.all \(index \d+\)$/;
|
|
4196
|
+
const isNormalStackLine = line => {
|
|
4197
|
+
return RE_AT.test(line) && !RE_AT_PROMISE_INDEX.test(line);
|
|
4215
4198
|
};
|
|
4216
|
-
const
|
|
4217
|
-
const
|
|
4218
|
-
|
|
4219
|
-
|
|
4199
|
+
const getDetails = lines => {
|
|
4200
|
+
const index = lines.findIndex(isNormalStackLine);
|
|
4201
|
+
if (index === -1) {
|
|
4202
|
+
return {
|
|
4203
|
+
actualMessage: joinLines(lines),
|
|
4204
|
+
rest: []
|
|
4205
|
+
};
|
|
4206
|
+
}
|
|
4207
|
+
let lastIndex = index - 1;
|
|
4208
|
+
while (++lastIndex < lines.length) {
|
|
4209
|
+
if (!isNormalStackLine(lines[lastIndex])) {
|
|
4210
|
+
break;
|
|
4211
|
+
}
|
|
4212
|
+
}
|
|
4220
4213
|
return {
|
|
4221
|
-
|
|
4222
|
-
|
|
4214
|
+
actualMessage: lines[index - 1],
|
|
4215
|
+
rest: lines.slice(index, lastIndex)
|
|
4223
4216
|
};
|
|
4224
4217
|
};
|
|
4225
|
-
const
|
|
4226
|
-
|
|
4218
|
+
const splitLines = lines => {
|
|
4219
|
+
return lines.split(NewLine);
|
|
4220
|
+
};
|
|
4227
4221
|
const RE_MESSAGE_CODE_BLOCK_START = /^Error: The module '.*'$/;
|
|
4228
4222
|
const RE_MESSAGE_CODE_BLOCK_END = /^\s* at/;
|
|
4229
|
-
const RE_AT = /^\s+at/;
|
|
4230
|
-
const RE_AT_PROMISE_INDEX = /^\s*at async Promise.all \(index \d+\)$/;
|
|
4231
|
-
const isUnhelpfulNativeModuleError = stderr => {
|
|
4232
|
-
return RE_NATIVE_MODULE_ERROR.test(stderr) && RE_NATIVE_MODULE_ERROR_2.test(stderr);
|
|
4233
|
-
};
|
|
4234
4223
|
const isMessageCodeBlockStartIndex = line => {
|
|
4235
4224
|
return RE_MESSAGE_CODE_BLOCK_START.test(line);
|
|
4236
4225
|
};
|
|
@@ -4245,51 +4234,46 @@ const getMessageCodeBlock = stderr => {
|
|
|
4245
4234
|
const relevantMessage = relevantLines.join(' ').slice('Error: '.length);
|
|
4246
4235
|
return relevantMessage;
|
|
4247
4236
|
};
|
|
4248
|
-
const
|
|
4249
|
-
|
|
4237
|
+
const isModuleNotFoundMessage = line => {
|
|
4238
|
+
return line.includes('[ERR_MODULE_NOT_FOUND]');
|
|
4239
|
+
};
|
|
4240
|
+
const getModuleNotFoundError = stderr => {
|
|
4241
|
+
const lines = splitLines(stderr);
|
|
4242
|
+
const messageIndex = lines.findIndex(isModuleNotFoundMessage);
|
|
4243
|
+
const message = lines[messageIndex];
|
|
4250
4244
|
return {
|
|
4251
|
-
message
|
|
4252
|
-
code:
|
|
4245
|
+
message,
|
|
4246
|
+
code: ERR_MODULE_NOT_FOUND
|
|
4253
4247
|
};
|
|
4254
4248
|
};
|
|
4255
|
-
const
|
|
4249
|
+
const isModuleNotFoundError = stderr => {
|
|
4256
4250
|
if (!stderr) {
|
|
4257
4251
|
return false;
|
|
4258
4252
|
}
|
|
4259
|
-
return stderr.includes('
|
|
4260
|
-
};
|
|
4261
|
-
const getModuleSyntaxError = () => {
|
|
4262
|
-
return {
|
|
4263
|
-
message: `ES Modules are not supported in electron`,
|
|
4264
|
-
code: E_MODULES_NOT_SUPPORTED_IN_ELECTRON
|
|
4265
|
-
};
|
|
4253
|
+
return stderr.includes('ERR_MODULE_NOT_FOUND');
|
|
4266
4254
|
};
|
|
4267
|
-
const
|
|
4255
|
+
const isModulesSyntaxError = stderr => {
|
|
4268
4256
|
if (!stderr) {
|
|
4269
4257
|
return false;
|
|
4270
4258
|
}
|
|
4271
|
-
return stderr.includes('
|
|
4259
|
+
return stderr.includes('SyntaxError: Cannot use import statement outside a module');
|
|
4272
4260
|
};
|
|
4273
|
-
const
|
|
4274
|
-
|
|
4261
|
+
const RE_NATIVE_MODULE_ERROR = /^innerError Error: Cannot find module '.*.node'/;
|
|
4262
|
+
const RE_NATIVE_MODULE_ERROR_2 = /was compiled against a different Node.js version/;
|
|
4263
|
+
const isUnhelpfulNativeModuleError = stderr => {
|
|
4264
|
+
return RE_NATIVE_MODULE_ERROR.test(stderr) && RE_NATIVE_MODULE_ERROR_2.test(stderr);
|
|
4275
4265
|
};
|
|
4276
|
-
const
|
|
4277
|
-
const
|
|
4278
|
-
if (index === -1) {
|
|
4279
|
-
return {
|
|
4280
|
-
actualMessage: joinLines(lines),
|
|
4281
|
-
rest: []
|
|
4282
|
-
};
|
|
4283
|
-
}
|
|
4284
|
-
let lastIndex = index - 1;
|
|
4285
|
-
while (++lastIndex < lines.length) {
|
|
4286
|
-
if (!isNormalStackLine(lines[lastIndex])) {
|
|
4287
|
-
break;
|
|
4288
|
-
}
|
|
4289
|
-
}
|
|
4266
|
+
const getNativeModuleErrorMessage = stderr => {
|
|
4267
|
+
const message = getMessageCodeBlock(stderr);
|
|
4290
4268
|
return {
|
|
4291
|
-
|
|
4292
|
-
|
|
4269
|
+
message: `Incompatible native node module: ${message}`,
|
|
4270
|
+
code: E_INCOMPATIBLE_NATIVE_MODULE
|
|
4271
|
+
};
|
|
4272
|
+
};
|
|
4273
|
+
const getModuleSyntaxError = () => {
|
|
4274
|
+
return {
|
|
4275
|
+
message: `ES Modules are not supported in electron`,
|
|
4276
|
+
code: E_MODULES_NOT_SUPPORTED_IN_ELECTRON
|
|
4293
4277
|
};
|
|
4294
4278
|
};
|
|
4295
4279
|
const getHelpfulChildProcessError = (stdout, stderr) => {
|
|
@@ -4308,7 +4292,7 @@ const getHelpfulChildProcessError = (stdout, stderr) => {
|
|
|
4308
4292
|
rest
|
|
4309
4293
|
} = getDetails(lines);
|
|
4310
4294
|
return {
|
|
4311
|
-
message:
|
|
4295
|
+
message: actualMessage,
|
|
4312
4296
|
code: '',
|
|
4313
4297
|
stack: rest
|
|
4314
4298
|
};
|
|
@@ -4347,13 +4331,10 @@ const listen$b = ({
|
|
|
4347
4331
|
}
|
|
4348
4332
|
return messagePort;
|
|
4349
4333
|
};
|
|
4350
|
-
const signal$
|
|
4334
|
+
const signal$c = messagePort => {
|
|
4351
4335
|
messagePort.start();
|
|
4352
4336
|
};
|
|
4353
4337
|
class IpcChildWithElectronMessagePort extends Ipc {
|
|
4354
|
-
constructor(port) {
|
|
4355
|
-
super(port);
|
|
4356
|
-
}
|
|
4357
4338
|
getData = getActualDataElectron;
|
|
4358
4339
|
send(message) {
|
|
4359
4340
|
this._rawIpc.postMessage(message);
|
|
@@ -4375,14 +4356,14 @@ class IpcChildWithElectronMessagePort extends Ipc {
|
|
|
4375
4356
|
this._rawIpc.on('close', callback);
|
|
4376
4357
|
}
|
|
4377
4358
|
}
|
|
4378
|
-
const wrap$
|
|
4359
|
+
const wrap$j = messagePort => {
|
|
4379
4360
|
return new IpcChildWithElectronMessagePort(messagePort);
|
|
4380
4361
|
};
|
|
4381
4362
|
const IpcChildWithElectronMessagePort$1 = {
|
|
4382
4363
|
__proto__: null,
|
|
4383
4364
|
listen: listen$b,
|
|
4384
|
-
signal: signal$
|
|
4385
|
-
wrap: wrap$
|
|
4365
|
+
signal: signal$c,
|
|
4366
|
+
wrap: wrap$j
|
|
4386
4367
|
};
|
|
4387
4368
|
|
|
4388
4369
|
// @ts-ignore
|
|
@@ -4410,7 +4391,7 @@ const listen$a = () => {
|
|
|
4410
4391
|
}
|
|
4411
4392
|
return parentPort;
|
|
4412
4393
|
};
|
|
4413
|
-
const signal$
|
|
4394
|
+
const signal$b = parentPort => {
|
|
4414
4395
|
parentPort.postMessage(readyMessage);
|
|
4415
4396
|
};
|
|
4416
4397
|
class IpcChildWithElectronUtilityProcess extends Ipc {
|
|
@@ -4437,14 +4418,14 @@ class IpcChildWithElectronUtilityProcess extends Ipc {
|
|
|
4437
4418
|
this._rawIpc.on('message', callback);
|
|
4438
4419
|
}
|
|
4439
4420
|
}
|
|
4440
|
-
const wrap$
|
|
4421
|
+
const wrap$i = parentPort => {
|
|
4441
4422
|
return new IpcChildWithElectronUtilityProcess(parentPort);
|
|
4442
4423
|
};
|
|
4443
4424
|
const IpcChildWithElectronUtilityProcess$1 = {
|
|
4444
4425
|
__proto__: null,
|
|
4445
4426
|
listen: listen$a,
|
|
4446
|
-
signal: signal$
|
|
4447
|
-
wrap: wrap$
|
|
4427
|
+
signal: signal$b,
|
|
4428
|
+
wrap: wrap$i
|
|
4448
4429
|
};
|
|
4449
4430
|
const withResolvers$2 = () => {
|
|
4450
4431
|
let _resolve;
|
|
@@ -4452,17 +4433,11 @@ const withResolvers$2 = () => {
|
|
|
4452
4433
|
_resolve = resolve;
|
|
4453
4434
|
});
|
|
4454
4435
|
return {
|
|
4436
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
4455
4437
|
resolve: _resolve,
|
|
4456
4438
|
promise
|
|
4457
4439
|
};
|
|
4458
4440
|
};
|
|
4459
|
-
const getTransferrablesNode = value => {
|
|
4460
|
-
const transferrables = getTransferrables(value);
|
|
4461
|
-
if (transferrables.length === 0) {
|
|
4462
|
-
throw new Error(`no transferrables found`);
|
|
4463
|
-
}
|
|
4464
|
-
return transferrables[0];
|
|
4465
|
-
};
|
|
4466
4441
|
const getActualData = (message, handle) => {
|
|
4467
4442
|
if (handle) {
|
|
4468
4443
|
return {
|
|
@@ -4472,19 +4447,23 @@ const getActualData = (message, handle) => {
|
|
|
4472
4447
|
}
|
|
4473
4448
|
return message;
|
|
4474
4449
|
};
|
|
4450
|
+
const getTransferrablesNode = value => {
|
|
4451
|
+
const transferrables = getTransferrables(value);
|
|
4452
|
+
if (transferrables.length === 0) {
|
|
4453
|
+
throw new Error(`no transferrables found`);
|
|
4454
|
+
}
|
|
4455
|
+
return transferrables[0];
|
|
4456
|
+
};
|
|
4475
4457
|
const listen$5 = async () => {
|
|
4476
4458
|
if (!process.send) {
|
|
4477
4459
|
throw new Error('process.send must be defined');
|
|
4478
4460
|
}
|
|
4479
4461
|
return process;
|
|
4480
4462
|
};
|
|
4481
|
-
const signal$
|
|
4463
|
+
const signal$7 = process => {
|
|
4482
4464
|
process.send(readyMessage);
|
|
4483
4465
|
};
|
|
4484
4466
|
class IpcChildWithNodeForkedProcess extends Ipc {
|
|
4485
|
-
constructor(process) {
|
|
4486
|
-
super(process);
|
|
4487
|
-
}
|
|
4488
4467
|
getData(message, handle) {
|
|
4489
4468
|
return getActualData(message, handle);
|
|
4490
4469
|
}
|
|
@@ -4505,14 +4484,14 @@ class IpcChildWithNodeForkedProcess extends Ipc {
|
|
|
4505
4484
|
// ignore
|
|
4506
4485
|
}
|
|
4507
4486
|
}
|
|
4508
|
-
const wrap$
|
|
4487
|
+
const wrap$d = process => {
|
|
4509
4488
|
return new IpcChildWithNodeForkedProcess(process);
|
|
4510
4489
|
};
|
|
4511
4490
|
const IpcChildWithNodeForkedProcess$1 = {
|
|
4512
4491
|
__proto__: null,
|
|
4513
4492
|
listen: listen$5,
|
|
4514
|
-
signal: signal$
|
|
4515
|
-
wrap: wrap$
|
|
4493
|
+
signal: signal$7,
|
|
4494
|
+
wrap: wrap$d
|
|
4516
4495
|
};
|
|
4517
4496
|
const listen$3 = async () => {
|
|
4518
4497
|
const {
|
|
@@ -4523,13 +4502,10 @@ const listen$3 = async () => {
|
|
|
4523
4502
|
}
|
|
4524
4503
|
return parentPort;
|
|
4525
4504
|
};
|
|
4526
|
-
const signal$
|
|
4505
|
+
const signal$5 = parentPort => {
|
|
4527
4506
|
parentPort.postMessage(readyMessage);
|
|
4528
4507
|
};
|
|
4529
4508
|
class IpcChildWithNodeWorker extends Ipc {
|
|
4530
|
-
constructor(port) {
|
|
4531
|
-
super(port);
|
|
4532
|
-
}
|
|
4533
4509
|
getData(data) {
|
|
4534
4510
|
return data;
|
|
4535
4511
|
}
|
|
@@ -4550,14 +4526,14 @@ class IpcChildWithNodeWorker extends Ipc {
|
|
|
4550
4526
|
this._rawIpc.close();
|
|
4551
4527
|
}
|
|
4552
4528
|
}
|
|
4553
|
-
const wrap$
|
|
4529
|
+
const wrap$b = parentPort => {
|
|
4554
4530
|
return new IpcChildWithNodeWorker(parentPort);
|
|
4555
4531
|
};
|
|
4556
4532
|
const IpcChildWithNodeWorker$1 = {
|
|
4557
4533
|
__proto__: null,
|
|
4558
4534
|
listen: listen$3,
|
|
4559
|
-
signal: signal$
|
|
4560
|
-
wrap: wrap$
|
|
4535
|
+
signal: signal$5,
|
|
4536
|
+
wrap: wrap$b
|
|
4561
4537
|
};
|
|
4562
4538
|
const preloadChannelType = 'port';
|
|
4563
4539
|
const listen$2 = ({
|
|
@@ -4597,16 +4573,16 @@ class IpcChildWithRendererProcess2 extends Ipc {
|
|
|
4597
4573
|
this._rawIpc.on('destroyed', callback);
|
|
4598
4574
|
}
|
|
4599
4575
|
}
|
|
4600
|
-
const wrap$
|
|
4576
|
+
const wrap$a = webContents => {
|
|
4601
4577
|
return new IpcChildWithRendererProcess2(webContents);
|
|
4602
4578
|
};
|
|
4603
4579
|
const IpcChildWithRendererProcess2$1 = {
|
|
4604
4580
|
__proto__: null,
|
|
4605
4581
|
listen: listen$2,
|
|
4606
|
-
wrap: wrap$
|
|
4582
|
+
wrap: wrap$a
|
|
4607
4583
|
};
|
|
4608
|
-
const Open =
|
|
4609
|
-
const Close =
|
|
4584
|
+
const Open = 2;
|
|
4585
|
+
const Close = 3;
|
|
4610
4586
|
const addListener = (emitter, type, callback) => {
|
|
4611
4587
|
if ('addEventListener' in emitter) {
|
|
4612
4588
|
emitter.addEventListener(type, callback);
|
|
@@ -4722,12 +4698,12 @@ const listen$1 = async ({
|
|
|
4722
4698
|
}
|
|
4723
4699
|
return webSocket;
|
|
4724
4700
|
};
|
|
4725
|
-
const signal$
|
|
4701
|
+
const signal$4 = webSocket => {
|
|
4726
4702
|
webSocket.resume();
|
|
4727
4703
|
};
|
|
4728
4704
|
|
|
4729
4705
|
// @ts-ignore
|
|
4730
|
-
const wrap$
|
|
4706
|
+
const wrap$9 = webSocket => {
|
|
4731
4707
|
return {
|
|
4732
4708
|
webSocket,
|
|
4733
4709
|
/**
|
|
@@ -4776,10 +4752,10 @@ const wrap$8 = webSocket => {
|
|
|
4776
4752
|
const IpcChildWithWebSocket = {
|
|
4777
4753
|
__proto__: null,
|
|
4778
4754
|
listen: listen$1,
|
|
4779
|
-
signal: signal$
|
|
4780
|
-
wrap: wrap$
|
|
4755
|
+
signal: signal$4,
|
|
4756
|
+
wrap: wrap$9
|
|
4781
4757
|
};
|
|
4782
|
-
const create$
|
|
4758
|
+
const create$7 = ({
|
|
4783
4759
|
messagePort
|
|
4784
4760
|
}) => {
|
|
4785
4761
|
if (!isMessagePortMain(messagePort)) {
|
|
@@ -4787,13 +4763,10 @@ const create$6 = ({
|
|
|
4787
4763
|
}
|
|
4788
4764
|
return messagePort;
|
|
4789
4765
|
};
|
|
4790
|
-
const signal$
|
|
4766
|
+
const signal$2 = messagePort => {
|
|
4791
4767
|
messagePort.start();
|
|
4792
4768
|
};
|
|
4793
4769
|
class IpcParentWithElectronMessagePort extends Ipc {
|
|
4794
|
-
constructor(port) {
|
|
4795
|
-
super(port);
|
|
4796
|
-
}
|
|
4797
4770
|
getData = getActualDataElectron;
|
|
4798
4771
|
send(message) {
|
|
4799
4772
|
this._rawIpc.postMessage(message);
|
|
@@ -4815,25 +4788,18 @@ class IpcParentWithElectronMessagePort extends Ipc {
|
|
|
4815
4788
|
this._rawIpc.on('close', callback);
|
|
4816
4789
|
}
|
|
4817
4790
|
}
|
|
4818
|
-
const wrap$
|
|
4791
|
+
const wrap$7 = messagePort => {
|
|
4819
4792
|
return new IpcParentWithElectronMessagePort(messagePort);
|
|
4820
4793
|
};
|
|
4821
4794
|
const IpcParentWithElectronMessagePort$1 = {
|
|
4822
4795
|
__proto__: null,
|
|
4823
|
-
create: create$
|
|
4824
|
-
signal: signal$
|
|
4825
|
-
wrap: wrap$
|
|
4796
|
+
create: create$7,
|
|
4797
|
+
signal: signal$2,
|
|
4798
|
+
wrap: wrap$7
|
|
4826
4799
|
};
|
|
4827
4800
|
const Exit = 1;
|
|
4828
4801
|
const Error$2 = 2;
|
|
4829
4802
|
const Message$1 = 3;
|
|
4830
|
-
|
|
4831
|
-
/**
|
|
4832
|
-
*
|
|
4833
|
-
* @param {any} utilityProcess
|
|
4834
|
-
* @returns
|
|
4835
|
-
*/
|
|
4836
|
-
// @ts-ignore
|
|
4837
4803
|
const getFirstUtilityProcessEvent = async utilityProcess => {
|
|
4838
4804
|
const {
|
|
4839
4805
|
resolve,
|
|
@@ -4841,7 +4807,6 @@ const getFirstUtilityProcessEvent = async utilityProcess => {
|
|
|
4841
4807
|
} = withResolvers$2();
|
|
4842
4808
|
let stdout = '';
|
|
4843
4809
|
let stderr = '';
|
|
4844
|
-
// @ts-ignore
|
|
4845
4810
|
const cleanup = value => {
|
|
4846
4811
|
// @ts-ignore
|
|
4847
4812
|
utilityProcess.stderr.off('data', handleStdErrData);
|
|
@@ -4849,18 +4814,14 @@ const getFirstUtilityProcessEvent = async utilityProcess => {
|
|
|
4849
4814
|
utilityProcess.stdout.off('data', handleStdoutData);
|
|
4850
4815
|
utilityProcess.off('message', handleMessage);
|
|
4851
4816
|
utilityProcess.off('exit', handleExit);
|
|
4852
|
-
// @ts-ignore
|
|
4853
4817
|
resolve(value);
|
|
4854
4818
|
};
|
|
4855
|
-
// @ts-ignore
|
|
4856
4819
|
const handleStdErrData = data => {
|
|
4857
4820
|
stderr += data;
|
|
4858
4821
|
};
|
|
4859
|
-
// @ts-ignore
|
|
4860
4822
|
const handleStdoutData = data => {
|
|
4861
4823
|
stdout += data;
|
|
4862
4824
|
};
|
|
4863
|
-
// @ts-ignore
|
|
4864
4825
|
const handleMessage = event => {
|
|
4865
4826
|
cleanup({
|
|
4866
4827
|
type: Message$1,
|
|
@@ -4869,7 +4830,6 @@ const getFirstUtilityProcessEvent = async utilityProcess => {
|
|
|
4869
4830
|
stderr
|
|
4870
4831
|
});
|
|
4871
4832
|
};
|
|
4872
|
-
// @ts-ignore
|
|
4873
4833
|
const handleExit = event => {
|
|
4874
4834
|
cleanup({
|
|
4875
4835
|
type: Exit,
|
|
@@ -4884,7 +4844,6 @@ const getFirstUtilityProcessEvent = async utilityProcess => {
|
|
|
4884
4844
|
utilityProcess.stdout.on('data', handleStdoutData);
|
|
4885
4845
|
utilityProcess.on('message', handleMessage);
|
|
4886
4846
|
utilityProcess.on('exit', handleExit);
|
|
4887
|
-
// @ts-ignore
|
|
4888
4847
|
const {
|
|
4889
4848
|
type,
|
|
4890
4849
|
event
|
|
@@ -4896,9 +4855,7 @@ const getFirstUtilityProcessEvent = async utilityProcess => {
|
|
|
4896
4855
|
stderr
|
|
4897
4856
|
};
|
|
4898
4857
|
};
|
|
4899
|
-
|
|
4900
|
-
// @ts-ignore
|
|
4901
|
-
const create$5 = async ({
|
|
4858
|
+
const create$6 = async ({
|
|
4902
4859
|
path,
|
|
4903
4860
|
argv = [],
|
|
4904
4861
|
execArgv = [],
|
|
@@ -4961,13 +4918,13 @@ let IpcParentWithElectronUtilityProcess$1 = class IpcParentWithElectronUtilityPr
|
|
|
4961
4918
|
this._rawIpc.on('message', callback);
|
|
4962
4919
|
}
|
|
4963
4920
|
};
|
|
4964
|
-
const wrap$
|
|
4921
|
+
const wrap$6 = process => {
|
|
4965
4922
|
return new IpcParentWithElectronUtilityProcess$1(process);
|
|
4966
4923
|
};
|
|
4967
4924
|
const IpcParentWithElectronUtilityProcess$1$1 = {
|
|
4968
4925
|
__proto__: null,
|
|
4969
|
-
create: create$
|
|
4970
|
-
wrap: wrap$
|
|
4926
|
+
create: create$6,
|
|
4927
|
+
wrap: wrap$6
|
|
4971
4928
|
};
|
|
4972
4929
|
class ChildProcessError extends Error {
|
|
4973
4930
|
// @ts-ignore
|
|
@@ -5009,10 +4966,7 @@ const fixNodeChildProcessParameters = value => {
|
|
|
5009
4966
|
transfer: transfer[0]
|
|
5010
4967
|
};
|
|
5011
4968
|
};
|
|
5012
|
-
|
|
5013
|
-
// @ts-ignore
|
|
5014
4969
|
const getFirstNodeChildProcessEvent = async childProcess => {
|
|
5015
|
-
// @ts-ignore
|
|
5016
4970
|
const {
|
|
5017
4971
|
type,
|
|
5018
4972
|
event,
|
|
@@ -5021,7 +4975,6 @@ const getFirstNodeChildProcessEvent = async childProcess => {
|
|
|
5021
4975
|
} = await new Promise((resolve, reject) => {
|
|
5022
4976
|
let stderr = '';
|
|
5023
4977
|
let stdout = '';
|
|
5024
|
-
// @ts-ignore
|
|
5025
4978
|
const cleanup = value => {
|
|
5026
4979
|
if (childProcess.stdout && childProcess.stderr) {
|
|
5027
4980
|
childProcess.stderr.off('data', handleStdErrData);
|
|
@@ -5032,15 +4985,12 @@ const getFirstNodeChildProcessEvent = async childProcess => {
|
|
|
5032
4985
|
childProcess.off('error', handleError);
|
|
5033
4986
|
resolve(value);
|
|
5034
4987
|
};
|
|
5035
|
-
// @ts-ignore
|
|
5036
4988
|
const handleStdErrData = data => {
|
|
5037
4989
|
stderr += data;
|
|
5038
4990
|
};
|
|
5039
|
-
// @ts-ignore
|
|
5040
4991
|
const handleStdoutData = data => {
|
|
5041
4992
|
stdout += data;
|
|
5042
4993
|
};
|
|
5043
|
-
// @ts-ignore
|
|
5044
4994
|
const handleMessage = event => {
|
|
5045
4995
|
cleanup({
|
|
5046
4996
|
type: Message$1,
|
|
@@ -5049,7 +4999,6 @@ const getFirstNodeChildProcessEvent = async childProcess => {
|
|
|
5049
4999
|
stderr
|
|
5050
5000
|
});
|
|
5051
5001
|
};
|
|
5052
|
-
// @ts-ignore
|
|
5053
5002
|
const handleExit = event => {
|
|
5054
5003
|
cleanup({
|
|
5055
5004
|
type: Exit,
|
|
@@ -5058,7 +5007,6 @@ const getFirstNodeChildProcessEvent = async childProcess => {
|
|
|
5058
5007
|
stderr
|
|
5059
5008
|
});
|
|
5060
5009
|
};
|
|
5061
|
-
// @ts-ignore
|
|
5062
5010
|
const handleError = event => {
|
|
5063
5011
|
cleanup({
|
|
5064
5012
|
type: Error$2,
|
|
@@ -5184,7 +5132,6 @@ const create$1$1 = async ({
|
|
|
5184
5132
|
env = process.env,
|
|
5185
5133
|
execArgv = []
|
|
5186
5134
|
}) => {
|
|
5187
|
-
// @ts-ignore
|
|
5188
5135
|
string(path);
|
|
5189
5136
|
const actualArgv = ['--ipc-type=node-worker', ...argv];
|
|
5190
5137
|
const actualEnv = {
|
|
@@ -5199,7 +5146,6 @@ const create$1$1 = async ({
|
|
|
5199
5146
|
env: actualEnv,
|
|
5200
5147
|
execArgv
|
|
5201
5148
|
});
|
|
5202
|
-
// @ts-ignore
|
|
5203
5149
|
const {
|
|
5204
5150
|
type,
|
|
5205
5151
|
event
|
|
@@ -5216,9 +5162,6 @@ const create$1$1 = async ({
|
|
|
5216
5162
|
return worker;
|
|
5217
5163
|
};
|
|
5218
5164
|
class IpcParentWithNodeWorker extends Ipc {
|
|
5219
|
-
constructor(worker) {
|
|
5220
|
-
super(worker);
|
|
5221
|
-
}
|
|
5222
5165
|
getData(message) {
|
|
5223
5166
|
return message;
|
|
5224
5167
|
}
|
|
@@ -5232,8 +5175,8 @@ class IpcParentWithNodeWorker extends Ipc {
|
|
|
5232
5175
|
} = fixNodeWorkerParameters(message);
|
|
5233
5176
|
this._rawIpc.postMessage(newValue, transfer);
|
|
5234
5177
|
}
|
|
5235
|
-
dispose() {
|
|
5236
|
-
this._rawIpc.terminate();
|
|
5178
|
+
async dispose() {
|
|
5179
|
+
await this._rawIpc.terminate();
|
|
5237
5180
|
}
|
|
5238
5181
|
onClose(callback) {
|
|
5239
5182
|
this._rawIpc.on('exit', callback);
|
|
@@ -7311,8 +7254,12 @@ const getByName = name => {
|
|
|
7311
7254
|
return undefined;
|
|
7312
7255
|
};
|
|
7313
7256
|
|
|
7314
|
-
const
|
|
7315
|
-
|
|
7257
|
+
const {
|
|
7258
|
+
create: create$1
|
|
7259
|
+
} = IpcParentWithElectronUtilityProcess$1$1;
|
|
7260
|
+
const {
|
|
7261
|
+
wrap
|
|
7262
|
+
} = IpcParentWithElectronUtilityProcess$1$1;
|
|
7316
7263
|
const effects = ({
|
|
7317
7264
|
rawIpc,
|
|
7318
7265
|
name
|
|
@@ -7320,7 +7267,9 @@ const effects = ({
|
|
|
7320
7267
|
if (!rawIpc.pid) {
|
|
7321
7268
|
return;
|
|
7322
7269
|
}
|
|
7323
|
-
const
|
|
7270
|
+
const {
|
|
7271
|
+
pid
|
|
7272
|
+
} = rawIpc;
|
|
7324
7273
|
const formattedName = formatUtilityProcessName(name);
|
|
7325
7274
|
add(pid, rawIpc, formattedName);
|
|
7326
7275
|
const cleanup = () => {
|
package/package.json
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lvce-editor/main-process",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "",
|
|
5
|
-
"main": "dist/mainProcessMain.js",
|
|
6
|
-
"type": "module",
|
|
7
5
|
"keywords": [
|
|
8
6
|
"lvce-editor",
|
|
9
7
|
"electron"
|
|
10
8
|
],
|
|
11
|
-
"author": "LVCE Editor",
|
|
12
|
-
"license": "MIT",
|
|
13
9
|
"repository": {
|
|
14
10
|
"type": "git",
|
|
15
11
|
"url": "https://github.com/lvce-editor/main-process.git"
|
|
16
12
|
},
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"author": "LVCE Editor",
|
|
15
|
+
"type": "module",
|
|
16
|
+
"main": "dist/mainProcessMain.js",
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"electron": "35.0.2"
|
|
19
|
+
},
|
|
17
20
|
"engines": {
|
|
18
21
|
"node": ">=22"
|
|
19
|
-
},
|
|
20
|
-
"dependencies": {
|
|
21
|
-
"electron": "33.2.1"
|
|
22
22
|
}
|
|
23
23
|
}
|