Releases: broccolijs/broccoli
v3.5.2
v3.5.0
Input node change tracking
Node version change, Rebuild memoization, and Watcher changes
- Add rebuild memoization support behind feature flag (#396)
- BROCCOLI_ENABLED_MEMOIZE=true to turn on
- Add more watcher events (#398)
- Drop support for unsupported Node versions (#400)
- Drop Node 6 support.
- Bump broccoli-node-info to v2.0.0
- Pass watchedNodes to Watcher/WatcherAdapter (#403)
- Require watchedNodes arguments to Watcher/WatcherAdapter (#405)
TypeScript support
The future is here, today!
Broccoli now supports a Brocfile.ts, and will auto compile this through ts-node 🎉
By default, ts-node uses TypeScript defaults for the compiler options. If you wish to add your own compiler options to make things stricter, you can add a tsconfig.json of your own and Broccoli should auto pick this up.
So now:
import merge = require('broccoli-merge-trees');
import uglify = require('broccoli-uglify-sourcemap');
import { BrocfileOptions } from 'broccoli';
export default (options: BrocfileOptions) => {
let js = 'src/a';
if (options.env === 'production') {
js = uglify(js);
}
return merge([js, 'src/b']);
}
Should work, and your editor should get access to the types it can find.
Over time, we will push for plugin developers to define at least a type definition, and provide documentation for how to convert a plugin to TypeScript
Thanks to everyone who helped in reviewing this.
ES Modules, Export function & Environment support
This release adds support for several new features.
ES Modules syntax
PR: #385
ES modules syntax is now supported in Broccoli using the esm npm package. You're now free to use this syntax for your Brocfile.js https://github.com/broccolijs/broccoli#using-plugins-in-a-brocfilejs
Welcome to the future!
import merge from 'broccoli-merge-trees';
export default merge(['a', 'b']);
Export function
PR: #386
Broccoli now supports exporting a function from the Brocfile.js, in the same way that Ember-CLI does https://github.com/broccolijs/broccoli#brocfilejs which paves the way for future enhancements to supply build parameters to the pipeline
import merge from 'broccoli-merge-trees';
export default () => {
return merge(['a', 'b']);
}
Environment
PR: #387
Broccoli now supports --environment,-e,--prod,--dev
CLI arguments similar to Ember-CLI. The environment flag is passed to the Brocfile in the options hash { env: ENVIRONMENT }
and defaults to development
.
Similar to the legacy BROCCOLI_CLI
environment variable, this allows a build pipeline to be altered based on the destined environment, for example by minifying files for production.
import merge from 'broccoli-merge-trees';
import uglify from 'broccoli-uglify-js';
export default (options) => {
let tree = merge(['a', 'b']);
if (options.environment === 'production') {
tree = uglify(tree);
}
return tree;
}