@lvce-editor/shared-process 0.35.4 → 0.35.6
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 +2 -2
- package/src/parts/{AddCustomRendererProcessPath/AddCustomRendererProcessPath.js → AddCustomPathsToIndexHtml/AddCustomPathsToIndexHtml.js} +12 -3
- package/src/parts/ExportStatic/ExportStatic.js +1 -0
- package/src/parts/ExtensionManifests/ExtensionManifestsFromLinkedExtensionsFolder.js +2 -17
- package/src/parts/GetElectronFileResponseContent/GetElectronFileResponseContent.js +2 -2
- package/src/parts/GetExtensions/GetExtensions.ipc.js +5 -0
- package/src/parts/GetExtensions/GetExtensions.js +4 -0
- package/src/parts/GetTestRequestResponse/GetTestRequestResponse.js +2 -2
- package/src/parts/MergeWithSymlinks/MergeWithSymlinks.js +16 -0
- package/src/parts/Module/Module.js +2 -0
- package/src/parts/ModuleId/ModuleId.js +1 -0
- package/src/parts/ModuleMap/ModuleMap.js +2 -0
- 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.35.
|
|
3
|
+
"version": "0.35.6",
|
|
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.35.
|
|
21
|
+
"@lvce-editor/extension-host-helper-process": "0.35.6",
|
|
22
22
|
"@lvce-editor/ipc": "^11.0.1",
|
|
23
23
|
"@lvce-editor/json-rpc": "^4.1.0",
|
|
24
24
|
"@lvce-editor/jsonc-parser": "^1.4.0",
|
|
@@ -1,15 +1,24 @@
|
|
|
1
1
|
import { pathToFileURL } from 'node:url';
|
|
2
2
|
import * as Platform from '../Platform/Platform.js';
|
|
3
3
|
import * as Preferences from '../Preferences/Preferences.js';
|
|
4
|
-
export const
|
|
4
|
+
export const addCustomPathsToIndexHtml = async (content) => {
|
|
5
5
|
if (Platform.isProduction) {
|
|
6
6
|
return content;
|
|
7
7
|
}
|
|
8
|
+
let newContent = content;
|
|
8
9
|
const preferences = await Preferences.getUserPreferences();
|
|
9
10
|
if (preferences['develop.rendererProcessPath']) {
|
|
10
|
-
|
|
11
|
+
newContent = newContent
|
|
11
12
|
.toString()
|
|
12
13
|
.replace('/packages/renderer-worker/node_modules/@lvce-editor/renderer-process/dist/rendererProcessMain.js', '/remote' + pathToFileURL(preferences['develop.rendererProcessPath']).toString().slice(7));
|
|
13
14
|
}
|
|
14
|
-
|
|
15
|
+
if (preferences['develop.extensionHostWorkerPath']) {
|
|
16
|
+
const actualUrl = '/remote' + pathToFileURL(preferences['develop.extensionHostWorkerPath']).toString().slice(7);
|
|
17
|
+
const config = JSON.stringify({
|
|
18
|
+
extensionHostWorkerUrl: actualUrl,
|
|
19
|
+
});
|
|
20
|
+
newContent = newContent.toString().replace('</title>', `</title>
|
|
21
|
+
<script type="application.json" id="Config">${config}</script>`);
|
|
22
|
+
}
|
|
23
|
+
return newContent;
|
|
15
24
|
};
|
|
@@ -97,6 +97,7 @@ const applyOverrides = async ({ root, commitHash, pathPrefix, serverStaticPath }
|
|
|
97
97
|
await replace(Path.join(root, 'dist', commitHash, 'packages', 'renderer-worker', 'dist', 'rendererWorkerMain.js'), `/${commitHash}`, `${pathPrefix}/${commitHash}`);
|
|
98
98
|
await replace(Path.join(root, 'dist', commitHash, 'packages', 'renderer-worker', 'dist', 'rendererWorkerMain.js'), `return \`\${assetDir}/extensions/builtin.theme-\${colorThemeId}/color-theme.json\``, `return \`\${assetDir}/themes/\${colorThemeId}.json\``);
|
|
99
99
|
await replace(Path.join(root, 'dist', commitHash, 'packages', 'extension-host-worker', 'dist', 'extensionHostWorkerMain.js'), `/${commitHash}`, `${pathPrefix}/${commitHash}`);
|
|
100
|
+
await replace(Path.join(root, 'dist', commitHash, 'packages', 'extension-host-worker', 'dist', 'extensionHostWorkerMain.js'), `const platform = Remote`, `const platform = Web`);
|
|
100
101
|
await replace(Path.join(root, 'dist', commitHash, 'packages', 'renderer-worker', 'dist', 'rendererWorkerMain.js'), `return \`\${assetDir}/extensions/builtin.\${iconThemeId}/icon-theme.json\``, `return \`\${assetDir}/icon-themes/\${iconThemeId}.json\``);
|
|
101
102
|
const extensionDirents = await FileSystem.readDir(Path.join(serverStaticPath, commitHash, 'extensions'));
|
|
102
103
|
const languageBasicsDirents = extensionDirents.filter(isLanguageBasics);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { readlink } from 'node:fs/promises';
|
|
2
2
|
import * as ExtensionManifest from '../ExtensionManifest/ExtensionManifest.js';
|
|
3
|
-
import * as ExtensionManifestStatus from '../ExtensionManifestStatus/ExtensionManifestStatus.js';
|
|
4
3
|
import * as FileSystem from '../FileSystem/FileSystem.js';
|
|
5
4
|
import * as IsEnoentError from '../IsEnoentError/IsEnoentError.js';
|
|
5
|
+
import * as MergeWithSymlinks from '../MergeWithSymlinks/MergeWithSymlinks.js';
|
|
6
6
|
import * as ToAbsolutePaths from '../ToAbsolutePaths/ToAbsolutePaths.js';
|
|
7
7
|
import { VError } from '../VError/VError.js';
|
|
8
8
|
const readSymlink = async (absolutePath) => {
|
|
@@ -17,21 +17,6 @@ const readSymlink = async (absolutePath) => {
|
|
|
17
17
|
const readSymlinks = (absolutePaths) => {
|
|
18
18
|
return Promise.all(absolutePaths.map(readSymlink));
|
|
19
19
|
};
|
|
20
|
-
const mergeWithSymLinks = (manifests, symlinks) => {
|
|
21
|
-
const { length } = manifests;
|
|
22
|
-
const merged = [];
|
|
23
|
-
for (let i = 0; i < length; i++) {
|
|
24
|
-
const manifest = manifests[i];
|
|
25
|
-
const symlink = symlinks[i];
|
|
26
|
-
if (manifest.status === ExtensionManifestStatus.Rejected) {
|
|
27
|
-
merged.push(manifest);
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
merged.push({ ...manifest, symlink });
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
return merged;
|
|
34
|
-
};
|
|
35
20
|
export const getExtensionManifests = async (path) => {
|
|
36
21
|
try {
|
|
37
22
|
if (!path) {
|
|
@@ -41,7 +26,7 @@ export const getExtensionManifests = async (path) => {
|
|
|
41
26
|
const absolutePaths = ToAbsolutePaths.toAbsolutePaths(path, dirents);
|
|
42
27
|
const manifests = await Promise.all(absolutePaths.map(ExtensionManifest.get));
|
|
43
28
|
const symlinks = await readSymlinks(absolutePaths);
|
|
44
|
-
const merged = mergeWithSymLinks(manifests, symlinks);
|
|
29
|
+
const merged = MergeWithSymlinks.mergeWithSymLinks(manifests, symlinks);
|
|
45
30
|
return merged;
|
|
46
31
|
}
|
|
47
32
|
catch (error) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { readFile } from 'node:fs/promises';
|
|
2
|
-
import * as
|
|
2
|
+
import * as AddCustomPathsToIndexHtml from '../AddCustomPathsToIndexHtml/AddCustomPathsToIndexHtml.js';
|
|
3
3
|
import * as Platform from '../Platform/Platform.js';
|
|
4
4
|
import * as ShouldTranspileTypescript from '../ShouldTranspileTypescript/ShouldTranspileTypescript.js';
|
|
5
5
|
import * as TranspileTypeScript from '../TranspileTypeScript/TranspileTypeScript.js';
|
|
@@ -18,7 +18,7 @@ export const getElectronFileResponseContent = async (request, absolutePath, url)
|
|
|
18
18
|
content = content.toString().replace(' <link rel="manifest" href="/manifest.json" crossorigin="use-credentials" />\n', '');
|
|
19
19
|
}
|
|
20
20
|
if (url === '/') {
|
|
21
|
-
content = await
|
|
21
|
+
content = await AddCustomPathsToIndexHtml.addCustomPathsToIndexHtml(content);
|
|
22
22
|
}
|
|
23
23
|
if (typeof content === 'string') {
|
|
24
24
|
content = Buffer.from(content);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { readFile } from 'node:fs/promises';
|
|
2
2
|
import { join } from 'node:path';
|
|
3
|
-
import * as
|
|
3
|
+
import * as AddCustomPathsToIndexHtml from '../AddCustomPathsToIndexHtml/AddCustomPathsToIndexHtml.js';
|
|
4
4
|
import * as CreateTestOverview from '../CreateTestOverview/CreateTestOverview.js';
|
|
5
5
|
import * as CrossOriginEmbedderPolicy from '../CrossOriginEmbedderPolicy/CrossOriginEmbedderPolicy.js';
|
|
6
6
|
import * as CrossOriginOpenerPolicy from '../CrossOriginOpenerPolicy/CrossOriginOpenerPolicy.js';
|
|
@@ -14,7 +14,7 @@ export const getTestRequestResponse = async (request, indexHtmlPath) => {
|
|
|
14
14
|
const pathName = GetPathName.getPathName(request);
|
|
15
15
|
if (pathName.endsWith('.html')) {
|
|
16
16
|
const body = await readFile(indexHtmlPath, 'utf8');
|
|
17
|
-
const content = await
|
|
17
|
+
const content = await AddCustomPathsToIndexHtml.addCustomPathsToIndexHtml(body);
|
|
18
18
|
return {
|
|
19
19
|
body: content,
|
|
20
20
|
init: {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as ExtensionManifestStatus from '../ExtensionManifestStatus/ExtensionManifestStatus.js';
|
|
2
|
+
export const mergeWithSymLinks = (manifests, symlinks) => {
|
|
3
|
+
const { length } = manifests;
|
|
4
|
+
const merged = [];
|
|
5
|
+
for (let i = 0; i < length; i++) {
|
|
6
|
+
const manifest = manifests[i];
|
|
7
|
+
const symlink = symlinks[i];
|
|
8
|
+
if (manifest.status === ExtensionManifestStatus.Rejected) {
|
|
9
|
+
merged.push(manifest);
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
merged.push({ ...manifest, symlink });
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return merged;
|
|
16
|
+
};
|
|
@@ -131,6 +131,8 @@ export const load = (moduleId) => {
|
|
|
131
131
|
return import('../FileWatcher/FileWatcher.ipc.js');
|
|
132
132
|
case ModuleId.WebViewServer:
|
|
133
133
|
return import('../WebViewServer/WebViewServer.ipc.js');
|
|
134
|
+
case ModuleId.GetExtensions:
|
|
135
|
+
return import('../GetExtensions/GetExtensions.ipc.js');
|
|
134
136
|
default:
|
|
135
137
|
throw new Error(`module ${moduleId} not found`);
|
|
136
138
|
}
|
|
@@ -285,6 +285,8 @@ export const getModuleId = (commandId) => {
|
|
|
285
285
|
case 'WebViewServer.setHandler':
|
|
286
286
|
case 'WebViewServer.registerProtocol':
|
|
287
287
|
return ModuleId.WebViewServer;
|
|
288
|
+
case 'GetExtensions.getExtensions':
|
|
289
|
+
return ModuleId.GetExtensions;
|
|
288
290
|
default:
|
|
289
291
|
throw new CommandNotFoundError(commandId);
|
|
290
292
|
}
|
|
@@ -41,9 +41,9 @@ export const getAppImageName = () => {
|
|
|
41
41
|
export const getSetupName = () => {
|
|
42
42
|
return 'Lvce-Setup';
|
|
43
43
|
};
|
|
44
|
-
export const version = '0.35.
|
|
45
|
-
export const commit = '
|
|
46
|
-
export const date = '2024-10-
|
|
44
|
+
export const version = '0.35.6';
|
|
45
|
+
export const commit = '08a59f1';
|
|
46
|
+
export const date = '2024-10-05T08:00:49.000Z';
|
|
47
47
|
export const getVersion = () => {
|
|
48
48
|
return version;
|
|
49
49
|
};
|