48 lines
1.3 KiB
TypeScript
48 lines
1.3 KiB
TypeScript
import * as webpack from 'webpack';
|
|
import { ParserOptions } from '@babel/parser';
|
|
import { Program, Node } from '@babel/types';
|
|
import { FilterPattern } from '@rollup/pluginutils';
|
|
|
|
interface ScriptTagMeta {
|
|
start: number;
|
|
end: number;
|
|
contentStart: number;
|
|
contentEnd: number;
|
|
content: string;
|
|
attrs: Record<string, string>;
|
|
found: boolean;
|
|
ast: Program;
|
|
}
|
|
interface ParsedSFC {
|
|
id?: string;
|
|
template: {
|
|
/** foo-bar -> FooBar */
|
|
components: Set<string>;
|
|
/** v-foo-bar -> fooBar */
|
|
directives: Set<string>;
|
|
identifiers: Set<string>;
|
|
};
|
|
scriptSetup: ScriptTagMeta;
|
|
script: ScriptTagMeta;
|
|
parserOptions: ParserOptions;
|
|
extraDeclarations: Node[];
|
|
}
|
|
interface ScriptSetupTransformOptions {
|
|
astTransforms?: {
|
|
script?: (ast: Program) => Program;
|
|
scriptSetup?: (ast: Program) => Program;
|
|
post?: (ast: Program, sfc: ParsedSFC) => Program;
|
|
};
|
|
reactivityTransform?: boolean;
|
|
importHelpersFrom?: string;
|
|
sourceMap?: boolean;
|
|
}
|
|
interface PluginOptions extends ScriptSetupTransformOptions {
|
|
include?: FilterPattern;
|
|
exclude?: FilterPattern;
|
|
}
|
|
|
|
declare const _default: (options: PluginOptions) => webpack.WebpackPluginInstance;
|
|
|
|
export { _default as default };
|