Skip to content

Commit

Permalink
New: pass outfile to transforms via _flags
Browse files Browse the repository at this point in the history
Adds _flags to the options, which is browserify compatible
  • Loading branch information
forivall authored and mysticatea committed Jun 26, 2018
1 parent 14a8920 commit 692b67b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion bin/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ module.exports = function main(source, outDir, args) {
const createStream = ABS_OR_REL.test(item.name)
? require(resolvePath(item.name))
: require(resolveModule(item.name, { basedir: process.cwd() }))
return file => createStream(file, item.argv)
return (file, opts) =>
createStream(file, Object.assign({ _flags: opts }, item.argv))
})

// Merge commands and transforms as same as order of process.argv.
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/copy-file.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function copyFileContent(source, output, transforms) {
try {
transforms
.reduce((input, factory) => {
const t = factory(source)
const t = factory(source, { outfile: output })
t.on("error", cleanup)
streams.push(t)

Expand Down

0 comments on commit 692b67b

Please sign in to comment.