@rolldown/node-binding
Version:
Fast JavaScript/TypeScript bundler in Rust with Rollup-compatible API.
129 lines (126 loc) • 3.16 kB
TypeScript
/* tslint:disable */
/* eslint-disable */
/* auto-generated by NAPI-RS */
export interface InputItem {
name?: string
import: string
}
export interface ResolveOptions {
alias?: Record<string, Array<string>>
aliasFields?: Array<Array<string>>
conditionNames?: Array<string>
exportsFields?: Array<Array<string>>
extensions?: Array<string>
mainFields?: Array<string>
mainFiles?: Array<string>
modules?: Array<string>
symlinks?: boolean
}
export interface InputOptions {
external?:
| undefined
| ((
source: string,
importer: string | undefined,
isResolved: boolean,
) => boolean)
input: Array<InputItem>
plugins: Array<PluginOptions>
resolve?: ResolveOptions
cwd: string
}
export interface OutputOptions {
entryFileNames?: string
chunkFileNames?: string
dir?: string
exports?: 'default' | 'named' | 'none' | 'auto'
format?: 'esm' | 'cjs'
sourcemap?: 'file' | 'inline' | 'hidden'
}
export interface PluginOptions {
name: string
buildStart?: () => Promise<void>
resolveId?: (
specifier: string,
importer?: string,
options?: HookResolveIdArgsOptions,
) => Promise<undefined | ResolveIdResult>
load?: (id: string) => Promise<undefined | SourceResult>
transform?: (id: string, code: string) => Promise<undefined | SourceResult>
buildEnd?: (error: string) => Promise<void>
renderChunk?: (
code: string,
chunk: RenderedChunk,
) => Promise<undefined | HookRenderChunkOutput>
generateBundle?: (bundle: Outputs, isWrite: boolean) => Promise<void>
writeBundle?: (bundle: Outputs) => Promise<void>
}
export interface HookResolveIdArgsOptions {
isEntry: boolean
kind: string
}
export interface ResolveIdResult {
id: string
external?: boolean
}
export interface SourceResult {
code: string
map?: SourceMap
}
export interface HookRenderChunkOutput {
code: string
}
export interface PreRenderedChunk {
isEntry: boolean
isDynamicEntry: boolean
facadeModuleId?: string
moduleIds: Array<string>
exports: Array<string>
}
export interface RenderedChunk {
isEntry: boolean
isDynamicEntry: boolean
facadeModuleId?: string
moduleIds: Array<string>
exports: Array<string>
fileName: string
modules: Record<string, RenderedModule>
}
export interface SourceMap {
mappings: string
names: Array<string>
sourceRoot?: string
sources: Array<string>
sourcesContent: Array<string>
}
export interface RenderedModule {
code?: string
removedExports: Array<string>
renderedExports: Array<string>
originalLength: number
renderedLength: number
}
export interface OutputChunk {
isEntry: boolean
isDynamicEntry: boolean
facadeModuleId?: string
moduleIds: Array<string>
exports: Array<string>
fileName: string
modules: Record<string, RenderedModule>
code: string
}
export interface OutputAsset {
fileName: string
source: string
}
export interface Outputs {
chunks: Array<OutputChunk>
assets: Array<OutputAsset>
}
export class Bundler {
constructor(inputOpts: InputOptions)
write(opts: OutputOptions): Promise<Outputs>
generate(opts: OutputOptions): Promise<Outputs>
scan(): Promise<void>
}