@lvce-editor/shared-process 0.29.5 → 0.29.7

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.5",
3
+ "version": "0.29.7",
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.5",
21
+ "@lvce-editor/extension-host-helper-process": "0.29.7",
22
22
  "@lvce-editor/ipc": "^9.1.0",
23
23
  "@lvce-editor/json-rpc": "^1.3.0",
24
24
  "@lvce-editor/jsonc-parser": "^1.2.0",
25
25
  "@lvce-editor/pretty-error": "^1.5.0",
26
- "@lvce-editor/verror": "^1.2.0",
27
- "debug": "^4.3.4",
26
+ "@lvce-editor/verror": "^1.3.0",
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
- "@lvce-editor/network-process": "^1.1.0",
33
- "@lvce-editor/preload": "^1.0.0",
34
- "@lvce-editor/search-process": "^1.1.0",
35
- "@lvce-editor/pty-host": "^1.1.0",
32
+ "@lvce-editor/network-process": "^1.2.0",
33
+ "@lvce-editor/preload": "^1.3.0",
34
+ "@lvce-editor/search-process": "^1.2.0",
35
+ "@lvce-editor/pty-host": "^1.2.0",
36
36
  "@lvce-editor/embeds-process": "^1.5.0",
37
37
  "open": "^10.1.0",
38
38
  "tail": "^2.2.6",
39
39
  "tmp-promise": "^3.0.3",
40
40
  "trash": "^8.1.1",
41
- "@lvce-editor/typescript-compile-process": "0.29.5"
41
+ "@lvce-editor/typescript-compile-process": "0.29.7"
42
42
  }
43
43
  }
@@ -0,0 +1,3 @@
1
+ import * as IsProduction from '../IsProduction/IsProduction.js';
2
+ import * as V8CacheOptions from '../V8CacheOptions/V8CacheOptions.js';
3
+ export const browserWindowV8CacheOptions = IsProduction.isProduction ? V8CacheOptions.BypassHeatCheck : V8CacheOptions.None;
@@ -0,0 +1,2 @@
1
+ import * as GetContentSecurityPolicy from '../GetContentSecurityPolicy/GetContentSecurityPolicy.js';
2
+ export const value = GetContentSecurityPolicy.getContentSecurityPolicy([`default-src 'none'`, `script-src 'self'`]);
@@ -1,10 +1,10 @@
1
1
  import * as Assert from '../Assert/Assert.js';
2
- import * as FileSystemWatch from '../FileSystemWatch/FileSystemWatch.js';
3
2
  import * as ReadJson from '../JsonFile/JsonFile.js';
4
3
  import * as JsonRpcVersion from '../JsonRpcVersion/JsonRpcVersion.js';
5
4
  import * as Path from '../Path/Path.js';
6
5
  import * as Process from '../Process/Process.js';
7
6
  import { VError } from '../VError/VError.js';
7
+ import * as FileSystemWatch from '../WatchFile/WatchFile.js';
8
8
  import * as ExtensionManagement from './ExtensionManagement.js';
9
9
  // TODO test this function
10
10
  // TODO very similar with getIconTheme
@@ -67,8 +67,8 @@ export const watch = async (socket, colorThemeId) => {
67
67
  if (verbose) {
68
68
  console.info(`[shared-process] starting to watch color theme ${colorThemeId} at ${colorThemePath}`);
69
69
  }
70
- const watcher = FileSystemWatch.watchFile(colorThemePath);
71
- for await (const event of watcher) {
70
+ const callback = () => {
72
71
  socket.send({ jsonrpc: JsonRpcVersion.Two, method: 'ColorTheme.reload', params: [] });
73
- }
72
+ };
73
+ await FileSystemWatch.watchFile(colorThemePath, callback);
74
74
  };
@@ -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: 'bypassHeatCheck', // TODO this is what vscode uses, but it doesn't work properly in electron https://github.com/electron/electron/issues/27075
24
+ v8CacheOptions: BrowserWindowV8CacheOptions.browserWindowV8CacheOptions,
24
25
  preload: PreloadUrl.preloadUrl,
