LCOV - code coverage report
Current view: top level - src/platform/extensions/services - extensionLoader.ts Coverage Total Hit
Test: ComfyUI E2E Coverage Lines: 100.0 % 18 18
Test Date: 2026-11-17 04:17:53

            Line data    Source code
       1              : import { installTouchPointerGuards } from '@/extensions/core/touchPointerGuards'
       2              : import {
       3              :   getExtensionPath,
       4              :   loadCustomNodeScripts,
       5              :   shouldLoadCustomNodeScript
       6              : } from '@/platform/customNodes/customNodeScripts'
       7              : import { isSafeExtensionBootActive } from '@/platform/customNodes/safeExtensionBoot'
       8              : import { askCpuServer } from '@/platform/customNodes/lateLoading/cpuServerStep'
       9              : import { lateLoadingApplies } from '@/platform/customNodes/lateLoading/lateLoading'
      10              : import { useExtensionStore } from '@/platform/extensions/stores/extensionStore'
      11              : import { useSettingStore } from '@/platform/settings/settingStore'
      12              : import { bootstrapTracer } from '@/platform/telemetry/perf/bootstrapTracer'
      13              : import { api } from '@/scripts/api'
      14              : import { installErrorNodeWidgets } from '@/scripts/errorNodeWidgets'
      15              : 
      16              : /**
      17              :  * Registers the core extensions, then loads the custom node scripts the backend serves.
      18              :  * Late custom nodes stop turning on when `signal` aborts.
      19              :  */
      20         2355 : export async function loadExtensions(
      21              :   signal: AbortSignal = new AbortController().signal
      22              : ) {
      23         2355 :   const extensionStore = useExtensionStore()
      24         2355 :   const settingStore = useSettingStore()
      25         2355 :   extensionStore.loadDisabledExtensionNames(
      26              :     settingStore.get('Comfy.Extension.Disabled')
      27              :   )
      28         2355 :   const disabledExtensionPaths = settingStore.get(
      29              :     'Comfy.Extension.DisabledPacks'
      30              :   )
      31         2355 :   const disableAllCustomExtensions = isSafeExtensionBootActive()
      32              : 
      33         2355 :   const firstCpuServerReading = lateLoadingApplies()
      34              :     ? askCpuServer()
      35              :     : undefined
      36         2355 :   const extensions = await api.getExtensions()
      37         2355 :   extensionStore.loadExtensionPaths(
      38              :     extensions
      39              :       .filter((extension) =>
      40              :         shouldLoadCustomNodeScript(extension, {
      41              :           isCloudBuild: __DISTRIBUTION__ === 'cloud'
      42              :         })
      43              :       )
      44              :       .flatMap((extension) => {
      45         9394 :         const extensionPath = getExtensionPath(extension)
      46         9394 :         return extensionPath === undefined ? [] : [extensionPath]
      47              :       }),
      48              :     disabledExtensionPaths
      49              :   )
      50              : 
      51         2355 :   installErrorNodeWidgets()
      52         2355 :   installTouchPointerGuards()
      53         2355 :   await bootstrapTracer.settle('bootstrap/extensions-load-core', async () => {
      54         2355 :     const { registerCoreExtensions } = await import('@/extensions/core/index')
      55         2355 :     await registerCoreExtensions()
      56              :   })
      57         2355 :   extensionStore.captureCoreExtensions()
      58         2355 :   await loadCustomNodeScripts(extensions, signal, firstCpuServerReading, {
      59              :     disabledExtensionPaths,
      60              :     disableAllCustomExtensions
      61              :   })
      62              : }
        

Generated by: LCOV version 2.0-1