@lvce-editor/shared-process 0.85.2 → 0.86.0
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 +1 -1
- package/package.json +12 -12
- package/src/parts/AddCustomPathsToIndexHtml/AddCustomPathsToIndexHtml.js +2 -2
- package/src/parts/AddSemiColon/AddSemiColon.js +4 -3
- package/src/parts/AppWindow/AppWindow.js +30 -22
- package/src/parts/ApplyEdit/ApplyEdit.js +7 -6
- package/src/parts/ApplyIncomingIpcResponse/ApplyIncomingIpcResponse.js +13 -12
- package/src/parts/Assert/Assert.js +1 -1
- package/src/parts/AttachDebugger/AttachDebugger.ipc.js +6 -4
- package/src/parts/AttachDebugger/AttachDebugger.js +5 -4
- package/src/parts/AuthProcess/AuthProcess.js +14 -12
- package/src/parts/AuthProcessPath/AuthProcessPath.js +4 -3
- package/src/parts/AuthProcessState/AuthProcessState.js +12 -9
- package/src/parts/Authority/Authority.js +1 -1
- package/src/parts/AutoUpdateType/AutoUpdateType.js +4 -4
- package/src/parts/AutoUpdater/AutoUpdater.ipc.js +5 -4
- package/src/parts/AutoUpdater/AutoUpdater.js +31 -31
- package/src/parts/AutoUpdaterAppImage/AutoUpdaterAppImage.ipc.js +7 -5
- package/src/parts/AutoUpdaterAppImage/AutoUpdaterAppImage.js +50 -49
- package/src/parts/AutoUpdaterWindowsNsis/AutoUpdaterWindowsNsis.ipc.js +5 -4
- package/src/parts/AutoUpdaterWindowsNsis/AutoUpdaterWindowsNsis.js +59 -58
- package/src/parts/BrowserWindowV8CacheOptions/BrowserWindowV8CacheOptions.js +4 -3
- package/src/parts/BuiltinExtensionsPath/BuiltinExtensionsPath.js +7 -6
- package/src/parts/BulkReplacement/BulkReplacement.ipc.js +6 -4
- package/src/parts/BulkReplacement/BulkReplacement.js +16 -16
- package/src/parts/BulkReplacementContent/BulkReplacementContent.js +27 -26
- package/src/parts/ByteSize/ByteSize.js +4 -4
- package/src/parts/Callback/Callback.js +1 -1
- package/src/parts/Character/Character.js +12 -12
- package/src/parts/Clamp/Clamp.js +2 -2
- package/src/parts/Cli/Cli.js +14 -14
- package/src/parts/CliCommandType/CliCommandType.js +11 -11
- package/src/parts/CliHelp/CliHelp.js +9 -8
- package/src/parts/CliInstall/CliInstall.js +24 -24
- package/src/parts/CliLink/CliLink.js +17 -17
- package/src/parts/CliList/CliList.js +18 -15
- package/src/parts/CliModule/CliModule.js +27 -26
- package/src/parts/CliStatus/CliStatus.js +5 -4
- package/src/parts/CliUnlink/CliUnlink.js +17 -17
- package/src/parts/CliVersion/CliVersion.js +8 -7
- package/src/parts/ClipBoard/ClipBoard.ipc.js +7 -5
- package/src/parts/ClipBoard/ClipBoard.js +7 -5
- package/src/parts/ClipBoardProcess/ClipBoardProcess.js +19 -16
- package/src/parts/ClipBoardProcessPath/ClipBoardProcessPath.js +13 -3
- package/src/parts/ColorTheme/ColorTheme.js +18 -15
- package/src/parts/Command/Command.js +69 -62
- package/src/parts/CommandNotFoundError/CommandNotFoundError.js +10 -7
- package/src/parts/CompareVersion/CompareVersion.js +2 -2
- package/src/parts/ConnectIpcToElectron/ConnectIpcToElectron.js +20 -18
- package/src/parts/ContentSecurityPolicy/ContentSecurityPolicy.ipc.js +6 -4
- package/src/parts/ContentSecurityPolicy/ContentSecurityPolicy.js +7 -6
- package/src/parts/ContentSecurityPolicyDocument/ContentSecurityPolicyDocument.js +45 -39
- package/src/parts/ContentSecurityPolicyState/ContentSecurityPolicyState.js +7 -5
- package/src/parts/CpuProfile/CpuProfile.js +25 -22
- package/src/parts/Crash/Crash.ipc.js +5 -4
- package/src/parts/Crash/Crash.js +11 -8
- package/src/parts/CreateTestOverview/CreateTestOverview.js +7 -6
- package/src/parts/CreateTestOverviewHtml/CreateTestOverviewHtml.js +24 -21
- package/src/parts/CreateUtilityProcessRpc/CreateUtilityProcessRpc.js +6 -5
- package/src/parts/CrossOriginEmbedderPolicy/CrossOriginEmbedderPolicy.js +1 -1
- package/src/parts/CrossOriginOpenerPolicy/CrossOriginOpenerPolicy.js +2 -2
- package/src/parts/CrossOriginResourcePolicy/CrossOriginResourcePolicy.js +1 -1
- package/src/parts/DeduplicateExtensions/DeduplicateExtensions.js +13 -13
- package/src/parts/DefaultUrl/DefaultUrl.js +4 -3
- package/src/parts/Desktop/Desktop.js +19 -18
- package/src/parts/DesktopCapturer/DesktopCapturer.ipc.js +6 -4
- package/src/parts/DesktopCapturer/DesktopCapturer.js +4 -3
- package/src/parts/DesktopType/DesktopType.js +3 -3
- package/src/parts/DestroySocket/DestroySocket.js +4 -5
- package/src/parts/Developer/Developer.ipc.js +12 -11
- package/src/parts/Developer/Developer.js +40 -33
- package/src/parts/DirentType/DirentType.js +12 -12
- package/src/parts/Download/Download.ipc.js +6 -4
- package/src/parts/Download/Download.js +4 -3
- package/src/parts/DownloadAndExtract/DownloadAndExtract.js +5 -4
- package/src/parts/ElectronApplicationMenu/ElectronApplicationMenu.ipc.js +6 -5
- package/src/parts/ElectronApplicationMenu/ElectronApplicationMenu.js +23 -20
- package/src/parts/ElectronContentTracing/ElectronContentTracing.ipc.js +7 -5
- package/src/parts/ElectronContentTracing/ElectronContentTracing.js +7 -5
- package/src/parts/ElectronContextMenu/ElectronContextMenu.ipc.js +6 -4
- package/src/parts/ElectronContextMenu/ElectronContextMenu.js +8 -7
- package/src/parts/ElectronDeveloper/ElectronDeveloper.ipc.js +6 -4
- package/src/parts/ElectronDeveloper/ElectronDeveloper.js +4 -3
- package/src/parts/ElectronDialog/ElectronDialog.ipc.js +8 -6
- package/src/parts/ElectronDialog/ElectronDialog.js +10 -7
- package/src/parts/ElectronInitialize/ElectronInitialize.ipc.js +6 -4
- package/src/parts/ElectronInitialize/ElectronInitialize.js +10 -9
- package/src/parts/ElectronNet/ElectronNet.ipc.js +6 -4
- package/src/parts/ElectronNet/ElectronNet.js +4 -3
- package/src/parts/ElectronNetLog/ElectronNetLog.ipc.js +7 -5
- package/src/parts/ElectronNetLog/ElectronNetLog.js +7 -5
- package/src/parts/ElectronPowerSaveBlocker/ElectronPowerSaveBlocker.ipc.js +7 -5
- package/src/parts/ElectronPowerSaveBlocker/ElectronPowerSaveBlocker.js +7 -5
- package/src/parts/ElectronProcess/ElectronProcess.ipc.js +7 -5
- package/src/parts/ElectronProcess/ElectronProcess.js +7 -5
- package/src/parts/ElectronSafeStorage/ElectronSafeStorage.ipc.js +8 -6
- package/src/parts/ElectronSafeStorage/ElectronSafeStorage.js +13 -10
- package/src/parts/ElectronShell/ElectronShell.ipc.js +6 -4
- package/src/parts/ElectronShell/ElectronShell.js +4 -3
- package/src/parts/ElectronWindow/ElectronWindow.ipc.js +18 -15
- package/src/parts/ElectronWindow/ElectronWindow.js +87 -61
- package/src/parts/ElectronWindowAbout/ElectronWindowAbout.ipc.js +6 -4
- package/src/parts/ElectronWindowAbout/ElectronWindowAbout.js +4 -3
- package/src/parts/ElectronWindowProcessExplorer/ElectronWindowProcessExplorer.ipc.js +6 -4
- package/src/parts/ElectronWindowProcessExplorer/ElectronWindowProcessExplorer.js +33 -31
- package/src/parts/EmbedsProcess/EmbedsProcess.js +14 -12
- package/src/parts/EmbedsProcessPath/EmbedsProcessPath.js +13 -3
- package/src/parts/EmbedsProcessState/EmbedsProcessState.js +12 -9
- package/src/parts/EncodingType/EncodingType.js +2 -2
- package/src/parts/Env/Env.js +16 -11
- package/src/parts/Error/FileSystemError.js +9 -6
- package/src/parts/ErrorCodes/ErrorCodes.js +22 -22
- package/src/parts/ErrorHandling/ErrorHandling.js +61 -53
- package/src/parts/Exec/Exec.ipc.js +6 -4
- package/src/parts/Exec/Exec.js +6 -5
- package/src/parts/ExecCommand/ExecCommand.js +22 -19
- package/src/parts/ExecPromise/ExecPromise.js +4 -3
- package/src/parts/Exit/Exit.ipc.js +6 -4
- package/src/parts/Exit/Exit.js +4 -3
- package/src/parts/ExitCode/ExitCode.js +5 -3
- package/src/parts/ExportStatic/ExportStatic.js +696 -558
- package/src/parts/ExtensionHostHelperProcessIpc/ExtensionHostHelperProcessIpc.js +15 -14
- package/src/parts/ExtensionHostRpc/ExtensionHostRpc.js +79 -70
- package/src/parts/ExtensionInstall/ExtensionInstall.ipc.js +6 -4
- package/src/parts/ExtensionInstall/ExtensionInstall.js +23 -21
- package/src/parts/ExtensionInstallFromFile/ExtensionInstallFromFile.js +34 -33
- package/src/parts/ExtensionInstallFromGitHub/ExtensionInstallFromGitHub.js +31 -31
- package/src/parts/ExtensionInstallFromUrl/ExtensionInstallFromUrl.js +32 -32
- package/src/parts/ExtensionInstallParseInput/ExtensionInstallParseInput.js +46 -43
- package/src/parts/ExtensionInstallType/ExtensionInstallType.js +7 -4
- package/src/parts/ExtensionLink/ExtensionLink.js +40 -40
- package/src/parts/ExtensionList/ExtensionList.js +72 -66
- package/src/parts/ExtensionManagement/ExtensionManagement.ipc.js +21 -20
- package/src/parts/ExtensionManagement/ExtensionManagement.js +157 -133
- package/src/parts/ExtensionManagement/ExtensionManagementColorTheme.js +70 -62
- package/src/parts/ExtensionManagement/ExtensionManagementIconTheme.js +26 -26
- package/src/parts/ExtensionManagement/ExtensionManagementLanguages.js +63 -58
- package/src/parts/ExtensionManifest/ExtensionManifest.js +54 -56
- package/src/parts/ExtensionManifestInputType/ExtensionManifestInputType.js +7 -4
- package/src/parts/ExtensionManifestStatus/ExtensionManifestStatus.js +3 -2
- package/src/parts/ExtensionManifests/ExtensionManifests.js +46 -41
- package/src/parts/ExtensionManifests/ExtensionManifestsFromFolder.js +21 -21
- package/src/parts/ExtensionManifests/ExtensionManifestsFromLinkedExtension.js +17 -16
- package/src/parts/ExtensionManifests/ExtensionManifestsFromLinkedExtensionsFolder.js +36 -35
- package/src/parts/ExtensionManifests/ExtensionManifestsFromOnlyExtension.js +8 -7
- package/src/parts/ExtensionUninstall/ExtensionUninstall.js +15 -15
- package/src/parts/ExtensionUnlink/ExtensionUnlink.js +19 -19
- package/src/parts/Extract/Extract.js +12 -10
- package/src/parts/FileNotFoundError/FileNotFoundError.js +15 -11
- package/src/parts/FileSystem/FileSystem.ipc.js +33 -30
- package/src/parts/FileSystem/FileSystem.js +269 -257
- package/src/parts/FileSystemDisk/FileSystemDisk.ipc.js +17 -15
- package/src/parts/FileSystemDisk/FileSystemDisk.js +226 -217
- package/src/parts/FileSystemProcess/FileSystemProcess.js +19 -16
- package/src/parts/FileSystemProcessPath/FileSystemProcessPath.js +3 -2
- package/src/parts/FileWatcher/FileWatcher.ipc.js +8 -6
- package/src/parts/FileWatcher/FileWatcher.js +40 -35
- package/src/parts/FileWatcherProcess/FileWatcherProcess.js +19 -16
- package/src/parts/FileWatcherProcessPath/FileWatcherProcessPath.js +3 -2
- package/src/parts/FirstNodeWorkerEventType/FirstNodeWorkerEventType.js +3 -3
- package/src/parts/FixElectronParameters/FixElectronParameters.js +10 -9
- package/src/parts/GetAppImageDownloadUrl/GetAppImageDownloadUrl.js +5 -4
- package/src/parts/GetAppImagePath/GetAppImagePath.js +4 -3
- package/src/parts/GetAppWindowOptions/GetAppWindowOptions.js +63 -53
- package/src/parts/GetBrowserWindowOptions/GetBrowserWindowOptions.js +28 -27
- package/src/parts/GetContentResponse/GetContentResponse.js +11 -10
- package/src/parts/GetContentSecurityPolicy/GetContentSecurityPolicy.js +5 -4
- package/src/parts/GetCustomPathsConfig/GetCustomPathsConfig.js +14 -13
- package/src/parts/GetDirentType/GetDirentType.js +25 -24
- package/src/parts/GetElectronFileResponse/GetElectronFileResponse.ipc.js +6 -4
- package/src/parts/GetElectronFileResponse/GetElectronFileResponse.js +48 -47
- package/src/parts/GetElectronFileResponseAbsolutePath/GetElectronFileResponseAbsolutePath.js +61 -58
- package/src/parts/GetElectronFileResponseContent/GetElectronFileResponseContent.js +31 -29
- package/src/parts/GetElectronFileResponseRelativePath/GetElectronFileResponseRelativePath.js +33 -30
- package/src/parts/GetElectronRebuildPath/GetElectronRebuildPath.js +9 -8
- package/src/parts/GetEtag/GetEtag.js +2 -2
- package/src/parts/GetEtagFromStats/GetEtagFromStats.js +10 -9
- package/src/parts/GetExtensionEtags/GetExtensionEtags.js +66 -60
- package/src/parts/GetExtensions/GetExtensions.ipc.js +6 -4
- package/src/parts/GetExtensions/GetExtensions.js +4 -3
- package/src/parts/GetExtraHeaders/GetExtraHeaders.js +8 -7
- package/src/parts/GetFirstEvent/GetFirstEvent.js +21 -20
- package/src/parts/GetFirstSpawnedProcessEvent/GetFirstSpawnedProcessEvent.js +8 -7
- package/src/parts/GetFolderSizeInternal/GetFolderSizeInternal.js +20 -20
- package/src/parts/GetHeaders/GetHeaders.js +34 -33
- package/src/parts/GetHeadersDefault/GetHeadersDefault.js +2 -2
- package/src/parts/GetHeadersOtherWorker/GetHeadersOtherWorker.js +13 -12
- package/src/parts/GetHelpString/GetHelpString.js +5 -4
- package/src/parts/GetHttpErrorMessage/GetHttpErrorMessage.js +19 -20
- package/src/parts/GetIcon/GetIcon.js +21 -20
- package/src/parts/GetLatestReleaseVersion/GetLatestReleaseVersion.js +33 -32
- package/src/parts/GetMimeType/GetMimeType.js +31 -30
- package/src/parts/GetMultipleChoiceResponse/GetMultipleChoiceResponse.js +11 -10
- package/src/parts/GetNewLineIndex/GetNewLineIndex.js +5 -4
- package/src/parts/GetNotFoundResponse/GetNotFoundResponse.js +11 -10
- package/src/parts/GetNotModifiedResponse/GetNotModifiedResponse.js +11 -10
- package/src/parts/GetNsisUpdateArgs/GetNsisUpdateArgs.js +6 -6
- package/src/parts/GetNsisUpdateDownloadPath/GetNsisUpdateDownloadPath.js +10 -9
- package/src/parts/GetPathEtag/GetPathEtag.js +11 -10
- package/src/parts/GetPathName/GetPathName.js +3 -3
- package/src/parts/GetPortTuple/GetPortTuple.js +10 -10
- package/src/parts/GetProcessExplorerUrl/GetProcessExplorerUrl.js +4 -3
- package/src/parts/GetRemoteUrl/GetRemoteUrl.js +5 -4
- package/src/parts/GetResolvedTestPath/GetResolvedTestPath.js +19 -17
- package/src/parts/GetServerErrorResponse/GetServerErrorResponse.js +11 -10
- package/src/parts/GetStatusString/GetStatusString.js +62 -54
- package/src/parts/GetTerminalProcessPath/GetTerminalProcessPath.js +5 -4
- package/src/parts/GetTerminalSpawnOptions/GetTerminalSpawnOptions.ipc.js +6 -4
- package/src/parts/GetTerminalSpawnOptions/GetTerminalSpawnOptions.js +17 -16
- package/src/parts/GetTestPath/GetTestPath.js +4 -3
- package/src/parts/GetTestRequestResponse/GetTestRequestResponse.js +72 -72
- package/src/parts/GetTitleBarItems/GetTitleBarItems.js +41 -40
- package/src/parts/GetTransferrables/GetTransferrables.js +7 -6
- package/src/parts/GetTypeFromUrl/GetTypeFromUrl.js +19 -18
- package/src/parts/GetTypeScriptPath/GetTypeScriptPath.js +21 -12
- package/src/parts/GetVersionString/GetVersionString.js +5 -4
- package/src/parts/GetWebViewsFromExtensions/GetWebViewsFromExtensions.js +23 -22
- package/src/parts/GetWindowId/GetWindowId.ipc.js +6 -4
- package/src/parts/GetWindowId/GetWindowId.js +6 -5
- package/src/parts/GetWindowsNsisDownloadUrl/GetWindowsNsisDownloadUrl.js +7 -6
- package/src/parts/GetWorkspaceId/GetWorkspaceId.js +4 -3
- package/src/parts/GitLsFiles/GitLsFiles.ipc.js +8 -6
- package/src/parts/GitLsFiles/GitLsFiles.js +22 -19
- package/src/parts/HandleCliArgs/HandleCliArgs.ipc.js +6 -4
- package/src/parts/HandleCliArgs/HandleCliArgs.js +11 -11
- package/src/parts/HandleDisconnect/HandleDisconnect.js +6 -5
- package/src/parts/HandleElectronMessagePort/HandleElectronMessagePort.ipc.js +6 -4
- package/src/parts/HandleElectronMessagePort/HandleElectronMessagePort.js +10 -9
- package/src/parts/HandleElectronReady/HandleElectronReady.ipc.js +6 -4
- package/src/parts/HandleElectronReady/HandleElectronReady.js +21 -21
- package/src/parts/HandleIncomingIpc/HandleIncomingIpc.js +40 -38
- package/src/parts/HandleIncomingIpcMessagePort/HandleIncomingIpcMessagePort.js +7 -7
- package/src/parts/HandleIncomingIpcWebSocket/HandleIncomingIpcWebSocket.js +7 -7
- package/src/parts/HandleIpc/HandleIpc.js +24 -23
- package/src/parts/HandleIpcAuthProcess/HandleIpcAuthProcess.js +11 -9
- package/src/parts/HandleIpcClipBoardProcess/HandleIpcClipBoardProcess.js +21 -17
- package/src/parts/HandleIpcEmbedsProcess/HandleIpcEmbedsProcess.js +11 -9
- package/src/parts/HandleIpcExtensionHostHelperProcess/HandleIpcExtensionHostHelperProcess.js +28 -24
- package/src/parts/HandleIpcFileSystemProcess/HandleIpcFileSystemProcess.js +21 -17
- package/src/parts/HandleIpcFileWatcher/HandleIpcFileWatcher.js +22 -18
- package/src/parts/HandleIpcModule/HandleIpcModule.js +36 -35
- package/src/parts/HandleIpcProcessExplorer/HandleIpcProcessExplorer.js +23 -19
- package/src/parts/HandleIpcSearchProcess/HandleIpcSearchProcess.js +21 -17
- package/src/parts/HandleIpcSharedProcess/HandleIpcSharedProcess.js +40 -36
- package/src/parts/HandleIpcTerminalProcess/HandleIpcTerminalProcess.js +22 -18
- package/src/parts/HandleMessage/HandleMessage.js +25 -14
- package/src/parts/HandleMessagePortForAuthProcess/HandleMessagePortForAuthProcess.ipc.js +7 -5
- package/src/parts/HandleMessagePortForAuthProcess/HandleMessagePortForAuthProcess.js +20 -18
- package/src/parts/HandleMessagePortForClipBoardProcess/HandleMessagePortForClipBoardProcess.ipc.js +6 -4
- package/src/parts/HandleMessagePortForClipBoardProcess/HandleMessagePortForClipBoardProcess.js +7 -6
- package/src/parts/HandleMessagePortForEmbedsProcess/HandleMessagePortForEmbedsProcess.ipc.js +7 -5
- package/src/parts/HandleMessagePortForEmbedsProcess/HandleMessagePortForEmbedsProcess.js +20 -18
- package/src/parts/HandleMessagePortForExtensionHostHelperProcess/HandleMessagePortForExtensionHostHelperProcess.ipc.js +6 -4
- package/src/parts/HandleMessagePortForExtensionHostHelperProcess/HandleMessagePortForExtensionHostHelperProcess.js +19 -18
- package/src/parts/HandleMessagePortForFileSystemProcess/HandleMessagePortForFileSystemProcess.ipc.js +6 -4
- package/src/parts/HandleMessagePortForFileSystemProcess/HandleMessagePortForFileSystemProcess.js +7 -6
- package/src/parts/HandleMessagePortForProcessExplorer/HandleMessagePortForProcessExplorer.ipc.js +6 -4
- package/src/parts/HandleMessagePortForProcessExplorer/HandleMessagePortForProcessExplorer.js +7 -7
- package/src/parts/HandleMessagePortForSearchProcess/HandleMessagePortForSearchProcess.ipc.js +6 -4
- package/src/parts/HandleMessagePortForSearchProcess/HandleMessagePortForSearchProcess.js +5 -4
- package/src/parts/HandleMessagePortForTerminalProcess/HandleMessagePortForTerminalProcess.ipc.js +6 -4
- package/src/parts/HandleMessagePortForTerminalProcess/HandleMessagePortForTerminalProcess.js +7 -6
- package/src/parts/HandleNodeMessagePort/HandleNodeMessagePort.ipc.js +6 -4
- package/src/parts/HandleNodeMessagePort/HandleNodeMessagePort.js +10 -9
- package/src/parts/HandleRemoteRequest/HandleRemoteRequest.ipc.js +6 -4
- package/src/parts/HandleRemoteRequest/HandleRemoteRequest.js +11 -10
- package/src/parts/HandleRequest/HandleRequest.ipc.js +6 -4
- package/src/parts/HandleRequest/HandleRequest.js +21 -20
- package/src/parts/HandleRequestTest/HandleRequestTest.ipc.js +6 -4
- package/src/parts/HandleRequestTest/HandleRequestTest.js +10 -9
- package/src/parts/HandleSocketError/HandleSocketError.js +11 -10
- package/src/parts/HandleUncaughtExceptionMonitor/HandleUncaughtExceptionMonitor.js +12 -9
- package/src/parts/HandleWebSocket/HandleWebSocket.ipc.js +6 -4
- package/src/parts/HandleWebSocket/HandleWebSocket.js +24 -24
- package/src/parts/HandleWebSocketForClipBoardProcess/HandleWebSocketForClipBoardProcess.js +5 -4
- package/src/parts/HandleWebSocketForExtensionHostHelperProcess/HandleWebSocketForExtensionHostHelperProcess.js +5 -4
- package/src/parts/HandleWebSocketForFileSystemProcess/HandleWebSocketForFileSystemProcess.js +5 -4
- package/src/parts/HandleWebSocketForProcessExplorer/HandleWebSocketForProcessExplorer.js +5 -4
- package/src/parts/HandleWebSocketForSearchProcess/HandleWebSocketForSearchProcess.js +5 -4
- package/src/parts/HandleWebSocketForSharedProcess/HandleWebSocketForSharedProcess.js +5 -4
- package/src/parts/HandleWebSocketForTerminalProcess/HandleWebSocketForTerminalProcess.js +5 -4
- package/src/parts/HandleWebSocketForUnknown/HandleWebSocketForUnknown.js +6 -5
- package/src/parts/HandleWebSocketModule/HandleWebSocketModule.js +33 -32
- package/src/parts/HandleWindowAllClosed/HandleWindowAllClosed.ipc.js +6 -4
- package/src/parts/HandleWindowAllClosed/HandleWindowAllClosed.js +7 -6
- package/src/parts/Hash/Hash.js +6 -4
- package/src/parts/HeapSnapshot/HeapSnapshot.ipc.js +4 -3
- package/src/parts/HeapSnapshot/HeapSnapshot.js +9 -6
- package/src/parts/HttpHeader/HttpHeader.js +9 -9
- package/src/parts/HttpServerResponse/HttpServerResponse.js +22 -19
- package/src/parts/HttpStatusCode/HttpStatusCode.js +6 -6
- package/src/parts/Id/Id.js +6 -5
- package/src/parts/IndexHtmlPath/IndexHtmlPath.js +4 -3
- package/src/parts/InferExtensionId/InferExtensionId.js +8 -7
- package/src/parts/InstallExtension/InstallExtension.ipc.js +4 -3
- package/src/parts/InstallExtension/InstallExtension.js +28 -28
- package/src/parts/IpcChild/IpcChild.js +14 -13
- package/src/parts/IpcChildModule/IpcChildModule.js +26 -19
- package/src/parts/IpcChildType/IpcChildType.js +19 -18
- package/src/parts/IpcChildWithNodeMessagePort/IpcChildWithNodeMessagePort.js +46 -45
- package/src/parts/IpcError/IpcError.js +4 -4
- package/src/parts/IpcId/IpcId.js +18 -17
- package/src/parts/IpcParent/IpcParent.js +10 -9
- package/src/parts/IpcParentModule/IpcParentModule.js +14 -13
- package/src/parts/IpcParentType/IpcParentType.js +3 -3
- package/src/parts/IpcParentWithElectronUtilityProcess/IpcParentWithElectronUtilityProcess.js +81 -76
- package/src/parts/IpcTransferState/IpcTransferState.js +14 -11
- package/src/parts/IsAbsolutePath/IsAbsolutePath.js +4 -3
- package/src/parts/IsAllowedWebSocketOrigin/IsAllowedWebSocketOrigin.js +39 -37
- package/src/parts/IsAppImage/IsAppImage.js +4 -3
- package/src/parts/IsAutoUpdateSupported/IsAutoUpdateSupported.ipc.js +6 -4
- package/src/parts/IsAutoUpdateSupported/IsAutoUpdateSupported.js +8 -6
- package/src/parts/IsBuiltServer/IsBuiltServer.js +1 -1
- package/src/parts/IsElectron/IsElectron.js +3 -1
- package/src/parts/IsEnoentError/IsEnoentError.js +11 -9
- package/src/parts/IsEnoentErrorWindows/IsEnoentErrorWindows.js +6 -4
- package/src/parts/IsEsrchError/IsEsrchError.js +4 -3
- package/src/parts/IsIgnoredError/IsIgnoredError.js +17 -16
- package/src/parts/IsLinux/IsLinux.js +3 -2
- package/src/parts/IsMessagePort/IsMessagePort.js +2 -2
- package/src/parts/IsMessagePortMain/IsMessagePortMain.js +2 -2
- package/src/parts/IsProduction/IsProduction.js +3 -2
- package/src/parts/IsSocket/IsSocket.js +4 -3
- package/src/parts/IsTransferrable/IsTransferrable.js +8 -7
- package/src/parts/IsTypeScriptPath/IsTypeScriptPath.js +5 -4
- package/src/parts/IsWindows/IsWindows.js +1 -1
- package/src/parts/JoinLines/JoinLines.js +4 -3
- package/src/parts/Json/Json.js +17 -15
- package/src/parts/JsonFile/JsonFile.js +12 -10
- package/src/parts/JsonRpc/JsonRpc.js +1 -1
- package/src/parts/JsonRpcVersion/JsonRpcVersion.js +1 -1
- package/src/parts/Jsonc/Jsonc.js +2 -1
- package/src/parts/JsoncFile/JsoncFile.js +8 -7
- package/src/parts/LaunchAuthProcess/LaunchAuthProcess.js +14 -13
- package/src/parts/LaunchClipBoardProcess/LaunchClipBoardProcess.js +14 -13
- package/src/parts/LaunchEmbedsProcess/LaunchEmbedsProcess.js +17 -16
- package/src/parts/LaunchFileSystemProcess/LaunchFileSystemProcess.js +21 -20
- package/src/parts/LaunchFileWatcherProcess/LaunchFileWatcherProcess.js +14 -13
- package/src/parts/LaunchNetworkProcess/LaunchNetworkProcess.js +13 -12
- package/src/parts/LaunchPreviewProcess/LaunchPreviewProcess.js +13 -12
- package/src/parts/LaunchProcess/LaunchProcess.js +34 -32
- package/src/parts/LaunchProcessExplorer/LaunchProcessExplorer.js +22 -21
- package/src/parts/LaunchPtyHost/LaunchPtyHost.js +16 -15
- package/src/parts/LaunchSearchProcess/LaunchSearchProcess.js +13 -12
- package/src/parts/LaunchTypeScriptCompileProcess/LaunchTypeScriptCompileProcess.js +25 -24
- package/src/parts/LimitString/LimitString.js +14 -13
- package/src/parts/LoadTypeScript/LoadTypeScript.js +12 -12
- package/src/parts/Logger/Logger.js +43 -35
- package/src/parts/Main/Main.js +16 -15
- package/src/parts/MainProcess/MainProcess.js +26 -20
- package/src/parts/MakeExecutable/MakeExecutable.js +9 -9
- package/src/parts/MergeWithSymlinks/MergeWithSymlinks.js +14 -14
- package/src/parts/MimeType/MimeType.js +38 -38
- package/src/parts/Module/Module.js +155 -154
- package/src/parts/ModuleId/ModuleId.js +80 -80
- package/src/parts/ModuleMap/ModuleMap.js +339 -337
- package/src/parts/NetworkProcess/NetworkProcess.js +19 -16
- package/src/parts/NetworkProcessPath/NetworkProcessPath.js +3 -2
- package/src/parts/OpenExternal/OpenExternal.ipc.js +7 -5
- package/src/parts/OpenExternal/OpenExternal.js +7 -5
- package/src/parts/OpenNativeFolder/OpenNativeFolder.ipc.js +6 -4
- package/src/parts/OpenNativeFolder/OpenNativeFolder.js +9 -9
- package/src/parts/Os/Os.ipc.js +4 -3
- package/src/parts/Os/Os.js +4 -3
- package/src/parts/OutputChannel/OutputChannel.ipc.js +39 -35
- package/src/parts/OutputChannel/OutputChannel.js +35 -32
- package/src/parts/OutputChannelState/OutputChannelState.js +15 -11
- package/src/parts/ParseUrlGithub/ParseUrlGithub.js +51 -49
- package/src/parts/Path/Path.js +16 -11
- package/src/parts/Performance/Performance.ipc.js +6 -4
- package/src/parts/Performance/Performance.js +27 -16
- package/src/parts/Platform/Platform.ipc.js +35 -33
- package/src/parts/Platform/Platform.js +76 -48
- package/src/parts/PlatformPaths/PlatformPaths.ipc.js +26 -24
- package/src/parts/PlatformPaths/PlatformPaths.js +140 -97
- package/src/parts/Preferences/Preferences.ipc.js +6 -4
- package/src/parts/Preferences/Preferences.js +83 -81
- package/src/parts/PreloadUrl/PreloadUrl.js +5 -4
- package/src/parts/PrettyError/PrettyError.js +1 -1
- package/src/parts/PreviewProcess/PreviewProcess.js +23 -19
- package/src/parts/PreviewProcessPath/PreviewProcessPath.js +3 -2
- package/src/parts/PrintPrettyError/PrintPrettyError.js +5 -4
- package/src/parts/Process/Process.ipc.js +10 -9
- package/src/parts/Process/Process.js +58 -45
- package/src/parts/ProcessDisplayName/ProcessDisplayName.js +1 -1
- package/src/parts/ProcessExitEventType/ProcessExitEventType.js +2 -2
- package/src/parts/ProcessExplorer/ProcessExplorer.ipc.js +6 -4
- package/src/parts/ProcessExplorer/ProcessExplorer.js +45 -42
- package/src/parts/ProcessExplorerPath/ProcessExplorerPath.js +3 -2
- package/src/parts/ProcessId/ProcessId.ipc.js +7 -5
- package/src/parts/ProcessId/ProcessId.js +5 -4
- package/src/parts/ProcessListeners/ProcessListeners.js +10 -8
- package/src/parts/Promises/Promises.js +18 -18
- package/src/parts/ProtocolType/ProtocolType.js +8 -8
- package/src/parts/PtyHost/PtyHost.js +28 -24
- package/src/parts/PtyHostPath/PtyHostPath.js +3 -2
- package/src/parts/PtyHostState/PtyHostState.js +17 -17
- package/src/parts/Queue/Queue.js +32 -31
- package/src/parts/RebuildNodePty/RebuildNodePty.ipc.js +6 -4
- package/src/parts/RebuildNodePty/RebuildNodePty.js +4 -3
- package/src/parts/RecentlyOpened/RecentlyOpened.ipc.js +6 -4
- package/src/parts/RecentlyOpened/RecentlyOpened.js +53 -54
- package/src/parts/RegisterWebViewProtocol/RegisterWebViewProtocol.js +13 -11
- package/src/parts/RejectWebSocket/RejectWebSocket.js +10 -9
- package/src/parts/RemoveQueryParameters/RemoveQueryParameters.js +6 -6
- package/src/parts/RemoveSymlink/RemoveSymlink.js +11 -11
- package/src/parts/RemoveValues/RemoveValues.js +21 -21
- package/src/parts/RequiresSocket/RequiresSocket.js +18 -16
- package/src/parts/ResolveBin/ResolveBin.js +10 -10
- package/src/parts/ResolveRoot/ResolveRoot.js +81 -78
- package/src/parts/Restart/Restart.js +10 -9
- package/src/parts/Root/Root.js +6 -4
- package/src/parts/Scheme/Scheme.js +1 -1
- package/src/parts/Screen/Screen.ipc.js +8 -6
- package/src/parts/Screen/Screen.js +10 -7
- package/src/parts/SearchProcess/SearchProcess.js +19 -16
- package/src/parts/SearchProcessPath/SearchProcessPath.js +3 -2
- package/src/parts/SendIncomingIpc/SendIncomingIpc.js +27 -24
- package/src/parts/SetHeaders/SetHeaders.js +4 -4
- package/src/parts/ShouldLogError/ShouldLogError.js +7 -6
- package/src/parts/ShouldTranspileTypescript/ShouldTranspileTypescript.js +11 -10
- package/src/parts/Signal/Signal.js +3 -3
- package/src/parts/SplitLines/SplitLines.js +4 -3
- package/src/parts/StaticPath/StaticPath.js +13 -12
- package/src/parts/StaticServerPath/StaticServerPath.js +4 -3
- package/src/parts/SymLink/SymLink.js +4 -3
- package/src/parts/TemporaryMessagePort/TemporaryMessagePort.ipc.js +9 -7
- package/src/parts/TemporaryMessagePort/TemporaryMessagePort.js +69 -64
- package/src/parts/Terminal/Terminal.ipc.js +9 -7
- package/src/parts/Terminal/Terminal.js +73 -68
- package/src/parts/TerminalState/TerminalState.js +12 -9
- package/src/parts/TextDocument/TextDocument.ipc.js +4 -3
- package/src/parts/TextDocument/TextDocument.js +23 -18
- package/src/parts/Timeout/Timeout.js +5 -4
- package/src/parts/TmpFile/TmpFile.js +13 -11
- package/src/parts/ToAbsolutePaths/ToAbsolutePaths.js +8 -7
- package/src/parts/Transferrables/Transferrables.js +5 -4
- package/src/parts/TransientLinkedExtensions/TransientLinkedExtensions.js +64 -58
- package/src/parts/TranspileTypeScript/TranspileTypeScript.js +8 -7
- package/src/parts/TranspileTypeScriptCached/TranspileTypeScriptCached.js +20 -19
- package/src/parts/Trash/Trash.js +11 -9
- package/src/parts/TrashElectron/TrashElectron.js +8 -7
- package/src/parts/TrashNode/TrashNode.js +9 -9
- package/src/parts/TypeScriptCompileCachePath/TypeScriptCompileCachePath.js +4 -3
- package/src/parts/TypeScriptCompileProcess/TypeScriptCompileProcess.js +19 -16
- package/src/parts/TypeScriptCompileProcessPath/TypeScriptCompileProcessPath.js +3 -2
- package/src/parts/UpdateState/UpdateState.js +11 -8
- package/src/parts/UpdateStateType/UpdateStateType.js +9 -9
- package/src/parts/V8CacheOptions/V8CacheOptions.js +2 -2
- package/src/parts/VError/VError.js +1 -1
- package/src/parts/WaitForProcessToExit/WaitForProcessToExit.js +8 -7
- package/src/parts/WalkValue/WalkValue.js +18 -18
- package/src/parts/WatchFile/WatchFile.js +12 -12
- package/src/parts/WatchForHotReload/WatchForHotReload.js +20 -16
- package/src/parts/WebViewProtocolState/WebViewProtocolState.js +9 -8
- package/src/parts/WebViewServer/WebViewServer.ipc.js +11 -9
- package/src/parts/WebViewServer/WebViewServer.js +26 -14
- package/src/parts/Workspace/Workspace.ipc.js +7 -5
- package/src/parts/Workspace/Workspace.js +23 -20
- package/src/parts/WorkspaceSource/WorkspaceSource.js +3 -3
- package/src/sharedProcessMain.js +3 -2
|
@@ -1,382 +1,491 @@
|
|
|
1
|
-
import { existsSync } from 'node:fs'
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import * as
|
|
5
|
-
import * as
|
|
6
|
-
import * as
|
|
7
|
-
import
|
|
8
|
-
import
|
|
1
|
+
import { existsSync } from 'node:fs'
|
|
2
|
+
import { stripTypeScriptTypes } from 'node:module'
|
|
3
|
+
import { isAbsolute, join, relative } from 'node:path'
|
|
4
|
+
import * as FileSystem from '../FileSystem/FileSystem.js'
|
|
5
|
+
import * as GetContentSecurityPolicy from '../GetContentSecurityPolicy/GetContentSecurityPolicy.js'
|
|
6
|
+
import * as JsonFile from '../JsonFile/JsonFile.js'
|
|
7
|
+
import * as Path from '../Path/Path.js'
|
|
8
|
+
import { readdir, readFile, rm, writeFile } from 'node:fs/promises'
|
|
9
|
+
import workers from '../Workers/Workers.json' with { type: 'json' }
|
|
10
|
+
|
|
9
11
|
const staticContentSecurityPolicy = GetContentSecurityPolicy.getContentSecurityPolicy([
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
])
|
|
12
|
+
`default-src 'none'`,
|
|
13
|
+
`font-src 'self'`,
|
|
14
|
+
`img-src 'self' https: data: blob:`, // TODO maybe disallow https and data images
|
|
15
|
+
`manifest-src 'self'`,
|
|
16
|
+
`media-src 'self' blob:`,
|
|
17
|
+
`script-src 'self'`,
|
|
18
|
+
`style-src 'self' 'unsafe-inline'`,
|
|
19
|
+
`frame-src 'self' blob:`,
|
|
20
|
+
])
|
|
21
|
+
|
|
19
22
|
const readExtensionManifest = async (path) => {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
+
const json = await JsonFile.readJson(path)
|
|
24
|
+
return { ...json, path }
|
|
25
|
+
}
|
|
26
|
+
|
|
23
27
|
const getThemeName = (dirent) => {
|
|
24
|
-
|
|
25
|
-
}
|
|
28
|
+
return dirent.slice('builtin.theme-'.length)
|
|
29
|
+
}
|
|
30
|
+
|
|
26
31
|
const replace = async (path, occurrence, replacement) => {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
32
|
+
const oldContent = await FileSystem.readFile(path)
|
|
33
|
+
if (!oldContent.includes(occurrence)) {
|
|
34
|
+
throw new Error(`failed to replace occurrence ${occurrence} in ${path}: Not found`)
|
|
35
|
+
}
|
|
36
|
+
// @ts-ignore
|
|
37
|
+
const newContent = oldContent.replaceAll(occurrence, replacement)
|
|
38
|
+
await FileSystem.writeFile(path, newContent)
|
|
39
|
+
}
|
|
40
|
+
|
|
35
41
|
const getWorkerById = (id) => {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
42
|
+
const worker = workers.find((item) => {
|
|
43
|
+
return item.id === id
|
|
44
|
+
})
|
|
45
|
+
if (!worker) {
|
|
46
|
+
throw new Error(`worker not found: ${id}`)
|
|
47
|
+
}
|
|
48
|
+
return worker
|
|
49
|
+
}
|
|
50
|
+
|
|
44
51
|
const getDistPathFromWorkerPath = (path) => {
|
|
45
|
-
|
|
46
|
-
}
|
|
52
|
+
return path.split('/').filter(Boolean)
|
|
53
|
+
}
|
|
54
|
+
|
|
47
55
|
const getWorkerDistPath = (root, commitHash, id) => {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
56
|
+
const worker = getWorkerById(id)
|
|
57
|
+
return Path.join(root, 'dist', commitHash, ...getDistPathFromWorkerPath(worker.productionPath))
|
|
58
|
+
}
|
|
59
|
+
|
|
51
60
|
/**
|
|
52
61
|
* @param {string} dirent
|
|
53
62
|
*/
|
|
54
63
|
const isLanguageBasics = (dirent) => {
|
|
55
|
-
|
|
56
|
-
}
|
|
64
|
+
return dirent.startsWith('builtin.language-basics')
|
|
65
|
+
}
|
|
66
|
+
|
|
57
67
|
/**
|
|
58
68
|
* @param {string} dirent
|
|
59
69
|
*/
|
|
60
70
|
const isTheme = (dirent) => {
|
|
61
|
-
|
|
62
|
-
}
|
|
71
|
+
return dirent.startsWith('builtin.theme-')
|
|
72
|
+
}
|
|
73
|
+
|
|
63
74
|
/**
|
|
64
75
|
* @param {string} dirent
|
|
65
76
|
*/
|
|
66
77
|
const isIconTheme = (dirent) => {
|
|
67
|
-
|
|
68
|
-
}
|
|
78
|
+
return dirent === 'builtin.vscode-icons'
|
|
79
|
+
}
|
|
80
|
+
|
|
69
81
|
const compare = (a, b) => {
|
|
70
|
-
|
|
71
|
-
}
|
|
82
|
+
return a.localeCompare(b)
|
|
83
|
+
}
|
|
84
|
+
|
|
72
85
|
const toSorted = (objects, compare) => {
|
|
73
|
-
|
|
74
|
-
}
|
|
86
|
+
return [...objects].sort(compare)
|
|
87
|
+
}
|
|
88
|
+
|
|
75
89
|
const mergeThemes = (builtinThemes, extensionThemes) => {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
|
|
90
|
+
const seen = []
|
|
91
|
+
const merged = []
|
|
92
|
+
for (const extensionTheme of extensionThemes) {
|
|
93
|
+
seen.push(extensionTheme)
|
|
94
|
+
merged.push(extensionTheme)
|
|
95
|
+
}
|
|
96
|
+
for (const builtinTheme of builtinThemes) {
|
|
97
|
+
if (seen.includes(builtinTheme)) {
|
|
98
|
+
continue
|
|
99
|
+
}
|
|
100
|
+
merged.push(builtinTheme)
|
|
101
|
+
}
|
|
102
|
+
const sorted = toSorted(merged, compare)
|
|
103
|
+
return sorted
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const RE_COMMIT_HASH = /^[a-z\d]+$/
|
|
92
107
|
const isCommitHash = (dirent) => {
|
|
93
|
-
|
|
94
|
-
}
|
|
108
|
+
return dirent.length === 7 && dirent.match(RE_COMMIT_HASH)
|
|
109
|
+
}
|
|
110
|
+
|
|
95
111
|
/**
|
|
96
112
|
* @param {string} root
|
|
97
113
|
*/
|
|
98
114
|
const clean = async (root) => {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}
|
|
115
|
+
await FileSystem.forceRemove(Path.join(root, 'dist'))
|
|
116
|
+
await FileSystem.mkdir(Path.join(root, 'dist'))
|
|
117
|
+
}
|
|
118
|
+
|
|
102
119
|
/**
|
|
103
120
|
* @param {string} root
|
|
104
121
|
*/
|
|
105
122
|
const copyStaticFiles = async (root, serverStaticPath) => {
|
|
106
|
-
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
const
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
123
|
+
await FileSystem.copy(serverStaticPath, Path.join(root, 'dist'))
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const applyOverridesRendererProcess = async ({ root, commitHash, pathPrefix } ) => {
|
|
127
|
+
await replace(
|
|
128
|
+
Path.join(root, 'dist', commitHash, 'packages', 'renderer-process', 'dist', 'rendererProcessMain.js'),
|
|
129
|
+
'platform = Remote;',
|
|
130
|
+
'platform = Web',
|
|
131
|
+
)
|
|
132
|
+
await replace(
|
|
133
|
+
Path.join(root, 'dist', commitHash, 'packages', 'renderer-process', 'dist', 'rendererProcessMain.js'),
|
|
134
|
+
`/${commitHash}`,
|
|
135
|
+
`${pathPrefix}/${commitHash}`,
|
|
136
|
+
)
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const applyOverrides = async ({ root, commitHash, pathPrefix, serverStaticPath } ) => {
|
|
140
|
+
const extensionHostWorkerDistPath = getWorkerDistPath(root, commitHash, 'extensionHostWorker')
|
|
141
|
+
await applyOverridesRendererProcess({ root, commitHash, pathPrefix })
|
|
142
|
+
await replace(
|
|
143
|
+
Path.join(root, 'dist', commitHash, 'packages', 'renderer-worker', 'dist', 'rendererWorkerMain.js'),
|
|
144
|
+
'platform = Remote;',
|
|
145
|
+
'platform = Web$1;',
|
|
146
|
+
)
|
|
147
|
+
await replace(
|
|
148
|
+
Path.join(root, 'dist', commitHash, 'packages', 'renderer-worker', 'dist', 'rendererWorkerMain.js'),
|
|
149
|
+
`/${commitHash}`,
|
|
150
|
+
`${pathPrefix}/${commitHash}`,
|
|
151
|
+
)
|
|
152
|
+
await replace(
|
|
153
|
+
extensionHostWorkerDistPath,
|
|
154
|
+
`return \`\${assetDir}/extensions/builtin.theme-\${colorThemeId}/color-theme.json\``,
|
|
155
|
+
`return \`\${assetDir}/themes/\${colorThemeId}.json\``,
|
|
156
|
+
)
|
|
157
|
+
await replace(extensionHostWorkerDistPath, `/${commitHash}`, `${pathPrefix}/${commitHash}`)
|
|
158
|
+
await replace(extensionHostWorkerDistPath, `const platform = Remote`, `const platform = Web`)
|
|
159
|
+
// await replace(
|
|
160
|
+
// Path.join(root, 'dist', commitHash, 'packages', 'extension-host-worker', 'dist', 'extensionHostWorkerMain.js'),
|
|
161
|
+
// `return \`\${assetDir}/extensions/builtin.\${iconThemeId}/icon-theme.json\``,
|
|
162
|
+
// `return \`\${assetDir}/icon-themes/\${iconThemeId}.json\``,
|
|
163
|
+
// )
|
|
164
|
+
|
|
165
|
+
const extensionDirents = await FileSystem.readDir(Path.join(serverStaticPath, commitHash, 'extensions'))
|
|
166
|
+
|
|
167
|
+
const languageBasicsDirents = extensionDirents.filter(isLanguageBasics)
|
|
168
|
+
const themeDirents = extensionDirents.filter(isTheme)
|
|
169
|
+
const iconThemeDirents = extensionDirents.filter(isIconTheme)
|
|
170
|
+
|
|
171
|
+
const getLanguages = (extension) => {
|
|
172
|
+
const languages = []
|
|
173
|
+
for (const language of extension.languages || []) {
|
|
174
|
+
languages.push({
|
|
175
|
+
...language,
|
|
176
|
+
tokenize: `${pathPrefix}/${commitHash}/extensions/${extension.id}/${language.tokenize}`,
|
|
177
|
+
})
|
|
178
|
+
}
|
|
179
|
+
return languages
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
const getWebViews = (extension) => {
|
|
183
|
+
const webViews = []
|
|
184
|
+
for (const webView of extension.webViews || []) {
|
|
185
|
+
webViews.push({
|
|
186
|
+
...webView,
|
|
187
|
+
path: `${pathPrefix}/${commitHash}/extensions/${webView.path}`,
|
|
188
|
+
remotePath: `${pathPrefix}/${commitHash}/extensions/${extension.id}`,
|
|
189
|
+
})
|
|
190
|
+
}
|
|
191
|
+
return webViews
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* @param {string} dirent
|
|
196
|
+
*/
|
|
197
|
+
const getManifestPath = (dirent) => {
|
|
198
|
+
return Path.join(serverStaticPath, commitHash, 'extensions', dirent, 'extension.json')
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
const manifestPaths = languageBasicsDirents.map(getManifestPath)
|
|
202
|
+
const manifests = await Promise.all(manifestPaths.map(readExtensionManifest))
|
|
203
|
+
const languages = manifests.flatMap(getLanguages)
|
|
204
|
+
await JsonFile.writeJson(Path.join(root, 'dist', commitHash, 'config', 'languages.json'), languages)
|
|
205
|
+
|
|
206
|
+
const webViews = manifests.flatMap(getWebViews)
|
|
207
|
+
await JsonFile.writeJson(Path.join(root, 'dist', commitHash, 'config', 'webViews.json'), webViews)
|
|
208
|
+
|
|
209
|
+
for (const languageBasicsDirent of languageBasicsDirents) {
|
|
210
|
+
await FileSystem.copy(
|
|
211
|
+
Path.join(serverStaticPath, commitHash, 'extensions', languageBasicsDirent),
|
|
212
|
+
Path.join(root, 'dist', commitHash, 'extensions', languageBasicsDirent),
|
|
213
|
+
)
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
for (const themeDirent of themeDirents) {
|
|
217
|
+
const themeId = getThemeName(themeDirent)
|
|
218
|
+
await FileSystem.copy(
|
|
219
|
+
Path.join(serverStaticPath, commitHash, 'extensions', themeDirent, 'color-theme.json'),
|
|
220
|
+
Path.join(root, 'dist', commitHash, 'themes', `${themeId}.json`),
|
|
221
|
+
)
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
const themeIds = mergeThemes(themeDirents.map(getThemeName), [])
|
|
225
|
+
await JsonFile.writeJson(Path.join(root, 'dist', commitHash, 'config', 'themes.json'), themeIds)
|
|
226
|
+
|
|
227
|
+
for (const iconThemeDirent of iconThemeDirents) {
|
|
228
|
+
const iconThemeId = iconThemeDirent.slice('builtin.'.length)
|
|
229
|
+
await FileSystem.copy(
|
|
230
|
+
Path.join(serverStaticPath, commitHash, 'extensions', iconThemeDirent, 'icon-theme.json'),
|
|
231
|
+
Path.join(root, 'dist', commitHash, 'icon-themes', `${iconThemeId}.json`),
|
|
232
|
+
)
|
|
233
|
+
}
|
|
234
|
+
const indexHtmlPath = Path.join(root, 'dist', 'index.html')
|
|
235
|
+
await replace(indexHtmlPath, `/${commitHash}`, `${pathPrefix}/${commitHash}`)
|
|
236
|
+
|
|
237
|
+
await replace(
|
|
238
|
+
indexHtmlPath,
|
|
239
|
+
'#282e2f" />',
|
|
240
|
+
`#282e2f" />
|
|
241
|
+
<meta http-equiv="Content-Security-Policy" content="${staticContentSecurityPolicy}">`,
|
|
242
|
+
)
|
|
243
|
+
|
|
244
|
+
if (pathPrefix) {
|
|
245
|
+
await replace(
|
|
246
|
+
indexHtmlPath,
|
|
247
|
+
'</title>',
|
|
248
|
+
`</title>
|
|
249
|
+
<link rel="shortcut icon" type="image/x-icon" href="${pathPrefix}/favicon.ico">`,
|
|
250
|
+
)
|
|
251
|
+
} else {
|
|
252
|
+
await replace(
|
|
253
|
+
indexHtmlPath,
|
|
254
|
+
'</title>',
|
|
255
|
+
`</title>
|
|
256
|
+
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico">`,
|
|
257
|
+
)
|
|
258
|
+
}
|
|
259
|
+
if (pathPrefix) {
|
|
260
|
+
await replace(Path.join(root, 'dist', commitHash, 'manifest.json'), `/${commitHash}`, `${pathPrefix}/${commitHash}`)
|
|
261
|
+
await replace(Path.join(root, 'dist', commitHash, 'manifest.json'), `"start_url": "/"`, `"start_url": "${pathPrefix}"`)
|
|
262
|
+
await replace(Path.join(root, 'dist', commitHash, 'css', 'App.css'), `/${commitHash}`, `${pathPrefix}/${commitHash}`)
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
const addExtensionSeo = async ({ root, name, description, commitHash } ) => {
|
|
267
|
+
await replace(Path.join(root, 'dist', 'index.html'), '<title>Lvce Editor</title>', `<title>${name}</title>`)
|
|
268
|
+
await replace(Path.join(root, 'dist', commitHash, 'manifest.json'), `"name": "Code Editor Web - OSS"`, `"name": "${name}"`)
|
|
269
|
+
await replace(Path.join(root, 'dist', commitHash, 'manifest.json'), `"short_name": "Web - OSS"`, `"short_name": "${name}"`)
|
|
270
|
+
await replace(Path.join(root, 'dist', commitHash, 'manifest.json'), `"description": "Web Code Editor."`, `"description": "${description}"`)
|
|
271
|
+
await replace(
|
|
272
|
+
Path.join(root, 'dist', 'index.html'),
|
|
273
|
+
'<meta name="description" content="VS Code inspired text editor that mostly runs in a webworker." />',
|
|
274
|
+
`<meta name="description" content="${description}" />`,
|
|
275
|
+
)
|
|
276
|
+
}
|
|
277
|
+
|
|
200
278
|
const getId = (object) => {
|
|
201
|
-
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
279
|
+
return object.id
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
const addExtensionThemes = async ({ root, extensionPath, extensionJson, commitHash } ) => {
|
|
283
|
+
const colorThemes = extensionJson.colorThemes || []
|
|
284
|
+
if (colorThemes.length === 0) {
|
|
285
|
+
return
|
|
286
|
+
}
|
|
287
|
+
for (const colorTheme of colorThemes) {
|
|
288
|
+
const { id, path } = colorTheme
|
|
289
|
+
const extensionId = `builtin.theme-${id}`
|
|
290
|
+
await FileSystem.forceRemove(Path.join(root, 'dist', commitHash, 'extensions', extensionId))
|
|
291
|
+
await FileSystem.mkdir(Path.join(root, 'dist', commitHash, 'extensions', extensionId))
|
|
292
|
+
await FileSystem.copy(Path.join(extensionPath, path), Path.join(root, 'dist', commitHash, 'themes', `${id}.json`))
|
|
293
|
+
await replace(
|
|
294
|
+
Path.join(root, 'dist', commitHash, 'config', 'defaultSettings.json'),
|
|
295
|
+
`"workbench.colorTheme": "slime"`,
|
|
296
|
+
`"workbench.colorTheme": "${id}"`,
|
|
297
|
+
)
|
|
298
|
+
await FileSystem.copyFile(Path.join(root, 'README.md'), Path.join(root, 'dist', commitHash, 'extensions', extensionId, 'README.md'))
|
|
299
|
+
await FileSystem.copyFile(
|
|
300
|
+
Path.join(extensionPath, 'extension.json'),
|
|
301
|
+
Path.join(root, 'dist', commitHash, 'extensions', extensionId, 'extension.json'),
|
|
302
|
+
)
|
|
303
|
+
await FileSystem.copyFile(
|
|
304
|
+
Path.join(extensionPath, 'color-theme.json'),
|
|
305
|
+
Path.join(root, 'dist', commitHash, 'extensions', extensionId, 'color-theme.json'),
|
|
306
|
+
)
|
|
307
|
+
}
|
|
308
|
+
const themesJson = await JsonFile.readJson(Path.join(root, 'dist', commitHash, 'config', 'themes.json'))
|
|
309
|
+
const ids = colorThemes.map(getId)
|
|
310
|
+
const mergedThemes = mergeThemes(themesJson, ids)
|
|
311
|
+
await JsonFile.writeJson(Path.join(root, 'dist', commitHash, 'config', 'themes.json'), mergedThemes)
|
|
312
|
+
}
|
|
313
|
+
|
|
224
314
|
const compareId = (a, b) => {
|
|
225
|
-
|
|
226
|
-
}
|
|
315
|
+
return a.id.localeCompare(b.id)
|
|
316
|
+
}
|
|
317
|
+
|
|
227
318
|
const mergeLanguages = (languages, extensionLanguages) => {
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
}
|
|
319
|
+
const seen = []
|
|
320
|
+
const merged = []
|
|
321
|
+
for (const language of extensionLanguages) {
|
|
322
|
+
seen.push(language.id)
|
|
323
|
+
merged.push(language)
|
|
324
|
+
}
|
|
325
|
+
for (const language of languages) {
|
|
326
|
+
if (seen.includes(language.id)) {
|
|
327
|
+
continue
|
|
328
|
+
}
|
|
329
|
+
merged.push(language)
|
|
330
|
+
}
|
|
331
|
+
merged.sort(compareId)
|
|
332
|
+
return merged
|
|
333
|
+
}
|
|
334
|
+
|
|
243
335
|
const toPlaygroundFile = (file) => {
|
|
244
|
-
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
}
|
|
336
|
+
return `/playground/${file}`
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
const addExtensionLanguages = async ({ root, extensionPath, extensionJson, commitHash, pathPrefix } ) => {
|
|
340
|
+
const languages = extensionJson.languages || []
|
|
341
|
+
if (languages.length === 0) {
|
|
342
|
+
return
|
|
343
|
+
}
|
|
344
|
+
const extensionId = extensionJson.id
|
|
345
|
+
await FileSystem.forceRemove(Path.join(root, 'dist', commitHash, 'extensions', extensionId))
|
|
346
|
+
await FileSystem.mkdir(Path.join(root, 'dist', commitHash, 'extensions', extensionId))
|
|
347
|
+
await FileSystem.copyFile(Path.join(root, 'README.md'), Path.join(root, 'dist', commitHash, 'extensions', extensionId, 'README.md'))
|
|
348
|
+
for (const file of ['src', 'data', 'extension.json']) {
|
|
349
|
+
if (await FileSystem.exists(Path.join(extensionPath, file))) {
|
|
350
|
+
await FileSystem.copy(Path.join(extensionPath, file), Path.join(root, 'dist', commitHash, 'extensions', extensionId, file))
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
const extensionLanguages = []
|
|
354
|
+
for (const language of languages) {
|
|
355
|
+
if (!language.tokenize) {
|
|
356
|
+
continue
|
|
357
|
+
}
|
|
358
|
+
extensionLanguages.push({
|
|
359
|
+
...language,
|
|
360
|
+
tokenize: `${pathPrefix}/${commitHash}/extensions/${extensionId}/${language.tokenize}`,
|
|
361
|
+
})
|
|
362
|
+
}
|
|
363
|
+
const builtinLanguages = await JsonFile.readJson(Path.join(root, 'dist', commitHash, 'config', 'languages.json'))
|
|
364
|
+
const mergedLanguages = mergeLanguages(builtinLanguages, extensionLanguages)
|
|
365
|
+
await JsonFile.writeJson(Path.join(root, 'dist', commitHash, 'config', 'languages.json'), mergedLanguages)
|
|
366
|
+
if (await FileSystem.exists(Path.join(extensionPath, 'test', 'cases'))) {
|
|
367
|
+
await FileSystem.forceRemove(Path.join(root, 'dist', commitHash, 'playground'))
|
|
368
|
+
await FileSystem.copy(Path.join(extensionPath, 'test', 'cases'), Path.join(root, 'dist', commitHash, 'playground'))
|
|
369
|
+
const testFiles = await FileSystem.readDir(Path.join(extensionPath, 'test', 'cases'))
|
|
370
|
+
const fileMap = testFiles.map(toPlaygroundFile)
|
|
371
|
+
await JsonFile.writeJson(Path.join(root, 'dist', commitHash, 'config', 'fileMap.json'), fileMap)
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
|
|
281
375
|
export const mergeExtensionManifests = (manifests, extraExtensions) => {
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
}
|
|
322
|
-
const
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
376
|
+
const replacements = Object.create(null)
|
|
377
|
+
for (const extension of extraExtensions) {
|
|
378
|
+
replacements[extension.id] = extension
|
|
379
|
+
}
|
|
380
|
+
const used = Object.create(null)
|
|
381
|
+
const merged = manifests.map((manifest) => {
|
|
382
|
+
const replacement = replacements[manifest.id]
|
|
383
|
+
if (replacement) {
|
|
384
|
+
used[manifest.id] = true
|
|
385
|
+
return replacement
|
|
386
|
+
}
|
|
387
|
+
return manifest
|
|
388
|
+
})
|
|
389
|
+
for (const extension of extraExtensions) {
|
|
390
|
+
if (used[extension.id]) {
|
|
391
|
+
continue
|
|
392
|
+
}
|
|
393
|
+
merged.push(extension)
|
|
394
|
+
}
|
|
395
|
+
return merged
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
const updateExtensionsJson = async ({ root, commitHash, pathPrefix, extraExtensions } ) => {
|
|
399
|
+
const dirents = await FileSystem.readDir(Path.join(root, 'dist', commitHash, 'extensions'))
|
|
400
|
+
const manifests = await Promise.all(
|
|
401
|
+
dirents.map(async (dirent) => {
|
|
402
|
+
const json = await JsonFile.readJson(Path.join(root, 'dist', commitHash, 'extensions', dirent, 'extension.json'))
|
|
403
|
+
const webExtensionPath = `${pathPrefix}/${commitHash}/extensions/${dirent}`
|
|
404
|
+
return {
|
|
405
|
+
...json,
|
|
406
|
+
path: webExtensionPath,
|
|
407
|
+
}
|
|
408
|
+
}),
|
|
409
|
+
)
|
|
410
|
+
const localExtensions = extraExtensions.map((extension) => {
|
|
411
|
+
return {
|
|
412
|
+
...extension,
|
|
413
|
+
path: `${pathPrefix}/${commitHash}/extensions/${extension.id}`,
|
|
414
|
+
}
|
|
415
|
+
})
|
|
416
|
+
const newExtensions = mergeExtensionManifests(manifests, localExtensions)
|
|
417
|
+
await JsonFile.writeJson(Path.join(root, 'dist', commitHash, 'config', 'extensions.json'), newExtensions)
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
const addExtensionWebExtension = async ({
|
|
421
|
+
root,
|
|
422
|
+
extensionPath,
|
|
423
|
+
commitHash,
|
|
424
|
+
extensionJson,
|
|
425
|
+
pathPrefix,
|
|
426
|
+
useSimpleWebExtensionFile,
|
|
427
|
+
} ) => {
|
|
428
|
+
await updateExtensionsJson({ root, commitHash, pathPrefix, extraExtensions: [extensionJson] })
|
|
429
|
+
|
|
430
|
+
if (!extensionJson.browser) {
|
|
431
|
+
return
|
|
432
|
+
}
|
|
433
|
+
const webExtensionPath = `${pathPrefix}/${commitHash}/extensions/${extensionJson.id}`
|
|
434
|
+
if (useSimpleWebExtensionFile) {
|
|
435
|
+
const webExtensions = [webExtensionPath]
|
|
436
|
+
await JsonFile.writeJson(Path.join(root, 'dist', commitHash, 'config', 'webExtensions.json'), webExtensions)
|
|
437
|
+
return
|
|
438
|
+
}
|
|
439
|
+
const webExtensions = [
|
|
440
|
+
{
|
|
441
|
+
...extensionJson,
|
|
442
|
+
isWeb: true,
|
|
443
|
+
path: webExtensionPath,
|
|
444
|
+
},
|
|
445
|
+
]
|
|
446
|
+
await JsonFile.writeJson(Path.join(root, 'dist', commitHash, 'config', 'webExtensions.json'), webExtensions)
|
|
447
|
+
await FileSystem.forceRemove(Path.join(root, 'dist', commitHash, 'extensions', extensionJson.id))
|
|
448
|
+
for (const dirent of ['src', 'extension.json']) {
|
|
449
|
+
await FileSystem.copy(Path.join(extensionPath, dirent), Path.join(root, 'dist', commitHash, 'extensions', extensionJson.id, dirent))
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
const addExtension = async ({ root, extensionPath, commitHash, pathPrefix, useSimpleWebExtensionFile } ) => {
|
|
454
|
+
const extensionJson = await readExtensionManifest(Path.join(extensionPath, 'extension.json'))
|
|
455
|
+
const name = extensionJson.name || extensionJson.id || ''
|
|
456
|
+
const description = extensionJson.description || ''
|
|
457
|
+
await addExtensionSeo({
|
|
458
|
+
root,
|
|
459
|
+
commitHash,
|
|
460
|
+
name,
|
|
461
|
+
description,
|
|
462
|
+
})
|
|
463
|
+
await addExtensionThemes({
|
|
464
|
+
root,
|
|
465
|
+
commitHash,
|
|
466
|
+
extensionJson,
|
|
467
|
+
extensionPath,
|
|
468
|
+
})
|
|
469
|
+
await addExtensionLanguages({
|
|
470
|
+
root,
|
|
471
|
+
extensionPath,
|
|
472
|
+
commitHash,
|
|
473
|
+
extensionJson,
|
|
474
|
+
pathPrefix,
|
|
475
|
+
})
|
|
476
|
+
|
|
477
|
+
await addExtensionWebExtension({
|
|
478
|
+
root,
|
|
479
|
+
extensionPath,
|
|
480
|
+
commitHash,
|
|
481
|
+
extensionJson,
|
|
482
|
+
pathPrefix,
|
|
483
|
+
useSimpleWebExtensionFile,
|
|
484
|
+
})
|
|
485
|
+
}
|
|
486
|
+
|
|
378
487
|
const generateTestOverviewHtml = (dirents) => {
|
|
379
|
-
|
|
488
|
+
const pre = `<!DOCTYPE html>
|
|
380
489
|
<html lang="en">
|
|
381
490
|
<head>
|
|
382
491
|
<meta charset="UTF-8" />
|
|
@@ -387,233 +496,262 @@ const generateTestOverviewHtml = (dirents) => {
|
|
|
387
496
|
<h1>Tests</h1>
|
|
388
497
|
<p>Available Tests</p>
|
|
389
498
|
<ul>
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
499
|
+
`
|
|
500
|
+
let middle = ``
|
|
501
|
+
// TODO properly escape name
|
|
502
|
+
for (const dirent of dirents) {
|
|
503
|
+
const name = dirent
|
|
504
|
+
middle += ` <li><a href="./${name}.html">${name}</a></li>
|
|
505
|
+
`
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
const post = ` </ul>
|
|
399
509
|
</body>
|
|
400
510
|
</html>
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
}
|
|
511
|
+
`
|
|
512
|
+
return pre + middle + post
|
|
513
|
+
}
|
|
514
|
+
|
|
404
515
|
const getName = (name) => {
|
|
405
|
-
|
|
406
|
-
}
|
|
516
|
+
return name.replace(/\.(js|ts)$/, '')
|
|
517
|
+
}
|
|
407
518
|
const isTestFile = (file) => {
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
}
|
|
519
|
+
if (file.startsWith('_')) {
|
|
520
|
+
return false
|
|
521
|
+
}
|
|
522
|
+
return file.endsWith('.js') || file.endsWith('.ts')
|
|
523
|
+
}
|
|
524
|
+
|
|
413
525
|
const getTestFiles = (testFilesRaw) => {
|
|
414
|
-
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
});
|
|
422
|
-
return result.outputText;
|
|
423
|
-
};
|
|
526
|
+
return testFilesRaw.filter(isTestFile).map(getName)
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
export const transpileFile = (content) => {
|
|
530
|
+
return stripTypeScriptTypes(content)
|
|
531
|
+
}
|
|
532
|
+
|
|
424
533
|
const transpileFiles = async (folder) => {
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
534
|
+
const dirents = await readdir(folder)
|
|
535
|
+
for (const dirent of dirents) {
|
|
536
|
+
if (dirent.endsWith('.ts')) {
|
|
537
|
+
const content = await readFile(join(folder, dirent), 'utf-8')
|
|
538
|
+
const js = transpileFile(content)
|
|
539
|
+
await writeFile(join(folder, dirent.slice(0, -2) + 'js'), js)
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
for (const dirent of dirents) {
|
|
543
|
+
if (dirent.endsWith('.ts')) {
|
|
544
|
+
await rm(join(folder, dirent))
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
|
|
440
549
|
export const createFilemap = async (fixturesPath) => {
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
|
|
550
|
+
const filemap = {}
|
|
551
|
+
|
|
552
|
+
const dirents = await readdir(fixturesPath, { withFileTypes: true, recursive: true })
|
|
553
|
+
|
|
554
|
+
for (const dirent of dirents) {
|
|
555
|
+
if (dirent.isFile()) {
|
|
556
|
+
// Calculate relative path by removing the fixturesPath prefix from parentPath
|
|
557
|
+
const fullPath = join(dirent.parentPath, dirent.name)
|
|
558
|
+
let relativeFilePath
|
|
559
|
+
if (dirent.parentPath === fixturesPath) {
|
|
560
|
+
relativeFilePath = dirent.name
|
|
561
|
+
} else {
|
|
562
|
+
// Manually calculate relative path for cross-platform compatibility
|
|
563
|
+
// Remove the fixturesPath prefix from parentPath and normalize separators
|
|
564
|
+
const normalizedFixturesPath = fixturesPath.replace(/\\/g, '/')
|
|
565
|
+
const normalizedParentPath = dirent.parentPath.replace(/\\/g, '/')
|
|
566
|
+
const relativeDir = normalizedParentPath.replace(normalizedFixturesPath + '/', '')
|
|
567
|
+
relativeFilePath = join(relativeDir, dirent.name)
|
|
568
|
+
}
|
|
569
|
+
const content = await FileSystem.readFile(fullPath)
|
|
570
|
+
filemap[relativeFilePath] = content
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
return filemap
|
|
575
|
+
}
|
|
576
|
+
|
|
465
577
|
export const createFilemapsPerFixture = async (fixturesPath) => {
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
const
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
}
|
|
578
|
+
const dirents = await readdir(fixturesPath, { withFileTypes: true })
|
|
579
|
+
|
|
580
|
+
const fixtureDirectories = dirents.filter((dirent) => dirent.isDirectory())
|
|
581
|
+
|
|
582
|
+
// Create filemaps in parallel
|
|
583
|
+
await Promise.all(
|
|
584
|
+
fixtureDirectories.map(async (dirent) => {
|
|
585
|
+
const fixturePath = join(fixturesPath, dirent.name)
|
|
586
|
+
const filemap = await createFilemap(fixturePath)
|
|
587
|
+
|
|
588
|
+
// Create fileMap.json in the fixture directory
|
|
589
|
+
const fileMapPath = join(fixturePath, 'fileMap.json')
|
|
590
|
+
await FileSystem.writeFile(fileMapPath, JSON.stringify(filemap, null, 2))
|
|
591
|
+
}),
|
|
592
|
+
)
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
const addTestFiles = async ({ testPath, commitHash, root, pathPrefix } ) => {
|
|
596
|
+
const testRoot = isAbsolute(testPath) ? testPath : join(root, testPath)
|
|
597
|
+
await FileSystem.copy(`${testRoot}/src`, `${root}/dist/${commitHash}/packages/extension-host-worker-tests/src`)
|
|
598
|
+
if (existsSync(`${testRoot}/fixtures`)) {
|
|
599
|
+
await FileSystem.copy(`${testRoot}/fixtures`, `${root}/dist/${commitHash}/packages/extension-host-worker-tests/fixtures`)
|
|
600
|
+
|
|
601
|
+
// Create fileMap.json for each fixture directory
|
|
602
|
+
await createFilemapsPerFixture(`${root}/dist/${commitHash}/packages/extension-host-worker-tests/fixtures`)
|
|
603
|
+
}
|
|
604
|
+
const distDirentsPath = `${root}/dist/${commitHash}/packages/extension-host-worker-tests/src`
|
|
605
|
+
await transpileFiles(distDirentsPath)
|
|
606
|
+
|
|
607
|
+
const testFilesRaw = await FileSystem.readDir(`${testRoot}/src`)
|
|
608
|
+
const testFiles = getTestFiles(testFilesRaw)
|
|
609
|
+
const hashTestsPath = `${root}/dist/${commitHash}/tests`
|
|
610
|
+
const rootTestsPath = `${root}/dist/tests`
|
|
611
|
+
await FileSystem.mkdir(hashTestsPath)
|
|
612
|
+
await FileSystem.mkdir(rootTestsPath)
|
|
613
|
+
await FileSystem.copyFile(`${root}/dist/index.html`, `${hashTestsPath}/_all.html`)
|
|
614
|
+
await FileSystem.copyFile(`${root}/dist/index.html`, `${rootTestsPath}/_all.html`)
|
|
615
|
+
for (const testFile of testFiles) {
|
|
616
|
+
await FileSystem.copyFile(`${root}/dist/index.html`, `${hashTestsPath}/${testFile}.html`)
|
|
617
|
+
await FileSystem.copyFile(`${root}/dist/index.html`, `${rootTestsPath}/${testFile}.html`)
|
|
618
|
+
}
|
|
619
|
+
const testOverviewHtml = generateTestOverviewHtml(testFiles)
|
|
620
|
+
await FileSystem.writeFile(`${hashTestsPath}/index.html`, testOverviewHtml)
|
|
621
|
+
await FileSystem.writeFile(`${rootTestsPath}/index.html`, testOverviewHtml)
|
|
622
|
+
}
|
|
623
|
+
|
|
503
624
|
const resolveServerStaticPath = (root) => {
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
}
|
|
625
|
+
const guessOne = Path.join(root, 'node_modules', '@lvce-editor', 'server', 'static')
|
|
626
|
+
if (existsSync(guessOne)) {
|
|
627
|
+
return guessOne
|
|
628
|
+
}
|
|
629
|
+
const guessTwo = Path.join(root, 'packages', 'build', 'node_modules', '@lvce-editor', 'server', 'static')
|
|
630
|
+
if (existsSync(guessTwo)) {
|
|
631
|
+
return guessTwo
|
|
632
|
+
}
|
|
633
|
+
const guessThree = Path.join(root, 'packages', 'server', 'node_modules', '@lvce-editor', 'server', 'static')
|
|
634
|
+
if (existsSync(guessThree)) {
|
|
635
|
+
return guessThree
|
|
636
|
+
}
|
|
637
|
+
const guessFour = Path.join(root, 'packages', 'build', 'node_modules', '@lvce-editor', 'static-server', 'static')
|
|
638
|
+
if (existsSync(guessFour)) {
|
|
639
|
+
return guessFour
|
|
640
|
+
}
|
|
641
|
+
const guessFive = Path.join(root, 'node_modules', '@lvce-editor', 'static-server', 'static')
|
|
642
|
+
if (existsSync(guessFive)) {
|
|
643
|
+
return guessFive
|
|
644
|
+
}
|
|
645
|
+
const guessSix = Path.join(root, 'packages', 'server', 'node_modules', '@lvce-editor', 'static-server', 'static')
|
|
646
|
+
if (existsSync(guessSix)) {
|
|
647
|
+
return guessSix
|
|
648
|
+
}
|
|
649
|
+
throw new Error(`server static path not found`)
|
|
650
|
+
}
|
|
651
|
+
|
|
530
652
|
const toArray = (value) => {
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
}
|
|
653
|
+
if (!value) {
|
|
654
|
+
return []
|
|
655
|
+
}
|
|
656
|
+
if (Array.isArray(value)) {
|
|
657
|
+
return value
|
|
658
|
+
}
|
|
659
|
+
return [value]
|
|
660
|
+
}
|
|
661
|
+
|
|
539
662
|
const getExtensionPaths = (extensionPath, extensionPaths) => {
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
}
|
|
663
|
+
const seen = Object.create(null)
|
|
664
|
+
const allExtensionPaths = []
|
|
665
|
+
for (const path of [...toArray(extensionPath), ...toArray(extensionPaths)]) {
|
|
666
|
+
if (!path || seen[path]) {
|
|
667
|
+
continue
|
|
668
|
+
}
|
|
669
|
+
seen[path] = true
|
|
670
|
+
allExtensionPaths.push(path)
|
|
671
|
+
}
|
|
672
|
+
return allExtensionPaths
|
|
673
|
+
}
|
|
674
|
+
|
|
551
675
|
/**
|
|
552
676
|
*
|
|
553
|
-
* @param {{root:string, pathPrefix:string
|
|
677
|
+
* @param {{root:string, pathPrefix:string, extensionPath:string, extensionPaths?:string[], testPath:string, useSimpleWebExtensionFile?:boolean, serverStaticPath?:string }} param0
|
|
554
678
|
*/
|
|
555
|
-
export const exportStatic = async ({
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
await
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
679
|
+
export const exportStatic = async ({
|
|
680
|
+
root,
|
|
681
|
+
pathPrefix,
|
|
682
|
+
extensionPath,
|
|
683
|
+
extensionPaths,
|
|
684
|
+
testPath,
|
|
685
|
+
useSimpleWebExtensionFile,
|
|
686
|
+
serverStaticPath,
|
|
687
|
+
} ) => {
|
|
688
|
+
if (!existsSync(root)) {
|
|
689
|
+
throw new Error(`root path does not exist: ${root}`)
|
|
690
|
+
}
|
|
691
|
+
const allExtensionPaths = getExtensionPaths(extensionPath, extensionPaths)
|
|
692
|
+
for (const extensionPath of allExtensionPaths) {
|
|
693
|
+
if (!existsSync(extensionPath)) {
|
|
694
|
+
throw new Error(`extension path does not exist: ${extensionPath}`)
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
if (!serverStaticPath) {
|
|
698
|
+
serverStaticPath = resolveServerStaticPath(root)
|
|
699
|
+
}
|
|
700
|
+
if (pathPrefix === 'auto') {
|
|
701
|
+
if (allExtensionPaths.length === 0) {
|
|
702
|
+
throw new Error(`extension path is required when path prefix is auto`)
|
|
703
|
+
}
|
|
704
|
+
const [extensionPath] = allExtensionPaths
|
|
705
|
+
const extensionJson = await readExtensionManifest(Path.join(extensionPath, 'extension.json'))
|
|
706
|
+
const { id } = extensionJson
|
|
707
|
+
const [author, name] = id.split('.')
|
|
708
|
+
pathPrefix = `/${name}`
|
|
709
|
+
}
|
|
710
|
+
const dirents = await FileSystem.readDir(serverStaticPath)
|
|
711
|
+
const commitHash = dirents.find(isCommitHash) || ''
|
|
712
|
+
|
|
713
|
+
console.time('clean')
|
|
714
|
+
await clean(root)
|
|
715
|
+
console.timeEnd('clean')
|
|
716
|
+
|
|
717
|
+
console.time('copyStaticFiles')
|
|
718
|
+
await copyStaticFiles(root, serverStaticPath)
|
|
719
|
+
console.timeEnd('copyStaticFiles')
|
|
720
|
+
|
|
721
|
+
console.time('applyOverrides')
|
|
722
|
+
await applyOverrides({
|
|
723
|
+
root,
|
|
724
|
+
commitHash,
|
|
725
|
+
pathPrefix,
|
|
726
|
+
serverStaticPath,
|
|
727
|
+
})
|
|
728
|
+
console.timeEnd('applyOverrides')
|
|
729
|
+
|
|
730
|
+
await updateExtensionsJson({ root, commitHash, pathPrefix, extraExtensions: [] })
|
|
731
|
+
|
|
732
|
+
for (const extensionPath of allExtensionPaths) {
|
|
733
|
+
console.time('addExtension')
|
|
734
|
+
await addExtension({
|
|
735
|
+
extensionPath,
|
|
736
|
+
commitHash,
|
|
737
|
+
pathPrefix,
|
|
738
|
+
root,
|
|
739
|
+
useSimpleWebExtensionFile,
|
|
740
|
+
})
|
|
741
|
+
console.timeEnd('addExtension')
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
if (testPath) {
|
|
745
|
+
console.time('addTestFiles')
|
|
746
|
+
await addTestFiles({
|
|
747
|
+
testPath,
|
|
748
|
+
commitHash,
|
|
749
|
+
pathPrefix,
|
|
750
|
+
root,
|
|
751
|
+
})
|
|
752
|
+
console.timeEnd('addTestFiles')
|
|
753
|
+
}
|
|
754
|
+
return {
|
|
755
|
+
commitHash,
|
|
756
|
+
}
|
|
757
|
+
}
|