assetstream
Advanced tools
Comparing version 0.1.12 to 0.1.13
{ | ||
"name": "assetstream", | ||
"version": "0.1.12", | ||
"version": "0.1.13", | ||
"description": "Stream and transform your browser assets.", | ||
@@ -19,4 +19,5 @@ "repository": { | ||
"mkdirp": "0.3.x", | ||
"less": "1.4.x" | ||
"less": "1.4.x", | ||
"ferro": "0.2.x" | ||
} | ||
} |
@@ -29,3 +29,3 @@ | ||
if (error) { | ||
self.emit('error', error); | ||
console.error(ferro.stack(error)); | ||
} else if (self._assets) { | ||
@@ -32,0 +32,0 @@ var lastIndex = self._assets.length - 1; |
var Transform = require('stream').Transform; | ||
var util = require('util'); | ||
var ferro = require('ferro'); | ||
@@ -25,6 +26,4 @@ util.inherits(AssetTransform, Transform); | ||
if (error) { | ||
console.error('Transform:', error.stack || error); | ||
self.emit('error', error); | ||
} | ||
if (transformedAsset) { | ||
console.error(ferro.stack(error)); | ||
} else if (transformedAsset) { | ||
self.push(transformedAsset); | ||
@@ -31,0 +30,0 @@ } |
@@ -7,2 +7,3 @@ | ||
var path = require('path'); | ||
var ferro = require('ferro'); | ||
var SourceMapConsumer = require('source-map').SourceMapConsumer; | ||
@@ -126,3 +127,3 @@ var SourceMapGenerator = require('source-map').SourceMapGenerator; | ||
function bundleError(message) { | ||
var error = new Error(message); | ||
var error = ferro('BundleJavaScriptError', message); | ||
if (bundleHasBeenBuilt) { | ||
@@ -277,3 +278,6 @@ bundleCallback(error); | ||
if (!asset.content.minified) { | ||
callback(new Error('Can only bundle minified JavaScript modules.')); | ||
callback(ferro( | ||
'BundleJavaScriptError', | ||
'Can only bundle minified JavaScript modules.' | ||
)); | ||
return; | ||
@@ -280,0 +284,0 @@ } |
@@ -8,2 +8,3 @@ | ||
var isType = require('../../helper/isType'); | ||
var ferro = require('ferro'); | ||
@@ -37,3 +38,9 @@ function minifyJavaScriptAsset(cache, asset, callback) { | ||
if (asset.event === 'update' && isType.javaScript(asset)) { | ||
minifyJavaScriptAsset(cache, asset, callback); | ||
minifyJavaScriptAsset(cache, asset, function(error, minifiedAsset) { | ||
if (error) { | ||
return callback(ferro('MinifyJavaScriptError', error)); | ||
} | ||
callback(null, minifiedAsset); | ||
}); | ||
} else { | ||
@@ -40,0 +47,0 @@ callback(null, asset); |
@@ -125,12 +125,20 @@ | ||
} catch (error) { | ||
if (error instanceof UglifyJS.JS_Parse_Error) { | ||
console.error('ERR: Parse error at ' + asset.path + ':' + error.line + ',' + error.col + ': ' + error.message + '\n' + error.stack); | ||
} else { | ||
console.error('ERR: Parse error at ' + asset.path + ':', error.stack || error); | ||
var message = 'Failed to minify ' + asset.path; | ||
if (error.line) { | ||
message += ':' + error.line; | ||
if (error.col) { | ||
message += ':' + error.col; | ||
} | ||
} | ||
if (error.message) { | ||
message += ': ' + error.message; | ||
} | ||
var reportedError = new Error('Could not minify JS.'); | ||
reportedError.cause = error; | ||
callback(reportedError, asset); | ||
callback({ | ||
message: message, | ||
path: asset.path, | ||
line: error.line, | ||
column: error.col | ||
}, asset); | ||
} | ||
}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
39320
1249
10
+ Addedferro@0.2.x
+ Addedferro@0.2.3(transitive)
+ Addedpackage-lookup@0.1.2(transitive)
+ Addedtinycolor@0.0.1(transitive)