@lvce-editor/shared-process 0.25.9 → 0.25.11

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 (407) hide show
  1. package/package.json +5 -6
  2. package/src/parts/AddAccurateMemoryUsage/AddAccurateMemoryUsage.js +7 -8
  3. package/src/parts/AddSemiColon/AddSemiColon.js +3 -4
  4. package/src/parts/AppWindow/AppWindow.js +14 -16
  5. package/src/parts/ApplyEdit/ApplyEdit.js +6 -7
  6. package/src/parts/Assert/Assert.js +1 -1
  7. package/src/parts/AttachDebugger/AttachDebugger.ipc.js +4 -6
  8. package/src/parts/AttachDebugger/AttachDebugger.js +4 -5
  9. package/src/parts/Authority/Authority.js +1 -1
  10. package/src/parts/AutoUpdateType/AutoUpdateType.js +4 -4
  11. package/src/parts/AutoUpdater/AutoUpdater.ipc.js +5 -7
  12. package/src/parts/AutoUpdater/AutoUpdater.js +31 -31
  13. package/src/parts/AutoUpdaterAppImage/AutoUpdaterAppImage.ipc.js +5 -7
  14. package/src/parts/AutoUpdaterAppImage/AutoUpdaterAppImage.js +49 -50
  15. package/src/parts/AutoUpdaterWindowsNsis/AutoUpdaterWindowsNsis.ipc.js +5 -7
  16. package/src/parts/AutoUpdaterWindowsNsis/AutoUpdaterWindowsNsis.js +49 -49
  17. package/src/parts/BulkReplacement/BulkReplacement.ipc.js +4 -6
  18. package/src/parts/BulkReplacement/BulkReplacement.js +16 -16
  19. package/src/parts/BulkReplacementContent/BulkReplacementContent.js +26 -27
  20. package/src/parts/ByteSize/ByteSize.js +4 -4
  21. package/src/parts/Callback/Callback.js +1 -1
  22. package/src/parts/Character/Character.js +12 -12
  23. package/src/parts/ChildProcess/ChildProcess.js +71 -86
  24. package/src/parts/Clamp/Clamp.js +2 -2
  25. package/src/parts/Cli/Cli.js +12 -12
  26. package/src/parts/CliCommandType/CliCommandType.js +11 -11
  27. package/src/parts/CliHelp/CliHelp.js +8 -9
  28. package/src/parts/CliInstall/CliInstall.js +24 -24
  29. package/src/parts/CliLink/CliLink.js +17 -17
  30. package/src/parts/CliList/CliList.js +15 -18
  31. package/src/parts/CliModule/CliModule.js +26 -27
  32. package/src/parts/CliStatus/CliStatus.js +4 -5
  33. package/src/parts/CliUnlink/CliUnlink.js +17 -17
  34. package/src/parts/CliVersion/CliVersion.js +7 -8
  35. package/src/parts/ClipBoard/ClipBoard.ipc.js +5 -7
  36. package/src/parts/ClipBoard/ClipBoard.js +18 -21
  37. package/src/parts/ClipBoard/ClipBoardGnome.js +49 -54
  38. package/src/parts/ClipBoard/ClipBoardNoop.js +10 -12
  39. package/src/parts/ClipBoard/ClipBoardWindows.js +17 -18
  40. package/src/parts/CollectTextSearchStdout/CollectTextSearchStdout.js +83 -93
  41. package/src/parts/ColorTheme/ColorTheme.js +14 -17
  42. package/src/parts/Command/Command.js +61 -68
  43. package/src/parts/CommandNotFoundError/CommandNotFoundError.js +7 -8
  44. package/src/parts/CompareVersion/CompareVersion.js +2 -2
  45. package/src/parts/ContentSecurityPolicy/ContentSecurityPolicy.ipc.js +4 -6
  46. package/src/parts/ContentSecurityPolicy/ContentSecurityPolicy.js +6 -7
  47. package/src/parts/ContentSecurityPolicyDocument/ContentSecurityPolicyDocument.js +10 -14
  48. package/src/parts/ContentSecurityPolicyState/ContentSecurityPolicyState.js +5 -7
  49. package/src/parts/ContentSecurityPolicySyntaxHighlightingWorker/ContentSecurityPolicySyntaxHighlightingWorker.js +2 -0
  50. package/src/parts/ContentSecurityPolicyTerminalWorker/ContentSecurityPolicyTerminalWorker.js +2 -4
  51. package/src/parts/ContentSecurityPolicyTestWorker/ContentSecurityPolicyTestWorker.js +2 -4
  52. package/src/parts/ContentSecurityPolicyWorker/ContentSecurityPolicyWorker.js +7 -12
  53. package/src/parts/CpuProfile/CpuProfile.js +22 -25
  54. package/src/parts/Crash/Crash.ipc.js +5 -7
  55. package/src/parts/Crash/Crash.js +8 -11
  56. package/src/parts/CreatePidMap/CreatePidMap.js +4 -5
  57. package/src/parts/CreateTestOverview/CreateTestOverview.js +19 -22
  58. package/src/parts/CrossOriginEmbedderPolicy/CrossOriginEmbedderPolicy.js +1 -1
  59. package/src/parts/CrossOriginOpenerPolicy/CrossOriginOpenerPolicy.js +2 -2
  60. package/src/parts/Debug/Debug.js +2 -3
  61. package/src/parts/DefaultUrl/DefaultUrl.js +3 -4
  62. package/src/parts/Desktop/Desktop.js +18 -19
  63. package/src/parts/DesktopCapturer/DesktopCapturer.ipc.js +4 -6
  64. package/src/parts/DesktopCapturer/DesktopCapturer.js +3 -4
  65. package/src/parts/DesktopType/DesktopType.js +3 -3
  66. package/src/parts/DestroySocket/DestroySocket.js +5 -4
  67. package/src/parts/Developer/Developer.ipc.js +12 -14
  68. package/src/parts/Developer/Developer.js +33 -40
  69. package/src/parts/DirentType/DirentType.js +12 -12
  70. package/src/parts/Download/Download.ipc.js +4 -6
  71. package/src/parts/Download/Download.js +20 -19
  72. package/src/parts/DownloadAndExtract/DownloadAndExtract.js +16 -20
  73. package/src/parts/ElectronApplicationMenu/ElectronApplicationMenu.ipc.js +5 -7
  74. package/src/parts/ElectronApplicationMenu/ElectronApplicationMenu.js +20 -23
  75. package/src/parts/ElectronBrowserView/ElectronBrowserView.ipc.js +5 -7
  76. package/src/parts/ElectronBrowserView/ElectronBrowserView.js +18 -21
  77. package/src/parts/ElectronBrowserViewFunctions/ElectronBrowserViewFunctions.ipc.js +17 -19
  78. package/src/parts/ElectronBrowserViewFunctions/ElectronBrowserViewFunctions.js +26 -41
  79. package/src/parts/ElectronBrowserViewIpcState/ElectronBrowserViewIpcState.js +10 -14
  80. package/src/parts/ElectronBrowserViewQuickPick/ElectronBrowserViewQuickPick.ipc.js +5 -7
  81. package/src/parts/ElectronBrowserViewQuickPick/ElectronBrowserViewQuickPick.js +5 -7
  82. package/src/parts/ElectronBrowserViewState/ElectronBrowserViewState.js +8 -11
  83. package/src/parts/ElectronBrowserViewSuggestions/ElectronBrowserViewSuggestions.ipc.js +6 -8
  84. package/src/parts/ElectronBrowserViewSuggestions/ElectronBrowserViewSuggestions.js +7 -10
  85. package/src/parts/ElectronClipBoard/ElectronClipBoard.ipc.js +4 -6
  86. package/src/parts/ElectronClipBoard/ElectronClipBoard.js +3 -4
  87. package/src/parts/ElectronContentTracing/ElectronContentTracing.ipc.js +5 -7
  88. package/src/parts/ElectronContentTracing/ElectronContentTracing.js +5 -7
  89. package/src/parts/ElectronContextMenu/ElectronContextMenu.ipc.js +4 -6
  90. package/src/parts/ElectronContextMenu/ElectronContextMenu.js +7 -8
  91. package/src/parts/ElectronDeveloper/ElectronDeveloper.ipc.js +4 -6
  92. package/src/parts/ElectronDeveloper/ElectronDeveloper.js +3 -4
  93. package/src/parts/ElectronDialog/ElectronDialog.ipc.js +5 -7
  94. package/src/parts/ElectronDialog/ElectronDialog.js +5 -7
  95. package/src/parts/ElectronInitialize/ElectronInitialize.ipc.js +4 -6
  96. package/src/parts/ElectronInitialize/ElectronInitialize.js +9 -10
  97. package/src/parts/ElectronNet/ElectronNet.ipc.js +4 -6
  98. package/src/parts/ElectronNet/ElectronNet.js +3 -4
  99. package/src/parts/ElectronNetLog/ElectronNetLog.ipc.js +5 -7
  100. package/src/parts/ElectronNetLog/ElectronNetLog.js +5 -7
  101. package/src/parts/ElectronPowerSaveBlocker/ElectronPowerSaveBlocker.ipc.js +5 -7
  102. package/src/parts/ElectronPowerSaveBlocker/ElectronPowerSaveBlocker.js +5 -7
  103. package/src/parts/ElectronProcess/ElectronProcess.ipc.js +5 -7
  104. package/src/parts/ElectronProcess/ElectronProcess.js +5 -7
  105. package/src/parts/ElectronSafeStorage/ElectronSafeStorage.ipc.js +6 -8
  106. package/src/parts/ElectronSafeStorage/ElectronSafeStorage.js +10 -13
  107. package/src/parts/ElectronShell/ElectronShell.ipc.js +4 -6
  108. package/src/parts/ElectronShell/ElectronShell.js +3 -4
  109. package/src/parts/ElectronWebContents/ElectronWebContents.ipc.js +11 -13
  110. package/src/parts/ElectronWebContents/ElectronWebContents.js +45 -61
  111. package/src/parts/ElectronWebContentsView/ElectronWebContentsView.ipc.js +5 -7
  112. package/src/parts/ElectronWebContentsView/ElectronWebContentsView.js +16 -18
  113. package/src/parts/ElectronWebContentsViewFunctions/ElectronWebContentsViewFunctions.ipc.js +17 -19
  114. package/src/parts/ElectronWebContentsViewFunctions/ElectronWebContentsViewFunctions.js +26 -41
  115. package/src/parts/ElectronWindow/ElectronWindow.ipc.js +15 -17
  116. package/src/parts/ElectronWindow/ElectronWindow.js +60 -81
  117. package/src/parts/ElectronWindowAbout/ElectronWindowAbout.ipc.js +4 -6
  118. package/src/parts/ElectronWindowAbout/ElectronWindowAbout.js +3 -4
  119. package/src/parts/ElectronWindowProcessExplorer/ElectronWindowProcessExplorer.ipc.js +4 -6
  120. package/src/parts/ElectronWindowProcessExplorer/ElectronWindowProcessExplorer.js +31 -33
  121. package/src/parts/EncodingType/EncodingType.js +2 -2
  122. package/src/parts/Env/Env.js +11 -16
  123. package/src/parts/Error/FileSystemError.js +6 -7
  124. package/src/parts/ErrorCodes/ErrorCodes.js +22 -22
  125. package/src/parts/ErrorHandling/ErrorHandling.js +52 -60
  126. package/src/parts/Exec/Exec.js +11 -12
  127. package/src/parts/ExecCommand/ExecCommand.js +19 -22
  128. package/src/parts/ExecPromise/ExecPromise.js +3 -4
  129. package/src/parts/Exit/Exit.ipc.js +4 -6
  130. package/src/parts/Exit/Exit.js +3 -4
  131. package/src/parts/ExitCode/ExitCode.js +3 -5
  132. package/src/parts/ExportStatic/ExportStatic.js +318 -419
  133. package/src/parts/ExtensionHostHelperProcessIpc/ExtensionHostHelperProcessIpc.js +13 -14
  134. package/src/parts/ExtensionHostRpc/ExtensionHostRpc.js +70 -79
  135. package/src/parts/ExtensionInstall/ExtensionInstall.ipc.js +4 -6
  136. package/src/parts/ExtensionInstall/ExtensionInstall.js +21 -23
  137. package/src/parts/ExtensionInstallFromFile/ExtensionInstallFromFile.js +32 -33
  138. package/src/parts/ExtensionInstallFromGitHub/ExtensionInstallFromGitHub.js +30 -30
  139. package/src/parts/ExtensionInstallFromUrl/ExtensionInstallFromUrl.js +30 -30
  140. package/src/parts/ExtensionInstallParseInput/ExtensionInstallParseInput.js +43 -46
  141. package/src/parts/ExtensionInstallType/ExtensionInstallType.js +4 -7
  142. package/src/parts/ExtensionLink/ExtensionLink.js +40 -40
  143. package/src/parts/ExtensionList/ExtensionList.js +57 -63
  144. package/src/parts/ExtensionManagement/ExtensionManagement.ipc.js +16 -17
  145. package/src/parts/ExtensionManagement/ExtensionManagement.js +70 -87
  146. package/src/parts/ExtensionManagement/ExtensionManagementColorTheme.js +62 -70
  147. package/src/parts/ExtensionManagement/ExtensionManagementIconTheme.js +26 -26
  148. package/src/parts/ExtensionManagement/ExtensionManagementLanguages.js +55 -59
  149. package/src/parts/ExtensionManifest/ExtensionManifest.js +50 -48
  150. package/src/parts/ExtensionManifestInputType/ExtensionManifestInputType.js +3 -5
  151. package/src/parts/ExtensionManifestStatus/ExtensionManifestStatus.js +2 -3
  152. package/src/parts/ExtensionManifests/ExtensionManifests.js +36 -40
  153. package/src/parts/ExtensionManifests/ExtensionManifestsFromFolder.js +19 -19
  154. package/src/parts/ExtensionManifests/ExtensionManifestsFromLinkedExtensionsFolder.js +46 -47
  155. package/src/parts/ExtensionManifests/ExtensionManifestsFromOnlyExtension.js +7 -8
  156. package/src/parts/ExtensionUninstall/ExtensionUninstall.js +17 -17
  157. package/src/parts/ExtensionUnlink/ExtensionUnlink.js +19 -19
  158. package/src/parts/Extract/Extract.js +24 -28
  159. package/src/parts/FileNotFoundError/FileNotFoundError.js +11 -13
  160. package/src/parts/FileSystem/FileSystem.ipc.js +27 -30
  161. package/src/parts/FileSystem/FileSystem.js +214 -228
  162. package/src/parts/FileSystemWatch/FileSystemWatch.js +4 -5
  163. package/src/parts/FirstNodeWorkerEventType/FirstNodeWorkerEventType.js +3 -3
  164. package/src/parts/GetAccurateMemoryUsage/GetAccurateMemoryUsage.js +34 -34
  165. package/src/parts/GetAppImageDownloadUrl/GetAppImageDownloadUrl.js +4 -5
  166. package/src/parts/GetAppImagePath/GetAppImagePath.js +3 -4
  167. package/src/parts/GetAppWindowOptions/GetAppWindowOptions.js +26 -28
  168. package/src/parts/GetBrowserWindowOptions/GetBrowserWindowOptions.js +26 -27
  169. package/src/parts/GetContentSecurityPolicy/GetContentSecurityPolicy.js +5 -0
  170. package/src/parts/GetDirentType/GetDirentType.js +24 -25
  171. package/src/parts/GetElectronFileResponse/GetElectronFileResponse.ipc.js +4 -6
  172. package/src/parts/GetElectronFileResponse/GetElectronFileResponse.js +43 -43
  173. package/src/parts/GetElectronFileResponseAbsolutePath/GetElectronFileResponseAbsolutePath.js +32 -33
  174. package/src/parts/GetElectronFileResponseContent/GetElectronFileResponseContent.js +15 -16
  175. package/src/parts/GetElectronFileResponseRelativePath/GetElectronFileResponseRelativePath.js +11 -13
  176. package/src/parts/GetElectronRebuildPath/GetElectronRebuildPath.js +8 -9
  177. package/src/parts/GetEtag/GetEtag.js +2 -2
  178. package/src/parts/GetFirstEvent/GetFirstEvent.js +20 -21
  179. package/src/parts/GetFirstNodeWorkerEvent/GetFirstNodeWorkerEvent.js +7 -8
  180. package/src/parts/GetFirstSpawnedProcessEvent/GetFirstSpawnedProcessEvent.js +7 -8
  181. package/src/parts/GetHeaders/GetHeaders.js +50 -48
  182. package/src/parts/GetHeadersDefault/GetHeadersDefault.js +2 -2
  183. package/src/parts/GetHeadersExtensionHostWorker/GetHeadersExtensionHostWorker.js +8 -9
  184. package/src/parts/GetHeadersMainFrame/GetHeadersMainFrame.js +10 -11
  185. package/src/parts/GetHeadersOtherWorker/GetHeadersOtherWorker.js +12 -13
  186. package/src/parts/GetHeadersRendererWorker/GetHeadersRendererWorker.js +8 -9
  187. package/src/parts/GetHeadersSyntaxHighlightingWorker/GetHeadersSyntaxHighlightingWorker.js +9 -0
  188. package/src/parts/GetHeadersTerminalWorker/GetHeadersTerminalWorker.js +8 -9
  189. package/src/parts/GetHeadersTestWorker/GetHeadersTestWorker.js +8 -9
  190. package/src/parts/GetHelpString/GetHelpString.js +4 -5
  191. package/src/parts/GetHttpErrorMessage/GetHttpErrorMessage.js +20 -21
  192. package/src/parts/GetIcon/GetIcon.js +17 -18
  193. package/src/parts/GetLatestReleaseVersion/GetLatestReleaseVersion.js +29 -30
  194. package/src/parts/GetMimeType/GetMimeType.js +26 -27
  195. package/src/parts/GetNewLineIndex/GetNewLineIndex.js +3 -4
  196. package/src/parts/GetNotFoundResponse/GetNotFoundResponse.js +10 -11
  197. package/src/parts/GetNotModifiedResponse/GetNotModifiedResponse.js +9 -10
  198. package/src/parts/GetNsisUpdateArgs/GetNsisUpdateArgs.js +6 -6
  199. package/src/parts/GetNsisUpdateDownloadPath/GetNsisUpdateDownloadPath.js +9 -10
  200. package/src/parts/GetPathName/GetPathName.js +3 -3
  201. package/src/parts/GetPreloadUrl/GetPreloadUrl.js +4 -5
  202. package/src/parts/GetProcessExplorerUrl/GetProcessExplorerUrl.js +3 -4
  203. package/src/parts/GetPsOutput/GetPsOutput.js +16 -17
  204. package/src/parts/GetRemoteUrl/GetRemoteUrl.js +4 -5
  205. package/src/parts/GetServerErrorResponse/GetServerErrorResponse.js +10 -11
  206. package/src/parts/GetStatusString/GetStatusString.js +54 -62
  207. package/src/parts/GetTerminalProcessPath/GetTerminalProcessPath.js +4 -5
  208. package/src/parts/GetTerminalSpawnOptions/GetTerminalSpawnOptions.ipc.js +4 -6
  209. package/src/parts/GetTerminalSpawnOptions/GetTerminalSpawnOptions.js +16 -17
  210. package/src/parts/GetTestPath/GetTestPath.js +10 -11
  211. package/src/parts/GetTestRequestResponse/GetTestRequestResponse.js +41 -42
  212. package/src/parts/GetTitleBarItems/GetTitleBarItems.js +40 -41
  213. package/src/parts/GetTypeFromUrl/GetTypeFromUrl.js +17 -18
  214. package/src/parts/GetTypeScriptPath/GetTypeScriptPath.js +11 -20
  215. package/src/parts/GetVersionString/GetVersionString.js +4 -5
  216. package/src/parts/GetWindowId/GetWindowId.ipc.js +4 -6
  217. package/src/parts/GetWindowId/GetWindowId.js +4 -5
  218. package/src/parts/GetWindowsNsisDownloadUrl/GetWindowsNsisDownloadUrl.js +6 -7
  219. package/src/parts/GetWorkspaceId/GetWorkspaceId.js +3 -4
  220. package/src/parts/GitLsFiles/GitLsFiles.ipc.js +6 -8
  221. package/src/parts/GitLsFiles/GitLsFiles.js +19 -22
  222. package/src/parts/HandleCliArgs/HandleCliArgs.ipc.js +4 -6
  223. package/src/parts/HandleCliArgs/HandleCliArgs.js +11 -11
  224. package/src/parts/HandleElectronMessagePort/HandleElectronMessagePort.ipc.js +4 -6
  225. package/src/parts/HandleElectronMessagePort/HandleElectronMessagePort.js +13 -14
  226. package/src/parts/HandleElectronReady/HandleElectronReady.ipc.js +4 -6
  227. package/src/parts/HandleElectronReady/HandleElectronReady.js +8 -9
  228. package/src/parts/HandleIpc/HandleIpc.js +20 -23
  229. package/src/parts/HandleMessagePortForExtensionHostHelperProcess/HandleMessagePortForExtensionHostHelperProcess.ipc.js +4 -6
  230. package/src/parts/HandleMessagePortForExtensionHostHelperProcess/HandleMessagePortForExtensionHostHelperProcess.js +17 -18
  231. package/src/parts/HandleMessagePortForTerminalProcess/HandleMessagePortForTerminalProcess.ipc.js +4 -6
  232. package/src/parts/HandleMessagePortForTerminalProcess/HandleMessagePortForTerminalProcess.js +8 -9
  233. package/src/parts/HandleNodeMessagePort/HandleNodeMessagePort.ipc.js +4 -6
  234. package/src/parts/HandleNodeMessagePort/HandleNodeMessagePort.js +9 -10
  235. package/src/parts/HandleRemoteRequest/HandleRemoteRequest.ipc.js +4 -6
  236. package/src/parts/HandleRemoteRequest/HandleRemoteRequest.js +8 -9
  237. package/src/parts/HandleRequestTest/HandleRequestTest.ipc.js +4 -6
  238. package/src/parts/HandleRequestTest/HandleRequestTest.js +9 -10
  239. package/src/parts/HandleSocketError/HandleSocketError.js +10 -11
  240. package/src/parts/HandleUncaughtExceptionMonitor/HandleUncaughtExceptionMonitor.js +9 -12
  241. package/src/parts/HandleWebSocket/HandleWebSocket.ipc.js +4 -6
  242. package/src/parts/HandleWebSocket/HandleWebSocket.js +19 -19
  243. package/src/parts/HandleWebSocketForExtensionHostHelperProcess/HandleWebSocketForExtensionHostHelperProcess.js +8 -9
  244. package/src/parts/HandleWebSocketForSharedProcess/HandleWebSocketForSharedProcess.js +15 -16
  245. package/src/parts/HandleWebSocketForTerminalProcess/HandleWebSocketForTerminalProcess.js +17 -21
  246. package/src/parts/HandleWebSocketForUnknown/HandleWebSocketForUnknown.js +9 -9
  247. package/src/parts/HandleWebSocketModule/HandleWebSocketModule.js +16 -17
  248. package/src/parts/HandleWindowAllClosed/HandleWindowAllClosed.ipc.js +4 -6
  249. package/src/parts/HandleWindowAllClosed/HandleWindowAllClosed.js +9 -10
  250. package/src/parts/HasPositiveMemoryUsage/HasPositiveMemoryUsage.js +2 -2
  251. package/src/parts/Hash/Hash.js +4 -6
  252. package/src/parts/HeapSnapshot/HeapSnapshot.ipc.js +4 -6
  253. package/src/parts/HeapSnapshot/HeapSnapshot.js +6 -9
  254. package/src/parts/HttpHeader/HttpHeader.js +7 -7
  255. package/src/parts/HttpServerResponse/HttpServerResponse.js +15 -16
  256. package/src/parts/HttpStatusCode/HttpStatusCode.js +5 -5
  257. package/src/parts/Id/Id.js +4 -5
  258. package/src/parts/IncrementalTextSearch/IncrementalTextSearch.js +44 -47
  259. package/src/parts/IncrementalTextSearch/IncremetalTextSearch.ipc.js +4 -6
  260. package/src/parts/InferExtensionId/InferExtensionId.js +7 -8
  261. package/src/parts/InstallExtension/InstallExtension.ipc.js +3 -4
  262. package/src/parts/InstallExtension/InstallExtension.js +32 -32
  263. package/src/parts/IpcChild/IpcChild.js +12 -13
  264. package/src/parts/IpcChildModule/IpcChildModule.js +19 -26
  265. package/src/parts/IpcChildType/IpcChildType.js +18 -19
  266. package/src/parts/IpcChildWithElectronMessagePort/IpcChildWithElectronMessagePort.js +47 -48
  267. package/src/parts/IpcChildWithNodeMessagePort/IpcChildWithNodeMessagePort.js +40 -41
  268. package/src/parts/IpcError/IpcError.js +4 -4
  269. package/src/parts/IpcParent/IpcParent.js +8 -9
  270. package/src/parts/IpcParentModule/IpcParentModule.js +13 -14
  271. package/src/parts/IpcParentType/IpcParentType.js +3 -3
  272. package/src/parts/IpcParentWithElectronUtilityProcess/IpcParentWithElectronUtilityProcess.js +45 -48
  273. package/src/parts/IsAbsolutePath/IsAbsolutePath.js +3 -4
  274. package/src/parts/IsAppImage/IsAppImage.js +3 -4
  275. package/src/parts/IsAutoUpdateSupported/IsAutoUpdateSupported.ipc.js +4 -6
  276. package/src/parts/IsAutoUpdateSupported/IsAutoUpdateSupported.js +6 -8
  277. package/src/parts/IsBuiltServer/IsBuiltServer.js +1 -1
  278. package/src/parts/IsDlOpenError/IsDlOpenError.js +3 -4
  279. package/src/parts/IsElectron/IsElectron.js +3 -4
  280. package/src/parts/IsEnoentError/IsEnoentError.js +9 -11
  281. package/src/parts/IsEnoentErrorWindows/IsEnoentErrorWindows.js +2 -2
  282. package/src/parts/IsEsrchError/IsEsrchError.js +3 -4
  283. package/src/parts/IsIgnoredError/IsIgnoredError.js +12 -13
  284. package/src/parts/IsMessagePort/IsMessagePort.js +2 -2
  285. package/src/parts/IsMessagePortMain/IsMessagePortMain.js +2 -2
  286. package/src/parts/IsTypeScriptPath/IsTypeScriptPath.js +2 -2
  287. package/src/parts/IsWindows/IsWindows.js +1 -1
  288. package/src/parts/JoinLines/JoinLines.js +3 -4
  289. package/src/parts/Json/Json.js +15 -17
  290. package/src/parts/JsonFile/JsonFile.js +10 -12
  291. package/src/parts/JsonRpc/JsonRpc.js +1 -1
  292. package/src/parts/JsonRpcVersion/JsonRpcVersion.js +1 -1
  293. package/src/parts/Jsonc/Jsonc.js +1 -1
  294. package/src/parts/JsoncFile/JsoncFile.js +7 -8
  295. package/src/parts/LeftCut/LeftCut.js +17 -18
  296. package/src/parts/LimitString/LimitString.js +13 -14
  297. package/src/parts/ListProcessGetName/ListProcessGetName.js +55 -56
  298. package/src/parts/ListProcessesWithMemoryUsage/ListProcessesWithMemoryUsage.ipc.js +4 -6
  299. package/src/parts/ListProcessesWithMemoryUsage/ListProcessesWithMemoryUsage.js +9 -11
  300. package/src/parts/ListProcessesWithMemoryUsageUnix/ListProcessesWithMemoryUsageUnix.js +19 -20
  301. package/src/parts/ListProcessesWithMemoryUsageWindows/ListProcessesWithMemoryUsageWindows.js +33 -36
  302. package/src/parts/LoadTypeScript/LoadTypeScript.js +12 -12
  303. package/src/parts/LoadWindowsProcessTree/LoadWindowsProcessTree.js +11 -13
  304. package/src/parts/Logger/Logger.js +34 -42
  305. package/src/parts/Main/Main.js +13 -14
  306. package/src/parts/MakeExecutable/MakeExecutable.js +9 -9
  307. package/src/parts/MimeType/MimeType.js +37 -37
  308. package/src/parts/Module/Module.js +150 -153
  309. package/src/parts/ModuleId/ModuleId.js +76 -76
  310. package/src/parts/ModuleMap/ModuleMap.js +329 -330
  311. package/src/parts/OpenExternal/OpenExternal.ipc.js +5 -7
  312. package/src/parts/OpenExternal/OpenExternal.js +5 -7
  313. package/src/parts/OpenNativeFolder/OpenNativeFolder.ipc.js +4 -6
  314. package/src/parts/OpenNativeFolder/OpenNativeFolder.js +9 -9
  315. package/src/parts/Os/Os.ipc.js +4 -6
  316. package/src/parts/Os/Os.js +3 -4
  317. package/src/parts/OutputChannel/OutputChannel.ipc.js +35 -39
  318. package/src/parts/OutputChannel/OutputChannel.js +32 -35
  319. package/src/parts/OutputChannelState/OutputChannelState.js +10 -14
  320. package/src/parts/ParentIpc/ParentIpc.js +19 -25
  321. package/src/parts/ParseInt/ParseInt.js +2 -2
  322. package/src/parts/ParseMemory/ParseMemory.js +9 -10
  323. package/src/parts/ParsePsOutput/ParsePsOutput.js +42 -46
  324. package/src/parts/ParseRipGrepLines/ParseRipGrepLines.js +9 -10
  325. package/src/parts/ParseUrlGithub/ParseUrlGithub.js +49 -51
  326. package/src/parts/Path/Path.js +11 -16
  327. package/src/parts/Performance/Performance.ipc.js +4 -6
  328. package/src/parts/Performance/Performance.js +16 -27
  329. package/src/parts/Platform/Platform.ipc.js +28 -30
  330. package/src/parts/Platform/Platform.js +46 -73
  331. package/src/parts/PlatformPaths/PlatformPaths.ipc.js +21 -23
  332. package/src/parts/PlatformPaths/PlatformPaths.js +79 -114
  333. package/src/parts/Preferences/Preferences.ipc.js +4 -6
  334. package/src/parts/Preferences/Preferences.js +69 -70
  335. package/src/parts/PrettyError/PrettyError.js +1 -1
  336. package/src/parts/PrintPrettyError/PrintPrettyError.js +3 -4
  337. package/src/parts/Process/Process.ipc.js +10 -12
  338. package/src/parts/Process/Process.js +35 -48
  339. package/src/parts/ProcessDisplayName/ProcessDisplayName.js +1 -1
  340. package/src/parts/ProcessExitEventType/ProcessExitEventType.js +2 -2
  341. package/src/parts/ProcessId/ProcessId.ipc.js +5 -7
  342. package/src/parts/ProcessId/ProcessId.js +4 -5
  343. package/src/parts/ProcessListeners/ProcessListeners.js +11 -14
  344. package/src/parts/Promises/Promises.js +18 -18
  345. package/src/parts/ProtocolType/ProtocolType.js +4 -4
  346. package/src/parts/PtyHost/PtyHost.js +55 -62
  347. package/src/parts/PtyHostPath/PtyHostPath.js +10 -10
  348. package/src/parts/PtyHostState/PtyHostState.js +16 -16
  349. package/src/parts/Queue/Queue.js +30 -31
  350. package/src/parts/RebuildForElectron/RebuildForElectron.js +14 -14
  351. package/src/parts/RebuildForNode/RebuildForNode.js +12 -12
  352. package/src/parts/RebuildNodePty/RebuildNodePty.ipc.js +4 -6
  353. package/src/parts/RebuildNodePty/RebuildNodePty.js +20 -22
  354. package/src/parts/RecentlyOpened/RecentlyOpened.ipc.js +4 -6
  355. package/src/parts/RecentlyOpened/RecentlyOpened.js +54 -53
  356. package/src/parts/RemoveSymlink/RemoveSymlink.js +11 -11
  357. package/src/parts/RequiresSocket/RequiresSocket.js +14 -15
  358. package/src/parts/Restart/Restart.js +9 -10
  359. package/src/parts/RipGrep/RipGrep.js +35 -37
  360. package/src/parts/RipGrepParsedLineType/RipGrepParsedLineType.js +4 -4
  361. package/src/parts/RipGrepPath/RipGrepPath.js +1 -1
  362. package/src/parts/Root/Root.js +4 -6
  363. package/src/parts/Screen/Screen.ipc.js +6 -8
  364. package/src/parts/Screen/Screen.js +7 -10
  365. package/src/parts/SearchFile/SearchFile.ipc.js +4 -6
  366. package/src/parts/SearchFile/SearchFile.js +26 -27
  367. package/src/parts/SetHeaders/SetHeaders.js +4 -4
  368. package/src/parts/ShouldLogError/ShouldLogError.js +6 -7
  369. package/src/parts/ShouldTranspileTypescript/ShouldTranspileTypescript.js +10 -11
  370. package/src/parts/Signal/Signal.js +3 -3
  371. package/src/parts/SplitLines/SplitLines.js +3 -4
  372. package/src/parts/SymLink/SymLink.js +3 -4
  373. package/src/parts/TemporaryMessagePort/TemporaryMessagePort.ipc.js +4 -6
  374. package/src/parts/TemporaryMessagePort/TemporaryMessagePort.js +18 -21
  375. package/src/parts/Terminal/Terminal.ipc.js +7 -9
  376. package/src/parts/Terminal/Terminal.js +68 -73
  377. package/src/parts/TerminalState/TerminalState.js +8 -11
  378. package/src/parts/TextDocument/TextDocument.ipc.js +3 -4
  379. package/src/parts/TextDocument/TextDocument.js +17 -22
  380. package/src/parts/TextSearch/TextSearch.ipc.js +4 -6
  381. package/src/parts/TextSearch/TextSearch.js +18 -22
  382. package/src/parts/TextSearchError/TextSearchError.js +12 -12
  383. package/src/parts/TextSearchResultType/TextSearchResultType.js +2 -2
  384. package/src/parts/Timeout/Timeout.js +4 -5
  385. package/src/parts/TmpFile/TmpFile.js +11 -13
  386. package/src/parts/ToAbsolutePaths/ToAbsolutePaths.js +7 -8
  387. package/src/parts/ToTextSearchResult/ToTextSearchResult.js +23 -24
  388. package/src/parts/Trace/Trace.js +10 -14
  389. package/src/parts/TranspileTypeScript/TranspileTypeScript.js +19 -19
  390. package/src/parts/Trash/Trash.js +15 -16
  391. package/src/parts/TrashElectron/TrashElectron.js +7 -8
  392. package/src/parts/TrashNode/TrashNode.js +3 -4
  393. package/src/parts/UpdateState/UpdateState.js +7 -10
  394. package/src/parts/UpdateStateType/UpdateStateType.js +9 -9
  395. package/src/parts/VError/VError.js +1 -1
  396. package/src/parts/WaitForProcessToExit/WaitForProcessToExit.js +7 -8
  397. package/src/parts/WebSocketServer/WebSocketServer.ipc.js +4 -6
  398. package/src/parts/WebSocketServer/WebSocketServer.js +1 -1
  399. package/src/parts/WindowsProcessTree/WindowsProcessTree.js +12 -14
  400. package/src/parts/WindowsProcessTreeDataFlag/WindowsProcessTreeDataFlag.js +3 -3
  401. package/src/parts/Workspace/Workspace.ipc.js +5 -7
  402. package/src/parts/Workspace/Workspace.js +79 -84
  403. package/src/parts/WorkspaceSource/WorkspaceSource.js +2 -2
  404. package/src/sharedProcessMain.js +2 -3
  405. package/src/parts/ChromeExtension/ChromeExtension.ipc.js +0 -8
  406. package/src/parts/ChromeExtension/ChromeExtension.js +0 -46
  407. package/src/parts/ExtractZip/ExtractZip.js +0 -12
