-
Notifications
You must be signed in to change notification settings - Fork 638
/
index.d.ts
94 lines (83 loc) · 2.26 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
import { SourceMap } from "magic-string";
import { TaglibLookup } from "@marko/babel-utils";
import * as types from "./babel-types";
export { types };
type Dep = {
type: string;
code: string;
path: string;
startPos?: number;
endPos?: number;
require?: boolean;
virtualPath?: string;
[x: string]: unknown;
};
export type Config = {
output?: "html" | "dom" | "hydrate" | "migrate" | "source";
runtimeId?: string;
ast?: boolean;
code?: boolean;
writeVersionComment?: boolean;
ignoreUnrecognizedTags?: boolean;
sourceMaps?: boolean;
translator?: string;
fileSystem?: typeof import("fs");
modules?: "esm" | "cjs";
resolveVirtualDependency?(sourceFileName: string, dep: { virtualPath: string, code: string, map?: SourceMap }): string;
hydrateIncludeImports?: RegExp | ((request: string) => boolean);
optimize?: boolean;
cache?: Map<unknown, unknown>;
hot?: boolean;
babelConfig?: {
ast?: boolean | null;
code?: boolean | null;
comments?: boolean | null;
compact?: boolean | "auto" | null;
caller?: { name?: string; [x: string]: unknown };
minified?: boolean | null;
[x: string]: unknown;
};
};
export type MarkoMeta = {
id: string;
component?: string;
watchFiles?: string[];
tags?: string[];
deps: Array<
| string
| Dep
>;
};
export type CompileResult = {
ast: types.File;
code: string;
map: SourceMap;
meta: MarkoMeta;
};
export function configure(config: Config): void;
export function compile(
src: string,
filename: string,
config?: Config
): Promise<CompileResult>;
export function compileSync(
src: string,
filename: string,
config?: Config
): CompileResult;
export function compileFile(
filename: string,
config?: Config
): Promise<CompileResult>;
export function compileFileSync(
filename: string,
config?: Config
): CompileResult;
export function getRuntimeEntryFiles(output: string, translator?: string | undefined): string[];
export namespace taglib {
export function excludeDir(dirname: string): void;
export function excludePackage(packageName: string): void;
export function register(id: string, props: { [x:string]: unknown }): void;
export function buildLookup(dirname: string, translator?: unknown): TaglibLookup
export function clearCaches(): void;
}