import { ServerPlugin } from './server'; import { Plugin as RollupPlugin } from 'rollup'; import { SourceMap } from './server/serverPluginSourceMap'; import { InternalResolver } from './resolver'; declare type ParsedQuery = Record; interface TransformTestContext { /** * Full specifier of the transformed module, including query parameters */ id: string; /** * Path without query (use this to check for file extensions) */ path: string; /** * Parsed query object */ query: ParsedQuery; /** * Indicates whether this is a request made by js import(), or natively by * the browser (e.g. ``). */ isImport: boolean; isBuild: boolean; /** * Indicates that the file for this request was not modified since last call. */ notModified?: true; } export interface TransformContext extends TransformTestContext { code: string; } export interface TransformResult { code: string; map?: SourceMap; } export declare type TransformFn = (ctx: TransformContext) => string | TransformResult | Promise; export interface Transform { test: (ctx: TransformTestContext) => boolean; transform: TransformFn; } export interface IndexHtmlTransformContext { code: string; isBuild: boolean; } export declare type IndexHtmlTransformFn = (ctx: IndexHtmlTransformContext) => string | Promise; export declare type IndexHtmlTransform = IndexHtmlTransformFn | { /** * Timing for applying the transform. * @default: 'post' */ apply?: 'pre' | 'post'; transform: IndexHtmlTransformFn; }; export declare type CustomBlockTransform = TransformFn; export declare function createServerTransformPlugin(transforms: Transform[], customBlockTransforms: Record, resolver: InternalResolver): ServerPlugin; export declare function createBuildJsTransformPlugin(transforms: Transform[], customBlockTransforms: Record): RollupPlugin; export {};