-
-
Notifications
You must be signed in to change notification settings - Fork 28
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 support for ignoreList property #93
Add support for ignoreList property #93
Conversation
c8fb7d4
to
9db4ff4
Compare
Hi, thank you for the contribution! I'm wondering if it might not be better to use a |
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 😄 |
8c60825
to
4e914e7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are converting to/from Vec<u32>
as it is defined in the JSON types, and the public API.
Which Set implementation you use should not really matter in those cases.
src/types.rs
Outdated
pub fn new( | ||
file: Option<Arc<str>>, | ||
mut tokens: Vec<RawToken>, | ||
names: Vec<Arc<str>>, | ||
sources: Vec<Arc<str>>, | ||
sources_content: Option<Vec<Option<Arc<str>>>>, | ||
ignore_list: Option<Vec<u32>>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a breaking change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good point. This could be avoided by removing this parameter and using add_to_ignore_list
in SourceMapBuilder::into_sourcemap
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we add a corresponding add_to_ignore_list
(or set_ignore_list
) in the builder?
4e914e7
to
93d524e
Compare
Sourcemaps can now specify an `ignoreList`, 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.
93d524e
to
d3c1b28
Compare
src/types.rs
Outdated
pub fn new( | ||
file: Option<Arc<str>>, | ||
mut tokens: Vec<RawToken>, | ||
names: Vec<Arc<str>>, | ||
sources: Vec<Arc<str>>, | ||
sources_content: Option<Vec<Option<Arc<str>>>>, | ||
ignore_list: Option<Vec<u32>>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good point. This could be avoided by removing this parameter and using add_to_ignore_list
in SourceMapBuilder::into_sourcemap
.
Co-authored-by: Sebastian Zivota <[email protected]>
bcb7141
to
5ddd8f1
Compare
5ddd8f1
to
fb686c7
Compare
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