-
Notifications
You must be signed in to change notification settings - Fork 108
/
index.d.ts
75 lines (66 loc) · 2.21 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
declare module "magic-string" {
export interface BundleOptions {
intro?: string;
separator?: string;
}
export interface SourceMapOptions {
hires: boolean;
file: string;
sources: string[];
sourcesContent: string;
includeContent: boolean;
names: string[];
mappings: string[];
}
class SourceMap {
constructor(properties: SourceMapOptions);
toString(): string;
toUrl(): string;
}
export class Bundle {
constructor(options?: BundleOptions);
addSource(source: MagicString | { filename?: string, content: MagicString }): Bundle;
append(str: string, options: BundleOptions): Bundle;
clone(): Bundle;
generateMap(options?: SourceMapOptions): SourceMap;
getIndentString(): string;
indent(indentStr: string): Bundle;
prepend(str: string): Bundle;
toString(): string;
trimLines(): string;
trim(charType: string): string;
trimStart(charType: string): Bundle;
trimEnd(charType: string): Bundle;
}
export interface MagicStringOptions {
filename: string,
indentExclusionRanges: any; // TODO
}
export interface IndentOptions {
exclude: any; // TODO
indentStart: boolean;
}
export interface OverwriteOptions {
storeName: boolean;
contentOnly: boolean;
}
export default class MagicString {
constructor(str: string, options?: MagicStringOptions);
addSourcemapLocation(char: string): void;
append(content: string): MagicString;
appendLeft(index: number, content: string): MagicString;
appendRight(index: number, content: string): MagicString;
clone(): MagicString;
generateMap(options?: SourceMapOptions);
getIndentString(): string;
indent(options?): MagicString;
indent(indentStr: string, options: IndentOptions): MagicString;
move(start: number, end: number, index: number): MagicString;
overwrite(start: number, end: number, content: string, options: boolean | OverwriteOptions): MagicString;
prepend(content: string): MagicString;
prependLeft(index: number, content: string): MagicString;
prependRight(index: number, content: string): MagicString;
remove(start: number, end: number): MagicString;
slice(start: number, end: number): string;
}
}