@lvce-editor/shared-process 0.21.2 → 0.21.4
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 +8 -7
- package/src/parts/AppWindow/AppWindow.js +2 -3
- package/src/parts/Assert/Assert.js +1 -59
- package/src/parts/CpuProfile/CpuProfile.js +1 -1
- package/src/parts/CreateCpuProfile/CreateCpuProfile.js +4 -4
- package/src/parts/Env/Env.js +1 -1
- package/src/parts/Exec/Exec.js +1 -1
- package/src/parts/ExportStatic/ExportStatic.js +2 -2
- package/src/parts/ExtensionManifests/ExtensionManifestsFromLinkedExtensionsFolder.js +2 -2
- package/src/parts/GetFirstWebSocketEvent/GetFirstWebSocketEvent.js +4 -20
- package/src/parts/GetPsOutput/GetPsOutput.js +2 -3
- package/src/parts/GetStatusString/GetStatusString.js +5 -5
- package/src/parts/HandleWebSocket/HandleWebSocket.js +1 -1
- package/src/parts/IpcChildWithElectronUtilityProcess/IpcChildWithElectronUtilityProcess.js +1 -1
- package/src/parts/IpcParentWithNodeForkedProcess/IpcParentWithNodeForkedProcess.js +3 -3
- package/src/parts/Platform/Platform.js +3 -3
- package/src/parts/ToTextSearchResult/ToTextSearchResult.js +2 -2
- package/src/parts/AssertionError/AssertionError.js +0 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lvce-editor/shared-process",
|
|
3
|
-
"version": "0.21.
|
|
3
|
+
"version": "0.21.4",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -18,12 +18,13 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@babel/code-frame": "^7.23.5",
|
|
21
|
-
"@lvce-editor/
|
|
22
|
-
"@lvce-editor/extension-host
|
|
21
|
+
"@lvce-editor/assert": "^1.0.1",
|
|
22
|
+
"@lvce-editor/extension-host": "0.21.4",
|
|
23
|
+
"@lvce-editor/extension-host-helper-process": "0.21.4",
|
|
23
24
|
"@lvce-editor/json-rpc": "^0.4.0",
|
|
24
25
|
"@lvce-editor/jsonc-parser": "^1.1.0",
|
|
25
|
-
"@lvce-editor/pretty-error": "^1.
|
|
26
|
-
"@lvce-editor/pty-host": "0.21.
|
|
26
|
+
"@lvce-editor/pretty-error": "^1.3.0",
|
|
27
|
+
"@lvce-editor/pty-host": "0.21.4",
|
|
27
28
|
"@lvce-editor/verror": "^1.1.2",
|
|
28
29
|
"debug": "^4.3.4",
|
|
29
30
|
"execa": "^8.0.1",
|
|
@@ -31,10 +32,10 @@
|
|
|
31
32
|
"got": "^13.0.0",
|
|
32
33
|
"is-object": "^1.0.2",
|
|
33
34
|
"lines-and-columns": "^2.0.4",
|
|
34
|
-
"p-queue": "^8.0.
|
|
35
|
+
"p-queue": "^8.0.1",
|
|
35
36
|
"parse-json": "^8.1.0",
|
|
36
37
|
"tar-fs": "^3.0.4",
|
|
37
|
-
"ws": "^8.15.
|
|
38
|
+
"ws": "^8.15.1",
|
|
38
39
|
"xdg-basedir": "^5.1.0"
|
|
39
40
|
},
|
|
40
41
|
"optionalDependencies": {
|
|
@@ -5,9 +5,8 @@ import * as Preferences from '../Preferences/Preferences.js'
|
|
|
5
5
|
import * as Screen from '../Screen/Screen.js'
|
|
6
6
|
|
|
7
7
|
export const createAppWindow = async (preferences, parsedArgs, workingDirectory, url = DefaultUrl.defaultUrl) => {
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const windowOptions = GetAppWindowOptions.getAppWindowOptions(preferences, screenWidth, screenHeight)
|
|
8
|
+
const { width, height } = await Screen.getBounds()
|
|
9
|
+
const windowOptions = GetAppWindowOptions.getAppWindowOptions(preferences, width, height)
|
|
11
10
|
return ParentIpc.invoke('AppWindow.createAppWindow2', windowOptions, parsedArgs, workingDirectory, url)
|
|
12
11
|
}
|
|
13
12
|
|
|
@@ -1,59 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const getType = (value) => {
|
|
4
|
-
switch (typeof value) {
|
|
5
|
-
case 'number':
|
|
6
|
-
return 'number'
|
|
7
|
-
case 'function':
|
|
8
|
-
return 'function'
|
|
9
|
-
case 'string':
|
|
10
|
-
return 'string'
|
|
11
|
-
case 'object':
|
|
12
|
-
if (value === null) {
|
|
13
|
-
return 'null'
|
|
14
|
-
}
|
|
15
|
-
if (Array.isArray(value)) {
|
|
16
|
-
return 'array'
|
|
17
|
-
}
|
|
18
|
-
return 'object'
|
|
19
|
-
case 'boolean':
|
|
20
|
-
return 'boolean'
|
|
21
|
-
default:
|
|
22
|
-
return 'unknown'
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export const object = (value) => {
|
|
27
|
-
const type = getType(value)
|
|
28
|
-
if (type !== 'object') {
|
|
29
|
-
throw new AssertionError('expected value to be of type object')
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export const number = (value) => {
|
|
34
|
-
const type = getType(value)
|
|
35
|
-
if (type !== 'number') {
|
|
36
|
-
throw new AssertionError('expected value to be of type number')
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export const array = (value) => {
|
|
41
|
-
const type = getType(value)
|
|
42
|
-
if (type !== 'array') {
|
|
43
|
-
throw new AssertionError('expected value to be of type array')
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export const string = (value) => {
|
|
48
|
-
const type = getType(value)
|
|
49
|
-
if (type !== 'string') {
|
|
50
|
-
throw new AssertionError('expected value to be of type string')
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export const boolean = (value) => {
|
|
55
|
-
const type = getType(value)
|
|
56
|
-
if (type !== 'boolean') {
|
|
57
|
-
throw new AssertionError('expected value to be of type boolean')
|
|
58
|
-
}
|
|
59
|
-
}
|
|
1
|
+
export * from '@lvce-editor/assert'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { writeFile } from 'node:fs/promises'
|
|
2
|
-
import got from 'got'
|
|
3
2
|
import { tmpdir } from 'node:os'
|
|
4
3
|
import { join } from 'node:path'
|
|
4
|
+
import got from 'got'
|
|
5
5
|
import { WebSocket } from 'ws'
|
|
6
6
|
import * as DevtoolsProtocolRpc from '../DevtoolsProtocolRpc/DevtoolsProtocolRpc.js'
|
|
7
7
|
|
|
@@ -29,7 +29,7 @@ export const createCpuProfile = async (pid) => {
|
|
|
29
29
|
// AttachDebugger.attachDebugger(pid)
|
|
30
30
|
const response = await got('http://localhost:9229/json/list').json()
|
|
31
31
|
const first = response[0]
|
|
32
|
-
const webSocketDebuggerUrl = first
|
|
32
|
+
const { webSocketDebuggerUrl } = first
|
|
33
33
|
const ipc = createConnection(webSocketDebuggerUrl)
|
|
34
34
|
|
|
35
35
|
await new Promise((r) => {
|
|
@@ -37,7 +37,7 @@ export const createCpuProfile = async (pid) => {
|
|
|
37
37
|
})
|
|
38
38
|
const rpc = DevtoolsProtocolRpc.create(ipc)
|
|
39
39
|
const result = await rpc.invoke('Debugger.enable')
|
|
40
|
-
const debuggerId = result.result
|
|
40
|
+
const { debuggerId } = result.result
|
|
41
41
|
console.log({ debuggerId })
|
|
42
42
|
const p = await rpc.invoke('Profiler.enable')
|
|
43
43
|
await rpc.invoke('Profiler.start')
|
|
@@ -46,7 +46,7 @@ export const createCpuProfile = async (pid) => {
|
|
|
46
46
|
})
|
|
47
47
|
const profileResult = await rpc.invoke('Profiler.stop')
|
|
48
48
|
console.log({ profileResult })
|
|
49
|
-
const profile = profileResult.result
|
|
49
|
+
const { profile } = profileResult.result
|
|
50
50
|
const profilePath = join(tmpdir(), 'node-profile.cpuprofile')
|
|
51
51
|
const profileString = JSON.stringify(profile)
|
|
52
52
|
await writeFile(profilePath, profileString)
|
package/src/parts/Env/Env.js
CHANGED
package/src/parts/Exec/Exec.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { existsSync } from 'node:fs'
|
|
2
|
+
import { isAbsolute, join } from 'node:path'
|
|
2
3
|
import * as FileSystem from '../FileSystem/FileSystem.js'
|
|
3
4
|
import * as JsonFile from '../JsonFile/JsonFile.js'
|
|
4
5
|
import * as Path from '../Path/Path.js'
|
|
5
|
-
import { existsSync } from 'fs'
|
|
6
6
|
|
|
7
7
|
// TODO
|
|
8
8
|
// - implement this for syntax highlighting projects
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { readlink } from 'fs/promises'
|
|
1
|
+
import { readlink } from 'node:fs/promises'
|
|
2
2
|
import * as ExtensionManifest from '../ExtensionManifest/ExtensionManifest.js'
|
|
3
3
|
import * as ExtensionManifestStatus from '../ExtensionManifestStatus/ExtensionManifestStatus.js'
|
|
4
4
|
import * as FileSystem from '../FileSystem/FileSystem.js'
|
|
@@ -20,7 +20,7 @@ const readSymlinks = (absolutePaths) => {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
const mergeWithSymLinks = (manifests, symlinks) => {
|
|
23
|
-
const length = manifests
|
|
23
|
+
const {length} = manifests
|
|
24
24
|
const merged = []
|
|
25
25
|
for (let i = 0; i < length; i++) {
|
|
26
26
|
const manifest = manifests[i]
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as FirstWebSocketEventType from '../FirstWebSocketEventType/FirstWebSocketEventType.js'
|
|
2
|
+
import * as GetFirstEvent from '../GetFirstEvent/GetFirstEvent.js'
|
|
2
3
|
import * as WebSocketReadyState from '../WebSocketReadyState/WebSocketReadyState.js'
|
|
3
4
|
|
|
4
5
|
export const getFirstWebSocketEvent = async (webSocket) => {
|
|
@@ -16,26 +17,9 @@ export const getFirstWebSocketEvent = async (webSocket) => {
|
|
|
16
17
|
default:
|
|
17
18
|
break
|
|
18
19
|
}
|
|
19
|
-
const { type, event } = await
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
webSocket.off('close', handleClose)
|
|
23
|
-
resolve(value)
|
|
24
|
-
}
|
|
25
|
-
const handleOpen = (event) => {
|
|
26
|
-
cleanup({
|
|
27
|
-
type: FirstWebSocketEventType.Open,
|
|
28
|
-
event,
|
|
29
|
-
})
|
|
30
|
-
}
|
|
31
|
-
const handleClose = (event) => {
|
|
32
|
-
cleanup({
|
|
33
|
-
type: FirstWebSocketEventType.Close,
|
|
34
|
-
event,
|
|
35
|
-
})
|
|
36
|
-
}
|
|
37
|
-
webSocket.on('open', handleOpen)
|
|
38
|
-
webSocket.on('close', handleClose)
|
|
20
|
+
const { type, event } = await GetFirstEvent.getFirstEvent(webSocket, {
|
|
21
|
+
open: FirstWebSocketEventType.Open,
|
|
22
|
+
close: FirstWebSocketEventType.Close,
|
|
39
23
|
})
|
|
40
24
|
return { type, event }
|
|
41
25
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { VError } from '../VError/VError.js'
|
|
2
1
|
import { execFile as _execFile } from 'node:child_process'
|
|
3
|
-
import * as Signal from '../Signal/Signal.js'
|
|
4
2
|
import { promisify } from 'node:util'
|
|
3
|
+
import * as Signal from '../Signal/Signal.js'
|
|
4
|
+
import { VError } from '../VError/VError.js'
|
|
5
5
|
|
|
6
6
|
const execFile = promisify(_execFile)
|
|
7
7
|
|
|
@@ -14,7 +14,6 @@ export const getPsOutput = async () => {
|
|
|
14
14
|
if (error && error.signal === Signal.SIGINT) {
|
|
15
15
|
return ''
|
|
16
16
|
}
|
|
17
|
-
// @ts-ignore
|
|
18
17
|
throw new VError(error, `Failed to execute ps`)
|
|
19
18
|
}
|
|
20
19
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import * as Os from 'node:os'
|
|
1
2
|
import * as Platform from '../Platform/Platform.js'
|
|
2
3
|
import * as ByteSize from '../ByteSize/ByteSize.js'
|
|
3
|
-
import * as Os from 'node:os'
|
|
4
4
|
|
|
5
5
|
const UiStrings = {
|
|
6
6
|
OsVersion: 'Os Version',
|
|
@@ -11,7 +11,7 @@ const UiStrings = {
|
|
|
11
11
|
const visitVersion = {
|
|
12
12
|
key: UiStrings.OsVersion,
|
|
13
13
|
getValue() {
|
|
14
|
-
const version = Platform
|
|
14
|
+
const { version } = Platform
|
|
15
15
|
return version
|
|
16
16
|
},
|
|
17
17
|
}
|
|
@@ -24,9 +24,9 @@ const visitCpus = {
|
|
|
24
24
|
return ''
|
|
25
25
|
}
|
|
26
26
|
const firstCpu = cpus[0]
|
|
27
|
-
const model = firstCpu
|
|
27
|
+
const { model } = firstCpu
|
|
28
28
|
const cpuLength = cpus.length
|
|
29
|
-
const speed = firstCpu
|
|
29
|
+
const { speed } = firstCpu
|
|
30
30
|
return `${model} (${cpuLength} x ${speed})`
|
|
31
31
|
},
|
|
32
32
|
}
|
|
@@ -56,7 +56,7 @@ const combineVisitors = (visitors) => {
|
|
|
56
56
|
const longestKeyLength = getLongestKeyLength(visitors)
|
|
57
57
|
const result = []
|
|
58
58
|
for (const visitor of visitors) {
|
|
59
|
-
const key = visitor
|
|
59
|
+
const { key } = visitor
|
|
60
60
|
const value = visitor.getValue()
|
|
61
61
|
result.push(`${key}: ${value}`)
|
|
62
62
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import * as Assert from '../Assert/Assert.js'
|
|
2
1
|
import { fork } from 'node:child_process'
|
|
3
|
-
import * as
|
|
4
|
-
import * as FirstNodeWorkerEventType from '../FirstNodeWorkerEventType/FirstNodeWorkerEventType.js'
|
|
2
|
+
import * as Assert from '../Assert/Assert.js'
|
|
5
3
|
import { ChildProcessError } from '../ChildProcessError/ChildProcessError.js'
|
|
4
|
+
import * as FirstNodeWorkerEventType from '../FirstNodeWorkerEventType/FirstNodeWorkerEventType.js'
|
|
5
|
+
import * as GetFirstNodeChildProcessEvent from '../GetFirstNodeChildProcessEvent/GetFirstNodeChildProcessEvent.js'
|
|
6
6
|
import { VError } from '../VError/VError.js'
|
|
7
7
|
|
|
8
8
|
export const create = async ({ path, argv = [], env, execArgv = [], stdio = 'inherit', name = 'child process' }) => {
|
|
@@ -61,11 +61,11 @@ export const getSetupName = () => {
|
|
|
61
61
|
return 'Lvce-Setup'
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
export const version = '0.21.
|
|
64
|
+
export const version = '0.21.4'
|
|
65
65
|
|
|
66
|
-
export const commit = '
|
|
66
|
+
export const commit = 'f091269'
|
|
67
67
|
|
|
68
|
-
export const date = '2023-12-
|
|
68
|
+
export const date = '2023-12-18T23:35:44.000Z'
|
|
69
69
|
|
|
70
70
|
export const getVersion = () => {
|
|
71
71
|
return version
|
|
@@ -6,11 +6,11 @@ export const toTextSearchResult = (parsedLine, remaining, charsBefore, charsAfte
|
|
|
6
6
|
const parsedLineData = parsedLine.data
|
|
7
7
|
const lines = ParseRipGrepLines.parseRipGrepLines(parsedLineData)
|
|
8
8
|
const lineNumber = parsedLineData.line_number
|
|
9
|
-
const submatches = parsedLineData
|
|
9
|
+
const { submatches } = parsedLineData
|
|
10
10
|
const linesLength = lines.length
|
|
11
11
|
for (const submatch of submatches) {
|
|
12
12
|
const previewStart = Math.max(submatch.start - charsBefore, 0)
|
|
13
|
-
|
|
13
|
+
const actualStart = previewStart
|
|
14
14
|
const previewEnd = Math.min(submatch.end + charsAfter, linesLength)
|
|
15
15
|
const previewText = lines.slice(actualStart, previewEnd)
|
|
16
16
|
results.push({
|