UNPKG

916 BTypeScriptView Raw
1import { TransformOptions, transform } from 'esbuild';
2
3type Filter = string | RegExp;
4
5type Implementation = {
6 transform: typeof transform;
7};
8
9type Except<ObjectType, Properties> = {
10 [Key in keyof ObjectType as (Key extends Properties ? never : Key)]: ObjectType[Key];
11};
12
13type LoaderOptions = Except<TransformOptions, 'sourcemap' | 'sourcefile'> & {
14 /** Pass a custom esbuild implementation */
15 implementation?: Implementation;
16
17 /**
18 * Path to tsconfig.json file
19 */
20 tsconfig?: string;
21};
22
23type EsbuildPluginOptions = Except<TransformOptions, 'sourcemap' | 'sourcefile'> & {
24 include?: Filter | Filter[];
25 exclude?: Filter | Filter[];
26 css?: boolean;
27 /** Pass a custom esbuild implementation */
28 implementation?: Implementation;
29};
30
31declare class EsbuildPlugin {
32 constructor(options?: EsbuildPluginOptions);
33
34 apply(compiler: any): void;
35}
36
37export { EsbuildPlugin, EsbuildPluginOptions, LoaderOptions };