In older versions of Fly, custom plugins were able to accept/handle more than a single opts object.
While restricting plugin authors to opts only is great for uniformity, it's sometimes more trouble than it's worth, based on the underlying/wrapped API.
So, a single opts object should be strongly recommended for ease-of-use & approachability, but Fly should (continue to) pass extra values when absolutely necessary.
// current
this.plugin('name', {}, function * (file, opts) {
console.log('everything is in "opts"');
});
// flyfile
yield this.source('*').name({hello: 'world'}).target('dist');
// proposed
this.plugin('name', {}, function * (file, str, opts) {
console.log('this is my greeting: ', str);
console.log('this is my audience: ', opts.who);
});
// flyfile
yield this.source('*').name('hello', {who: 'world'}).target('dist');
In older versions of Fly, custom plugins were able to accept/handle more than a single
opts
object.While restricting plugin authors to
opts
only is great for uniformity, it's sometimes more trouble than it's worth, based on the underlying/wrapped API.So, a single
opts
object should be strongly recommended for ease-of-use & approachability, but Fly should (continue to) pass extra values when absolutely necessary.