@lvce-editor/shared-process 0.29.6 → 0.29.8
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 +8 -8
- package/src/parts/BrowserWindowV8CacheOptions/BrowserWindowV8CacheOptions.js +3 -0
- package/src/parts/ExportStatic/ExportStatic.js +2 -2
- package/src/parts/FileWatcher/FileWatcher.ipc.js +5 -0
- package/src/parts/FileWatcher/FileWatcher.js +27 -0
- package/src/parts/GetBrowserWindowOptions/GetBrowserWindowOptions.js +3 -2
- package/src/parts/GetIcon/GetIcon.js +6 -4
- package/src/parts/HandleIpcFileWatcher/HandleIpcFileWatcher.js +24 -0
- package/src/parts/IsLinux/IsLinux.js +2 -0
- package/src/parts/IsProduction/IsProduction.js +2 -0
- package/src/parts/LaunchTypeScriptCompileProcess/LaunchTypeScriptCompileProcess.js +4 -0
- package/src/parts/Module/Module.js +2 -0
- package/src/parts/ModuleId/ModuleId.js +1 -0
- package/src/parts/ModuleMap/ModuleMap.js +3 -0
- package/src/parts/Platform/Platform.ipc.js +1 -0
- package/src/parts/Platform/Platform.js +3 -3
- package/src/parts/PlatformPaths/PlatformPaths.js +3 -0
- package/src/parts/RequiresSocket/RequiresSocket.js +1 -0
- package/src/parts/TypeScriptCompileProcessPath/TypeScriptCompileProcessPath.js +2 -1
- package/src/parts/V8CacheOptions/V8CacheOptions.js +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lvce-editor/shared-process",
|
|
3
|
-
"version": "0.29.
|
|
3
|
+
"version": "0.29.8",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -18,26 +18,26 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@lvce-editor/assert": "^1.2.0",
|
|
21
|
-
"@lvce-editor/extension-host-helper-process": "0.29.
|
|
22
|
-
"@lvce-editor/ipc": "^9.
|
|
21
|
+
"@lvce-editor/extension-host-helper-process": "0.29.8",
|
|
22
|
+
"@lvce-editor/ipc": "^9.2.0",
|
|
23
23
|
"@lvce-editor/json-rpc": "^1.3.0",
|
|
24
|
-
"@lvce-editor/jsonc-parser": "^1.
|
|
24
|
+
"@lvce-editor/jsonc-parser": "^1.3.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.5",
|
|
28
28
|
"is-object": "^1.0.2",
|
|
29
29
|
"xdg-basedir": "^5.1.0"
|
|
30
30
|
},
|
|
31
31
|
"optionalDependencies": {
|
|
32
32
|
"@lvce-editor/network-process": "^1.2.0",
|
|
33
|
-
"@lvce-editor/preload": "^1.
|
|
33
|
+
"@lvce-editor/preload": "^1.3.0",
|
|
34
34
|
"@lvce-editor/search-process": "^1.2.0",
|
|
35
|
+
"@lvce-editor/typescript-compile-process": "^1.2.0",
|
|
35
36
|
"@lvce-editor/pty-host": "^1.2.0",
|
|
36
37
|
"@lvce-editor/embeds-process": "^1.5.0",
|
|
37
38
|
"open": "^10.1.0",
|
|
38
39
|
"tail": "^2.2.6",
|
|
39
40
|
"tmp-promise": "^3.0.3",
|
|
40
|
-
"trash": "^8.1.1"
|
|
41
|
-
"@lvce-editor/typescript-compile-process": "0.29.6"
|
|
41
|
+
"trash": "^8.1.1"
|
|
42
42
|
}
|
|
43
43
|
}
|
|
@@ -138,11 +138,11 @@ const applyOverrides = async ({ root, commitHash, pathPrefix }) => {
|
|
|
138
138
|
}
|
|
139
139
|
};
|
|
140
140
|
const addExtensionSeo = async ({ root, name, description, commitHash }) => {
|
|
141
|
-
await replace(Path.join(root, 'dist', 'index.html'), '<title>
|
|
141
|
+
await replace(Path.join(root, 'dist', 'index.html'), '<title>Lvce Editor</title>', `<title>${name}</title>`);
|
|
142
142
|
await replace(Path.join(root, 'dist', commitHash, 'manifest.json'), `"name": "Code Editor Web - OSS"`, `"name": "${name}"`);
|
|
143
143
|
await replace(Path.join(root, 'dist', commitHash, 'manifest.json'), `"short_name": "Web - OSS"`, `"short_name": "${name}"`);
|
|
144
144
|
await replace(Path.join(root, 'dist', commitHash, 'manifest.json'), `"description": "Web Code Editor."`, `"description": "${description}"`);
|
|
145
|
-
await replace(Path.join(root, 'dist', 'index.html'), '<meta name="description" content="
|
|
145
|
+
await replace(Path.join(root, 'dist', 'index.html'), '<meta name="description" content="VS Code inspired text editor that mostly runs in a webworker." />', `<meta name="description" content="${description}" />`);
|
|
146
146
|
};
|
|
147
147
|
const getId = (object) => {
|
|
148
148
|
return object.id;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as fs from 'node:fs/promises';
|
|
2
|
+
import * as JsonRpc from '../JsonRpc/JsonRpc.js';
|
|
3
|
+
const handleEvents = async (watcher, id, ipc) => {
|
|
4
|
+
try {
|
|
5
|
+
for await (const event of watcher) {
|
|
6
|
+
JsonRpc.send(ipc, 'FileWatcher.handleEvent', id, event);
|
|
7
|
+
// ipc.send('FileWatcher.handleEvent', id, event)
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
catch (error) {
|
|
11
|
+
console.log('event error', error);
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
// TODO run file watcher in a separate process to not crash application when file watcher crashes
|
|
15
|
+
export const watch = async (ipc, id, { roots, exclude }) => {
|
|
16
|
+
try {
|
|
17
|
+
for (const root of roots) {
|
|
18
|
+
const watcher = fs.watch(root, {
|
|
19
|
+
recursive: true,
|
|
20
|
+
});
|
|
21
|
+
handleEvents(watcher, id, ipc);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
console.error(error);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as BrowserWindowV8CacheOptions from '../BrowserWindowV8CacheOptions/BrowserWindowV8CacheOptions.js';
|
|
1
2
|
import * as GetIcon from '../GetIcon/GetIcon.js';
|
|
2
3
|
import * as PreloadUrl from '../PreloadUrl/PreloadUrl.js';
|
|
3
4
|
/**
|
|
@@ -20,9 +21,9 @@ export const getBrowserWindowOptions = ({ x, y, width, height, titleBarStyle, ti
|
|
|
20
21
|
spellcheck: false,
|
|
21
22
|
sandbox: true,
|
|
22
23
|
contextIsolation: true,
|
|
23
|
-
v8CacheOptions:
|
|
24
|
+
v8CacheOptions: BrowserWindowV8CacheOptions.browserWindowV8CacheOptions,
|
|
24
25
|
preload: PreloadUrl.preloadUrl,
|
|
25
|
-
additionalArguments: [
|
|
26
|
+
additionalArguments: [],
|
|
26
27
|
},
|
|
27
28
|
backgroundColor: background,
|
|
28
29
|
show: false,
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
+
import * as IsLinux from '../IsLinux/IsLinux.js';
|
|
2
|
+
import * as IsWindows from '../IsWindows/IsWindows.js';
|
|
1
3
|
import * as Path from '../Path/Path.js';
|
|
2
4
|
import * as Platform from '../Platform/Platform.js';
|
|
3
5
|
import * as Root from '../Root/Root.js';
|
|
4
6
|
export const getIcon = () => {
|
|
5
|
-
if (!Platform.isProduction &&
|
|
6
|
-
return Path.join(Root.root, 'build', 'files', 'icon.png');
|
|
7
|
+
if (!Platform.isProduction && IsLinux.isLinux) {
|
|
8
|
+
return Path.join(Root.root, 'packages', 'build', 'files', 'icon.png');
|
|
7
9
|
}
|
|
8
|
-
if (!Platform.isProduction &&
|
|
9
|
-
return Path.join(Root.root, 'build', 'files', 'icon.png');
|
|
10
|
+
if (!Platform.isProduction && IsWindows.isWindows) {
|
|
11
|
+
return Path.join(Root.root, 'packages', 'build', 'files', 'icon.png');
|
|
10
12
|
}
|
|
11
13
|
if (Platform.isProduction && Platform.isArchLinux) {
|
|
12
14
|
return Path.join(Root.root, 'static', 'icons', 'icon.png');
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as PtyHost from '../PtyHost/PtyHost.js';
|
|
2
|
+
import * as IpcParentType from '../IpcParentType/IpcParentType.js';
|
|
3
|
+
export const targetWebSocket = () => {
|
|
4
|
+
return PtyHost.getOrCreate(IpcParentType.NodeForkedProcess);
|
|
5
|
+
};
|
|
6
|
+
export const upgradeWebSocket = (handle, message) => {
|
|
7
|
+
return {
|
|
8
|
+
type: 'send',
|
|
9
|
+
method: 'HandleWebSocket.handleWebSocket',
|
|
10
|
+
params: [message],
|
|
11
|
+
transfer: handle,
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export const targetMessagePort = () => {
|
|
15
|
+
return PtyHost.getOrCreate(IpcParentType.ElectronUtilityProcess);
|
|
16
|
+
};
|
|
17
|
+
export const upgradeMessagePort = (port) => {
|
|
18
|
+
return {
|
|
19
|
+
type: 'send',
|
|
20
|
+
method: 'HandleElectronMessagePort.handleElectronMessagePort',
|
|
21
|
+
params: [],
|
|
22
|
+
transfer: [port],
|
|
23
|
+
};
|
|
24
|
+
};
|
|
@@ -2,6 +2,8 @@ import * as HandleIpc from '../HandleIpc/HandleIpc.js';
|
|
|
2
2
|
import * as IpcParent from '../IpcParent/IpcParent.js';
|
|
3
3
|
import * as IpcParentType from '../IpcParentType/IpcParentType.js';
|
|
4
4
|
import * as IsElectron from '../IsElectron/IsElectron.js';
|
|
5
|
+
import * as GetTypeScriptPath from '../GetTypeScriptPath/GetTypeScriptPath.js';
|
|
6
|
+
import * as JsonRpc from '../JsonRpc/JsonRpc.js';
|
|
5
7
|
export const launchTypeScriptCompileProcess = async () => {
|
|
6
8
|
const method = IsElectron.isElectron ? IpcParentType.ElectronUtilityProcess : IpcParentType.NodeForkedProcess;
|
|
7
9
|
const TypeScriptCompileProcessPath = await import('../TypeScriptCompileProcessPath/TypeScriptCompileProcessPath.js');
|
|
@@ -13,5 +15,7 @@ export const launchTypeScriptCompileProcess = async () => {
|
|
|
13
15
|
name: 'TypeScript Compile Process',
|
|
14
16
|
});
|
|
15
17
|
HandleIpc.handleIpc(typescriptCompileProcess);
|
|
18
|
+
const typeScriptPath = GetTypeScriptPath.getTypeScriptUri();
|
|
19
|
+
await JsonRpc.invoke(typescriptCompileProcess, 'TypeScript.setTypeScriptPath', typeScriptPath);
|
|
16
20
|
return typescriptCompileProcess;
|
|
17
21
|
};
|
|
@@ -127,6 +127,8 @@ export const load = (moduleId) => {
|
|
|
127
127
|
return import('../HandleMessagePortForProcessExplorer/HandleMessagePortForProcessExplorer.ipc.js');
|
|
128
128
|
case ModuleId.HandleMessagePortForSearchProcess:
|
|
129
129
|
return import('../HandleMessagePortForSearchProcess/HandleMessagePortForSearchProcess.ipc.js');
|
|
130
|
+
case ModuleId.FileWatcher:
|
|
131
|
+
return import('../FileWatcher/FileWatcher.ipc.js');
|
|
130
132
|
default:
|
|
131
133
|
throw new Error(`module ${moduleId} not found`);
|
|
132
134
|
}
|
|
@@ -185,6 +185,7 @@ export const getModuleId = (commandId) => {
|
|
|
185
185
|
case 'Platform.getCachedExtensionsPath':
|
|
186
186
|
case 'Platform.getCacheDir':
|
|
187
187
|
case 'Platform.getCommit':
|
|
188
|
+
case 'Platform.getRoot':
|
|
188
189
|
case 'Platform.getConfigDir':
|
|
189
190
|
case 'Platform.getDataDir':
|
|
190
191
|
case 'Platform.getDate':
|
|
@@ -273,6 +274,8 @@ export const getModuleId = (commandId) => {
|
|
|
273
274
|
return ModuleId.HandleMessagePortForProcessExplorer;
|
|
274
275
|
case 'HandleMessagePortForSearchProcess.handleMessagePortForSearchProcess':
|
|
275
276
|
return ModuleId.HandleMessagePortForSearchProcess;
|
|
277
|
+
case 'FileWatcher.watch':
|
|
278
|
+
return ModuleId.FileWatcher;
|
|
276
279
|
default:
|
|
277
280
|
throw new CommandNotFoundError(commandId);
|
|
278
281
|
}
|
|
@@ -11,6 +11,7 @@ export const Commands = {
|
|
|
11
11
|
getConfigDir: PlatformPaths.getConfigDir,
|
|
12
12
|
getDataDir: PlatformPaths.getDataDir,
|
|
13
13
|
getDate: Platform.getDate,
|
|
14
|
+
getRoot: PlatformPaths.getRoot,
|
|
14
15
|
getDisabledExtensionsPath: PlatformPaths.getDisabledExtensionsPath,
|
|
15
16
|
getDownloadDir: PlatformPaths.getDownloadDir,
|
|
16
17
|
getExtensionsPath: PlatformPaths.getExtensionsPath,
|
|
@@ -41,9 +41,9 @@ export const getAppImageName = () => {
|
|
|
41
41
|
export const getSetupName = () => {
|
|
42
42
|
return 'Lvce-Setup';
|
|
43
43
|
};
|
|
44
|
-
export const version = '0.29.
|
|
45
|
-
export const commit = '
|
|
46
|
-
export const date = '2024-
|
|
44
|
+
export const version = '0.29.8';
|
|
45
|
+
export const commit = '03ea80f';
|
|
46
|
+
export const date = '2024-06-10T08:30:47.000Z';
|
|
47
47
|
export const getVersion = () => {
|
|
48
48
|
return version;
|
|
49
49
|
};
|
|
@@ -13,6 +13,7 @@ const METHODS_THAT_REQUIRE_SOCKET = new Set([
|
|
|
13
13
|
'HandleMessagePortForExtensionHostHelperProcess.handleMessagePortForExtensionHostHelperProcess',
|
|
14
14
|
'ElectronBrowserView.createBrowserView',
|
|
15
15
|
'ElectronWebContentsView.createWebContentsView',
|
|
16
|
+
'FileWatcher.watch',
|
|
16
17
|
]);
|
|
17
18
|
export const requiresSocket = (method) => {
|
|
18
19
|
return METHODS_THAT_REQUIRE_SOCKET.has(method);
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import * as ResolveBin from '../ResolveBin/ResolveBin.js';
|
|
2
|
+
export const typescriptCompileProcessPath = ResolveBin.resolveBin('@lvce-editor/typescript-compile-process');
|