@lvce-editor/shared-process 0.122.14 → 0.122.16

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.122.14",
3
+ "version": "0.122.16",
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.14.0",
37
+ "@lvce-editor/file-watcher-process": "4.15.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', '592920b', 'extensions')
6
+ const builtinExtensionsPath = join(staticServerPath, '..', '..', 'static', 'ba63f0c', '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, { exclude, roots, useGitIgnore } ) => {
29
+ export const watch = async (ipc, id, { depth, exclude, roots, useGitIgnore } ) => {
30
30
  const internalId = Id.create()
31
31
  const handleClose = async () => {
32
32
  removeCloseListener(ipc, handleClose)
@@ -35,12 +35,26 @@ export const watch = async (ipc, id, { exclude, roots, useGitIgnore } ) => {
35
35
  }
36
36
  addCloseListener(ipc, handleClose)
37
37
  internalIdMap[internalId] = { handleClose, id, ipc }
38
- return FileWatcherProcess.invoke('FileWatcher.watchFolders', {
39
- exclude,
40
- id: internalId,
41
- roots,
42
- ...(useGitIgnore === undefined ? {} : { useGitIgnore }),
43
- })
38
+ try {
39
+ const result = await FileWatcherProcess.invoke('FileWatcher.watchFolders', {
40
+ exclude,
41
+ id: internalId,
42
+ roots,
43
+ ...(depth === undefined ? {} : { depth }),
44
+ ...(useGitIgnore === undefined ? {} : { useGitIgnore }),
45
+ })
46
+ if (!internalIdMap[internalId]) {
47
+ await disposeFileWatcher(internalId)
48
+ throw new Error('File watcher connection closed during registration')
49
+ }
50
+ if (result?.ok === false) {
51
+ await handleClose()
52
+ }
53
+ return result
54
+ } catch (error) {
55
+ await handleClose()
56
+ throw error
57
+ }
44
58
  }
45
59
 
46
60
  const disposeFileWatcher = async (internalId) => {
@@ -82,3 +96,16 @@ export const handleChange = (event) => {
82
96
  }
83
97
  handleEvents(ref.id, ref.ipc, event)
84
98
  }
99
+
100
+ export const handleProcessClose = () => {
101
+ for (const [internalId, ref] of Object.entries(internalIdMap)) {
102
+ const { handleClose, id, ipc } = ref
103
+ removeCloseListener(ipc, handleClose)
104
+ delete internalIdMap[internalId]
105
+ handleEvents(id, ipc, {
106
+ error: { message: 'File watcher process disconnected', name: 'Error' },
107
+ eventName: 'error',
108
+ uri: '',
109
+ })
110
+ }
111
+ }
@@ -1,3 +1,4 @@
1
+ import * as FileWatcher from '../FileWatcher/FileWatcher.js'
1
2
  import * as JsonRpc from '../JsonRpc/JsonRpc.js'
2
3
  import * as LaunchFileWatcherProcess from '../LaunchFileWatcherProcess/LaunchFileWatcherProcess.js'
3
4
 
@@ -10,7 +11,20 @@ export const state = {
10
11
 
11
12
  export const getOrCreate = async () => {
12
13
  if (!state.ipc) {
13
- state.ipc = LaunchFileWatcherProcess.launchFileWatcherProcess()
14
+ const pending = LaunchFileWatcherProcess.launchFileWatcherProcess().then((ipc) => {
15
+ const handleClose = () => {
16
+ if (state.ipc !== pending) return
17
+ state.ipc = undefined
18
+ FileWatcher.handleProcessClose()
19
+ }
20
+ if (ipc.addEventListener) ipc.addEventListener('close', handleClose)
21
+ else ipc.on('close', handleClose)
22
+ return ipc
23
+ })
24
+ state.ipc = pending
25
+ pending.catch(() => {
26
+ if (state.ipc === pending) state.ipc = undefined
27
+ })
14
28
  }
15
29
  return state.ipc
16
30
  }
@@ -56,11 +56,11 @@ export const getSetupName = () => {
56
56
  return 'Lvce-Setup'
57
57
  }
58
58
 
59
- export const version = '0.122.14'
59
+ export const version = '0.122.16'
60
60
 
61
- export const commit = '592920b'
61
+ export const commit = 'ba63f0c'
62
62
 
63
- export const date = '2026-10-14T00:18:11.000Z'
63
+ export const date = '2026-10-14T15:34:58.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', '592920b', 'packages', 'preload', 'dist', 'index.js')
5
+ return join(Root.root, 'static', 'ba63f0c', 'packages', 'preload', 'dist', 'index.js')
6
6
  }