This addresses #8 by adding proper support for the only and ignore configuration options. In some cases, transpilation can be undesired:
most of our dependencies don't publish as ES6, so time spent building those is unnecessary
some dependencies can throw errors because of the addition of "use strict"; where it was not previously expected
some dependencies (lodash, react, etc) can be very large, sometimes to the point where babel refuses to transpile them (plus they don't even need to be)
Anyways, the point is the ability to be more deliberate about what should and should not be transpiled is quite useful. (this does away with the onlyLocals option, as this syntax is far more flexible)
var babel = require('duo-babel');
// default behavior, transpile all the things
duo.use(babel());
// only process locals (identical to the old onlyLocals config)
duo.use(babel({
only: [ 'locals' ]
}));
// whitelist locals and certain remotes
duo.use(babel({
only: [ 'locals', 'components/segmentio-*/**.js' ]
}));
// blacklist certain locals and remotes
duo.use(babel({
ignore: [ 'lib/react.js', 'components/lodash*/**.js' ]
}));
Notice, we are taking advantage of the directory structure that duo creates, as babel already has a pretty robust system internally. We only added some sugar here for our special cases. (ie: "locals" and "remotes")
This addresses #8 by adding proper support for the
only
andignore
configuration options. In some cases, transpilation can be undesired:"use strict";
where it was not previously expectedAnyways, the point is the ability to be more deliberate about what should and should not be transpiled is quite useful. (this does away with the
onlyLocals
option, as this syntax is far more flexible)Notice, we are taking advantage of the directory structure that duo creates, as babel already has a pretty robust system internally. We only added some sugar here for our special cases. (ie: "locals" and "remotes")