0.0.2 • Published 5 years ago

broccoli-sucrase v0.0.2

Weekly downloads
1
License
MIT
Repository
-
Last release
5 years ago

broccoli-sucrase

Build Status

Broccoli Plugin for Sucrase (a babel alternative):

Sucrase is an alternative to Babel that allows super-fast development builds. Instead of compiling a large range of JS features to be able to work in Internet Explorer, Sucrase assumes that you're developing with a recent browser or recent Node.js version, so it focuses on compiling non-standard language extensions: JSX, TypeScript, and Flow. Because of this smaller scope, Sucrase can get away with an architecture that is much more performant but less extensible and maintainable. Sucrase's parser is forked from Babel's parser (so Sucrase is indebted to Babel and wouldn't be possible without it) and trims it down to a focused subset of what Babel solves. If it fits your use case, hopefully Sucrase can speed up your development experience!

This module aims to experiment using sucrase in the broccoli and ember-cli ecosystems.

usage

Basic via Brocfile.js or Broccoli pipeline

// Brocfile.js
const sucrase = require('broccoli-sucrase');
module.exports = sucrase(__dirname + '/src', {
  sucrase: { /* any option sucrase.transform supports */ }
}); // where src/**/*.js contains ecmascript

Extension / Subclassing

// Brocfile.js
const sucrase = require('broccoli-sucrase');

module.exports = class CustomSucrase extends sucrase.Plugin {
  // custom behavior
}