@lvce-editor/shared-process 0.29.8 → 0.30.1

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.8",
3
+ "version": "0.30.1",
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.8",
21
+ "@lvce-editor/extension-host-helper-process": "0.30.1",
22
22
  "@lvce-editor/ipc": "^9.2.0",
23
23
  "@lvce-editor/json-rpc": "^1.3.0",
24
- "@lvce-editor/jsonc-parser": "^1.3.0",
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
27
  "debug": "^4.3.5",
@@ -29,7 +29,7 @@
29
29
  "xdg-basedir": "^5.1.0"
30
30
  },
31
31
  "optionalDependencies": {
32
- "@lvce-editor/network-process": "^1.2.0",
32
+ "@lvce-editor/network-process": "^1.3.0",
33
33
  "@lvce-editor/preload": "^1.3.0",
34
34
  "@lvce-editor/search-process": "^1.2.0",
35
35
  "@lvce-editor/typescript-compile-process": "^1.2.0",
@@ -76,9 +76,12 @@ const clean = async (root) => {
76
76
  const copyStaticFiles = async (root, commitHash) => {
77
77
  await FileSystem.copy(Path.join(root, 'node_modules', '@lvce-editor', 'server', 'static'), Path.join(root, 'dist'));
78
78
  };
79
- const applyOverrides = async ({ root, commitHash, pathPrefix }) => {
80
- await replace(Path.join(root, 'dist', commitHash, 'packages', 'renderer-process', 'dist', 'rendererProcessMain.js'), 'platform = getPlatform();', 'platform = "web"');
79
+ const applyOverridesRendererProcess = async ({ root, commitHash, pathPrefix }) => {
80
+ await replace(Path.join(root, 'dist', commitHash, 'packages', 'renderer-process', 'dist', 'rendererProcessMain.js'), 'platform = Remote;', 'platform = Web');
81
81
  await replace(Path.join(root, 'dist', commitHash, 'packages', 'renderer-process', 'dist', 'rendererProcessMain.js'), `/${commitHash}`, `${pathPrefix}/${commitHash}`);
82
+ };
83
+ const applyOverrides = async ({ root, commitHash, pathPrefix }) => {
84
+ await applyOverridesRendererProcess({ root, commitHash, pathPrefix });
82
85
  await replace(Path.join(root, 'dist', commitHash, 'packages', 'renderer-worker', 'dist', 'rendererWorkerMain.js'), 'platform = Remote;', 'platform = Web$1;');
83
86
  await replace(Path.join(root, 'dist', commitHash, 'packages', 'renderer-worker', 'dist', 'rendererWorkerMain.js'), `/${commitHash}`, `${pathPrefix}/${commitHash}`);
84
87
  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\``);
@@ -2,6 +2,8 @@ import { readFile } from 'node:fs/promises';
2
2
  import * as Platform from '../Platform/Platform.js';
3
3
  import * as ShouldTranspileTypescript from '../ShouldTranspileTypescript/ShouldTranspileTypescript.js';
4
4
  import * as TranspileTypeScript from '../TranspileTypeScript/TranspileTypeScript.js';
5
+ import * as Preferences from '../Preferences/Preferences.js';
6
+ import { pathToFileURL } from 'node:url';
5
7
  export const getElectronFileResponseContent = async (request, absolutePath, url) => {
6
8
  if (ShouldTranspileTypescript.shouldTranspileTypescript(request, url)) {
7
9
  const content = await readFile(absolutePath);
@@ -13,5 +15,15 @@ export const getElectronFileResponseContent = async (request, absolutePath, url)
13
15
  // @ts-ignore
14
16
  content = content.toString().replace(' <link rel="manifest" href="/manifest.json" crossorigin="use-credentials" />\n', '');
15
17
  }
18
+ if (!Platform.isProduction && url === '/') {
19
+ const preferences = await Preferences.getUserPreferences();
20
+ if (preferences['develop.rendererProcessPath']) {
21
+ console.log('custom renderer process path');
22
+ // @ts-ignore
23
+ content = content
24
+ .toString()
25
+ .replace('/packages/renderer-worker/node_modules/@lvce-editor/renderer-process/dist/rendererProcessMain.js', '/remote' + pathToFileURL(preferences['develop.rendererProcessPath']).toString().slice(7));
26
+ }
27
+ }
16
28
  return content;
17
29
  };
@@ -10,8 +10,8 @@ export const handleWebSocket = async (handle, message) => {
10
10
  const { url } = message;
11
11
  const type = GetTypeFromUrl.getTypeFromUrl(url);
12
12
  handle.pause();
13
- const module = await HandleWebSocketModule.load(type);
14
- await module.handleWebSocket(message, handle, type);
13
+ const module = HandleWebSocketModule.load(type);
14
+ module.handleWebSocket(message, handle, type);
15
15
  }
16
16
  catch (error) {
17
17
  DestroyWebSocket.destroySocket(handle);
@@ -1,3 +1,8 @@
1
+ import * as HandleWebSocketForExtensionHostHelperProcess from '../HandleWebSocketForExtensionHostHelperProcess/HandleWebSocketForExtensionHostHelperProcess.js';
2
+ import * as HandleWebSocketForSearchProcess from '../HandleWebSocketForSearchProcess/HandleWebSocketForSearchProcess.js';
3
+ import * as HandleWebSocketForSharedProcess from '../HandleWebSocketForSharedProcess/HandleWebSocketForSharedProcess.js';
4
+ import * as HandleWebSocketForTerminalProcess from '../HandleWebSocketForTerminalProcess/HandleWebSocketForTerminalProcess.js';
5
+ import * as HandleWebSocketForUnknown from '../HandleWebSocketForUnknown/HandleWebSocketForUnknown.js';
1
6
  import * as ProtocolType from '../ProtocolType/ProtocolType.js';
2
7
  import { VError } from '../VError/VError.js';
3
8
  export const load = (protocol) => {
@@ -6,14 +11,14 @@ export const load = (protocol) => {
6
11
  }
7
12
  switch (protocol) {
8
13
  case ProtocolType.SharedProcess:
9
- return import('../HandleWebSocketForSharedProcess/HandleWebSocketForSharedProcess.js');
14
+ return HandleWebSocketForSharedProcess;
10
15
  case ProtocolType.ExtensionHostHelperProcess:
11
- return import('../HandleWebSocketForExtensionHostHelperProcess/HandleWebSocketForExtensionHostHelperProcess.js');
16
+ return HandleWebSocketForExtensionHostHelperProcess;
12
17
  case ProtocolType.TerminalProcess:
13
- return import('../HandleWebSocketForTerminalProcess/HandleWebSocketForTerminalProcess.js');
18
+ return HandleWebSocketForTerminalProcess;
14
19
  case ProtocolType.SearchProcess:
15
- return import('../HandleWebSocketForSearchProcess/HandleWebSocketForSearchProcess.js');
20
+ return HandleWebSocketForSearchProcess;
16
21
  default:
17
- return import('../HandleWebSocketForUnknown/HandleWebSocketForUnknown.js');
22
+ return HandleWebSocketForUnknown;
18
23
  }
19
24
  };
@@ -9,5 +9,9 @@ export const isIgnoredError = (error) => {
9
9
  // parent process is disposed, ignore
10
10
  return true;
11
11
  }
12
+ if (error && error.code === ErrorCodes.ECONNRESET) {
13
+ // TODO investigate why this error occurs sometimes when reloading the page
14
+ return true;
15
+ }
12
16
  return false;
13
17
  };
@@ -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.8';
45
- export const commit = '03ea80f';
46
- export const date = '2024-06-10T08:30:47.000Z';
44
+ export const version = '0.30.1';
45
+ export const commit = '0d78ce4';
46
+ export const date = '2024-06-16T07:24:35.000Z';
47
47
  export const getVersion = () => {
48
48
  return version;
49
49
  };