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

Support merging sourcemaps when transformed file is fully replaced #14247

Merged
merged 2 commits into from Feb 8, 2022

Conversation

jridgewell
Copy link
Member

@jridgewell jridgewell commented Feb 7, 2022

Q                       A
Fixed Issues?
Patch: Bug Fix?
Major: Breaking Change?
Minor: New Feature? Yes
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT

A follow-up to #14246. I finally thought of a case where the
sourceFileName's content is fully replaced, leading to only the injected
file existing in the output sourcemap. This can happen where only one
output source is created, or multiple.

In the single output source case, we'd incorrectly associate the
mappings through the inputMap, even though none of the content actually
comes from there.

In the multiple source case, we'd silently fail and output empty mappings.

Both cases are now fixed, with the correct remapping being done through
in all possible output cases now.

A follow-up to babel#14246. I finally thought of a case where the
sourceFileName's content is fully replaced, leading to only the injected
file existing in the output sourcemap. This can happen where only one
output source is created, or multiple.

In the single output source case, we'd incorrectly associate the
mappings through the inputMap, even though none of the content actually
comes from there.

In the multiple source case, we'd silently fail and output empty mappings.

Both cases are now fixed, with the correct remapping being done through
in all possible output cases now.
@babel-bot
Copy link
Collaborator

babel-bot commented Feb 7, 2022

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/51185/

"@ampproject/remapping@npm:^2.0.0":
version: 2.0.2
resolution: "@ampproject/remapping@npm:2.0.2"
"@ampproject/remapping@npm:^2.0.0, @ampproject/remapping@npm:^2.1.0":
Copy link
Member Author

Choose a reason for hiding this comment

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

I don't get yarn, but we need v2.1.0 to ensure the new ctx param is passed to the remapping loader. Will just the change in the package.json be enough?

Copy link
Member

Choose a reason for hiding this comment

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

Yeah it's enough

@JLHwung JLHwung merged commit 76dd491 into babel:main Feb 8, 2022
@jridgewell jridgewell deleted the multisource-output-sourcemap-2 branch February 8, 2022 20:38
@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label May 11, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 11, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants