@lvce-editor/shared-process 0.34.10 → 0.34.12

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.34.10",
3
+ "version": "0.34.12",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -18,9 +18,9 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "@lvce-editor/assert": "^1.3.0",
21
- "@lvce-editor/extension-host-helper-process": "0.34.10",
21
+ "@lvce-editor/extension-host-helper-process": "0.34.12",
22
22
  "@lvce-editor/ipc": "^11.0.1",
23
- "@lvce-editor/json-rpc": "^4.0.0",
23
+ "@lvce-editor/json-rpc": "^4.1.0",
24
24
  "@lvce-editor/jsonc-parser": "^1.4.0",
25
25
  "@lvce-editor/pretty-error": "^1.6.0",
26
26
  "@lvce-editor/verror": "^1.4.0",
@@ -32,10 +32,10 @@
32
32
  "@lvce-editor/network-process": "^2.0.0",
33
33
  "@lvce-editor/preload": "^1.4.0",
34
34
  "@lvce-editor/search-process": "^2.0.0",
35
- "@lvce-editor/typescript-compile-process": "^1.2.0",
35
+ "@lvce-editor/typescript-compile-process": "^1.3.0",
36
36
  "@lvce-editor/pty-host": "^2.0.0",
37
37
  "@lvce-editor/embeds-process": "^1.5.0",
38
- "@lvce-editor/preview-process": "^3.5.0",
38
+ "@lvce-editor/preview-process": "^3.6.0",
39
39
  "open": "^10.1.0",
40
40
  "tail": "^2.2.6",
41
41
  "tmp-promise": "^3.0.3",
@@ -3,10 +3,11 @@ import * as AddCustomRendererProcessPath from '../AddCustomRendererProcessPath/A
3
3
  import * as Platform from '../Platform/Platform.js';
4
4
  import * as ShouldTranspileTypescript from '../ShouldTranspileTypescript/ShouldTranspileTypescript.js';
5
5
  import * as TranspileTypeScript from '../TranspileTypeScript/TranspileTypeScript.js';
6
+ const useCache = false; // TODO enable this
6
7
  export const getElectronFileResponseContent = async (request, absolutePath, url) => {
7
8
  if (ShouldTranspileTypescript.shouldTranspileTypescript(request, url)) {
8
9
  const content = await readFile(absolutePath);
9
- const newContent = await TranspileTypeScript.transpileTypeScript(content.toString());
10
+ const newContent = await TranspileTypeScript.transpileTypeScript(content.toString(), useCache);
10
11
  const newContentString = newContent.outputText;
11
12
  const newContentBuffer = Buffer.from(newContentString);
12
13
  return newContentBuffer;
@@ -41,9 +41,9 @@ export const getAppImageName = () => {
41
41
  export const getSetupName = () => {
42
42
  return 'Lvce-Setup';
43
43
  };
44
- export const version = '0.34.10';
45
- export const commit = 'a221003';
46
- export const date = '2024-09-22T07:11:58.000Z';
44
+ export const version = '0.34.12';
45
+ export const commit = '1f15ca3';
46
+ export const date = '2024-09-24T21:45:15.000Z';
47
47
  export const getVersion = () => {
48
48
  return version;
49
49
  };
@@ -1,4 +1,8 @@
1
1
  import * as TypeScriptCompileProcess from '../TypeScriptCompileProcess/TypeScriptCompileProcess.js';
2
- export const transpileTypeScript = (code) => {
2
+ import * as TranspileTypeScriptCached from '../TranspileTypeScriptCached/TranspileTypeScriptCached.js';
3
+ export const transpileTypeScript = (code, useCache) => {
4
+ if (useCache) {
5
+ return TranspileTypeScriptCached.transpileTypeScript(code);
6
+ }
3
7
  return TypeScriptCompileProcess.invoke('TranspileTypeScript.transpileTypeScript', code);
4
8
  };
@@ -1,6 +1,6 @@
1
1
  import { existsSync } from 'node:fs';
2
- import { readFile, writeFile } from 'node:fs/promises';
3
- import { join } from 'node:path';
2
+ import { mkdir, readFile, writeFile } from 'node:fs/promises';
3
+ import { dirname, join } from 'node:path';
4
4
  import * as Hash from '../Hash/Hash.js';
5
5
  import * as TypeScriptCompileCachePath from '../TypeScriptCompileCachePath/TypeScriptCompileCachePath.js';
6
6
  import * as TypeScriptCompileProcess from '../TypeScriptCompileProcess/TypeScriptCompileProcess.js';
@@ -8,9 +8,13 @@ export const transpileTypeScript = async (code) => {
8
8
  const hash = Hash.fromString(code);
9
9
  const cachePath = join(TypeScriptCompileCachePath.typescriptCompileCachePath, `${hash}.ts`);
10
10
  if (!existsSync(cachePath)) {
11
- const content = await TypeScriptCompileProcess.invoke('TranspileTypeScript.transpileTypeScript', code);
12
- await writeFile(cachePath, content);
11
+ const { outputText } = await TypeScriptCompileProcess.invoke('TranspileTypeScript.transpileTypeScript', code);
12
+ await mkdir(dirname(cachePath), { recursive: true });
13
+ await writeFile(cachePath, outputText);
13
14
  }
14
15
  const content = await readFile(cachePath, 'utf8');
15
- return content;
16
+ return {
17
+ outputText: content,
18
+ diagnostics: [],
19
+ };
16
20
  };