@@ -1,34 +1,31 @@
1
1
  // TODO lazyload chokidar and trash (but doesn't work currently because of bug with jest)
2
- import * as fs from 'node:fs/promises'
3
- import * as os from 'node:os'
4
- import * as Assert from '../Assert/Assert.js'
5
- import * as EncodingType from '../EncodingType/EncodingType.js'
6
- import * as ErrorCodes from '../ErrorCodes/ErrorCodes.js'
7
- import { FileNotFoundError } from '../FileNotFoundError/FileNotFoundError.js'
8
- import * as GetDirentType from '../GetDirentType/GetDirentType.js'
9
- import * as IsEnoentError from '../IsEnoentError/IsEnoentError.js'
10
- import * as Path from '../Path/Path.js'
11
- import * as Platform from '../Platform/Platform.js'
12
- import * as Trash from '../Trash/Trash.js'
13
- import { VError } from '../VError/VError.js'
14
-
2
+ import * as fs from 'node:fs/promises';
3
+ import * as os from 'node:os';
4
+ import * as Assert from '../Assert/Assert.js';
5
+ import * as EncodingType from '../EncodingType/EncodingType.js';
6
+ import * as ErrorCodes from '../ErrorCodes/ErrorCodes.js';
7
+ import { FileNotFoundError } from '../FileNotFoundError/FileNotFoundError.js';
8
+ import * as GetDirentType from '../GetDirentType/GetDirentType.js';
9
+ import * as IsEnoentError from '../IsEnoentError/IsEnoentError.js';
10
+ import * as Path from '../Path/Path.js';
11
+ import * as Platform from '../Platform/Platform.js';
12
+ import * as Trash from '../Trash/Trash.js';
13
+ import { VError } from '../VError/VError.js';
15
14
  export const state = {
16
- watcherMap: Object.create(null),
17
- }
18
-
15
+ watcherMap: Object.create(null),
16
+ };
19
17
  export const copy = async (source, target) => {
20
- try {
21
- await fs.cp(source, target, { recursive: true })
22
- } catch (error) {
23
- if (error && error.message && error.message.startsWith('Invalid src or dest: cp returned EINVAL (src and dest cannot be the same)')) {
24
- throw new VError(`Failed to copy "${source}" to "${target}": src and dest cannot be the same`)
25
- }
26
- throw new VError(error, `Failed to copy "${source}" to "${target}"`)
27
- }
28
- }
29
-
18
+ try {
19
+ await fs.cp(source, target, { recursive: true });
20
+ }
21
+ catch (error) {
22
+ if (error && error.message && error.message.startsWith('Invalid src or dest: cp returned EINVAL (src and dest cannot be the same)')) {
23
+ throw new VError(`Failed to copy "${source}" to "${target}": src and dest cannot be the same`);
24
+ }
25
+ throw new VError(error, `Failed to copy "${source}" to "${target}"`);
26
+ }
27
+ };
30
28
  // TODO extensions should only be accessed once on startup
