Comparing version 2.2.0 to 2.3.0
27
index.js
@@ -8,2 +8,3 @@ var convert = require('convert-source-map') | ||
module.exports = uglifyify | ||
function uglifyify(file, opts) { | ||
@@ -37,19 +38,21 @@ opts = opts || {} | ||
var sourceMaps = buffer.match( | ||
/\/\/[#@] sourceMappingURL=data:application\/json;base64,([a-zA-Z0-9+\/]+)={0,2}$/ | ||
/\/\/[#@] ?sourceMappingURL=data:application\/json;base64,([a-zA-Z0-9+\/]+)={0,2}$/ | ||
) | ||
if (sourceMaps) { | ||
opts.outSourceMap = 'out.js.map' | ||
opts.inSourceMap = convert.fromJSON( | ||
new Buffer(sourceMaps[1], 'base64').toString() | ||
).sourcemap | ||
} | ||
opts.outSourceMap = 'out.js.map' | ||
opts.inSourceMap = sourceMaps && convert.fromJSON( | ||
new Buffer(sourceMaps[1], 'base64').toString() | ||
).sourcemap | ||
buffer = ujs.minify(buffer, opts) | ||
this.queue(buffer.code) | ||
var min = ujs.minify(buffer, opts) | ||
this.queue(min.code) | ||
if (sourceMaps) { | ||
var map = convert.fromJSON(buffer.map) | ||
if (min.map) { | ||
var map = convert.fromJSON(min.map) | ||
map.setProperty('sources', [file]) | ||
map.setProperty('sourcesContent', opts.inSourceMap.sourcesContent) | ||
map.setProperty('sourcesContent', sourceMaps | ||
? opts.inSourceMap.sourcesContent | ||
: [buffer] | ||
) | ||
this.queue('\n') | ||
@@ -56,0 +59,0 @@ this.queue(map.toComment()) |
{ | ||
"name": "uglifyify", | ||
"version": "2.2.0", | ||
"version": "2.3.0", | ||
"description": "A browserify transform which minifies your code using UglifyJS2", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
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
6375
60