@lvce-editor/main-process 3.1.0 → 4.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 +205 -1127
- package/package.json +2 -2
package/dist/mainProcessMain.js
CHANGED
|
@@ -9,11 +9,12 @@ import { createWriteStream, readFileSync } from 'node:fs';
|
|
|
9
9
|
import { tmpdir, homedir } from 'node:os';
|
|
10
10
|
import * as NodePath from 'node:path';
|
|
11
11
|
import { dirname } from 'node:path';
|
|
12
|
-
import require$$1 from 'tty';
|
|
13
|
-
import require$$1$1 from 'util';
|
|
14
|
-
import require$$0 from 'os';
|
|
15
12
|
import { MessageChannel } from 'node:worker_threads';
|
|
16
13
|
|
|
14
|
+
const scheme = 'lvce-oss';
|
|
15
|
+
const applicationName = 'lvce-oss';
|
|
16
|
+
const WebView = 'lvce-oss-webview';
|
|
17
|
+
|
|
17
18
|
function escapeStringRegexp(string) {
|
|
18
19
|
if (typeof string !== 'string') {
|
|
19
20
|
throw new TypeError('Expected a string');
|
|
@@ -1163,39 +1164,39 @@ function requireLib () {
|
|
|
1163
1164
|
const NEWLINE$1 = /\r\n|[\n\r\u2028\u2029]/;
|
|
1164
1165
|
const BRACKET = /^[()[\]{}]$/;
|
|
1165
1166
|
let tokenize;
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
}
|
|
1173
|
-
if (JSX_TAG.test(token.value) && (text[offset - 1] === "<" || text.slice(offset - 2, offset) === "</")) {
|
|
1174
|
-
return "jsxIdentifier";
|
|
1175
|
-
}
|
|
1176
|
-
if (token.value[0] !== token.value[0].toLowerCase()) {
|
|
1177
|
-
return "capitalized";
|
|
1178
|
-
}
|
|
1179
|
-
}
|
|
1180
|
-
if (token.type === "punctuator" && BRACKET.test(token.value)) {
|
|
1181
|
-
return "bracket";
|
|
1167
|
+
const JSX_TAG = /^[a-z][\w-]*$/i;
|
|
1168
|
+
const getTokenType = function (token, offset, text) {
|
|
1169
|
+
if (token.type === "name") {
|
|
1170
|
+
const tokenValue = token.value;
|
|
1171
|
+
if (helperValidatorIdentifier.isKeyword(tokenValue) || helperValidatorIdentifier.isStrictReservedWord(tokenValue, true) || sometimesKeywords.has(tokenValue)) {
|
|
1172
|
+
return "keyword";
|
|
1182
1173
|
}
|
|
1183
|
-
if (
|
|
1184
|
-
return "
|
|
1174
|
+
if (JSX_TAG.test(tokenValue) && (text[offset - 1] === "<" || text.slice(offset - 2, offset) === "</")) {
|
|
1175
|
+
return "jsxIdentifier";
|
|
1185
1176
|
}
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
let match;
|
|
1190
|
-
while (match = jsTokens.default.exec(text)) {
|
|
1191
|
-
const token = jsTokens.matchToToken(match);
|
|
1192
|
-
yield {
|
|
1193
|
-
type: getTokenType(token, match.index, text),
|
|
1194
|
-
value: token.value
|
|
1195
|
-
};
|
|
1177
|
+
const firstChar = String.fromCodePoint(tokenValue.codePointAt(0));
|
|
1178
|
+
if (firstChar !== firstChar.toLowerCase()) {
|
|
1179
|
+
return "capitalized";
|
|
1196
1180
|
}
|
|
1197
|
-
}
|
|
1198
|
-
|
|
1181
|
+
}
|
|
1182
|
+
if (token.type === "punctuator" && BRACKET.test(token.value)) {
|
|
1183
|
+
return "bracket";
|
|
1184
|
+
}
|
|
1185
|
+
if (token.type === "invalid" && (token.value === "@" || token.value === "#")) {
|
|
1186
|
+
return "punctuator";
|
|
1187
|
+
}
|
|
1188
|
+
return token.type;
|
|
1189
|
+
};
|
|
1190
|
+
tokenize = function* (text) {
|
|
1191
|
+
let match;
|
|
1192
|
+
while (match = jsTokens.default.exec(text)) {
|
|
1193
|
+
const token = jsTokens.matchToToken(match);
|
|
1194
|
+
yield {
|
|
1195
|
+
type: getTokenType(token, match.index, text),
|
|
1196
|
+
value: token.value
|
|
1197
|
+
};
|
|
1198
|
+
}
|
|
1199
|
+
};
|
|
1199
1200
|
function highlight(text) {
|
|
1200
1201
|
if (text === "") return "";
|
|
1201
1202
|
const defs = getDefs(true);
|
|
@@ -1923,8 +1924,8 @@ const getModuleNotFoundError = stderr => {
|
|
|
1923
1924
|
const messageIndex = lines.findIndex(isModuleNotFoundMessage);
|
|
1924
1925
|
const message = lines[messageIndex];
|
|
1925
1926
|
return {
|
|
1926
|
-
|
|
1927
|
-
|
|
1927
|
+
code: ERR_MODULE_NOT_FOUND,
|
|
1928
|
+
message
|
|
1928
1929
|
};
|
|
1929
1930
|
};
|
|
1930
1931
|
const isModuleNotFoundError = stderr => {
|
|
@@ -1947,14 +1948,14 @@ const isUnhelpfulNativeModuleError = stderr => {
|
|
|
1947
1948
|
const getNativeModuleErrorMessage = stderr => {
|
|
1948
1949
|
const message = getMessageCodeBlock(stderr);
|
|
1949
1950
|
return {
|
|
1950
|
-
|
|
1951
|
-
|
|
1951
|
+
code: E_INCOMPATIBLE_NATIVE_MODULE,
|
|
1952
|
+
message: `Incompatible native node module: ${message}`
|
|
1952
1953
|
};
|
|
1953
1954
|
};
|
|
1954
1955
|
const getModuleSyntaxError = () => {
|
|
1955
1956
|
return {
|
|
1956
|
-
|
|
1957
|
-
|
|
1957
|
+
code: E_MODULES_NOT_SUPPORTED_IN_ELECTRON,
|
|
1958
|
+
message: `ES Modules are not supported in electron`
|
|
1958
1959
|
};
|
|
1959
1960
|
};
|
|
1960
1961
|
const getHelpfulChildProcessError = (stdout, stderr) => {
|
|
@@ -1973,8 +1974,8 @@ const getHelpfulChildProcessError = (stdout, stderr) => {
|
|
|
1973
1974
|
rest
|
|
1974
1975
|
} = getDetails(lines);
|
|
1975
1976
|
return {
|
|
1976
|
-
message: actualMessage,
|
|
1977
1977
|
code: '',
|
|
1978
|
+
message: actualMessage,
|
|
1978
1979
|
stack: rest
|
|
1979
1980
|
};
|
|
1980
1981
|
};
|
|
@@ -1984,8 +1985,8 @@ class IpcError extends VError {
|
|
|
1984
1985
|
if (stdout || stderr) {
|
|
1985
1986
|
// @ts-ignore
|
|
1986
1987
|
const {
|
|
1987
|
-
message,
|
|
1988
1988
|
code,
|
|
1989
|
+
message,
|
|
1989
1990
|
stack
|
|
1990
1991
|
} = getHelpfulChildProcessError(stdout, stderr);
|
|
1991
1992
|
const cause = new Error(message);
|
|
@@ -2267,8 +2268,8 @@ const removeListener = (emitter, type, callback) => {
|
|
|
2267
2268
|
};
|
|
2268
2269
|
const getFirstEvent = (eventEmitter, eventMap) => {
|
|
2269
2270
|
const {
|
|
2270
|
-
|
|
2271
|
-
|
|
2271
|
+
promise,
|
|
2272
|
+
resolve
|
|
2272
2273
|
} = Promise.withResolvers();
|
|
2273
2274
|
const listenerMap = Object.create(null);
|
|
2274
2275
|
const cleanup = value => {
|
|
@@ -2280,8 +2281,8 @@ const getFirstEvent = (eventEmitter, eventMap) => {
|
|
|
2280
2281
|
for (const [event, type] of Object.entries(eventMap)) {
|
|
2281
2282
|
const listener = event => {
|
|
2282
2283
|
cleanup({
|
|
2283
|
-
|
|
2284
|
-
|
|
2284
|
+
event,
|
|
2285
|
+
type
|
|
2285
2286
|
});
|
|
2286
2287
|
};
|
|
2287
2288
|
addListener(eventEmitter, event, listener);
|
|
@@ -2336,8 +2337,8 @@ const Error$2 = 2;
|
|
|
2336
2337
|
const Message$1 = 3;
|
|
2337
2338
|
const getFirstUtilityProcessEvent = async utilityProcess => {
|
|
2338
2339
|
const {
|
|
2339
|
-
|
|
2340
|
-
|
|
2340
|
+
promise,
|
|
2341
|
+
resolve
|
|
2341
2342
|
} = Promise.withResolvers();
|
|
2342
2343
|
let stdout = '';
|
|
2343
2344
|
let stderr = '';
|
|
@@ -2358,18 +2359,18 @@ const getFirstUtilityProcessEvent = async utilityProcess => {
|
|
|
2358
2359
|
};
|
|
2359
2360
|
const handleMessage = event => {
|
|
2360
2361
|
cleanup({
|
|
2361
|
-
type: Message$1,
|
|
2362
2362
|
event,
|
|
2363
|
+
stderr,
|
|
2363
2364
|
stdout,
|
|
2364
|
-
|
|
2365
|
+
type: Message$1
|
|
2365
2366
|
});
|
|
2366
2367
|
};
|
|
2367
2368
|
const handleExit = event => {
|
|
2368
2369
|
cleanup({
|
|
2369
|
-
type: Exit,
|
|
2370
2370
|
event,
|
|
2371
|
+
stderr,
|
|
2371
2372
|
stdout,
|
|
2372
|
-
|
|
2373
|
+
type: Exit
|
|
2373
2374
|
});
|
|
2374
2375
|
};
|
|
2375
2376
|
// @ts-ignore
|
|
@@ -2379,22 +2380,22 @@ const getFirstUtilityProcessEvent = async utilityProcess => {
|
|
|
2379
2380
|
utilityProcess.on('message', handleMessage);
|
|
2380
2381
|
utilityProcess.on('exit', handleExit);
|
|
2381
2382
|
const {
|
|
2382
|
-
|
|
2383
|
-
|
|
2383
|
+
event,
|
|
2384
|
+
type
|
|
2384
2385
|
} = await promise;
|
|
2385
2386
|
return {
|
|
2386
|
-
type,
|
|
2387
2387
|
event,
|
|
2388
|
+
stderr,
|
|
2388
2389
|
stdout,
|
|
2389
|
-
|
|
2390
|
+
type
|
|
2390
2391
|
};
|
|
2391
2392
|
};
|
|
2392
2393
|
const create$6 = async ({
|
|
2393
|
-
path,
|
|
2394
2394
|
argv = [],
|
|
2395
|
+
env = process.env,
|
|
2395
2396
|
execArgv = [],
|
|
2396
2397
|
name,
|
|
2397
|
-
|
|
2398
|
+
path
|
|
2398
2399
|
}) => {
|
|
2399
2400
|
string(path);
|
|
2400
2401
|
const actualArgv = ['--ipc-type=electron-utility-process', ...argv];
|
|
@@ -2402,10 +2403,10 @@ const create$6 = async ({
|
|
|
2402
2403
|
utilityProcess
|
|
2403
2404
|
} = await import('electron');
|
|
2404
2405
|
const childProcess = utilityProcess.fork(path, actualArgv, {
|
|
2406
|
+
env,
|
|
2405
2407
|
execArgv,
|
|
2406
|
-
stdio: 'pipe',
|
|
2407
2408
|
serviceName: name,
|
|
2408
|
-
|
|
2409
|
+
stdio: 'pipe'
|
|
2409
2410
|
});
|
|
2410
2411
|
const handleExit = () => {
|
|
2411
2412
|
// @ts-ignore
|
|
@@ -2417,9 +2418,9 @@ const create$6 = async ({
|
|
|
2417
2418
|
// @ts-ignore
|
|
2418
2419
|
childProcess.stdout.pipe(process.stdout);
|
|
2419
2420
|
const {
|
|
2420
|
-
|
|
2421
|
+
stderr,
|
|
2421
2422
|
stdout,
|
|
2422
|
-
|
|
2423
|
+
type
|
|
2423
2424
|
} = await getFirstUtilityProcessEvent(childProcess);
|
|
2424
2425
|
if (type === Exit) {
|
|
2425
2426
|
throw new IpcError(`Utility process exited before ipc connection was established`, stdout, stderr);
|
|
@@ -2465,8 +2466,8 @@ class ChildProcessError extends Error {
|
|
|
2465
2466
|
constructor(stderr) {
|
|
2466
2467
|
// @ts-ignore
|
|
2467
2468
|
const {
|
|
2468
|
-
message,
|
|
2469
2469
|
code,
|
|
2470
|
+
message,
|
|
2470
2471
|
stack
|
|
2471
2472
|
} = getHelpfulChildProcessError('', stderr);
|
|
2472
2473
|
super(message || 'child process error');
|
|
@@ -2502,10 +2503,10 @@ const fixNodeChildProcessParameters = value => {
|
|
|
2502
2503
|
};
|
|
2503
2504
|
const getFirstNodeChildProcessEvent = async childProcess => {
|
|
2504
2505
|
const {
|
|
2505
|
-
type,
|
|
2506
2506
|
event,
|
|
2507
|
+
stderr,
|
|
2507
2508
|
stdout,
|
|
2508
|
-
|
|
2509
|
+
type
|
|
2509
2510
|
} = await new Promise((resolve, reject) => {
|
|
2510
2511
|
let stderr = '';
|
|
2511
2512
|
let stdout = '';
|
|
@@ -2527,26 +2528,26 @@ const getFirstNodeChildProcessEvent = async childProcess => {
|
|
|
2527
2528
|
};
|
|
2528
2529
|
const handleMessage = event => {
|
|
2529
2530
|
cleanup({
|
|
2530
|
-
type: Message$1,
|
|
2531
2531
|
event,
|
|
2532
|
+
stderr,
|
|
2532
2533
|
stdout,
|
|
2533
|
-
|
|
2534
|
+
type: Message$1
|
|
2534
2535
|
});
|
|
2535
2536
|
};
|
|
2536
2537
|
const handleExit = event => {
|
|
2537
2538
|
cleanup({
|
|
2538
|
-
type: Exit,
|
|
2539
2539
|
event,
|
|
2540
|
+
stderr,
|
|
2540
2541
|
stdout,
|
|
2541
|
-
|
|
2542
|
+
type: Exit
|
|
2542
2543
|
});
|
|
2543
2544
|
};
|
|
2544
2545
|
const handleError = event => {
|
|
2545
2546
|
cleanup({
|
|
2546
|
-
type: Error$2,
|
|
2547
2547
|
event,
|
|
2548
|
+
stderr,
|
|
2548
2549
|
stdout,
|
|
2549
|
-
|
|
2550
|
+
type: Error$2
|
|
2550
2551
|
});
|
|
2551
2552
|
};
|
|
2552
2553
|
if (childProcess.stdout && childProcess.stderr) {
|
|
@@ -2558,21 +2559,21 @@ const getFirstNodeChildProcessEvent = async childProcess => {
|
|
|
2558
2559
|
childProcess.on('error', handleError);
|
|
2559
2560
|
});
|
|
2560
2561
|
return {
|
|
2561
|
-
type,
|
|
2562
2562
|
event,
|
|
2563
|
+
stderr,
|
|
2563
2564
|
stdout,
|
|
2564
|
-
|
|
2565
|
+
type
|
|
2565
2566
|
};
|
|
2566
2567
|
};
|
|
2567
2568
|
|
|
2568
2569
|
// @ts-ignore
|
|
2569
2570
|
const create$2$2 = async ({
|
|
2570
|
-
path,
|
|
2571
2571
|
argv = [],
|
|
2572
2572
|
env,
|
|
2573
2573
|
execArgv = [],
|
|
2574
|
-
|
|
2575
|
-
|
|
2574
|
+
name = 'child process',
|
|
2575
|
+
path,
|
|
2576
|
+
stdio = 'inherit'
|
|
2576
2577
|
}) => {
|
|
2577
2578
|
try {
|
|
2578
2579
|
string(path);
|
|
@@ -2586,9 +2587,9 @@ const create$2$2 = async ({
|
|
|
2586
2587
|
stdio: 'pipe'
|
|
2587
2588
|
});
|
|
2588
2589
|
const {
|
|
2589
|
-
type,
|
|
2590
2590
|
event,
|
|
2591
|
-
stderr
|
|
2591
|
+
stderr,
|
|
2592
|
+
type
|
|
2592
2593
|
} = await getFirstNodeChildProcessEvent(childProcess);
|
|
2593
2594
|
if (type === Exit) {
|
|
2594
2595
|
throw new ChildProcessError(stderr);
|
|
@@ -2653,18 +2654,18 @@ const fixNodeWorkerParameters = value => {
|
|
|
2653
2654
|
};
|
|
2654
2655
|
const getFirstNodeWorkerEvent = worker => {
|
|
2655
2656
|
return getFirstEvent(worker, {
|
|
2656
|
-
|
|
2657
|
+
error: Error$2,
|
|
2657
2658
|
exit: Exit,
|
|
2658
|
-
|
|
2659
|
+
message: Message$1
|
|
2659
2660
|
});
|
|
2660
2661
|
};
|
|
2661
2662
|
const create$1$2 = async ({
|
|
2662
|
-
path,
|
|
2663
2663
|
argv = [],
|
|
2664
2664
|
env = process.env,
|
|
2665
2665
|
execArgv = [],
|
|
2666
|
-
|
|
2667
|
-
|
|
2666
|
+
name,
|
|
2667
|
+
path,
|
|
2668
|
+
stdio
|
|
2668
2669
|
}) => {
|
|
2669
2670
|
string(path);
|
|
2670
2671
|
const actualArgv = ['--ipc-type=node-worker', ...argv];
|
|
@@ -2680,13 +2681,13 @@ const create$1$2 = async ({
|
|
|
2680
2681
|
argv: actualArgv,
|
|
2681
2682
|
env: actualEnv,
|
|
2682
2683
|
execArgv,
|
|
2683
|
-
|
|
2684
|
+
name,
|
|
2684
2685
|
stderr: ignoreStdio,
|
|
2685
|
-
|
|
2686
|
+
stdout: ignoreStdio
|
|
2686
2687
|
});
|
|
2687
2688
|
const {
|
|
2688
|
-
|
|
2689
|
-
|
|
2689
|
+
event,
|
|
2690
|
+
type
|
|
2690
2691
|
} = await getFirstNodeWorkerEvent(worker);
|
|
2691
2692
|
if (type === Exit) {
|
|
2692
2693
|
throw new IpcError(`Worker exited before ipc connection was established`);
|
|
@@ -2732,14 +2733,7 @@ const IpcParentWithNodeWorker$1 = {
|
|
|
2732
2733
|
wrap: wrap$1
|
|
2733
2734
|
};
|
|
2734
2735
|
|
|
2735
|
-
const Two = '2.0';
|
|
2736
|
-
const create$4 = (method, params) => {
|
|
2737
|
-
return {
|
|
2738
|
-
jsonrpc: Two,
|
|
2739
|
-
method,
|
|
2740
|
-
params
|
|
2741
|
-
};
|
|
2742
|
-
};
|
|
2736
|
+
const Two$1 = '2.0';
|
|
2743
2737
|
const callbacks = Object.create(null);
|
|
2744
2738
|
const set$2 = (id, fn) => {
|
|
2745
2739
|
callbacks[id] = fn;
|
|
@@ -2750,11 +2744,11 @@ const get$4 = id => {
|
|
|
2750
2744
|
const remove$2 = id => {
|
|
2751
2745
|
delete callbacks[id];
|
|
2752
2746
|
};
|
|
2753
|
-
let id = 0;
|
|
2747
|
+
let id$1 = 0;
|
|
2754
2748
|
const create$3 = () => {
|
|
2755
|
-
return ++id;
|
|
2749
|
+
return ++id$1;
|
|
2756
2750
|
};
|
|
2757
|
-
const registerPromise = () => {
|
|
2751
|
+
const registerPromise$1 = () => {
|
|
2758
2752
|
const id = create$3();
|
|
2759
2753
|
const {
|
|
2760
2754
|
resolve,
|
|
@@ -2770,9 +2764,9 @@ const create$2$1 = (method, params) => {
|
|
|
2770
2764
|
const {
|
|
2771
2765
|
id,
|
|
2772
2766
|
promise
|
|
2773
|
-
} = registerPromise();
|
|
2767
|
+
} = registerPromise$1();
|
|
2774
2768
|
const message = {
|
|
2775
|
-
jsonrpc: Two,
|
|
2769
|
+
jsonrpc: Two$1,
|
|
2776
2770
|
method,
|
|
2777
2771
|
params,
|
|
2778
2772
|
id
|
|
@@ -2977,7 +2971,7 @@ const getErrorProperty = (error, prettyError) => {
|
|
|
2977
2971
|
};
|
|
2978
2972
|
const create$1$1 = (id, error) => {
|
|
2979
2973
|
return {
|
|
2980
|
-
jsonrpc: Two,
|
|
2974
|
+
jsonrpc: Two$1,
|
|
2981
2975
|
id,
|
|
2982
2976
|
error
|
|
2983
2977
|
};
|
|
@@ -2988,20 +2982,20 @@ const getErrorResponse = (id, error, preparePrettyError, logError) => {
|
|
|
2988
2982
|
const errorProperty = getErrorProperty(error, prettyError);
|
|
2989
2983
|
return create$1$1(id, errorProperty);
|
|
2990
2984
|
};
|
|
2991
|
-
const create$
|
|
2985
|
+
const create$4 = (message, result) => {
|
|
2992
2986
|
return {
|
|
2993
|
-
jsonrpc: Two,
|
|
2987
|
+
jsonrpc: Two$1,
|
|
2994
2988
|
id: message.id,
|
|
2995
2989
|
result: result ?? null
|
|
2996
2990
|
};
|
|
2997
2991
|
};
|
|
2998
2992
|
const getSuccessResponse = (message, result) => {
|
|
2999
2993
|
const resultProperty = result ?? null;
|
|
3000
|
-
return create$
|
|
2994
|
+
return create$4(message, resultProperty);
|
|
3001
2995
|
};
|
|
3002
2996
|
const getErrorResponseSimple = (id, error) => {
|
|
3003
2997
|
return {
|
|
3004
|
-
jsonrpc: Two,
|
|
2998
|
+
jsonrpc: Two$1,
|
|
3005
2999
|
id,
|
|
3006
3000
|
error: {
|
|
3007
3001
|
code: Custom,
|
|
@@ -3088,12 +3082,12 @@ const handleJsonRpcMessage = async (...args) => {
|
|
|
3088
3082
|
}
|
|
3089
3083
|
throw new JsonRpcError('unexpected message');
|
|
3090
3084
|
};
|
|
3091
|
-
const invokeHelper = async (ipc, method, params, useSendAndTransfer) => {
|
|
3085
|
+
const invokeHelper$1 = async (ipc, method, params, useSendAndTransfer) => {
|
|
3092
3086
|
const {
|
|
3093
3087
|
message,
|
|
3094
3088
|
promise
|
|
3095
3089
|
} = create$2$1(method, params);
|
|
3096
|
-
if (
|
|
3090
|
+
if (ipc.sendAndTransfer) {
|
|
3097
3091
|
ipc.sendAndTransfer(message);
|
|
3098
3092
|
} else {
|
|
3099
3093
|
ipc.send(message);
|
|
@@ -3101,15 +3095,8 @@ const invokeHelper = async (ipc, method, params, useSendAndTransfer) => {
|
|
|
3101
3095
|
const responseMessage = await promise;
|
|
3102
3096
|
return unwrapJsonRpcResult(responseMessage);
|
|
3103
3097
|
};
|
|
3104
|
-
const send$2 = (transport, method, ...params) => {
|
|
3105
|
-
const message = create$4(method, params);
|
|
3106
|
-
transport.send(message);
|
|
3107
|
-
};
|
|
3108
|
-
const invoke$1 = (ipc, method, ...params) => {
|
|
3109
|
-
return invokeHelper(ipc, method, params, false);
|
|
3110
|
-
};
|
|
3111
3098
|
const invokeAndTransfer$1 = (ipc, method, ...params) => {
|
|
3112
|
-
return invokeHelper(ipc, method, params
|
|
3099
|
+
return invokeHelper$1(ipc, method, params);
|
|
3113
3100
|
};
|
|
3114
3101
|
|
|
3115
3102
|
class CommandNotFoundError extends Error {
|
|
@@ -3133,24 +3120,87 @@ const execute$1 = (command, ...args) => {
|
|
|
3133
3120
|
return fn(...args);
|
|
3134
3121
|
};
|
|
3135
3122
|
|
|
3123
|
+
const Two = '2.0';
|
|
3124
|
+
const create$s = (method, params) => {
|
|
3125
|
+
return {
|
|
3126
|
+
jsonrpc: Two,
|
|
3127
|
+
method,
|
|
3128
|
+
params
|
|
3129
|
+
};
|
|
3130
|
+
};
|
|
3131
|
+
const create$r = (id, method, params) => {
|
|
3132
|
+
const message = {
|
|
3133
|
+
id,
|
|
3134
|
+
jsonrpc: Two,
|
|
3135
|
+
method,
|
|
3136
|
+
params
|
|
3137
|
+
};
|
|
3138
|
+
return message;
|
|
3139
|
+
};
|
|
3140
|
+
let id = 0;
|
|
3141
|
+
const create$q = () => {
|
|
3142
|
+
return ++id;
|
|
3143
|
+
};
|
|
3144
|
+
|
|
3145
|
+
/* eslint-disable n/no-unsupported-features/es-syntax */
|
|
3146
|
+
|
|
3147
|
+
const registerPromise = map => {
|
|
3148
|
+
const id = create$q();
|
|
3149
|
+
const {
|
|
3150
|
+
promise,
|
|
3151
|
+
resolve
|
|
3152
|
+
} = Promise.withResolvers();
|
|
3153
|
+
map[id] = resolve;
|
|
3154
|
+
return {
|
|
3155
|
+
id,
|
|
3156
|
+
promise
|
|
3157
|
+
};
|
|
3158
|
+
};
|
|
3159
|
+
|
|
3160
|
+
// @ts-ignore
|
|
3161
|
+
const invokeHelper = async (callbacks, ipc, method, params, useSendAndTransfer) => {
|
|
3162
|
+
const {
|
|
3163
|
+
id,
|
|
3164
|
+
promise
|
|
3165
|
+
} = registerPromise(callbacks);
|
|
3166
|
+
const message = create$r(id, method, params);
|
|
3167
|
+
if (useSendAndTransfer && ipc.sendAndTransfer) {
|
|
3168
|
+
ipc.sendAndTransfer(message);
|
|
3169
|
+
} else {
|
|
3170
|
+
ipc.send(message);
|
|
3171
|
+
}
|
|
3172
|
+
const responseMessage = await promise;
|
|
3173
|
+
return unwrapJsonRpcResult(responseMessage);
|
|
3174
|
+
};
|
|
3136
3175
|
const createRpc = ipc => {
|
|
3176
|
+
const callbacks = Object.create(null);
|
|
3177
|
+
ipc._resolve = (id, response) => {
|
|
3178
|
+
const fn = callbacks[id];
|
|
3179
|
+
if (!fn) {
|
|
3180
|
+
console.warn(`callback ${id} may already be disposed`);
|
|
3181
|
+
return;
|
|
3182
|
+
}
|
|
3183
|
+
fn(response);
|
|
3184
|
+
delete callbacks[id];
|
|
3185
|
+
};
|
|
3137
3186
|
const rpc = {
|
|
3187
|
+
async dispose() {
|
|
3188
|
+
await ipc?.dispose();
|
|
3189
|
+
},
|
|
3190
|
+
invoke(method, ...params) {
|
|
3191
|
+
return invokeHelper(callbacks, ipc, method, params, false);
|
|
3192
|
+
},
|
|
3193
|
+
invokeAndTransfer(method, ...params) {
|
|
3194
|
+
return invokeHelper(callbacks, ipc, method, params, true);
|
|
3195
|
+
},
|
|
3138
3196
|
// @ts-ignore
|
|
3139
3197
|
ipc,
|
|
3140
3198
|
/**
|
|
3141
3199
|
* @deprecated
|
|
3142
3200
|
*/
|
|
3143
3201
|
send(method, ...params) {
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
invoke(method, ...params) {
|
|
3147
|
-
return invoke$1(ipc, method, ...params);
|
|
3148
|
-
},
|
|
3149
|
-
invokeAndTransfer(method, ...params) {
|
|
3150
|
-
return invokeAndTransfer$1(ipc, method, ...params);
|
|
3151
|
-
},
|
|
3152
|
-
async dispose() {
|
|
3153
|
-
await ipc?.dispose();
|
|
3202
|
+
const message = create$s(method, params);
|
|
3203
|
+
ipc.send(message);
|
|
3154
3204
|
}
|
|
3155
3205
|
};
|
|
3156
3206
|
return rpc;
|
|
@@ -3167,7 +3217,7 @@ const logError$1 = () => {
|
|
|
3167
3217
|
const handleMessage$1 = event => {
|
|
3168
3218
|
const actualRequiresSocket = event?.target?.requiresSocket || requiresSocket$1;
|
|
3169
3219
|
const actualExecute = event?.target?.execute || execute$1;
|
|
3170
|
-
return handleJsonRpcMessage(event.target, event.data, actualExecute,
|
|
3220
|
+
return handleJsonRpcMessage(event.target, event.data, actualExecute, event.target._resolve, preparePrettyError, logError$1, actualRequiresSocket);
|
|
3171
3221
|
};
|
|
3172
3222
|
const handleIpc$1 = ipc => {
|
|
3173
3223
|
if ('addEventListener' in ipc) {
|
|
@@ -3185,7 +3235,7 @@ const listen$1 = async (module, options) => {
|
|
|
3185
3235
|
const ipc = module.wrap(rawIpc);
|
|
3186
3236
|
return ipc;
|
|
3187
3237
|
};
|
|
3188
|
-
const create$
|
|
3238
|
+
const create$p = async ({
|
|
3189
3239
|
commandMap,
|
|
3190
3240
|
messagePort,
|
|
3191
3241
|
requiresSocket
|
|
@@ -3204,25 +3254,25 @@ const create$k = async ({
|
|
|
3204
3254
|
};
|
|
3205
3255
|
const ElectronMessagePortRpcClient = {
|
|
3206
3256
|
__proto__: null,
|
|
3207
|
-
create: create$
|
|
3257
|
+
create: create$p
|
|
3208
3258
|
};
|
|
3209
|
-
const create$
|
|
3259
|
+
const create$n = async ({
|
|
3260
|
+
argv,
|
|
3210
3261
|
commandMap,
|
|
3211
3262
|
env,
|
|
3212
|
-
argv,
|
|
3213
3263
|
execArgv,
|
|
3214
|
-
path,
|
|
3215
3264
|
name,
|
|
3265
|
+
path,
|
|
3216
3266
|
requiresSocket
|
|
3217
3267
|
}) => {
|
|
3218
3268
|
// TODO create a commandMap per rpc instance
|
|
3219
3269
|
register(commandMap);
|
|
3220
3270
|
const rawIpc = await IpcParentWithElectronUtilityProcess$1$1.create({
|
|
3221
|
-
env,
|
|
3222
3271
|
argv,
|
|
3272
|
+
env,
|
|
3223
3273
|
execArgv,
|
|
3224
|
-
|
|
3225
|
-
|
|
3274
|
+
name,
|
|
3275
|
+
path
|
|
3226
3276
|
});
|
|
3227
3277
|
const ipc = IpcParentWithElectronUtilityProcess$1$1.wrap(rawIpc);
|
|
3228
3278
|
if (requiresSocket) {
|
|
@@ -3235,12 +3285,12 @@ const create$i = async ({
|
|
|
3235
3285
|
};
|
|
3236
3286
|
const ElectronUtilityProcessRpcParent = {
|
|
3237
3287
|
__proto__: null,
|
|
3238
|
-
create: create$
|
|
3288
|
+
create: create$n
|
|
3239
3289
|
};
|
|
3240
|
-
const create$
|
|
3290
|
+
const create$m = async ({
|
|
3241
3291
|
commandMap,
|
|
3242
|
-
|
|
3243
|
-
|
|
3292
|
+
requiresSocket,
|
|
3293
|
+
webContents
|
|
3244
3294
|
}) => {
|
|
3245
3295
|
// TODO create a commandMap per rpc instance
|
|
3246
3296
|
register(commandMap);
|
|
@@ -3255,7 +3305,7 @@ const create$h = async ({
|
|
|
3255
3305
|
};
|
|
3256
3306
|
const ElectronWebContentsRpcClient = {
|
|
3257
3307
|
__proto__: null,
|
|
3258
|
-
create: create$
|
|
3308
|
+
create: create$m
|
|
3259
3309
|
};
|
|
3260
3310
|
|
|
3261
3311
|
const commandMapRef = Object.create(null);
|
|
@@ -3332,12 +3382,12 @@ const {
|
|
|
3332
3382
|
const isLinux = platform === 'linux';
|
|
3333
3383
|
const isProduction = false;
|
|
3334
3384
|
const homeDirectory = homedir();
|
|
3335
|
-
|
|
3385
|
+
|
|
3336
3386
|
const xdgCache = env.XDG_CACHE_HOME || (homeDirectory ? join(homeDirectory, '.cache') : undefined);
|
|
3337
3387
|
const xdgData = env.XDG_DATA_HOME || (homeDirectory ? join(homeDirectory, '.local', 'share') : undefined);
|
|
3338
3388
|
join(xdgData || tmpdir(), applicationName);
|
|
3339
3389
|
const chromeUserDataPath = xdgCache ? join(xdgCache, applicationName, 'userdata') : '';
|
|
3340
|
-
|
|
3390
|
+
|
|
3341
3391
|
const getSessionId = () => {
|
|
3342
3392
|
return process.env.SESSION_ID || `persist:${scheme}`;
|
|
3343
3393
|
};
|
|
@@ -3547,974 +3597,6 @@ const enable$1 = parsedCliArgs => {
|
|
|
3547
3597
|
setLocale('en');
|
|
3548
3598
|
};
|
|
3549
3599
|
|
|
3550
|
-
var src = {exports: {}};
|
|
3551
|
-
|
|
3552
|
-
var browser = {exports: {}};
|
|
3553
|
-
|
|
3554
|
-
/**
|
|
3555
|
-
* Helpers.
|
|
3556
|
-
*/
|
|
3557
|
-
|
|
3558
|
-
var ms;
|
|
3559
|
-
var hasRequiredMs;
|
|
3560
|
-
|
|
3561
|
-
function requireMs () {
|
|
3562
|
-
if (hasRequiredMs) return ms;
|
|
3563
|
-
hasRequiredMs = 1;
|
|
3564
|
-
var s = 1000;
|
|
3565
|
-
var m = s * 60;
|
|
3566
|
-
var h = m * 60;
|
|
3567
|
-
var d = h * 24;
|
|
3568
|
-
var w = d * 7;
|
|
3569
|
-
var y = d * 365.25;
|
|
3570
|
-
|
|
3571
|
-
/**
|
|
3572
|
-
* Parse or format the given `val`.
|
|
3573
|
-
*
|
|
3574
|
-
* Options:
|
|
3575
|
-
*
|
|
3576
|
-
* - `long` verbose formatting [false]
|
|
3577
|
-
*
|
|
3578
|
-
* @param {String|Number} val
|
|
3579
|
-
* @param {Object} [options]
|
|
3580
|
-
* @throws {Error} throw an error if val is not a non-empty string or a number
|
|
3581
|
-
* @return {String|Number}
|
|
3582
|
-
* @api public
|
|
3583
|
-
*/
|
|
3584
|
-
|
|
3585
|
-
ms = function (val, options) {
|
|
3586
|
-
options = options || {};
|
|
3587
|
-
var type = typeof val;
|
|
3588
|
-
if (type === 'string' && val.length > 0) {
|
|
3589
|
-
return parse(val);
|
|
3590
|
-
} else if (type === 'number' && isFinite(val)) {
|
|
3591
|
-
return options.long ? fmtLong(val) : fmtShort(val);
|
|
3592
|
-
}
|
|
3593
|
-
throw new Error('val is not a non-empty string or a valid number. val=' + JSON.stringify(val));
|
|
3594
|
-
};
|
|
3595
|
-
|
|
3596
|
-
/**
|
|
3597
|
-
* Parse the given `str` and return milliseconds.
|
|
3598
|
-
*
|
|
3599
|
-
* @param {String} str
|
|
3600
|
-
* @return {Number}
|
|
3601
|
-
* @api private
|
|
3602
|
-
*/
|
|
3603
|
-
|
|
3604
|
-
function parse(str) {
|
|
3605
|
-
str = String(str);
|
|
3606
|
-
if (str.length > 100) {
|
|
3607
|
-
return;
|
|
3608
|
-
}
|
|
3609
|
-
var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(str);
|
|
3610
|
-
if (!match) {
|
|
3611
|
-
return;
|
|
3612
|
-
}
|
|
3613
|
-
var n = parseFloat(match[1]);
|
|
3614
|
-
var type = (match[2] || 'ms').toLowerCase();
|
|
3615
|
-
switch (type) {
|
|
3616
|
-
case 'years':
|
|
3617
|
-
case 'year':
|
|
3618
|
-
case 'yrs':
|
|
3619
|
-
case 'yr':
|
|
3620
|
-
case 'y':
|
|
3621
|
-
return n * y;
|
|
3622
|
-
case 'weeks':
|
|
3623
|
-
case 'week':
|
|
3624
|
-
case 'w':
|
|
3625
|
-
return n * w;
|
|
3626
|
-
case 'days':
|
|
3627
|
-
case 'day':
|
|
3628
|
-
case 'd':
|
|
3629
|
-
return n * d;
|
|
3630
|
-
case 'hours':
|
|
3631
|
-
case 'hour':
|
|
3632
|
-
case 'hrs':
|
|
3633
|
-
case 'hr':
|
|
3634
|
-
case 'h':
|
|
3635
|
-
return n * h;
|
|
3636
|
-
case 'minutes':
|
|
3637
|
-
case 'minute':
|
|
3638
|
-
case 'mins':
|
|
3639
|
-
case 'min':
|
|
3640
|
-
case 'm':
|
|
3641
|
-
return n * m;
|
|
3642
|
-
case 'seconds':
|
|
3643
|
-
case 'second':
|
|
3644
|
-
case 'secs':
|
|
3645
|
-
case 'sec':
|
|
3646
|
-
case 's':
|
|
3647
|
-
return n * s;
|
|
3648
|
-
case 'milliseconds':
|
|
3649
|
-
case 'millisecond':
|
|
3650
|
-
case 'msecs':
|
|
3651
|
-
case 'msec':
|
|
3652
|
-
case 'ms':
|
|
3653
|
-
return n;
|
|
3654
|
-
default:
|
|
3655
|
-
return undefined;
|
|
3656
|
-
}
|
|
3657
|
-
}
|
|
3658
|
-
|
|
3659
|
-
/**
|
|
3660
|
-
* Short format for `ms`.
|
|
3661
|
-
*
|
|
3662
|
-
* @param {Number} ms
|
|
3663
|
-
* @return {String}
|
|
3664
|
-
* @api private
|
|
3665
|
-
*/
|
|
3666
|
-
|
|
3667
|
-
function fmtShort(ms) {
|
|
3668
|
-
var msAbs = Math.abs(ms);
|
|
3669
|
-
if (msAbs >= d) {
|
|
3670
|
-
return Math.round(ms / d) + 'd';
|
|
3671
|
-
}
|
|
3672
|
-
if (msAbs >= h) {
|
|
3673
|
-
return Math.round(ms / h) + 'h';
|
|
3674
|
-
}
|
|
3675
|
-
if (msAbs >= m) {
|
|
3676
|
-
return Math.round(ms / m) + 'm';
|
|
3677
|
-
}
|
|
3678
|
-
if (msAbs >= s) {
|
|
3679
|
-
return Math.round(ms / s) + 's';
|
|
3680
|
-
}
|
|
3681
|
-
return ms + 'ms';
|
|
3682
|
-
}
|
|
3683
|
-
|
|
3684
|
-
/**
|
|
3685
|
-
* Long format for `ms`.
|
|
3686
|
-
*
|
|
3687
|
-
* @param {Number} ms
|
|
3688
|
-
* @return {String}
|
|
3689
|
-
* @api private
|
|
3690
|
-
*/
|
|
3691
|
-
|
|
3692
|
-
function fmtLong(ms) {
|
|
3693
|
-
var msAbs = Math.abs(ms);
|
|
3694
|
-
if (msAbs >= d) {
|
|
3695
|
-
return plural(ms, msAbs, d, 'day');
|
|
3696
|
-
}
|
|
3697
|
-
if (msAbs >= h) {
|
|
3698
|
-
return plural(ms, msAbs, h, 'hour');
|
|
3699
|
-
}
|
|
3700
|
-
if (msAbs >= m) {
|
|
3701
|
-
return plural(ms, msAbs, m, 'minute');
|
|
3702
|
-
}
|
|
3703
|
-
if (msAbs >= s) {
|
|
3704
|
-
return plural(ms, msAbs, s, 'second');
|
|
3705
|
-
}
|
|
3706
|
-
return ms + ' ms';
|
|
3707
|
-
}
|
|
3708
|
-
|
|
3709
|
-
/**
|
|
3710
|
-
* Pluralization helper.
|
|
3711
|
-
*/
|
|
3712
|
-
|
|
3713
|
-
function plural(ms, msAbs, n, name) {
|
|
3714
|
-
var isPlural = msAbs >= n * 1.5;
|
|
3715
|
-
return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');
|
|
3716
|
-
}
|
|
3717
|
-
return ms;
|
|
3718
|
-
}
|
|
3719
|
-
|
|
3720
|
-
/**
|
|
3721
|
-
* This is the common logic for both the Node.js and web browser
|
|
3722
|
-
* implementations of `debug()`.
|
|
3723
|
-
*/
|
|
3724
|
-
|
|
3725
|
-
var common;
|
|
3726
|
-
var hasRequiredCommon;
|
|
3727
|
-
|
|
3728
|
-
function requireCommon () {
|
|
3729
|
-
if (hasRequiredCommon) return common;
|
|
3730
|
-
hasRequiredCommon = 1;
|
|
3731
|
-
function setup(env) {
|
|
3732
|
-
createDebug.debug = createDebug;
|
|
3733
|
-
createDebug.default = createDebug;
|
|
3734
|
-
createDebug.coerce = coerce;
|
|
3735
|
-
createDebug.disable = disable;
|
|
3736
|
-
createDebug.enable = enable;
|
|
3737
|
-
createDebug.enabled = enabled;
|
|
3738
|
-
createDebug.humanize = requireMs();
|
|
3739
|
-
createDebug.destroy = destroy;
|
|
3740
|
-
Object.keys(env).forEach(key => {
|
|
3741
|
-
createDebug[key] = env[key];
|
|
3742
|
-
});
|
|
3743
|
-
|
|
3744
|
-
/**
|
|
3745
|
-
* The currently active debug mode names, and names to skip.
|
|
3746
|
-
*/
|
|
3747
|
-
|
|
3748
|
-
createDebug.names = [];
|
|
3749
|
-
createDebug.skips = [];
|
|
3750
|
-
|
|
3751
|
-
/**
|
|
3752
|
-
* Map of special "%n" handling functions, for the debug "format" argument.
|
|
3753
|
-
*
|
|
3754
|
-
* Valid key names are a single, lower or upper-case letter, i.e. "n" and "N".
|
|
3755
|
-
*/
|
|
3756
|
-
createDebug.formatters = {};
|
|
3757
|
-
|
|
3758
|
-
/**
|
|
3759
|
-
* Selects a color for a debug namespace
|
|
3760
|
-
* @param {String} namespace The namespace string for the debug instance to be colored
|
|
3761
|
-
* @return {Number|String} An ANSI color code for the given namespace
|
|
3762
|
-
* @api private
|
|
3763
|
-
*/
|
|
3764
|
-
function selectColor(namespace) {
|
|
3765
|
-
let hash = 0;
|
|
3766
|
-
for (let i = 0; i < namespace.length; i++) {
|
|
3767
|
-
hash = (hash << 5) - hash + namespace.charCodeAt(i);
|
|
3768
|
-
hash |= 0; // Convert to 32bit integer
|
|
3769
|
-
}
|
|
3770
|
-
return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
|
|
3771
|
-
}
|
|
3772
|
-
createDebug.selectColor = selectColor;
|
|
3773
|
-
|
|
3774
|
-
/**
|
|
3775
|
-
* Create a debugger with the given `namespace`.
|
|
3776
|
-
*
|
|
3777
|
-
* @param {String} namespace
|
|
3778
|
-
* @return {Function}
|
|
3779
|
-
* @api public
|
|
3780
|
-
*/
|
|
3781
|
-
function createDebug(namespace) {
|
|
3782
|
-
let prevTime;
|
|
3783
|
-
let enableOverride = null;
|
|
3784
|
-
let namespacesCache;
|
|
3785
|
-
let enabledCache;
|
|
3786
|
-
function debug(...args) {
|
|
3787
|
-
// Disabled?
|
|
3788
|
-
if (!debug.enabled) {
|
|
3789
|
-
return;
|
|
3790
|
-
}
|
|
3791
|
-
const self = debug;
|
|
3792
|
-
|
|
3793
|
-
// Set `diff` timestamp
|
|
3794
|
-
const curr = Number(new Date());
|
|
3795
|
-
const ms = curr - (prevTime || curr);
|
|
3796
|
-
self.diff = ms;
|
|
3797
|
-
self.prev = prevTime;
|
|
3798
|
-
self.curr = curr;
|
|
3799
|
-
prevTime = curr;
|
|
3800
|
-
args[0] = createDebug.coerce(args[0]);
|
|
3801
|
-
if (typeof args[0] !== 'string') {
|
|
3802
|
-
// Anything else let's inspect with %O
|
|
3803
|
-
args.unshift('%O');
|
|
3804
|
-
}
|
|
3805
|
-
|
|
3806
|
-
// Apply any `formatters` transformations
|
|
3807
|
-
let index = 0;
|
|
3808
|
-
args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
|
|
3809
|
-
// If we encounter an escaped % then don't increase the array index
|
|
3810
|
-
if (match === '%%') {
|
|
3811
|
-
return '%';
|
|
3812
|
-
}
|
|
3813
|
-
index++;
|
|
3814
|
-
const formatter = createDebug.formatters[format];
|
|
3815
|
-
if (typeof formatter === 'function') {
|
|
3816
|
-
const val = args[index];
|
|
3817
|
-
match = formatter.call(self, val);
|
|
3818
|
-
|
|
3819
|
-
// Now we need to remove `args[index]` since it's inlined in the `format`
|
|
3820
|
-
args.splice(index, 1);
|
|
3821
|
-
index--;
|
|
3822
|
-
}
|
|
3823
|
-
return match;
|
|
3824
|
-
});
|
|
3825
|
-
|
|
3826
|
-
// Apply env-specific formatting (colors, etc.)
|
|
3827
|
-
createDebug.formatArgs.call(self, args);
|
|
3828
|
-
const logFn = self.log || createDebug.log;
|
|
3829
|
-
logFn.apply(self, args);
|
|
3830
|
-
}
|
|
3831
|
-
debug.namespace = namespace;
|
|
3832
|
-
debug.useColors = createDebug.useColors();
|
|
3833
|
-
debug.color = createDebug.selectColor(namespace);
|
|
3834
|
-
debug.extend = extend;
|
|
3835
|
-
debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.
|
|
3836
|
-
|
|
3837
|
-
Object.defineProperty(debug, 'enabled', {
|
|
3838
|
-
enumerable: true,
|
|
3839
|
-
configurable: false,
|
|
3840
|
-
get: () => {
|
|
3841
|
-
if (enableOverride !== null) {
|
|
3842
|
-
return enableOverride;
|
|
3843
|
-
}
|
|
3844
|
-
if (namespacesCache !== createDebug.namespaces) {
|
|
3845
|
-
namespacesCache = createDebug.namespaces;
|
|
3846
|
-
enabledCache = createDebug.enabled(namespace);
|
|
3847
|
-
}
|
|
3848
|
-
return enabledCache;
|
|
3849
|
-
},
|
|
3850
|
-
set: v => {
|
|
3851
|
-
enableOverride = v;
|
|
3852
|
-
}
|
|
3853
|
-
});
|
|
3854
|
-
|
|
3855
|
-
// Env-specific initialization logic for debug instances
|
|
3856
|
-
if (typeof createDebug.init === 'function') {
|
|
3857
|
-
createDebug.init(debug);
|
|
3858
|
-
}
|
|
3859
|
-
return debug;
|
|
3860
|
-
}
|
|
3861
|
-
function extend(namespace, delimiter) {
|
|
3862
|
-
const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
|
|
3863
|
-
newDebug.log = this.log;
|
|
3864
|
-
return newDebug;
|
|
3865
|
-
}
|
|
3866
|
-
|
|
3867
|
-
/**
|
|
3868
|
-
* Enables a debug mode by namespaces. This can include modes
|
|
3869
|
-
* separated by a colon and wildcards.
|
|
3870
|
-
*
|
|
3871
|
-
* @param {String} namespaces
|
|
3872
|
-
* @api public
|
|
3873
|
-
*/
|
|
3874
|
-
function enable(namespaces) {
|
|
3875
|
-
createDebug.save(namespaces);
|
|
3876
|
-
createDebug.namespaces = namespaces;
|
|
3877
|
-
createDebug.names = [];
|
|
3878
|
-
createDebug.skips = [];
|
|
3879
|
-
const split = (typeof namespaces === 'string' ? namespaces : '').trim().replace(/\s+/g, ',').split(',').filter(Boolean);
|
|
3880
|
-
for (const ns of split) {
|
|
3881
|
-
if (ns[0] === '-') {
|
|
3882
|
-
createDebug.skips.push(ns.slice(1));
|
|
3883
|
-
} else {
|
|
3884
|
-
createDebug.names.push(ns);
|
|
3885
|
-
}
|
|
3886
|
-
}
|
|
3887
|
-
}
|
|
3888
|
-
|
|
3889
|
-
/**
|
|
3890
|
-
* Checks if the given string matches a namespace template, honoring
|
|
3891
|
-
* asterisks as wildcards.
|
|
3892
|
-
*
|
|
3893
|
-
* @param {String} search
|
|
3894
|
-
* @param {String} template
|
|
3895
|
-
* @return {Boolean}
|
|
3896
|
-
*/
|
|
3897
|
-
function matchesTemplate(search, template) {
|
|
3898
|
-
let searchIndex = 0;
|
|
3899
|
-
let templateIndex = 0;
|
|
3900
|
-
let starIndex = -1;
|
|
3901
|
-
let matchIndex = 0;
|
|
3902
|
-
while (searchIndex < search.length) {
|
|
3903
|
-
if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === '*')) {
|
|
3904
|
-
// Match character or proceed with wildcard
|
|
3905
|
-
if (template[templateIndex] === '*') {
|
|
3906
|
-
starIndex = templateIndex;
|
|
3907
|
-
matchIndex = searchIndex;
|
|
3908
|
-
templateIndex++; // Skip the '*'
|
|
3909
|
-
} else {
|
|
3910
|
-
searchIndex++;
|
|
3911
|
-
templateIndex++;
|
|
3912
|
-
}
|
|
3913
|
-
} else if (starIndex !== -1) {
|
|
3914
|
-
// eslint-disable-line no-negated-condition
|
|
3915
|
-
// Backtrack to the last '*' and try to match more characters
|
|
3916
|
-
templateIndex = starIndex + 1;
|
|
3917
|
-
matchIndex++;
|
|
3918
|
-
searchIndex = matchIndex;
|
|
3919
|
-
} else {
|
|
3920
|
-
return false; // No match
|
|
3921
|
-
}
|
|
3922
|
-
}
|
|
3923
|
-
|
|
3924
|
-
// Handle trailing '*' in template
|
|
3925
|
-
while (templateIndex < template.length && template[templateIndex] === '*') {
|
|
3926
|
-
templateIndex++;
|
|
3927
|
-
}
|
|
3928
|
-
return templateIndex === template.length;
|
|
3929
|
-
}
|
|
3930
|
-
|
|
3931
|
-
/**
|
|
3932
|
-
* Disable debug output.
|
|
3933
|
-
*
|
|
3934
|
-
* @return {String} namespaces
|
|
3935
|
-
* @api public
|
|
3936
|
-
*/
|
|
3937
|
-
function disable() {
|
|
3938
|
-
const namespaces = [...createDebug.names, ...createDebug.skips.map(namespace => '-' + namespace)].join(',');
|
|
3939
|
-
createDebug.enable('');
|
|
3940
|
-
return namespaces;
|
|
3941
|
-
}
|
|
3942
|
-
|
|
3943
|
-
/**
|
|
3944
|
-
* Returns true if the given mode name is enabled, false otherwise.
|
|
3945
|
-
*
|
|
3946
|
-
* @param {String} name
|
|
3947
|
-
* @return {Boolean}
|
|
3948
|
-
* @api public
|
|
3949
|
-
*/
|
|
3950
|
-
function enabled(name) {
|
|
3951
|
-
for (const skip of createDebug.skips) {
|
|
3952
|
-
if (matchesTemplate(name, skip)) {
|
|
3953
|
-
return false;
|
|
3954
|
-
}
|
|
3955
|
-
}
|
|
3956
|
-
for (const ns of createDebug.names) {
|
|
3957
|
-
if (matchesTemplate(name, ns)) {
|
|
3958
|
-
return true;
|
|
3959
|
-
}
|
|
3960
|
-
}
|
|
3961
|
-
return false;
|
|
3962
|
-
}
|
|
3963
|
-
|
|
3964
|
-
/**
|
|
3965
|
-
* Coerce `val`.
|
|
3966
|
-
*
|
|
3967
|
-
* @param {Mixed} val
|
|
3968
|
-
* @return {Mixed}
|
|
3969
|
-
* @api private
|
|
3970
|
-
*/
|
|
3971
|
-
function coerce(val) {
|
|
3972
|
-
if (val instanceof Error) {
|
|
3973
|
-
return val.stack || val.message;
|
|
3974
|
-
}
|
|
3975
|
-
return val;
|
|
3976
|
-
}
|
|
3977
|
-
|
|
3978
|
-
/**
|
|
3979
|
-
* XXX DO NOT USE. This is a temporary stub function.
|
|
3980
|
-
* XXX It WILL be removed in the next major release.
|
|
3981
|
-
*/
|
|
3982
|
-
function destroy() {
|
|
3983
|
-
console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
|
|
3984
|
-
}
|
|
3985
|
-
createDebug.enable(createDebug.load());
|
|
3986
|
-
return createDebug;
|
|
3987
|
-
}
|
|
3988
|
-
common = setup;
|
|
3989
|
-
return common;
|
|
3990
|
-
}
|
|
3991
|
-
|
|
3992
|
-
/* eslint-env browser */
|
|
3993
|
-
|
|
3994
|
-
var hasRequiredBrowser;
|
|
3995
|
-
|
|
3996
|
-
function requireBrowser () {
|
|
3997
|
-
if (hasRequiredBrowser) return browser.exports;
|
|
3998
|
-
hasRequiredBrowser = 1;
|
|
3999
|
-
(function (module, exports$1) {
|
|
4000
|
-
/**
|
|
4001
|
-
* This is the web browser implementation of `debug()`.
|
|
4002
|
-
*/
|
|
4003
|
-
|
|
4004
|
-
exports$1.formatArgs = formatArgs;
|
|
4005
|
-
exports$1.save = save;
|
|
4006
|
-
exports$1.load = load;
|
|
4007
|
-
exports$1.useColors = useColors;
|
|
4008
|
-
exports$1.storage = localstorage();
|
|
4009
|
-
exports$1.destroy = (() => {
|
|
4010
|
-
let warned = false;
|
|
4011
|
-
return () => {
|
|
4012
|
-
if (!warned) {
|
|
4013
|
-
warned = true;
|
|
4014
|
-
console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
|
|
4015
|
-
}
|
|
4016
|
-
};
|
|
4017
|
-
})();
|
|
4018
|
-
|
|
4019
|
-
/**
|
|
4020
|
-
* Colors.
|
|
4021
|
-
*/
|
|
4022
|
-
|
|
4023
|
-
exports$1.colors = ['#0000CC', '#0000FF', '#0033CC', '#0033FF', '#0066CC', '#0066FF', '#0099CC', '#0099FF', '#00CC00', '#00CC33', '#00CC66', '#00CC99', '#00CCCC', '#00CCFF', '#3300CC', '#3300FF', '#3333CC', '#3333FF', '#3366CC', '#3366FF', '#3399CC', '#3399FF', '#33CC00', '#33CC33', '#33CC66', '#33CC99', '#33CCCC', '#33CCFF', '#6600CC', '#6600FF', '#6633CC', '#6633FF', '#66CC00', '#66CC33', '#9900CC', '#9900FF', '#9933CC', '#9933FF', '#99CC00', '#99CC33', '#CC0000', '#CC0033', '#CC0066', '#CC0099', '#CC00CC', '#CC00FF', '#CC3300', '#CC3333', '#CC3366', '#CC3399', '#CC33CC', '#CC33FF', '#CC6600', '#CC6633', '#CC9900', '#CC9933', '#CCCC00', '#CCCC33', '#FF0000', '#FF0033', '#FF0066', '#FF0099', '#FF00CC', '#FF00FF', '#FF3300', '#FF3333', '#FF3366', '#FF3399', '#FF33CC', '#FF33FF', '#FF6600', '#FF6633', '#FF9900', '#FF9933', '#FFCC00', '#FFCC33'];
|
|
4024
|
-
|
|
4025
|
-
/**
|
|
4026
|
-
* Currently only WebKit-based Web Inspectors, Firefox >= v31,
|
|
4027
|
-
* and the Firebug extension (any Firefox version) are known
|
|
4028
|
-
* to support "%c" CSS customizations.
|
|
4029
|
-
*
|
|
4030
|
-
* TODO: add a `localStorage` variable to explicitly enable/disable colors
|
|
4031
|
-
*/
|
|
4032
|
-
|
|
4033
|
-
// eslint-disable-next-line complexity
|
|
4034
|
-
function useColors() {
|
|
4035
|
-
// NB: In an Electron preload script, document will be defined but not fully
|
|
4036
|
-
// initialized. Since we know we're in Chrome, we'll just detect this case
|
|
4037
|
-
// explicitly
|
|
4038
|
-
if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {
|
|
4039
|
-
return true;
|
|
4040
|
-
}
|
|
4041
|
-
|
|
4042
|
-
// Internet Explorer and Edge do not support colors.
|
|
4043
|
-
if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
|
|
4044
|
-
return false;
|
|
4045
|
-
}
|
|
4046
|
-
let m;
|
|
4047
|
-
|
|
4048
|
-
// Is webkit? http://stackoverflow.com/a/16459606/376773
|
|
4049
|
-
// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632
|
|
4050
|
-
// eslint-disable-next-line no-return-assign
|
|
4051
|
-
return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance ||
|
|
4052
|
-
// Is firebug? http://stackoverflow.com/a/398120/376773
|
|
4053
|
-
typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) ||
|
|
4054
|
-
// Is firefox >= v31?
|
|
4055
|
-
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages
|
|
4056
|
-
typeof navigator !== 'undefined' && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[1], 10) >= 31 ||
|
|
4057
|
-
// Double check webkit in userAgent just in case we are in a worker
|
|
4058
|
-
typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
|
|
4059
|
-
}
|
|
4060
|
-
|
|
4061
|
-
/**
|
|
4062
|
-
* Colorize log arguments if enabled.
|
|
4063
|
-
*
|
|
4064
|
-
* @api public
|
|
4065
|
-
*/
|
|
4066
|
-
|
|
4067
|
-
function formatArgs(args) {
|
|
4068
|
-
args[0] = (this.useColors ? '%c' : '') + this.namespace + (this.useColors ? ' %c' : ' ') + args[0] + (this.useColors ? '%c ' : ' ') + '+' + module.exports.humanize(this.diff);
|
|
4069
|
-
if (!this.useColors) {
|
|
4070
|
-
return;
|
|
4071
|
-
}
|
|
4072
|
-
const c = 'color: ' + this.color;
|
|
4073
|
-
args.splice(1, 0, c, 'color: inherit');
|
|
4074
|
-
|
|
4075
|
-
// The final "%c" is somewhat tricky, because there could be other
|
|
4076
|
-
// arguments passed either before or after the %c, so we need to
|
|
4077
|
-
// figure out the correct index to insert the CSS into
|
|
4078
|
-
let index = 0;
|
|
4079
|
-
let lastC = 0;
|
|
4080
|
-
args[0].replace(/%[a-zA-Z%]/g, match => {
|
|
4081
|
-
if (match === '%%') {
|
|
4082
|
-
return;
|
|
4083
|
-
}
|
|
4084
|
-
index++;
|
|
4085
|
-
if (match === '%c') {
|
|
4086
|
-
// We only are interested in the *last* %c
|
|
4087
|
-
// (the user may have provided their own)
|
|
4088
|
-
lastC = index;
|
|
4089
|
-
}
|
|
4090
|
-
});
|
|
4091
|
-
args.splice(lastC, 0, c);
|
|
4092
|
-
}
|
|
4093
|
-
|
|
4094
|
-
/**
|
|
4095
|
-
* Invokes `console.debug()` when available.
|
|
4096
|
-
* No-op when `console.debug` is not a "function".
|
|
4097
|
-
* If `console.debug` is not available, falls back
|
|
4098
|
-
* to `console.log`.
|
|
4099
|
-
*
|
|
4100
|
-
* @api public
|
|
4101
|
-
*/
|
|
4102
|
-
exports$1.log = console.debug || console.log || (() => {});
|
|
4103
|
-
|
|
4104
|
-
/**
|
|
4105
|
-
* Save `namespaces`.
|
|
4106
|
-
*
|
|
4107
|
-
* @param {String} namespaces
|
|
4108
|
-
* @api private
|
|
4109
|
-
*/
|
|
4110
|
-
function save(namespaces) {
|
|
4111
|
-
try {
|
|
4112
|
-
if (namespaces) {
|
|
4113
|
-
exports$1.storage.setItem('debug', namespaces);
|
|
4114
|
-
} else {
|
|
4115
|
-
exports$1.storage.removeItem('debug');
|
|
4116
|
-
}
|
|
4117
|
-
} catch (error) {
|
|
4118
|
-
// Swallow
|
|
4119
|
-
// XXX (@Qix-) should we be logging these?
|
|
4120
|
-
}
|
|
4121
|
-
}
|
|
4122
|
-
|
|
4123
|
-
/**
|
|
4124
|
-
* Load `namespaces`.
|
|
4125
|
-
*
|
|
4126
|
-
* @return {String} returns the previously persisted debug modes
|
|
4127
|
-
* @api private
|
|
4128
|
-
*/
|
|
4129
|
-
function load() {
|
|
4130
|
-
let r;
|
|
4131
|
-
try {
|
|
4132
|
-
r = exports$1.storage.getItem('debug') || exports$1.storage.getItem('DEBUG');
|
|
4133
|
-
} catch (error) {
|
|
4134
|
-
// Swallow
|
|
4135
|
-
// XXX (@Qix-) should we be logging these?
|
|
4136
|
-
}
|
|
4137
|
-
|
|
4138
|
-
// If debug isn't set in LS, and we're in Electron, try to load $DEBUG
|
|
4139
|
-
if (!r && typeof process !== 'undefined' && 'env' in process) {
|
|
4140
|
-
r = process.env.DEBUG;
|
|
4141
|
-
}
|
|
4142
|
-
return r;
|
|
4143
|
-
}
|
|
4144
|
-
|
|
4145
|
-
/**
|
|
4146
|
-
* Localstorage attempts to return the localstorage.
|
|
4147
|
-
*
|
|
4148
|
-
* This is necessary because safari throws
|
|
4149
|
-
* when a user disables cookies/localstorage
|
|
4150
|
-
* and you attempt to access it.
|
|
4151
|
-
*
|
|
4152
|
-
* @return {LocalStorage}
|
|
4153
|
-
* @api private
|
|
4154
|
-
*/
|
|
4155
|
-
|
|
4156
|
-
function localstorage() {
|
|
4157
|
-
try {
|
|
4158
|
-
// TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context
|
|
4159
|
-
// The Browser also has localStorage in the global context.
|
|
4160
|
-
return localStorage;
|
|
4161
|
-
} catch (error) {
|
|
4162
|
-
// Swallow
|
|
4163
|
-
// XXX (@Qix-) should we be logging these?
|
|
4164
|
-
}
|
|
4165
|
-
}
|
|
4166
|
-
module.exports = requireCommon()(exports$1);
|
|
4167
|
-
const {
|
|
4168
|
-
formatters
|
|
4169
|
-
} = module.exports;
|
|
4170
|
-
|
|
4171
|
-
/**
|
|
4172
|
-
* Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
|
|
4173
|
-
*/
|
|
4174
|
-
|
|
4175
|
-
formatters.j = function (v) {
|
|
4176
|
-
try {
|
|
4177
|
-
return JSON.stringify(v);
|
|
4178
|
-
} catch (error) {
|
|
4179
|
-
return '[UnexpectedJSONParseError]: ' + error.message;
|
|
4180
|
-
}
|
|
4181
|
-
};
|
|
4182
|
-
} (browser, browser.exports));
|
|
4183
|
-
return browser.exports;
|
|
4184
|
-
}
|
|
4185
|
-
|
|
4186
|
-
var node = {exports: {}};
|
|
4187
|
-
|
|
4188
|
-
var hasFlag;
|
|
4189
|
-
var hasRequiredHasFlag;
|
|
4190
|
-
|
|
4191
|
-
function requireHasFlag () {
|
|
4192
|
-
if (hasRequiredHasFlag) return hasFlag;
|
|
4193
|
-
hasRequiredHasFlag = 1;
|
|
4194
|
-
|
|
4195
|
-
hasFlag = (flag, argv = process.argv) => {
|
|
4196
|
-
const prefix = flag.startsWith('-') ? '' : flag.length === 1 ? '-' : '--';
|
|
4197
|
-
const position = argv.indexOf(prefix + flag);
|
|
4198
|
-
const terminatorPosition = argv.indexOf('--');
|
|
4199
|
-
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
4200
|
-
};
|
|
4201
|
-
return hasFlag;
|
|
4202
|
-
}
|
|
4203
|
-
|
|
4204
|
-
var supportsColor_1;
|
|
4205
|
-
var hasRequiredSupportsColor;
|
|
4206
|
-
|
|
4207
|
-
function requireSupportsColor () {
|
|
4208
|
-
if (hasRequiredSupportsColor) return supportsColor_1;
|
|
4209
|
-
hasRequiredSupportsColor = 1;
|
|
4210
|
-
|
|
4211
|
-
const os = require$$0;
|
|
4212
|
-
const tty = require$$1;
|
|
4213
|
-
const hasFlag = requireHasFlag();
|
|
4214
|
-
const {
|
|
4215
|
-
env
|
|
4216
|
-
} = process;
|
|
4217
|
-
let forceColor;
|
|
4218
|
-
if (hasFlag('no-color') || hasFlag('no-colors') || hasFlag('color=false') || hasFlag('color=never')) {
|
|
4219
|
-
forceColor = 0;
|
|
4220
|
-
} else if (hasFlag('color') || hasFlag('colors') || hasFlag('color=true') || hasFlag('color=always')) {
|
|
4221
|
-
forceColor = 1;
|
|
4222
|
-
}
|
|
4223
|
-
if ('FORCE_COLOR' in env) {
|
|
4224
|
-
if (env.FORCE_COLOR === 'true') {
|
|
4225
|
-
forceColor = 1;
|
|
4226
|
-
} else if (env.FORCE_COLOR === 'false') {
|
|
4227
|
-
forceColor = 0;
|
|
4228
|
-
} else {
|
|
4229
|
-
forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
|
|
4230
|
-
}
|
|
4231
|
-
}
|
|
4232
|
-
function translateLevel(level) {
|
|
4233
|
-
if (level === 0) {
|
|
4234
|
-
return false;
|
|
4235
|
-
}
|
|
4236
|
-
return {
|
|
4237
|
-
level,
|
|
4238
|
-
hasBasic: true,
|
|
4239
|
-
has256: level >= 2,
|
|
4240
|
-
has16m: level >= 3
|
|
4241
|
-
};
|
|
4242
|
-
}
|
|
4243
|
-
function supportsColor(haveStream, streamIsTTY) {
|
|
4244
|
-
if (forceColor === 0) {
|
|
4245
|
-
return 0;
|
|
4246
|
-
}
|
|
4247
|
-
if (hasFlag('color=16m') || hasFlag('color=full') || hasFlag('color=truecolor')) {
|
|
4248
|
-
return 3;
|
|
4249
|
-
}
|
|
4250
|
-
if (hasFlag('color=256')) {
|
|
4251
|
-
return 2;
|
|
4252
|
-
}
|
|
4253
|
-
if (haveStream && !streamIsTTY && forceColor === undefined) {
|
|
4254
|
-
return 0;
|
|
4255
|
-
}
|
|
4256
|
-
const min = forceColor || 0;
|
|
4257
|
-
if (env.TERM === 'dumb') {
|
|
4258
|
-
return min;
|
|
4259
|
-
}
|
|
4260
|
-
if (process.platform === 'win32') {
|
|
4261
|
-
// Windows 10 build 10586 is the first Windows release that supports 256 colors.
|
|
4262
|
-
// Windows 10 build 14931 is the first release that supports 16m/TrueColor.
|
|
4263
|
-
const osRelease = os.release().split('.');
|
|
4264
|
-
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
4265
|
-
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
4266
|
-
}
|
|
4267
|
-
return 1;
|
|
4268
|
-
}
|
|
4269
|
-
if ('CI' in env) {
|
|
4270
|
-
if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'GITHUB_ACTIONS', 'BUILDKITE'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
|
|
4271
|
-
return 1;
|
|
4272
|
-
}
|
|
4273
|
-
return min;
|
|
4274
|
-
}
|
|
4275
|
-
if ('TEAMCITY_VERSION' in env) {
|
|
4276
|
-
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
4277
|
-
}
|
|
4278
|
-
if (env.COLORTERM === 'truecolor') {
|
|
4279
|
-
return 3;
|
|
4280
|
-
}
|
|
4281
|
-
if ('TERM_PROGRAM' in env) {
|
|
4282
|
-
const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
|
|
4283
|
-
switch (env.TERM_PROGRAM) {
|
|
4284
|
-
case 'iTerm.app':
|
|
4285
|
-
return version >= 3 ? 3 : 2;
|
|
4286
|
-
case 'Apple_Terminal':
|
|
4287
|
-
return 2;
|
|
4288
|
-
// No default
|
|
4289
|
-
}
|
|
4290
|
-
}
|
|
4291
|
-
if (/-256(color)?$/i.test(env.TERM)) {
|
|
4292
|
-
return 2;
|
|
4293
|
-
}
|
|
4294
|
-
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
|
4295
|
-
return 1;
|
|
4296
|
-
}
|
|
4297
|
-
if ('COLORTERM' in env) {
|
|
4298
|
-
return 1;
|
|
4299
|
-
}
|
|
4300
|
-
return min;
|
|
4301
|
-
}
|
|
4302
|
-
function getSupportLevel(stream) {
|
|
4303
|
-
const level = supportsColor(stream, stream && stream.isTTY);
|
|
4304
|
-
return translateLevel(level);
|
|
4305
|
-
}
|
|
4306
|
-
supportsColor_1 = {
|
|
4307
|
-
supportsColor: getSupportLevel,
|
|
4308
|
-
stdout: translateLevel(supportsColor(true, tty.isatty(1))),
|
|
4309
|
-
stderr: translateLevel(supportsColor(true, tty.isatty(2)))
|
|
4310
|
-
};
|
|
4311
|
-
return supportsColor_1;
|
|
4312
|
-
}
|
|
4313
|
-
|
|
4314
|
-
/**
|
|
4315
|
-
* Module dependencies.
|
|
4316
|
-
*/
|
|
4317
|
-
|
|
4318
|
-
var hasRequiredNode;
|
|
4319
|
-
|
|
4320
|
-
function requireNode () {
|
|
4321
|
-
if (hasRequiredNode) return node.exports;
|
|
4322
|
-
hasRequiredNode = 1;
|
|
4323
|
-
(function (module, exports$1) {
|
|
4324
|
-
const tty = require$$1;
|
|
4325
|
-
const util = require$$1$1;
|
|
4326
|
-
|
|
4327
|
-
/**
|
|
4328
|
-
* This is the Node.js implementation of `debug()`.
|
|
4329
|
-
*/
|
|
4330
|
-
|
|
4331
|
-
exports$1.init = init;
|
|
4332
|
-
exports$1.log = log;
|
|
4333
|
-
exports$1.formatArgs = formatArgs;
|
|
4334
|
-
exports$1.save = save;
|
|
4335
|
-
exports$1.load = load;
|
|
4336
|
-
exports$1.useColors = useColors;
|
|
4337
|
-
exports$1.destroy = util.deprecate(() => {}, 'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');
|
|
4338
|
-
|
|
4339
|
-
/**
|
|
4340
|
-
* Colors.
|
|
4341
|
-
*/
|
|
4342
|
-
|
|
4343
|
-
exports$1.colors = [6, 2, 3, 4, 5, 1];
|
|
4344
|
-
try {
|
|
4345
|
-
// Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json)
|
|
4346
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
4347
|
-
const supportsColor = requireSupportsColor();
|
|
4348
|
-
if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {
|
|
4349
|
-
exports$1.colors = [20, 21, 26, 27, 32, 33, 38, 39, 40, 41, 42, 43, 44, 45, 56, 57, 62, 63, 68, 69, 74, 75, 76, 77, 78, 79, 80, 81, 92, 93, 98, 99, 112, 113, 128, 129, 134, 135, 148, 149, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 178, 179, 184, 185, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 214, 215, 220, 221];
|
|
4350
|
-
}
|
|
4351
|
-
} catch (error) {
|
|
4352
|
-
// Swallow - we only care if `supports-color` is available; it doesn't have to be.
|
|
4353
|
-
}
|
|
4354
|
-
|
|
4355
|
-
/**
|
|
4356
|
-
* Build up the default `inspectOpts` object from the environment variables.
|
|
4357
|
-
*
|
|
4358
|
-
* $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js
|
|
4359
|
-
*/
|
|
4360
|
-
|
|
4361
|
-
exports$1.inspectOpts = Object.keys(process.env).filter(key => {
|
|
4362
|
-
return /^debug_/i.test(key);
|
|
4363
|
-
}).reduce((obj, key) => {
|
|
4364
|
-
// Camel-case
|
|
4365
|
-
const prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, (_, k) => {
|
|
4366
|
-
return k.toUpperCase();
|
|
4367
|
-
});
|
|
4368
|
-
|
|
4369
|
-
// Coerce string value into JS value
|
|
4370
|
-
let val = process.env[key];
|
|
4371
|
-
if (/^(yes|on|true|enabled)$/i.test(val)) {
|
|
4372
|
-
val = true;
|
|
4373
|
-
} else if (/^(no|off|false|disabled)$/i.test(val)) {
|
|
4374
|
-
val = false;
|
|
4375
|
-
} else if (val === 'null') {
|
|
4376
|
-
val = null;
|
|
4377
|
-
} else {
|
|
4378
|
-
val = Number(val);
|
|
4379
|
-
}
|
|
4380
|
-
obj[prop] = val;
|
|
4381
|
-
return obj;
|
|
4382
|
-
}, {});
|
|
4383
|
-
|
|
4384
|
-
/**
|
|
4385
|
-
* Is stdout a TTY? Colored output is enabled when `true`.
|
|
4386
|
-
*/
|
|
4387
|
-
|
|
4388
|
-
function useColors() {
|
|
4389
|
-
return 'colors' in exports$1.inspectOpts ? Boolean(exports$1.inspectOpts.colors) : tty.isatty(process.stderr.fd);
|
|
4390
|
-
}
|
|
4391
|
-
|
|
4392
|
-
/**
|
|
4393
|
-
* Adds ANSI color escape codes if enabled.
|
|
4394
|
-
*
|
|
4395
|
-
* @api public
|
|
4396
|
-
*/
|
|
4397
|
-
|
|
4398
|
-
function formatArgs(args) {
|
|
4399
|
-
const {
|
|
4400
|
-
namespace: name,
|
|
4401
|
-
useColors
|
|
4402
|
-
} = this;
|
|
4403
|
-
if (useColors) {
|
|
4404
|
-
const c = this.color;
|
|
4405
|
-
const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c);
|
|
4406
|
-
const prefix = ` ${colorCode};1m${name} \u001B[0m`;
|
|
4407
|
-
args[0] = prefix + args[0].split('\n').join('\n' + prefix);
|
|
4408
|
-
args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m');
|
|
4409
|
-
} else {
|
|
4410
|
-
args[0] = getDate() + name + ' ' + args[0];
|
|
4411
|
-
}
|
|
4412
|
-
}
|
|
4413
|
-
function getDate() {
|
|
4414
|
-
if (exports$1.inspectOpts.hideDate) {
|
|
4415
|
-
return '';
|
|
4416
|
-
}
|
|
4417
|
-
return new Date().toISOString() + ' ';
|
|
4418
|
-
}
|
|
4419
|
-
|
|
4420
|
-
/**
|
|
4421
|
-
* Invokes `util.formatWithOptions()` with the specified arguments and writes to stderr.
|
|
4422
|
-
*/
|
|
4423
|
-
|
|
4424
|
-
function log(...args) {
|
|
4425
|
-
return process.stderr.write(util.formatWithOptions(exports$1.inspectOpts, ...args) + '\n');
|
|
4426
|
-
}
|
|
4427
|
-
|
|
4428
|
-
/**
|
|
4429
|
-
* Save `namespaces`.
|
|
4430
|
-
*
|
|
4431
|
-
* @param {String} namespaces
|
|
4432
|
-
* @api private
|
|
4433
|
-
*/
|
|
4434
|
-
function save(namespaces) {
|
|
4435
|
-
if (namespaces) {
|
|
4436
|
-
process.env.DEBUG = namespaces;
|
|
4437
|
-
} else {
|
|
4438
|
-
// If you set a process.env field to null or undefined, it gets cast to the
|
|
4439
|
-
// string 'null' or 'undefined'. Just delete instead.
|
|
4440
|
-
delete process.env.DEBUG;
|
|
4441
|
-
}
|
|
4442
|
-
}
|
|
4443
|
-
|
|
4444
|
-
/**
|
|
4445
|
-
* Load `namespaces`.
|
|
4446
|
-
*
|
|
4447
|
-
* @return {String} returns the previously persisted debug modes
|
|
4448
|
-
* @api private
|
|
4449
|
-
*/
|
|
4450
|
-
|
|
4451
|
-
function load() {
|
|
4452
|
-
return process.env.DEBUG;
|
|
4453
|
-
}
|
|
4454
|
-
|
|
4455
|
-
/**
|
|
4456
|
-
* Init logic for `debug` instances.
|
|
4457
|
-
*
|
|
4458
|
-
* Create a new `inspectOpts` object in case `useColors` is set
|
|
4459
|
-
* differently for a particular `debug` instance.
|
|
4460
|
-
*/
|
|
4461
|
-
|
|
4462
|
-
function init(debug) {
|
|
4463
|
-
debug.inspectOpts = {};
|
|
4464
|
-
const keys = Object.keys(exports$1.inspectOpts);
|
|
4465
|
-
for (let i = 0; i < keys.length; i++) {
|
|
4466
|
-
debug.inspectOpts[keys[i]] = exports$1.inspectOpts[keys[i]];
|
|
4467
|
-
}
|
|
4468
|
-
}
|
|
4469
|
-
module.exports = requireCommon()(exports$1);
|
|
4470
|
-
const {
|
|
4471
|
-
formatters
|
|
4472
|
-
} = module.exports;
|
|
4473
|
-
|
|
4474
|
-
/**
|
|
4475
|
-
* Map %o to `util.inspect()`, all on a single line.
|
|
4476
|
-
*/
|
|
4477
|
-
|
|
4478
|
-
formatters.o = function (v) {
|
|
4479
|
-
this.inspectOpts.colors = this.useColors;
|
|
4480
|
-
return util.inspect(v, this.inspectOpts).split('\n').map(str => str.trim()).join(' ');
|
|
4481
|
-
};
|
|
4482
|
-
|
|
4483
|
-
/**
|
|
4484
|
-
* Map %O to `util.inspect()`, allowing multiple lines if needed.
|
|
4485
|
-
*/
|
|
4486
|
-
|
|
4487
|
-
formatters.O = function (v) {
|
|
4488
|
-
this.inspectOpts.colors = this.useColors;
|
|
4489
|
-
return util.inspect(v, this.inspectOpts);
|
|
4490
|
-
};
|
|
4491
|
-
} (node, node.exports));
|
|
4492
|
-
return node.exports;
|
|
4493
|
-
}
|
|
4494
|
-
|
|
4495
|
-
/**
|
|
4496
|
-
* Detect Electron renderer / nwjs process, which is node, but we should
|
|
4497
|
-
* treat as a browser.
|
|
4498
|
-
*/
|
|
4499
|
-
|
|
4500
|
-
var hasRequiredSrc;
|
|
4501
|
-
|
|
4502
|
-
function requireSrc () {
|
|
4503
|
-
if (hasRequiredSrc) return src.exports;
|
|
4504
|
-
hasRequiredSrc = 1;
|
|
4505
|
-
if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {
|
|
4506
|
-
src.exports = requireBrowser();
|
|
4507
|
-
} else {
|
|
4508
|
-
src.exports = requireNode();
|
|
4509
|
-
}
|
|
4510
|
-
return src.exports;
|
|
4511
|
-
}
|
|
4512
|
-
|
|
4513
|
-
var srcExports = requireSrc();
|
|
4514
|
-
const debugModule = /*@__PURE__*/getDefaultExportFromCjs(srcExports);
|
|
4515
|
-
|
|
4516
|
-
const debug = debugModule('main-process');
|
|
4517
|
-
|
|
4518
3600
|
const BeforeQuit = 'before-quit';
|
|
4519
3601
|
const SecondInstance = 'second-instance';
|
|
4520
3602
|
const WindowAllClosed = 'window-all-closed';
|
|
@@ -4570,7 +3652,6 @@ const setShutDown = () => {
|
|
|
4570
3652
|
// TODO move this function to shared process
|
|
4571
3653
|
const handleBeforeQuit = () => {
|
|
4572
3654
|
setShutDown();
|
|
4573
|
-
debug('[info] before quit');
|
|
4574
3655
|
};
|
|
4575
3656
|
|
|
4576
3657
|
const handleReady = async (parsedArgs, workingDirectory) => {
|
|
@@ -4820,7 +3901,6 @@ const parseCliArgs = argv => {
|
|
|
4820
3901
|
sandbox: false
|
|
4821
3902
|
}
|
|
4822
3903
|
};
|
|
4823
|
-
debug('[info] parsing argv');
|
|
4824
3904
|
const relevantArgv = argv.slice(1);
|
|
4825
3905
|
const parsedArgs = minimist(relevantArgv, CLI_OPTIONS);
|
|
4826
3906
|
// TODO tree-shake this out
|
|
@@ -4832,9 +3912,7 @@ const parseCliArgs = argv => {
|
|
|
4832
3912
|
|
|
4833
3913
|
const handleSecondInstance = async (event, commandLine, workingDirectory, additionalData // additionalData is the actual process.argv https://github.com/electron/electron/pull/30891
|
|
4834
3914
|
) => {
|
|
4835
|
-
debug('[info] second instance');
|
|
4836
3915
|
const parsedArgs = parseCliArgs(additionalData);
|
|
4837
|
-
debug('[info] second instance args', additionalData, parsedArgs);
|
|
4838
3916
|
const moduleId = canHandleFastCliArgs(parsedArgs);
|
|
4839
3917
|
const handled = await handleFastCliArgs(moduleId, parsedArgs); // TODO don't like the side effect here
|
|
4840
3918
|
if (handled) {
|
|
@@ -4858,6 +3936,9 @@ const openPath = async path => {
|
|
|
4858
3936
|
// TODO handle error
|
|
4859
3937
|
await shell.openPath(path);
|
|
4860
3938
|
};
|
|
3939
|
+
const openExternal$1 = async url => {
|
|
3940
|
+
await shell.openExternal(url);
|
|
3941
|
+
};
|
|
4861
3942
|
|
|
4862
3943
|
const ContextMenu = 'context-menu';
|
|
4863
3944
|
const WillNavigate = 'will-navigate';
|
|
@@ -4917,7 +3998,7 @@ const handleWebContentsWindowOpen = ({
|
|
|
4917
3998
|
url
|
|
4918
3999
|
}) => {
|
|
4919
4000
|
// @ts-ignore
|
|
4920
|
-
void
|
|
4001
|
+
void openExternal$1(url);
|
|
4921
4002
|
return {
|
|
4922
4003
|
action: Deny
|
|
4923
4004
|
};
|
|
@@ -4957,9 +4038,9 @@ const isProtocolHandleApiSupported = protocol => {
|
|
|
4957
4038
|
return false;
|
|
4958
4039
|
};
|
|
4959
4040
|
|
|
4960
|
-
const WebView = 'lvce-oss-webview';
|
|
4961
4041
|
|
|
4962
|
-
|
|
4042
|
+
|
|
4043
|
+
const privilegedSchemes = [{
|
|
4963
4044
|
privileges: {
|
|
4964
4045
|
codeCache: true,
|
|
4965
4046
|
secure: true,
|
|
@@ -4987,7 +4068,7 @@ const handle = (protocol, name, handleRequest) => {
|
|
|
4987
4068
|
throw new Error('protocol.handle api is not supported');
|
|
4988
4069
|
};
|
|
4989
4070
|
const enable = protocol => {
|
|
4990
|
-
protocol.registerSchemesAsPrivileged(
|
|
4071
|
+
protocol.registerSchemesAsPrivileged(privilegedSchemes);
|
|
4991
4072
|
};
|
|
4992
4073
|
|
|
4993
4074
|
const requestSingleInstanceLock = argv => {
|
|
@@ -5030,7 +4111,6 @@ const hydrate = async (isLinux, chromeUserDataPath, argv) => {
|
|
|
5030
4111
|
}
|
|
5031
4112
|
const hasLock = requestSingleInstanceLock(argv);
|
|
5032
4113
|
if (!hasLock) {
|
|
5033
|
-
debug('[info] quitting because no lock');
|
|
5034
4114
|
exit();
|
|
5035
4115
|
return;
|
|
5036
4116
|
}
|
|
@@ -5058,7 +4138,6 @@ const hydrate = async (isLinux, chromeUserDataPath, argv) => {
|
|
|
5058
4138
|
await whenReady();
|
|
5059
4139
|
mark(AppReady);
|
|
5060
4140
|
await handleReady(parsedCliArgs, cwd());
|
|
5061
|
-
debug('[info] app window created');
|
|
5062
4141
|
};
|
|
5063
4142
|
|
|
5064
4143
|
const {
|
|
@@ -5098,12 +4177,7 @@ const handlePermissionCheck$1 = (webContents, permission, origin, details) => {
|
|
|
5098
4177
|
return isAllowed;
|
|
5099
4178
|
};
|
|
5100
4179
|
|
|
5101
|
-
|
|
5102
|
-
*
|
|
5103
|
-
* @param {string} url
|
|
5104
|
-
* @param {any} request
|
|
5105
|
-
*/
|
|
5106
|
-
const getElectronFileResponse = async (url, request) => {
|
|
4180
|
+
const getElectronFileResponseIpc = async (url, request) => {
|
|
5107
4181
|
const {
|
|
5108
4182
|
body,
|
|
5109
4183
|
init
|
|
@@ -5112,6 +4186,12 @@ const getElectronFileResponse = async (url, request) => {
|
|
|
5112
4186
|
return response;
|
|
5113
4187
|
};
|
|
5114
4188
|
|
|
4189
|
+
const getElectronFileResponse = async (url, request) => {
|
|
4190
|
+
{
|
|
4191
|
+
return getElectronFileResponseIpc(url, request);
|
|
4192
|
+
}
|
|
4193
|
+
};
|
|
4194
|
+
|
|
5115
4195
|
/**
|
|
5116
4196
|
*
|
|
5117
4197
|
* @param {Headers} headers
|
|
@@ -6790,7 +5870,6 @@ const cancelNavigation = view => {
|
|
|
6790
5870
|
webContents
|
|
6791
5871
|
} = view;
|
|
6792
5872
|
setCanceled(webContents.id);
|
|
6793
|
-
debug(`[main process] canceled navigation to ${webContents.getURL()}`);
|
|
6794
5873
|
webContents.stop();
|
|
6795
5874
|
if (webContents.navigationHistory.canGoBack()) {
|
|
6796
5875
|
webContents.navigationHistory.goBack();
|
|
@@ -6800,7 +5879,6 @@ const show = id => {
|
|
|
6800
5879
|
// console.log('[main-process] show browser view', id)
|
|
6801
5880
|
const state = get$3(id);
|
|
6802
5881
|
if (!state) {
|
|
6803
|
-
debug('[main-process] failed to show browser view', id);
|
|
6804
5882
|
return;
|
|
6805
5883
|
}
|
|
6806
5884
|
const {
|
|
@@ -6823,7 +5901,6 @@ const addToWindow = (browserWindowId, browserViewId) => {
|
|
|
6823
5901
|
const hide = id => {
|
|
6824
5902
|
const state = get$3(id);
|
|
6825
5903
|
if (!state) {
|
|
6826
|
-
debug('[main-process] failed to hide browser view', id);
|
|
6827
5904
|
return;
|
|
6828
5905
|
}
|
|
6829
5906
|
const {
|
|
@@ -7084,6 +6161,7 @@ const shouldOpenExternal = url => {
|
|
|
7084
6161
|
};
|
|
7085
6162
|
|
|
7086
6163
|
const openExternal = async url => {
|
|
6164
|
+
string(url);
|
|
7087
6165
|
if (!shouldOpenExternal(url)) {
|
|
7088
6166
|
throw new VError(`only http or https urls are allowed`);
|
|
7089
6167
|
}
|