@lvce-editor/shared-process 0.16.18 → 0.16.20
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/extensions/builtin.language-basics-javascript/src/tokenizeJavaScript.js +24 -1
- package/extensions/builtin.language-basics-less/src/tokenizeLess.js +17 -1
- package/extensions/builtin.language-basics-wgsl/README.md +16 -0
- package/extensions/builtin.language-basics-wgsl/extension.json +13 -0
- package/extensions/builtin.language-basics-wgsl/languageConfiguration.json +21 -0
- package/extensions/builtin.language-basics-wgsl/src/tokenizeWgsl.js +226 -0
- package/package.json +4 -4
- package/src/parts/ElectronContextMenu/ElectronContextMenu.ipc.js +7 -0
- package/src/parts/ElectronContextMenu/ElectronContextMenu.js +5 -0
- package/src/parts/ElectronProcess/ElectronProcess.ipc.js +8 -0
- package/src/parts/ElectronProcess/ElectronProcess.js +9 -0
- package/src/parts/ElectronSafeStorage/ElectronSafeStorage.ipc.js +9 -0
- package/src/parts/ElectronSafeStorage/ElectronSafeStorage.js +13 -0
- package/src/parts/ExtensionManifest/ExtensionManifest.js +2 -1
- package/src/parts/ExtensionManifests/ExtensionManifestsFromFolder.js +2 -4
- package/src/parts/ExtensionManifests/ExtensionManifestsFromLinkedExtensionsFolder.js +2 -4
- package/src/parts/ExtensionUnlink/ExtensionUnlink.js +2 -2
- package/src/parts/FileSystem/FileSystem.js +9 -4
- package/src/parts/GetAccurateMemoryUsage/GetAccurateMemoryUsage.js +30 -23
- package/src/parts/GetElectronRebuildPath/GetElectronRebuildPath.js +2 -2
- package/src/parts/GetFirstEvent/GetFirstEvent.js +22 -0
- package/src/parts/GetFirstNodeWorkerEvent/GetFirstNodeWorkerEvent.js +5 -16
- package/src/parts/GetFirstWebSocketEvent/GetFirstWebSocketEvent.js +3 -3
- package/src/parts/GetHttpErrorMessage/GetHttpErrorMessage.js +28 -0
- package/src/parts/GetLatestReleaseVersion/GetLatestReleaseVersion.js +2 -28
- package/src/parts/GetTerminalProcessPath/GetTerminalProcessPath.js +6 -0
- package/src/parts/IpcParentType/IpcParentType.js +1 -0
- package/src/parts/IpcParentWithElectronUtilityProcess/IpcParentWithElectronUtilityProcess.js +12 -0
- package/src/parts/IsEsrchError/IsEsrchError.js +5 -0
- package/src/parts/IsWindows/IsWindows.js +1 -0
- package/src/parts/ListProcessGetName/ListProcessGetName.js +3 -0
- package/src/parts/Module/Module.js +10 -2
- package/src/parts/ModuleId/ModuleId.js +5 -0
- package/src/parts/ModuleMap/ModuleMap.js +18 -0
- package/src/parts/PassThroughElectronMessageForTerminalProcess/PassThroughElectronMessageForTerminalProcess.js +29 -0
- package/src/parts/PassThroughElectronMessagePort/PassThroughElectronMessagePort.ipc.js +7 -0
- package/src/parts/PassThroughElectronMessagePort/PassThroughElectronMessagePort.js +4 -0
- package/src/parts/PassThroughElectronMessagePortModule/PassThroughElectronMessagePortModule.js +8 -0
- package/src/parts/Platform/Platform.ipc.js +1 -1
- package/src/parts/Platform/Platform.js +3 -3
- package/src/parts/Preferences/Preferences.js +2 -1
- package/src/parts/Process/Process.js +4 -0
- package/src/parts/PtyHost/PtyHost.js +17 -12
- package/src/parts/RebuildForElectron/RebuildForElectron.js +19 -0
- package/src/parts/RebuildForNode/RebuildForNode.js +17 -0
- package/src/parts/RebuildNodePty/RebuildNodePty.js +5 -38
- package/src/parts/RecentlyOpened/RecentlyOpened.js +3 -2
- package/src/parts/RemoveSymlink/RemoveSymlink.js +12 -0
- package/src/parts/Terminal/Terminal.js +5 -3
- package/src/parts/WaitForProcessToExit/WaitForProcessToExit.js +4 -24
- package/src/parts/WebSocketReadyState/WebSocketReadyState.js +5 -0
- package/src/parts/Window/ElectronWindow.ipc.js +12 -0
- package/src/parts/Window/ElectronWindow.js +32 -0
|
@@ -5,6 +5,7 @@ import * as FileSystem from '../FileSystem/FileSystem.js'
|
|
|
5
5
|
import * as Json from '../Json/Json.js'
|
|
6
6
|
import * as JsonFile from '../JsonFile/JsonFile.js'
|
|
7
7
|
import * as Platform from '../Platform/Platform.js'
|
|
8
|
+
import * as IsEnoentError from '../IsEnoentError/IsEnoentError.js'
|
|
8
9
|
import { VError } from '../VError/VError.js'
|
|
9
10
|
|
|
10
11
|
const addToArrayUnique = (recentlyOpened, path) => {
|
|
@@ -20,7 +21,7 @@ const getRecentlyOpened = async (recentlyOpenedPath) => {
|
|
|
20
21
|
const parsed = await JsonFile.readJson(recentlyOpenedPath)
|
|
21
22
|
return parsed
|
|
22
23
|
} catch (error) {
|
|
23
|
-
if (error
|
|
24
|
+
if (IsEnoentError.isEnoentError(error)) {
|
|
24
25
|
// ignore
|
|
25
26
|
} else if (error && error.code === ErrorCodes.E_JSON_PARSE) {
|
|
26
27
|
// ignore
|
|
@@ -36,7 +37,7 @@ const setRecentlyOpened = async (recentlyOpenedPath, newRecentlyOpened) => {
|
|
|
36
37
|
try {
|
|
37
38
|
await FileSystem.writeFile(recentlyOpenedPath, stringified)
|
|
38
39
|
} catch (error) {
|
|
39
|
-
if (error
|
|
40
|
+
if (IsEnoentError.isEnoentError(error)) {
|
|
40
41
|
await FileSystem.mkdir(dirname(recentlyOpenedPath))
|
|
41
42
|
await FileSystem.writeFile(recentlyOpenedPath, stringified)
|
|
42
43
|
return
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { rm } from 'node:fs/promises'
|
|
2
|
+
import * as Assert from '../Assert/Assert.js'
|
|
3
|
+
import { VError } from '../VError/VError.js'
|
|
4
|
+
|
|
5
|
+
export const removeSymlink = async (path) => {
|
|
6
|
+
try {
|
|
7
|
+
Assert.string(path)
|
|
8
|
+
await rm(path, { force: true })
|
|
9
|
+
} catch (error) {
|
|
10
|
+
throw new VError(error, `Failed to remove symlink ${path}`)
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -37,9 +37,11 @@ export const create = async (ipc, id, cwd, command, args) => {
|
|
|
37
37
|
const ptyHost = await PtyHost.getOrCreate()
|
|
38
38
|
const terminal = createTerminal(ptyHost, ipc)
|
|
39
39
|
TerminalState.add(id, terminal)
|
|
40
|
-
// TODO
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
// TODO improve ipc error handling and await promise
|
|
41
|
+
// current can't await promise because when process exits
|
|
42
|
+
// because of native module error, promise is not resolved
|
|
43
|
+
// causing application which waits on this promise to hang
|
|
44
|
+
PtyHost.invoke('Terminal.create', id, cwd, command, args)
|
|
43
45
|
} catch (error) {
|
|
44
46
|
throw new VError(error, `Failed to create terminal`)
|
|
45
47
|
}
|
|
@@ -1,29 +1,9 @@
|
|
|
1
1
|
import * as ProcessExitEventType from '../ProcessExitEventType/ProcessExitEventType.js'
|
|
2
|
+
import * as GetFirstEvent from '../GetFirstEvent/GetFirstEvent.js'
|
|
2
3
|
|
|
3
4
|
export const waitForProcessToExit = async (childProcess) => {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
childProcess.off('error', handleError)
|
|
8
|
-
resolve(value)
|
|
9
|
-
}
|
|
10
|
-
const handleClose = (event) => {
|
|
11
|
-
cleanup({
|
|
12
|
-
type: ProcessExitEventType.Exit,
|
|
13
|
-
event,
|
|
14
|
-
})
|
|
15
|
-
}
|
|
16
|
-
const handleError = (event) => {
|
|
17
|
-
cleanup({
|
|
18
|
-
type: ProcessExitEventType.Error,
|
|
19
|
-
event,
|
|
20
|
-
})
|
|
21
|
-
}
|
|
22
|
-
childProcess.on('close', handleClose)
|
|
23
|
-
childProcess.on('error', handleError)
|
|
5
|
+
return GetFirstEvent.getFirstEvent(childProcess, {
|
|
6
|
+
error: ProcessExitEventType.Error,
|
|
7
|
+
close: ProcessExitEventType.Exit,
|
|
24
8
|
})
|
|
25
|
-
return {
|
|
26
|
-
type,
|
|
27
|
-
event,
|
|
28
|
-
}
|
|
29
9
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as ElectronWindow from './ElectronWindow.js'
|
|
2
|
+
|
|
3
|
+
export const name = 'ElectronWindow'
|
|
4
|
+
|
|
5
|
+
export const Commands = {
|
|
6
|
+
close: ElectronWindow.close,
|
|
7
|
+
maximize: ElectronWindow.maximize,
|
|
8
|
+
minimize: ElectronWindow.minimize,
|
|
9
|
+
reload: ElectronWindow.reload,
|
|
10
|
+
toggleDevtools: ElectronWindow.toggleDevtools,
|
|
11
|
+
unmaximize: ElectronWindow.unmaximize,
|
|
12
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as Assert from '../Assert/Assert.js'
|
|
2
|
+
import * as ParentIpc from '../ParentIpc/ParentIpc.js'
|
|
3
|
+
|
|
4
|
+
export const minimize = (windowId) => {
|
|
5
|
+
Assert.number(windowId)
|
|
6
|
+
return ParentIpc.invoke('ElectronWindow.minimize', windowId)
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const toggleDevtools = (windowId) => {
|
|
10
|
+
Assert.number(windowId)
|
|
11
|
+
return ParentIpc.invoke('ElectronWindow.toggleDevtools', windowId)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const maximize = (windowId) => {
|
|
15
|
+
Assert.number(windowId)
|
|
16
|
+
return ParentIpc.invoke('ElectronWindow.maximize', windowId)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const unmaximize = (windowId) => {
|
|
20
|
+
Assert.number(windowId)
|
|
21
|
+
return ParentIpc.invoke('ElectronWindow.unmaximize')
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const close = (windowId) => {
|
|
25
|
+
Assert.number(windowId)
|
|
26
|
+
return ParentIpc.invoke('ElectronWindow.close', windowId)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const reload = (windowId) => {
|
|
30
|
+
Assert.number(windowId)
|
|
31
|
+
return ParentIpc.invoke('ElectronWindow.reload', windowId)
|
|
32
|
+
}
|