@lvce-editor/shared-process 0.94.6 → 0.94.7

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.94.6",
3
+ "version": "0.94.7",
4
4
  "main": "index.js",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -19,7 +19,7 @@
19
19
  "dependencies": {
20
20
  "@lvce-editor/assert": "1.7.0",
21
21
  "@lvce-editor/auth-process": "1.12.0",
22
- "@lvce-editor/extension-host-helper-process": "0.94.6",
22
+ "@lvce-editor/extension-host-helper-process": "0.94.7",
23
23
  "@lvce-editor/ipc": "16.6.0",
24
24
  "@lvce-editor/json-rpc": "8.5.0",
25
25
  "@lvce-editor/jsonc-parser": "1.5.0",
@@ -1,3 +1,5 @@
1
+ import { isAbsolute, resolve } from 'node:path'
2
+ import { fileURLToPath, pathToFileURL } from 'node:url'
1
3
  import * as DefaultUrl from '../DefaultUrl/DefaultUrl.js'
2
4
  import * as GetAppWindowOptions from '../GetAppWindowOptions/GetAppWindowOptions.js'
3
5
  import * as GetTitleBarItems from '../GetTitleBarItems/GetTitleBarItems.js'
@@ -23,8 +25,29 @@ const getValidatedAppUrl = (url) => {
23
25
  return parsedUrl.toString()
24
26
  }
25
27
 
28
+ const getWorkspaceUri = (parsedArgs, workingDirectory) => {
29
+ const path = parsedArgs?._?.at(-1)
30
+ if (!path || typeof path !== 'string') {
31
+ return ''
32
+ }
33
+ if (path.startsWith('file://')) {
34
+ return pathToFileURL(fileURLToPath(path)).toString()
35
+ }
36
+ const absolutePath = isAbsolute(path) ? path : resolve(workingDirectory, path)
37
+ return pathToFileURL(absolutePath).toString()
38
+ }
39
+
40
+ const getAppWindowUrl = (url, parsedArgs, workingDirectory) => {
41
+ const parsedUrl = new URL(getValidatedAppUrl(url))
42
+ const workspaceUri = getWorkspaceUri(parsedArgs, workingDirectory)
43
+ if (workspaceUri) {
44
+ parsedUrl.searchParams.set('workspace', workspaceUri)
45
+ }
46
+ return parsedUrl.toString()
47
+ }
48
+
26
49
  export const createAppWindow = async ({ parsedArgs, preferences, preloadUrl, url = DefaultUrl.defaultUrl, workingDirectory } ) => {
27
- const validatedUrl = getValidatedAppUrl(url)
50
+ const validatedUrl = getAppWindowUrl(url, parsedArgs, workingDirectory)
28
51
  const { height, width } = await Screen.getBounds()
29
52
  const windowOptions = await GetAppWindowOptions.getAppWindowOptions({
30
53
  preferences,
@@ -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', '632fa10', 'extensions')
6
+ const builtinExtensionsPath = join(staticServerPath, '..', '..', 'static', '1c9a69d', 'extensions')
7
7
  return builtinExtensionsPath
8
8
  }
@@ -61,11 +61,11 @@ export const getSetupName = () => {
61
61
  return 'Lvce-Setup'
62
62
  }
63
63
 
64
- export const version = '0.94.6'
64
+ export const version = '0.94.7'
65
65
 
66
- export const commit = '632fa10'
66
+ export const commit = '1c9a69d'
67
67
 
68
- export const date = '2026-07-26T13:00:34.000Z'
68
+ export const date = '2026-07-26T15:07:02.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', '632fa10', 'packages', 'preload', 'dist', 'index.js')
5
+ return join(Root.root, 'static', '1c9a69d', 'packages', 'preload', 'dist', 'index.js')
6
6
  }
@@ -1,6 +1,6 @@
1
1
  import { homedir } from 'node:os'
2
2
  import { isAbsolute, join, resolve } from 'node:path'
3
- import { pathToFileURL } from 'node:url'
3
+ import { fileURLToPath, pathToFileURL } from 'node:url'
4
4
  import * as Env from '../Env/Env.js'
5
5
  import * as GetWorkspaceId from '../GetWorkspaceId/GetWorkspaceId.js'
6
6
  import * as IsAbsolutePath from '../IsAbsolutePath/IsAbsolutePath.js'
@@ -30,8 +30,31 @@ const toUri = (path) => {
30
30
  return pathToFileURL(path).toString()
31
31
  }
32
32
 
33
- export const resolveRoot = async () => {
33
+ const getWindowWorkspacePath = (href) => {
34
+ if (!href) {
35
+ return ''
36
+ }
37
+ const workspaceUri = new URL(href).searchParams.get('workspace')
38
+ if (!workspaceUri) {
39
+ return ''
40
+ }
41
+ return fileURLToPath(workspaceUri)
42
+ }
43
+
44
+ export const resolveRoot = async (href = '') => {
34
45
  if (IsElectron.isElectron) {
46
+ const windowWorkspacePath = getWindowWorkspacePath(href)
47
+ if (windowWorkspacePath) {
48
+ return {
49
+ homeDir: PlatformPaths.getHomeDir(),
50
+ homeDirUri: toUri(PlatformPaths.getHomeDir()),
51
+ path: windowWorkspacePath,
52
+ pathSeparator: Platform.getPathSeparator(),
53
+ source: WorkspaceSource.SharedProcessCliArg,
54
+ uri: toUri(windowWorkspacePath),
55
+ workspaceId: GetWorkspaceId.getWorkspaceId(windowWorkspacePath),
56
+ }
57
+ }
35
58
  const argv = await ParentIpc.invoke('Process.getArgv')
36
59
  const relevantArgv = argv.slice(1)
37
60
  const last = relevantArgv.at(-1)