@lvce-editor/shared-process 0.28.1 → 0.28.3

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.28.1",
3
+ "version": "0.28.3",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -18,12 +18,12 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "@lvce-editor/assert": "^1.2.0",
21
- "@lvce-editor/extension-host-helper-process": "0.28.1",
22
- "@lvce-editor/ipc": "^8.2.0",
21
+ "@lvce-editor/extension-host-helper-process": "0.28.3",
22
+ "@lvce-editor/ipc": "^8.2.1",
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/pty-host": "0.28.1",
26
+ "@lvce-editor/pty-host": "0.28.3",
27
27
  "@lvce-editor/verror": "^1.2.0",
28
28
  "debug": "^4.3.4",
29
29
  "exit-hook": "^4.0.0",
@@ -35,7 +35,8 @@
35
35
  "tail": "^2.2.6",
36
36
  "tmp-promise": "^3.0.3",
37
37
  "trash": "^8.1.1",
38
- "@lvce-editor/network-process": "0.28.1",
39
- "@lvce-editor/search-process": "0.28.1"
38
+ "@lvce-editor/network-process": "0.28.3",
39
+ "@lvce-editor/search-process": "0.28.3",
40
+ "@lvce-editor/typescript-compile-process": "0.28.3"
40
41
  }
41
42
  }
@@ -3,11 +3,12 @@ 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
5
  export const getElectronFileResponseContent = async (request, absolutePath, url) => {
6
- let content = await readFile(absolutePath);
7
6
  if (ShouldTranspileTypescript.shouldTranspileTypescript(request, url)) {
7
+ const content = await readFile(absolutePath);
8
8
  const newContent = await TranspileTypeScript.transpileTypeScript(content.toString());
9
- content = newContent.outputText;
9
+ return newContent.outputText;
10
10
  }
11
+ let content = await readFile(absolutePath);
11
12
  if (!Platform.isProduction && url === `${Platform.scheme}://-/`) {
12
13
  // @ts-ignore
13
14
  content = content.toString().replace(' <link rel="manifest" href="/manifest.json" crossorigin="use-credentials" />\n', '');
@@ -1,6 +1,7 @@
1
1
  import * as Assert from '../Assert/Assert.js';
2
2
  import * as ExtensionHostHelperProcessIpc from '../ExtensionHostHelperProcessIpc/ExtensionHostHelperProcessIpc.js';
3
3
  import * as HandleIpc from '../HandleIpc/HandleIpc.js';
4
+ import * as IpcId from '../IpcId/IpcId.js';
4
5
  import * as IpcParentType from '../IpcParentType/IpcParentType.js';
5
6
  import * as JsonRpc from '../JsonRpc/JsonRpc.js';
6
7
  // TODO connect this ipc to the renderer worker ipc
@@ -14,7 +15,7 @@ export const handleMessagePortForExtensionHostHelperProcess = async (rendererWor
14
15
  method: IpcParentType.ElectronUtilityProcess,
15
16
  });
16
17
  HandleIpc.handleIpc(ipc);
17
- await JsonRpc.invokeAndTransfer(ipc, [port], 'HandleElectronMessagePort.handleElectronMessagePort');
18
+ await JsonRpc.invokeAndTransfer(ipc, [port], 'HandleElectronMessagePort.handleElectronMessagePort', IpcId.ExtensionHostWorker);
18
19
  // const cleanup = () => {
19
20
  // ipc.dispose()
20
21
  // rendererWorkerIpc.off('close', cleanup)
@@ -8,3 +8,4 @@ export const SharedProcess = 1;
8
8
  export const TerminalProcess = 7;
9
9
  export const Unknown = 0;
10
10
  export const ProcessExplorerRenderer = 33;
11
+ export const ExtensionHostWorker = 218;
@@ -2,9 +2,9 @@ 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 TypeScriptCompileProcessPath from '../TypeScriptCompileProcessPath/TypeScriptCompileProcessPath.js';
6
5
  export const launchTypeScriptCompileProcess = async () => {
7
6
  const method = IsElectron.isElectron ? IpcParentType.ElectronUtilityProcess : IpcParentType.NodeForkedProcess;
7
+ const TypeScriptCompileProcessPath = await import('../TypeScriptCompileProcessPath/TypeScriptCompileProcessPath.js');
8
8
  const typescriptCompileProcess = await IpcParent.create({
9
9
  method,
10
10
  path: TypeScriptCompileProcessPath.typescriptCompileProcessPath,
@@ -41,9 +41,9 @@ export const getAppImageName = () => {
41
41
  export const getSetupName = () => {
42
42
  return 'Lvce-Setup';
43
43
  };
44
- export const version = '0.28.1';
45
- export const commit = '50a3401';
46
- export const date = '2024-05-03T21:44:26.000Z';
44
+ export const version = '0.28.3';
45
+ export const commit = 'c0148f2';
46
+ export const date = '2024-05-04T11:13:42.000Z';
47
47
  export const getVersion = () => {
48
48
  return version;
49
49
  };
@@ -0,0 +1,16 @@
1
+ import { existsSync } from 'node:fs';
2
+ import { readFile, writeFile } from 'node:fs/promises';
3
+ import { join } from 'node:path';
4
+ import * as Hash from '../Hash/Hash.js';
5
+ import * as TypeScriptCompileCachePath from '../TypeScriptCompileCachePath/TypeScriptCompileCachePath.js';
6
+ import * as TypeScriptCompileProcess from '../TypeScriptCompileProcess/TypeScriptCompileProcess.js';
7
+ export const transpileTypeScript = async (code) => {
8
+ const hash = Hash.fromString(code);
9
+ const cachePath = join(TypeScriptCompileCachePath.typescriptCompileCachePath, `${hash}.ts`);
10
+ if (!existsSync(cachePath)) {
11
+ const content = await TypeScriptCompileProcess.invoke('TranspileTypeScript.transpileTypeScript', code);
12
+ await writeFile(cachePath, content);
13
+ }
14
+ const content = await readFile(cachePath, 'utf8');
15
+ return content;
16
+ };
@@ -0,0 +1,3 @@
1
+ import * as Path from '../Path/Path.js';
2
+ import * as Root from '../Root/Root.js';
3
+ export const typescriptCompileCachePath = Path.join(Root.root, 'packages', 'build', '.tmp', 'typescript-compile-cache');