Skip to content

v2.0.0

Compare
Choose a tag to compare
@wessberg wessberg released this 17 Nov 00:00
· 96 commits to master since this release

Breaking Changes

Babel packages are now optional peer dependencies

Ever since rollup-plugin-ts was initially released, it has declared hard dependencies on several babel packages such as @babel/core, @babel/runtime, @babel/preset-env, and @babel/plugin-transform-runtime. This is useful when configuring the plugin to use Babel as the transpiler. However, it also meant that a ton of Babel-related packages was installed for everyone who wanted to use rollup-plugin-ts, but not necessarily Babel, at least not on every project. It also took away control from library consumers in terms of deciding which specific versions of Babel and its related packages to depend on. And, it also meant that if the plugin should support additional transpilers in the future, the related packages to those would most likely also have to be declared as hard dependencies, to align with the behavior with Babel.

With v2.0.0, all Babel dependencies are now optional peer dependencies. That means that if you use the transpiler: "babel" option with rollup-plugin-ts, you'll have to make sure that @babel/core, @babel/runtime, @babel/plugin-transform-runtime, and @babel/preset-env are declared as dependencies within your package.json file. If you don't, you'll get an error describing exactly which packages are missing such that you can easily include these in your package.json file.

New Features

Support for using swc as a transpiler

It was always the intention that rollup-plugin-ts could be extended to support more transpilers than just typescript and babel. Now that we support optional peer dependencies, it was finally possible to bring swc support to the plugin.

Swc is a much faster alternative to Babel, built in Rust, that attempts to be as close to a drop-in replacement for Babel as possible. It is not nearly as mature and doesn't have as big a plugin ecosystem yet, but can often be much faster than Babel. And like Babel, it also has first-class support for Browserslists which will be used to decide which syntax transformations to apply depending on language support in the target environments.

Full Changelog

  • docs: improve README 80b7d1c
  • docs: fix incorrect formatting in README ee9ab26
  • docs: Document interoperability with swc in README 68474f4
  • fix: when emiting declarations, always use define for class fields to work around limitations introduced in TypeScript 4.3 for when bundling declarations when a subclass overrides a property from the parent class but doesn't provide an initializer b25a494
  • fix: add support for shimming regenerator-runtime when using swc as a transpiler 1513fc5
  • feat: add support for swc as a transpiler as an alternative to babel. #155 e84d21c
  • feat: no longer depend on @babel/core types in npm package d91ec74
  • BREAKING CHANGE: Move babel related dependencies to peer dependencies and make them optional cfe3913
  • fix: ensure that the drive letter is prefixed to absolute paths on Windows when getSourceFile is called internally from TypeScript f368af3
  • test: make more tests run in serial 12a3e15

v1.4.7...v2.0.0