@lvce-editor/main-process 1.9.0 → 1.10.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 +65 -88
- package/package.json +1 -1
package/dist/mainProcessMain.js
CHANGED
|
@@ -742,18 +742,6 @@ const {
|
|
|
742
742
|
argv: argv$1
|
|
743
743
|
} = process;
|
|
744
744
|
|
|
745
|
-
const Version = 'version';
|
|
746
|
-
const Help = 'help';
|
|
747
|
-
const Wait = 'wait';
|
|
748
|
-
const BuiltinSelfTest = 'built-in-self-test';
|
|
749
|
-
const Web = 'web';
|
|
750
|
-
const SandBox = 'sandbox';
|
|
751
|
-
const Install = 'install';
|
|
752
|
-
const List = 'list';
|
|
753
|
-
const Link = 'link';
|
|
754
|
-
const Unlink = 'unlink';
|
|
755
|
-
const Status = 'status';
|
|
756
|
-
|
|
757
745
|
const Success = 0;
|
|
758
746
|
const Error$3 = 1;
|
|
759
747
|
|
|
@@ -3773,7 +3761,7 @@ class CommandNotFoundError extends Error {
|
|
|
3773
3761
|
|
|
3774
3762
|
const App = 1;
|
|
3775
3763
|
const AppWindow = 2;
|
|
3776
|
-
const Beep
|
|
3764
|
+
const Beep = 3;
|
|
3777
3765
|
const Developer = 4;
|
|
3778
3766
|
const Dialog = 5;
|
|
3779
3767
|
const ElectronWindowProcessExplorer = 6;
|
|
@@ -3792,7 +3780,7 @@ const Process = 19;
|
|
|
3792
3780
|
const ElectronNet = 20;
|
|
3793
3781
|
const ElectronBrowserViewSuggestions = 21;
|
|
3794
3782
|
const CreatePidMap = 22;
|
|
3795
|
-
const OpenExternal$
|
|
3783
|
+
const OpenExternal$1 = 23;
|
|
3796
3784
|
const Platform = 25;
|
|
3797
3785
|
const GetWindowId = 26;
|
|
3798
3786
|
const DesktopCapturer = 27;
|
|
@@ -3812,7 +3800,7 @@ const ElectronSession = 40;
|
|
|
3812
3800
|
const getPrefix = commandId => {
|
|
3813
3801
|
return commandId.slice(0, commandId.indexOf('.'));
|
|
3814
3802
|
};
|
|
3815
|
-
const getModuleId
|
|
3803
|
+
const getModuleId = commandId => {
|
|
3816
3804
|
const prefix = getPrefix(commandId);
|
|
3817
3805
|
switch (prefix) {
|
|
3818
3806
|
case 'Crash':
|
|
@@ -3821,7 +3809,7 @@ const getModuleId$1 = commandId => {
|
|
|
3821
3809
|
case 'App':
|
|
3822
3810
|
return App;
|
|
3823
3811
|
case 'Beep':
|
|
3824
|
-
return Beep
|
|
3812
|
+
return Beep;
|
|
3825
3813
|
case 'ElectronWindow':
|
|
3826
3814
|
return Window;
|
|
3827
3815
|
case 'ElectronDeveloper':
|
|
@@ -3833,7 +3821,7 @@ const getModuleId$1 = commandId => {
|
|
|
3833
3821
|
case 'ElectronDialog':
|
|
3834
3822
|
return Dialog;
|
|
3835
3823
|
case 'ElectronBeep':
|
|
3836
|
-
return Beep
|
|
3824
|
+
return Beep;
|
|
3837
3825
|
case 'ElectronShell':
|
|
3838
3826
|
return ElectronShell;
|
|
3839
3827
|
case 'ElectronPowerSaveBlocker':
|
|
@@ -3863,7 +3851,7 @@ const getModuleId$1 = commandId => {
|
|
|
3863
3851
|
case 'CreatePidMap':
|
|
3864
3852
|
return CreatePidMap;
|
|
3865
3853
|
case 'OpenExternal':
|
|
3866
|
-
return OpenExternal$
|
|
3854
|
+
return OpenExternal$1;
|
|
3867
3855
|
case 'Platform':
|
|
3868
3856
|
return Platform;
|
|
3869
3857
|
case 'GetWindowId':
|
|
@@ -3923,7 +3911,7 @@ const getOrLoadModule = moduleId => {
|
|
|
3923
3911
|
}
|
|
3924
3912
|
return state$7.pendingModules[moduleId];
|
|
3925
3913
|
};
|
|
3926
|
-
const loadCommand = command => getOrLoadModule(getModuleId
|
|
3914
|
+
const loadCommand = command => getOrLoadModule(getModuleId(command));
|
|
3927
3915
|
const register = (commandId, listener) => {
|
|
3928
3916
|
state$7.commands[commandId] = listener;
|
|
3929
3917
|
};
|
|
@@ -5305,6 +5293,9 @@ const CliForwardToSharedProcess = {
|
|
|
5305
5293
|
handleCliArgs
|
|
5306
5294
|
};
|
|
5307
5295
|
|
|
5296
|
+
const SharedProcess = 4;
|
|
5297
|
+
const None = 0;
|
|
5298
|
+
|
|
5308
5299
|
const on = (event, listener) => {
|
|
5309
5300
|
app.on(event, listener);
|
|
5310
5301
|
};
|
|
@@ -5315,34 +5306,43 @@ const appendCommandLineSwitch = (commandLineSwitch, value) => {
|
|
|
5315
5306
|
app.commandLine.appendSwitch(commandLineSwitch, value);
|
|
5316
5307
|
};
|
|
5317
5308
|
|
|
5318
|
-
|
|
5319
|
-
|
|
5320
|
-
|
|
5321
|
-
const
|
|
5322
|
-
|
|
5323
|
-
|
|
5309
|
+
const Version = 'version';
|
|
5310
|
+
const Help = 'help';
|
|
5311
|
+
const Wait = 'wait';
|
|
5312
|
+
const BuiltinSelfTest = 'built-in-self-test';
|
|
5313
|
+
const Web = 'web';
|
|
5314
|
+
const SandBox = 'sandbox';
|
|
5315
|
+
const Install = 'install';
|
|
5316
|
+
const List = 'list';
|
|
5317
|
+
const Link = 'link';
|
|
5318
|
+
const Unlink = 'unlink';
|
|
5319
|
+
const Status = 'status';
|
|
5320
|
+
|
|
5321
|
+
const getCliModuleId = parsedArgs => {
|
|
5322
|
+
const arg0 = parsedArgs._[0];
|
|
5323
|
+
if (arg0 === Install || arg0 === List || arg0 === Link || arg0 === Unlink || parsedArgs[Status] || parsedArgs[Version] || parsedArgs[Help] || parsedArgs[Web] || parsedArgs[BuiltinSelfTest]) {
|
|
5324
|
+
return SharedProcess;
|
|
5325
|
+
}
|
|
5326
|
+
return None;
|
|
5324
5327
|
};
|
|
5328
|
+
|
|
5325
5329
|
const getModule$1 = moduleId => {
|
|
5326
5330
|
switch (moduleId) {
|
|
5327
|
-
case
|
|
5331
|
+
case SharedProcess:
|
|
5328
5332
|
return CliForwardToSharedProcess;
|
|
5329
5333
|
default:
|
|
5330
5334
|
throw new Error('module not found');
|
|
5331
5335
|
}
|
|
5332
5336
|
};
|
|
5333
|
-
const getModuleId = parsedArgs => {
|
|
5334
|
-
const arg0 = parsedArgs._[0];
|
|
5335
|
-
if (arg0 === Install || arg0 === List || arg0 === Link || arg0 === Unlink || parsedArgs[Status] || parsedArgs[Version] || parsedArgs[Help] || parsedArgs[Web] || parsedArgs[BuiltinSelfTest]) {
|
|
5336
|
-
return ModuleId.SharedProcess;
|
|
5337
|
-
}
|
|
5338
|
-
return ModuleId.None;
|
|
5339
|
-
};
|
|
5340
5337
|
const handleArgs = (moduleId, parsedArgs) => {
|
|
5341
5338
|
const module = getModule$1(moduleId);
|
|
5342
5339
|
return module.handleCliArgs(parsedArgs);
|
|
5343
5340
|
};
|
|
5344
|
-
const
|
|
5345
|
-
const moduleId =
|
|
5341
|
+
const canHandleFastCliArgs = parsedArgs => {
|
|
5342
|
+
const moduleId = getCliModuleId(parsedArgs);
|
|
5343
|
+
return moduleId;
|
|
5344
|
+
};
|
|
5345
|
+
const handleFastCliArgs = async (moduleId, parsedArgs) => {
|
|
5346
5346
|
if (moduleId) {
|
|
5347
5347
|
await whenReady();
|
|
5348
5348
|
return handleArgs(moduleId, parsedArgs);
|
|
@@ -6655,51 +6655,18 @@ const handleSecondInstance = async (event, commandLine, workingDirectory, additi
|
|
|
6655
6655
|
debug('[info] second instance');
|
|
6656
6656
|
const parsedArgs = parseCliArgs(additionalData);
|
|
6657
6657
|
debug('[info] second instance args', additionalData, parsedArgs);
|
|
6658
|
-
const
|
|
6658
|
+
const moduleId = canHandleFastCliArgs(parsedArgs);
|
|
6659
|
+
const handled = await handleFastCliArgs(moduleId, parsedArgs); // TODO don't like the side effect here
|
|
6659
6660
|
if (handled) {
|
|
6660
6661
|
return;
|
|
6661
6662
|
}
|
|
6662
6663
|
await handleReady(parsedArgs, workingDirectory);
|
|
6663
6664
|
};
|
|
6664
6665
|
|
|
6665
|
-
const shouldOpenExternal = url => {
|
|
6666
|
-
if (url.startsWith('http:') || url.startsWith('https:')) {
|
|
6667
|
-
return true;
|
|
6668
|
-
}
|
|
6669
|
-
return false;
|
|
6670
|
-
};
|
|
6671
|
-
|
|
6672
|
-
const openExternal$1 = async url => {
|
|
6673
|
-
if (!shouldOpenExternal(url)) {
|
|
6674
|
-
throw new VError(`only http or https urls are allowed`);
|
|
6675
|
-
}
|
|
6676
|
-
await shell.openExternal(url);
|
|
6677
|
-
};
|
|
6678
|
-
|
|
6679
|
-
const OpenExternal$1 = {
|
|
6680
|
-
__proto__: null,
|
|
6681
|
-
openExternal: openExternal$1
|
|
6682
|
-
};
|
|
6683
|
-
|
|
6684
6666
|
const showItemInFolder = fullPath => {
|
|
6685
6667
|
shell.showItemInFolder(fullPath);
|
|
6686
6668
|
};
|
|
6687
6669
|
|
|
6688
|
-
/**
|
|
6689
|
-
* @deprecated use OpenExternal.openExternal function instead
|
|
6690
|
-
*/
|
|
6691
|
-
const {
|
|
6692
|
-
openExternal
|
|
6693
|
-
} = OpenExternal$1;
|
|
6694
|
-
|
|
6695
|
-
/**
|
|
6696
|
-
* @deprecated use Beep.beep instead
|
|
6697
|
-
*/
|
|
6698
|
-
const beep$1 = async () => {
|
|
6699
|
-
const Beep$1 = await Promise.resolve().then(function () { return Beep; });
|
|
6700
|
-
Beep$1.beep();
|
|
6701
|
-
};
|
|
6702
|
-
|
|
6703
6670
|
const ContextMenu = 'context-menu';
|
|
6704
6671
|
const WillNavigate = 'will-navigate';
|
|
6705
6672
|
const DidNavigate = 'did-navigate';
|
|
@@ -6757,7 +6724,7 @@ const shouldAllowNavigation = webContentsId => {
|
|
|
6757
6724
|
const handleWebContentsWindowOpen = ({
|
|
6758
6725
|
url
|
|
6759
6726
|
}) => {
|
|
6760
|
-
void
|
|
6727
|
+
void undefined(url);
|
|
6761
6728
|
return {
|
|
6762
6729
|
action: Deny
|
|
6763
6730
|
};
|
|
@@ -6869,8 +6836,9 @@ const hydrate = async () => {
|
|
|
6869
6836
|
// see https://github.com/microsoft/playwright/issues/12345
|
|
6870
6837
|
|
|
6871
6838
|
const parsedCliArgs = parseCliArgs(argv$1);
|
|
6872
|
-
const
|
|
6873
|
-
if (
|
|
6839
|
+
const moduleId = canHandleFastCliArgs(parsedCliArgs);
|
|
6840
|
+
if (moduleId) {
|
|
6841
|
+
await handleFastCliArgs(moduleId, parsedCliArgs);
|
|
6874
6842
|
return;
|
|
6875
6843
|
}
|
|
6876
6844
|
if (isLinux && chromeUserDataPath) {
|
|
@@ -6927,7 +6895,7 @@ const load = async moduleId => {
|
|
|
6927
6895
|
return Promise.resolve().then(function () { return App_ipc; });
|
|
6928
6896
|
case AppWindow:
|
|
6929
6897
|
return Promise.resolve().then(function () { return AppWindow_ipc; });
|
|
6930
|
-
case Beep
|
|
6898
|
+
case Beep:
|
|
6931
6899
|
return Promise.resolve().then(function () { return Beep_ipc; });
|
|
6932
6900
|
case Crash:
|
|
6933
6901
|
return Promise.resolve().then(function () { return Crash_ipc; });
|
|
@@ -6965,7 +6933,7 @@ const load = async moduleId => {
|
|
|
6965
6933
|
return Promise.resolve().then(function () { return ElectronWindowProcessExplorer_ipc; });
|
|
6966
6934
|
case IpcParent:
|
|
6967
6935
|
return Promise.resolve().then(function () { return IpcParent_ipc; });
|
|
6968
|
-
case OpenExternal$
|
|
6936
|
+
case OpenExternal$1:
|
|
6969
6937
|
return Promise.resolve().then(function () { return OpenExternal_ipc; });
|
|
6970
6938
|
case Process:
|
|
6971
6939
|
return Promise.resolve().then(function () { return Process_ipc; });
|
|
@@ -7109,15 +7077,6 @@ const IpcParentWithElectronUtilityProcess = {
|
|
|
7109
7077
|
wrap
|
|
7110
7078
|
};
|
|
7111
7079
|
|
|
7112
|
-
const beep = () => {
|
|
7113
|
-
shell.beep();
|
|
7114
|
-
};
|
|
7115
|
-
|
|
7116
|
-
const Beep = {
|
|
7117
|
-
__proto__: null,
|
|
7118
|
-
beep
|
|
7119
|
-
};
|
|
7120
|
-
|
|
7121
7080
|
const name$w = 'App';
|
|
7122
7081
|
const Commands$w = {};
|
|
7123
7082
|
|
|
@@ -7348,6 +7307,10 @@ const AppWindow_ipc = {
|
|
|
7348
7307
|
name: name$v
|
|
7349
7308
|
};
|
|
7350
7309
|
|
|
7310
|
+
const beep = () => {
|
|
7311
|
+
shell.beep();
|
|
7312
|
+
};
|
|
7313
|
+
|
|
7351
7314
|
const name$u = 'Beep';
|
|
7352
7315
|
const Commands$u = {
|
|
7353
7316
|
beep: beep
|
|
@@ -7944,9 +7907,23 @@ const ElectronSafeStorage_ipc = {
|
|
|
7944
7907
|
name: name$g
|
|
7945
7908
|
};
|
|
7946
7909
|
|
|
7910
|
+
const shouldOpenExternal = url => {
|
|
7911
|
+
if (url.startsWith('http:') || url.startsWith('https:')) {
|
|
7912
|
+
return true;
|
|
7913
|
+
}
|
|
7914
|
+
return false;
|
|
7915
|
+
};
|
|
7916
|
+
|
|
7917
|
+
const openExternal = async url => {
|
|
7918
|
+
if (!shouldOpenExternal(url)) {
|
|
7919
|
+
throw new VError(`only http or https urls are allowed`);
|
|
7920
|
+
}
|
|
7921
|
+
await shell.openExternal(url);
|
|
7922
|
+
};
|
|
7923
|
+
|
|
7947
7924
|
const name$f = 'ElectronShell';
|
|
7948
7925
|
const Commands$f = {
|
|
7949
|
-
beep: beep
|
|
7926
|
+
beep: beep,
|
|
7950
7927
|
openExternal: openExternal,
|
|
7951
7928
|
openPath: showItemInFolder,
|
|
7952
7929
|
showItemInFolder: showItemInFolder
|
|
@@ -8037,7 +8014,7 @@ const IpcParent_ipc = {
|
|
|
8037
8014
|
|
|
8038
8015
|
const name$b = 'OpenExternal';
|
|
8039
8016
|
const Commands$b = {
|
|
8040
|
-
openExternal: openExternal
|
|
8017
|
+
openExternal: openExternal
|
|
8041
8018
|
};
|
|
8042
8019
|
|
|
8043
8020
|
const OpenExternal_ipc = {
|
|
@@ -8177,8 +8154,8 @@ const getStats$1 = webContentsId => {
|
|
|
8177
8154
|
if (!contents) {
|
|
8178
8155
|
return undefined;
|
|
8179
8156
|
}
|
|
8180
|
-
const canGoBack = contents.canGoBack();
|
|
8181
|
-
const canGoForward = contents.canGoForward();
|
|
8157
|
+
const canGoBack = contents.navigationHistory.canGoBack();
|
|
8158
|
+
const canGoForward = contents.navigationHistory.canGoForward();
|
|
8182
8159
|
const url = contents.getURL();
|
|
8183
8160
|
const title = contents.getTitle();
|
|
8184
8161
|
return {
|