KC's Workspace
    Preparing search index...
    interface RolldownMagicString {
        isRolldownMagicString: true;
        get filename(): string | null;
        get indentExclusionRanges(): number[] | number[][] | null;
        get offset(): number;
        set offset(offset: number): void;
        get original(): string;
        append(content: string): this;
        appendLeft(index: number, content: string): this;
        appendRight(index: number, content: string): this;
        clone(): BindingMagicString;
        generateDecodedMap(
            options?: BindingSourceMapOptions | null,
        ): BindingDecodedMap;
        generateMap(options?: BindingSourceMapOptions | null): BindingSourceMap;
        hasChanged(): boolean;
        indent(
            indentor?: string | null,
            options?: BindingIndentOptions | null,
        ): this;
        insert(index: number, content: string): void;
        isEmpty(): boolean;
        lastChar(): string;
        lastLine(): string;
        length(): number;
        move(start: number, end: number, index: number): this;
        overwrite(start: number, end: number, content: string): this;
        prepend(content: string): this;
        prependLeft(index: number, content: string): this;
        prependRight(index: number, content: string): this;
        relocate(start: number, end: number, to: number): this;
        remove(start: number, end: number): this;
        replace(from: string, to: string): this;
        replaceAll(from: string, to: string): this;
        reset(start: number, end: number): this;
        slice(start?: number | null, end?: number | null): string;
        snip(start: number, end: number): BindingMagicString;
        toString(): string;
        trim(charType?: string | null): this;
        trimEnd(charType?: string | null): this;
        trimLines(): this;
        trimStart(charType?: string | null): this;
        update(start: number, end: number, content: string): this;
    }

    Hierarchy (View Summary)

    Index

    Properties

    isRolldownMagicString: true

    Accessors

    • get indentExclusionRanges(): number[] | number[][] | null

      Returns number[] | number[][] | null

    Methods

    • Deprecated method that throws an error directing users to use prependRight or appendLeft. This matches the original magic-string API which deprecated this method.

      Parameters

      • index: number
      • content: string

      Returns void

    • Alias for relocate to match the original magic-string API. Moves the characters from start to end to index. Returns this for method chaining.

      Parameters

      • start: number
      • end: number
      • index: number

      Returns this

    • Resets the portion of the string from start to end to its original content. This undoes any modifications made to that range. Supports negative indices (counting from the end).

      Parameters

      • start: number
      • end: number

      Returns this

    • Returns the content between the specified UTF-16 code unit positions (JS string indices). Supports negative indices (counting from the end).

      When an index falls in the middle of a surrogate pair, the lone surrogate is included in the result (matching the original magic-string / JS behavior). This is done by returning a UTF-16 encoded JS string via napi_create_string_utf16.

      Parameters

      • Optionalstart: number | null
      • Optionalend: number | null

      Returns string