@lvce-editor/shared-process 0.108.19 → 0.108.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/package.json +1 -1
- package/src/parts/BuiltinExtensionsPath/BuiltinExtensionsPath.js +1 -1
- package/src/parts/ExtensionManagement/ExtensionManagement.ipc.js +1 -0
- package/src/parts/ExtensionManagement/ExtensionManagement.js +4 -0
- package/src/parts/FileWatcher/FileWatcher.js +2 -1
- package/src/parts/GetHelpString/GetHelpString.js +1 -0
- package/src/parts/HandleElectronReady/HandleElectronReady.js +3 -1
- package/src/parts/LinkedExtensionDevServers/LinkedExtensionDevServers.js +74 -0
- package/src/parts/Platform/Platform.js +3 -3
- package/src/parts/PreloadUrl/PreloadUrl.js +1 -1
- package/src/parts/TransientLinkedExtensions/TransientLinkedExtensions.js +12 -0
package/package.json
CHANGED
|
@@ -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', '3efcdf3', 'extensions')
|
|
7
7
|
return builtinExtensionsPath
|
|
8
8
|
}
|
|
@@ -19,5 +19,6 @@ export const Commands = {
|
|
|
19
19
|
'ExtensionManagement.getAllExtensions': ExtensionManagement.getExtensions,
|
|
20
20
|
'ExtensionManagement.getExtensions': ExtensionManagement.getExtensions,
|
|
21
21
|
'ExtensionManagement.getExtensionsEtag': ExtensionManagement.getExtensionsEtag,
|
|
22
|
+
'ExtensionManagement.getLinkedExtensionDevelopmentConfig': ExtensionManagement.getLinkedExtensionDevelopmentConfig,
|
|
22
23
|
'ExtensionManagement.uninstall': ExtensionManagement.uninstall,
|
|
23
24
|
}
|
|
@@ -169,6 +169,10 @@ export const getExtensionsEtag = async () => {
|
|
|
169
169
|
return etag
|
|
170
170
|
}
|
|
171
171
|
|
|
172
|
+
export const getLinkedExtensionDevelopmentConfig = () => {
|
|
173
|
+
return TransientLinkedExtensions.getDevelopmentConfig()
|
|
174
|
+
}
|
|
175
|
+
|
|
172
176
|
export const getDisabledExtensions = () => {
|
|
173
177
|
return ExtensionManifests.getAll(
|
|
174
178
|
[
|
|
@@ -26,7 +26,7 @@ const removeCloseListener = (ipc, listener) => {
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
export const watch = async (ipc, id, { exclude, roots } ) => {
|
|
29
|
+
export const watch = async (ipc, id, { exclude, roots, useGitIgnore } ) => {
|
|
30
30
|
const internalId = Id.create()
|
|
31
31
|
const handleClose = async () => {
|
|
32
32
|
removeCloseListener(ipc, handleClose)
|
|
@@ -39,6 +39,7 @@ export const watch = async (ipc, id, { exclude, roots } ) => {
|
|
|
39
39
|
exclude,
|
|
40
40
|
id: internalId,
|
|
41
41
|
roots,
|
|
42
|
+
...(useGitIgnore === undefined ? {} : { useGitIgnore }),
|
|
42
43
|
})
|
|
43
44
|
}
|
|
44
45
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as AppWindow from '../AppWindow/AppWindow.js'
|
|
2
2
|
import * as Assert from '../Assert/Assert.js'
|
|
3
3
|
import * as ExitCode from '../ExitCode/ExitCode.js'
|
|
4
|
+
import * as LinkedExtensionDevServers from '../LinkedExtensionDevServers/LinkedExtensionDevServers.js'
|
|
4
5
|
import * as Logger from '../Logger/Logger.js'
|
|
5
6
|
import * as Preferences from '../Preferences/Preferences.js'
|
|
6
7
|
import * as PreloadUrl from '../PreloadUrl/PreloadUrl.js'
|
|
@@ -11,7 +12,8 @@ export const handleElectronReady = async (parsedArgs, workingDirectory) => {
|
|
|
11
12
|
Assert.object(parsedArgs)
|
|
12
13
|
Assert.string(workingDirectory)
|
|
13
14
|
try {
|
|
14
|
-
await TransientLinkedExtensions.validate()
|
|
15
|
+
const links = await TransientLinkedExtensions.validate()
|
|
16
|
+
await LinkedExtensionDevServers.startDevServers(links)
|
|
15
17
|
} catch (error) {
|
|
16
18
|
Logger.error(error)
|
|
17
19
|
Process.exit(ExitCode.Error)
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { spawn, } from 'node:child_process'
|
|
2
|
+
import { readFile } from 'node:fs/promises'
|
|
3
|
+
import * as Logger from '../Logger/Logger.js'
|
|
4
|
+
import * as Process from '../Process/Process.js'
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
const children = new Set ()
|
|
18
|
+
let exitListenerRegistered = false
|
|
19
|
+
|
|
20
|
+
const readPackageJson = async (path) => {
|
|
21
|
+
try {
|
|
22
|
+
const content = await readFile(`${path}/package.json`, 'utf8')
|
|
23
|
+
return JSON.parse(content)
|
|
24
|
+
} catch {
|
|
25
|
+
return undefined
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const spawnProcess = (command, args, options) => {
|
|
30
|
+
return spawn(command, args, options)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export const dispose = () => {
|
|
34
|
+
for (const child of children) {
|
|
35
|
+
child.kill()
|
|
36
|
+
}
|
|
37
|
+
children.clear()
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const registerExitListener = () => {
|
|
41
|
+
if (exitListenerRegistered) {
|
|
42
|
+
return
|
|
43
|
+
}
|
|
44
|
+
exitListenerRegistered = true
|
|
45
|
+
process.once('exit', dispose)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export const startDevServers = async (
|
|
49
|
+
links,
|
|
50
|
+
readPackage = readPackageJson,
|
|
51
|
+
spawnDevProcess = spawnProcess,
|
|
52
|
+
) => {
|
|
53
|
+
const uniquePaths = new Set(links.map((link) => link.resolvedPath))
|
|
54
|
+
for (const path of uniquePaths) {
|
|
55
|
+
const packageJson = await readPackage(path)
|
|
56
|
+
if (typeof packageJson?.scripts?.dev !== 'string') {
|
|
57
|
+
continue
|
|
58
|
+
}
|
|
59
|
+
const command = Process.platform === 'win32' ? 'npm.cmd' : 'npm'
|
|
60
|
+
const child = spawnDevProcess(command, ['run', 'dev'], {
|
|
61
|
+
cwd: path,
|
|
62
|
+
stdio: 'inherit',
|
|
63
|
+
})
|
|
64
|
+
children.add(child)
|
|
65
|
+
child.once('error', (error) => {
|
|
66
|
+
children.delete(child)
|
|
67
|
+
Logger.error(error)
|
|
68
|
+
})
|
|
69
|
+
child.once('exit', () => {
|
|
70
|
+
children.delete(child)
|
|
71
|
+
})
|
|
72
|
+
registerExitListener()
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -61,11 +61,11 @@ export const getSetupName = () => {
|
|
|
61
61
|
return 'Lvce-Setup'
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
export const version = '0.108.
|
|
64
|
+
export const version = '0.108.20'
|
|
65
65
|
|
|
66
|
-
export const commit = '
|
|
66
|
+
export const commit = '3efcdf3'
|
|
67
67
|
|
|
68
|
-
export const date = '2026-08-
|
|
68
|
+
export const date = '2026-08-24T23:48:59.000Z'
|
|
69
69
|
|
|
70
70
|
export const getVersion = () => {
|
|
71
71
|
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', '3efcdf3', 'packages', 'preload', 'dist', 'index.js')
|
|
6
6
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { pathToFileURL } from 'node:url'
|
|
1
2
|
import * as ErrorCodes from '../ErrorCodes/ErrorCodes.js'
|
|
2
3
|
import * as ExtensionManifest from '../ExtensionManifest/ExtensionManifest.js'
|
|
3
4
|
import * as ExtensionManifestStatus from '../ExtensionManifestStatus/ExtensionManifestStatus.js'
|
|
@@ -46,6 +47,17 @@ export const getLinkedExtensions = () => {
|
|
|
46
47
|
})
|
|
47
48
|
}
|
|
48
49
|
|
|
50
|
+
export const getDevelopmentConfig = () => {
|
|
51
|
+
const extensions = getLinkedExtensions().map((link) => ({
|
|
52
|
+
path: link.resolvedPath,
|
|
53
|
+
uri: pathToFileURL(link.resolvedPath).toString(),
|
|
54
|
+
}))
|
|
55
|
+
return {
|
|
56
|
+
extensions,
|
|
57
|
+
hotReload: Process.argv.includes('--hot-reload') && extensions.length > 0,
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
49
61
|
const createMissingPathError = (link) => {
|
|
50
62
|
const error = new Error(`Failed to start: ${link.source} requires a folder path`)
|
|
51
63
|
// @ts-ignore
|