123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268 |
- export interface BundleOptions {
- intro?: string;
- separator?: string;
- }
- export interface SourceMapOptions {
-
- hires?: boolean | 'boundary';
-
- file?: string;
-
- source?: string;
-
- includeContent?: boolean;
- }
- export type SourceMapSegment =
- | [number]
- | [number, number, number, number]
- | [number, number, number, number, number];
- export interface DecodedSourceMap {
- file: string;
- sources: string[];
- sourcesContent?: string[];
- names: string[];
- mappings: SourceMapSegment[][];
- x_google_ignoreList?: number[];
- }
- export class SourceMap {
- constructor(properties: DecodedSourceMap);
- version: number;
- file: string;
- sources: string[];
- sourcesContent?: string[];
- names: string[];
- mappings: string;
- x_google_ignoreList?: number[];
-
- toString(): string;
-
- toUrl(): string;
- }
- export class Bundle {
- constructor(options?: BundleOptions);
-
- addSource(source: MagicString | { filename?: string, content: MagicString, ignoreList?: boolean }): this;
- append(str: string, options?: BundleOptions): this;
- clone(): this;
- generateMap(options?: SourceMapOptions): Omit<SourceMap, 'sourcesContent'> & { sourcesContent: Array<string | null> };
- generateDecodedMap(options?: SourceMapOptions): Omit<DecodedSourceMap, 'sourcesContent'> & { sourcesContent: Array<string | null> };
- getIndentString(): string;
- indent(indentStr?: string): this;
- indentExclusionRanges: ExclusionRange | Array<ExclusionRange>;
- prepend(str: string): this;
- toString(): string;
- trimLines(): this;
- trim(charType?: string): this;
- trimStart(charType?: string): this;
- trimEnd(charType?: string): this;
- isEmpty(): boolean;
- length(): number;
- }
- export type ExclusionRange = [ number, number ];
- export interface MagicStringOptions {
- filename?: string,
- indentExclusionRanges?: ExclusionRange | Array<ExclusionRange>;
- }
- export interface IndentOptions {
- exclude?: ExclusionRange | Array<ExclusionRange>;
- indentStart?: boolean;
- }
- export interface OverwriteOptions {
- storeName?: boolean;
- contentOnly?: boolean;
- }
- export interface UpdateOptions {
- storeName?: boolean;
- overwrite?: boolean;
- }
- export default class MagicString {
- constructor(str: string, options?: MagicStringOptions);
-
- addSourcemapLocation(char: number): void;
-
- append(content: string): this;
-
- appendLeft(index: number, content: string): this;
-
- appendRight(index: number, content: string): this;
-
- clone(): this;
-
- generateMap(options?: SourceMapOptions): SourceMap;
-
- generateDecodedMap(options?: SourceMapOptions): DecodedSourceMap;
- getIndentString(): string;
-
- indent(options?: IndentOptions): this;
-
- indent(indentStr?: string, options?: IndentOptions): this;
- indentExclusionRanges: ExclusionRange | Array<ExclusionRange>;
-
- move(start: number, end: number, index: number): this;
-
- overwrite(start: number, end: number, content: string, options?: boolean | OverwriteOptions): this;
-
- update(start: number, end: number, content: string, options?: boolean | UpdateOptions): this;
-
- prepend(content: string): this;
-
- prependLeft(index: number, content: string): this;
-
- prependRight(index: number, content: string): this;
-
- remove(start: number, end: number): this;
-
- reset(start: number, end: number): this;
-
- slice(start: number, end: number): string;
-
- snip(start: number, end: number): this;
-
- trim(charType?: string): this;
-
- trimStart(charType?: string): this;
-
- trimEnd(charType?: string): this;
-
- trimLines(): this;
-
- replace(regex: RegExp | string, replacement: string | ((substring: string, ...args: any[]) => string)): this;
- /**
- * Same as `s.replace`, but replace all matched strings instead of just one.
- */
- replaceAll(regex: RegExp | string, replacement: string | ((substring: string, ...args: any[]) => string)): this;
- lastChar(): string;
- lastLine(): string;
- /**
- * Returns true if the resulting source is empty (disregarding white space).
- */
- isEmpty(): boolean;
- length(): number;
- /**
- * Indicates if the string has been changed.
- */
- hasChanged(): boolean;
- original: string;
- /**
- * Returns the generated string.
- */
- toString(): string;
- }
|