@hyperfrontend/builder/bundle

bundle

Bundle subdomain facade: entry-point discovery, externals resolution, Rollup driver, declaration emission, and the orchestrator that runs them in order.

runBundlePhase(context, config) walks the per-format configurations on the supplied BuildConfig, resolves the matching entry points, drives Rollup once per entry through the appropriate per-format descriptor factory, then calls generateDeclarations to emit .d.ts files and runs the closing prune and shared-dedupe passes. The phase returns aggregated FormatOutputs covering the ESM, CJS, IIFE, and UMD entries it produced — consumers compose this primitive into the larger build() facade.

API Reference

ƒ Functions

§function

runBundlePhase(context: BuildContext, config: BuildConfig, monitor?: MemoryMonitor): Promise<FormatOutputs>

Runs the entire bundle phase: ESM, CJS, IIFE, UMD outputs followed by declaration emission.
Iterates the format-specific configurations in config, resolves the matching entry points for each format, and bundles every one. After all bundles are written, emits .d.ts declarations for the project exactly once.

Parameters

NameTypeDescription
§context
BuildContext
Resolved build context.
§config
BuildConfig
Top-level builder configuration. Only the format and tsConfig fields are consulted by this phase.
§monitor?
MemoryMonitor
Optional memory monitor; when provided, peak heap inside the bundle phase is sampled at each format and declaration step.

Returns

Promise<FormatOutputs>
Aggregated outputs grouped by format.

Example

Driving the bundle phase from a custom orchestrator

const formatOutputs = await runBundlePhase(context, config)