25
- additionalArguments: ['--lvce-window-kind'],
26
+ additionalArguments: [],
26
27
  },
27
28
  backgroundColor: background,
28
29
  show: false,
@@ -1,4 +1,4 @@
1
- import { extname } from 'path';
1
+ import { basename, extname } from 'path';
2
2
  import * as GetHeadersDefault from '../GetHeadersDefault/GetHeadersDefault.js';
3
3
  import * as GetHeadersEditorWorker from '../GetHeadersEditorWorker/GetHeadersEditorWorker.js';
4
4
  import * as GetHeadersEmbedsWorker from '../GetHeadersEmbedsWorker/GetHeadersEmbedsWorker.js';
@@ -6,6 +6,7 @@ import * as GetHeadersExtensionHostWorker from '../GetHeadersExtensionHostWorker
6
6
  import * as GetHeadersMainFrame from '../GetHeadersMainFrame/GetHeadersMainFrame.js';
7
7
  import * as GetHeadersOtherWorker from '../GetHeadersOtherWorker/GetHeadersOtherWorker.js';
8
8
  import * as GetHeadersRendererWorker from '../GetHeadersRendererWorker/GetHeadersRendererWorker.js';
9
+ import * as GetHeadersSearchWorker from '../GetHeadersSearchWorker/GetHeadersSearchWorker.js';
9
10
  import * as GetHeadersSyntaxHighlightingWorker from '../GetHeadersSyntaxHighlightingWorker/GetHeadersSyntaxHighlightingWorker.js';
10
11
  import * as GetHeadersTerminalWorker from '../GetHeadersTerminalWorker/GetHeadersTerminalWorker.js';
11
12
  import * as GetHeadersTestWorker from '../GetHeadersTestWorker/GetHeadersTestWorker.js';
