forked from yui/yuglify
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request yui#22 from louisbuchbinder/upgrade-uglify
upgrade uglify-js
- Loading branch information
Showing
11 changed files
with
95 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,4 @@ CVS/ | |
*~ | ||
.com.apple.timemachine.supported | ||
tests/assets/yql/build/*/*.js | ||
yuglify-*.tgz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
v0.10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
language: node_js | ||
node_js: | ||
- "0.8" | ||
- "0.10" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
The mocha-tests directory contains tests that will validate refactoring steps. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
var a = function () { | ||
return true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
var a = function () { | ||
return true; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
/*! This is a License Comment | ||
* It should persist through the uglification | ||
*/ | ||
|
||
var a = function () { | ||
return true; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
|
||
var assert = require('assert'); | ||
var fs = require('fs'); | ||
var path = require('path'); | ||
var module = require('../../../lib/jsminify.js'); | ||
var config = module.config; | ||
var jsminify = module.jsminify; | ||
var good = String(fs.readFileSync(path.join(__dirname, 'goodSyntax.js.ignore'))); | ||
var goodWithLicense = String(fs.readFileSync(path.join(__dirname, 'goodSyntaxWithLicense.js.ignore'))); | ||
var bad = String(fs.readFileSync(path.join(__dirname, 'badSyntax.js.ignore'))); | ||
|
||
describe('JSminify Unit Tests', function () { | ||
it('should have a default config object', function () { | ||
var expected = { | ||
mangle: true, | ||
squeeze: true, | ||
semicolon: false, | ||
lift_vars: true, | ||
mangle_toplevel: true, | ||
no_mangle_functions: true, | ||
max_line_length: 6000 | ||
}; | ||
|
||
assert.strictEqual(typeof config, 'object'); | ||
|
||
Object.keys(expected).forEach(function (key) { | ||
assert.strictEqual(config[key], expected[key]); | ||
}); | ||
}); | ||
it('should have a jsminify function', function () { | ||
assert.strictEqual(typeof jsminify, 'function'); | ||
}); | ||
it('should minify js code', function (done) { | ||
jsminify(good, null, function (err, code) { | ||
if (err) { | ||
return done(err); | ||
} | ||
assert.strictEqual(code, 'var a=function(){return!0};\n'); | ||
done(); | ||
}); | ||
}); | ||
it('should preserve license comments in js code', function (done) { | ||
jsminify(goodWithLicense, null, function (err, code) { | ||
if (err) { | ||
return done(err); | ||
} | ||
|
||
assert.strictEqual(code, '/*! This is a License Comment\n\t* It should persist through the uglification\n*/\n;var a=function(){return!0};\n'); | ||
done(); | ||
}); | ||
}); | ||
it('should error on bad syntax', function (done) { | ||
jsminify(bad, null, function (err, code) { | ||
assert(err, 'Expected an error'); | ||
done(); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters