Skip to content

feat: Add debug_id field to SourceMapIndex #117

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

Merged
merged 1 commit into from
Apr 24, 2025

Conversation

szokeasaurusrex
Copy link
Member

Also, add support for encoding and decoding the new debug_id field, and add tests.

In order to be able to more thoroughly test encoding/decoding, this code adds PartialEq and Debug implementations to some structs which were lacking it previously.

Closes #113

Also, add support for encoding and decoding the new `debug_id` field, and add tests.

In order to be able to more thoroughly test encoding/decoding, this code adds `PartialEq` and `Debug` implementations to some structs which were lacking it previously.

Closes #113
@@ -214,7 +214,8 @@ impl Encodable for SourceMapIndex {
x_metro_module_paths: None,
x_facebook_sources: None,
debug_id: None,
_debug_id_new: None,
// Put the debug ID on _debug_id_new to serialize it to the debugId field.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This behavior differs from the other cases—we don't write the _debug_id_new/debugId field anywhere, it's only used for reading. I would suggest doing the same here and switching to the new field in a separate PR.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean I should switch everything over to writing to the debugId field in the separate PR?

The reason I am reluctant to do that is because it would likely require a new major release of the crate (and then also in the CLI), since we would break anyone who relies on SourceMap objects being written to the debug_id field. On the other hand, since we are only just now adding the ability to write a debug ID field for SourceMapIndex, it is not a breaking change to write to debugId/_debug_id_new.

It would, however, in my opinion be beneficial to use the debugId field already here, since that is what we want to move towards, anyways

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, that makes sense.

@szokeasaurusrex szokeasaurusrex merged commit 3f32cae into master Apr 24, 2025
10 checks passed
@szokeasaurusrex szokeasaurusrex deleted the szokeasaurusrex/debug-id-sourcemap-index branch April 24, 2025 09:19
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.

Add debug_id field to indexed sourcemaps
2 participants