@hyperfrontend/builder/presetspresets
Predicate factories for the IsWorkspacePackagePredicate slot on BuildConfig.
byPrefix(scope) returns a predicate that matches every package whose name starts with the supplied scope (e.g., byPrefix('@hyperfrontend/')). Use this when every workspace package shares a single scope. byNames(names[]) returns a predicate that matches an explicit list of names; reach for it when the workspace exposes packages under heterogeneous scopes or unscoped names that a prefix can't capture. Both factories return stable closures suitable for direct assignment to BuildConfig.isWorkspacePackage, opting the build into workspace-aware bundling and dependency-filtering behavior without hand-rolling the predicate.
API Reference
ƒ Functions
Use this preset when the workspace exposes packages under heterogeneous scopes (or unscoped names) and a single string prefix can't capture them all.
Parameters
| Name | Type | Description |
|---|---|---|
§names | string[] | Exact package names to treat as workspace-internal. |
Returns
IsWorkspacePackagePredicatetrue when the supplied name appears in names.Example
Tagging an explicit set of workspace packages
const isWorkspacePackage = byNames(['@hyperfrontend/logging', 'internal-utils'])
isWorkspacePackage('internal-utils') // => true
isWorkspacePackage('rollup') // => falseThe scope is treated as a literal string prefix — pass the full scope including the trailing slash (
'@hyperfrontend/') when matching scoped packages so the predicate doesn't accidentally treat @hyperfrontend-foo/x as a workspace package.Parameters
| Name | Type | Description |
|---|---|---|
§scope | string | Literal prefix to match against package names. |
Returns
IsWorkspacePackagePredicatetrue when the supplied name starts with scope.Example
Matching every workspace package by scope
const isWorkspacePackage = byPrefix('@hyperfrontend/')
isWorkspacePackage('@hyperfrontend/logging') // => true
isWorkspacePackage('rollup') // => false