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

metro-minify-terser: Don't mutate input options #929

Closed
wants to merge 1 commit into from

Conversation

robhogan
Copy link
Contributor

Summary:
Mitigates terser/terser#1341

Terser sets properties inlcuding source_map and _destroy_ast on the given options.output (or options.format) object, which can affect subsequent calls where we re-use the same config object.

Here we take a shallow copy of the given configuration, so terser doesn't mutate metro-minify-terser's input.

Changelog: [Fix] Mitigate potential source map mismatches with concurrent transformations (Terser #1341)

Reviewed By: jacdebug, motiz88

Differential Revision: D43362977

Summary:
Mitigates terser/terser#1341

Terser sets properties inlcuding `source_map` and `_destroy_ast` on the given `options.output` (or `options.format`) object, which can affect subsequent calls where we re-use the same config object.

Here we take a shallow copy of the given configuration, so `terser` doesn't mutate `metro-minify-terser`'s input.

Changelog: [Fix] Mitigate potential source map mismatches with concurrent transformations (Terser [facebook#1341](terser/terser#1341))

Reviewed By: jacdebug, motiz88

Differential Revision: D43362977

fbshipit-source-id: 019f417aa8cc7897c71a6ab2c7db5d0cf916e59d
@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported labels Feb 17, 2023
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D43362977

@robhogan
Copy link
Contributor Author

Merged in 5e27b3b

@robhogan robhogan closed this Feb 20, 2023
@robhogan robhogan deleted the export-D43362977 branch February 20, 2023 15:24
This was referenced Mar 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants