Crate js_source_scopes

Source
Expand description

§JS Source Scopes

Build Status codecov

This crate provides functionality for extracting and processing scope information from JavaScript source files, and resolving that scope via SourceMaps.

§Features

  • Extracting scopes from source text using extract_scope_names
  • Fast lookup of scopes by byte offset using ScopeIndex
  • Fast conversion between line/column source positions and byte offsets using SourceContext
  • Resolution of minified scope names to their original names using NameResolver

§License

JS Source Scopes is licensed under the Apache-2.0 license.

Structs§

NameComponent
An individual component of a ScopeName.
NameResolver
A structure for resolving ScopeNames in minified code to their original names using information contained in a DecodedMap.
ParseError
An error parsing the JS Source provided to extract_scope_names.
ScopeIndex
An indexed structure of scopes that allows quick lookup by byte offset.
ScopeIndexError
An Error that can happen when building a ScopeIndex.
ScopeName
An abstract scope name which can consist of multiple NameComponents.
SourceContext
A structure allowing fast line/column <-> byte offset remapping.
SourceContextError
An Error that can happen when building a SourceContext.
SourcePosition
A line/column source position.

Enums§

ScopeLookupResult
The Result of a Scope lookup.

Functions§

extract_scope_names
Extracts function scopes from the given JS-like src.

Type Aliases§

Scopes
The Scopes extracted from a piece of JS Code.