@lvce-editor/shared-process 0.86.5 → 0.86.6

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.
Files changed (125) hide show
  1. package/index.js +2 -2
  2. package/package.json +6 -6
  3. package/src/parts/AppWindow/AppWindow.js +5 -5
  4. package/src/parts/ApplyEdit/ApplyEdit.js +1 -1
  5. package/src/parts/ApplyIncomingIpcResponse/ApplyIncomingIpcResponse.js +13 -8
  6. package/src/parts/AutoUpdaterWindowsNsis/AutoUpdaterWindowsNsis.js +2 -2
  7. package/src/parts/BuiltinExtensionsPath/BuiltinExtensionsPath.js +1 -1
  8. package/src/parts/CliModule/CliModule.js +2 -2
  9. package/src/parts/ColorTheme/ColorTheme.js +1 -1
  10. package/src/parts/Command/Command.js +1 -1
  11. package/src/parts/Crash/Crash.js +1 -1
  12. package/src/parts/CreateTestOverviewHtml/CreateTestOverviewHtml.js +3 -1
  13. package/src/parts/DefaultUrl/DefaultUrl.js +1 -1
  14. package/src/parts/DownloadAndExtract/DownloadAndExtract.js +2 -2
  15. package/src/parts/ElectronInitialize/ElectronInitialize.js +1 -1
  16. package/src/parts/ElectronWindowProcessExplorer/ElectronWindowProcessExplorer.js +4 -4
  17. package/src/parts/ErrorHandling/ErrorHandling.js +1 -1
  18. package/src/parts/ExecCommand/ExecCommand.js +2 -2
  19. package/src/parts/ExportStatic/ExportStatic.js +35 -32
  20. package/src/parts/ExtensionHostHelperProcessIpc/ExtensionHostHelperProcessIpc.js +3 -3
  21. package/src/parts/ExtensionHostRpc/ExtensionHostRpc.js +4 -4
  22. package/src/parts/ExtensionInstall/ExtensionInstall.js +2 -2
  23. package/src/parts/ExtensionInstallFromGitHub/ExtensionInstallFromGitHub.js +2 -2
  24. package/src/parts/ExtensionInstallFromUrl/ExtensionInstallFromUrl.js +1 -1
  25. package/src/parts/ExtensionInstallParseInput/ExtensionInstallParseInput.js +5 -5
  26. package/src/parts/ExtensionList/ExtensionList.js +7 -7
  27. package/src/parts/ExtensionManagement/ExtensionManagement.ipc.js +3 -3
  28. package/src/parts/ExtensionManagement/ExtensionManagement.js +13 -13
  29. package/src/parts/ExtensionManifest/ExtensionManifest.js +3 -3
  30. package/src/parts/ExtensionManifests/ExtensionManifests.js +2 -2
  31. package/src/parts/ExtensionManifests/ExtensionManifestsFromFolder.js +1 -1
  32. package/src/parts/ExtensionManifests/ExtensionManifestsFromLinkedExtensionsFolder.js +1 -1
  33. package/src/parts/FileSystem/FileSystem.ipc.js +1 -1
  34. package/src/parts/FileSystem/FileSystem.js +2 -2
  35. package/src/parts/FileSystemDisk/FileSystemDisk.ipc.js +1 -1
  36. package/src/parts/FileSystemDisk/FileSystemDisk.js +3 -3
  37. package/src/parts/FileSystemProcess/FileSystemProcess.js +1 -1
  38. package/src/parts/FileWatcher/FileWatcher.ipc.js +1 -1
  39. package/src/parts/FileWatcher/FileWatcher.js +2 -2
  40. package/src/parts/GetAppWindowOptions/GetAppWindowOptions.js +9 -9
  41. package/src/parts/GetBrowserWindowOptions/GetBrowserWindowOptions.js +14 -14
  42. package/src/parts/GetContentResponse/GetContentResponse.js +1 -1
  43. package/src/parts/GetContentSecurityPolicy/GetContentSecurityPolicy.js +1 -1
  44. package/src/parts/GetExtensionEtags/GetExtensionEtags.js +1 -1
  45. package/src/parts/GetFirstEvent/GetFirstEvent.js +2 -2
  46. package/src/parts/GetFirstSpawnedProcessEvent/GetFirstSpawnedProcessEvent.js +1 -1
  47. package/src/parts/GetHeaders/GetHeaders.js +4 -4
  48. package/src/parts/GetMimeType/GetMimeType.js +10 -10
  49. package/src/parts/GetMultipleChoiceResponse/GetMultipleChoiceResponse.js +1 -1
  50. package/src/parts/GetNotFoundResponse/GetNotFoundResponse.js +1 -1
  51. package/src/parts/GetNotModifiedResponse/GetNotModifiedResponse.js +1 -1
  52. package/src/parts/GetServerErrorResponse/GetServerErrorResponse.js +1 -1
  53. package/src/parts/GetStatusString/GetStatusString.js +5 -5
  54. package/src/parts/GetTerminalSpawnOptions/GetTerminalSpawnOptions.js +3 -3
  55. package/src/parts/GetTestRequestResponse/GetTestRequestResponse.js +7 -7
  56. package/src/parts/GetTitleBarItems/GetTitleBarItems.js +4 -4
  57. package/src/parts/GetTransferrables/GetTransferrables.js +1 -1
  58. package/src/parts/GetWebViewsFromExtensions/GetWebViewsFromExtensions.js +2 -2
  59. package/src/parts/GitLsFiles/GitLsFiles.js +2 -2
  60. package/src/parts/HandleElectronMessagePort/HandleElectronMessagePort.js +1 -1
  61. package/src/parts/HandleElectronReady/HandleElectronReady.js +1 -1
  62. package/src/parts/HandleIncomingIpc/HandleIncomingIpc.js +8 -8
  63. package/src/parts/HandleIncomingIpcMessagePort/HandleIncomingIpcMessagePort.js +1 -1
  64. package/src/parts/HandleIncomingIpcWebSocket/HandleIncomingIpcWebSocket.js +1 -1
  65. package/src/parts/HandleIpcAuthProcess/HandleIpcAuthProcess.js +1 -1
  66. package/src/parts/HandleIpcClipBoardProcess/HandleIpcClipBoardProcess.js +2 -2
  67. package/src/parts/HandleIpcEmbedsProcess/HandleIpcEmbedsProcess.js +1 -1
  68. package/src/parts/HandleIpcExtensionHostHelperProcess/HandleIpcExtensionHostHelperProcess.js +2 -2
  69. package/src/parts/HandleIpcFileSystemProcess/HandleIpcFileSystemProcess.js +2 -2
  70. package/src/parts/HandleIpcFileWatcher/HandleIpcFileWatcher.js +3 -3
  71. package/src/parts/HandleIpcModule/HandleIpcModule.js +8 -8
  72. package/src/parts/HandleIpcProcessExplorer/HandleIpcProcessExplorer.js +3 -3
  73. package/src/parts/HandleIpcSearchProcess/HandleIpcSearchProcess.js +2 -2
  74. package/src/parts/HandleIpcSharedProcess/HandleIpcSharedProcess.js +2 -2
  75. package/src/parts/HandleIpcTerminalProcess/HandleIpcTerminalProcess.js +3 -3
  76. package/src/parts/HandleMessagePortForAuthProcess/HandleMessagePortForAuthProcess.ipc.js +1 -1
  77. package/src/parts/HandleMessagePortForEmbedsProcess/HandleMessagePortForEmbedsProcess.ipc.js +1 -1
  78. package/src/parts/HandleMessagePortForTerminalProcess/HandleMessagePortForTerminalProcess.js +1 -1
  79. package/src/parts/HandleNodeMessagePort/HandleNodeMessagePort.js +1 -1
  80. package/src/parts/HandleWebSocket/HandleWebSocket.js +1 -1
  81. package/src/parts/HandleWebSocketForUnknown/HandleWebSocketForUnknown.js +1 -1
  82. package/src/parts/HandleWebSocketModule/HandleWebSocketModule.js +8 -8
  83. package/src/parts/HeapSnapshot/HeapSnapshot.js +1 -1
  84. package/src/parts/IpcChildModule/IpcChildModule.js +6 -6
  85. package/src/parts/IpcChildWithNodeMessagePort/IpcChildWithNodeMessagePort.js +6 -6
  86. package/src/parts/IpcParentModule/IpcParentModule.js +4 -4
  87. package/src/parts/IpcParentWithElectronUtilityProcess/IpcParentWithElectronUtilityProcess.js +22 -22
  88. package/src/parts/Json/Json.js +1 -1
  89. package/src/parts/LaunchAuthProcess/LaunchAuthProcess.js +2 -2
  90. package/src/parts/LaunchClipBoardProcess/LaunchClipBoardProcess.js +2 -2
  91. package/src/parts/LaunchEmbedsProcess/LaunchEmbedsProcess.js +2 -2
  92. package/src/parts/LaunchFileSystemProcess/LaunchFileSystemProcess.js +2 -2
  93. package/src/parts/LaunchFileWatcherProcess/LaunchFileWatcherProcess.js +2 -2
  94. package/src/parts/LaunchPreviewProcess/LaunchPreviewProcess.js +2 -2
  95. package/src/parts/LaunchProcess/LaunchProcess.js +4 -4
  96. package/src/parts/LaunchProcessExplorer/LaunchProcessExplorer.js +1 -1
  97. package/src/parts/LaunchSearchProcess/LaunchSearchProcess.js +1 -1
  98. package/src/parts/LaunchTypeScriptCompileProcess/LaunchTypeScriptCompileProcess.js +6 -6
  99. package/src/parts/Main/Main.js +1 -1
  100. package/src/parts/Module/Module.js +56 -56
  101. package/src/parts/ModuleMap/ModuleMap.js +107 -107
  102. package/src/parts/NetworkProcess/NetworkProcess.js +1 -1
  103. package/src/parts/OutputChannel/OutputChannel.js +1 -1
  104. package/src/parts/ParseUrlGithub/ParseUrlGithub.js +9 -9
  105. package/src/parts/Performance/Performance.js +15 -15
  106. package/src/parts/Platform/Platform.js +3 -3
  107. package/src/parts/PlatformPaths/PlatformPaths.ipc.js +1 -1
  108. package/src/parts/PreloadUrl/PreloadUrl.js +1 -1
  109. package/src/parts/Process/Process.js +1 -1
  110. package/src/parts/Promises/Promises.js +2 -2
  111. package/src/parts/PtyHostState/PtyHostState.js +4 -4
  112. package/src/parts/Queue/Queue.js +2 -2
  113. package/src/parts/ResolveRoot/ResolveRoot.js +12 -12
  114. package/src/parts/Restart/Restart.js +1 -1
  115. package/src/parts/Screen/Screen.ipc.js +1 -1
  116. package/src/parts/SearchProcess/SearchProcess.js +1 -1
  117. package/src/parts/SendIncomingIpc/SendIncomingIpc.js +2 -2
  118. package/src/parts/TemporaryMessagePort/TemporaryMessagePort.js +1 -1
  119. package/src/parts/Terminal/Terminal.js +3 -3
  120. package/src/parts/TextDocument/TextDocument.js +1 -1
  121. package/src/parts/TranspileTypeScript/TranspileTypeScript.js +1 -1
  122. package/src/parts/TranspileTypeScriptCached/TranspileTypeScriptCached.js +1 -1
  123. package/src/parts/WaitForProcessToExit/WaitForProcessToExit.js +1 -1
  124. package/src/parts/WebViewServer/WebViewServer.ipc.js +2 -2
  125. package/src/parts/Workspace/Workspace.js +2 -2
