module-deps
module-deps copied to clipboard
Are module-deps options passed as parameter to the transforms?
The documentation is unclear about this point:
If the transform is a function, it should take the file name as an argument
Then, the example shows a second parameters named opts:
var through = require('through2');
module.exports = function (file, opts) { return through() };
What is this second parameter? Is it the options passed to module-deps constructor?
It's the row.options property on on the input object: https://github.com/browserify/module-deps#input-objects
Typically browserify passes it in from its .transform() method, which more or less does:
function transform(transformPathOrFn, transformOptions) {
mdeps.write({ transform: transformPathOrFn, options: transformOptions })
}
e; And if you pass in an opts.transform option to the module-deps constructor, you can set options like:
moduleDeps({
transform: [
['transformPath', { options: 'here' }]
]
})
agree that docs could be clearer about this!