Skip to content

Commit

Permalink
t2 run: fix uglify-es compression bug by adding arrow: false. Remove …
Browse files Browse the repository at this point in the history
…affected modules from blacklist.
  • Loading branch information
rwaldron committed Aug 4, 2017
1 parent 7c6e802 commit d3de424
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
5 changes: 3 additions & 2 deletions lib/tessel/deployment/javascript.js
Original file line number Diff line number Diff line change
Expand Up @@ -802,11 +802,12 @@ exportables.compress = function(source, options) {
properties: true,
sequences: true,
unsafe: true,
// ------
// ------ potentially dangerous
dead_code: true,
unsafe_math: true,
keep_infinity: true,
// ------
// ------ explicitly false
arrows: false,
keep_fargs: false,
keep_fnames: false,
warnings: false,
Expand Down
9 changes: 3 additions & 6 deletions lib/tessel/deployment/lists/javascript.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module.exports = {
'node_modules/**/negotiator/**/*.js',
'node_modules/**/socket.io-client/socket.io.js',
'node_modules/**/socket.io-client/dist/socket.io.min.js',
'node_modules/**/socket.io-client/dist/socket.io.js',
],

ignores: [
Expand Down Expand Up @@ -44,7 +45,8 @@ module.exports = {
*/
},
compressionOptions: {
'extend': {
// "extend" is the name of the module
extend: {
compress: {
keep_fnames: true
},
Expand All @@ -53,10 +55,5 @@ module.exports = {
},
compressionBlacklist: {
bindings: true,
base64id: true,
'component-inherit': true,
express: true,
'fraction.js': true,
'mongodb': true,
},
};
7 changes: 5 additions & 2 deletions test/unit/deployment/javascript.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ exports['deployment.js.compress'] = {
},

noOptionsCompress(test) {
test.expect(22);
test.expect(23);

const optionsCompress = {
// ------
Expand All @@ -315,6 +315,7 @@ exports['deployment.js.compress'] = {
unsafe_math: true,
keep_infinity: true,
// ------
arrows: false,
keep_fargs: false,
keep_fnames: false,
warnings: false,
Expand All @@ -335,7 +336,7 @@ exports['deployment.js.compress'] = {
},

ourOptionsCompress(test) {
test.expect(22);
test.expect(23);

const ourExplicitSettings = {
// ------
Expand All @@ -359,6 +360,7 @@ exports['deployment.js.compress'] = {
unsafe_math: true,
keep_infinity: true,
// ------
arrows: false,
keep_fargs: false,
keep_fnames: false,
warnings: false,
Expand Down Expand Up @@ -3381,6 +3383,7 @@ exports['deployment.js.lists'] = {
'node_modules/**/negotiator/**/*.js',
'node_modules/**/socket.io-client/socket.io.js',
'node_modules/**/socket.io-client/dist/socket.io.min.js',
'node_modules/**/socket.io-client/dist/socket.io.js',
];

test.deepEqual(lists.includes, includes);
Expand Down

2 comments on commit d3de424

@kzc
Copy link

@kzc kzc commented on d3de424 Aug 7, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rwaldron It would be appreciated if you could file an example JS program exhibiting an incorrect arrows transformation with the uglify-es project so that others might benefit from a fix.

https://github.com/mishoo/UglifyJS2/issues

@kzc
Copy link

@kzc kzc commented on d3de424 Aug 7, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rwaldron I've isolated an uglify-es arrows bug test case:

mishoo/UglifyJS#2271

If you're aware of another arrows bug, please feel free to add a comment to the issue above. Thanks.

Please sign in to comment.