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

Add source map debugging to website #793

Merged
merged 1 commit into from
Apr 8, 2023

Conversation

alangpierce
Copy link
Owner

Progress toward #541, prep work to help make #759 (and any future source map work) more manually testable.

This PR splits out token information into a new collapased-by-default debug section, then adds source map info to that section. The source map toggle does three things:

  • Show the actual mappings from the source map by line/column index.
  • Show the JSON value of the source map.
  • Extend the normal code output to include an inline source map with the full original source embedded, then link to the very helpful tool https://evanw.github.io/source-map-visualization/ , which accepts pasting the output code.

Progress toward #541, prep work to help make #759 (and any future source map
work) more manually testable.

This PR splits out token information into a new collapased-by-default debug
section, then adds source map info to that section. The source map toggle does
three things:
* Show the actual mappings from the source map by line/column index.
* Show the JSON value of the source map.
* Extend the normal code output to include an inline source map with the full
  original source embedded, then link to the very helpful tool
  https://evanw.github.io/source-map-visualization/ , which accepts pasting the
  output code.
@codecov
Copy link

codecov bot commented Apr 3, 2023

Codecov Report

Merging #793 (f3208d3) into main (99c4f71) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main     #793   +/-   ##
=======================================
  Coverage   88.32%   88.32%           
=======================================
  Files          55       55           
  Lines        5955     5955           
  Branches     1415     1415           
=======================================
  Hits         5260     5260           
  Misses        430      430           
  Partials      265      265           

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@github-actions
Copy link

github-actions bot commented Apr 3, 2023

Benchmark results

Before this PR: 408.4 thousand lines per second
After this PR: 407 thousand lines per second

Measured change: 0.33% slower (1.79% slower to 2.06% faster)
Summary: Likely no significant difference

@alangpierce alangpierce merged commit 7e5b06a into main Apr 8, 2023
8 checks passed
@alangpierce alangpierce deleted the add-source-map-debugging-to-website branch April 8, 2023 04:23
alangpierce added a commit to forivall/sucrase that referenced this pull request Apr 9, 2023
* Get rid of simple source map mode. For now, the detailed source maps will be
  the only mode. Also inline `computeDetailedSourceMap` now that it's the only
  case.
* Remove `WRITE_SOURCE_MAPS` in test and related details. In alangpierce#793 I added source
  map info to the demo website, which is a nicer system for manually verifying
  correctness.
* Update test code to assert the full source map and a JSON representation of
  the mappings.
* Add integration test for Jest inline snapshots.
* Change lint config to ignore unused rest siblings.
* Add bounds checks and change empty `for` loops to `while` (just a style
  preference).
* Add comments in a few more places.
* Remove unnecessary special case when handling hashbang lines.
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.

None yet

1 participant