@lvce-editor/shared-process 0.37.12 → 0.37.13
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/package.json +3 -3
- package/src/parts/AddCustomPathsToIndexHtml/AddCustomPathsToIndexHtml.js +5 -14
- package/src/parts/GetCustomPathsConfig/GetCustomPathsConfig.js +14 -0
- package/src/parts/GetElectronFileResponseAbsolutePath/GetElectronFileResponseAbsolutePath.js +2 -1
- package/src/parts/IndexHtmlPath/IndexHtmlPath.js +3 -0
- package/src/parts/Platform/Platform.js +3 -3
- package/src/parts/RegisterWebViewProtocol/RegisterWebViewProtocol.js +14 -0
- package/src/parts/WebViewProtocolState/WebViewProtocolState.js +9 -0
- package/src/parts/WebViewServer/WebViewServer.js +2 -17
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lvce-editor/shared-process",
|
|
3
|
-
"version": "0.37.
|
|
3
|
+
"version": "0.37.13",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@lvce-editor/assert": "^1.3.0",
|
|
21
|
-
"@lvce-editor/extension-host-helper-process": "0.37.
|
|
21
|
+
"@lvce-editor/extension-host-helper-process": "0.37.13",
|
|
22
22
|
"@lvce-editor/ipc": "^11.1.0",
|
|
23
23
|
"@lvce-editor/json-rpc": "^5.0.0",
|
|
24
24
|
"@lvce-editor/jsonc-parser": "^1.5.0",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"@lvce-editor/embeds-process": "^1.5.0",
|
|
33
33
|
"@lvce-editor/network-process": "^2.1.0",
|
|
34
34
|
"@lvce-editor/preload": "^1.4.0",
|
|
35
|
-
"@lvce-editor/preview-process": "^3.
|
|
35
|
+
"@lvce-editor/preview-process": "^3.11.0",
|
|
36
36
|
"@lvce-editor/pty-host": "^2.1.0",
|
|
37
37
|
"@lvce-editor/search-process": "^3.2.0",
|
|
38
38
|
"@lvce-editor/typescript-compile-process": "^1.5.0",
|
|
@@ -1,26 +1,17 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as GetCustomPathsConfig from '../GetCustomPathsConfig/GetCustomPathsConfig.js';
|
|
2
2
|
import * as Platform from '../Platform/Platform.js';
|
|
3
3
|
import * as Preferences from '../Preferences/Preferences.js';
|
|
4
|
-
const getRemoteUrl = (path) => {
|
|
5
|
-
return '/remote' + pathToFileURL(path).toString().slice(7);
|
|
6
|
-
};
|
|
7
4
|
export const addCustomPathsToIndexHtml = async (content) => {
|
|
8
5
|
if (Platform.isProduction) {
|
|
9
6
|
return content;
|
|
10
7
|
}
|
|
11
|
-
let newContent = content;
|
|
12
8
|
const preferences = await Preferences.getUserPreferences();
|
|
13
|
-
|
|
9
|
+
const config = GetCustomPathsConfig.getCustomPathsConfig(preferences);
|
|
10
|
+
let newContent = content;
|
|
11
|
+
if (config.rendererProcessPath) {
|
|
14
12
|
newContent = newContent
|
|
15
13
|
.toString()
|
|
16
|
-
.replace('/packages/renderer-worker/node_modules/@lvce-editor/renderer-process/dist/rendererProcessMain.js',
|
|
17
|
-
}
|
|
18
|
-
const config = Object.create(null);
|
|
19
|
-
if (preferences['develop.extensionHostWorkerPath']) {
|
|
20
|
-
config.extensionHostWorkerUrl = getRemoteUrl(preferences['develop.extensionHostWorkerPath']);
|
|
21
|
-
}
|
|
22
|
-
if (preferences['develop.editorWorkerPath']) {
|
|
23
|
-
config.editorWorkerUrl = getRemoteUrl(preferences['develop.editorWorkerPath']);
|
|
14
|
+
.replace('/packages/renderer-worker/node_modules/@lvce-editor/renderer-process/dist/rendererProcessMain.js', config.rendererProcessPath);
|
|
24
15
|
}
|
|
25
16
|
const stringifiedConfig = JSON.stringify(config, null, 2);
|
|
26
17
|
newContent = newContent.toString().replace('</title>', `</title>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as GetRemoteUrl from '../GetRemoteUrl/GetRemoteUrl.js';
|
|
2
|
+
export const getCustomPathsConfig = (preferences) => {
|
|
3
|
+
const config = Object.create(null);
|
|
4
|
+
if (preferences['develop.rendererProcessPath']) {
|
|
5
|
+
config.rendererProcessPath = GetRemoteUrl.getRemoteUrl(preferences['develop.rendererProcessPath']);
|
|
6
|
+
}
|
|
7
|
+
if (preferences['develop.extensionHostWorkerPath']) {
|
|
8
|
+
config.extensionHostWorkerUrl = GetRemoteUrl.getRemoteUrl(preferences['develop.extensionHostWorkerPath']);
|
|
9
|
+
}
|
|
10
|
+
if (preferences['develop.editorWorkerPath']) {
|
|
11
|
+
config.editorWorkerUrl = GetRemoteUrl.getRemoteUrl(preferences['develop.editorWorkerPath']);
|
|
12
|
+
}
|
|
13
|
+
return config;
|
|
14
|
+
};
|
package/src/parts/GetElectronFileResponseAbsolutePath/GetElectronFileResponseAbsolutePath.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { tmpdir } from 'node:os';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
3
|
import { fileURLToPath } from 'node:url';
|
|
4
|
+
import * as IndexHtmlPath from '../IndexHtmlPath/IndexHtmlPath.js';
|
|
4
5
|
import * as Path from '../Path/Path.js';
|
|
5
6
|
import * as Platform from '../Platform/Platform.js';
|
|
6
7
|
import * as Root from '../Root/Root.js';
|
|
@@ -8,7 +9,7 @@ import * as Root from '../Root/Root.js';
|
|
|
8
9
|
export const getElectronFileResponseAbsolutePath = (pathName) => {
|
|
9
10
|
// TODO remove if/else in prod (use replacement)
|
|
10
11
|
if (pathName === `/` || pathName.startsWith(`/?`)) {
|
|
11
|
-
return
|
|
12
|
+
return IndexHtmlPath.indexHtmlPath;
|
|
12
13
|
}
|
|
13
14
|
if (pathName.startsWith(`/packages`)) {
|
|
14
15
|
return Path.join(Root.root, pathName);
|
|
@@ -41,9 +41,9 @@ export const getAppImageName = () => {
|
|
|
41
41
|
export const getSetupName = () => {
|
|
42
42
|
return 'Lvce-Setup';
|
|
43
43
|
};
|
|
44
|
-
export const version = '0.37.
|
|
45
|
-
export const commit = '
|
|
46
|
-
export const date = '2024-11-
|
|
44
|
+
export const version = '0.37.13';
|
|
45
|
+
export const commit = '11ff8c4';
|
|
46
|
+
export const date = '2024-11-08T22:28:54.000Z';
|
|
47
47
|
export const getVersion = () => {
|
|
48
48
|
return version;
|
|
49
49
|
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as GetPortTuple from '../GetPortTuple/GetPortTuple.js';
|
|
2
|
+
import * as ParentIpc from '../ParentIpc/ParentIpc.js';
|
|
3
|
+
import * as PreviewProcess from '../PreviewProcess/PreviewProcess.js';
|
|
4
|
+
import * as WebViewProtocolState from '../WebViewProtocolState/WebViewProtocolState.js';
|
|
5
|
+
const doRegisterWebViewProtocol = async () => {
|
|
6
|
+
const { port1, port2 } = await GetPortTuple.getPortTuple();
|
|
7
|
+
await ParentIpc.invokeAndTransfer('ElectronSession.registerWebviewProtocol', port1);
|
|
8
|
+
// TODO launch preview process at the start of this
|
|
9
|
+
await PreviewProcess.invokeAndTransfer('HandleElectronMessagePort.handleElectronMessagePort', port2);
|
|
10
|
+
};
|
|
11
|
+
// TODO send port directly to from preview process to renderer worker?
|
|
12
|
+
export const registerWebViewProtocol = async () => {
|
|
13
|
+
return WebViewProtocolState.getOrCreate(doRegisterWebViewProtocol);
|
|
14
|
+
};
|
|
@@ -1,21 +1,6 @@
|
|
|
1
1
|
import * as PreviewProcess from '../PreviewProcess/PreviewProcess.js';
|
|
2
|
-
import * as
|
|
3
|
-
|
|
4
|
-
// TODO send port directly to from preview process to renderer worker?
|
|
5
|
-
export const registerProtocol = async () => {
|
|
6
|
-
// TODO only do this once
|
|
7
|
-
// TODO send messageport to proview process
|
|
8
|
-
// TODO send other messageport to parent process
|
|
9
|
-
console.time('get-ports');
|
|
10
|
-
const { port1, port2 } = await GetPortTuple.getPortTuple();
|
|
11
|
-
console.timeEnd('get-ports');
|
|
12
|
-
console.time('register-protocol');
|
|
13
|
-
await ParentIpc.invokeAndTransfer('ElectronSession.registerWebviewProtocol', port1);
|
|
14
|
-
console.timeEnd('register-protocol');
|
|
15
|
-
console.time('handle-port');
|
|
16
|
-
await PreviewProcess.invokeAndTransfer('HandleElectronMessagePort.handleElectronMessagePort', port2);
|
|
17
|
-
console.timeEnd('handle-port');
|
|
18
|
-
};
|
|
2
|
+
import * as RegisterWebViewProtocol from '../RegisterWebViewProtocol/RegisterWebViewProtocol.js';
|
|
3
|
+
export const registerProtocol = RegisterWebViewProtocol.registerWebViewProtocol;
|
|
19
4
|
export const create = async (previewId) => {
|
|
20
5
|
await PreviewProcess.invoke('WebViewServer.create', previewId);
|
|
21
6
|
};
|