콘텐츠로 이동

PluginBuild

Defined in: core/index.ts:1116

onAstFunction(options, callback): void

Defined in: core/index.ts:1163

RegExp

(info) => HookResult<AstFunctionResult>

void


onBuildEnd(callback): void

Defined in: core/index.ts:1157

Bundle 종료 시 1회 호출. 성공/실패 모두 dispatch. 실패 시 fatal diagnostic 의 첫 항목을 Error 로 wrap 해서 전달 (#2156). watch 모드는 초기 build 와 매 rebuild 마다 호출.

onCloseBundle 보다 먼저 호출됨.

(error?) => void | Promise<void>

void


onBuildStart(callback): void

Defined in: core/index.ts:1150

Bundle 시작 시 1회 호출. esbuild onStart, Rollup/Vite/rolldown buildStart 동일 (#2156). watch 모드는 초기 build 와 매 rebuild 마다 호출됨 (Rollup 5+ 정책과 동일).

인자는 없음 — esbuild onStart 와 동일. plugin 자체 setup 시 BuildOptions 가 이미 전달됨.

() => void | Promise<void>

void


onCloseBundle(callback): void

Defined in: core/index.ts:1162

Output 파일 write 완료 후 1회 호출 (#2156). Rollup closeBundle 와 동일 — temp 파일 cleanup, 외부 시스템에 빌드 완료 알림 등에 사용. watch 모드는 초기 build 와 매 rebuild 마다 호출.

() => void | Promise<void>

void


onGenerateBundle(callback): void

Defined in: core/index.ts:1143

(outputs) => void | Promise<void>

void


onLoad(options, callback): void

Defined in: core/index.ts:1129

RegExp

(args) => HookResult<{ contents: string | Uint8Array<ArrayBufferLike>; loader?: string; map?: unknown; }>

void


onRenderChunk(options, callback): void

Defined in: core/index.ts:1139

RegExp

(args) => HookResult<{ code: string; }>

void


onResolve(options, callback): void

Defined in: core/index.ts:1117

RegExp

(args) => HookResult<{ disabled?: boolean; external?: boolean; path?: string; }>

void


onResolveContext(options, callback): void

Defined in: core/index.ts:1179

require.context(dir, recursive, filter, mode) 의 매칭 결과를 호스트 런타임에서 채운다. (#1579) ZNTC 자체 regex executor 가 없어서 (#1771) host 의 RegExp 에 위임 — Node V8 / Bun JSC.

options.filterdir 에 적용 (예: /^\./app/ 으로 특정 디렉토리만 처리). 콜백 반환:

  • { context: string[] } — 매칭된 파일 경로 배열 (빈 배열 = empty context)
  • null/undefined — 다음 plugin 시도 (모두 null 이면 graph 가 require_context_no_handler diagnostic)

콜백 인자 filter 는 require.context 의 정규식 본문 (slashes 없이), flags 는 정규식 플래그. host 가 new RegExp(filter, flags) 로 컴파일 후 매칭.

RegExp

(args) => HookResult<{ context: string[]; }>

void


onTransform(options, callback): void

Defined in: core/index.ts:1135

RegExp

(args) => HookResult<{ code: string; map?: unknown; }>

void