31
-
32
29
  /**
33
30
  *
34
31
  * @param {string} path
@@ -36,24 +33,24 @@ export const copy = async (source, target) => {
36
33
  * @returns
37
34
  */
38
35
  export const readFile = async (path, encoding = EncodingType.Utf8) => {
39
- // console.info('[shared-process] read file', path)
40
- try {
41
- Assert.string(path)
42
- // const start = performance.now()
43
- // console.time(`read ${path}`)
44
- const content = await fs.readFile(path, encoding)
45
- // const end = performance.now()
46
- // console.log('read', path, 'took', (end - start).toFixed(2), 'ms')
47
- // console.timeEnd(`read ${path}`)
48
- return content
49
- } catch (error) {
50
- if (IsEnoentError.isEnoentError(error)) {
51
- throw new FileNotFoundError(path)
52
- }
53
- throw new VError(error, `Failed to read file "${path}"`)
54
- }
55
- }
56
-
36
+ // console.info('[shared-process] read file', path)
37
+ try {
38
+ Assert.string(path);
39
+ // const start = performance.now()
40
+ // console.time(`read ${path}`)
41
+ const content = await fs.readFile(path, encoding);
42
+ // const end = performance.now()
43
+ // console.log('read', path, 'took', (end - start).toFixed(2), 'ms')
44
+ // console.timeEnd(`read ${path}`)
45
+ return content;
46
+ }
47
+ catch (error) {
48
+ if (IsEnoentError.isEnoentError(error)) {
49
+ throw new FileNotFoundError(path);
50
+ }
51
+ throw new VError(error, `Failed to read file "${path}"`);
52
+ }
53
+ };
57
54
  /**
58
55
  *
59
56
  * @param {string} path
@@ -61,154 +58,151 @@ export const readFile = async (path, encoding = EncodingType.Utf8) => {
61
58
  * @param {BufferEncoding} encoding
62
59
  */
