///
import type { Plugin, Metafile, OnResolveArgs, OnLoadArgs, OnResolveResult, OnLoadResult, BuildOptions } from 'esbuild';
import { ISpeedyBundler } from './bundler';
import { WebpackStats } from './webpack-stats';
interface SourceMap {
mappings: string;
names: string[];
sources: (string | null)[];
version: number;
sourcesContent?: (string | null)[];
}
export declare type ExtraContext = Record;
/**
* Only merge additional fields from U to T.
*/
export declare type SafeMerge = T & {
[K in keyof U as Exclude]: U[K];
};
export interface SpeedyPlugin {
name: string;
apply(compiler: SafeMerge): void;
}
export declare type EsbuildPlugin = Plugin;
export { Metafile };
export declare type ResolveArgs = Pick;
export declare type ResolveResult = Pick;
export declare type LoadArgs = Pick & Pick;
export declare type LoadResult = Pick & {
map?: SourceMap;
};
export declare type AssetChunk = {
type: 'asset';
contents: string | Buffer;
fileName: string;
originalFileName?: string;
entryPoint?: string;
};
export declare type JsChunk = {
type: 'chunk';
contents: string;
fileName: string;
originalFileName?: string;
map?: SourceMap;
entryPoint?: string;
modules?: Record;
isEntry: boolean;
};
export declare type Chunk = AssetChunk | JsChunk;
export declare type Source = {
code: string;
map?: SourceMap;
path: string;
loader?: string;
/**
* Whether enable cache.
* @default true
*/
cache?: boolean;
};
export type { SourceMap };
export { ISpeedyBundler };
export declare const enum ChunkType {
chunk = "chunk",
asset = "asset"
}
export declare type SpeedyManifest = {
metafile: Metafile;
config: BuildOptions;
stats: WebpackStats;
};