@@ -17,31 +18,38 @@ const getExtraHeaders = (pathName, fileExtension) => {
17
18
  return GetHeadersMainFrame.getHeadersMainFrame();
18
19
  case '.js':
19
20
  case '.ts':
20
- if (pathName.endsWith('editorWorkerMain.js') || pathName.endsWith('editorWorkerMain.ts')) {
21
- return GetHeadersEditorWorker.getHeadersEditorWorker();
21
+ const baseName = basename(pathName);
22
+ switch (baseName) {
23
+ case 'editorWorkerMain.js':
24
+ case 'editorWorkerMain.ts':
25
+ return GetHeadersEditorWorker.getHeadersEditorWorker();
26
+ case 'testWorkerMain.js':
27
+ case 'testWorkerMain.ts':
28
+ return GetHeadersTestWorker.getHeadersExtensionHostWorker(); // TODO
29
+ case 'rendererWorkerMain.js':
30
+ case 'rendererWorkerMain.ts':
31
+ return GetHeadersRendererWorker.getHeadersRendererWorker();
32
+ case 'extensionHostWorkerMain.js':
33
+ case 'extensionHostWorkerMain.ts':
34
+ return GetHeadersExtensionHostWorker.getHeadersExtensionHostWorker();
35
+ case 'terminalWorkerMain.js':
36
+ case 'terminalWorkerMain.ts':
37
+ return GetHeadersTerminalWorker.getHeadersTerminalWorker();
38
+ case 'syntaxHighlightingWorkerMain.js':
39
+ case 'syntaxHighlightingWorkerMain.ts':
40
+ return GetHeadersSyntaxHighlightingWorker.getHeadersSyntaxHighlightingWorker();
41
+ case 'embedsWorkerMain.js':
42
+ case 'embedsWorkerMain.ts':
43
+ return GetHeadersEmbedsWorker.getHeadersEmbedsWorker();
44
+ case 'searchWorkerMain.js':
45
+ case 'searchWorkerMain.ts':
46
+ return GetHeadersSearchWorker.getHeadersSearchWorker();
47
+ default:
48
+ if (pathName.endsWith('WorkerMain.js') || pathName.endsWith('WorkerMain.ts')) {
49
+ return GetHeadersOtherWorker.getHeadersOtherWorker(pathName);
50
+ }
51
+ return GetHeadersDefault.getHeadersDefault();
22
52
  }
23
- if (pathName.endsWith('testWorkerMain.js') || pathName.endsWith('testWorkerMain.ts')) {
24
- return GetHeadersTestWorker.getHeadersExtensionHostWorker();
25
- }
26
- if (pathName.endsWith('rendererWorkerMain.js') || pathName.endsWith('rendererWorkerMain.ts')) {
27
- return GetHeadersRendererWorker.getHeadersRendererWorker();
28
- }
29
- if (pathName.endsWith('extensionHostWorkerMain.js') || pathName.endsWith('extensionHostWorkerMain.ts')) {
30
- return GetHeadersExtensionHostWorker.getHeadersExtensionHostWorker();
31
- }
32
- if (pathName.endsWith('terminalWorkerMain.js') || pathName.endsWith('terminalWorkerMain.ts')) {
33
- return GetHeadersTerminalWorker.getHeadersTerminalWorker();
34
- }
35
- if (pathName.endsWith('syntaxHighlightingWorkerMain.js') || pathName.endsWith('syntaxHighlightingWorkerMain.ts')) {
36
- return GetHeadersSyntaxHighlightingWorker.getHeadersSyntaxHighlightingWorker();
37
- }
38
- if (pathName.endsWith('embedsWorkerMain.js') || pathName.endsWith('embedsWorkerMain.ts')) {
39
- return GetHeadersEmbedsWorker.getHeadersEmbedsWorker();
40
- }
41
- if (pathName.endsWith('WorkerMain.js') || pathName.endsWith('WorkerMain.ts')) {
42
- return GetHeadersOtherWorker.getHeadersOtherWorker(pathName);
43
- }
44
- return GetHeadersDefault.getHeadersDefault();
45
53
  default:
46
54
  return GetHeadersDefault.getHeadersDefault();
47
55
  }
@@ -0,0 +1,9 @@
1
+ import * as ContentSecurityPolicySearchWorker from '../ContentSecurityPolicySearchWorker/ContentSecurityPolicySearchWorker.js';
2
+ import * as CrossOriginEmbedderPolicy from '../CrossOriginEmbedderPolicy/CrossOriginEmbedderPolicy.js';
3
+ import * as HttpHeader from '../HttpHeader/HttpHeader.js';
4
+ export const getHeadersSearchWorker = () => {
5
+ return {
6
+ [HttpHeader.CrossOriginEmbedderPolicy]: CrossOriginEmbedderPolicy.value,
7
+ [HttpHeader.ContentSecurityPolicy]: ContentSecurityPolicySearchWorker.value,
8
+ };
9
+ };
@@ -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 && Platform.isLinux) {
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 && Platform.isWindows) {
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,2 @@
1
+ import * as Platform from '../Platform/Platform.js';
2
+ export const isLinux = Platform.isLinux;
@@ -0,0 +1,2 @@
1
+ import * as Platform from '../Platform/Platform.js';
2
+ export const isProduction = Platform.isProduction;
@@ -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.5';
45
- export const commit = 'e4111e1';
46
- export const date = '2024-05-19T12:24:59.000Z';
44
+ export const version = '0.29.7';
45
+ export const commit = '77ff834';
46
+ export const date = '2024-05-31T16:58:06.000Z';
47
47
  export const getVersion = () => {
48
48
  return version;
49
49
  };
@@ -0,0 +1,2 @@
1
+ export const BypassHeatCheck = 'bypassHeatCheck';
2
+ export const None = 'none';
@@ -0,0 +1,14 @@
1
+ import { VError } from '@lvce-editor/verror';
2
+ import * as fs from 'node:fs/promises';
3
+ export const watchFile = async (path, callback) => {
4
+ try {
5
+ const watcher = fs.watch(path);
6
+ for await (const event of watcher) {
7
+ callback(event);
8
+ }
9
+ return watcher;
10
+ }
11
+ catch (error) {
12
+ console.error(new VError(error, `Failed to watch file`));
13
+ }
14
+ };
@@ -1,5 +0,0 @@
1
- import * as fs from 'node:fs/promises';
2
- export const watchFile = (path) => {
3
- const watcher = fs.watch(path);
4
- return watcher;
5
- };