Home / Function/ hookParallel() — vite Function Reference

hookParallel() — vite Function Reference

Architecture documentation for the hookParallel() function in pluginContainer.ts from the vite codebase.

Entity Profile

Dependency Diagram

graph TD
  be3526c9_4f67_b6dd_9a14_dd784ae26c08["hookParallel()"]
  285b1044_dd20_6f59_7cf5_0ad094eeacee["EnvironmentPluginContainer"]
  be3526c9_4f67_b6dd_9a14_dd784ae26c08 -->|defined in| 285b1044_dd20_6f59_7cf5_0ad094eeacee
  4037a852_6412_11ad_da74_ea3d0ff0c661["buildStart()"]
  4037a852_6412_11ad_da74_ea3d0ff0c661 -->|calls| be3526c9_4f67_b6dd_9a14_dd784ae26c08
  1792884e_1fbb_9081_6a8c_f0356bfb1682["watchChange()"]
  1792884e_1fbb_9081_6a8c_f0356bfb1682 -->|calls| be3526c9_4f67_b6dd_9a14_dd784ae26c08
  562e9e2b_e379_c47c_c40f_7b7850f80d38["close()"]
  562e9e2b_e379_c47c_c40f_7b7850f80d38 -->|calls| be3526c9_4f67_b6dd_9a14_dd784ae26c08
  58719e23_70bd_67e0_1ed8_f61c19ec725b["getHookHandler()"]
  be3526c9_4f67_b6dd_9a14_dd784ae26c08 -->|calls| 58719e23_70bd_67e0_1ed8_f61c19ec725b
  style be3526c9_4f67_b6dd_9a14_dd784ae26c08 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/vite/src/node/server/pluginContainer.ts lines 304–326

  private async hookParallel<H extends AsyncPluginHooks & ParallelPluginHooks>(
    hookName: H,
    context: (plugin: Plugin) => ThisType<FunctionPluginHooks[H]>,
    args: (plugin: Plugin) => Parameters<FunctionPluginHooks[H]>,
    condition?: (plugin: Plugin) => boolean | undefined,
  ): Promise<void> {
    const parallelPromises: Promise<unknown>[] = []
    for (const plugin of this.getSortedPlugins(hookName)) {
      // Don't throw here if closed, so buildEnd and closeBundle hooks can finish running
      if (condition && !condition(plugin)) continue

      const hook = plugin[hookName]
      const handler: Function = getHookHandler(hook)
      if ((hook as { sequential?: boolean }).sequential) {
        await Promise.all(parallelPromises)
        parallelPromises.length = 0
        await handler.apply(context(plugin), args(plugin))
      } else {
        parallelPromises.push(handler.apply(context(plugin), args(plugin)))
      }
    }
    await Promise.all(parallelPromises)
  }

Domain

Subdomains

Frequently Asked Questions

What does hookParallel() do?
hookParallel() is a function in the vite codebase, defined in packages/vite/src/node/server/pluginContainer.ts.
Where is hookParallel() defined?
hookParallel() is defined in packages/vite/src/node/server/pluginContainer.ts at line 304.
What does hookParallel() call?
hookParallel() calls 1 function(s): getHookHandler.
What calls hookParallel()?
hookParallel() is called by 3 function(s): buildStart, close, watchChange.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free