@lvce-editor/shared-process 0.127.0 → 0.127.2
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 +1 -1
- package/src/parts/AuthProcess/AuthProcess.js +76 -9
- package/src/parts/BuiltinExtensionsPath/BuiltinExtensionsPath.js +1 -1
- package/src/parts/HandleIpcAuthProcess/HandleIpcAuthProcess.js +16 -9
- package/src/parts/HandleMessagePortForAuthProcess/HandleMessagePortForAuthProcess.js +3 -14
- package/src/parts/Platform/Platform.js +3 -3
- package/src/parts/Preferences/Preferences.js +2 -0
- package/src/parts/PreloadUrl/PreloadUrl.js +1 -1
- package/src/parts/AuthProcessState/AuthProcessState.js +0 -15
package/package.json
CHANGED
|
@@ -1,15 +1,82 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto'
|
|
2
|
+
import * as HandleIpc from '../HandleIpc/HandleIpc.js'
|
|
3
|
+
import * as JsonRpc from '../JsonRpc/JsonRpc.js'
|
|
1
4
|
import * as LaunchAuthProcess from '../LaunchAuthProcess/LaunchAuthProcess.js'
|
|
2
5
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
let current
|
|
12
|
+
const connections = new Map ()
|
|
13
|
+
|
|
14
|
+
const forget = (generation) => {
|
|
15
|
+
if (current === generation) {
|
|
16
|
+
current = undefined
|
|
17
|
+
}
|
|
18
|
+
for (const id of generation.connections) {
|
|
19
|
+
connections.delete(id)
|
|
20
|
+
}
|
|
21
|
+
generation.connections.clear()
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const getGeneration = () => {
|
|
25
|
+
if (!current) {
|
|
26
|
+
const generation = { connections: new Set(), ipc: LaunchAuthProcess.launchAuthProcess() }
|
|
27
|
+
current = generation
|
|
28
|
+
void generation.ipc.then(
|
|
29
|
+
(ipc) => {
|
|
30
|
+
const handleClose = () => {
|
|
31
|
+
forget(generation)
|
|
32
|
+
HandleIpc.unhandleIpc(ipc)
|
|
33
|
+
}
|
|
34
|
+
if (ipc.addEventListener) {
|
|
35
|
+
ipc.addEventListener('close', handleClose, { once: true })
|
|
36
|
+
} else {
|
|
37
|
+
ipc.on('close', handleClose)
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
() => forget(generation),
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
return current
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export const acquire = async () => {
|
|
47
|
+
const generation = getGeneration()
|
|
48
|
+
const connectionId = randomUUID()
|
|
49
|
+
generation.connections.add(connectionId)
|
|
50
|
+
connections.set(connectionId, generation)
|
|
51
|
+
try {
|
|
52
|
+
const ipc = await generation.ipc
|
|
53
|
+
if (!generation.connections.has(connectionId)) {
|
|
54
|
+
throw new Error('Auth process closed while connecting')
|
|
55
|
+
}
|
|
56
|
+
return { connectionId, ipc }
|
|
57
|
+
} catch (error) {
|
|
58
|
+
release(connectionId)
|
|
59
|
+
throw error
|
|
60
|
+
}
|
|
8
61
|
}
|
|
9
62
|
|
|
10
|
-
export const
|
|
11
|
-
|
|
12
|
-
|
|
63
|
+
export const release = (connectionId) => {
|
|
64
|
+
const generation = connections.get(connectionId)
|
|
65
|
+
if (!generation) {
|
|
66
|
+
return
|
|
67
|
+
}
|
|
68
|
+
connections.delete(connectionId)
|
|
69
|
+
generation.connections.delete(connectionId)
|
|
70
|
+
if (generation.connections.size > 0) {
|
|
71
|
+
return
|
|
72
|
+
}
|
|
73
|
+
if (current === generation) {
|
|
74
|
+
current = undefined
|
|
13
75
|
}
|
|
14
|
-
|
|
76
|
+
// Let the close notification's response reach the child before terminating it.
|
|
77
|
+
setTimeout(() => {
|
|
78
|
+
// Address the old process through its own channel. Name-based utility-process
|
|
79
|
+
// disposal could kill a replacement that starts during shutdown.
|
|
80
|
+
void generation.ipc.then((ipc) => JsonRpc.send(ipc, 'AuthProcess.dispose')).catch(console.error)
|
|
81
|
+
}, 0)
|
|
15
82
|
}
|
|
@@ -3,6 +3,6 @@ import { fileURLToPath } from 'url'
|
|
|
3
3
|
|
|
4
4
|
export const getBuiltinExtensionsPath = () => {
|
|
5
5
|
const staticServerPath = fileURLToPath(import.meta.resolve('@lvce-editor/static-server'))
|
|
6
|
-
const builtinExtensionsPath = join(staticServerPath, '..', '..', 'static', '
|
|
6
|
+
const builtinExtensionsPath = join(staticServerPath, '..', '..', 'static', '376e853', 'extensions')
|
|
7
7
|
return builtinExtensionsPath
|
|
8
8
|
}
|
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
import * as AuthProcess from '../AuthProcess/AuthProcess.js'
|
|
2
|
+
import * as JsonRpc from '../JsonRpc/JsonRpc.js'
|
|
2
3
|
|
|
3
|
-
export const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
type: '
|
|
4
|
+
export const connectMessagePort = async (port, message) => {
|
|
5
|
+
let connectionId
|
|
6
|
+
try {
|
|
7
|
+
const connection = await AuthProcess.acquire()
|
|
8
|
+
connectionId = connection.connectionId
|
|
9
|
+
const { ipc } = connection
|
|
10
|
+
await JsonRpc.invokeAndTransfer(ipc, 'HandleMessagePort.handleMessagePort', port, message.ipcId, connectionId)
|
|
11
|
+
// Keep the parent channel handled so subsequent close notifications are received.
|
|
12
|
+
return { response: { type: 'handle' }, target: ipc }
|
|
13
|
+
} catch (error) {
|
|
14
|
+
if (connectionId) {
|
|
15
|
+
AuthProcess.release(connectionId)
|
|
16
|
+
}
|
|
17
|
+
port.close()
|
|
18
|
+
throw error
|
|
12
19
|
}
|
|
13
20
|
}
|
|
@@ -1,22 +1,11 @@
|
|
|
1
1
|
import * as AuthProcess from '../AuthProcess/AuthProcess.js'
|
|
2
|
-
import * as AuthProcessState from '../AuthProcessState/AuthProcessState.js'
|
|
3
2
|
import * as HandleIncomingIpc from '../HandleIncomingIpc/HandleIncomingIpc.js'
|
|
4
3
|
import * as IpcId from '../IpcId/IpcId.js'
|
|
5
4
|
|
|
6
5
|
export const handleMessagePortForAuthProcess = (port, ipcId) => {
|
|
7
|
-
|
|
8
|
-
return HandleIncomingIpc.handleIncomingIpc(IpcId.AuthProcess, port, {
|
|
9
|
-
ipcId,
|
|
10
|
-
})
|
|
6
|
+
return HandleIncomingIpc.handleIncomingIpc(IpcId.AuthProcess, port, { ipcId })
|
|
11
7
|
}
|
|
12
8
|
|
|
13
|
-
export const handleAuthProcessIpcClosed =
|
|
14
|
-
|
|
15
|
-
if (AuthProcessState.hasRef()) {
|
|
16
|
-
return
|
|
17
|
-
}
|
|
18
|
-
const promise = AuthProcess.state.ipc
|
|
19
|
-
AuthProcess.state.ipc = undefined
|
|
20
|
-
const ipc = await promise
|
|
21
|
-
ipc.dispose()
|
|
9
|
+
export const handleAuthProcessIpcClosed = (connectionId) => {
|
|
10
|
+
AuthProcess.release(connectionId)
|
|
22
11
|
}
|
|
@@ -56,11 +56,11 @@ export const getSetupName = () => {
|
|
|
56
56
|
return 'Lvce-Setup'
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
export const version = '0.127.
|
|
59
|
+
export const version = '0.127.2'
|
|
60
60
|
|
|
61
|
-
export const commit = '
|
|
61
|
+
export const commit = '376e853'
|
|
62
62
|
|
|
63
|
-
export const date = '2026-
|
|
63
|
+
export const date = '2026-11-01T21:19:34.000Z'
|
|
64
64
|
|
|
65
65
|
export const getVersion = () => {
|
|
66
66
|
return version
|
|
@@ -60,6 +60,8 @@ export const getOverrides = () => {
|
|
|
60
60
|
overrides['develop.processExplorerWorkerPath'] = argv.slice('--process-explorer-worker='.length)
|
|
61
61
|
} else if (argv.startsWith('--activity-bar-worker=')) {
|
|
62
62
|
overrides['develop.activityBarWorkerPath'] = argv.slice('--activity-bar-worker='.length)
|
|
63
|
+
} else if (argv.startsWith('--blob-worker=')) {
|
|
64
|
+
overrides['develop.blobWorkerPath'] = argv.slice('--blob-worker='.length)
|
|
63
65
|
} else if (argv === '--auth-worker-path' && argvSliced[index + 1]) {
|
|
64
66
|
overrides['develop.authWorkerPath'] = argvSliced[++index]
|
|
65
67
|
} else if (argv.startsWith('--auth-worker-path=')) {
|
|
@@ -2,5 +2,5 @@ import { join } from 'node:path'
|
|
|
2
2
|
import * as Root from '../Root/Root.js'
|
|
3
3
|
|
|
4
4
|
export const getPreloadUrl = () => {
|
|
5
|
-
return join(Root.root, 'static', '
|
|
5
|
+
return join(Root.root, 'static', '376e853', 'packages', 'preload', 'dist', 'index.js')
|
|
6
6
|
}
|