@lvce-editor/shared-process 0.86.5 → 0.86.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/index.js +2 -2
- package/package.json +6 -6
- package/src/parts/AppWindow/AppWindow.js +5 -5
- package/src/parts/ApplyEdit/ApplyEdit.js +1 -1
- package/src/parts/ApplyIncomingIpcResponse/ApplyIncomingIpcResponse.js +13 -8
- package/src/parts/AutoUpdaterWindowsNsis/AutoUpdaterWindowsNsis.js +2 -2
- package/src/parts/BuiltinExtensionsPath/BuiltinExtensionsPath.js +1 -1
- package/src/parts/CliModule/CliModule.js +2 -2
- package/src/parts/ColorTheme/ColorTheme.js +1 -1
- package/src/parts/Command/Command.js +1 -1
- package/src/parts/Crash/Crash.js +1 -1
- package/src/parts/CreateTestOverviewHtml/CreateTestOverviewHtml.js +3 -1
- package/src/parts/DefaultUrl/DefaultUrl.js +1 -1
- package/src/parts/DownloadAndExtract/DownloadAndExtract.js +2 -2
- package/src/parts/ElectronInitialize/ElectronInitialize.js +1 -1
- package/src/parts/ElectronWindowProcessExplorer/ElectronWindowProcessExplorer.js +4 -4
- package/src/parts/ErrorHandling/ErrorHandling.js +1 -1
- package/src/parts/ExecCommand/ExecCommand.js +2 -2
- package/src/parts/ExportStatic/ExportStatic.js +35 -32
- package/src/parts/ExtensionHostHelperProcessIpc/ExtensionHostHelperProcessIpc.js +3 -3
- package/src/parts/ExtensionHostRpc/ExtensionHostRpc.js +4 -4
- package/src/parts/ExtensionInstall/ExtensionInstall.js +2 -2
- package/src/parts/ExtensionInstallFromGitHub/ExtensionInstallFromGitHub.js +2 -2
- package/src/parts/ExtensionInstallFromUrl/ExtensionInstallFromUrl.js +1 -1
- package/src/parts/ExtensionInstallParseInput/ExtensionInstallParseInput.js +5 -5
- package/src/parts/ExtensionList/ExtensionList.js +7 -7
- package/src/parts/ExtensionManagement/ExtensionManagement.ipc.js +3 -3
- package/src/parts/ExtensionManagement/ExtensionManagement.js +13 -13
- package/src/parts/ExtensionManifest/ExtensionManifest.js +3 -3
- package/src/parts/ExtensionManifests/ExtensionManifests.js +2 -2
- package/src/parts/ExtensionManifests/ExtensionManifestsFromFolder.js +1 -1
- package/src/parts/ExtensionManifests/ExtensionManifestsFromLinkedExtensionsFolder.js +1 -1
- package/src/parts/FileSystem/FileSystem.ipc.js +1 -1
- package/src/parts/FileSystem/FileSystem.js +2 -2
- package/src/parts/FileSystemDisk/FileSystemDisk.ipc.js +1 -1
- package/src/parts/FileSystemDisk/FileSystemDisk.js +3 -3
- package/src/parts/FileSystemProcess/FileSystemProcess.js +1 -1
- package/src/parts/FileWatcher/FileWatcher.ipc.js +1 -1
- package/src/parts/FileWatcher/FileWatcher.js +2 -2
- package/src/parts/GetAppWindowOptions/GetAppWindowOptions.js +9 -9
- package/src/parts/GetBrowserWindowOptions/GetBrowserWindowOptions.js +14 -14
- package/src/parts/GetContentResponse/GetContentResponse.js +1 -1
- package/src/parts/GetContentSecurityPolicy/GetContentSecurityPolicy.js +1 -1
- package/src/parts/GetExtensionEtags/GetExtensionEtags.js +1 -1
- package/src/parts/GetFirstEvent/GetFirstEvent.js +2 -2
- package/src/parts/GetFirstSpawnedProcessEvent/GetFirstSpawnedProcessEvent.js +1 -1
- package/src/parts/GetHeaders/GetHeaders.js +4 -4
- package/src/parts/GetMimeType/GetMimeType.js +10 -10
- package/src/parts/GetMultipleChoiceResponse/GetMultipleChoiceResponse.js +1 -1
- package/src/parts/GetNotFoundResponse/GetNotFoundResponse.js +1 -1
- package/src/parts/GetNotModifiedResponse/GetNotModifiedResponse.js +1 -1
- package/src/parts/GetServerErrorResponse/GetServerErrorResponse.js +1 -1
- package/src/parts/GetStatusString/GetStatusString.js +5 -5
- package/src/parts/GetTerminalSpawnOptions/GetTerminalSpawnOptions.js +3 -3
- package/src/parts/GetTestRequestResponse/GetTestRequestResponse.js +7 -7
- package/src/parts/GetTitleBarItems/GetTitleBarItems.js +4 -4
- package/src/parts/GetTransferrables/GetTransferrables.js +1 -1
- package/src/parts/GetWebViewsFromExtensions/GetWebViewsFromExtensions.js +2 -2
- package/src/parts/GitLsFiles/GitLsFiles.js +2 -2
- package/src/parts/HandleElectronMessagePort/HandleElectronMessagePort.js +1 -1
- package/src/parts/HandleElectronReady/HandleElectronReady.js +1 -1
- package/src/parts/HandleIncomingIpc/HandleIncomingIpc.js +8 -8
- package/src/parts/HandleIncomingIpcMessagePort/HandleIncomingIpcMessagePort.js +1 -1
- package/src/parts/HandleIncomingIpcWebSocket/HandleIncomingIpcWebSocket.js +1 -1
- package/src/parts/HandleIpcAuthProcess/HandleIpcAuthProcess.js +1 -1
- package/src/parts/HandleIpcClipBoardProcess/HandleIpcClipBoardProcess.js +2 -2
- package/src/parts/HandleIpcEmbedsProcess/HandleIpcEmbedsProcess.js +1 -1
- package/src/parts/HandleIpcExtensionHostHelperProcess/HandleIpcExtensionHostHelperProcess.js +2 -2
- package/src/parts/HandleIpcFileSystemProcess/HandleIpcFileSystemProcess.js +2 -2
- package/src/parts/HandleIpcFileWatcher/HandleIpcFileWatcher.js +3 -3
- package/src/parts/HandleIpcModule/HandleIpcModule.js +8 -8
- package/src/parts/HandleIpcProcessExplorer/HandleIpcProcessExplorer.js +3 -3
- package/src/parts/HandleIpcSearchProcess/HandleIpcSearchProcess.js +2 -2
- package/src/parts/HandleIpcSharedProcess/HandleIpcSharedProcess.js +2 -2
- package/src/parts/HandleIpcTerminalProcess/HandleIpcTerminalProcess.js +3 -3
- package/src/parts/HandleMessagePortForAuthProcess/HandleMessagePortForAuthProcess.ipc.js +1 -1
- package/src/parts/HandleMessagePortForEmbedsProcess/HandleMessagePortForEmbedsProcess.ipc.js +1 -1
- package/src/parts/HandleMessagePortForTerminalProcess/HandleMessagePortForTerminalProcess.js +1 -1
- package/src/parts/HandleNodeMessagePort/HandleNodeMessagePort.js +1 -1
- package/src/parts/HandleWebSocket/HandleWebSocket.js +1 -1
- package/src/parts/HandleWebSocketForUnknown/HandleWebSocketForUnknown.js +1 -1
- package/src/parts/HandleWebSocketModule/HandleWebSocketModule.js +8 -8
- package/src/parts/HeapSnapshot/HeapSnapshot.js +1 -1
- package/src/parts/IpcChildModule/IpcChildModule.js +6 -6
- package/src/parts/IpcChildWithNodeMessagePort/IpcChildWithNodeMessagePort.js +6 -6
- package/src/parts/IpcParentModule/IpcParentModule.js +4 -4
- package/src/parts/IpcParentWithElectronUtilityProcess/IpcParentWithElectronUtilityProcess.js +22 -22
- package/src/parts/Json/Json.js +1 -1
- package/src/parts/LaunchAuthProcess/LaunchAuthProcess.js +2 -2
- package/src/parts/LaunchClipBoardProcess/LaunchClipBoardProcess.js +2 -2
- package/src/parts/LaunchEmbedsProcess/LaunchEmbedsProcess.js +2 -2
- package/src/parts/LaunchFileSystemProcess/LaunchFileSystemProcess.js +2 -2
- package/src/parts/LaunchFileWatcherProcess/LaunchFileWatcherProcess.js +2 -2
- package/src/parts/LaunchPreviewProcess/LaunchPreviewProcess.js +2 -2
- package/src/parts/LaunchProcess/LaunchProcess.js +4 -4
- package/src/parts/LaunchProcessExplorer/LaunchProcessExplorer.js +1 -1
- package/src/parts/LaunchSearchProcess/LaunchSearchProcess.js +1 -1
- package/src/parts/LaunchTypeScriptCompileProcess/LaunchTypeScriptCompileProcess.js +6 -6
- package/src/parts/Main/Main.js +1 -1
- package/src/parts/Module/Module.js +56 -56
- package/src/parts/ModuleMap/ModuleMap.js +107 -107
- package/src/parts/NetworkProcess/NetworkProcess.js +1 -1
- package/src/parts/OutputChannel/OutputChannel.js +1 -1
- package/src/parts/ParseUrlGithub/ParseUrlGithub.js +9 -9
- package/src/parts/Performance/Performance.js +15 -15
- package/src/parts/Platform/Platform.js +3 -3
- package/src/parts/PlatformPaths/PlatformPaths.ipc.js +1 -1
- package/src/parts/PreloadUrl/PreloadUrl.js +1 -1
- package/src/parts/Process/Process.js +1 -1
- package/src/parts/Promises/Promises.js +2 -2
- package/src/parts/PtyHostState/PtyHostState.js +4 -4
- package/src/parts/Queue/Queue.js +2 -2
- package/src/parts/ResolveRoot/ResolveRoot.js +12 -12
- package/src/parts/Restart/Restart.js +1 -1
- package/src/parts/Screen/Screen.ipc.js +1 -1
- package/src/parts/SearchProcess/SearchProcess.js +1 -1
- package/src/parts/SendIncomingIpc/SendIncomingIpc.js +2 -2
- package/src/parts/TemporaryMessagePort/TemporaryMessagePort.js +1 -1
- package/src/parts/Terminal/Terminal.js +3 -3
- package/src/parts/TextDocument/TextDocument.js +1 -1
- package/src/parts/TranspileTypeScript/TranspileTypeScript.js +1 -1
- package/src/parts/TranspileTypeScriptCached/TranspileTypeScriptCached.js +1 -1
- package/src/parts/WaitForProcessToExit/WaitForProcessToExit.js +1 -1
- package/src/parts/WebViewServer/WebViewServer.ipc.js +2 -2
- package/src/parts/Workspace/Workspace.js +2 -2
package/index.js
CHANGED
|
@@ -25,7 +25,7 @@ const toAbsoluteExtensionPath = (root, extensionPath) => {
|
|
|
25
25
|
* @param {{extensionPath?: string, extensionPaths?: string[] | string, testPath?: string, root?: string}} [options]
|
|
26
26
|
*/
|
|
27
27
|
export const exportStatic = async (options = {}) => {
|
|
28
|
-
const { extensionPath, extensionPaths = [],
|
|
28
|
+
const { extensionPath, extensionPaths = [], root = '', testPath = '' } = options
|
|
29
29
|
if (!root) {
|
|
30
30
|
throw new Error(`root argument is required`)
|
|
31
31
|
}
|
|
@@ -35,5 +35,5 @@ export const exportStatic = async (options = {}) => {
|
|
|
35
35
|
const absoluteExtensionPath = toAbsoluteExtensionPath(root, defaultExtensionPath)
|
|
36
36
|
const absoluteExtensionPaths = extensionPathList.map((extensionPath) => toAbsoluteExtensionPath(root, extensionPath))
|
|
37
37
|
const pathPrefix = process.env.PATH_PREFIX || ''
|
|
38
|
-
return fn.exportStatic({
|
|
38
|
+
return fn.exportStatic({ extensionPath: absoluteExtensionPath, extensionPaths: absoluteExtensionPaths, pathPrefix, root, testPath })
|
|
39
39
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lvce-editor/shared-process",
|
|
3
|
-
"version": "0.86.
|
|
3
|
+
"version": "0.86.7",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -19,21 +19,21 @@
|
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@lvce-editor/assert": "1.7.0",
|
|
21
21
|
"@lvce-editor/auth-process": "1.8.0",
|
|
22
|
-
"@lvce-editor/extension-host-helper-process": "0.86.
|
|
23
|
-
"@lvce-editor/ipc": "16.
|
|
22
|
+
"@lvce-editor/extension-host-helper-process": "0.86.7",
|
|
23
|
+
"@lvce-editor/ipc": "16.3.0",
|
|
24
24
|
"@lvce-editor/json-rpc": "8.2.0",
|
|
25
25
|
"@lvce-editor/jsonc-parser": "1.5.0",
|
|
26
26
|
"@lvce-editor/pretty-error": "2.0.0",
|
|
27
27
|
"@lvce-editor/process-explorer": "3.8.0",
|
|
28
|
-
"@lvce-editor/rpc-registry": "9.
|
|
28
|
+
"@lvce-editor/rpc-registry": "9.33.0",
|
|
29
29
|
"@lvce-editor/verror": "1.7.0",
|
|
30
30
|
"is-object": "^1.0.2",
|
|
31
31
|
"xdg-basedir": "^5.1.0"
|
|
32
32
|
},
|
|
33
33
|
"optionalDependencies": {
|
|
34
|
-
"@lvce-editor/embeds-process": "4.
|
|
34
|
+
"@lvce-editor/embeds-process": "4.7.0",
|
|
35
35
|
"@lvce-editor/file-system-process": "5.3.0",
|
|
36
|
-
"@lvce-editor/file-watcher-process": "4.
|
|
36
|
+
"@lvce-editor/file-watcher-process": "4.2.0",
|
|
37
37
|
"@lvce-editor/network-process": "5.2.0",
|
|
38
38
|
"@lvce-editor/preload": "1.5.0",
|
|
39
39
|
"@lvce-editor/preview-process": "11.0.0",
|
|
@@ -23,14 +23,14 @@ const getValidatedAppUrl = (url) => {
|
|
|
23
23
|
return parsedUrl.toString()
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
export const createAppWindow = async ({
|
|
26
|
+
export const createAppWindow = async ({ parsedArgs, preferences, preloadUrl, url = DefaultUrl.defaultUrl, workingDirectory } ) => {
|
|
27
27
|
const validatedUrl = getValidatedAppUrl(url)
|
|
28
|
-
const {
|
|
28
|
+
const { height, width } = await Screen.getBounds()
|
|
29
29
|
const windowOptions = await GetAppWindowOptions.getAppWindowOptions({
|
|
30
30
|
preferences,
|
|
31
|
-
screenWidth: width,
|
|
32
|
-
screenHeight: height,
|
|
33
31
|
preloadUrl,
|
|
32
|
+
screenHeight: height,
|
|
33
|
+
screenWidth: width,
|
|
34
34
|
})
|
|
35
35
|
const titleBarItems = GetTitleBarItems.getTitleBarItems()
|
|
36
36
|
return ParentIpc.invoke('AppWindow.createAppWindow', windowOptions, parsedArgs, workingDirectory, titleBarItems, validatedUrl)
|
|
@@ -39,7 +39,7 @@ export const createAppWindow = async ({ preferences, parsedArgs, workingDirector
|
|
|
39
39
|
export const openNew = async (url) => {
|
|
40
40
|
const preferences = await Preferences.getAll()
|
|
41
41
|
const preloadUrl = PreloadUrl.getPreloadUrl()
|
|
42
|
-
return createAppWindow({
|
|
42
|
+
return createAppWindow({ parsedArgs: [], preferences, preloadUrl, url, workingDirectory: '' })
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
export const openNewWithUri = async (uri) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import * as FileSystem from '../FileSystem/FileSystem.js'
|
|
2
1
|
import * as BulkReplacementContent from '../BulkReplacementContent/BulkReplacementContent.js'
|
|
2
|
+
import * as FileSystem from '../FileSystem/FileSystem.js'
|
|
3
3
|
|
|
4
4
|
export const applyEdit = async (path, ranges, replacement) => {
|
|
5
5
|
const content = await FileSystem.readFile(path)
|
|
@@ -2,13 +2,18 @@ import * as HandleIpc from '../HandleIpc/HandleIpc.js'
|
|
|
2
2
|
import * as SendIncomingIpc from '../SendIncomingIpc/SendIncomingIpc.js'
|
|
3
3
|
|
|
4
4
|
export const applyIncomingIpcResponse = async (target, response, ipcId) => {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
try {
|
|
6
|
+
switch (response.type) {
|
|
7
|
+
case 'handle':
|
|
8
|
+
HandleIpc.handleIpc(target)
|
|
9
|
+
break
|
|
10
|
+
case 'send':
|
|
11
|
+
await SendIncomingIpc.sendIncomingIpc(target, response, ipcId)
|
|
12
|
+
break
|
|
13
|
+
default:
|
|
14
|
+
throw new Error('unexpected response')
|
|
15
|
+
}
|
|
16
|
+
} catch (error) {
|
|
17
|
+
return error
|
|
13
18
|
}
|
|
14
19
|
}
|
|
@@ -50,10 +50,10 @@ export const installAndRestart = async (downloadPath) => {
|
|
|
50
50
|
Logger.info(`[shared-process] spawning nsis update: ${downloadPath}`)
|
|
51
51
|
UpdateState.set(UpdateStateType.Updating)
|
|
52
52
|
const child = spawn(downloadPath, args, {
|
|
53
|
-
stdio: 'inherit',
|
|
54
53
|
detached: true,
|
|
54
|
+
stdio: 'inherit',
|
|
55
55
|
})
|
|
56
|
-
const {
|
|
56
|
+
const { event, type } = await GetFirstSpawnedProcessEvent.getFirstSpawnedProcessEvent(child)
|
|
57
57
|
if (type === FirstNodeWorkerEventType.Error) {
|
|
58
58
|
throw new Error(`Child process error: ${event}`)
|
|
59
59
|
}
|
|
@@ -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', '78bafe8', 'extensions')
|
|
7
7
|
return builtinExtensionsPath
|
|
8
8
|
}
|
|
@@ -16,10 +16,10 @@ export const getModule = (parsedArgs) => {
|
|
|
16
16
|
switch (argv0) {
|
|
17
17
|
case CliCommandType.Install:
|
|
18
18
|
return import('../CliInstall/CliInstall.js')
|
|
19
|
-
case CliCommandType.List:
|
|
20
|
-
return import('../CliList/CliList.js')
|
|
21
19
|
case CliCommandType.Link:
|
|
22
20
|
return import('../CliLink/CliLink.js')
|
|
21
|
+
case CliCommandType.List:
|
|
22
|
+
return import('../CliList/CliList.js')
|
|
23
23
|
case CliCommandType.Unlink:
|
|
24
24
|
return import('../CliUnlink/CliUnlink.js')
|
|
25
25
|
default:
|
package/src/parts/Crash/Crash.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
const testFileExtensionRegex = /\.(js|ts)$/
|
|
2
|
+
|
|
1
3
|
const isTestFile = (dirent) => {
|
|
2
4
|
if (dirent.startsWith('_')) {
|
|
3
5
|
return false
|
|
@@ -6,7 +8,7 @@ const isTestFile = (dirent) => {
|
|
|
6
8
|
}
|
|
7
9
|
|
|
8
10
|
const toTestName = (dirent) => {
|
|
9
|
-
return dirent.replace(
|
|
11
|
+
return dirent.replace(testFileExtensionRegex, '')
|
|
10
12
|
}
|
|
11
13
|
|
|
12
14
|
export const createTestOverviewHtml = (dirents) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as NetworkProcess from '../NetworkProcess/NetworkProcess.js'
|
|
2
2
|
|
|
3
|
-
export const downloadAndExtractTarGz = async ({
|
|
4
|
-
return NetworkProcess.invoke('Download.downloadAndExtractTarGz', {
|
|
3
|
+
export const downloadAndExtractTarGz = async ({ outDir, strip, url } ) => {
|
|
4
|
+
return NetworkProcess.invoke('Download.downloadAndExtractTarGz', { outDir, strip, url })
|
|
5
5
|
}
|
|
@@ -4,8 +4,8 @@ import * as IpcChildType from '../IpcChildType/IpcChildType.js'
|
|
|
4
4
|
|
|
5
5
|
export const electronInitialize = async (port, folder) => {
|
|
6
6
|
const ipc = await IpcChild.listen({
|
|
7
|
-
method: IpcChildType.NodeMessagePort,
|
|
8
7
|
messagePort: port,
|
|
8
|
+
method: IpcChildType.NodeMessagePort,
|
|
9
9
|
})
|
|
10
10
|
HandleIpc.handleIpc(ipc)
|
|
11
11
|
}
|
|
@@ -2,23 +2,23 @@ import { writeFile } from 'node:fs/promises'
|
|
|
2
2
|
import { tmpdir } from 'node:os'
|
|
3
3
|
import { join } from 'node:path'
|
|
4
4
|
import * as ColorTheme from '../ColorTheme/ColorTheme.js'
|
|
5
|
-
import * as PreloadUrl from '../PreloadUrl/PreloadUrl.js'
|
|
6
5
|
import * as GetProcessExplorerUrl from '../GetProcessExplorerUrl/GetProcessExplorerUrl.js'
|
|
7
6
|
import * as ParentIpc from '../MainProcess/MainProcess.js'
|
|
7
|
+
import * as PreloadUrl from '../PreloadUrl/PreloadUrl.js'
|
|
8
8
|
|
|
9
9
|
const getOptions = async (colorThemeJson) => {
|
|
10
10
|
const backgroundColor = colorThemeJson.MainBackground
|
|
11
11
|
const preload = PreloadUrl.getPreloadUrl()
|
|
12
12
|
const options = {
|
|
13
|
-
width: 800,
|
|
14
|
-
height: 500,
|
|
15
13
|
backgroundColor,
|
|
14
|
+
height: 500,
|
|
16
15
|
webPreferences: {
|
|
16
|
+
additionalArguments: ['--lvce-window-kind=process-explorer'],
|
|
17
17
|
preload,
|
|
18
18
|
sandbox: true,
|
|
19
|
-
additionalArguments: ['--lvce-window-kind=process-explorer'],
|
|
20
19
|
spellcheck: false,
|
|
21
20
|
},
|
|
21
|
+
width: 800,
|
|
22
22
|
}
|
|
23
23
|
return options
|
|
24
24
|
}
|
|
@@ -4,10 +4,10 @@ import * as ExecPromise from '../ExecPromise/ExecPromise.js'
|
|
|
4
4
|
import * as Hash from '../Hash/Hash.js'
|
|
5
5
|
|
|
6
6
|
export const execCommand = async (command, args, options) => {
|
|
7
|
-
const {
|
|
7
|
+
const { stderr, stdout } = await ExecPromise.execPromise(command, args, options)
|
|
8
8
|
return {
|
|
9
|
-
stdout,
|
|
10
9
|
stderr,
|
|
10
|
+
stdout,
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { existsSync } from 'node:fs'
|
|
2
|
+
import { readdir, readFile, rm, writeFile } from 'node:fs/promises'
|
|
2
3
|
import { stripTypeScriptTypes } from 'node:module'
|
|
3
4
|
import { isAbsolute, join, relative } from 'node:path'
|
|
5
|
+
import workers from '../Workers/Workers.json' with { type: 'json' }
|
|
4
6
|
import * as FileSystem from '../FileSystem/FileSystem.js'
|
|
5
7
|
import * as GetContentSecurityPolicy from '../GetContentSecurityPolicy/GetContentSecurityPolicy.js'
|
|
6
8
|
import * as JsonFile from '../JsonFile/JsonFile.js'
|
|
7
9
|
import * as Path from '../Path/Path.js'
|
|
8
|
-
|
|
9
|
-
|
|
10
|
+
|
|
11
|
+
const testFileExtensionRegex = /\.(js|ts)$/
|
|
12
|
+
const backslashRegex = /\\/g
|
|
10
13
|
|
|
11
14
|
const staticContentSecurityPolicy = GetContentSecurityPolicy.getContentSecurityPolicy([
|
|
12
15
|
`default-src 'none'`,
|
|
@@ -123,7 +126,7 @@ const copyStaticFiles = async (root, serverStaticPath) => {
|
|
|
123
126
|
await FileSystem.copy(serverStaticPath, Path.join(root, 'dist'))
|
|
124
127
|
}
|
|
125
128
|
|
|
126
|
-
const applyOverridesRendererProcess = async ({
|
|
129
|
+
const applyOverridesRendererProcess = async ({ commitHash, pathPrefix, root } ) => {
|
|
127
130
|
await replace(
|
|
128
131
|
Path.join(root, 'dist', commitHash, 'packages', 'renderer-process', 'dist', 'rendererProcessMain.js'),
|
|
129
132
|
'platform = Remote;',
|
|
@@ -136,9 +139,9 @@ const applyOverridesRendererProcess = async ({ root, commitHash, pathPrefix }
|
|
|
136
139
|
)
|
|
137
140
|
}
|
|
138
141
|
|
|
139
|
-
const applyOverrides = async ({
|
|
142
|
+
const applyOverrides = async ({ commitHash, pathPrefix, root, serverStaticPath } ) => {
|
|
140
143
|
const extensionHostWorkerDistPath = getWorkerDistPath(root, commitHash, 'extensionHostWorker')
|
|
141
|
-
await applyOverridesRendererProcess({
|
|
144
|
+
await applyOverridesRendererProcess({ commitHash, pathPrefix, root })
|
|
142
145
|
await replace(
|
|
143
146
|
Path.join(root, 'dist', commitHash, 'packages', 'renderer-worker', 'dist', 'rendererWorkerMain.js'),
|
|
144
147
|
'platform = Remote;',
|
|
@@ -263,7 +266,7 @@ const applyOverrides = async ({ root, commitHash, pathPrefix, serverStaticPath }
|
|
|
263
266
|
}
|
|
264
267
|
}
|
|
265
268
|
|
|
266
|
-
const addExtensionSeo = async ({
|
|
269
|
+
const addExtensionSeo = async ({ commitHash, description, name, root } ) => {
|
|
267
270
|
await replace(Path.join(root, 'dist', 'index.html'), '<title>Lvce Editor</title>', `<title>${name}</title>`)
|
|
268
271
|
await replace(Path.join(root, 'dist', commitHash, 'manifest.json'), `"name": "Code Editor Web - OSS"`, `"name": "${name}"`)
|
|
269
272
|
await replace(Path.join(root, 'dist', commitHash, 'manifest.json'), `"short_name": "Web - OSS"`, `"short_name": "${name}"`)
|
|
@@ -279,7 +282,7 @@ const getId = (object) => {
|
|
|
279
282
|
return object.id
|
|
280
283
|
}
|
|
281
284
|
|
|
282
|
-
const addExtensionThemes = async ({
|
|
285
|
+
const addExtensionThemes = async ({ commitHash, extensionJson, extensionPath, root } ) => {
|
|
283
286
|
const colorThemes = extensionJson.colorThemes || []
|
|
284
287
|
if (colorThemes.length === 0) {
|
|
285
288
|
return
|
|
@@ -336,7 +339,7 @@ const toPlaygroundFile = (file) => {
|
|
|
336
339
|
return `/playground/${file}`
|
|
337
340
|
}
|
|
338
341
|
|
|
339
|
-
const addExtensionLanguages = async ({
|
|
342
|
+
const addExtensionLanguages = async ({ commitHash, extensionJson, extensionPath, pathPrefix, root } ) => {
|
|
340
343
|
const languages = extensionJson.languages || []
|
|
341
344
|
if (languages.length === 0) {
|
|
342
345
|
return
|
|
@@ -395,7 +398,7 @@ export const mergeExtensionManifests = (manifests, extraExtensions) => {
|
|
|
395
398
|
return merged
|
|
396
399
|
}
|
|
397
400
|
|
|
398
|
-
const updateExtensionsJson = async ({
|
|
401
|
+
const updateExtensionsJson = async ({ commitHash, extraExtensions, pathPrefix, root } ) => {
|
|
399
402
|
const dirents = await FileSystem.readDir(Path.join(root, 'dist', commitHash, 'extensions'))
|
|
400
403
|
const manifests = await Promise.all(
|
|
401
404
|
dirents.map(async (dirent) => {
|
|
@@ -418,14 +421,14 @@ const updateExtensionsJson = async ({ root, commitHash, pathPrefix, extraExtensi
|
|
|
418
421
|
}
|
|
419
422
|
|
|
420
423
|
const addExtensionWebExtension = async ({
|
|
421
|
-
root,
|
|
422
|
-
extensionPath,
|
|
423
424
|
commitHash,
|
|
424
425
|
extensionJson,
|
|
426
|
+
extensionPath,
|
|
425
427
|
pathPrefix,
|
|
428
|
+
root,
|
|
426
429
|
useSimpleWebExtensionFile,
|
|
427
430
|
} ) => {
|
|
428
|
-
await updateExtensionsJson({
|
|
431
|
+
await updateExtensionsJson({ commitHash, extraExtensions: [extensionJson], pathPrefix, root })
|
|
429
432
|
|
|
430
433
|
if (!extensionJson.browser) {
|
|
431
434
|
return
|
|
@@ -450,36 +453,36 @@ const addExtensionWebExtension = async ({
|
|
|
450
453
|
}
|
|
451
454
|
}
|
|
452
455
|
|
|
453
|
-
const addExtension = async ({
|
|
456
|
+
const addExtension = async ({ commitHash, extensionPath, pathPrefix, root, useSimpleWebExtensionFile } ) => {
|
|
454
457
|
const extensionJson = await readExtensionManifest(Path.join(extensionPath, 'extension.json'))
|
|
455
458
|
const name = extensionJson.name || extensionJson.id || ''
|
|
456
459
|
const description = extensionJson.description || ''
|
|
457
460
|
await addExtensionSeo({
|
|
458
|
-
root,
|
|
459
461
|
commitHash,
|
|
460
|
-
name,
|
|
461
462
|
description,
|
|
463
|
+
name,
|
|
464
|
+
root,
|
|
462
465
|
})
|
|
463
466
|
await addExtensionThemes({
|
|
464
|
-
root,
|
|
465
467
|
commitHash,
|
|
466
468
|
extensionJson,
|
|
467
469
|
extensionPath,
|
|
470
|
+
root,
|
|
468
471
|
})
|
|
469
472
|
await addExtensionLanguages({
|
|
470
|
-
root,
|
|
471
|
-
extensionPath,
|
|
472
473
|
commitHash,
|
|
473
474
|
extensionJson,
|
|
475
|
+
extensionPath,
|
|
474
476
|
pathPrefix,
|
|
477
|
+
root,
|
|
475
478
|
})
|
|
476
479
|
|
|
477
480
|
await addExtensionWebExtension({
|
|
478
|
-
root,
|
|
479
|
-
extensionPath,
|
|
480
481
|
commitHash,
|
|
481
482
|
extensionJson,
|
|
483
|
+
extensionPath,
|
|
482
484
|
pathPrefix,
|
|
485
|
+
root,
|
|
483
486
|
useSimpleWebExtensionFile,
|
|
484
487
|
})
|
|
485
488
|
}
|
|
@@ -513,7 +516,7 @@ const generateTestOverviewHtml = (dirents) => {
|
|
|
513
516
|
}
|
|
514
517
|
|
|
515
518
|
const getName = (name) => {
|
|
516
|
-
return name.replace(
|
|
519
|
+
return name.replace(testFileExtensionRegex, '')
|
|
517
520
|
}
|
|
518
521
|
const isTestFile = (file) => {
|
|
519
522
|
if (file.startsWith('_')) {
|
|
@@ -549,7 +552,7 @@ const transpileFiles = async (folder) => {
|
|
|
549
552
|
export const createFilemap = async (fixturesPath) => {
|
|
550
553
|
const filemap = {}
|
|
551
554
|
|
|
552
|
-
const dirents = await readdir(fixturesPath, {
|
|
555
|
+
const dirents = await readdir(fixturesPath, { recursive: true, withFileTypes: true })
|
|
553
556
|
|
|
554
557
|
for (const dirent of dirents) {
|
|
555
558
|
if (dirent.isFile()) {
|
|
@@ -561,8 +564,8 @@ export const createFilemap = async (fixturesPath) => {
|
|
|
561
564
|
} else {
|
|
562
565
|
// Manually calculate relative path for cross-platform compatibility
|
|
563
566
|
// Remove the fixturesPath prefix from parentPath and normalize separators
|
|
564
|
-
const normalizedFixturesPath = fixturesPath.replace(
|
|
565
|
-
const normalizedParentPath = dirent.parentPath.replace(
|
|
567
|
+
const normalizedFixturesPath = fixturesPath.replace(backslashRegex, '/')
|
|
568
|
+
const normalizedParentPath = dirent.parentPath.replace(backslashRegex, '/')
|
|
566
569
|
const relativeDir = normalizedParentPath.replace(normalizedFixturesPath + '/', '')
|
|
567
570
|
relativeFilePath = join(relativeDir, dirent.name)
|
|
568
571
|
}
|
|
@@ -592,7 +595,7 @@ export const createFilemapsPerFixture = async (fixturesPath) => {
|
|
|
592
595
|
)
|
|
593
596
|
}
|
|
594
597
|
|
|
595
|
-
const addTestFiles = async ({
|
|
598
|
+
const addTestFiles = async ({ commitHash, pathPrefix, root, testPath } ) => {
|
|
596
599
|
const testRoot = isAbsolute(testPath) ? testPath : join(root, testPath)
|
|
597
600
|
await FileSystem.copy(`${testRoot}/src`, `${root}/dist/${commitHash}/packages/extension-host-worker-tests/src`)
|
|
598
601
|
if (existsSync(`${testRoot}/fixtures`)) {
|
|
@@ -677,13 +680,13 @@ const getExtensionPaths = (extensionPath, extensionPaths) => {
|
|
|
677
680
|
* @param {{root:string, pathPrefix:string, extensionPath:string, extensionPaths?:string[], testPath:string, useSimpleWebExtensionFile?:boolean, serverStaticPath?:string }} param0
|
|
678
681
|
*/
|
|
679
682
|
export const exportStatic = async ({
|
|
680
|
-
root,
|
|
681
|
-
pathPrefix,
|
|
682
683
|
extensionPath,
|
|
683
684
|
extensionPaths,
|
|
685
|
+
pathPrefix,
|
|
686
|
+
root,
|
|
687
|
+
serverStaticPath,
|
|
684
688
|
testPath,
|
|
685
689
|
useSimpleWebExtensionFile,
|
|
686
|
-
serverStaticPath,
|
|
687
690
|
} ) => {
|
|
688
691
|
if (!existsSync(root)) {
|
|
689
692
|
throw new Error(`root path does not exist: ${root}`)
|
|
@@ -720,20 +723,20 @@ export const exportStatic = async ({
|
|
|
720
723
|
|
|
721
724
|
console.time('applyOverrides')
|
|
722
725
|
await applyOverrides({
|
|
723
|
-
root,
|
|
724
726
|
commitHash,
|
|
725
727
|
pathPrefix,
|
|
728
|
+
root,
|
|
726
729
|
serverStaticPath,
|
|
727
730
|
})
|
|
728
731
|
console.timeEnd('applyOverrides')
|
|
729
732
|
|
|
730
|
-
await updateExtensionsJson({
|
|
733
|
+
await updateExtensionsJson({ commitHash, extraExtensions: [], pathPrefix, root })
|
|
731
734
|
|
|
732
735
|
for (const extensionPath of allExtensionPaths) {
|
|
733
736
|
console.time('addExtension')
|
|
734
737
|
await addExtension({
|
|
735
|
-
extensionPath,
|
|
736
738
|
commitHash,
|
|
739
|
+
extensionPath,
|
|
737
740
|
pathPrefix,
|
|
738
741
|
root,
|
|
739
742
|
useSimpleWebExtensionFile,
|
|
@@ -744,10 +747,10 @@ export const exportStatic = async ({
|
|
|
744
747
|
if (testPath) {
|
|
745
748
|
console.time('addTestFiles')
|
|
746
749
|
await addTestFiles({
|
|
747
|
-
testPath,
|
|
748
750
|
commitHash,
|
|
749
751
|
pathPrefix,
|
|
750
752
|
root,
|
|
753
|
+
testPath,
|
|
751
754
|
})
|
|
752
755
|
console.timeEnd('addTestFiles')
|
|
753
756
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
+
import * as Id from '../Id/Id.js'
|
|
1
2
|
import * as IpcParent from '../IpcParent/IpcParent.js'
|
|
2
3
|
import * as PlatformPaths from '../PlatformPaths/PlatformPaths.js'
|
|
3
|
-
import * as Id from '../Id/Id.js'
|
|
4
4
|
|
|
5
5
|
export const create = async ({ method } ) => {
|
|
6
6
|
const extensionHostHelperProcessPath = await PlatformPaths.getExtensionHostHelperProcessPath()
|
|
7
7
|
const id = Id.create()
|
|
8
8
|
const ipc = await IpcParent.create({
|
|
9
|
-
method,
|
|
10
|
-
path: extensionHostHelperProcessPath,
|
|
11
9
|
execArgv: [],
|
|
10
|
+
method,
|
|
12
11
|
name: `Extension Host Helper Process ${id}`,
|
|
12
|
+
path: extensionHostHelperProcessPath,
|
|
13
13
|
})
|
|
14
14
|
return ipc
|
|
15
15
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as Assert from '../Assert/Assert.js'
|
|
2
|
+
import * as Logger from '../Logger/Logger.js'
|
|
2
3
|
import * as Timeout from '../Timeout/Timeout.js'
|
|
3
4
|
import { VError } from '../VError/VError.js'
|
|
4
|
-
import * as Logger from '../Logger/Logger.js'
|
|
5
5
|
// TODO maybe rename to extension host management for clarity
|
|
6
6
|
|
|
7
7
|
const CONNECTION_TIMEOUT = 3000
|
|
@@ -69,14 +69,14 @@ export const create = async (ipc, socket) => {
|
|
|
69
69
|
})
|
|
70
70
|
|
|
71
71
|
return {
|
|
72
|
+
dispose() {
|
|
73
|
+
ipc.dispose()
|
|
74
|
+
},
|
|
72
75
|
on(event, listener) {
|
|
73
76
|
ipc.on(event, listener)
|
|
74
77
|
},
|
|
75
78
|
send(message) {
|
|
76
79
|
ipc.send(message)
|
|
77
80
|
},
|
|
78
|
-
dispose() {
|
|
79
|
-
ipc.dispose()
|
|
80
|
-
},
|
|
81
81
|
}
|
|
82
82
|
}
|
|
@@ -3,12 +3,12 @@ import * as ExtensionInstallType from '../ExtensionInstallType/ExtensionInstallT
|
|
|
3
3
|
|
|
4
4
|
const getModule = (type) => {
|
|
5
5
|
switch (type) {
|
|
6
|
+
case ExtensionInstallType.File:
|
|
7
|
+
return import('../ExtensionInstallFromFile/ExtensionInstallFromFile.js')
|
|
6
8
|
case ExtensionInstallType.GithubRepository:
|
|
7
9
|
return import('../ExtensionInstallFromGitHub/ExtensionInstallFromGitHub.js')
|
|
8
10
|
case ExtensionInstallType.Url:
|
|
9
11
|
return import('../ExtensionInstallFromUrl/ExtensionInstallFromUrl.js')
|
|
10
|
-
case ExtensionInstallType.File:
|
|
11
|
-
return import('../ExtensionInstallFromFile/ExtensionInstallFromFile.js')
|
|
12
12
|
default:
|
|
13
13
|
throw new Error('module not found')
|
|
14
14
|
}
|
|
@@ -5,15 +5,15 @@ import * as Path from '../Path/Path.js'
|
|
|
5
5
|
import * as PlatformPaths from '../PlatformPaths/PlatformPaths.js'
|
|
6
6
|
import { VError } from '../VError/VError.js'
|
|
7
7
|
|
|
8
|
-
export const install = async ({
|
|
8
|
+
export const install = async ({ branch, repo, user } ) => {
|
|
9
9
|
try {
|
|
10
10
|
const cachedExtensionsPath = PlatformPaths.getCachedExtensionsPath()
|
|
11
11
|
const url = `https://codeload.github.com/${user}/${repo}/tar.gz/${branch}`
|
|
12
12
|
const cachedExtensionPath = Path.join(cachedExtensionsPath, `github-${user}-${repo}-${branch}`)
|
|
13
13
|
await DownloadAndExtract.downloadAndExtractTarGz({
|
|
14
|
-
url,
|
|
15
14
|
outDir: cachedExtensionPath,
|
|
16
15
|
strip: 1,
|
|
16
|
+
url,
|
|
17
17
|
})
|
|
18
18
|
const extensionsPath = PlatformPaths.getExtensionsPath()
|
|
19
19
|
const manifestPath = Path.join(cachedExtensionPath, 'extension.json')
|
|
@@ -24,7 +24,7 @@ export const install = async ({ url } ) => {
|
|
|
24
24
|
throw new Error('missing id in extension manifest')
|
|
25
25
|
}
|
|
26
26
|
const outDir = join(extensionsPath, id)
|
|
27
|
-
await rm(outDir, {
|
|
27
|
+
await rm(outDir, { force: true, recursive: true })
|
|
28
28
|
await mkdir(dirname(outDir), { recursive: true })
|
|
29
29
|
await rename(tmpDir, outDir)
|
|
30
30
|
} catch (error) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as ExtensionInstallType from '../ExtensionInstallType/ExtensionInstallType.js'
|
|
2
|
-
import * as Path from '../Path/Path.js'
|
|
3
2
|
import * as ParseUrlGithub from '../ParseUrlGithub/ParseUrlGithub.js'
|
|
3
|
+
import * as Path from '../Path/Path.js'
|
|
4
4
|
|
|
5
5
|
const parseUrl = (input) => {
|
|
6
6
|
if (input.startsWith('https://github.com')) {
|
|
@@ -8,26 +8,26 @@ const parseUrl = (input) => {
|
|
|
8
8
|
}
|
|
9
9
|
if (input.endsWith('.tar.br')) {
|
|
10
10
|
return {
|
|
11
|
-
type: ExtensionInstallType.Url,
|
|
12
11
|
options: {
|
|
13
12
|
url: input,
|
|
14
13
|
},
|
|
14
|
+
type: ExtensionInstallType.Url,
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
return {
|
|
18
|
-
type: ExtensionInstallType.ParsingError,
|
|
19
18
|
options: {
|
|
20
19
|
message: 'Failed to parse url',
|
|
21
20
|
},
|
|
21
|
+
type: ExtensionInstallType.ParsingError,
|
|
22
22
|
}
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
const parseFile = (input) => {
|
|
26
26
|
return {
|
|
27
|
-
type: ExtensionInstallType.File,
|
|
28
27
|
options: {
|
|
29
28
|
path: input,
|
|
30
29
|
},
|
|
30
|
+
type: ExtensionInstallType.File,
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
|
|
@@ -42,9 +42,9 @@ export const parse = (input) => {
|
|
|
42
42
|
return parseFile(input)
|
|
43
43
|
}
|
|
44
44
|
return {
|
|
45
|
-
type: ExtensionInstallType.ParsingError,
|
|
46
45
|
options: {
|
|
47
46
|
message: 'Failed to parse input',
|
|
48
47
|
},
|
|
48
|
+
type: ExtensionInstallType.ParsingError,
|
|
49
49
|
}
|
|
50
50
|
}
|