@@ -3,18 +3,18 @@ import * as Platform from '../Platform/Platform.js'
3
3
  export const getTerminalSpawnOptions = () => {
4
4
  if (Platform.isWindows) {
5
5
  return {
6
- command: 'powershell.exe',
7
6
  args: [],
7
+ command: 'powershell.exe',
8
8
  }
9
9
  }
10
10
  if (Platform.isMacOs) {
11
11
  return {
12
- command: 'zsh',
13
12
  args: ['-i'],
13
+ command: 'zsh',
14
14
  }
15
15
  }
16
16
  return {
17
- command: 'bash',
18
17
  args: ['-i'],
18
+ command: 'bash',
19
19
  }
20
20
  }
@@ -7,9 +7,9 @@ import * as CrossOriginEmbedderPolicy from '../CrossOriginEmbedderPolicy/CrossOr
7
7
  import * as CrossOriginOpenerPolicy from '../CrossOriginOpenerPolicy/CrossOriginOpenerPolicy.js'
8
8
  import * as CrossOriginResourcePolicy from '../CrossOriginResourcePolicy/CrossOriginResourcePolicy.js'
9
9
  import * as GetContentResponse from '../GetContentResponse/GetContentResponse.js'
10
+ import * as GetNotFoundResponse from '../GetNotFoundResponse/GetNotFoundResponse.js'
10
11
  import * as GetPathName from '../GetPathName/GetPathName.js'
