@lvce-editor/typescript-compile-process 2.0.0 → 2.1.0
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/dist/index.js +12 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2,6 +2,7 @@ import * as Command from '@lvce-editor/command';
|
|
|
2
2
|
import { object, string } from '@lvce-editor/assert';
|
|
3
3
|
import { WebSocketRpcParent, ElectronMessagePortRpcClient, ElectronUtilityProcessRpcClient, NodeForkedProcessRpcClient } from '@lvce-editor/rpc';
|
|
4
4
|
import { VError } from '@lvce-editor/verror';
|
|
5
|
+
import { readFile, writeFile } from 'node:fs/promises';
|
|
5
6
|
|
|
6
7
|
const NodeWorker = 1;
|
|
7
8
|
const NodeForkedProcess = 2;
|
|
@@ -116,8 +117,19 @@ const transpileTypeScript = async code => {
|
|
|
116
117
|
}
|
|
117
118
|
};
|
|
118
119
|
|
|
120
|
+
const transpileTypeScriptAtPath = async (inPath, outPath) => {
|
|
121
|
+
try {
|
|
122
|
+
const content = await readFile(inPath, 'utf-8');
|
|
123
|
+
const newContent = await transpileTypeScript(content);
|
|
124
|
+
await writeFile(outPath, newContent);
|
|
125
|
+
} catch (error) {
|
|
126
|
+
throw new VError(error, `Failed to transpile typescript`);
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
|
|
119
130
|
const commandMap = {
|
|
120
131
|
'TranspileTypeScript.transpileTypeScript': transpileTypeScript,
|
|
132
|
+
'TranspileTypeScript.transpileTypeScriptAtPath': transpileTypeScriptAtPath,
|
|
121
133
|
'TypeScript.setTypeScriptPath': set,
|
|
122
134
|
'HandleElectronMessagePort.handleElectronMessagePort': handleElectronMessagePort
|
|
123
135
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lvce-editor/typescript-compile-process",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "TypeScript Compile Process",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": "bin/typescriptCompileProcess.js",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@lvce-editor/assert": "^1.3.0",
|
|
22
22
|
"@lvce-editor/command": "^1.2.0",
|
|
23
|
-
"@lvce-editor/rpc": "^1.
|
|
23
|
+
"@lvce-editor/rpc": "^1.12.0",
|
|
24
24
|
"@lvce-editor/verror": "^1.6.0"
|
|
25
25
|
},
|
|
26
26
|
"xo": {
|