mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-03-05 13:10:24 +00:00
perf: code-split xterm bundle and gate terminal features for cloud
- Gate logs-terminal keybinding (Ctrl+`) registration for cloud builds - Filter out ToggleBottomPanel command for cloud builds - Gate terminal tab registration in bottomPanelStore for cloud - Convert terminal tab components to async imports (defineAsyncComponent) - Dynamic import of useTerminalTabs module ensures xterm bundle is tree-shaken The ~400KB xterm bundle (vendor-xterm-*.js) is now only loaded on non-cloud distributions when terminal tabs are registered. Fixes COM-14129 Co-authored-by: Amp <amp@ampcode.com> Amp-Thread-ID: https://ampcode.com/threads/T-019c17af-8992-739f-be03-1e375de1b56b
This commit is contained in:
@@ -2,10 +2,7 @@ import { defineStore } from 'pinia'
|
||||
import { computed, ref } from 'vue'
|
||||
|
||||
import { useShortcutsTab } from '@/composables/bottomPanelTabs/useShortcutsTab'
|
||||
import {
|
||||
useCommandTerminalTab,
|
||||
useLogsTerminalTab
|
||||
} from '@/composables/bottomPanelTabs/useTerminalTabs'
|
||||
|
||||
import { useCommandStore } from '@/stores/commandStore'
|
||||
import type { ComfyExtension } from '@/types/comfy'
|
||||
import type { BottomPanelExtension } from '@/types/extensionTypes'
|
||||
@@ -121,10 +118,15 @@ export const useBottomPanelStore = defineStore('bottomPanel', () => {
|
||||
})
|
||||
}
|
||||
|
||||
const registerCoreBottomPanelTabs = () => {
|
||||
registerBottomPanelTab(useLogsTerminalTab())
|
||||
if (isElectron()) {
|
||||
registerBottomPanelTab(useCommandTerminalTab())
|
||||
const registerCoreBottomPanelTabs = async () => {
|
||||
// Use __DISTRIBUTION__ directly for proper dead code elimination
|
||||
if (__DISTRIBUTION__ !== 'cloud') {
|
||||
const { useLogsTerminalTab, useCommandTerminalTab } =
|
||||
await import('@/composables/bottomPanelTabs/useTerminalTabs')
|
||||
registerBottomPanelTab(useLogsTerminalTab())
|
||||
if (isElectron()) {
|
||||
registerBottomPanelTab(useCommandTerminalTab())
|
||||
}
|
||||
}
|
||||
useShortcutsTab().forEach(registerBottomPanelTab)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user