@lvce-editor/shared-process 0.31.1 → 0.31.3
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/AddCustomRendererProcessPath/AddCustomRendererProcessPath.js +15 -0
- package/src/parts/ContentSecurityPolicyEditorWorker/ContentSecurityPolicyEditorWorker.js +1 -1
- package/src/parts/GetElectronFileResponseContent/GetElectronFileResponseContent.js +3 -10
- package/src/parts/GetTestRequestResponse/GetTestRequestResponse.js +3 -1
- package/src/parts/Platform/Platform.js +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lvce-editor/shared-process",
|
|
3
|
-
"version": "0.31.
|
|
3
|
+
"version": "0.31.3",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -18,13 +18,13 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@lvce-editor/assert": "^1.2.0",
|
|
21
|
-
"@lvce-editor/extension-host-helper-process": "0.31.
|
|
21
|
+
"@lvce-editor/extension-host-helper-process": "0.31.3",
|
|
22
22
|
"@lvce-editor/ipc": "^9.3.0",
|
|
23
23
|
"@lvce-editor/json-rpc": "^1.4.0",
|
|
24
24
|
"@lvce-editor/jsonc-parser": "^1.4.0",
|
|
25
25
|
"@lvce-editor/pretty-error": "^1.5.0",
|
|
26
26
|
"@lvce-editor/verror": "^1.3.0",
|
|
27
|
-
"debug": "^4.3.
|
|
27
|
+
"debug": "^4.3.6",
|
|
28
28
|
"is-object": "^1.0.2",
|
|
29
29
|
"xdg-basedir": "^5.1.0"
|
|
30
30
|
},
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { pathToFileURL } from 'node:url';
|
|
2
|
+
import * as Platform from '../Platform/Platform.js';
|
|
3
|
+
import * as Preferences from '../Preferences/Preferences.js';
|
|
4
|
+
export const addCustomRendererProcessPath = async (content) => {
|
|
5
|
+
if (Platform.isProduction) {
|
|
6
|
+
return content;
|
|
7
|
+
}
|
|
8
|
+
const preferences = await Preferences.getUserPreferences();
|
|
9
|
+
if (preferences['develop.rendererProcessPath']) {
|
|
10
|
+
return content
|
|
11
|
+
.toString()
|
|
12
|
+
.replace('/packages/renderer-worker/node_modules/@lvce-editor/renderer-process/dist/rendererProcessMain.js', '/remote' + pathToFileURL(preferences['develop.rendererProcessPath']).toString().slice(7));
|
|
13
|
+
}
|
|
14
|
+
return content;
|
|
15
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import * as GetContentSecurityPolicy from '../GetContentSecurityPolicy/GetContentSecurityPolicy.js';
|
|
2
|
-
export const value = GetContentSecurityPolicy.getContentSecurityPolicy([`default-src 'none'`, `
|
|
2
|
+
export const value = GetContentSecurityPolicy.getContentSecurityPolicy([`default-src 'none'`, `font-src 'self'`]);
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { readFile } from 'node:fs/promises';
|
|
2
|
+
import * as AddCustomRendererProcessPath from '../AddCustomRendererProcessPath/AddCustomRendererProcessPath.js';
|
|
2
3
|
import * as Platform from '../Platform/Platform.js';
|
|
3
4
|
import * as ShouldTranspileTypescript from '../ShouldTranspileTypescript/ShouldTranspileTypescript.js';
|
|
4
5
|
import * as TranspileTypeScript from '../TranspileTypeScript/TranspileTypeScript.js';
|
|
5
|
-
import * as Preferences from '../Preferences/Preferences.js';
|
|
6
|
-
import { pathToFileURL } from 'node:url';
|
|
7
6
|
export const getElectronFileResponseContent = async (request, absolutePath, url) => {
|
|
8
7
|
if (ShouldTranspileTypescript.shouldTranspileTypescript(request, url)) {
|
|
9
8
|
const content = await readFile(absolutePath);
|
|
@@ -17,14 +16,8 @@ export const getElectronFileResponseContent = async (request, absolutePath, url)
|
|
|
17
16
|
// @ts-ignore
|
|
18
17
|
content = content.toString().replace(' <link rel="manifest" href="/manifest.json" crossorigin="use-credentials" />\n', '');
|
|
19
18
|
}
|
|
20
|
-
if (
|
|
21
|
-
|
|
22
|
-
if (preferences['develop.rendererProcessPath']) {
|
|
23
|
-
// @ts-ignore
|
|
24
|
-
content = content
|
|
25
|
-
.toString()
|
|
26
|
-
.replace('/packages/renderer-worker/node_modules/@lvce-editor/renderer-process/dist/rendererProcessMain.js', '/remote' + pathToFileURL(preferences['develop.rendererProcessPath']).toString().slice(7));
|
|
27
|
-
}
|
|
19
|
+
if (url === '/') {
|
|
20
|
+
content = await AddCustomRendererProcessPath.addCustomRendererProcessPath(content);
|
|
28
21
|
}
|
|
29
22
|
if (typeof content === 'string') {
|
|
30
23
|
content = Buffer.from(content);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { readFile } from 'node:fs/promises';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
|
+
import * as AddCustomRendererProcessPath from '../AddCustomRendererProcessPath/AddCustomRendererProcessPath.js';
|
|
3
4
|
import * as CreateTestOverview from '../CreateTestOverview/CreateTestOverview.js';
|
|
4
5
|
import * as CrossOriginEmbedderPolicy from '../CrossOriginEmbedderPolicy/CrossOriginEmbedderPolicy.js';
|
|
5
6
|
import * as CrossOriginOpenerPolicy from '../CrossOriginOpenerPolicy/CrossOriginOpenerPolicy.js';
|
|
@@ -12,8 +13,9 @@ export const getTestRequestResponse = async (request, indexHtmlPath) => {
|
|
|
12
13
|
const pathName = GetPathName.getPathName(request);
|
|
13
14
|
if (pathName.endsWith('.html')) {
|
|
14
15
|
const body = await readFile(indexHtmlPath, 'utf8');
|
|
16
|
+
const content = await AddCustomRendererProcessPath.addCustomRendererProcessPath(body);
|
|
15
17
|
return {
|
|
16
|
-
body,
|
|
18
|
+
body: content,
|
|
17
19
|
init: {
|
|
18
20
|
status: HttpStatusCode.Ok,
|
|
19
21
|
headers: {
|
|
@@ -41,9 +41,9 @@ export const getAppImageName = () => {
|
|
|
41
41
|
export const getSetupName = () => {
|
|
42
42
|
return 'Lvce-Setup';
|
|
43
43
|
};
|
|
44
|
-
export const version = '0.31.
|
|
45
|
-
export const commit = '
|
|
46
|
-
export const date = '2024-07-
|
|
44
|
+
export const version = '0.31.3';
|
|
45
|
+
export const commit = '33562c6';
|
|
46
|
+
export const date = '2024-07-28T19:18:08.000Z';
|
|
47
47
|
export const getVersion = () => {
|
|
48
48
|
return version;
|
|
49
49
|
};
|