63
60
  export const writeFile = async (path, content, encoding = EncodingType.Utf8) => {
64
- try {
65
- Assert.string(path)
66
- Assert.string(content)
67
- // queue would be more correct for concurrent writes but also slower
68
- // Queue.add(`writeFile/${path}`, () =>
69
- await fs.writeFile(path, content, encoding)
70
- } catch (error) {
71
- if (IsEnoentError.isEnoentError(error)) {
72
- throw new FileNotFoundError(path)
73
- }
74
- throw new VError(error, `Failed to write to file "${path}"`)
75
- }
76
- }
77
-
61
+ try {
62
+ Assert.string(path);
63
+ Assert.string(content);
64
+ // queue would be more correct for concurrent writes but also slower
65
+ // Queue.add(`writeFile/${path}`, () =>
66
+ await fs.writeFile(path, content, encoding);
67
+ }
68
+ catch (error) {
69
+ if (IsEnoentError.isEnoentError(error)) {
70
+ throw new FileNotFoundError(path);
71
+ }
72
+ throw new VError(error, `Failed to write to file "${path}"`);
73
+ }
74
+ };
78
75
  export const ensureFile = async (path, content) => {
79
- try {
80
- await fs.mkdir(Path.dirname(path), { recursive: true })
81
- await fs.writeFile(path, content)
82
- } catch (error) {
83
- throw new VError(error, `Failed to write to file "${path}"`)
84
- }
85
- }
86
-
76
+ try {
77
+ await fs.mkdir(Path.dirname(path), { recursive: true });
78
+ await fs.writeFile(path, content);
79
+ }
80
+ catch (error) {
81
+ throw new VError(error, `Failed to write to file "${path}"`);
82
+ }
83
+ };
87
84
  export const createFile = async (path) => {
88
- try {
89
- await fs.writeFile(path, '', { flag: 'wx' })
90
- } catch (error) {
91
- throw new VError(error, `Failed to create file "${path}"`)
92
- }
93
- }
94
-
85
+ try {
86
+ await fs.writeFile(path, '', { flag: 'wx' });
87
+ }
88
+ catch (error) {
89
+ throw new VError(error, `Failed to create file "${path}"`);
90
+ }
91
+ };
95
92
  export const createFolder = async (path, options) => {
96
- try {
97
- await fs.mkdir(path, options)
98
- } catch (error) {
99
- throw new VError(error, `Failed to create folder "${path}"`)
100
- }
101
- }
102
-
93
+ try {
94
+ await fs.mkdir(path, options);
95
+ }
96
+ catch (error) {
97
+ throw new VError(error, `Failed to create folder "${path}"`);
98
+ }
99
+ };
103
100
  const isOkayToRemove = (path) => {
104
- if (path === '/') {
105
- return false
106
- }
107
- if (path === '~') {
108
- return false
109
- }
110
- if (path === os.homedir()) {
111
- return false
112
- }
113
- return true
114
- }
115
-
101
+ if (path === '/') {
102
+ return false;
103
+ }
104
+ if (path === '~') {
105
+ return false;
106
+ }
107
+ if (path === os.homedir()) {
108
+ return false;
109
+ }
110
+ return true;
111
+ };
116
112
  export const remove = async (path) => {
117
- if (!isOkayToRemove(path)) {
118
- console.warn('not removing path')
119
- return
120
- }
121
-
122
- // TODO lazyload trash (doesn't work currently because of bug with jest)
123
- // const { trash } = await import('../../wrap/trash.js')
124
- try {
125
- await Trash.trash(path)
126
- } catch (error) {
127
- throw new VError(error, `Failed to remove "${path}"`)
128
- }
129
- }
130
-
113
+ if (!isOkayToRemove(path)) {
114
+ console.warn('not removing path');
115
+ return;
116
+ }
117
+ // TODO lazyload trash (doesn't work currently because of bug with jest)
118
+ // const { trash } = await import('../../wrap/trash.js')
119
+ try {
120
+ await Trash.trash(path);
121
+ }
122
+ catch (error) {
123
+ throw new VError(error, `Failed to remove "${path}"`);
124
+ }
125
+ };
131
126
  export const forceRemove = async (path) => {
132
- if (!isOkayToRemove(path)) {
133
- console.warn('not removing path')
134
- return
135
- }
136
- try {
137
- await fs.rm(path, { force: true, recursive: true })
138
- } catch (error) {
139
- throw new VError(error, `Failed to remove "${path}"`)
140
- }
141
- }
142
-
127
+ if (!isOkayToRemove(path)) {
128
+ console.warn('not removing path');
129
+ return;
130
+ }
131
+ try {
132
+ await fs.rm(path, { force: true, recursive: true });
133
+ }
134
+ catch (error) {
135
+ throw new VError(error, `Failed to remove "${path}"`);
136
+ }
137
+ };
143
138
  export const exists = async (path) => {
144
- try {
145
- await fs.access(path)
146
- return true
147
- } catch {
148
- return false
149
- }
150
- }
151
-
139
+ try {
140
+ await fs.access(path);
141
+ return true;
142
+ }
143
+ catch {
144
+ return false;
145
+ }
146
+ };
152
147
  /**
153
148
  * @param {import('fs').Dirent} dirent
154
149
  */
