@lvce-editor/shared-process 0.28.1 → 0.28.2
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 +6 -5
- package/src/parts/GetElectronFileResponseContent/GetElectronFileResponseContent.js +3 -2
- package/src/parts/LaunchTypeScriptCompileProcess/LaunchTypeScriptCompileProcess.js +1 -1
- package/src/parts/Platform/Platform.js +3 -3
- package/src/parts/TranspileTypeScriptCached/TranspileTypeScriptCached.js +16 -0
- package/src/parts/TypeScriptCompileCachePath/TypeScriptCompileCachePath.js +3 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lvce-editor/shared-process",
|
|
3
|
-
"version": "0.28.
|
|
3
|
+
"version": "0.28.2",
|
|
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.
|
|
21
|
+
"@lvce-editor/extension-host-helper-process": "0.28.2",
|
|
22
22
|
"@lvce-editor/ipc": "^8.2.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/pty-host": "0.28.
|
|
26
|
+
"@lvce-editor/pty-host": "0.28.2",
|
|
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.
|
|
39
|
-
"@lvce-editor/search-process": "0.28.
|
|
38
|
+
"@lvce-editor/network-process": "0.28.2",
|
|
39
|
+
"@lvce-editor/search-process": "0.28.2",
|
|
40
|
+
"@lvce-editor/typescript-compile-process": "0.28.2"
|
|
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
|
-
|
|
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', '');
|
|
@@ -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.
|
|
45
|
-
export const commit = '
|
|
46
|
-
export const date = '2024-05-
|
|
44
|
+
export const version = '0.28.2';
|
|
45
|
+
export const commit = 'fe693ea';
|
|
46
|
+
export const date = '2024-05-04T08:29:08.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
|
+
};
|