Skip to content

Update to latest magic-string

username-removed-383729 requested to merge update-magic-string into master

Last weekend I rewrote magic-string to be a lot faster. Doing so meant changing how it works: instead of allowing new content (such as the function before an arrow function expression) to be inserted at arbitrary points, content must be 'attached' to the chunk immediately before or after the insertion point.

This sounds more restrictive but it's actually a good deal more robust (since any code that gets moved is guaranteed to bring its attached inserts along with it), as well as allowing the drastic performance improvements.

Anyway, it was a breaking change, replacing the old code.insert(...) method with code.insertLeft(...) and code.insertRight(...). This PR updates things accordingly. No breakage in the test suite, but can't absolutely guarantee that it behaves the same with all code, so it should probably be a 0.8 release.

Marked as WIP because there's probably a little bit of tidying up to do.

Merge request reports