-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathindex.d.ts
82 lines (81 loc) · 1.71 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
type Callback<T = unknown> = (err: Error | null, data: T) => void;
interface PackageJson {
name: string;
version: string;
dependencies?: Record<string, string>;
devDependencies?: Record<string, string>;
}
export interface CompiledViewInfo {
template: {
type: string;
hashKey: string;
src: string;
};
bundle: {
hashKey: string;
};
}
type OcOptions = {
files: {
data: string;
template: {
src: string;
type: string;
externals?: Array<{
name: string;
global: string | string[];
url: string;
}>;
};
static: string[];
};
};
export interface CompilerOptions {
componentPackage: PackageJson & {
oc: OcOptions;
};
componentPath: string;
minify: boolean;
ocPackage: PackageJson;
production: boolean;
publishPath: string;
verbose: boolean;
watch: boolean;
}
export interface CompilerServerOptions extends CompilerOptions {
compiledViewInfo: CompiledViewInfo;
}
export type CompileView = (
options: CompilerOptions,
cb: Callback<CompiledViewInfo>
) => void;
export type CompileServer = (
options: CompilerServerOptions,
cb: Callback<any>
) => void;
export type CompileStatics = (
options: CompilerOptions,
cb: Callback<'ok'>
) => void;
export type GetInfo = () => {
type: string;
version: string;
externals: Array<{
name: string;
global: string | string[];
url: string;
}>;
};
export type Compilers = {
compileView: CompileView;
compileServer: CompileServer;
compileStatics: CompileStatics;
getInfo: GetInfo;
};
export declare const createCompile: ({
compileServer,
compileView,
compileStatics,
getInfo
}: Compilers) => (options: CompilerOptions, callback: Callback) => void;
export {};