11
12
  import * as GetTestPath from '../GetTestPath/GetTestPath.js'
12
- import * as GetNotFoundResponse from '../GetNotFoundResponse/GetNotFoundResponse.js'
13
13
  import * as HttpHeader from '../HttpHeader/HttpHeader.js'
14
14
  import * as HttpStatusCode from '../HttpStatusCode/HttpStatusCode.js'
15
15
  import * as Logger from '../Logger/Logger.js'
@@ -21,11 +21,11 @@ export const getTestRequestResponse = async (request, indexHtmlPath) => {
21
21
  const body = await readFile(indexHtmlPath, 'utf8')
22
22
  const content = await AddCustomPathsToIndexHtml.addCustomPathsToIndexHtml(body)
23
23
  const headers = {
24
+ [HttpHeader.ContentSecurityPolicy]: ContentSecurityPolicyDocument.value,
25
+ [HttpHeader.ContentType]: 'text/html',
24
26
  [HttpHeader.CrossOriginEmbedderPolicy]: CrossOriginEmbedderPolicy.value,
25
27
  [HttpHeader.CrossOriginOpenerPolicy]: CrossOriginOpenerPolicy.value,
26
28
  [HttpHeader.CrossOriginResourcePolicy]: CrossOriginResourcePolicy.value,
27
- [HttpHeader.ContentSecurityPolicy]: ContentSecurityPolicyDocument.value,
28
- [HttpHeader.ContentType]: 'text/html',
29
29
  }
30
30
  return GetContentResponse.getContentResponse(content, headers)
31
31
  }
