@lvce-editor/main-process 2.2.0 → 2.4.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 +43 -16
- package/package.json +2 -2
package/dist/mainProcessMain.js
CHANGED
|
@@ -2710,7 +2710,7 @@ const callbacks = Object.create(null);
|
|
|
2710
2710
|
const set$2 = (id, fn) => {
|
|
2711
2711
|
callbacks[id] = fn;
|
|
2712
2712
|
};
|
|
2713
|
-
const get$
|
|
2713
|
+
const get$4 = id => {
|
|
2714
2714
|
return callbacks[id];
|
|
2715
2715
|
};
|
|
2716
2716
|
const remove$2 = id => {
|
|
@@ -2883,7 +2883,7 @@ const warn = (...args) => {
|
|
|
2883
2883
|
console.warn(...args);
|
|
2884
2884
|
};
|
|
2885
2885
|
const resolve = (id, response) => {
|
|
2886
|
-
const fn = get$
|
|
2886
|
+
const fn = get$4(id);
|
|
2887
2887
|
if (!fn) {
|
|
2888
2888
|
console.log(response);
|
|
2889
2889
|
warn(`callback ${id} may already be disposed`);
|
|
@@ -4803,7 +4803,7 @@ const hasWebContents = id => {
|
|
|
4803
4803
|
* @param {number} id
|
|
4804
4804
|
* @returns {{browserWindow: Electron.BrowserWindow, view: Electron.WebContentsView}}
|
|
4805
4805
|
*/
|
|
4806
|
-
const get$
|
|
4806
|
+
const get$3 = id => {
|
|
4807
4807
|
return state$5.views[id];
|
|
4808
4808
|
};
|
|
4809
4809
|
const remove$1 = id => {
|
|
@@ -5271,7 +5271,7 @@ const state$3 = {
|
|
|
5271
5271
|
const has = () => {
|
|
5272
5272
|
return Boolean(state$3.session);
|
|
5273
5273
|
};
|
|
5274
|
-
const get$
|
|
5274
|
+
const get$2 = () => {
|
|
5275
5275
|
if (!state$3.session) {
|
|
5276
5276
|
throw new Error('session is not defined');
|
|
5277
5277
|
}
|
|
@@ -5374,11 +5374,11 @@ const create$1 = ipc => {
|
|
|
5374
5374
|
return handleRequest;
|
|
5375
5375
|
};
|
|
5376
5376
|
|
|
5377
|
-
const get = () => {
|
|
5377
|
+
const get$1 = () => {
|
|
5378
5378
|
if (!has()) {
|
|
5379
5379
|
set$1(createElectronSession());
|
|
5380
5380
|
}
|
|
5381
|
-
return get$
|
|
5381
|
+
return get$2();
|
|
5382
5382
|
};
|
|
5383
5383
|
const registerWebviewProtocol = async port => {
|
|
5384
5384
|
object(port);
|
|
@@ -5390,7 +5390,7 @@ const registerWebviewProtocol = async port => {
|
|
|
5390
5390
|
console.log('do register protocol');
|
|
5391
5391
|
handleIpc(ipc);
|
|
5392
5392
|
port.start();
|
|
5393
|
-
const session = get();
|
|
5393
|
+
const session = get$1();
|
|
5394
5394
|
const handleRequest = create$1(ipc);
|
|
5395
5395
|
// @ts-ignore
|
|
5396
5396
|
handle(session.protocol, WebView, handleRequest);
|
|
@@ -5422,7 +5422,7 @@ const loadUrl = async (browserWindow, url) => {
|
|
|
5422
5422
|
|
|
5423
5423
|
// TODO avoid mixing BrowserWindow, childprocess and various lifecycle methods in one file -> separate concerns
|
|
5424
5424
|
const createAppWindow = async (windowOptions, parsedArgs, workingDirectory, titleBarItems, url) => {
|
|
5425
|
-
const session = get();
|
|
5425
|
+
const session = get$1();
|
|
5426
5426
|
mark(WillCreateCodeWindow);
|
|
5427
5427
|
const window = new BrowserWindow({
|
|
5428
5428
|
...windowOptions,
|
|
@@ -5632,6 +5632,22 @@ const createPidMap = () => {
|
|
|
5632
5632
|
return pidWindowMap;
|
|
5633
5633
|
};
|
|
5634
5634
|
|
|
5635
|
+
const rpcs = Object.create(null);
|
|
5636
|
+
const set$3 = (id, rpc) => {
|
|
5637
|
+
rpcs[id] = rpc;
|
|
5638
|
+
};
|
|
5639
|
+
const get = id => {
|
|
5640
|
+
return rpcs[id];
|
|
5641
|
+
};
|
|
5642
|
+
|
|
5643
|
+
const createUtilityProcessRpc = async options => {
|
|
5644
|
+
const rpc = await ElectronUtilityProcessRpcParent.create({
|
|
5645
|
+
commandMap: commandMapRef,
|
|
5646
|
+
...options
|
|
5647
|
+
});
|
|
5648
|
+
set$3(options.rpcId, rpc);
|
|
5649
|
+
};
|
|
5650
|
+
|
|
5635
5651
|
const serializeDeskopCapturerSource = source => {
|
|
5636
5652
|
return {
|
|
5637
5653
|
display_id: source.display_id,
|
|
@@ -6678,7 +6694,7 @@ const attachEventListeners = webContentsId => {
|
|
|
6678
6694
|
};
|
|
6679
6695
|
const disposeWebContentsView = browserViewId => {
|
|
6680
6696
|
console.log('[main process] dispose browser view', browserViewId);
|
|
6681
|
-
const instance = get$
|
|
6697
|
+
const instance = get$3(browserViewId);
|
|
6682
6698
|
if (!instance) {
|
|
6683
6699
|
return;
|
|
6684
6700
|
}
|
|
@@ -6696,7 +6712,7 @@ const webContentsViewErrorPath = join(root, 'packages', 'main-process', 'pages',
|
|
|
6696
6712
|
|
|
6697
6713
|
const wrapBrowserViewCommand = fn => {
|
|
6698
6714
|
const wrappedCommand = (id, ...args) => {
|
|
6699
|
-
const state = get$
|
|
6715
|
+
const state = get$3(id);
|
|
6700
6716
|
if (!state) {
|
|
6701
6717
|
console.log(`[main process] no browser view with id ${id}`);
|
|
6702
6718
|
return;
|
|
@@ -6831,7 +6847,7 @@ const cancelNavigation = view => {
|
|
|
6831
6847
|
};
|
|
6832
6848
|
const show = id => {
|
|
6833
6849
|
// console.log('[main-process] show browser view', id)
|
|
6834
|
-
const state = get$
|
|
6850
|
+
const state = get$3(id);
|
|
6835
6851
|
if (!state) {
|
|
6836
6852
|
debug('[main-process] failed to show browser view', id);
|
|
6837
6853
|
return;
|
|
@@ -6843,7 +6859,7 @@ const show = id => {
|
|
|
6843
6859
|
browserWindow.contentView.addChildView(view);
|
|
6844
6860
|
};
|
|
6845
6861
|
const addToWindow = (browserWindowId, browserViewId) => {
|
|
6846
|
-
const state = get$
|
|
6862
|
+
const state = get$3(browserViewId);
|
|
6847
6863
|
const {
|
|
6848
6864
|
view
|
|
6849
6865
|
} = state;
|
|
@@ -6854,7 +6870,7 @@ const addToWindow = (browserWindowId, browserViewId) => {
|
|
|
6854
6870
|
browserWindow.contentView.addChildView(view);
|
|
6855
6871
|
};
|
|
6856
6872
|
const hide = id => {
|
|
6857
|
-
const state = get$
|
|
6873
|
+
const state = get$3(id);
|
|
6858
6874
|
if (!state) {
|
|
6859
6875
|
debug('[main-process] failed to hide browser view', id);
|
|
6860
6876
|
return;
|
|
@@ -6968,7 +6984,7 @@ const open2 = async (options, url) => {
|
|
|
6968
6984
|
...options,
|
|
6969
6985
|
webPreferences: {
|
|
6970
6986
|
...options.webPreferences,
|
|
6971
|
-
session: get()
|
|
6987
|
+
session: get$1()
|
|
6972
6988
|
}
|
|
6973
6989
|
};
|
|
6974
6990
|
const processExplorerWindow = new BrowserWindow(allOptions);
|
|
@@ -7124,6 +7140,15 @@ const sendTo = async (port, name, ipcId) => {
|
|
|
7124
7140
|
await invokeAndTransfer$1(utilityProcessIpc, 'HandleElectronMessagePort.handleElectronMessagePort', port, ipcId);
|
|
7125
7141
|
unhandleIpc(utilityProcessIpc);
|
|
7126
7142
|
};
|
|
7143
|
+
|
|
7144
|
+
// TODO use rpc id, and then use rpc.invokeAndtransfer
|
|
7145
|
+
const sendTo2 = async (port, rpcId) => {
|
|
7146
|
+
object(port);
|
|
7147
|
+
const rpc = get(rpcId);
|
|
7148
|
+
await rpc.invokeAndTransfer('HandleElectronMessagePort.handleElectronMessagePort', port, rpcId);
|
|
7149
|
+
};
|
|
7150
|
+
|
|
7151
|
+
// todo dispose the rpc by rpc id
|
|
7127
7152
|
const dispose$1 = name => {
|
|
7128
7153
|
string(name);
|
|
7129
7154
|
const formattedName = formatUtilityProcessName(name);
|
|
@@ -7143,9 +7168,10 @@ const commandMap = {
|
|
|
7143
7168
|
'AppWindow.createAppWindow': createAppWindow,
|
|
7144
7169
|
'Beep.beep': beep$1,
|
|
7145
7170
|
'Crash.crashMainProcess': crashMainProcess$1,
|
|
7146
|
-
'DesktopCapturer.getSources': getSources,
|
|
7147
7171
|
'CreateMessagePort.createMessagePort': createMessagePort,
|
|
7148
7172
|
'CreatePidMap.createPidMap': createPidMap,
|
|
7173
|
+
'CreateUtilityProcessRpc.createUtilityProcessRpc': createUtilityProcessRpc,
|
|
7174
|
+
'DesktopCapturer.getSources': getSources,
|
|
7149
7175
|
'ElectronApplicationMenu.setItems': setItems,
|
|
7150
7176
|
'ElectronBeep.beep': beep,
|
|
7151
7177
|
'ElectronContentTracing.startRecording': startRecording,
|
|
@@ -7186,7 +7212,7 @@ const commandMap = {
|
|
|
7186
7212
|
'ElectronWebContentsViewFunctions.reload': reload,
|
|
7187
7213
|
'ElectronWebContentsViewFunctions.resizeBrowserView': resizeBrowserView,
|
|
7188
7214
|
'ElectronWebContentsViewFunctions.setBackgroundColor': setBackgroundColor,
|
|
7189
|
-
'ElectronWebContentsViewFunctions.setFallthroughKeyBindings':
|
|
7215
|
+
'ElectronWebContentsViewFunctions.setFallthroughKeyBindings': setFallThroughKeyBindings,
|
|
7190
7216
|
'ElectronWebContentsViewFunctions.setIframeSrc': setIframeSrc,
|
|
7191
7217
|
'ElectronWebContentsViewFunctions.setIframeSrcFallback': setIframeSrcFallback,
|
|
7192
7218
|
'ElectronWebContentsViewFunctions.show': show,
|
|
@@ -7209,6 +7235,7 @@ const commandMap = {
|
|
|
7209
7235
|
'TemporaryMessagePort.createPortTuple': createPortTuple,
|
|
7210
7236
|
'TemporaryMessagePort.dispose': dispose$1,
|
|
7211
7237
|
'TemporaryMessagePort.sendTo': sendTo,
|
|
7238
|
+
'TemporaryMessagePort.sendTo2': sendTo2,
|
|
7212
7239
|
'Trash.trash': trash
|
|
7213
7240
|
};
|
|
7214
7241
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lvce-editor/main-process",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"lvce-editor",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"type": "module",
|
|
16
16
|
"main": "dist/mainProcessMain.js",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"electron": "36.
|
|
18
|
+
"electron": "36.2.0"
|
|
19
19
|
},
|
|
20
20
|
"engines": {
|
|
21
21
|
"node": ">=22"
|