@lvce-editor/shared-process 0.103.9 → 0.103.10

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.103.9",
3
+ "version": "0.103.10",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -18,7 +18,7 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "@lvce-editor/assert": "1.9.0",
21
- "@lvce-editor/extension-host-helper-process": "0.103.9",
21
+ "@lvce-editor/extension-host-helper-process": "0.103.10",
22
22
  "@lvce-editor/ipc": "16.11.0",
23
23
  "@lvce-editor/json-rpc": "8.6.0",
24
24
  "@lvce-editor/jsonc-parser": "1.5.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', '72acf91', 'extensions')
6
+ const builtinExtensionsPath = join(staticServerPath, '..', '..', 'static', 'ffb9403', 'extensions')
7
7
  return builtinExtensionsPath
8
8
  }
@@ -34,7 +34,7 @@ const addExtensionDisabledStatus = (uniqueExtensions, disabledExtensionIds) => {
34
34
  return uniqueExtensions.map((extension) => {
35
35
  return {
36
36
  ...extension,
37
- disabled: disabledExtensionIds.includes(extension.id),
37
+ disabled: extension.disabled === true || disabledExtensionIds.includes(extension.id),
38
38
  isBuiltin: isBuiltin(extension),
39
39
  }
40
40
  })
@@ -1,6 +1,31 @@
1
+ import * as ExtensionHostHelperProcessIpc from '../ExtensionHostHelperProcessIpc/ExtensionHostHelperProcessIpc.js'
1
2
  import * as HandleIncomingIpc from '../HandleIncomingIpc/HandleIncomingIpc.js'
3
+ import * as HandleIpc from '../HandleIpc/HandleIpc.js'
2
4
  import * as IpcId from '../IpcId/IpcId.js'
5
+ import * as IpcParentType from '../IpcParentType/IpcParentType.js'
6
+ import * as JsonRpc from '../JsonRpc/JsonRpc.js'
7
+ import * as ResolveExtensionNodeRpcPath from '../ResolveExtensionNodeRpcPath/ResolveExtensionNodeRpcPath.js'
3
8
 
4
- export const handleWebSocket = (message, handle) => {
5
- return HandleIncomingIpc.handleIncomingIpc(IpcId.ExtensionHostHelperProcess, handle, message)
9
+ export const handleWebSocket = async (message, handle) => {
10
+ const url = new URL(message.url, 'http://localhost')
11
+ const extensionId = url.searchParams.get('extensionId')
12
+ const rpcId = url.searchParams.get('rpcId')
13
+ if (!extensionId && !rpcId) {
14
+ return HandleIncomingIpc.handleIncomingIpc(IpcId.ExtensionHostHelperProcess, handle, message)
15
+ }
16
+ if (!extensionId || !rpcId) {
17
+ throw new Error('Remote extension node rpc request is incomplete')
18
+ }
19
+ const modulePath = await ResolveExtensionNodeRpcPath.resolveExtensionNodeRpcPath(extensionId, rpcId)
20
+ const ipc = await ExtensionHostHelperProcessIpc.create({
21
+ method: IpcParentType.NodeForkedProcess,
22
+ })
23
+ HandleIpc.handleIpc(ipc)
24
+ try {
25
+ await JsonRpc.invoke(ipc, 'LoadFile.loadFile', modulePath)
26
+ await JsonRpc.invokeAndTransfer(ipc, 'HandleWebSocket.handleWebSocket', handle, message)
27
+ } catch (error) {
28
+ ipc.dispose()
29
+ throw error
30
+ }
6
31
  }
@@ -61,11 +61,11 @@ export const getSetupName = () => {
61
61
  return 'Lvce-Setup'
62
62
  }
63
63
 
64
- export const version = '0.103.9'
64
+ export const version = '0.103.10'
65
65
 
66
- export const commit = '72acf91'
66
+ export const commit = 'ffb9403'
67
67
 
68
- export const date = '2026-08-16T14:55:12.000Z'
68
+ export const date = '2026-08-16T15:11:25.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', '72acf91', 'packages', 'preload', 'dist', 'index.js')
5
+ return join(Root.root, 'static', 'ffb9403', 'packages', 'preload', 'dist', 'index.js')
6
6
  }
