Closed wbinnssmith closed 3 weeks ago
cc @bgw @sokra
Hi, thank you for the contribution! I'm wondering if it might not be better to use a BTreeSet
for the ignored indices to make serialization order deterministic.
Yeah, I think this is a good call. We use https://github.com/indexmap-rs/indexmap in Turbopack for this, but I was hesitant to add another dependency and the sourcemap spec doesn't seem to prefer any specific order, but implementations may.
A BTree wouldn't have constant time insertion, and we can end up doing a lot of redundant insertions during a sectioned map flatten with the code as it stands, but this may be negligible.
I'll make the change 😄
Sourcemaps can now specify an
ignoreList
[0], a list of indexes into sources for which those sources should be shown as ignored in dev tools, for example as collapsed stack frames in program stacks.This adds the list to the SourceMap structure but only includes it in serialized output when it’s non-zero. Open to feedback.
Added a test to exercise this through flattening indexed source maps into a regular map with updated source positions.
[0] https://tc39.es/source-map/#source-map-format