factor-bundle
Advanced tools
Comparing version 0.0.2 to 0.1.0
11
index.js
@@ -48,7 +48,12 @@ var Transform = require('stream').Transform; | ||
this._thresholdVal = typeof opts.threshold === "number" ? opts.threshold : 1; | ||
this._thresholdVal = typeof opts.threshold === "number" | ||
? opts.threshold : 1 | ||
; | ||
this._defaultThreshold = function(row, group) { | ||
return group.length > this._thresholdVal; | ||
}; | ||
this._threshold = typeof opts.threshold === "function" ? opts.threshold : this._defaultThreshold | ||
this._threshold = typeof opts.threshold === "function" | ||
? opts.threshold | ||
: this._defaultThreshold | ||
; | ||
} | ||
@@ -90,3 +95,3 @@ | ||
deps.push([self._buffered[file].id, self._buffered[file].deps[dep]]) | ||
}) | ||
}); | ||
}); | ||
@@ -93,0 +98,0 @@ var order = toposort.array(Object.keys(self._buffered), deps); |
{ | ||
"name": "factor-bundle", | ||
"version": "0.0.2", | ||
"version": "0.1.0", | ||
"description": "factor browser-pack bundles into common shared bundles", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -12,4 +12,3 @@ var test = require('tape'); | ||
test('more complicated dependencies', function (t) { | ||
//t.plan(5); | ||
t.plan(2); | ||
t.plan(5); | ||
var files = [ 'x.js', 'y.js' ].map(function (file) { | ||
@@ -20,3 +19,3 @@ return path.join(__dirname, 'files', file); | ||
var expected = { | ||
common: [ read('z.js') ], | ||
common: [ read('z.js'), read('a.js') ], | ||
'x.js': [ | ||
@@ -27,12 +26,14 @@ read('x.js', { | ||
}), | ||
read('w.js') | ||
read('w.js', { | ||
deps: { './a.js': norm('a.js') } | ||
}) | ||
], | ||
'y.js': [ | ||
read('y.js', { | ||
entry: true, | ||
deps: { './z.js': norm('z.js') } | ||
entry: true, | ||
deps: { './z.js': norm('z.js'), './a.js': norm('a.js') } | ||
}) | ||
] | ||
}; | ||
var packs = { | ||
@@ -80,3 +81,3 @@ common: pack({ raw: true }), | ||
bundle.pipe(rowsOf(function (rows) { | ||
//t.deepEqual(rows, expected[name]); | ||
t.deepEqual(rows, expected[name]); | ||
})); | ||
@@ -87,3 +88,3 @@ bundle.pipe(packs[name]); | ||
fr.pipe(rowsOf(function (rows) { | ||
//t.deepEqual(rows, expected.common); | ||
t.deepEqual(rows, expected.common); | ||
})); | ||
@@ -90,0 +91,0 @@ fr.pipe(packs.common); |
Sorry, the diff of this file is not supported yet
22578
558
135