Comparing version 3.0.4 to 4.0.0
25
index.js
@@ -5,3 +5,3 @@ var minimatch = require('minimatch').Minimatch | ||
, path = require('path') | ||
, ujs = require('uglify-js') | ||
, ujs = require('uglify-es') | ||
, extend = require('extend') | ||
@@ -41,2 +41,7 @@ | ||
// remove exts before passing opts to uglify | ||
delete opts.global | ||
delete opts.exts | ||
delete opts.x | ||
return through(function write(chunk) { | ||
@@ -46,13 +51,11 @@ buffer += chunk | ||
var matched = buffer.match( | ||
// match an inlined sourcemap with or without a charset definition | ||
// match an inlined sourceMap with or without a charset definition | ||
/\/\/[#@] ?sourceMappingURL=data:application\/json(?:;charset=utf-8)?;base64,([a-zA-Z0-9+\/]+)={0,2}\n?$/ | ||
) | ||
debug = opts.sourcemap !== false && (debug || matched) | ||
debug = opts.sourceMap !== false && (debug || matched) | ||
opts = extend({}, { | ||
fromString: true | ||
, compress: true | ||
, mangle: true | ||
, filename: file | ||
, sourceMaps: debug | ||
sourceMap: { | ||
filename: file | ||
} | ||
}, opts) | ||
@@ -64,3 +67,3 @@ | ||
if (debug) opts.outSourceMap = 'out.js.map' | ||
if (debug) opts.sourceMap.url = 'out.js.map' | ||
@@ -70,5 +73,5 @@ // Check if incoming source code already has source map comment. | ||
if (debug && matched) { | ||
opts.inSourceMap = convert.fromJSON( | ||
opts.sourceMap.content = convert.fromJSON( | ||
new Buffer(matched[1], 'base64').toString() | ||
).sourcemap | ||
).sourceMap | ||
} | ||
@@ -75,0 +78,0 @@ |
{ | ||
"name": "uglifyify", | ||
"version": "3.0.4", | ||
"version": "4.0.0", | ||
"description": "A browserify transform which minifies your code using UglifyJS2", | ||
@@ -11,3 +11,3 @@ "main": "index.js", | ||
"through": "~2.3.4", | ||
"uglify-js": "2.x.x" | ||
"uglify-es": "^3.0.15" | ||
}, | ||
@@ -14,0 +14,0 @@ "devDependencies": { |
# uglifyify | ||
A [Browserify](http://browserify.org) v2 transform which minifies your code | ||
using [UglifyJS2](https://github.com/mishoo/UglifyJS2). | ||
using [uglify-es](https://github.com/mishoo/UglifyJS2/tree/harmony). | ||
@@ -99,5 +99,3 @@ ## Installation | ||
bundler.transform({ | ||
global: true | ||
}, 'uglifyify') | ||
bundler.transform('uglifyify', { global: true }) | ||
@@ -127,9 +125,9 @@ bundler.bundle() | ||
bundler.transform({ | ||
global: true | ||
, ignore: [ | ||
bundler.transform('uglifyify', { | ||
global: true, | ||
ignore: [ | ||
'**/node_modules/weakmap/*' | ||
, '**/node_modules/async/*' | ||
] | ||
}, 'uglifyify') | ||
}) | ||
@@ -177,5 +175,5 @@ bundler.bundle().pipe(process.stdout) | ||
bundler.transform({ sourcemap: false }, 'uglifyify') | ||
bundler.transform('uglifyify', { sourceMap: false }) | ||
.bundle() | ||
.pipe(process.stdout) | ||
``` |
const convert = require('convert-source-map') | ||
const wrap = require('wrap-stream') | ||
const browserify = require('browserify') | ||
const uglify = require('uglify-js') | ||
const uglify = require('uglify-es') | ||
const from2 = require('from2') | ||
@@ -80,3 +80,3 @@ const test = require('tape') | ||
.pipe(closure()) | ||
.pipe(uglifyify(src, { compress: false, mangle: false })) | ||
.pipe(uglifyify(src, { compress: { conditionals: false } })) | ||
.pipe(bl(buffered1)) | ||
@@ -117,4 +117,5 @@ | ||
var min = uglify.minify(orig, { | ||
outSourceMap: 'out.js.map' | ||
, fromString: true | ||
sourceMap: { | ||
url: 'out.js.map' | ||
} | ||
}) | ||
@@ -121,0 +122,0 @@ |
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
14514
243
177
+ Addeduglify-es@^3.0.15
+ Addedcommander@2.14.1(transitive)
+ Addedsource-map@0.6.1(transitive)
+ Addeduglify-es@3.3.10(transitive)
- Removeduglify-js@2.x.x
- Removedalign-text@0.1.4(transitive)
- Removedcamelcase@1.2.1(transitive)
- Removedcenter-align@0.1.3(transitive)
- Removedcliui@2.1.0(transitive)
- Removeddecamelize@1.2.0(transitive)
- Removedis-buffer@1.1.6(transitive)
- Removedkind-of@3.2.2(transitive)
- Removedlazy-cache@1.0.4(transitive)
- Removedlongest@1.0.1(transitive)
- Removedrepeat-string@1.6.1(transitive)
- Removedright-align@0.1.3(transitive)
- Removedsource-map@0.5.7(transitive)
- Removeduglify-js@2.8.29(transitive)
- Removeduglify-to-browserify@1.0.2(transitive)
- Removedwindow-size@0.1.0(transitive)
- Removedwordwrap@0.0.2(transitive)
- Removedyargs@3.10.0(transitive)