import { SourceMapInput, EmittedAsset, AcornNode, Plugin, PluginContextMeta } from 'rollup'; export { Plugin as RollupPlugin } from 'rollup'; import { Compiler, WebpackPluginInstance } from 'webpack'; export { Compiler as WebpackCompiler } from 'webpack'; import { Plugin as Plugin$1 } from 'vite'; export { Plugin as VitePlugin } from 'vite'; import { Plugin as Plugin$2, PluginBuild } from 'esbuild'; export { Plugin as EsbuildPlugin } from 'esbuild'; import VirtualModulesPlugin from 'webpack-virtual-modules'; type Thenable = T | Promise; type TransformResult = string | { code: string; map?: SourceMapInput | null; } | null | undefined; interface ExternalIdResult { id: string; external?: boolean; } interface UnpluginBuildContext { addWatchFile: (id: string) => void; emitFile: (emittedFile: EmittedAsset) => void; getWatchFiles: () => string[]; parse: (input: string, options?: any) => AcornNode; } interface UnpluginOptions { name: string; enforce?: 'post' | 'pre' | undefined; buildStart?: (this: UnpluginBuildContext) => Promise | void; buildEnd?: (this: UnpluginBuildContext) => Promise | void; transform?: (this: UnpluginBuildContext & UnpluginContext, code: string, id: string) => Thenable; load?: (this: UnpluginBuildContext & UnpluginContext, id: string) => Thenable; resolveId?: (id: string, importer: string | undefined, options: { isEntry: boolean; }) => Thenable; watchChange?: (this: UnpluginBuildContext, id: string, change: { event: 'create' | 'update' | 'delete'; }) => void; writeBundle?: (this: void) => Promise | void; /** * Custom predicate function to filter modules to be loaded. * When omitted, all modules will be included (might have potential perf impact on Webpack). */ loadInclude?: (id: string) => boolean | null | undefined; /** * Custom predicate function to filter modules to be transformed. * When omitted, all modules will be included (might have potential perf impact on Webpack). */ transformInclude?: (id: string) => boolean | null | undefined; rollup?: Partial; webpack?: (compiler: Compiler) => void; vite?: Partial; esbuild?: { onResolveFilter?: RegExp; onLoadFilter?: RegExp; setup?: Plugin$2['setup']; }; } interface ResolvedUnpluginOptions extends UnpluginOptions { __vfs?: VirtualModulesPlugin; __vfsModules?: Set; __virtualModulePrefix: string; } type UnpluginFactory = (options: UserOptions, meta: UnpluginContextMeta) => Nested extends true ? Array : UnpluginOptions; type UnpluginFactoryOutput = undefined extends UserOptions ? (options?: UserOptions) => Return : (options: UserOptions) => Return; interface UnpluginInstance { rollup: UnpluginFactoryOutput : Plugin>; vite: UnpluginFactoryOutput : Plugin$1>; webpack: UnpluginFactoryOutput; esbuild: UnpluginFactoryOutput; raw: UnpluginFactory; } type UnpluginContextMeta = Partial & ({ framework: 'rollup' | 'vite'; } | { framework: 'webpack'; webpack: { compiler: Compiler; }; } | { framework: 'esbuild'; build?: PluginBuild; /** Set the host plugin name of esbuild when returning multiple plugins */ esbuildHostName?: string; }); interface UnpluginContext { error(message: any): void; warn(message: any): void; } declare module 'webpack' { interface Compiler { $unpluginContext: Record; } } declare function createUnplugin(factory: UnpluginFactory): UnpluginInstance; export { ExternalIdResult, ResolvedUnpluginOptions, Thenable, TransformResult, UnpluginBuildContext, UnpluginContext, UnpluginContextMeta, UnpluginFactory, UnpluginFactoryOutput, UnpluginInstance, UnpluginOptions, createUnplugin };