At @rollupjs@m.webtoo.ls, we just released an amazing tree-shaking update, which is also probably the most ambitious first-time contribution we had so far. in https://github.com/rollup/rollup/pull/5443, user https://github.com/liuly0322 implemented call tracking for functions that are only called once or only with the same literal values or variables to improve tree-shaking within those functions. Take this example: https://rollupjs.org/repl/?version=4.16.0&shareable=JTdCJTIyZXhhbXBsZSUyMiUzQW51bGwlMkMlMjJtb2R1bGVzJTIyJTNBJTVCJTdCJTIyY29kZSUyMiUzQSUyMmNvbnN0JTIwY29uZmlnJTIwJTNEJTIwJTdCJTIwZGVidWdNb2RlJTNBJTIwZmFsc2UlMjAlN0QlM0IlNUNuJTVDbmZ1bmN0aW9uJTIwcGVyZm9ybUNhbGN1bGF0aW9uKGlucHV0JTJDJTIwY29uZmlnKSUyMCU3QiU1Q24lMjAlMjAlMkYlMkYlMjBUaGlzJTIwd2lsbCUyMGJlJTIwb3B0aW1pemVkJTIwYXdheSU1Q24lMjAlMjBpZiUyMChjb25maWcuZGVidWdNb2RlKSUyMCU3QiU1Q24lMjAlMjAlMjAlMjBjb25zb2xlLmxvZygnSU5QVVQnJTJDJTIwaW5wdXQpJTNCJTVDbiUyMCUyMCU3RCU1Q24lMjAlMjByZXR1cm4lMjAyJTIwKiUyMGlucHV0JTNCJTVDbiU3RCU1Q24lNUNuJTJGJTJGJTIwV2UlMjBjYW4lMjBjYWxsJTIwdGhlJTIwZnVuY3Rpb24lMjBhcyUyMG1hbnklMjB0aW1lcyUyMGFzJTIwd2UlMjB3YW50JTIwYXMlMjBsb25nJTVDbiUyRiUyRiUyMGFzJTIwd2UlMjB1c2UlMjB0aGUlMjB2YXJpYWJsZSUyMCU1QyUyMmNvbmZpZyU1QyUyMiUyMGFuZCUyMGl0JTIwZ2V0cyUyMG9wdGltaXplZC4lNUNuJTJGJTJGJTIwQWxzbyUyMG5vdGUlMjBob3clMjB0aGUlMjBzZWNvbmQlMjBwYXJhbWV0ZXIlMjBhbmQlMjB0aGUlMjBjb25maWclMjBvYmplY3QlNUNuJTJGJTJGJTIwaXMlMjBvcHRpbWl6ZWQlMjBhd2F5ISU1Q25jb25zb2xlLmxvZyhwZXJmb3JtQ2FsY3VsYXRpb24oMSUyQyUyMGNvbmZpZykpJTNCJTVDbmNvbnNvbGUubG9nKHBlcmZvcm1DYWxjdWxhdGlvbigyJTJDJTIwY29uZmlnKSklM0IlMjIlMkMlMjJpc0VudHJ5JTIyJTNBdHJ1ZSUyQyUyMm5hbWUlMjIlM0ElMjJtYWluLmpzJTIyJTdEJTVEJTJDJTIyb3B0aW9ucyUyMiUzQSU3QiUyMm91dHB1dCUyMiUzQSU3QiUyMmZvcm1hdCUyMiUzQSUyMmVzJTIyJTdEJTJDJTIydHJlZXNoYWtlJTIyJTNBdHJ1ZSU3RCU3RA==
Lukas Taegert-Atkinson
PhD in Mathematics, software engineer at TNG, JavaScript enthusiast and maintainer of RollupJS.
If you ever have the need for high performance JavaScript Set comparisons, merges and intersections: BigInt has you covered! Provided you can assign an index to all possible Set elements. Then:
- Add element 15 to set A: `A |= 1n << 15n`
- Remove element 3: `A &= ~(1n << 3n)`
- Intersect two sets: `C = A & B`
- Merge two sets: `C = A | B`
- Compare two sets: `A === B`
Many thanks to whoever decided BigInt should support bitwise operations!
This now fixes Rollup chunking performance for large projects: https://github.com/rollup/rollup/pull/4862
We are nearly ready at Rollup to release object property tree-shaking! But we need beta testers! Please try out
rollup@4.25.0-0
And let us know:
- Does it introduce any bug in the code?
- Does it bundle much slower for you?
What to expect:
- Properly tracked destructuring with removal of unused or un-needed properties
https://rollupjs.org/repl/?version=4.25.0-0&shareable=JTdCJTIyZXhhbXBsZSUyMiUzQW51bGwlMkMlMjJtb2R1bGVzJTIyJTNBJTVCJTdCJTIyY29kZSUyMiUzQSUyMiUyRiUyRiUyMERlc3RydWN0dXJpbmclMjBjYW4lMjBub3clMjB0cmFjayUyMHZhbHVlcyUyMGFuZCUyMHJlbW92ZSUyMHVudXNlZCUyMHByb3BlcnRpZXMlNUNuY29uc3QlMjAlN0Il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iUzQW51bGwlMkMlMjJtb2R1bGVzJTIyJTNBJTVCJTdCJTIyY29kZSUyMiUzQSUyMiUyRiUyRiUyME9ubHklMjBpbmNsdWRlJTIwbmVlZGVkJTIwcHJvcHMlMjBpbiUyMGZ1bmN0aW9uJTIwYXJndW1lbnRzJTIwdmlhJTIwZGVzdHJ1Y3R1cmluZyUyMG9yJTIwcHJvcGVydHklMjBhY2Nlc3MlNUNuZnVuY3Rpb24lMjBvbmx5VXNlT25lUHJvcCglN0JiJTNBJTIwJTdCZCU3RCU3RCklMjAlN0IlNUNuJTIwJTIwY29uc29sZS5sb2coZC5lKSU1Q24lN0QlNUNuJTVDbm9ubHlVc2VPbmVQcm9wKCU3QiU1Q24lMjAlMjBhJTNBJTIwJ3VudXNlZCclMkMlNUNuJTIwJTIwYiUzQSUyMCU3QiU1Q24lMjAlMjAlMjAlMjBjJTNBJTIwJ3VudXNlZCclMkMlNUNuJTIwJTIwJTIwJTIwZCUzQSUyMCU3QiU1Q24lMjAlMjAlMjAlMjAlMjAlMjBlJTNBJTIwdHJ1ZSUyQyUyMGYlM0ElMjAndW51c2VkJyU1Q24lMjAlMjAlMjAlMjAlN0QlNUNuJTIwJTIwJTdEJTVDbiU3RCklM0IlMjIlMkMlMjJpc0VudHJ5JTIyJTNBdHJ1ZSUyQyUyMm5hbWUlMjIlM0ElMjJtYWluLmpzJTIyJTdEJTVEJTJDJTIyb3B0aW9ucyUyMiUzQSU3QiU3RCU3RA==
Have fun!
Now it has come to this: @vite@m.webtoo.ls is sponsoring @rollupjs@m.webtoo.ls. Which I find particularly amazing considering the efforts on Rolldown. Thank you so much!
https://opencollective.com/rollup 🎉😊
More amazing things coming from the Vite community, this time from the one-and-only @antfu@m.webtoo.ls: Named export tree-shaking for dynamic imports when using destructuring and similar patterns https://github.com/rollup/rollup/pull/4952
And only a few days after the Webpack feature was released. Admittedly, we should have done that ages ago, but alas, there was always one other thing to do...
Amazing work ❤️
🎉 Finally, Rollup now has a Logging API! And if your plugins use `this.warn()`, they will already be using it. But there is more:
- Want helpful debug logs in your plugin that cause virtually no overhead that users can enable on-demand? Use `this.debug()`. If your log needs expensive pre-processing, passing a function allows you to do this only if the log is processed.
- Print helpful status information that is visible by default? Use `this.info()`. Users can hide this via the `logLevel` option.
- Your plugin creates circular dependencies or causes other warnings that can be ignored? Hide the warnings in an `onLog` plugin hook.
- Want a plugin that elevates some warnings to errors? Again, the `onLog` hook can do that.
- As an end user, use the `onLog` option to filter and control logs. This is like `onwarn` but includes all log levels.
More information:
PR: https://github.com/rollup/rollup/pull/5026
https://rollupjs.org/configuration-options/#onlog
https://rollupjs.org/configuration-options/#loglevel
https://rollupjs.org/plugin-development/#this-warn
https://rollupjs.org/plugin-development/#onlog
I am currently working on an easy and powerful way to filter logs from the CLI, so there is more coming!
I have been talking very little about what I was working on. Today is the day, and we will release Rollup 4. Tune in to ViteConf now to learn what it will be all about: https://viteconf.org/23/live/lukastaegert
See you in @ViteConf 2023! The Rollup community will not miss it! https://viteconf.org/23/tickets/lukastaegert?t=Rollup
Nearly forgot to update the migration guide for Rollup 4. Here you go: https://rollupjs.org/migration/
You may or may not have noticed but for a few days, @rollupjs@m.webtoo.ls now has full Chinese docs. And there is A LOT OF docs! Huge thanks to https://github.com/ShenQingchuan, who approached us, assembled a team and made the impossible possible in just a few days.
We are deeply humbled and grateful! Enjoy here: https://cn.rollupjs.org
I think this is possible only thanks to the amazing Vite community ❤️
@marvinh Now to allow modifications, that would be the holy grail. Then for most plugins, this could become a valid replacement for magic-string. For the long term, we might even think about a new plugin hook transformAst that runs after transform, directly receives the AST as input and is only allowed to read and modify it while Rollup would then consume the modified AST directly without another parse. We would need to generate proper sourcemaps for the transforms, though, which will be a lot of work. And a bigger open question to me: What is the API to insert/replace Nodes? Do users supply code snippets or AST nodes? Can they add sourcemaps for inserted code that was taken from another file? How is it turned to binary?