@lvce-editor/shared-process 0.44.5 → 0.44.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/shared-process",
3
- "version": "0.44.5",
3
+ "version": "0.44.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.44.5",
21
+ "@lvce-editor/extension-host-helper-process": "0.44.6",
22
22
  "@lvce-editor/ipc": "13.7.0",
23
23
  "@lvce-editor/json-rpc": "5.4.0",
24
24
  "@lvce-editor/jsonc-parser": "1.5.0",
@@ -2,6 +2,6 @@ import { join } from 'path';
2
2
  import { fileURLToPath } from 'url';
3
3
  export const getBuiltinExtensionsPath = () => {
4
4
  const staticServerPath = fileURLToPath(import.meta.resolve('@lvce-editor/static-server'));
5
- const builtinExtensionsPath = join(staticServerPath, '..', '..', 'static', '10163fd', 'extensions');
5
+ const builtinExtensionsPath = join(staticServerPath, '..', '..', 'static', '75e0a3f', 'extensions');
6
6
  return builtinExtensionsPath;
7
7
  };
@@ -2,6 +2,7 @@ import * as ExtensionHostIconTheme from '../ExtensionManagement/ExtensionManagem
2
2
  import * as ExtensionManagement from './ExtensionManagement.js';
3
3
  import * as ExtensionHostColorTheme from './ExtensionManagementColorTheme.js';
4
4
  import * as ExtensionHostLanguages from './ExtensionManagementLanguages.js';
5
+ import * as WatchForHotReload from '../WatchForHotReload/WatchForHotReload.js';
5
6
  // prettier-ignore
6
7
  export const Commands = {
7
8
  'ExtensionHost.getColorThemeJson': ExtensionHostColorTheme.getColorThemeJson,
@@ -17,4 +18,5 @@ export const Commands = {
17
18
  'ExtensionManagement.getExtensions': ExtensionManagement.getExtensions,
18
19
  'ExtensionManagement.uninstall': ExtensionManagement.uninstall,
19
20
  'ExtensionManagement.getExtensionsEtag': ExtensionManagement.getExtensionsEtag,
21
+ 'ExtensionHost.watchForHotReload': WatchForHotReload.watchForHotReload,
20
22
  };
@@ -130,6 +130,7 @@ export const getModuleId = (commandId) => {
130
130
  case 'ExtensionManagement.install':
131
131
  case 'ExtensionManagement.uninstall':
132
132
  case 'ExtensionManagement.getExtensionsEtag':
133
+ case 'ExtensionHost.watchForHotReload':
133
134
  return ModuleId.ExtensionManagement;
134
135
  case 'FileSystem.chmod':
135
136
  case 'FileSystem.copy':
@@ -41,9 +41,9 @@ export const getAppImageName = () => {
41
41
  export const getSetupName = () => {
42
42
  return 'Lvce-Setup';
43
43
  };
44
- export const version = '0.44.5';
45
- export const commit = '10163fd';
46
- export const date = '2025-01-09T21:55:07.000Z';
44
+ export const version = '0.44.6';
45
+ export const commit = '75e0a3f';
46
+ export const date = '2025-01-09T23:14:15.000Z';
47
47
  export const getVersion = () => {
48
48
  return version;
49
49
  };
@@ -7,6 +7,7 @@ const METHODS_THAT_REQUIRE_SOCKET = new Set([
7
7
  'ExtensionHost.start',
8
8
  'ExtensionHost.send',
9
9
  'ExtensionHost.watchColorTheme',
10
+ 'ExtensionHost.watchForHotReload',
10
11
  'Terminal.create',
11
12
  'IncrementalTextSearch.start',
12
13
  'ElectronApplicationMenu.setItems',
@@ -0,0 +1,17 @@
1
+ import * as JsonRpcVersion from '../JsonRpcVersion/JsonRpcVersion.js';
2
+ import * as FileSystemWatch from '../WatchFile/WatchFile.js';
3
+ const hasWatcher = new WeakSet();
4
+ export const watchForHotReload = async (socket, configs) => {
5
+ if (hasWatcher.has(socket)) {
6
+ return;
7
+ }
8
+ hasWatcher.add(socket);
9
+ // TODO when socket closes, dispose file watcher?
10
+ // or keep file watcher and broadcast to all sockets?
11
+ await Promise.all(configs.map(async (config) => {
12
+ const callback = () => {
13
+ socket.send({ jsonrpc: JsonRpcVersion.Two, method: config.command, params: [] });
14
+ };
15
+ await FileSystemWatch.watchFile(config.path, callback);
16
+ }));
17
+ };