import * as _farmfe_core from '@farmfe/core'; import { JsPlugin } from '@farmfe/core'; import * as _rspack_core_dist_config_zod from '@rspack/core/dist/config/zod'; import * as webpack from 'webpack'; import { Compiler, WebpackPluginInstance } from 'webpack'; export { Compiler as WebpackCompiler, WebpackPluginInstance } from 'webpack'; import * as _rolldown_node from '@rolldown/node'; import { Plugin as Plugin$2 } from '@rolldown/node'; export { Plugin as RolldownPlugin } from '@rolldown/node'; import * as vite from 'vite'; import { Plugin as Plugin$1 } from 'vite'; export { Plugin as VitePlugin } from 'vite'; import * as rollup from 'rollup'; import { SourceMapInput, EmittedAsset, AstNode, Plugin, PluginContextMeta } from 'rollup'; export { Plugin as RollupPlugin } from 'rollup'; import * as esbuild from 'esbuild'; import { PluginBuild, OnLoadResult, Loader, BuildOptions, Plugin as Plugin$3 } from 'esbuild'; export { Plugin as EsbuildPlugin } from 'esbuild'; import { Compiler as Compiler$1, RspackPluginInstance } from '@rspack/core'; export { Compiler as RspackCompiler, RspackPluginInstance } from '@rspack/core'; import VirtualModulesPlugin from 'webpack-virtual-modules'; interface OnTransformOptions { filter: RegExp; namespace?: string; } interface OnTransformArgs { getContents: () => Promise; path: string; namespace: string; suffix: string; pluginData: any; with: Record; } type OnTransformCallback = (args: OnTransformArgs) => (OnLoadResult | null | undefined | Promise); interface EsbuildPluginBuild extends PluginBuild { onTransform: (options: OnTransformOptions, callback: OnTransformCallback) => void; } type Thenable = T | Promise; interface SourceMapCompact { file?: string; mappings: string; names: string[]; sourceRoot?: string; sources: string[]; sourcesContent?: (string | null)[]; version: number; } interface JsPluginExtended extends JsPlugin { [key: string]: any; } type TransformResult = string | { code: string; map?: SourceMapInput | SourceMapCompact | 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) => AstNode; } 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?: (this: UnpluginBuildContext & UnpluginContext, 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; rspack?: (compiler: Compiler$1) => void; vite?: Partial; rolldown?: Partial; esbuild?: { onResolveFilter?: RegExp; onLoadFilter?: RegExp; setup?: (build: EsbuildPluginBuild) => void | Promise; loader?: Loader | ((code: string, id: string) => Loader); config?: (options: BuildOptions) => void; }; farm?: Partial; } 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>; rolldown: UnpluginFactoryOutput : Plugin$2>; webpack: UnpluginFactoryOutput; rspack: UnpluginFactoryOutput; esbuild: UnpluginFactoryOutput; farm: UnpluginFactoryOutput; raw: UnpluginFactory; } type UnpluginContextMeta = Partial & ({ framework: 'rollup' | 'vite' | 'rolldown'; } | { framework: 'webpack'; webpack: { compiler: Compiler; }; } | { framework: 'esbuild'; build?: EsbuildPluginBuild; /** Set the host plugin name of esbuild when returning multiple plugins */ esbuildHostName?: string; } | { framework: 'rspack'; rspack: { compiler: Compiler$1; }; } | { framework: 'farm'; }); interface UnpluginMessage { name?: string; id?: string; message: string; stack?: string; code?: string; plugin?: string; pluginCode?: unknown; loc?: { column: number; file?: string; line: number; }; meta?: any; } interface UnpluginContext { error: (message: string | UnpluginMessage) => void; warn: (message: string | UnpluginMessage) => void; } declare module 'webpack' { interface Compiler { $unpluginContext: Record; } } declare module '@rspack/core' { interface Compiler { $unpluginContext: Record; } } declare function createUnplugin(factory: UnpluginFactory): UnpluginInstance; declare function createEsbuildPlugin(factory: UnpluginFactory): UnpluginFactoryOutput; declare function createRollupPlugin(factory: UnpluginFactory): UnpluginFactoryOutput[] : rollup.Plugin>; declare function createVitePlugin(factory: UnpluginFactory): UnpluginFactoryOutput[] : vite.Plugin>; /** @experimental do not use it in production */ declare function createRolldownPlugin(factory: UnpluginFactory): UnpluginFactoryOutput; declare function createWebpackPlugin(factory: UnpluginFactory): UnpluginFactoryOutput; /** @experimental do not use it in production */ declare function createRspackPlugin(factory: UnpluginFactory): UnpluginFactoryOutput; declare function createFarmPlugin(factory: UnpluginFactory): UnpluginFactoryOutput; export { type ExternalIdResult, type JsPluginExtended, type ResolvedUnpluginOptions, type SourceMapCompact, type Thenable, type TransformResult, type UnpluginBuildContext, type UnpluginContext, type UnpluginContextMeta, type UnpluginFactory, type UnpluginFactoryOutput, type UnpluginInstance, type UnpluginMessage, type UnpluginOptions, createEsbuildPlugin, createFarmPlugin, createRolldownPlugin, createRollupPlugin, createRspackPlugin, createUnplugin, createVitePlugin, createWebpackPlugin };