///
import * as Options from './options';
import type { Processed as SvelteProcessed, Preprocessor as SveltePreprocessor, PreprocessorGroup } from 'svelte/compiler';
export { Options };
export { PreprocessorGroup };
export type PreprocessorArgs = Preprocessor extends (options: infer T) => any ? T : never;
export type TransformerArgs = {
content: string;
filename?: string;
attributes?: Record;
map?: string | object;
markup?: string;
diagnostics?: unknown[];
options?: T;
};
/**
* Small extension to the official SvelteProcessed type
* to include possible diagnostics.
* Used for the typescript transformer.
*/
export type Processed = SvelteProcessed & {
diagnostics?: any[];
};
/**
* Svelte preprocessor type with guaranteed Processed results
*
* The official type also considers `void`
* */
export type Preprocessor = (options: Parameters[0]) => Processed | Promise;
export type Transformer = (args: TransformerArgs) => Processed | Promise;
export type TransformerOptions = boolean | T | Transformer;
export interface Transformers {
babel?: TransformerOptions;
typescript?: TransformerOptions;
scss?: TransformerOptions;
sass?: TransformerOptions;
less?: TransformerOptions;
stylus?: TransformerOptions;
postcss?: TransformerOptions;
coffeescript?: TransformerOptions;
pug?: TransformerOptions;
globalStyle?: Options.GlobalStyle;
replace?: Options.Replace;
[language: string]: TransformerOptions;
}
export type AutoPreprocessGroup = PreprocessorGroup;
export type AutoPreprocessOptions = {
markupTagName?: string;
aliases?: Array<[string, string]>;
sourceMap?: boolean;
babel?: TransformerOptions;
typescript?: TransformerOptions;
scss?: TransformerOptions;
sass?: TransformerOptions;
less?: TransformerOptions;
stylus?: TransformerOptions;
postcss?: TransformerOptions;
coffeescript?: TransformerOptions;
pug?: TransformerOptions;
globalStyle?: Options.GlobalStyle | boolean;
replace?: Options.Replace;
[languageName: string]: TransformerOptions;
};