documentify
Advanced tools
Comparing version 3.2.0 to 3.2.1
13
index.js
@@ -72,3 +72,3 @@ var parallel = require('async-collection').parallel | ||
if (!opts.order) opts = Object.assign({}, opts, { order: 'main' }) | ||
var internalOpts = { order: opts.order || 'main' } | ||
@@ -78,3 +78,3 @@ if (typeof transform === 'string') { | ||
var basedir = opts.basedir || this.basedir | ||
this.transforms.push([ placeholder, opts ]) | ||
this.transforms.push([ placeholder, opts, internalOpts ]) | ||
this._ready = false | ||
@@ -94,3 +94,3 @@ resolve(transform, { basedir: basedir }, function (err, resolved) { | ||
} else { | ||
this.transforms.push([ transform, opts ]) | ||
this.transforms.push([ transform, opts, internalOpts ]) | ||
} | ||
@@ -111,3 +111,4 @@ | ||
var opts = tuple[1] | ||
var label = opts && opts.order | ||
var internalOpts = tuple[2] | ||
var label = internalOpts.order | ||
var transform = fn(opts) | ||
@@ -182,3 +183,3 @@ pipeline.get(label).push(transform) | ||
// Run package.json transforms first by default. | ||
if (!opts.order) opts.order = 'start' | ||
var internalOpts = { order: opts.order || 'start' } | ||
@@ -188,3 +189,3 @@ return function (done) { | ||
if (err) return done(err) | ||
done(null, [ require(resolved), opts ]) | ||
done(null, [ require(resolved), opts, internalOpts ]) | ||
}) | ||
@@ -191,0 +192,0 @@ } |
@@ -5,3 +5,3 @@ { | ||
"repository": "stackhtml/documentify", | ||
"version": "3.2.0", | ||
"version": "3.2.1", | ||
"bin": "./bin.js", | ||
@@ -8,0 +8,0 @@ "scripts": { |
@@ -55,2 +55,14 @@ var test = require('tape') | ||
}) | ||
t.test('should accept primitives as option value', function (t) { | ||
t.plan(1) | ||
documentify(testPath) | ||
.transform(function (opt) { return append(opt) }, 'whatever') | ||
.bundle() | ||
.pipe(concat({ encoding: 'string' }, function (result) { | ||
var lines = result.split(/\n/g) | ||
t.equal(lines[lines.length - 1], 'whatever') | ||
})) | ||
}) | ||
}) | ||
@@ -57,0 +69,0 @@ |
19603
498