155
150
  const toPrettyDirent = (dirent) => {
156
- return {
157
- name: dirent.name,
158
- type: GetDirentType.getDirentType(dirent),
159
- }
160
- }
161
-
151
+ return {
152
+ name: dirent.name,
153
+ type: GetDirentType.getDirentType(dirent),
154
+ };
155
+ };
162
156
  export const readDirWithFileTypes = async (path) => {
163
- try {
164
- const dirents = await fs.readdir(path, { withFileTypes: true })
165
- const prettyDirents = dirents.map(toPrettyDirent)
166
- return prettyDirents
167
- } catch (error) {
168
- throw new VError(error, `Failed to read directory "${path}"`)
169
- }
170
- }
171
-
157
+ try {
158
+ const dirents = await fs.readdir(path, { withFileTypes: true });
159
+ const prettyDirents = dirents.map(toPrettyDirent);
160
+ return prettyDirents;
161
+ }
162
+ catch (error) {
163
+ throw new VError(error, `Failed to read directory "${path}"`);
164
+ }
165
+ };
172
166
  export const readDir = async (path) => {
173
- try {
174
- const dirents = await fs.readdir(path)
175
- return dirents
176
- } catch (error) {
177
- if (IsEnoentError.isEnoentError(error)) {
178
- throw new FileNotFoundError(path)
179
- }
180
- throw new VError(error, `Failed to read directory "${path}"`)
181
- }
182
- }
183
-
167
+ try {
168
+ const dirents = await fs.readdir(path);
169
+ return dirents;
170
+ }
171
+ catch (error) {
172
+ if (IsEnoentError.isEnoentError(error)) {
173
+ throw new FileNotFoundError(path);
174
+ }
175
+ throw new VError(error, `Failed to read directory "${path}"`);
176
+ }
177
+ };
184
178
  export const mkdir = async (path) => {
185
- try {
186
- await fs.mkdir(path, { recursive: true })
187
- } catch (error) {
188
- throw new VError(error, `Failed to create directory "${path}"`)
189
- }
190
- }
191
-
179
+ try {
180
+ await fs.mkdir(path, { recursive: true });
181
+ }
182
+ catch (error) {
183
+ throw new VError(error, `Failed to create directory "${path}"`);
184
+ }
185
+ };
192
186
  const fallbackRename = async (oldPath, newPath) => {
193
- try {
194
- await fs.cp(oldPath, newPath, { recursive: true })
195
- await fs.rm(oldPath, { recursive: true })
196
- } catch (error) {
197
- throw new VError(error, `Failed to rename "${oldPath}" to "${newPath}"`)
198
- }
199
- }
200
-
187
+ try {
188
+ await fs.cp(oldPath, newPath, { recursive: true });
189
+ await fs.rm(oldPath, { recursive: true });
190
+ }
191
+ catch (error) {
192
+ throw new VError(error, `Failed to rename "${oldPath}" to "${newPath}"`);
193
+ }
194
+ };
201
195
  export const rename = async (oldPath, newPath) => {
202
- try {
203
- await fs.rename(oldPath, newPath)
204
- } catch (error) {
205
- if (error && error.code === ErrorCodes.EXDEV) {
206
- return fallbackRename(oldPath, newPath)
207
- }
208
- throw new VError(error, `Failed to rename "${oldPath}" to "${newPath}"`)
209
- }
210
- }
211
-
196
+ try {
197
+ await fs.rename(oldPath, newPath);
198
+ }
199
+ catch (error) {
200
+ if (error && error.code === ErrorCodes.EXDEV) {
201
+ return fallbackRename(oldPath, newPath);
202
+ }
203
+ throw new VError(error, `Failed to rename "${oldPath}" to "${newPath}"`);
204
+ }
205
+ };
212
206
  // TODO have a separate process for file watching
