@lvce-editor/shared-process 0.122.16 → 0.122.18
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 +2 -2
- package/src/parts/BuiltinExtensionsPath/BuiltinExtensionsPath.js +1 -1
- package/src/parts/FileWatcher/FileWatcher.js +2 -1
- package/src/parts/FileWatcherProcess/FileWatcherProcess.js +44 -1
- package/src/parts/Platform/Platform.js +3 -3
- package/src/parts/PreloadUrl/PreloadUrl.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lvce-editor/shared-process",
|
|
3
|
-
"version": "0.122.
|
|
3
|
+
"version": "0.122.18",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@lvce-editor/cookie-import-view": "0.3.2",
|
|
35
35
|
"@lvce-editor/embeds-process": "4.25.0",
|
|
36
36
|
"@lvce-editor/file-system-process": "5.17.1",
|
|
37
|
-
"@lvce-editor/file-watcher-process": "4.
|
|
37
|
+
"@lvce-editor/file-watcher-process": "4.16.0",
|
|
38
38
|
"@lvce-editor/network-process": "5.2.0",
|
|
39
39
|
"@lvce-editor/preload": "1.5.1",
|
|
40
40
|
"@lvce-editor/preview-process": "11.0.0",
|
|
@@ -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', '7a31853', 'extensions')
|
|
7
7
|
return builtinExtensionsPath
|
|
8
8
|
}
|
|
@@ -26,7 +26,7 @@ const removeCloseListener = (ipc, listener) => {
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
export const watch = async (ipc, id, { depth, exclude, roots, useGitIgnore } ) => {
|
|
29
|
+
export const watch = async (ipc, id, { childNames, depth, exclude, roots, useGitIgnore } ) => {
|
|
30
30
|
const internalId = Id.create()
|
|
31
31
|
const handleClose = async () => {
|
|
32
32
|
removeCloseListener(ipc, handleClose)
|
|
@@ -40,6 +40,7 @@ export const watch = async (ipc, id, { depth, exclude, roots, useGitIgnore }
|
|
|
40
40
|
exclude,
|
|
41
41
|
id: internalId,
|
|
42
42
|
roots,
|
|
43
|
+
...(childNames === undefined ? {} : { childNames }),
|
|
43
44
|
...(depth === undefined ? {} : { depth }),
|
|
44
45
|
...(useGitIgnore === undefined ? {} : { useGitIgnore }),
|
|
45
46
|
})
|
|
@@ -2,6 +2,8 @@ import * as FileWatcher from '../FileWatcher/FileWatcher.js'
|
|
|
2
2
|
import * as JsonRpc from '../JsonRpc/JsonRpc.js'
|
|
3
3
|
import * as LaunchFileWatcherProcess from '../LaunchFileWatcherProcess/LaunchFileWatcherProcess.js'
|
|
4
4
|
|
|
5
|
+
const closedConnections = new WeakSet ()
|
|
6
|
+
|
|
5
7
|
export const state = {
|
|
6
8
|
/**
|
|
7
9
|
* @type {any}
|
|
@@ -13,6 +15,7 @@ export const getOrCreate = async () => {
|
|
|
13
15
|
if (!state.ipc) {
|
|
14
16
|
const pending = LaunchFileWatcherProcess.launchFileWatcherProcess().then((ipc) => {
|
|
15
17
|
const handleClose = () => {
|
|
18
|
+
closedConnections.add(ipc)
|
|
16
19
|
if (state.ipc !== pending) return
|
|
17
20
|
state.ipc = undefined
|
|
18
21
|
FileWatcher.handleProcessClose()
|
|
@@ -31,5 +34,45 @@ export const getOrCreate = async () => {
|
|
|
31
34
|
|
|
32
35
|
export const invoke = async (method, ...params) => {
|
|
33
36
|
const ipc = await getOrCreate()
|
|
34
|
-
|
|
37
|
+
if (closedConnections.has(ipc)) throw new Error('File watcher process disconnected')
|
|
38
|
+
const events = ipc.addEventListener ? ipc : ipc.port || ipc
|
|
39
|
+
const on = events.addEventListener ? events.addEventListener.bind(events) : events.on.bind(events)
|
|
40
|
+
const off = events.removeEventListener ? events.removeEventListener.bind(events) : events.off.bind(events)
|
|
41
|
+
let requestId
|
|
42
|
+
let pending = true
|
|
43
|
+
const fail = (error) => {
|
|
44
|
+
if (!pending || requestId === undefined) return
|
|
45
|
+
pending = false
|
|
46
|
+
JsonRpc.resolve(requestId, { error })
|
|
47
|
+
}
|
|
48
|
+
const handleClose = () => fail(new Error('File watcher process disconnected'))
|
|
49
|
+
const handleMessage = (event) => {
|
|
50
|
+
const message = event.data || event
|
|
51
|
+
if (message.id === requestId && !message.method) pending = false
|
|
52
|
+
}
|
|
53
|
+
on('close', handleClose)
|
|
54
|
+
on('message', handleMessage)
|
|
55
|
+
try {
|
|
56
|
+
return await JsonRpc.invoke(
|
|
57
|
+
{
|
|
58
|
+
send(message) {
|
|
59
|
+
requestId = message.id
|
|
60
|
+
if (closedConnections.has(ipc)) {
|
|
61
|
+
handleClose()
|
|
62
|
+
return
|
|
63
|
+
}
|
|
64
|
+
try {
|
|
65
|
+
ipc.send(message)
|
|
66
|
+
} catch (error) {
|
|
67
|
+
fail(error)
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
method,
|
|
72
|
+
...params,
|
|
73
|
+
)
|
|
74
|
+
} finally {
|
|
75
|
+
off('close', handleClose)
|
|
76
|
+
off('message', handleMessage)
|
|
77
|
+
}
|
|
35
78
|
}
|
|
@@ -56,11 +56,11 @@ export const getSetupName = () => {
|
|
|
56
56
|
return 'Lvce-Setup'
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
export const version = '0.122.
|
|
59
|
+
export const version = '0.122.18'
|
|
60
60
|
|
|
61
|
-
export const commit = '
|
|
61
|
+
export const commit = '7a31853'
|
|
62
62
|
|
|
63
|
-
export const date = '2026-10-
|
|
63
|
+
export const date = '2026-10-14T17:53:26.000Z'
|
|
64
64
|
|
|
65
65
|
export const getVersion = () => {
|
|
66
66
|
return version
|
|
@@ -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', '7a31853', 'packages', 'preload', 'dist', 'index.js')
|
|
6
6
|
}
|