@lvce-editor/shared-process 0.121.15 → 0.121.17
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/EditorTransfer/EditorTransfer.js +65 -0
- package/src/parts/ElectronWindow/ElectronWindow.ipc.js +3 -0
- package/src/parts/ElectronWindow/ElectronWindow.js +2 -0
- package/src/parts/GetElectronFileResponseContent/GetElectronFileResponseContent.js +3 -2
- package/src/parts/ModuleMap/ModuleMap.js +3 -0
- package/src/parts/Platform/Platform.js +3 -3
- package/src/parts/PreloadUrl/PreloadUrl.js +1 -1
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', '5f3fc25', 'extensions')
|
|
7
7
|
return builtinExtensionsPath
|
|
8
8
|
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto'
|
|
2
|
+
import * as AppWindow from '../AppWindow/AppWindow.js'
|
|
3
|
+
import * as DefaultUrl from '../DefaultUrl/DefaultUrl.js'
|
|
4
|
+
import * as ParentIpc from '../MainProcess/MainProcess.js'
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
const transfers = new Map ()
|
|
15
|
+
|
|
16
|
+
export const openNewWithEditorInput = async (sourceWindowId, payload) => {
|
|
17
|
+
if (!payload?.editorInput || typeof payload.editorInput.type !== 'string') {
|
|
18
|
+
throw new TypeError('Expected an editor input')
|
|
19
|
+
}
|
|
20
|
+
const token = randomUUID()
|
|
21
|
+
let timer
|
|
22
|
+
let transfer
|
|
23
|
+
const ready = new Promise ((resolve, reject) => {
|
|
24
|
+
transfer = { payload, reject, resolve, sourceWindowId }
|
|
25
|
+
transfers.set(token, transfer)
|
|
26
|
+
timer = setTimeout(() => reject(new Error('Timed out opening the detached editor')), 60_000)
|
|
27
|
+
})
|
|
28
|
+
const url = new URL(DefaultUrl.defaultUrl)
|
|
29
|
+
url.searchParams.set('editorTransfer', token)
|
|
30
|
+
if (payload.workspaceUri) url.searchParams.set('workspace', payload.workspaceUri)
|
|
31
|
+
try {
|
|
32
|
+
await Promise.all([AppWindow.openNew(url.toString()), ready])
|
|
33
|
+
return transfer .destinationWindowId
|
|
34
|
+
} catch (error) {
|
|
35
|
+
// Keep the source tab and dispose the failed destination if it connected.
|
|
36
|
+
if (transfer .destinationWindowId !== undefined) {
|
|
37
|
+
await ParentIpc.invoke('ElectronWindow.executeWindowFunction', transfer .destinationWindowId, 'close')
|
|
38
|
+
}
|
|
39
|
+
throw error
|
|
40
|
+
} finally {
|
|
41
|
+
clearTimeout(timer)
|
|
42
|
+
transfers.delete(token)
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export const takeEditorTransfer = (windowId, token) => {
|
|
47
|
+
const transfer = transfers.get(token)
|
|
48
|
+
if (!transfer || windowId === transfer.sourceWindowId || transfer.destinationWindowId !== undefined) {
|
|
49
|
+
throw new Error('Editor transfer is no longer available')
|
|
50
|
+
}
|
|
51
|
+
transfer.destinationWindowId = windowId
|
|
52
|
+
return transfer.payload
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export const completeEditorTransfer = (windowId, token, errorMessage) => {
|
|
56
|
+
const transfer = transfers.get(token)
|
|
57
|
+
if (!transfer || transfer.destinationWindowId !== windowId) {
|
|
58
|
+
throw new Error('Editor transfer is no longer available')
|
|
59
|
+
}
|
|
60
|
+
if (errorMessage) {
|
|
61
|
+
transfer.reject(new Error(errorMessage))
|
|
62
|
+
} else {
|
|
63
|
+
transfer.resolve()
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -4,14 +4,17 @@ export const name = 'ElectronWindow'
|
|
|
4
4
|
|
|
5
5
|
export const Commands = {
|
|
6
6
|
close: ElectronWindow.close,
|
|
7
|
+
completeEditorTransfer: ElectronWindow.completeEditorTransfer,
|
|
7
8
|
focus: ElectronWindow.focus,
|
|
8
9
|
getZoom: ElectronWindow.getZoom,
|
|
9
10
|
maximize: ElectronWindow.maximize,
|
|
10
11
|
minimize: ElectronWindow.minimize,
|
|
11
12
|
openNew: ElectronWindow.openNew,
|
|
13
|
+
openNewWithEditorInput: ElectronWindow.openNewWithEditorInput,
|
|
12
14
|
openNewWithUri: ElectronWindow.openNewWithUri,
|
|
13
15
|
reload: ElectronWindow.reload,
|
|
14
16
|
setBrowserFullWidthGestureEnabled: ElectronWindow.setBrowserFullWidthGestureEnabled,
|
|
17
|
+
takeEditorTransfer: ElectronWindow.takeEditorTransfer,
|
|
15
18
|
toggleDevtools: ElectronWindow.toggleDevtools,
|
|
16
19
|
toggleFullScreen: ElectronWindow.toggleFullScreen,
|
|
17
20
|
toggleMaximize: ElectronWindow.toggleMaximize,
|
|
@@ -131,3 +131,5 @@ export const setBrowserFullWidthGestureEnabled = (windowId, enabled) => {
|
|
|
131
131
|
enabled ? 'enableBrowserFullWidthGesture' : 'disableBrowserFullWidthGesture',
|
|
132
132
|
)
|
|
133
133
|
}
|
|
134
|
+
|
|
135
|
+
export { openNewWithEditorInput, takeEditorTransfer, completeEditorTransfer } from '../EditorTransfer/EditorTransfer.js'
|
|
@@ -34,12 +34,13 @@ export const getElectronFileResponseContent = async (request, absolutePath, url,
|
|
|
34
34
|
return newContentBuffer
|
|
35
35
|
}
|
|
36
36
|
let content = await readFile(absolutePath)
|
|
37
|
-
|
|
37
|
+
const isAppIndex = typeof url === 'string' && (url === '/' || (url.startsWith(`${Platform.scheme}://-/`) && new URL(url).pathname === '/'))
|
|
38
|
+
if (!Platform.isProduction && isAppIndex) {
|
|
38
39
|
// @ts-ignore
|
|
39
40
|
content = content.toString().replace(' <link rel="manifest" href="/manifest.json" crossorigin="use-credentials" />\n', '')
|
|
40
41
|
content = await AddCustomPathsToIndexHtml.addCustomPathsToIndexHtml(content, { platform: 'electron' })
|
|
41
42
|
}
|
|
42
|
-
if (
|
|
43
|
+
if (Platform.isProduction && isAppIndex) {
|
|
43
44
|
content = await AddCustomPathsToIndexHtml.addCustomPathsToIndexHtml(content, { platform: 'electron' })
|
|
44
45
|
}
|
|
45
46
|
if (typeof content === 'string') {
|
|
@@ -83,14 +83,17 @@ export const getModuleId = (commandId) => {
|
|
|
83
83
|
case 'ElectronProcess.writeStdout':
|
|
84
84
|
return ModuleId.ElectronProcess
|
|
85
85
|
case 'ElectronWindow.close':
|
|
86
|
+
case 'ElectronWindow.completeEditorTransfer':
|
|
86
87
|
case 'ElectronWindow.focus':
|
|
87
88
|
case 'ElectronWindow.getZoom':
|
|
88
89
|
case 'ElectronWindow.maximize':
|
|
89
90
|
case 'ElectronWindow.minimize':
|
|
90
91
|
case 'ElectronWindow.openNew':
|
|
92
|
+
case 'ElectronWindow.openNewWithEditorInput':
|
|
91
93
|
case 'ElectronWindow.openNewWithUri':
|
|
92
94
|
case 'ElectronWindow.reload':
|
|
93
95
|
case 'ElectronWindow.setBrowserFullWidthGestureEnabled':
|
|
96
|
+
case 'ElectronWindow.takeEditorTransfer':
|
|
94
97
|
case 'ElectronWindow.toggleDevtools':
|
|
95
98
|
case 'ElectronWindow.toggleFullScreen':
|
|
96
99
|
case 'ElectronWindow.toggleMaximize':
|
|
@@ -56,11 +56,11 @@ export const getSetupName = () => {
|
|
|
56
56
|
return 'Lvce-Setup'
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
export const version = '0.121.
|
|
59
|
+
export const version = '0.121.17'
|
|
60
60
|
|
|
61
|
-
export const commit = '
|
|
61
|
+
export const commit = '5f3fc25'
|
|
62
62
|
|
|
63
|
-
export const date = '2026-10-
|
|
63
|
+
export const date = '2026-10-09T22:26:15.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', '5f3fc25', 'packages', 'preload', 'dist', 'index.js')
|
|
6
6
|
}
|