0
0
mirror of https://github.com/sveltejs/svelte.git synced 2024-11-30 00:46:29 +01:00
svelte/src/interfaces.ts
2018-09-25 22:54:57 -04:00

89 lines
1.6 KiB
TypeScript

export interface Node {
start: number;
end: number;
type: string;
[propName: string]: any;
}
export interface Parser {
readonly template: string;
readonly filename?: string;
index: number;
stack: Array<Node>;
html: Node;
css: Node;
js: Node;
metaTags: {};
}
export interface Ast {
html: Node;
css: Node;
js: Node;
}
export interface Warning {
start?: { line: number; column: number; pos?: number };
end?: { line: number; column: number; };
pos?: number;
code: string;
message: string;
filename?: string;
frame?: string;
toString: () => string;
}
export type ModuleFormat = 'es' | 'amd' | 'cjs' | 'iife' | 'umd' | 'eval';
export interface CompileOptions {
format?: ModuleFormat;
name?: string;
filename?: string;
generate?: string | false;
globals?: ((id: string) => string) | object;
amd?: {
id?: string;
};
outputFilename?: string;
cssOutputFilename?: string;
dev?: boolean;
immutable?: boolean;
shared?: boolean | string;
hydratable?: boolean;
legacy?: boolean;
customElement?: CustomElementOptions | true;
css?: boolean;
preserveComments?: boolean | false;
onwarn?: (warning: Warning) => void;
// to remove in v3
onerror?: (error: Error) => void;
skipIntroByDefault?: boolean;
nestedTransitions?: boolean;
}
export interface ShorthandImport {
name: string;
source: string;
};
export interface Visitor {
enter: (node: Node) => void;
leave?: (node: Node) => void;
}
export interface CustomElementOptions {
tag?: string;
props?: string[];
}
export interface AppendTarget {
slots: Record<string, string>;
slotStack: string[]
}