mirror of
https://github.com/imezx/Warp.git
synced 2025-04-24 15:10:03 +00:00
62 lines
2.1 KiB
TypeScript
62 lines
2.1 KiB
TypeScript
import { ViteDevServer, Plugin } from 'vite';
|
|
import * as _compiler from 'vue/compiler-sfc';
|
|
import { SFCScriptCompileOptions, SFCTemplateCompileOptions, SFCStyleCompileOptions } from 'vue/compiler-sfc';
|
|
|
|
interface VueQuery {
|
|
vue?: boolean;
|
|
src?: string;
|
|
type?: 'script' | 'template' | 'style' | 'custom';
|
|
index?: number;
|
|
lang?: string;
|
|
raw?: boolean;
|
|
url?: boolean;
|
|
scoped?: boolean;
|
|
id?: string;
|
|
}
|
|
declare function parseVueRequest(id: string): {
|
|
filename: string;
|
|
query: VueQuery;
|
|
};
|
|
|
|
interface Options {
|
|
include?: string | RegExp | (string | RegExp)[];
|
|
exclude?: string | RegExp | (string | RegExp)[];
|
|
isProduction?: boolean;
|
|
script?: Partial<Pick<SFCScriptCompileOptions, 'babelParserPlugins' | 'globalTypeFiles' | 'propsDestructure' | 'fs' | 'hoistStatic'>> & {
|
|
/**
|
|
* @deprecated defineModel is now a stable feature and always enabled if
|
|
* using Vue 3.4 or above.
|
|
*/
|
|
defineModel?: boolean;
|
|
};
|
|
template?: Partial<Pick<SFCTemplateCompileOptions, 'compiler' | 'compilerOptions' | 'preprocessOptions' | 'preprocessCustomRequire' | 'transformAssetUrls'>>;
|
|
style?: Partial<Pick<SFCStyleCompileOptions, 'trim'>>;
|
|
/**
|
|
* Transform Vue SFCs into custom elements.
|
|
* - `true`: all `*.vue` imports are converted into custom elements
|
|
* - `string | RegExp`: matched files are converted into custom elements
|
|
*
|
|
* @default /\.ce\.vue$/
|
|
*/
|
|
customElement?: boolean | string | RegExp | (string | RegExp)[];
|
|
/**
|
|
* Use custom compiler-sfc instance. Can be used to force a specific version.
|
|
*/
|
|
compiler?: typeof _compiler;
|
|
}
|
|
interface ResolvedOptions extends Options {
|
|
compiler: typeof _compiler;
|
|
root: string;
|
|
sourceMap: boolean;
|
|
cssDevSourcemap: boolean;
|
|
devServer?: ViteDevServer;
|
|
devToolsEnabled?: boolean;
|
|
}
|
|
interface Api {
|
|
get options(): ResolvedOptions;
|
|
set options(value: ResolvedOptions);
|
|
version: string;
|
|
}
|
|
declare function vuePlugin(rawOptions?: Options): Plugin<Api>;
|
|
|
|
export { type Api, type Options, type ResolvedOptions, type VueQuery, vuePlugin as default, parseVueRequest };
|