@@ -33,11 +33,11 @@ export const getTestRequestResponse = async (request, indexHtmlPath) => {
33
33
  const body = await readFile(indexHtmlPath, 'utf8')
34
34
  const content = await AddCustomPathsToIndexHtml.addCustomPathsToIndexHtml(body)
35
35
  const headers = {
36
+ [HttpHeader.ContentSecurityPolicy]: ContentSecurityPolicyDocument.value,
37
+ [HttpHeader.ContentType]: 'text/html',
36
38
  [HttpHeader.CrossOriginEmbedderPolicy]: CrossOriginEmbedderPolicy.value,
37
39
  [HttpHeader.CrossOriginOpenerPolicy]: CrossOriginOpenerPolicy.value,
38
40
  [HttpHeader.CrossOriginResourcePolicy]: CrossOriginResourcePolicy.value,
39
- [HttpHeader.ContentSecurityPolicy]: ContentSecurityPolicyDocument.value,
40
- [HttpHeader.ContentType]: 'text/html',
41
41
  }
42
42
  return GetContentResponse.getContentResponse(content, headers)
43
43
  }
@@ -47,10 +47,10 @@ export const getTestRequestResponse = async (request, indexHtmlPath) => {
47
47
  const body = await CreateTestOverview.createTestOverview(testPathSrc)
48
48
  const headers = {
49
49
  [HttpHeader.CacheControl]: 'no-store',
50
- [HttpHeader.CrossOriginEmbedderPolicy]: CrossOriginEmbedderPolicy.value,
51
- [HttpHeader.CrossOriginOpenerPolicy]: CrossOriginOpenerPolicy.value,
52
50
  [HttpHeader.ContentSecurityPolicy]: "default-src 'none'",
53
51
  [HttpHeader.ContentType]: 'text/html',
52
+ [HttpHeader.CrossOriginEmbedderPolicy]: CrossOriginEmbedderPolicy.value,
53
+ [HttpHeader.CrossOriginOpenerPolicy]: CrossOriginOpenerPolicy.value,
54
54
  }
55
55
  return GetContentResponse.getContentResponse(body, headers)
56
56
  }
@@ -2,15 +2,15 @@
2
2
  * @enum {string}
3
3
  */
4
4
  const UiStrings = {
5
- File: 'File',
6
5
  Edit: 'Edit',
7
- Selection: 'Selection',
8
- View: 'View',
6
+ File: 'File',
9
7
  Go: 'Go',
8
+ Help: 'Help',
10
9
  Run: 'Run',
10
+ Selection: 'Selection',
11
11
  Terminal: 'Terminal',
12
+ View: 'View',
12
13
  Window: 'Window',
13
- Help: 'Help',
14
14
  }
15
15
 
