@lvce-editor/shared-process 0.29.7 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/shared-process",
3
- "version": "0.29.7",
3
+ "version": "0.29.8",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -18,10 +18,10 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "@lvce-editor/assert": "^1.2.0",
21
- "@lvce-editor/extension-host-helper-process": "0.29.7",
22
- "@lvce-editor/ipc": "^9.1.0",
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.2.0",
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
27
  "debug": "^4.3.5",
@@ -32,12 +32,12 @@
32
32
  "@lvce-editor/network-process": "^1.2.0",
33
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.7"
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>Code Editor</title>', `<title>${name}</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="Online Code Editor" />', `<meta name="description" content="${description}" />`);
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,5 @@
1
+ import * as FileWatcher from '../FileWatcher/FileWatcher.js';
2
+ export const name = 'FileWatcher';
3
+ export const Commands = {
4
+ watch: FileWatcher.watch,
5
+ };
@@ -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
+ };
@@ -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
  }
@@ -66,3 +66,4 @@ export const ContentSecurityPolicy = 70;
66
66
  export const HandleMessagePortForEmbedsProcess = 72;
67
67
  export const HandleMessagePortForProcessExplorer = 73;
68
68
  export const HandleMessagePortForSearchProcess = 74;
69
+ export const FileWatcher = 75;
@@ -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.7';
45
- export const commit = '77ff834';
46
- export const date = '2024-05-31T16:58:06.000Z';
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
  };
@@ -104,3 +104,6 @@ export const getDownloadDir = () => {
104
104
  export const getRepository = () => {
105
105
  return `lvce-editor/lvce-editor`;
106
106
  };
107
+ export const getRoot = () => {
108
+ return Root.root;
109
+ };
@@ -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
- export { typescriptCompileProcessPath } from '@lvce-editor/typescript-compile-process';
1
+ import * as ResolveBin from '../ResolveBin/ResolveBin.js';
2
+ export const typescriptCompileProcessPath = ResolveBin.resolveBin('@lvce-editor/typescript-compile-process');