@lvce-editor/shared-process 0.0.7 → 0.0.11
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.11",
|
|
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.11",
|
|
36
|
+
"@lvce-editor/extension-host": "0.0.11"
|
|
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':
|
|
@@ -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
|
}
|
|
@@ -1,114 +1,34 @@
|
|
|
1
|
+
import { extensionHostPath } from '@lvce-editor/extension-host'
|
|
1
2
|
import { homedir, tmpdir } from 'node:os'
|
|
2
3
|
import { sep } from 'node:path'
|
|
3
4
|
import { xdgCache, xdgConfig, xdgData, xdgState } from 'xdg-basedir'
|
|
4
|
-
import * as Root from '../Root/Root.js'
|
|
5
5
|
import * as Path from '../Path/Path.js'
|
|
6
|
-
import
|
|
6
|
+
import * as Root from '../Root/Root.js'
|
|
7
7
|
|
|
8
|
-
export const
|
|
9
|
-
|
|
10
|
-
return 'lvce-oss'
|
|
11
|
-
},
|
|
12
|
-
isWindows() {
|
|
13
|
-
return process.platform === 'win32'
|
|
14
|
-
},
|
|
15
|
-
isMacOs() {
|
|
16
|
-
return process.platform === 'darwin'
|
|
17
|
-
},
|
|
18
|
-
getDataDir() {
|
|
19
|
-
return Path.join(xdgData || tmpdir(), this.getApplicationName())
|
|
20
|
-
},
|
|
21
|
-
getConfigDir() {
|
|
22
|
-
return Path.join(xdgConfig || tmpdir(), this.getApplicationName())
|
|
23
|
-
},
|
|
24
|
-
getCacheDir() {
|
|
25
|
-
return Path.join(xdgCache || tmpdir(), this.getApplicationName())
|
|
26
|
-
},
|
|
27
|
-
getAppDir() {
|
|
28
|
-
return Root.root
|
|
29
|
-
},
|
|
30
|
-
getExtensionsPath() {
|
|
31
|
-
return Path.join(this.getDataDir(), 'extensions')
|
|
32
|
-
},
|
|
33
|
-
getBuiltinExtensionsPath() {
|
|
34
|
-
return Path.join(Root.root, 'extensions')
|
|
35
|
-
},
|
|
36
|
-
getDisabledExtensionsPath() {
|
|
37
|
-
return Path.join(this.getDataDir(), 'disabled-extensions')
|
|
38
|
-
},
|
|
39
|
-
getCachedExtensionsPath() {
|
|
40
|
-
return Path.join(this.getCacheDir(), 'cached-extensions')
|
|
41
|
-
},
|
|
42
|
-
getMarketplaceUrl() {
|
|
43
|
-
return (
|
|
44
|
-
process.env.LVCE_MARKETPLACE_URL ||
|
|
45
|
-
'https://marketplace.22e924c84de072d4b25b.com'
|
|
46
|
-
)
|
|
47
|
-
},
|
|
48
|
-
getDesktop() {
|
|
49
|
-
if (
|
|
50
|
-
process.env.ORIGINAL_XDG_CURRENT_DESKTOP &&
|
|
51
|
-
process.env.ORIGINAL_XDG_CURRENT_DESKTOP !== 'undefined'
|
|
52
|
-
) {
|
|
53
|
-
if (process.env.ORIGINAL_XDG_CURRENT_DESKTOP === 'ubuntu:GNOME') {
|
|
54
|
-
return 'gnome'
|
|
55
|
-
}
|
|
56
|
-
return process.env.ORIGINAL_XDG_CURRENT_DESKTOP
|
|
57
|
-
}
|
|
58
|
-
if (process.env.XDG_CURRENT_DESKTOP) {
|
|
59
|
-
if (process.env.XDG_CURRENT_DESKTOP === 'ubuntu:GNOME') {
|
|
60
|
-
return 'gnome'
|
|
61
|
-
}
|
|
62
|
-
return process.env.XDG_CURRENT_DESKTOP
|
|
63
|
-
}
|
|
64
|
-
if (process.platform === 'win32') {
|
|
65
|
-
return 'windows'
|
|
66
|
-
}
|
|
67
|
-
return ''
|
|
68
|
-
},
|
|
69
|
-
getPathSeparator() {
|
|
70
|
-
return sep
|
|
71
|
-
},
|
|
72
|
-
getStateDir() {
|
|
73
|
-
return xdgState
|
|
74
|
-
},
|
|
75
|
-
getLogsDir() {
|
|
76
|
-
return Path.join(xdgState || tmpdir(), this.getApplicationName(), 'logs')
|
|
77
|
-
},
|
|
78
|
-
getUserSettingsPath() {
|
|
79
|
-
return Path.join(this.getConfigDir(), 'settings.json')
|
|
80
|
-
},
|
|
81
|
-
getExtensionHostPath() {
|
|
82
|
-
return extensionHostPath
|
|
83
|
-
},
|
|
84
|
-
getRecentlyOpenedPath() {
|
|
85
|
-
return Path.join(this.getCacheDir(), 'recently-opened.json')
|
|
86
|
-
},
|
|
87
|
-
getDefaultSettingsPath() {
|
|
88
|
-
return Path.join(Root.root, 'config', 'defaultSettings.json')
|
|
89
|
-
},
|
|
8
|
+
export const getApplicationName = () => {
|
|
9
|
+
return 'lvce-oss'
|
|
90
10
|
}
|
|
91
11
|
|
|
92
12
|
export const isWindows = () => {
|
|
93
|
-
return
|
|
13
|
+
return process.platform === 'win32'
|
|
94
14
|
}
|
|
95
15
|
|
|
96
16
|
export const isMacOs = () => {
|
|
97
|
-
return
|
|
17
|
+
return process.platform === 'darwin'
|
|
98
18
|
}
|
|
99
19
|
|
|
100
20
|
// TODO pass which version when building: insiders|oss|normal
|
|
101
21
|
|
|
102
22
|
export const getDataDir = () => {
|
|
103
|
-
return
|
|
23
|
+
return Path.join(xdgData || tmpdir(), getApplicationName())
|
|
104
24
|
}
|
|
105
25
|
|
|
106
26
|
export const getConfigDir = () => {
|
|
107
|
-
return
|
|
27
|
+
return Path.join(xdgConfig || tmpdir(), getApplicationName())
|
|
108
28
|
}
|
|
109
29
|
|
|
110
30
|
export const getCacheDir = () => {
|
|
111
|
-
return
|
|
31
|
+
return Path.join(xdgCache || tmpdir(), getApplicationName())
|
|
112
32
|
}
|
|
113
33
|
|
|
114
34
|
export const getHomeDir = () => {
|
|
@@ -116,57 +36,84 @@ export const getHomeDir = () => {
|
|
|
116
36
|
}
|
|
117
37
|
|
|
118
38
|
export const getAppDir = () => {
|
|
119
|
-
return
|
|
39
|
+
return Root.root
|
|
120
40
|
}
|
|
121
41
|
|
|
122
42
|
export const getExtensionsPath = () => {
|
|
123
|
-
return
|
|
43
|
+
return Path.join(getDataDir(), 'extensions')
|
|
124
44
|
}
|
|
125
45
|
|
|
126
46
|
export const getBuiltinExtensionsPath = () => {
|
|
127
|
-
return
|
|
47
|
+
return Path.join(Root.root, 'extensions')
|
|
128
48
|
}
|
|
129
49
|
|
|
130
50
|
export const getDisabledExtensionsPath = () => {
|
|
131
|
-
return
|
|
51
|
+
return Path.join(getDataDir(), 'disabled-extensions')
|
|
132
52
|
}
|
|
133
53
|
|
|
134
54
|
export const getCachedExtensionsPath = () => {
|
|
135
|
-
return
|
|
55
|
+
return Path.join(getCacheDir(), 'cached-extensions')
|
|
136
56
|
}
|
|
137
57
|
|
|
138
58
|
export const getMarketplaceUrl = () => {
|
|
139
|
-
return
|
|
59
|
+
return (
|
|
60
|
+
process.env.LVCE_MARKETPLACE_URL ||
|
|
61
|
+
'https://marketplace.22e924c84de072d4b25b.com'
|
|
62
|
+
)
|
|
140
63
|
}
|
|
141
64
|
|
|
142
65
|
export const getDesktop = () => {
|
|
143
|
-
|
|
66
|
+
if (
|
|
67
|
+
process.env.ORIGINAL_XDG_CURRENT_DESKTOP &&
|
|
68
|
+
process.env.ORIGINAL_XDG_CURRENT_DESKTOP !== 'undefined'
|
|
69
|
+
) {
|
|
70
|
+
if (process.env.ORIGINAL_XDG_CURRENT_DESKTOP === 'ubuntu:GNOME') {
|
|
71
|
+
return 'gnome'
|
|
72
|
+
}
|
|
73
|
+
return process.env.ORIGINAL_XDG_CURRENT_DESKTOP
|
|
74
|
+
}
|
|
75
|
+
if (process.env.XDG_CURRENT_DESKTOP) {
|
|
76
|
+
if (process.env.XDG_CURRENT_DESKTOP === 'ubuntu:GNOME') {
|
|
77
|
+
return 'gnome'
|
|
78
|
+
}
|
|
79
|
+
return process.env.XDG_CURRENT_DESKTOP
|
|
80
|
+
}
|
|
81
|
+
if (process.platform === 'win32') {
|
|
82
|
+
return 'windows'
|
|
83
|
+
}
|
|
84
|
+
return ''
|
|
144
85
|
}
|
|
145
86
|
|
|
146
87
|
export const getPathSeparator = () => {
|
|
147
|
-
return
|
|
88
|
+
return sep
|
|
148
89
|
}
|
|
149
90
|
|
|
150
91
|
export const getStateDir = () => {
|
|
151
|
-
return
|
|
92
|
+
return xdgState
|
|
152
93
|
}
|
|
153
94
|
|
|
154
95
|
export const getLogsDir = () => {
|
|
155
|
-
return
|
|
96
|
+
return Path.join(xdgState || tmpdir(), getApplicationName(), 'logs')
|
|
156
97
|
}
|
|
157
98
|
|
|
158
99
|
export const getUserSettingsPath = () => {
|
|
159
|
-
return
|
|
100
|
+
return Path.join(getConfigDir(), 'settings.json')
|
|
160
101
|
}
|
|
161
102
|
|
|
162
103
|
export const getExtensionHostPath = () => {
|
|
163
|
-
return
|
|
104
|
+
return extensionHostPath
|
|
164
105
|
}
|
|
165
106
|
|
|
166
107
|
export const getRecentlyOpenedPath = () => {
|
|
167
|
-
return
|
|
108
|
+
return Path.join(getCacheDir(), 'recently-opened.json')
|
|
168
109
|
}
|
|
169
110
|
|
|
170
111
|
export const getDefaultSettingsPath = () => {
|
|
171
|
-
return
|
|
112
|
+
return Path.join(Root.root, 'config', 'defaultSettings.json')
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export const setEnvironmentVariables = (variables) => {
|
|
116
|
+
for (const [key, value] of Object.entries(variables)) {
|
|
117
|
+
process.env[key] = value
|
|
118
|
+
}
|
|
172
119
|
}
|