16
16
  export const getTitleBarItems = () => {
@@ -1,5 +1,5 @@
1
- import * as WalkValue from '../WalkValue/WalkValue.js'
2
1
  import * as IsTransferrable from '../IsTransferrable/IsTransferrable.js'
2
+ import * as WalkValue from '../WalkValue/WalkValue.js'
3
3
 
4
4
  export const getTransferrables = (value) => {
5
5
  const transferrables = []
@@ -1,6 +1,6 @@
1
1
  import { join } from 'node:path'
2
- import * as GetRemoteUrl from '../GetRemoteUrl/GetRemoteUrl.js'
3
2
  import { pathToFileURL } from 'node:url'
3
+ import * as GetRemoteUrl from '../GetRemoteUrl/GetRemoteUrl.js'
4
4
 
5
5
  export const getWebViewsFromExtensions = (extensions) => {
6
6
  const webViews = []
@@ -16,8 +16,8 @@ export const getWebViewsFromExtensions = (extensions) => {
16
16
  webViews.push({
17
17
  ...webView,
18
18
  path,
19
- uri,
20
19
  remotePath,
20
+ uri,
21
21
  })
22
22
  }
23
23
  }
@@ -2,13 +2,13 @@ import * as ExecCommand from '../ExecCommand/ExecCommand.js'
2
2
  import * as Hash from '../Hash/Hash.js'
3
3
 
4
4
  export const gitLsFiles = async (gitPath, cwd, limit) => {
5
- const { stdout, stderr } = await ExecCommand.execCommand(gitPath, ['ls-files'], {
5
+ const { stderr, stdout } = await ExecCommand.execCommand(gitPath, ['ls-files'], {
6
6
  cwd,
7
7
  })
8
8
  const hash = Hash.fromString(stdout)
9
9
  return {
10
- stdout,
11
10
  cacheId: hash,
11
+ stdout,
12
12
  }
13
13
  }
14
14
 
@@ -1,6 +1,6 @@
1
+ import * as Assert from '../Assert/Assert.js'
1
2
  import * as HandleIncomingIpc from '../HandleIncomingIpc/HandleIncomingIpc.js'
2
3
  import * as IpcId from '../IpcId/IpcId.js'
3
- import * as Assert from '../Assert/Assert.js'
4
4
 
5
5
  export const handleElectronMessagePort = (messagePort, ipcId) => {
6
6
  Assert.object(messagePort)
@@ -14,7 +14,7 @@ export const handleElectronReady = async (parsedArgs, workingDirectory) => {
14
14
  await TransientLinkedExtensions.validate()
15
15
  const preferences = await Preferences.getAllSafe()
16
16
  const preloadUrl = PreloadUrl.getPreloadUrl()
17
- await AppWindow.createAppWindow({ preferences, parsedArgs, workingDirectory, preloadUrl })
17
+ await AppWindow.createAppWindow({ parsedArgs, preferences, preloadUrl, workingDirectory })
18
18
  } catch (error) {
19
19
  Logger.error(error)
20
20
  Process.exit(ExitCode.ExpectedError)
@@ -32,13 +32,13 @@ const getIpcAndResponse = (module, handle, message) => {
32
32
  export const handleIncomingIpc = async (ipcId, handle, message) => {
33
33
  Assert.number(ipcId)
34
34
  const module = HandleIpcModule.getModule(ipcId)
35
- const { target, response } = await getIpcAndResponse(module, handle, message)
36
- try {
37
- await ApplyIncomingIpcResponse.applyIncomingIpcResponse(target, response, ipcId)
38
- } catch (error) {
39
- if (ipcId === IpcId.ProcessExplorer) {
40
- ProcessExplorer.decreaseRefCount()
41
- }
42
- throw error
35
+ const { response, target } = await getIpcAndResponse(module, handle, message)
36
+ const error = await ApplyIncomingIpcResponse.applyIncomingIpcResponse(target, response, ipcId)
37
+ if (!error) {
38
+ return
43
39
  }
40
+ if (ipcId === IpcId.ProcessExplorer) {
41
+ ProcessExplorer.decreaseRefCount()
42
+ }
43
+ console.error(error)
44
44
  }
@@ -2,7 +2,7 @@ export const handleIncomingIpcMessagePort = async (module, handle, message) => {
2
2
  const response = module.upgradeMessagePort(handle, message)
3
3
  const target = await module.targetMessagePort(handle, message)
4
4
  return {
5
- target,
6
5
  response,
6
+ target,
7
7
  }
8
8
  }
@@ -2,7 +2,7 @@ export const handleIncomingIpcWebSocket = async (module, handle, message) => {
2
2
  const response = module.upgradeWebSocket(handle, message)
3
3
  const target = await module.targetWebSocket(handle, message)
4
4
  return {
5
- target,
6
5
  response,
6
+ target,
7
7
  }
8
8
  }
@@ -6,8 +6,8 @@ export const targetMessagePort = () => {
6
6
 
7
7
  export const upgradeMessagePort = (port, message) => {
8
8
  return {
9
- type: 'send',
10
9
  method: 'HandleMessagePort.handleMessagePort',
11
10
  params: [port, message.ipcId],
11
+ type: 'send',
12
12
  }
13
13
  }
@@ -6,9 +6,9 @@ export const targetWebSocket = () => {
6
6
 
7
7
  export const upgradeWebSocket = (handle, message) => {
8
8
  return {
9
- type: 'send',
10
9
  method: 'HandleWebSocket.handleWebSocket',
11
10
  params: [handle, message],
11
+ type: 'send',
12
12
  }
13
13
  }
14
14
 
@@ -18,8 +18,8 @@ export const targetMessagePort = () => {
18
18
 
19
19
  export const upgradeMessagePort = (port) => {
20
20
  return {
21
- type: 'send',
22
21
  method: 'HandleElectronMessagePort.handleElectronMessagePort',
23
22
  params: [port],
23
+ type: 'send',
24
24
  }
25
25
  }
@@ -6,8 +6,8 @@ export const targetMessagePort = () => {
6
6
 
7
7
  export const upgradeMessagePort = (port, message) => {
8
8
  return {
9
- type: 'send',
10
9
  method: 'HandleElectronMessagePort.handleElectronMessagePort',
11
10
  params: [port, message.ipcId],
11
+ type: 'send',
12
12
  }
13
13
  }
@@ -10,9 +10,9 @@ export const targetWebSocket = async () => {
10
10
 
11
11
  export const upgradeWebSocket = (handle, message) => {
12
12
  return {
13
- type: 'send',
14
13
  method: 'HandleWebSocket.handleWebSocket',
15
14
  params: [handle, message],
15
+ type: 'send',
16
16
  }
17
17
  }
18
18
 
@@ -25,8 +25,8 @@ export const targetMessagePort = async () => {
25
25
 
26
26
  export const upgradeMessagePort = (port) => {
27
27
  return {
28
- type: 'send',
29
28
  method: 'HandleElectronMessagePort.handleElectronMessagePort',
30
29
  params: [port],
30
+ type: 'send',
31
31
  }
32
32
  }
@@ -6,9 +6,9 @@ export const targetWebSocket = () => {
6
6
 
7
7
  export const upgradeWebSocket = (handle, message) => {
8
8
  return {
9
- type: 'send',
10
9
  method: 'HandleWebSocket.handleWebSocket',
11
10
  params: [handle, message],
11
+ type: 'send',
12
12
  }
13
13
  }
14
14
 
@@ -18,8 +18,8 @@ export const targetMessagePort = () => {
18
18
 
19
19
  export const upgradeMessagePort = (port) => {
20
20
  return {
21
- type: 'send',
22
21
  method: 'HandleElectronMessagePort.handleElectronMessagePort',
23
22
  params: [port],
23
+ type: 'send',
24
24
  }
25
25
  }
@@ -1,5 +1,5 @@
1
- import * as PtyHost from '../PtyHost/PtyHost.js'
2
1
  import * as IpcParentType from '../IpcParentType/IpcParentType.js'
2
+ import * as PtyHost from '../PtyHost/PtyHost.js'
3
3
 
4
4
  export const targetWebSocket = () => {
5
5
  return PtyHost.getOrCreate(IpcParentType.NodeForkedProcess)
@@ -7,9 +7,9 @@ export const targetWebSocket = () => {
7
7
 
8
8
  export const upgradeWebSocket = (handle, message) => {
9
9
  return {
10
- type: 'send',
11
10
  method: 'HandleWebSocket.handleWebSocket',
12
11
  params: [handle, message],
12
+ type: 'send',
13
13
  }
14
14
  }
15
15
 
@@ -19,8 +19,8 @@ export const targetMessagePort = () => {
19
19
 
20
20
  export const upgradeMessagePort = (port) => {
21
21
  return {
22
- type: 'send',
23
22
  method: 'HandleElectronMessagePort.handleElectronMessagePort',
24
23
  params: [port],
24
+ type: 'send',
25
25
  }
26
26
  }
@@ -15,22 +15,22 @@ export const getModule = (ipcId) => {
15
15
  switch (ipcId) {
16
16
  case IpcId.AuthProcess:
17
17
  return HandleIpcAuthProcess
18
- case IpcId.SharedProcess:
19
- return HandleIpcSharedProcess
18
+ case IpcId.ClipBoardProcess:
19
+ return HandleIpcClipBoardProcess
20
20
  case IpcId.EmbedsProcess:
21
21
  return HandleIpcEmbedsProcess
22
- case IpcId.TerminalProcess:
23
- return HandleIpcTerminalProcess
24
22
  case IpcId.ExtensionHostHelperProcess:
25
23
  return HandleIpcExtensionHostHelperProcess
24
+ case IpcId.FileSystemProcess:
25
+ return HandleIpcFileSystemProcess
26
26
  case IpcId.ProcessExplorer:
27
27
  return HandleIpcProcessExplorer
28
28
  case IpcId.SearchProcess:
29
29
  return HandleIpcSearchProcess
30
- case IpcId.FileSystemProcess:
31
- return HandleIpcFileSystemProcess
32
- case IpcId.ClipBoardProcess:
33
- return HandleIpcClipBoardProcess
30
+ case IpcId.SharedProcess:
31
+ return HandleIpcSharedProcess
32
+ case IpcId.TerminalProcess:
33
+ return HandleIpcTerminalProcess
34
34
  default:
35
35
  throw new Error(`unexpected incoming ipc`)
36
36
  }
@@ -1,5 +1,5 @@
1
- import * as ProcessExplorer from '../ProcessExplorer/ProcessExplorer.js'
2
1
  import * as Assert from '../Assert/Assert.js'
2
+ import * as ProcessExplorer from '../ProcessExplorer/ProcessExplorer.js'
3
3
 
4
4
  export const targetMessagePort = () => {
5
5
  return ProcessExplorer.acquire()
@@ -12,16 +12,16 @@ export const targetWebSocket = () => {
12
12
  export const upgradeMessagePort = (port) => {
13
13
  Assert.object(port)
14
14
  return {
15
- type: 'send',
16
15
  method: 'HandleElectronMessagePort.handleElectronMessagePort',
17
16
  params: [port],
17
+ type: 'send',
18
18
  }
19
19
  }
20
20
 
21
21
  export const upgradeWebSocket = (handle, message) => {
22
22
  return {
23
- type: 'send',
24
23
  method: 'HandleWebSocket.handleWebSocket',
25
24
  params: [handle, message],
25
+ type: 'send',
26
26
  }
27
27
  }
@@ -6,9 +6,9 @@ export const targetWebSocket = () => {
6
6
 
7
7
  export const upgradeWebSocket = (handle, message) => {
8
8
  return {
9
- type: 'send',
10
9
  method: 'HandleWebSocket.handleWebSocket',
11
10
  params: [handle, message],
11
+ type: 'send',
12
12
  }
13
13
  }
14
14
 
@@ -18,8 +18,8 @@ export const targetMessagePort = () => {
18
18
 
19
19
  export const upgradeMessagePort = (port) => {
20
20
  return {
21
- type: 'send',
22
21
  method: 'HandleElectronMessagePort.handleElectronMessagePort',
23
22
  params: [port],
23
+ type: 'send',
24
24
  }
25
25
  }
@@ -8,9 +8,9 @@ import * as ParentIpc from '../MainProcess/MainProcess.js'
8
8
  export const targetWebSocket = async (handle, message) => {
9
9
  handle.on('error', HandleSocketError.handleSocketError)
10
10
  const ipc = await IpcChild.listen({
11
+ handle,
11
12
  method: IpcChildType.WebSocket,
12
13
  request: message,
13
- handle,
14
14
  })
15
15
  return ipc
16
16
  }
@@ -24,8 +24,8 @@ export const upgradeWebSocket = () => {
24
24
  export const targetMessagePort = async (messagePort, message) => {
25
25
  Assert.object(messagePort)
26
26
  const ipc = await IpcChild.listen({
27
- method: IpcChildType.ElectronMessagePort,
28
27
  messagePort,
28
+ method: IpcChildType.ElectronMessagePort,
29
29
  })
30
30
  if (message.ipcId === IpcId.MainProcess) {
31
31
  // update ipc with message port ipc that supports transferring objects
@@ -1,5 +1,5 @@
1
- import * as PtyHost from '../PtyHost/PtyHost.js'
2
1
  import * as IpcParentType from '../IpcParentType/IpcParentType.js'
2
+ import * as PtyHost from '../PtyHost/PtyHost.js'
3
3
 
4
4
  export const targetWebSocket = () => {
5
5
  return PtyHost.getOrCreate(IpcParentType.NodeForkedProcess)
@@ -7,9 +7,9 @@ export const targetWebSocket = () => {
7
7
 
8
8
  export const upgradeWebSocket = (handle, message) => {
9
9
  return {
10
- type: 'send',
11
10
  method: 'HandleWebSocket.handleWebSocket',
12
11
  params: [handle, message],
12
+ type: 'send',
13
13
  }
14
14
  }
15
15
 
@@ -19,8 +19,8 @@ export const targetMessagePort = () => {
19
19
 
20
20
  export const upgradeMessagePort = (port) => {
21
21
  return {
22
- type: 'send',
23
22
  method: 'HandleElectronMessagePort.handleElectronMessagePort',
24
23
  params: [port],
24
+ type: 'send',
25
25
  }
26
26
  }
@@ -3,6 +3,6 @@ import * as HandleMessagePortForAuthProcess from './HandleMessagePortForAuthProc
3
3
  export const name = 'HandleMessagePortForAuthProcess'
4
4
 
5
5
  export const Commands = {
6
- handleMessagePortForAuthProcess: HandleMessagePortForAuthProcess.handleMessagePortForAuthProcess,
7
6
  handleAuthProcessIpcClosed: HandleMessagePortForAuthProcess.handleAuthProcessIpcClosed,
7
+ handleMessagePortForAuthProcess: HandleMessagePortForAuthProcess.handleMessagePortForAuthProcess,
8
8
  }
@@ -3,6 +3,6 @@ import * as HandleMessagePortForEmbedsProcess from './HandleMessagePortForEmbeds
3
3
  export const name = 'HandleMessagePortForEmbedsProcess'
4
4
 
5
5
  export const Commands = {
6
- handleMessagePortForEmbedsProcess: HandleMessagePortForEmbedsProcess.handleMessagePortForEmbedsProcess,
7
6
  handleEmbedsProcessIpcClosed: HandleMessagePortForEmbedsProcess.handleEmbedsProcessIpcClosed,
7
+ handleMessagePortForEmbedsProcess: HandleMessagePortForEmbedsProcess.handleMessagePortForEmbedsProcess,
8
8
  }
@@ -1,6 +1,6 @@
1
+ import * as Assert from '../Assert/Assert.js'
1
2
  import * as HandleIncomingIpc from '../HandleIncomingIpc/HandleIncomingIpc.js'
2
3
  import * as IpcId from '../IpcId/IpcId.js'
3
- import * as Assert from '../Assert/Assert.js'
4
4
 
5
5
  export const handleMessagePortForTerminalProcess = (port) => {
6
6
  Assert.object(port)
@@ -4,8 +4,8 @@ import * as IpcChildType from '../IpcChildType/IpcChildType.js'
4
4
 
5
5
  export const handleNodeMessagePort = async (messagePort) => {
6
6
  const ipc = await IpcChild.listen({
7
- method: IpcChildType.NodeMessagePort,
8
7
  messagePort,
8
+ method: IpcChildType.NodeMessagePort,
9
9
  })
10
10
  HandleIpc.handleIpc(ipc)
11
11
  }
@@ -1,7 +1,7 @@
1
1
  import * as Assert from '../Assert/Assert.js'
2
2
  import * as DestroyWebSocket from '../DestroySocket/DestroySocket.js'
3
- import * as HandleWebSocketModule from '../HandleWebSocketModule/HandleWebSocketModule.js'
4
3
  import * as GetTypeFromUrl from '../GetTypeFromUrl/GetTypeFromUrl.js'
4
+ import * as HandleWebSocketModule from '../HandleWebSocketModule/HandleWebSocketModule.js'
5
5
  import * as IsAllowedWebSocketOrigin from '../IsAllowedWebSocketOrigin/IsAllowedWebSocketOrigin.js'
6
6
  import * as RejectWebSocket from '../RejectWebSocket/RejectWebSocket.js'
7
7
  import { VError } from '../VError/VError.js'
@@ -1,5 +1,5 @@
1
- import * as Logger from '../Logger/Logger.js'
2
1
  import * as DestroySocket from '../DestroySocket/DestroySocket.js'
2
+ import * as Logger from '../Logger/Logger.js'
3
3
 
4
4
  export const handleWebSocket = (message, handle, protocol) => {
5
5
  Logger.warn(`[shared-process] unsupported sec-websocket-protocol ${protocol}`)
@@ -14,20 +14,20 @@ export const load = (protocol) => {
14
14
  throw new VError('missing sec websocket protocol header')
15
15
  }
16
16
  switch (protocol) {
17
- case ProtocolType.SharedProcess:
18
- return HandleWebSocketForSharedProcess
19
17
  case ProtocolType.ClipBoardProcess:
20
18
  return HandleWebSocketForClipBoardProcess
21
19
  case ProtocolType.ExtensionHostHelperProcess:
22
20
  return HandleWebSocketForExtensionHostHelperProcess
23
- case ProtocolType.TerminalProcess:
24
- return HandleWebSocketForTerminalProcess
25
- case ProtocolType.SearchProcess:
26
- return HandleWebSocketForSearchProcess
27
- case ProtocolType.ProcessExplorer:
28
- return HandleWebSocketForProcessExplorer
29
21
  case ProtocolType.FileSystemProcess:
30
22
  return HandleWebSocketForFileSystemProcess
23
+ case ProtocolType.ProcessExplorer:
24
+ return HandleWebSocketForProcessExplorer
25
+ case ProtocolType.SearchProcess:
26
+ return HandleWebSocketForSearchProcess
27
+ case ProtocolType.SharedProcess:
28
+ return HandleWebSocketForSharedProcess
29
+ case ProtocolType.TerminalProcess:
30
+ return HandleWebSocketForTerminalProcess
31
31
  default:
32
32
  return HandleWebSocketForUnknown
33
33
  }
@@ -1,6 +1,6 @@
1
1
  import { createWriteStream } from 'node:fs'
2
- import { getHeapSnapshot } from 'node:v8'
3
2
  import { pipeline } from 'node:stream/promises'
3
+ import { getHeapSnapshot } from 'node:v8'
4
4
 
5
5
  export const createHeapSnapshot = async () => {
6
6
  await pipeline(
@@ -9,16 +9,16 @@ import * as IpcChildType from '../IpcChildType/IpcChildType.js'
9
9
 
10
10
  export const getModule = (method) => {
11
11
  switch (method) {
12
- case IpcChildType.NodeForkedProcess:
13
- return IpcChildWithNodeForkedProcess
14
- case IpcChildType.NodeWorker:
15
- return IpcChildWithNodeWorker
16
- case IpcChildType.ElectronUtilityProcess:
17
- return IpcChildWithElectronUtilityProcess
18
12
  case IpcChildType.ElectronMessagePort:
19
13
  return IpcChildWithElectronMessagePort
14
+ case IpcChildType.ElectronUtilityProcess:
15
+ return IpcChildWithElectronUtilityProcess
16
+ case IpcChildType.NodeForkedProcess:
17
+ return IpcChildWithNodeForkedProcess
20
18
  case IpcChildType.NodeMessagePort:
21
19
  return import('../IpcChildWithNodeMessagePort/IpcChildWithNodeMessagePort.js')
20
+ case IpcChildType.NodeWorker:
21
+ return IpcChildWithNodeWorker
22
22
  case IpcChildType.WebSocket:
23
23
  return IpcChildWithWebSocket
24
24
  default:
@@ -14,7 +14,13 @@ const getActualData = (message) => {
14
14
 
15
15
  export const wrap = (messagePort) => {
16
16
  return {
17
+ dispose() {
18
+ this.messagePort.close()
19
+ },
17
20
  messagePort,
21
+ off(event, listener) {
22
+ this.messagePort.off(event, listener)
23
+ },
18
24
  on(event, listener) {
19
25
  if (event === 'message') {
20
26
  const wrappedListener = (event) => {
@@ -32,15 +38,9 @@ export const wrap = (messagePort) => {
32
38
  throw new Error(`unsupported event type ${event}`)
33
39
  }
34
40
  },
35
- off(event, listener) {
36
- this.messagePort.off(event, listener)
37
- },
38
41
  send(message) {
39
42
  this.messagePort.postMessage(message)
40
43
  },
41
- dispose() {
42
- this.messagePort.close()
43
- },
44
44
  start() {
45
45
  this.messagePort.start()
46
46
  },
@@ -3,12 +3,12 @@ import * as IpcParentType from '../IpcParentType/IpcParentType.js'
3
3
 
4
4
  export const getModule = (method) => {
5
5
  switch (method) {
6
- case IpcParentType.NodeWorker:
7
- return IpcParentWithNodeWorker
8
- case IpcParentType.NodeForkedProcess:
9
- return IpcParentWithNodeForkedProcess
10
6
  case IpcParentType.ElectronUtilityProcess:
11
7
  return import('../IpcParentWithElectronUtilityProcess/IpcParentWithElectronUtilityProcess.js')
8
+ case IpcParentType.NodeForkedProcess:
9
+ return IpcParentWithNodeForkedProcess
10
+ case IpcParentType.NodeWorker:
11
+ return IpcParentWithNodeWorker
12
12
  default:
13
13
  throw new Error('unexpected ipc type')
14
14
  }