Package Exports
- decorator-transforms
- decorator-transforms/globals
- decorator-transforms/runtime
Readme
decorator-transforms
Better babel transforms for decorators.
Why?
A transform like @babel/plugin-proposal-decorators is still often necessary because it took Decorators a long time to move through the TC39 standardization process. But we can implement the same functionality in a much simpler way now that we can rely on the presence of features like class static block, private fields, and WeakMap.
Status
This is new and incomplete. I have implemented class fields and class methods.
Trying this in an Ember App
Install the
decorator-transformspackage (you're going to use ember-auto-import to get its runtime helpers, so it needs to be listed in your package.json).In
ember-cli-build.js:new EmberApp(defaults, { 'ember-cli-babel': { // turn off the old transform disableDecoratorTransforms: true, }, babel: { plugins: [ // add the new transform require.resolve('decorator-transforms'), ], }, )
At the beginning of
app.js, install the runtime helpers:import "decorator-transforms/globals";