213
207
  // export const watch = async (path, options) => {
214
208
  // // let state = 'loading'
@@ -216,78 +210,70 @@ export const rename = async (oldPath, newPath) => {
216
210
  // const watcher = chokidar.watch(`${path}`, {
217
211
  // ignoreInitial: true,
218
212
  // })
219
-
220
213
  // if (options.onAll) {
221
214
  // watcher.on('all', options.onAll)
222
215
  // }
223
216
  // return watcher
224
-
225
217
  // // const { default: chokidar } = await import('chokidar')
226
218
  // }
227
-
228
219
  export const getPathSeparator = () => {
229
- return Platform.getPathSeparator()
230
- }
231
-
220
+ return Platform.getPathSeparator();
221
+ };
232
222
  export const getRealPath = async (path) => {
233
- try {
234
- return await fs.realpath(path)
235
- } catch (error) {
236
- // @ts-ignore
237
- if (
238
- error &&
239
- error instanceof globalThis.Error &&
240
- // @ts-ignore
241
- error.code === ErrorCodes.ENOENT
242
- ) {
243
- let content
244
- try {
245
- content = await fs.readlink(path)
246
- } catch {
247
- throw new VError(error, `Failed to resolve real path for ${path}`)
248
- }
249
- throw new VError(`Broken symbolic link: File not found ${content}`)
250
- }
251
- throw new VError(error, `Failed to resolve real path for ${path}`)
252
- }
253
- }
254
-
223
+ try {
224
+ return await fs.realpath(path);
225
+ }
226
+ catch (error) {
227
+ // @ts-ignore
228
+ if (error &&
229
+ error instanceof globalThis.Error &&
230
+ // @ts-ignore
231
+ error.code === ErrorCodes.ENOENT) {
232
+ let content;
233
+ try {
234
+ content = await fs.readlink(path);
235
+ }
236
+ catch {
237
+ throw new VError(error, `Failed to resolve real path for ${path}`);
238
+ }
239
+ throw new VError(`Broken symbolic link: File not found ${content}`);
240
+ }
241
+ throw new VError(error, `Failed to resolve real path for ${path}`);
242
+ }
243
+ };
255
244
  // TODO handle error
