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