webpack / webpack-sources

Source code handling classes for webpack
MIT License
261 stars 71 forks source link

split code into more tokens to fix sourcemap-validator warnings #51

Closed connorjclark closed 5 years ago

connorjclark commented 5 years ago

Fixes https://github.com/webpack/webpack/issues/8302

Add more nodes to create a more granular identity source map. This allows for better source maps when other consumers process what webpack creates (I've been using the terser plugin).

Previous splitting resulted in this (this is post-terser): image

note that all mappings map to column 0 for every line.

Now:

image

I also added a test that did a (too simple) check w/ sourcemap-validator. It passes even w/o these changes - I didn't spend any time thinking about how to create a test case that would mimic what terser was doing. Perhaps someone could help with that?

jsf-clabot commented 5 years ago

CLA assistant check
Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.

codecov[bot] commented 5 years ago

Codecov Report

Merging #51 into master will decrease coverage by 61.66%. The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff             @@
##           master      #51       +/-   ##
===========================================
- Coverage   78.25%   16.58%   -61.67%     
===========================================
  Files          11        8        -3     
  Lines         492      416       -76     
  Branches       76       67        -9     
===========================================
- Hits          385       69      -316     
- Misses        107      347      +240
Impacted Files Coverage Δ
lib/OriginalSource.js 89.47% <100%> (-10.53%) :arrow_down:
lib/ReplaceSource.js 3.6% <0%> (-92.79%) :arrow_down:
lib/ConcatSource.js 9.09% <0%> (-80%) :arrow_down:
lib/PrefixSource.js 15% <0%> (-67.5%) :arrow_down:
lib/RawSource.js 23.52% <0%> (-64.71%) :arrow_down:
lib/CachedSource.js 4.87% <0%> (-41.47%) :arrow_down:
lib/SourceAndMapMixin.js 66.66% <0%> (-33.34%) :arrow_down:
lib/Source.js 15.78% <0%> (-15.79%) :arrow_down:
lib/SourceMapSource.js
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update b9529e9...9aab3a7. Read the comment docs.

codecov[bot] commented 5 years ago

Codecov Report

Merging #51 into master will decrease coverage by 61.66%. The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff             @@
##           master      #51       +/-   ##
===========================================
- Coverage   78.25%   16.58%   -61.67%     
===========================================
  Files          11        8        -3     
  Lines         492      416       -76     
  Branches       76       67        -9     
===========================================
- Hits          385       69      -316     
- Misses        107      347      +240
Impacted Files Coverage Δ
lib/OriginalSource.js 89.47% <100%> (-10.53%) :arrow_down:
lib/ReplaceSource.js 3.6% <0%> (-92.79%) :arrow_down:
lib/ConcatSource.js 9.09% <0%> (-80%) :arrow_down:
lib/PrefixSource.js 15% <0%> (-67.5%) :arrow_down:
lib/RawSource.js 23.52% <0%> (-64.71%) :arrow_down:
lib/CachedSource.js 4.87% <0%> (-41.47%) :arrow_down:
lib/SourceAndMapMixin.js 66.66% <0%> (-33.34%) :arrow_down:
lib/Source.js 15.78% <0%> (-15.79%) :arrow_down:
lib/SourceMapSource.js
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update b9529e9...1b0d706. Read the comment docs.