Comparing version 0.12.3 to 0.12.4
@@ -127,40 +127,48 @@ var inherits = require( 'inherits' ); | ||
var bundle = through2(); | ||
var tempBundlePath = path.join( path.dirname( dstPath ), '.temp_' + path.basename( dstPath ) ); | ||
async.series( [ function( nextSeries ) { | ||
var srcAssets = _this.parcelAssetsByType[ assetType ]; | ||
if( srcAssets.length === 0 ) return callback(); // we don't want to create an empty bundle just because we have no source files | ||
bundle.pipe( fs.createWriteStream( tempBundlePath ) ).on( 'close', function ( err ) { | ||
// execution resumes here after all the individual asset streams | ||
// have been piped to this bundle. we need to pipe the bundle to the writable | ||
// stream first (before individual assets are piped to bundle stream) | ||
// so that if the high water mark is reached on one of the readable streams | ||
// it doesn't pause (with no way to resume). See github issue #15. | ||
if( err ) return callback( err ); | ||
// pipe all our individual style streams to the bundle in order to concatenate them | ||
async.eachSeries( srcAssets, function( thisAsset, nextAsset ) { | ||
var thisAssetStream = thisAsset.createReadStream(); | ||
fs.rename( tempBundlePath, dstPath, function( err ) { | ||
if( err ) return callback( err ); | ||
thisAssetStream.on( 'error', function( err ) { | ||
nextAsset( new Error( 'While reading or transforming "' + thisAsset.srcPath + '":\n' + err.message ) ); | ||
} ); | ||
//_this.bundlePathsByType[ assetType ] = dstPath; // don't do this. isn't really a property of the parcel so much as an input to parcelify | ||
thisAssetStream.on( 'end', nextAsset ); | ||
thisAssetStream.pipe( bundle, { end : false } ); | ||
}, function( err ) { | ||
if( err ) return nextSeries( err ); | ||
bundle.end(); | ||
nextSeries(); | ||
callback( null ); | ||
} ); | ||
}, function( nextSeries ) { | ||
var tempBundlePath = path.join( path.dirname( dstPath ), '.temp_' + path.basename( dstPath ) ); | ||
} ); | ||
bundle.pipe( fs.createWriteStream( tempBundlePath ) ).on( 'close', function ( err ) { | ||
if( err ) return nextSeries( err ); | ||
var srcAssets = _this.parcelAssetsByType[ assetType ]; | ||
if( srcAssets.length === 0 ) return callback(); // we don't want to create an empty bundle just because we have no source files | ||
fs.rename( tempBundlePath, dstPath, function( err ) { | ||
if( err ) return nextSeries( err ); | ||
// pipe all our individual style streams to the bundle in order to concatenate them | ||
async.eachSeries( srcAssets, function( thisAsset, nextAsset ) { | ||
var thisAssetStream = thisAsset.createReadStream(); | ||
//_this.bundlePathsByType[ assetType ] = dstPath; // don't do this. isn't really a property of the parcel so much as an input to parcelify | ||
thisAssetStream.on( 'error', function( err ) { | ||
nextAsset( new Error( 'While reading or transforming "' + thisAsset.srcPath + '":\n' + err.message ) ); | ||
} ); | ||
nextSeries( null ); | ||
} ); | ||
thisAssetStream.on( 'end', function( err ) { | ||
nextAsset(); | ||
} ); | ||
} ], callback ); | ||
thisAssetStream.pipe( bundle, { end : false } ); | ||
}, function( err ) { | ||
if( err ) return nextSeries( err ); | ||
bundle.end(); | ||
// execution will resume up above on the | ||
// `close` event handler for our bundle | ||
} ); | ||
} | ||
}; | ||
{ | ||
"name": "parcelify", | ||
"version": "0.12.3", | ||
"version": "0.12.4", | ||
"description": "Create css bundles from npm packages using the browserify dependency graph.", | ||
@@ -11,3 +11,3 @@ "main": "index.js", | ||
"mkdirp": "~0.3.5", | ||
"through2": "~0.4.1", | ||
"through2": "~0.6.3", | ||
"parcel-map": "~1.3.1", | ||
@@ -14,0 +14,0 @@ "shasum": "~1.0.0", |
60058
895
+ Addedthrough2@0.6.5(transitive)
+ Addedxtend@4.0.2(transitive)
Updatedthrough2@~0.6.3