1 | export interface BundleOptions {
|
2 | intro?: string;
|
3 | separator?: string;
|
4 | }
|
5 |
|
6 | export interface SourceMapOptions {
|
7 | hires: boolean;
|
8 | file: string;
|
9 | source: string;
|
10 | includeContent: boolean;
|
11 | }
|
12 |
|
13 | export interface SourceMap {
|
14 | file: string;
|
15 | sources: string[];
|
16 | sourcesContent: string;
|
17 | names: string[];
|
18 | mappings: string[];
|
19 |
|
20 | toString(): string;
|
21 | toUrl(): string;
|
22 | }
|
23 |
|
24 | export class Bundle {
|
25 | constructor(options?: BundleOptions);
|
26 | addSource(source: MagicString | { filename?: string, content: MagicString }): Bundle;
|
27 | append(str: string, options: BundleOptions): Bundle;
|
28 | clone(): Bundle;
|
29 | generateMap(options?: Partial<SourceMapOptions>): SourceMap;
|
30 | getIndentString(): string;
|
31 | indent(indentStr?: string): Bundle;
|
32 | prepend(str: string): Bundle;
|
33 | toString(): string;
|
34 | trimLines(): string;
|
35 | trim(charType: string): string;
|
36 | trimStart(charType: string): Bundle;
|
37 | trimEnd(charType: string): Bundle;
|
38 | }
|
39 |
|
40 | export type ExclusionRange = [ number, number ];
|
41 |
|
42 | export interface MagicStringOptions {
|
43 | filename: string,
|
44 | indentExclusionRanges: ExclusionRange | Array<ExclusionRange>;
|
45 | }
|
46 |
|
47 | export interface IndentOptions {
|
48 | exclude: ExclusionRange | Array<ExclusionRange>;
|
49 | indentStart: boolean;
|
50 | }
|
51 |
|
52 | export interface OverwriteOptions {
|
53 | storeName?: boolean;
|
54 | contentOnly?: boolean;
|
55 | }
|
56 |
|
57 | export default class MagicString {
|
58 | constructor(str: string, options?: MagicStringOptions);
|
59 | addSourcemapLocation(char: number): void;
|
60 | append(content: string): MagicString;
|
61 | appendLeft(index: number, content: string): MagicString;
|
62 | appendRight(index: number, content: string): MagicString;
|
63 | clone(): MagicString;
|
64 | generateMap(options?: Partial<SourceMapOptions>): SourceMap;
|
65 | getIndentString(): string;
|
66 |
|
67 | indent(options?: IndentOptions): MagicString;
|
68 | indent(indentStr?: string, options?: IndentOptions): MagicString;
|
69 |
|
70 | move(start: number, end: number, index: number): MagicString;
|
71 | overwrite(start: number, end: number, content: string, options?: boolean | OverwriteOptions): MagicString;
|
72 | prepend(content: string): MagicString;
|
73 | prependLeft(index: number, content: string): MagicString;
|
74 | prependRight(index: number, content: string): MagicString;
|
75 | remove(start: number, end: number): MagicString;
|
76 | slice(start: number, end: number): string;
|
77 | snip(start: number, end: number): MagicString;
|
78 |
|
79 | original: string;
|
80 | }
|