@@ -0,0 +1,40 @@
1
+ import { readFile, realpath } from 'node:fs/promises'
2
+ import path from 'node:path'
3
+
4
+ const idRegex = /^[A-Za-z0-9][A-Za-z0-9._-]*$/
5
+ const schemeRegex = /^[A-Za-z][A-Za-z\d+.-]*:/
6
+
7
+ const isInside = (parent, child) => child === parent || child.startsWith(`${parent}${path.sep}`)
8
+
9
+ const validateId = (value, name) => {
10
+ if (!idRegex.test(value)) {
11
+ throw new Error(`Invalid extension node rpc ${name}`)
12
+ }
13
+ }
14
+
15
+ export const resolveExtensionNodeRpcPath = async (extensionId, rpcId) => {
16
+ validateId(extensionId, 'extension id')
17
+ validateId(rpcId, 'rpc id')
18
+ const configuredRoot = process.env.LVCE_REMOTE_EXTENSIONS_PATH
19
+ if (!configuredRoot) {
20
+ throw new Error('Remote extensions path is unavailable')
21
+ }
22
+ const extensionsRoot = await realpath(configuredRoot)
23
+ const extensionRoot = await realpath(path.join(extensionsRoot, extensionId))
24
+ if (!isInside(extensionsRoot, extensionRoot)) {
25
+ throw new Error('Extension path escapes the remote extensions root')
26
+ }
27
+ const manifest = JSON.parse(await readFile(path.join(extensionRoot, 'extension.json'), 'utf8'))
28
+ const rpc = manifest.rpc?.find((candidate) => candidate?.id === rpcId)
29
+ if (!rpc || rpc.type !== 'node' || typeof rpc.url !== 'string') {
30
+ throw new Error(`Node rpc ${rpcId} is not declared by extension ${extensionId}`)
31
+ }
32
+ if (!rpc.url || path.isAbsolute(rpc.url) || schemeRegex.test(rpc.url)) {
33
+ throw new Error(`Node rpc ${rpcId} must use a relative url`)
34
+ }
35
+ const modulePath = await realpath(path.resolve(extensionRoot, rpc.url))
36
+ if (!isInside(extensionRoot, modulePath)) {
37
+ throw new Error('Extension node rpc path escapes the extension root')
38
+ }
39
+ return modulePath
40
+ }
@@ -1234,7 +1234,7 @@
1234
1234
  {
1235
1235
  "id": "processExplorer",
1236
1236
  "fileName": "process-explorer-worker/index.js",
1237
- "contentSecurityPolicy": ["default-src 'none'", "connect-src 'self'"],
1237
+ "contentSecurityPolicy": ["default-src 'none'", "connect-src 'self' ws://127.0.0.1:* ws://localhost:*"],
1238
1238
  "defaultPath": "/packages/renderer-worker/node_modules/@lvce-editor/process-explorer-worker/index.js",
1239
1239
  "productionPath": "/packages/process-explorer-worker/index.js",
1240
1240
  "settingName": "develop.processExplorerWorkerPath",
@@ -1540,7 +1540,7 @@
1540
1540
  {
1541
1541
  "id": "terminalWorker",
1542
1542
  "fileName": "terminalWorkerMain.js",
1543
- "contentSecurityPolicy": ["default-src 'none'", "connect-src 'self'", "script-src 'self'"],
1543
+ "contentSecurityPolicy": ["default-src 'none'", "connect-src 'self' ws://127.0.0.1:* ws://localhost:*", "script-src 'self'"],
1544
1544
  "defaultPath": "/packages/renderer-worker/node_modules/@lvce-editor/terminal-worker/dist/terminalWorkerMain.js",
1545
1545
  "productionPath": "/packages/terminal-worker/dist/terminalWorkerMain.js",
1546
1546
  "settingName": "develop.terminalWorkerPath",
@@ -1571,7 +1571,7 @@
1571
1571
  "productionPath": "/packages/text-search-worker/dist/textSearchWorkerMain.js",
1572
1572
  "settingName": "develop.textSearchWorkerPath",
1573
1573
  "hotReloadCommand": "Search.hotReload",
1574
- "contentSecurityPolicy": ["default-src 'none'", "connect-src 'self'", "sandbox allow-same-origin"]
1574
+ "contentSecurityPolicy": ["default-src 'none'", "connect-src 'self' ws://127.0.0.1:* ws://localhost:*", "sandbox allow-same-origin"]
1575
1575
  },
1576
1576
  {
1577
1577
  "id": "titleBar",