bunchee
Version:
zero config bundler for js/ts/jsx libraries
52 lines (48 loc) • 1.5 kB
TypeScript
import { JscTarget } from '@swc/types';
import { OutputOptions } from 'rollup';
type ExportCondition = string | {
[key: string]: ExportCondition | string;
};
type BundleConfig = {
file?: string;
cwd?: string;
watch?: boolean;
target?: JscTarget;
format?: OutputOptions['format'];
minify?: boolean;
sourcemap?: boolean;
external?: string[] | null;
env?: string[];
dts?: {
respectExternal?: boolean;
} | false;
runtime?: string;
pkg?: PackageMetadata;
clean?: boolean;
tsconfig?: string;
onSuccess?: string | (() => void | Promise<void>);
_callbacks?: {
onBuildStart?: (state: any) => void;
onBuildEnd?: (assetJobs: any) => void;
onBuildError?: (assetJob: any) => void;
};
};
type PackageMetadata = {
name?: string;
main?: string;
bin?: string | Record<string, string>;
module?: string;
files?: string[];
type?: 'commonjs' | 'module';
dependencies?: Record<string, string>;
peerDependencies?: Record<string, string>;
peerDependenciesMeta?: Record<string, Record<string, string>>;
exports?: string | Record<string, ExportCondition>;
types?: string;
typings?: string;
browserslist?: BrowserslistConfig;
};
type BrowserslistConfig = string | string[] | Record<string, string>;
declare function bundle(cliEntryPath: string, { cwd: _cwd, onSuccess, ...options }?: BundleConfig): Promise<void>;
export { bundle };
export type { BundleConfig };