Framework
BuildTransformContext
Interface: BuildTransformContext
Context provided to build/transform.ts hooks. Runs AFTER entries are processed but BEFORE manifest generation. Allows filtering and transforming processed entries.
Hook signature: (entries: ProcessedEntry[], context: BuildTransformContext) => ProcessedEntry[]
The entries are passed as the first argument for modification.
The context also provides entries accessor for convenience (read-only inspection).
Example
export default function (entries: ProcessedEntry[], context: BuildTransformContext) {
// Use context.entries for read-only inspection
const commands = context.entries?.get('discordjs', 'commands') ?? []
context.logger.info(`Processing ${commands.length} commands`)
// Filter/transform and return modified entries
return entries.filter(e => !e.key.startsWith('debug'))
}Extends
Properties
| Property | Type | Description | Overrides | Inherited from |
|---|---|---|---|---|
config | Config | Loaded configuration | - | BuildContext.config |
entries | EntriesAccessor | Entries accessor is always available in transform hooks | BuildContext.entries | - |
env | typeof Env | Environment variable access | - | BuildContext.env |
logger | Logger | Logger instance (forked for plugins) | - | BuildContext.logger |
mode | string | Current build mode (supports custom modes like 'beta', 'staging', etc.) | - | BuildContext.mode |
paths | { output: string; root: string; src: string; } | Project paths | - | BuildContext.paths |
paths.output | string | - | - | - |
paths.root | string | - | - | - |
paths.src | string | - | - | - |
store | BuildStore | Key-value store for passing data between build hooks. Use to share computed values between build/start and build/complete. | - | BuildContext.store |
