@lvce-editor/shared-process 0.0.9 → 0.0.13
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.0.
|
|
3
|
+
"version": "0.0.13",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"verror": "^1.10.1",
|
|
33
33
|
"ws": "^8.8.0",
|
|
34
34
|
"xdg-basedir": "^5.1.0",
|
|
35
|
-
"@lvce-editor/pty-host": "0.0.
|
|
36
|
-
"@lvce-editor/extension-host": "0.0.
|
|
35
|
+
"@lvce-editor/pty-host": "0.0.13",
|
|
36
|
+
"@lvce-editor/extension-host": "0.0.13"
|
|
37
37
|
},
|
|
38
38
|
"optionalDependencies": {
|
|
39
39
|
"electron-clipboard-ex": "^1.3.3",
|
|
@@ -178,6 +178,7 @@ const getModuleId = (commandId) => {
|
|
|
178
178
|
case 'Platform.getUserSettingsPath':
|
|
179
179
|
case 'Platform.getRecentlyOpenedPath':
|
|
180
180
|
case 'Platform.getCacheDir':
|
|
181
|
+
case 'Platform.setEnvironmentVariables':
|
|
181
182
|
return MODULE_PLATFORM
|
|
182
183
|
case 'Terminal.create':
|
|
183
184
|
case 'Terminal.dispose':
|
|
@@ -15,10 +15,19 @@ export const state = {
|
|
|
15
15
|
electronPortMap: new Map(),
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
+
// TODO apparent there are multiple ways for listening to ipc
|
|
19
|
+
// 1. parentPort
|
|
20
|
+
// 2. process.send
|
|
21
|
+
// instead of if/else use interface and abstraction: ParentPortIpc.listen(), ProcessIpc.listen(), ParentPortIpc.send(message), ProcessIpc.send(message)
|
|
22
|
+
|
|
18
23
|
export const electronSend = (message) => {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
24
|
+
if (parentPort) {
|
|
25
|
+
// @ts-ignore
|
|
26
|
+
// process.send(message)
|
|
27
|
+
parentPort.postMessage(message)
|
|
28
|
+
} else if (process.send) {
|
|
29
|
+
process.send(message)
|
|
30
|
+
}
|
|
22
31
|
}
|
|
23
32
|
|
|
24
33
|
const handleMessageFromParentProcess = async (message, handle) => {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as Command from '../Command/Command.js'
|
|
2
2
|
import * as Platform from '../Platform/Platform.js'
|
|
3
3
|
|
|
4
|
+
// prettier-ignore
|
|
4
5
|
export const __initialize__ = () => {
|
|
5
6
|
Command.register('Platform.getConfigDir', Platform.getConfigDir)
|
|
6
7
|
Command.register('Platform.getAppDir', Platform.getAppDir)
|
|
@@ -15,4 +16,6 @@ export const __initialize__ = () => {
|
|
|
15
16
|
Command.register('Platform.getUserSettingsPath', Platform.getUserSettingsPath)
|
|
16
17
|
Command.register('Platform.getRecentlyOpenedPath', Platform.getRecentlyOpenedPath)
|
|
17
18
|
Command.register('Platform.getCacheDir', Platform.getCacheDir)
|
|
19
|
+
Command.register('Platform.getCacheDir', Platform.getCacheDir)
|
|
20
|
+
Command.register('Platform.setEnvironmentVariables', Platform.setEnvironmentVariables)
|
|
18
21
|
}
|
|
@@ -111,3 +111,9 @@ export const getRecentlyOpenedPath = () => {
|
|
|
111
111
|
export const getDefaultSettingsPath = () => {
|
|
112
112
|
return Path.join(Root.root, 'config', 'defaultSettings.json')
|
|
113
113
|
}
|
|
114
|
+
|
|
115
|
+
export const setEnvironmentVariables = (variables) => {
|
|
116
|
+
for (const [key, value] of Object.entries(variables)) {
|
|
117
|
+
process.env[key] = value
|
|
118
|
+
}
|
|
119
|
+
}
|