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

feat: new reset method (#218) #271

Merged
merged 4 commits into from Feb 5, 2024
Merged

feat: new reset method (#218) #271

merged 4 commits into from Feb 5, 2024

Conversation

KermanX
Copy link
Contributor

@KermanX KermanX commented Feb 3, 2024

New methods

The MagicString.reset method resets chars in the specified range to its original version.

The Chunk.resetToOriginal method resets the chunk to its original version. (empty intro and outro, and set edited to false)

Usage

  1. Restore previously removed range ([Feature request] Add method to restore previously removed range #218)
  2. Discard unwanted changes

I don't know much about sourcemap, so I'm not 100% sure that the sourcemap produced by this method is correct.

@antfu antfu changed the title feat: new restore method (#218) feat: new reset method (#218) Feb 4, 2024
Copy link
Collaborator

@antfu antfu left a comment

Choose a reason for hiding this comment

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

Seems like a good feature to me 👍

@antfu antfu merged commit 3dc21e2 into Rich-Harris:master Feb 5, 2024
12 checks passed
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.

None yet

2 participants