256
245
  export const stat = async (path) => {
257
- const stats = await fs.stat(path)
258
- const type = GetDirentType.getDirentType(stats)
259
- return type
260
- }
261
-
246
+ const stats = await fs.stat(path);
247
+ const type = GetDirentType.getDirentType(stats);
248
+ return type;
249
+ };
262
250
  export const chmod = async (path, permissions) => {
263
- await fs.chmod(path, permissions)
264
- }
251
+ await fs.chmod(path, permissions);
252
+ };
265
253
  export const copyFile = async (from, to) => {
266
- try {
267
- await fs.copyFile(from, to)
268
- } catch (error) {
269
- throw new VError(error, `Failed to copy file from ${from} to ${to}`)
270
- }
271
- }
272
-
254
+ try {
255
+ await fs.copyFile(from, to);
256
+ }
257
+ catch (error) {
258
+ throw new VError(error, `Failed to copy file from ${from} to ${to}`);
259
+ }
260
+ };
273
261
  export const cp = async (from, to) => {
274
- try {
275
- await fs.cp(from, to, { recursive: true })
276
- } catch (error) {
277
- throw new VError(error, `Failed to copy folder from ${from} to ${to}`)
278
- }
279
- }
280
-
262
+ try {
263
+ await fs.cp(from, to, { recursive: true });
264
+ }
265
+ catch (error) {
266
+ throw new VError(error, `Failed to copy folder from ${from} to ${to}`);
267
+ }
268
+ };
281
269
  // export const unwatch = (id) => {
282
270
  // state.watchers[id].close()
283
271
  // delete state.watchers[id]
284
272
  // }
285
-
286
273
  // export const unwatchAll = () => {
287
274
  // for (const key in state.watchers) {
288
275
  // unwatch(key)
289
276
  // }
290
277
  // }
291
-
292
278
  // TODO ui should show useful error message when file cannot be saved
293
279
  // and for permission denied error it should use that npm module that allows root
@@ -1,6 +1,5 @@
1
- import * as fs from 'node:fs/promises'
2
-
1
+ import * as fs from 'node:fs/promises';
3
2
  export const watchFile = (path) => {
4
- const watcher = fs.watch(path)
5
- return watcher
6
- }
3
+ const watcher = fs.watch(path);
4
+ return watcher;
5
+ };
@@ -1,3 +1,3 @@
1
- export const Exit = 1
2
- export const Error = 2
3
- export const Message = 3
1
+ export const Exit = 1;
2
+ export const Error = 2;
3
+ export const Message = 3;
@@ -1,39 +1,39 @@
1
- import { readFile } from 'node:fs/promises'
2
- import { join } from 'node:path'
3
- import * as Assert from '../Assert/Assert.js'
4
- import * as EncodingType from '../EncodingType/EncodingType.js'
5
- import * as IsEnoentError from '../IsEnoentError/IsEnoentError.js'
6
- import * as IsEsrchError from '../IsEsrchError/IsEsrchError.js'
7
- import * as ParseMemory from '../ParseMemory/ParseMemory.js'
8
- import * as Platform from '../Platform/Platform.js'
9
- import { VError } from '../VError/VError.js'
10
-
1
+ import { readFile } from 'node:fs/promises';
2
+ import { join } from 'node:path';
3
+ import * as Assert from '../Assert/Assert.js';
4
+ import * as EncodingType from '../EncodingType/EncodingType.js';
5
+ import * as IsEnoentError from '../IsEnoentError/IsEnoentError.js';
6
+ import * as IsEsrchError from '../IsEsrchError/IsEsrchError.js';
7
+ import * as ParseMemory from '../ParseMemory/ParseMemory.js';
8
+ import * as Platform from '../Platform/Platform.js';
9
+ import { VError } from '../VError/VError.js';
11
10
  const getContent = async (pid) => {
12
- try {
13
- const filePath = join('/proc', `${pid}`, 'statm')
14
- const content = await readFile(filePath, EncodingType.Utf8)
15
- return content
16
- } catch (error) {
17
- if (IsEnoentError.isEnoentError(error) || IsEsrchError.isEsrchError(error)) {
18
- return ''
11
+ try {
12
+ const filePath = join('/proc', `${pid}`, 'statm');
13
+ const content = await readFile(filePath, EncodingType.Utf8);
14
+ return content;
19
15
  }
20
- throw error
21
- }
22
- }
23
-
16
+ catch (error) {
17
+ if (IsEnoentError.isEnoentError(error) || IsEsrchError.isEsrchError(error)) {
18
+ return '';
19
+ }
20
+ throw error;
21
+ }
22
+ };
24
23
  export const getAccurateMemoryUsage = async (pid) => {
25
- try {
26
- Assert.number(pid)
27
- if (Platform.isMacOs) {
28
- return 0
24
+ try {
25
+ Assert.number(pid);
26
+ if (Platform.isMacOs) {
27
+ return 0;
28
+ }
29
+ const content = await getContent(pid);
30
+ if (!content) {
31
+ return -1;
32
+ }
33
+ const memory = ParseMemory.parseMemory(content);
34
+ return memory;
29
35
  }
30
- const content = await getContent(pid)
31
- if (!content) {
32
- return -1
36
+ catch (error) {
37
+ throw new VError(error, 'Failed to get accurate memory usage');
33
38
  }
34
- const memory = ParseMemory.parseMemory(content)
35
- return memory
36
- } catch (error) {
37
- throw new VError(error, 'Failed to get accurate memory usage')
38
- }
39
- }
39
+ };
@@ -1,6 +1,5 @@
1
- import * as Assert from '../Assert/Assert.js'
2
-
1
+ import * as Assert from '../Assert/Assert.js';
3
2
  export const getDownloadUrl = (repository, version, appImageName) => {
4
- Assert.string(version)
5
- return `https://github.com/${repository}/releases/download/v${version}/${appImageName}-v${version}.AppImage`
6
- }
3
+ Assert.string(version);
4
+ return `https://github.com/${repository}/releases/download/v${version}/${appImageName}-v${version}.AppImage`;
5
+ };
@@ -1,5 +1,4 @@
1
- import * as Env from '../Env/Env.js'
2
-
1
+ import * as Env from '../Env/Env.js';
3
2
  export const getAppImagePath = () => {
4
- return Env.getAppImagePath()
5
- }
3
+ return Env.getAppImagePath();
4
+ };