Skip to content

Commit

Permalink
Define decoding algorithms for source maps (#119)
Browse files Browse the repository at this point in the history
* Define decoding algorithms for source maps

This PR introduces "decoded source map" data structures, which are
internal spec representations of the information encoded in source maps.

It also defines algorithms to decode source maps from either a JSON
string or [infra](https://infra.spec.whatwg.org/) representation.

The goal is:
- use them to explicitly write down all the possible error cases
- use them as a starting point to define new data structures, for
  example for the scopes proposal
- eventually add algorithms such as "get the original location given a
  decoded source map and a generated location".

This PR also explicitly defines sources/sourceRoot resolution in terms
of the [WHATWG URL](https://url.spec.whatwg.org/) spec.

* Fix indentation

* Remove extra text

* Asumu's review

* Justin: rename variable

* Justin: sources/sourcesContent can contain nulls

* Justin: error on missing sources

* Justin: fix source url resolution

* Justin: handle call to "decode a base64 VLQ" at the string end

* Return -2147483648 for B, and use natural arithmetic

* Hoist

* Hoist originalLine and originalColumn

* Add note about deduplication

* Remove todo comment
  • Loading branch information
nicolo-ribaudo authored Sep 15, 2024
1 parent fec48d3 commit 66a163d
Showing 1 changed file with 295 additions and 25 deletions.
Loading

0 comments on commit 66a163d

Please sign in to comment.