@lvce-editor/main-process 4.11.0 → 5.0.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 +90 -96
- package/package.json +2 -2
package/dist/mainProcessMain.js
CHANGED
|
@@ -2291,7 +2291,7 @@ const getFirstEvent = (eventEmitter, eventMap) => {
|
|
|
2291
2291
|
}
|
|
2292
2292
|
return promise;
|
|
2293
2293
|
};
|
|
2294
|
-
const create$7 = ({
|
|
2294
|
+
const create$7$1 = ({
|
|
2295
2295
|
messagePort
|
|
2296
2296
|
}) => {
|
|
2297
2297
|
if (!isMessagePortMain(messagePort)) {
|
|
@@ -2329,7 +2329,7 @@ const wrap$7 = messagePort => {
|
|
|
2329
2329
|
};
|
|
2330
2330
|
const IpcParentWithElectronMessagePort$1 = {
|
|
2331
2331
|
__proto__: null,
|
|
2332
|
-
create: create$7,
|
|
2332
|
+
create: create$7$1,
|
|
2333
2333
|
signal: signal$2,
|
|
2334
2334
|
wrap: wrap$7
|
|
2335
2335
|
};
|
|
@@ -2391,7 +2391,7 @@ const getFirstUtilityProcessEvent = async utilityProcess => {
|
|
|
2391
2391
|
type
|
|
2392
2392
|
};
|
|
2393
2393
|
};
|
|
2394
|
-
const create$6 = async ({
|
|
2394
|
+
const create$6$1 = async ({
|
|
2395
2395
|
argv = [],
|
|
2396
2396
|
env = process.env,
|
|
2397
2397
|
execArgv = [],
|
|
@@ -2459,7 +2459,7 @@ const wrap$6 = process => {
|
|
|
2459
2459
|
};
|
|
2460
2460
|
const IpcParentWithElectronUtilityProcess$1$1 = {
|
|
2461
2461
|
__proto__: null,
|
|
2462
|
-
create: create$6,
|
|
2462
|
+
create: create$6$1,
|
|
2463
2463
|
wrap: wrap$6
|
|
2464
2464
|
};
|
|
2465
2465
|
class ChildProcessError extends Error {
|
|
@@ -2734,6 +2734,27 @@ const IpcParentWithNodeWorker$1 = {
|
|
|
2734
2734
|
wrap: wrap$1
|
|
2735
2735
|
};
|
|
2736
2736
|
|
|
2737
|
+
class CommandNotFoundError extends Error {
|
|
2738
|
+
constructor(command) {
|
|
2739
|
+
super(`Command not found ${command}`);
|
|
2740
|
+
this.name = 'CommandNotFoundError';
|
|
2741
|
+
}
|
|
2742
|
+
}
|
|
2743
|
+
const commands = Object.create(null);
|
|
2744
|
+
const register = commandMap => {
|
|
2745
|
+
Object.assign(commands, commandMap);
|
|
2746
|
+
};
|
|
2747
|
+
const getCommand = key => {
|
|
2748
|
+
return commands[key];
|
|
2749
|
+
};
|
|
2750
|
+
const execute$1 = (command, ...args) => {
|
|
2751
|
+
const fn = getCommand(command);
|
|
2752
|
+
if (!fn) {
|
|
2753
|
+
throw new CommandNotFoundError(command);
|
|
2754
|
+
}
|
|
2755
|
+
return fn(...args);
|
|
2756
|
+
};
|
|
2757
|
+
|
|
2737
2758
|
const Two$1 = '2.0';
|
|
2738
2759
|
const callbacks = Object.create(null);
|
|
2739
2760
|
const set$2 = (id, fn) => {
|
|
@@ -2746,14 +2767,14 @@ const remove$2 = id => {
|
|
|
2746
2767
|
delete callbacks[id];
|
|
2747
2768
|
};
|
|
2748
2769
|
let id$1 = 0;
|
|
2749
|
-
const create$3 = () => {
|
|
2770
|
+
const create$3$1 = () => {
|
|
2750
2771
|
return ++id$1;
|
|
2751
2772
|
};
|
|
2752
2773
|
const registerPromise$1 = () => {
|
|
2753
|
-
const id = create$3();
|
|
2774
|
+
const id = create$3$1();
|
|
2754
2775
|
const {
|
|
2755
|
-
|
|
2756
|
-
|
|
2776
|
+
promise,
|
|
2777
|
+
resolve
|
|
2757
2778
|
} = Promise.withResolvers();
|
|
2758
2779
|
set$2(id, resolve);
|
|
2759
2780
|
return {
|
|
@@ -2767,10 +2788,10 @@ const create$2$1 = (method, params) => {
|
|
|
2767
2788
|
promise
|
|
2768
2789
|
} = registerPromise$1();
|
|
2769
2790
|
const message = {
|
|
2791
|
+
id,
|
|
2770
2792
|
jsonrpc: Two$1,
|
|
2771
2793
|
method,
|
|
2772
|
-
params
|
|
2773
|
-
id
|
|
2794
|
+
params
|
|
2774
2795
|
};
|
|
2775
2796
|
return {
|
|
2776
2797
|
message,
|
|
@@ -2793,12 +2814,12 @@ const getErrorConstructor = (message, type) => {
|
|
|
2793
2814
|
switch (type) {
|
|
2794
2815
|
case DomException:
|
|
2795
2816
|
return DOMException;
|
|
2796
|
-
case TypeError$1:
|
|
2797
|
-
return TypeError;
|
|
2798
|
-
case SyntaxError$1:
|
|
2799
|
-
return SyntaxError;
|
|
2800
2817
|
case ReferenceError$1:
|
|
2801
2818
|
return ReferenceError;
|
|
2819
|
+
case SyntaxError$1:
|
|
2820
|
+
return SyntaxError;
|
|
2821
|
+
case TypeError$1:
|
|
2822
|
+
return TypeError;
|
|
2802
2823
|
default:
|
|
2803
2824
|
return Error;
|
|
2804
2825
|
}
|
|
@@ -2954,27 +2975,27 @@ const getErrorProperty = (error, prettyError) => {
|
|
|
2954
2975
|
if (error && error.code === E_COMMAND_NOT_FOUND) {
|
|
2955
2976
|
return {
|
|
2956
2977
|
code: MethodNotFound,
|
|
2957
|
-
|
|
2958
|
-
|
|
2978
|
+
data: error.stack,
|
|
2979
|
+
message: error.message
|
|
2959
2980
|
};
|
|
2960
2981
|
}
|
|
2961
2982
|
return {
|
|
2962
2983
|
code: Custom,
|
|
2963
|
-
message: prettyError.message,
|
|
2964
2984
|
data: {
|
|
2965
|
-
stack: getStack(prettyError),
|
|
2966
|
-
codeFrame: prettyError.codeFrame,
|
|
2967
|
-
type: getErrorType(prettyError),
|
|
2968
2985
|
code: prettyError.code,
|
|
2969
|
-
|
|
2970
|
-
|
|
2986
|
+
codeFrame: prettyError.codeFrame,
|
|
2987
|
+
name: prettyError.name,
|
|
2988
|
+
stack: getStack(prettyError),
|
|
2989
|
+
type: getErrorType(prettyError)
|
|
2990
|
+
},
|
|
2991
|
+
message: prettyError.message
|
|
2971
2992
|
};
|
|
2972
2993
|
};
|
|
2973
2994
|
const create$1$1 = (id, error) => {
|
|
2974
2995
|
return {
|
|
2975
|
-
|
|
2996
|
+
error,
|
|
2976
2997
|
id,
|
|
2977
|
-
|
|
2998
|
+
jsonrpc: Two$1
|
|
2978
2999
|
};
|
|
2979
3000
|
};
|
|
2980
3001
|
const getErrorResponse = (id, error, preparePrettyError, logError) => {
|
|
@@ -2983,27 +3004,27 @@ const getErrorResponse = (id, error, preparePrettyError, logError) => {
|
|
|
2983
3004
|
const errorProperty = getErrorProperty(error, prettyError);
|
|
2984
3005
|
return create$1$1(id, errorProperty);
|
|
2985
3006
|
};
|
|
2986
|
-
const create$
|
|
3007
|
+
const create$9 = (message, result) => {
|
|
2987
3008
|
return {
|
|
2988
|
-
jsonrpc: Two$1,
|
|
2989
3009
|
id: message.id,
|
|
3010
|
+
jsonrpc: Two$1,
|
|
2990
3011
|
result: result ?? null
|
|
2991
3012
|
};
|
|
2992
3013
|
};
|
|
2993
3014
|
const getSuccessResponse = (message, result) => {
|
|
2994
3015
|
const resultProperty = result ?? null;
|
|
2995
|
-
return create$
|
|
3016
|
+
return create$9(message, resultProperty);
|
|
2996
3017
|
};
|
|
2997
3018
|
const getErrorResponseSimple = (id, error) => {
|
|
2998
3019
|
return {
|
|
2999
|
-
jsonrpc: Two$1,
|
|
3000
|
-
id,
|
|
3001
3020
|
error: {
|
|
3002
3021
|
code: Custom,
|
|
3022
|
+
data: error,
|
|
3003
3023
|
// @ts-ignore
|
|
3004
|
-
message: error.message
|
|
3005
|
-
|
|
3006
|
-
|
|
3024
|
+
message: error.message
|
|
3025
|
+
},
|
|
3026
|
+
id,
|
|
3027
|
+
jsonrpc: Two$1
|
|
3007
3028
|
};
|
|
3008
3029
|
};
|
|
3009
3030
|
const getResponse = async (message, ipc, execute, preparePrettyError, logError, requiresSocket) => {
|
|
@@ -3033,35 +3054,35 @@ const normalizeParams = args => {
|
|
|
3033
3054
|
if (args.length === 1) {
|
|
3034
3055
|
const options = args[0];
|
|
3035
3056
|
return {
|
|
3057
|
+
execute: options.execute,
|
|
3036
3058
|
ipc: options.ipc,
|
|
3059
|
+
logError: options.logError || defaultLogError,
|
|
3037
3060
|
message: options.message,
|
|
3038
|
-
execute: options.execute,
|
|
3039
|
-
resolve: options.resolve || defaultResolve,
|
|
3040
3061
|
preparePrettyError: options.preparePrettyError || defaultPreparePrettyError,
|
|
3041
|
-
|
|
3042
|
-
|
|
3062
|
+
requiresSocket: options.requiresSocket || defaultRequiresSocket,
|
|
3063
|
+
resolve: options.resolve || defaultResolve
|
|
3043
3064
|
};
|
|
3044
3065
|
}
|
|
3045
3066
|
return {
|
|
3067
|
+
execute: args[2],
|
|
3046
3068
|
ipc: args[0],
|
|
3069
|
+
logError: args[5],
|
|
3047
3070
|
message: args[1],
|
|
3048
|
-
execute: args[2],
|
|
3049
|
-
resolve: args[3],
|
|
3050
3071
|
preparePrettyError: args[4],
|
|
3051
|
-
|
|
3052
|
-
|
|
3072
|
+
requiresSocket: args[6],
|
|
3073
|
+
resolve: args[3]
|
|
3053
3074
|
};
|
|
3054
3075
|
};
|
|
3055
3076
|
const handleJsonRpcMessage = async (...args) => {
|
|
3056
3077
|
const options = normalizeParams(args);
|
|
3057
3078
|
const {
|
|
3058
|
-
message,
|
|
3059
|
-
ipc,
|
|
3060
3079
|
execute,
|
|
3061
|
-
|
|
3062
|
-
preparePrettyError,
|
|
3080
|
+
ipc,
|
|
3063
3081
|
logError,
|
|
3064
|
-
|
|
3082
|
+
message,
|
|
3083
|
+
preparePrettyError,
|
|
3084
|
+
requiresSocket,
|
|
3085
|
+
resolve
|
|
3065
3086
|
} = options;
|
|
3066
3087
|
if ('id' in message) {
|
|
3067
3088
|
if ('method' in message) {
|
|
@@ -3100,36 +3121,17 @@ const invokeAndTransfer$1 = (ipc, method, ...params) => {
|
|
|
3100
3121
|
return invokeHelper$1(ipc, method, params);
|
|
3101
3122
|
};
|
|
3102
3123
|
|
|
3103
|
-
class CommandNotFoundError extends Error {
|
|
3104
|
-
constructor(command) {
|
|
3105
|
-
super(`Command not found ${command}`);
|
|
3106
|
-
this.name = 'CommandNotFoundError';
|
|
3107
|
-
}
|
|
3108
|
-
}
|
|
3109
|
-
const commands = Object.create(null);
|
|
3110
|
-
const register = commandMap => {
|
|
3111
|
-
Object.assign(commands, commandMap);
|
|
3112
|
-
};
|
|
3113
|
-
const getCommand = key => {
|
|
3114
|
-
return commands[key];
|
|
3115
|
-
};
|
|
3116
|
-
const execute$1 = (command, ...args) => {
|
|
3117
|
-
const fn = getCommand(command);
|
|
3118
|
-
if (!fn) {
|
|
3119
|
-
throw new CommandNotFoundError(command);
|
|
3120
|
-
}
|
|
3121
|
-
return fn(...args);
|
|
3122
|
-
};
|
|
3123
|
-
|
|
3124
3124
|
const Two = '2.0';
|
|
3125
|
-
|
|
3125
|
+
|
|
3126
|
+
const create$8 = (method, params) => {
|
|
3126
3127
|
return {
|
|
3127
3128
|
jsonrpc: Two,
|
|
3128
3129
|
method,
|
|
3129
3130
|
params
|
|
3130
3131
|
};
|
|
3131
3132
|
};
|
|
3132
|
-
|
|
3133
|
+
|
|
3134
|
+
const create$7 = (id, method, params) => {
|
|
3133
3135
|
const message = {
|
|
3134
3136
|
id,
|
|
3135
3137
|
jsonrpc: Two,
|
|
@@ -3138,15 +3140,14 @@ const create$s = (id, method, params) => {
|
|
|
3138
3140
|
};
|
|
3139
3141
|
return message;
|
|
3140
3142
|
};
|
|
3143
|
+
|
|
3141
3144
|
let id = 0;
|
|
3142
|
-
const create$
|
|
3145
|
+
const create$6 = () => {
|
|
3143
3146
|
return ++id;
|
|
3144
3147
|
};
|
|
3145
3148
|
|
|
3146
|
-
/* eslint-disable n/no-unsupported-features/es-syntax */
|
|
3147
|
-
|
|
3148
3149
|
const registerPromise = map => {
|
|
3149
|
-
const id = create$
|
|
3150
|
+
const id = create$6();
|
|
3150
3151
|
const {
|
|
3151
3152
|
promise,
|
|
3152
3153
|
resolve
|
|
@@ -3158,13 +3159,12 @@ const registerPromise = map => {
|
|
|
3158
3159
|
};
|
|
3159
3160
|
};
|
|
3160
3161
|
|
|
3161
|
-
// @ts-ignore
|
|
3162
3162
|
const invokeHelper = async (callbacks, ipc, method, params, useSendAndTransfer) => {
|
|
3163
3163
|
const {
|
|
3164
3164
|
id,
|
|
3165
3165
|
promise
|
|
3166
3166
|
} = registerPromise(callbacks);
|
|
3167
|
-
const message = create$
|
|
3167
|
+
const message = create$7(id, method, params);
|
|
3168
3168
|
if (useSendAndTransfer && ipc.sendAndTransfer) {
|
|
3169
3169
|
ipc.sendAndTransfer(message);
|
|
3170
3170
|
} else {
|
|
@@ -3200,12 +3200,13 @@ const createRpc = ipc => {
|
|
|
3200
3200
|
* @deprecated
|
|
3201
3201
|
*/
|
|
3202
3202
|
send(method, ...params) {
|
|
3203
|
-
const message = create$
|
|
3203
|
+
const message = create$8(method, params);
|
|
3204
3204
|
ipc.send(message);
|
|
3205
3205
|
}
|
|
3206
3206
|
};
|
|
3207
3207
|
return rpc;
|
|
3208
3208
|
};
|
|
3209
|
+
|
|
3209
3210
|
const requiresSocket$1 = () => {
|
|
3210
3211
|
return false;
|
|
3211
3212
|
};
|
|
@@ -3220,6 +3221,7 @@ const handleMessage$1 = event => {
|
|
|
3220
3221
|
const actualExecute = event?.target?.execute || execute$1;
|
|
3221
3222
|
return handleJsonRpcMessage(event.target, event.data, actualExecute, event.target._resolve, preparePrettyError, logError$1, actualRequiresSocket);
|
|
3222
3223
|
};
|
|
3224
|
+
|
|
3223
3225
|
const handleIpc$1 = ipc => {
|
|
3224
3226
|
if ('addEventListener' in ipc) {
|
|
3225
3227
|
ipc.addEventListener('message', handleMessage$1);
|
|
@@ -3228,6 +3230,7 @@ const handleIpc$1 = ipc => {
|
|
|
3228
3230
|
ipc.on('message', handleMessage$1);
|
|
3229
3231
|
}
|
|
3230
3232
|
};
|
|
3233
|
+
|
|
3231
3234
|
const listen$1 = async (module, options) => {
|
|
3232
3235
|
const rawIpc = await module.listen(options);
|
|
3233
3236
|
if (module.signal) {
|
|
@@ -3236,7 +3239,8 @@ const listen$1 = async (module, options) => {
|
|
|
3236
3239
|
const ipc = module.wrap(rawIpc);
|
|
3237
3240
|
return ipc;
|
|
3238
3241
|
};
|
|
3239
|
-
|
|
3242
|
+
|
|
3243
|
+
const create$5 = async ({
|
|
3240
3244
|
commandMap,
|
|
3241
3245
|
messagePort,
|
|
3242
3246
|
requiresSocket
|
|
@@ -3253,11 +3257,8 @@ const create$q = async ({
|
|
|
3253
3257
|
const rpc = createRpc(ipc);
|
|
3254
3258
|
return rpc;
|
|
3255
3259
|
};
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
create: create$q
|
|
3259
|
-
};
|
|
3260
|
-
const create$o = async ({
|
|
3260
|
+
|
|
3261
|
+
const create$4 = async ({
|
|
3261
3262
|
argv,
|
|
3262
3263
|
commandMap,
|
|
3263
3264
|
env,
|
|
@@ -3284,11 +3285,8 @@ const create$o = async ({
|
|
|
3284
3285
|
const rpc = createRpc(ipc);
|
|
3285
3286
|
return rpc;
|
|
3286
3287
|
};
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
create: create$o
|
|
3290
|
-
};
|
|
3291
|
-
const create$n = async ({
|
|
3288
|
+
|
|
3289
|
+
const create$3 = async ({
|
|
3292
3290
|
commandMap,
|
|
3293
3291
|
requiresSocket,
|
|
3294
3292
|
webContents
|
|
@@ -3304,10 +3302,6 @@ const create$n = async ({
|
|
|
3304
3302
|
const rpc = createRpc(ipc);
|
|
3305
3303
|
return rpc;
|
|
3306
3304
|
};
|
|
3307
|
-
const ElectronWebContentsRpcClient = {
|
|
3308
|
-
__proto__: null,
|
|
3309
|
-
create: create$n
|
|
3310
|
-
};
|
|
3311
3305
|
|
|
3312
3306
|
const commandMapRef = Object.create(null);
|
|
3313
3307
|
|
|
@@ -3421,7 +3415,7 @@ const launchSharedProcess = async ({
|
|
|
3421
3415
|
...process.env,
|
|
3422
3416
|
...env
|
|
3423
3417
|
};
|
|
3424
|
-
const sharedProcessRpc = await
|
|
3418
|
+
const sharedProcessRpc = await create$4({
|
|
3425
3419
|
argv: [],
|
|
3426
3420
|
commandMap: commandMapRef,
|
|
3427
3421
|
env: fullEnv,
|
|
@@ -3450,7 +3444,7 @@ const launchSharedProcess = async ({
|
|
|
3450
3444
|
port2
|
|
3451
3445
|
} = getPortTuple();
|
|
3452
3446
|
await sharedProcessRpc.invokeAndTransfer('HandleElectronMessagePort.handleElectronMessagePort', port2, MainProcess);
|
|
3453
|
-
await
|
|
3447
|
+
await create$5({
|
|
3454
3448
|
commandMap: commandMapRef,
|
|
3455
3449
|
messagePort: port1,
|
|
3456
3450
|
requiresSocket: requiresSocket
|
|
@@ -4337,7 +4331,7 @@ const get$1 = () => {
|
|
|
4337
4331
|
};
|
|
4338
4332
|
const registerWebviewProtocol = async port => {
|
|
4339
4333
|
object(port);
|
|
4340
|
-
const rpc = await
|
|
4334
|
+
const rpc = await create$5({
|
|
4341
4335
|
commandMap: {},
|
|
4342
4336
|
messagePort: port,
|
|
4343
4337
|
requiresSocket: requiresSocket
|
|
@@ -4406,7 +4400,7 @@ const createAppWindow = async (windowOptions, parsedArgs, workingDirectory, titl
|
|
|
4406
4400
|
}
|
|
4407
4401
|
};
|
|
4408
4402
|
window.on('close', handleWindowClose);
|
|
4409
|
-
await
|
|
4403
|
+
await create$3({
|
|
4410
4404
|
commandMap: commandMapRef,
|
|
4411
4405
|
webContents: window.webContents
|
|
4412
4406
|
});
|
|
@@ -4597,7 +4591,7 @@ const get = id => {
|
|
|
4597
4591
|
};
|
|
4598
4592
|
|
|
4599
4593
|
const createUtilityProcessRpc = async options => {
|
|
4600
|
-
const rpc = await
|
|
4594
|
+
const rpc = await create$4({
|
|
4601
4595
|
commandMap: commandMapRef,
|
|
4602
4596
|
...options
|
|
4603
4597
|
});
|
|
@@ -6185,7 +6179,7 @@ const getWindowId = webContentsId => {
|
|
|
6185
6179
|
|
|
6186
6180
|
const handleElectronMessagePort = async (messagePort, rpcId) => {
|
|
6187
6181
|
object(messagePort);
|
|
6188
|
-
const rpc = await
|
|
6182
|
+
const rpc = await create$5({
|
|
6189
6183
|
commandMap: commandMapRef,
|
|
6190
6184
|
messagePort: messagePort,
|
|
6191
6185
|
requiresSocket: requiresSocket
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lvce-editor/main-process",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"lvce-editor",
|
|
6
6
|
"electron"
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"type": "module",
|
|
15
15
|
"main": "dist/mainProcessMain.js",
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"electron": "
|
|
17
|
+
"electron": "41.1.1"
|
|
18
18
|
},
|
|
19
19
|
"engines": {
|
|
20
20
|
"node": ">=22"
|