UNPKG

2.02 kBTypeScriptView Raw
1/// <reference types="node" />
2import { EventEmitter } from "events";
3import { ModuleFormat as RollupModuleFormat, OutputOptions as RollupOutputOptions, Plugin, RollupOptions } from "rollup";
4export declare type ExcludeProps<T, X extends keyof T> = Pick<T, Exclude<keyof T, X>>;
5export declare type OutputExtra = ExcludeProps<RollupOutputOptions, "file" | "format" | "sourcemap" | "esModule" | "interop">;
6export declare type FilterablePlugins = Array<Plugin | null | false>;
7export declare type ConfigExtra = ExcludeProps<RollupOptions, "input" | "output" | "external" | "plugins">;
8export declare type ModuleBuildFormat = Extract<RollupModuleFormat, "cjs" | "es">;
9export declare type BrowserBuildFormat = Extract<RollupModuleFormat, "iife" | "amd" | "umd">;
10export declare type BuildFormat = ModuleBuildFormat | BrowserBuildFormat;
11export interface BundlibOptions {
12 /**
13 * makes bundlib build a development bundle
14 * @default false
15 */
16 dev?: boolean;
17 /**
18 * makes bundlib to run in watch mode
19 * @default false
20 */
21 watch?: boolean;
22 silent?: boolean;
23}
24export declare type EventBuilding = "BUILDING";
25export declare type EventBuilt = "BUILT";
26export declare type EventWriting = "WRITING";
27export declare type EventWritten = "WRITTEN";
28export declare type EventError = "ERROR";
29export interface BuildEventEmitter extends EventEmitter {
30 on(event: EventWriting | EventWritten, listener: (filename: string) => void): this;
31 on(event: EventError, listener: (error: Error) => void): this;
32 on(event: EventBuilding | EventBuilt, listener: () => void): this;
33 emit(event: EventWriting | EventWritten, filename: string): boolean;
34 emit(event: EventError, error: Error): boolean;
35 emit(event: EventBuilding | EventBuilt): boolean;
36}
37export declare type BuildEventEmitterOrPromise = BuildEventEmitter | Promise<BuildEventEmitter>;
38export declare type BuldFunction = (configs: RollupOptions[]) => BuildEventEmitterOrPromise;