Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prototype implementation of Source Maps v4 #1

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

robpaveza
Copy link
Owner

This pull request is for me to do a self-code-review.

Source Maps v4 standard proposal is an addendum to source maps to
improve post-hoc debugging and analysis of call stacks. This proposal is
being put forward in
[https://github.com/MicrosoftEdge/MSEdgeExplainers/pull/538](Microsoft Edge)
and is designed to enable an analysis of stack traces to reconstruct an
unminified stack trace.

To do so, two additional fields are added to the source maps output:

  • scopeNames
  • scopes

The latter field behaves similarly to the existing mappings field. The
former list are names that should be displayed for a given function once
it is determined to be responsible. The format of the scopes field is
a Base64 VLQ with 6 fields, which are, in order:

  • Source file index
  • Source line (relative offset)
  • Source character (relative offset)
  • End line (relative offset, should always be positive)
  • End character (relative offset)
  • Index into scopeNames

(This first commit does not implement the VLQ encoding; rather, all
number values are directly passed in and are neither relative nor are
they encoded as VLQs).

Fixes #

Source Maps v4 standard proposal is an addendum to source maps to
improve post-hoc debugging and analysis of call stacks. This proposal is
being put forward in
[https://github.com/MicrosoftEdge/MSEdgeExplainers/pull/538](Microsoft Edge)
and is designed to enable an analysis of stack traces to reconstruct an
unminified stack trace.

To do so, two additional fields are added to the source maps output:
 - `scopeNames`
 - `scopes`

The latter field behaves similarly to the existing `mappings` field. The
former list are names that should be displayed for a given function once
it is determined to be responsible. The format of the `scopes` field is
a Base64 VLQ with 6 fields, which are, in order:
 - Source file index
 - Source line (relative offset)
 - Source character (relative offset)
 - End line (relative offset, should always be positive)
 - End character (relative offset)
 - Index into `scopeNames`

(This first commit does not implement the VLQ encoding; rather, all
number values are directly passed in and are neither relative nor are
they encoded as VLQs).
 - Method declarations
 - Constructor
 - Class property accessors
 - Improved arrow scope
 - Arrow scope call expressions
 - Lambda class property
 - Base64 VLQ encoding of `scopes` property

Fixed a bug that allowed some code to execute in v3 passes.
Several tests related to tsc --init / tsc watch were breaking as a
result of the new option. These tests have been rebaselined or adjusted
as needed to accommodate the new `sourceMapVersion` setting.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant