UNPKG

2.16 kBTypeScriptView Raw
1/// <reference types="node" />
2import { SFCBlock, StyleCompileResults, TemplateCompileResult } from '@vue/component-compiler-utils';
3import { VueTemplateCompiler, VueTemplateCompilerOptions } from '@vue/component-compiler-utils/dist/types';
4import { AssetURLOptions } from '@vue/component-compiler-utils/dist/templateCompilerModules/assetUrl';
5export interface TemplateOptions {
6 compiler: VueTemplateCompiler;
7 compilerOptions: VueTemplateCompilerOptions;
8 preprocessOptions?: any;
9 transformAssetUrls?: AssetURLOptions | boolean;
10 transpileOptions?: any;
11 isProduction?: boolean;
12 optimizeSSR?: boolean;
13}
14export interface StyleOptions {
15 postcssOptions?: any;
16 postcssPlugins?: any[];
17 postcssModulesOptions?: any;
18 preprocessOptions?: any;
19 postcssCleanOptions?: any;
20 trim?: boolean;
21}
22export interface ScriptOptions {
23 preprocessorOptions?: any;
24}
25export interface CompileResult {
26 code: string;
27 map?: any;
28}
29export declare type StyleCompileResult = StyleCompileResults & {
30 scoped?: boolean;
31 media?: string;
32 moduleName?: string;
33 module?: any;
34};
35export interface DescriptorCompileResult {
36 customBlocks: SFCBlock[];
37 scopeId: string;
38 script?: CompileResult;
39 styles: StyleCompileResult[];
40 template?: TemplateCompileResult & {
41 functional: boolean;
42 };
43}
44export declare class SFCCompiler {
45 script: ScriptOptions;
46 style: StyleOptions;
47 template: TemplateOptions;
48 resolve: RequireResolve;
49 constructor(script: ScriptOptions, style: StyleOptions, template: TemplateOptions, resolve?: RequireResolve);
50 compileToDescriptor(filename: string, source: string): DescriptorCompileResult;
51 compileToDescriptorAsync(filename: string, source: string): Promise<DescriptorCompileResult>;
52 compileTemplate(filename: string, template: SFCBlock): TemplateCompileResult & {
53 functional: boolean;
54 };
55 compileStyle(filename: string, scopeId: string, style: SFCBlock): StyleCompileResult;
56 compileStyleAsync(filename: string, scopeId: string, style: SFCBlock): Promise<StyleCompileResult>;
57 private doCompileStyle;
58 private read;
59}