From eff6ccec36944a71f0fcf3ee306a86e69e78b429 Mon Sep 17 00:00:00 2001 From: Joey Baker Date: Tue, 26 May 2015 19:12:31 -0700 Subject: [PATCH 1/2] fix: directly require factor-bundle fixes #61 --- index.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 81d2c17..6c54b53 100644 --- a/index.js +++ b/index.js @@ -20,10 +20,9 @@ var browserify = require('browserify') , _ = require('lodash') , minifyify = require('minifyify') , resrcify = require('resrcify') + , factorBundle = require('factor-bundle') , ctor -require('factor-bundle') - ctor = module.exports = function atomifyJs (opts, cb) { var outputPath , outputDir @@ -221,7 +220,7 @@ ctor = module.exports = function atomifyJs (opts, cb) { }) // setup factor bundle, pass in our streamable-buffers as the output source - b.plugin('factor-bundle', { + b.plugin(factorBundle, { o: _.values(outputs) }) From a82f1fb3c0714cfc3652657c7dfada474350182a Mon Sep 17 00:00:00 2001 From: eggyal Date: Thu, 28 May 2015 21:14:12 +0100 Subject: [PATCH 2/2] Fixes atomify/atomify-js#62 Fixes --- index.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/index.js b/index.js index 6c54b53..ac9a7eb 100644 --- a/index.js +++ b/index.js @@ -34,7 +34,6 @@ ctor = module.exports = function atomifyJs (opts, cb) { , assets , outputs , b - , w if (Array.isArray(opts)) opts = {entries: opts} if (typeof opts === 'string') opts = {entries: [opts]} @@ -104,20 +103,20 @@ ctor = module.exports = function atomifyJs (opts, cb) { emitter.emit('browserify', b) if (opts.watch) { - w = watchify(b) - emitter.emit('watchify', w) + b = watchify(b) + emitter.emit('watchify', b) } if (opts.watch) { - w.on('update', function onUpdate (ids) { + b.on('update', function onUpdate (ids) { ids.forEach(function eachId (id) { emitter.emit('changed', id) }) - w.bundle(cb) + rebundle() }) - w.on('time', function onTime (time) { + b.on('time', function onTime (time) { emitter.emit('bundle', time) }) } @@ -199,6 +198,9 @@ ctor = module.exports = function atomifyJs (opts, cb) { b.external(opts.external) } + return rebundle() + + function rebundle() { // if we've got the common option, we want to use factor bundle if (opts.common === true){ if (opts.entries.length < 2) { @@ -250,6 +252,7 @@ ctor = module.exports = function atomifyJs (opts, cb) { } // if we don't need to use factor bundle, just browserify! else return b.bundle(cb) + } } ctor.emitter = emitter