Skip to content

Commit 2d04f24

Browse files
XhmikosRvladikoff
authored andcommitted
Update uglify to v2.7.0. (#416)
* bump uglify-js to 2.7 * Update files for `screw_ie8` being true in uglify 2.7.0. * Minor lint tweaks. * v2.0.0.
1 parent 48285c9 commit 2d04f24

16 files changed

+88
-70
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ node_js:
77
- "0.12"
88
- "4"
99
- "5"
10+
- "6"
1011
- "iojs"
1112

1213
matrix:

CHANGELOG

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1+
v2.0.0:
2+
date: 2016-07-19
3+
changes:
4+
- Update uglify-js to v2.7.0. `screwIE8` is enabled by default.
15
v1.0.2:
2-
date: 2016-03-19
6+
date: 2016-07-19
37
changes:
48
- Update grunt to ^1.0.0.
59
- Fix `beautify` when passed as an object.

Gruntfile.js

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ module.exports = function(grunt) {
5555
files: {
5656
'tmp/compress_mangle_banner.js': ['test/fixtures/src/simple.js']
5757
},
58-
options : {
59-
banner : '// banner without sourcemap\n'
58+
options: {
59+
banner: '// banner without sourcemap\n'
6060
}
6161
},
6262
no_src: {
@@ -99,7 +99,7 @@ module.exports = function(grunt) {
9999
},
100100
multifile: {
101101
files: {
102-
'tmp/multifile.js': ['test/fixtures/src/simple.js','test/fixtures/src/comments.js']
102+
'tmp/multifile.js': ['test/fixtures/src/simple.js', 'test/fixtures/src/comments.js']
103103
},
104104
options: {
105105
mangle: false
@@ -141,7 +141,7 @@ module.exports = function(grunt) {
141141
src: 'test/fixtures/src/screwIE8.js',
142142
dest: 'tmp/screwIE8.js',
143143
options: {
144-
screwIE8: true
144+
screwIE8: false
145145
}
146146
},
147147
exportAll: {
@@ -197,8 +197,8 @@ module.exports = function(grunt) {
197197
dest: 'tmp/sourcemap_functionName.js',
198198
options: {
199199
sourceMap: true,
200-
sourceMapName: function( dest ) {
201-
return dest + ".fn.map";
200+
sourceMapName: function(dest) {
201+
return dest + '.fn.map';
202202
}
203203
}
204204
},
@@ -218,7 +218,7 @@ module.exports = function(grunt) {
218218
},
219219
options: {
220220
sourceMap: true,
221-
sourceMapName: function( dest ) {
221+
sourceMapName: function(dest) {
222222
return dest+'.fn.map';
223223
}
224224
}
@@ -238,13 +238,13 @@ module.exports = function(grunt) {
238238
}
239239
},
240240
sourcemap_sources: {
241-
files: {
242-
'tmp/sourcemap_sources.js': ['test/fixtures/src/simple.js']
243-
},
244-
options: {
245-
sourceMap: true,
246-
sourceMapIncludeSources: true
247-
}
241+
files: {
242+
'tmp/sourcemap_sources.js': ['test/fixtures/src/simple.js']
243+
},
244+
options: {
245+
sourceMap: true,
246+
sourceMapIncludeSources: true
247+
}
248248
},
249249
sourcemapin_sources: {
250250
files: {
@@ -259,24 +259,24 @@ module.exports = function(grunt) {
259259
}
260260
},
261261
expression_json: {
262-
files: {
263-
'tmp/expression.json': ['test/fixtures/src/simple.json']
264-
},
265-
options: {
266-
expression: true,
267-
mangle: false,
268-
compress: false
269-
}
262+
files: {
263+
'tmp/expression.json': ['test/fixtures/src/simple.json']
264+
},
265+
options: {
266+
expression: true,
267+
mangle: false,
268+
compress: false
269+
}
270270
},
271271
expression_js: {
272-
files: {
273-
'tmp/expression.js': ['test/fixtures/src/expression.js']
274-
},
275-
options: {
276-
expression: true,
277-
mangle: false,
278-
compress: false
279-
}
272+
files: {
273+
'tmp/expression.js': ['test/fixtures/src/expression.js']
274+
},
275+
options: {
276+
expression: true,
277+
mangle: false,
278+
compress: false
279+
}
280280
},
281281
mangleprops: {
282282
files: {
@@ -396,20 +396,20 @@ module.exports = function(grunt) {
396396
});
397397

398398
// task that expects its argument (another task) to fail
399-
grunt.registerTask('expectFail', function(){
399+
grunt.registerTask('expectFail', function() {
400400
var task = this.args.join(':');
401401

402402
var done = this.async();
403403

404404
function onComplete(error, result) {
405-
grunt.log.write("\n > " + result.stdout.split("\n").join("\n > ") + "\n");
406-
var rv = error ? true : new Error("Task " + task + " unexpectedly passed.");
405+
grunt.log.write('\n > ' + result.stdout.split('\n').join('\n > ') + '\n');
406+
var rv = error ? true : new Error('Task ' + task + ' unexpectedly passed.');
407407
done(rv);
408408
}
409409

410410
grunt.util.spawn({
411-
grunt : true,
412-
args : task
411+
grunt: true,
412+
args: task
413413
}, onComplete);
414414
});
415415

README.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# grunt-contrib-uglify v1.0.2 [![Build Status: Linux](https://travis-ci.org/gruntjs/grunt-contrib-uglify.svg?branch=master)](https://travis-ci.org/gruntjs/grunt-contrib-uglify) [![Build Status: Windows](https://ci.appveyor.com/api/projects/status/ybtf5vbvtenii561/branch/master?svg=true)](https://ci.appveyor.com/project/gruntjs/grunt-contrib-uglify/branch/master)
1+
# grunt-contrib-uglify v2.0.0 [![Build Status: Linux](https://travis-ci.org/gruntjs/grunt-contrib-uglify.svg?branch=master)](https://travis-ci.org/gruntjs/grunt-contrib-uglify) [![Build Status: Windows](https://ci.appveyor.com/api/projects/status/ybtf5vbvtenii561/branch/master?svg=true)](https://ci.appveyor.com/project/gruntjs/grunt-contrib-uglify/branch/master)
22

3-
> Minify javascript files with UglifyJS
3+
> Minify JavaScript files with UglifyJS
44
55

66

@@ -186,9 +186,9 @@ This string will be appended to the minified output. Template strings (e.g. `<%=
186186

187187
#### screwIE8
188188
Type: `Boolean`
189-
Default: `false`
189+
Default: `true`
190190

191-
Pass this flag if you don't care about full compliance with Internet Explorer 6-8 quirks.
191+
Set this to `false` if you still care about full compliance with Internet Explorer 6-8 quirks.
192192

193193
#### mangleProperties
194194
Type: `Boolean` `Object`
@@ -513,13 +513,12 @@ grunt.initConfig({
513513
}
514514
});
515515
```
516-
#### Quiet Mode
517-
By default the task supresses the logging, use _--verbose_ to show the full output.
518516

519517

520518
## Release History
521519

522-
* 2016-03-19   v1.0.2   Update grunt to ^1.0.0. Fix `beautify` when passed as an object. Fix docs about `report` values.
520+
* 2016-07-19   v2.0.0   Update uglify-js to v2.7.0. `screwIE8` is enabled by default.
521+
* 2016-07-19   v1.0.2   Update grunt to ^1.0.0. Fix `beautify` when passed as an object. Fix docs about `report` values.
523522
* 2016-03-16   v1.0.1   Downgrade maxmin for Node.js 0.10.
524523
* 2016-03-04   v1.0.0   Use uglify-js ~2.6.2 to fix sourcemap issue. Improve docs for `global-defs` and `--define` options. Add `sourceMapUrl` option. Add `bare_returns` option. Optionally set report verbosity level using report option.
525524
* 2016-01-29   v0.11.1   Update lodash to ^4.0.1. Update grunt-contrib-clean to ^0.7.0. Update grunt-contrib-jshint to ^0.12.0.
@@ -557,4 +556,4 @@ By default the task supresses the logging, use _--verbose_ to show the full outp
557556

558557
Task submitted by ["Cowboy" Ben Alman](http://benalman.com)
559558

560-
*This file was generated on Tue Jul 19 2016 16:34:56.*
559+
*This file was generated on Tue Jul 19 2016 16:46:21.*

appveyor.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ environment:
1515
platform: x86
1616
- nodejs_version: "5"
1717
platform: x86
18+
- nodejs_version: "6"
19+
platform: x86
1820

1921
install:
2022
- ps: Install-Product node $env:nodejs_version $env:platform

docs/uglify-options.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,9 @@ This string will be appended to the minified output. Template strings (e.g. `<%=
137137

138138
## screwIE8
139139
Type: `Boolean`
140-
Default: `false`
140+
Default: `true`
141141

142-
Pass this flag if you don't care about full compliance with Internet Explorer 6-8 quirks.
142+
Set this to `false` if you still care about full compliance with Internet Explorer 6-8 quirks.
143143

144144
## mangleProperties
145145
Type: `Boolean` `Object`

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "grunt-contrib-uglify",
3-
"description": "Minify javascript files with UglifyJS",
4-
"version": "1.0.2",
3+
"description": "Minify JavaScript files with UglifyJS",
4+
"version": "2.0.0",
55
"author": {
66
"name": "Grunt Team",
77
"url": "http://gruntjs.com/"
@@ -19,7 +19,7 @@
1919
"chalk": "^1.0.0",
2020
"lodash.assign": "^4.0.9",
2121
"maxmin": "^1.1.0",
22-
"uglify-js": "~2.6.2",
22+
"uglify-js": "~2.7.0",
2323
"uri-path": "^1.0.0"
2424
},
2525
"devDependencies": {

tasks/lib/uglify.js

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,10 @@ exports.init = function(grunt) {
8181
// Need to call this before we mangle or compress,
8282
// and call after any compression or ast altering
8383
if (options.expression === false) {
84-
topLevel.figure_out_scope({ screw_ie8: options.screwIE8, cache: topLevelCache });
84+
topLevel.figure_out_scope({
85+
screw_ie8: options.screwIE8,
86+
cache: topLevelCache
87+
});
8588
}
8689

8790
if (options.compress !== false) {
@@ -91,19 +94,25 @@ exports.init = function(grunt) {
9194
if (options.compress.warnings !== true) {
9295
options.compress.warnings = false;
9396
}
94-
if (options.screwIE8) {
95-
options.compress.screw_ie8 = true;
97+
if (options.screwIE8 === false) {
98+
options.compress.screw_ie8 = false;
9699
}
97100
var compressor = UglifyJS.Compressor(options.compress);
98101
topLevel = topLevel.transform(compressor);
99102

100103
// Need to figure out scope again after source being altered
101104
if (options.expression === false) {
102-
topLevel.figure_out_scope({screw_ie8: options.screwIE8, cache: topLevelCache});
105+
topLevel.figure_out_scope({
106+
screw_ie8: options.screwIE8,
107+
cache: topLevelCache
108+
});
103109
}
104110
}
105111

106-
var mangleExclusions = { vars: [], props: [] };
112+
var mangleExclusions = {
113+
vars: [],
114+
props: []
115+
};
107116
if (options.reserveDOMProperties) {
108117
mangleExclusions = UglifyJS.readDefaultReservedFile();
109118
}
@@ -123,7 +132,7 @@ exports.init = function(grunt) {
123132
cache = UglifyJS.readNameCache(options.nameCache, 'props');
124133
}
125134

126-
if (typeof(options.mangleProperties) !== 'undefined' && options.mangleProperties !== false) {
135+
if (typeof options.mangleProperties !== 'undefined' && options.mangleProperties !== false) {
127136
// if options.mangleProperties is a boolean (true) convert it into an object
128137
if (typeof options.mangleProperties !== 'object') {
129138
options.mangleProperties = {};
@@ -140,16 +149,19 @@ exports.init = function(grunt) {
140149

141150
// Need to figure out scope again since topLevel has been altered
142151
if (options.expression === false) {
143-
topLevel.figure_out_scope({screw_ie8: options.screwIE8, cache: topLevelCache});
152+
topLevel.figure_out_scope({
153+
screw_ie8: options.screwIE8,
154+
cache: topLevelCache
155+
});
144156
}
145157
}
146158

147159
if (options.mangle !== false) {
148160
if (options.mangle === true) {
149161
options.mangle = {};
150162
}
151-
if (options.screwIE8) {
152-
options.mangle.screw_ie8 = true;
163+
if (options.screwIE8 === false) {
164+
options.mangle.screw_ie8 = false;
153165
}
154166
// disabled due to:
155167
// 1) preserve stable name mangling
@@ -195,7 +207,7 @@ exports.init = function(grunt) {
195207
if (options.sourceMap) {
196208
// Set all paths to forward slashes for use in the browser
197209
var sourceMappingURL;
198-
sourceMappingURL = options.destToSourceMap.match(/^http[s]?\:\/\//) === null ? uriPath(options.destToSourceMap) : options.destToSourceMap;
210+
sourceMappingURL = options.destToSourceMap.match(/^http[s]?:\/\//) === null ? uriPath(options.destToSourceMap) : options.destToSourceMap;
199211
min += '\n//# sourceMappingURL=' + sourceMappingURL;
200212
}
201213

@@ -220,8 +232,8 @@ exports.init = function(grunt) {
220232
outputOptions.preamble = options.banner;
221233
}
222234

223-
if (options.screwIE8) {
224-
outputOptions.screw_ie8 = true;
235+
if (options.screwIE8 === false) {
236+
outputOptions.screw_ie8 = false;
225237
}
226238

227239
if (options.sourceMap) {

tasks/uglify.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ module.exports = function(grunt) {
4747
expression: false,
4848
maxLineLen: 32000,
4949
ASCIIOnly: false,
50-
screwIE8: false,
50+
screwIE8: true,
5151
quoteStyle: 0
5252
});
5353

@@ -124,7 +124,7 @@ module.exports = function(grunt) {
124124
// Calculate the path from the dest file to the sourcemap for the
125125
// sourceMappingURL reference
126126
// If sourceMapUrl is defined, use this instead
127-
if(options.sourceMap) {
127+
if (options.sourceMap) {
128128
var destToSourceMapPath, sourceMapBasename;
129129
if (!options.sourceMapUrl) {
130130
destToSourceMapPath = relativePath(f.dest, options.generatedSourceMapName);

test/fixtures/expected/quotes_double.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)