Crate source_map_mappings_wasm_api [] [src]

The public JS API to the source-map-mappings crate.

Usage

  1. Instantiate the WebAssembly module, supplying a JS implementation of mapping_callback.

  2. Allocate space for the mappings string with allocate_mappings.

  3. Initialize the mappings string by copying the JS String's data into it.

  4. Parse the mappings with parse_mappings. Handle errors, if any.

  5. Query the resulting Mappings structure as needed with by_generated_location, by_original_location, compute_column_spans, original_location_for, generated_location_for, and all_generated_locations_for as needed.

  6. When finished with Mappings structure, dispose of it with free_mappings.

Functions

all_generated_locations_for

Find all mappings for the given original location, and invoke the mapping_callback on each of them.

allocate_mappings

Allocate space for a mappings string of the given size (in bytes).

by_generated_location

Invoke the mapping_callback on each mapping in the given Mappings structure, in order of generated location.

by_original_location

Invoke the mapping_callback on each mapping in the given Mappings structure that has original location information, in order of original location.

compute_column_spans

Compute column spans for the given mappings.

free_mappings

Destroy the given Mappings structure.

generated_location_for

Find the mapping for the given original location, if any exists.

get_last_error

Get the last error's error code, or 0 if there was none.

original_location_for

Find the mapping for the given generated location, if any exists.

parse_mappings

Parse the given initialized mappings string into a Mappings structure.