Skip to content

Commit eb45c79

Browse files
committed
feat: add chunks on build:done hook
closes #435
1 parent 64feae0 commit eb45c79

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/features/hooks.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import process from 'node:process'
22
import { createHooks as create, type Hookable } from 'hookable'
33
import { exec } from 'tinyexec'
44
import treeKill from 'tree-kill'
5-
import type { ResolvedConfig } from '../config/index.ts'
5+
import type { ResolvedConfig, TsdownChunks } from '../config/index.ts'
66
import type { BuildOptions } from 'rolldown'
77

88
export interface BuildContext {
@@ -33,7 +33,9 @@ export interface TsdownHooks {
3333
* Invoked after each tsdown build completes.
3434
* Use this hook for cleanup or post-processing tasks.
3535
*/
36-
'build:done': (ctx: BuildContext) => void | Promise<void>
36+
'build:done': (
37+
ctx: BuildContext & { chunks: TsdownChunks },
38+
) => void | Promise<void>
3739
}
3840

3941
export async function createHooks(options: ResolvedConfig): Promise<{

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ export async function buildSingle(
275275
await Promise.all([writeExports(config, chunks), copy(config)])
276276
// TODO: perf use one tarball for both attw and publint
277277
await Promise.all([publint(config), attw(config)])
278-
await hooks.callHook('build:done', context)
278+
await hooks.callHook('build:done', { ...context, chunks })
279279

280280
ab?.abort()
281281
ab = executeOnSuccess(config)

0 commit comments

Comments
 (0)