@hyperfrontend/builder/modelsmodels
Type definitions for builder configuration, runtime context, and build results.
This entry point re-exports the cross-cutting types consumed by the bundle, package, and bin subdomains: BuildConfig and the per-format configuration shapes (EsmConfig, CjsConfig, IifeConfig, UmdConfig), the BinConfig and SeaConfig declarations, the resolved BuildContext passed to primitives, and the BuildResult returned by the build() facade. Consumers composing builder primitives — or extending it with custom presets — import from here to stay aligned with the shapes the rest of the library expects.
API Reference
◈ Interfaces
Generic asset-copy specification consumed by the package phase.
Either
Either
files or glob selects the inputs under from. When neither is provided, every file directly under from is copied.Properties
Author / contributor entry in package.json.
Bin synthesis configuration.
The source file is fixed at
The source file is fixed at
src/bin/<name>.ts. The runner export defaults to the file's default export; override with runner to target a named export instead.Properties
Output record describing a single emitted bin (per format and per platform).
Properties
§
kind:"cjs" | "esm" | "native"— Output kind: a JS script for one of the supported formats, or a native SEA binary.
Bugs field in package.json.
Top-level builder configuration consumed by the
build() facade.Properties
§
files?:string[]— Override the published
When omitted, the allowlist is reflected from the materialized output tree after every emit phase — it names exactly what shipped. Provide an explicit array to take full control of what
package.json#files allowlist. When omitted, the allowlist is reflected from the materialized output tree after every emit phase — it names exactly what shipped. Provide an explicit array to take full control of what
npm publish ships.§
filterWorkspaceDepsFromOutput?:boolean— Drop workspace-internal entries from the output package.json's
dependencies.§
inheritFieldsFrom?:InheritFromSpec— Selectively copy fields from another package.json onto the output package.json.
§
isWorkspacePackage?:IsWorkspacePackagePredicate— Workspace-package predicate; when omitted the bundler treats every dep as external.
§
memoryMonitor?:boolean | MemoryMonitorOptions— Enable the memory monitor; pass
true for defaults or an options object for custom thresholds.§
outputPath?:string— Absolute output directory. Defaults to
<workspaceRoot>/dist/<projectRelativePath>.§
tsConfig?:string— Path to the project's tsconfig used for declarations. Defaults to
<projectRoot>/tsconfig.lib.json.§
verbose?:boolean— Raise the build's log level. When
true, the shared logger emits at debug (surfacing every phase's progress, timing, and memory diagnostics); when omitted or false, the build stays quiet at error. Also settable via the hf-build --verbose flag.§
workspaceDepPolicy?:Record<string, WorkspaceDepHoistPolicy>— Per-package override of the workspace-dependency hoist policy, keyed by package name. Packages absent from the map default to
'sub-path' (granular, zero-config); set a package to 'whole-surface' to opt into collapsing its sub-paths onto the root chunk. Builder ships no built-in entries; consumers inject their own opinions here, mirroring isWorkspacePackage.Resolved, fully-computed runtime context derived from a
Unlike
BuildConfig. Unlike
BuildConfig, every path and option here has been resolved to an absolute value and every default has been filled in. Builder primitives consume the BuildContext, never the raw config.Properties
§
bundledDeps:string[]— Third-party deps bundled into
_dependencies/<dep>/ and stripped from the output package.json. Empty unless at least one format declares bundleAllDeps.§
isWorkspacePackage:IsWorkspacePackagePredicate— Workspace-package predicate, normalized to always-defined.
§
startedAt:number— Wall-clock timestamp captured at context creation, used for
BuildResult.durationMs.§
workspaceBundledDeps:WorkspaceBundledDep[]— Workspace deps bundled into
_dependencies/<packageName>(/<sub>)?/. Empty unless at least one format declares bundleAllDeps and the project declares workspace deps.Final result returned by the
build() facade.Properties
Caller overrides to the auto-derived bundled-dep set.
The default set is
The default set is
package.json#dependencies minus peerDependencies minus any package matching isWorkspacePackage. include adds packages absent from dependencies; exclude skips ones that would otherwise be picked up. Neither override can resurrect a peer or workspace package.CommonJS output configuration.
Properties
§
bundleAllDeps?:boolean | BundleAllDepsOptions— Bundle every third-party dep into
_dependencies/<dep>/ and route entry imports through that directory at install-relative paths. When true, builder produces a fully self-contained dist with no dependencies field on the published package.§
bundleWorkspaceDeps?:boolean— Inline workspace dependencies (
true) or keep them external (false). Defaults to true.§
entry?:string | string[]— Entry pattern(s) — exact path, glob, or list. Omit to include all detected entries.
Conditional export specification for the package.json
Each property maps an export condition (e.g.,
exports field. Each property maps an export condition (e.g.,
import, require, types) to a resolved file path, or to a nested conditional-export object for further refinement.Properties
A single resolved entry point within a library.
Result of scanning a library for its entry points.
Properties
ESM output configuration.
Properties
§
bundleAllDeps?:boolean | BundleAllDepsOptions— Bundle every third-party dep into
_dependencies/<dep>/ and route entry imports through that directory at install-relative paths. When true, builder produces a fully self-contained dist with no dependencies field on the published package.§
bundleWorkspaceDeps?:boolean— Inline workspace dependencies (
true) or keep them external (false). Defaults to true.§
entry?:string | string[]— Entry pattern(s) — exact path, glob, or list. Omit to include all detected entries.
Per-format counts emitted during a build, derived from
FormatOutputs.Entry-point selection shared by every per-format configuration.
Aggregate per-format output collected during the bundle phase.
Funding entry in package.json.
IIFE (browser self-executing) output configuration.
Build output for a single IIFE bundle.
Inheritance specification: copy the listed top-level fields from another package.json onto the synthesized output package.json, leaving existing fields intact.
Memory-monitor configuration thresholds (in MB).
Subset of the npm package.json schema that the builder reads from and writes to.
Only fields the builder pipeline interacts with directly are typed; arbitrary additional fields are preserved through the index signature and emitted to the output package.json.
Only fields the builder pipeline interacts with directly are typed; arbitrary additional fields are preserved through the index signature and emitted to the output package.json.
Properties
Repository field in package.json.
Node SEA (single-executable application) configuration for a bin.
Properties
UMD (universal module definition) output configuration.
Build output for a single UMD bundle.
Per-package workspace dependency to bundle into a hoisted chunk under
The default set is
_dependencies/<packageName>(/<sub>)?. The default set is
package.json#dependencies intersected with the workspace predicate.◆ Types
Predicate gating whether an asset spec materializes for a given package.
type AssetConditionPredicate = (pkg: PackageJson) => booleanPer-bin format declaration: a single format or an explicit list.
type BinFormatSpec = BinScriptFormat | BinScriptFormat[]Structural pattern of a library's entry-point layout.
root: single entry atsrc/index.tsplatform: browser / node split undersrc/browser/andsrc/node/feature: multiple feature modules undersrc/<feature>/hybrid: a mix of root, platform, and / or feature entriescomplex: nested platform-plus-feature structures
type EntryPointCategory = "root" | "platform" | "feature" | "hybrid" | "complex"Platform hint used for browser / node-specific entry points.
type EntryPointPlatform = "browser" | "node"Value form for an
exports map entry — a resolved string path, a conditional exports object, or a nested record for sub-conditions.type ExportValue = string | ConditionalExport | Record<string, unknown>Predicate identifying packages that are local to the workspace.
Returning
Returning
true opts the package into workspace-aware behavior such as inlining during bundling or stripping from the published dependencies map.type IsWorkspacePackagePredicate = (name: string) => booleanNative binary platform identifier in the form
<process.platform>-<process.arch>.type SeaPlatform = "linux-x64" | "linux-arm64" | "darwin-x64" | "darwin-arm64" | "win32-x64"Per-package hoist policy for a bundled workspace dependency.
'sub-path' (the zero-config default) gives every public tsconfig specifier of the dep — root and each sub-path — its own _dependencies/<name>(/<sub>)?/index.<ext> chunk, preserving sub-module tree-shaking and reuse, and supporting subpath-only packages that expose no root export. 'whole-surface' is an explicit opt-in collapse: it routes every import of the dep onto a single root chunk, and therefore requires the dep to expose a root export.type WorkspaceDepHoistPolicy = "sub-path" | "whole-surface"