-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Fix for #7: Not as optimized for Webpack as it could be. Adds ability to wrap functions that are elements of an array literal in an argument list * Added a few negative case tests in response to code review. * Modified the array literal logic to very specifically track with webpack patterns rather than all array literal function parameters. * Added optimization of browserify modules. * Refactor of browserify and webpack logic.
- Loading branch information
1 parent
33d691e
commit 0cba85e
Showing
11 changed files
with
182 additions
and
13 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
9 changes: 9 additions & 0 deletions
9
test/cases/browserify-object-literal-in-global-scope/input.js
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,9 @@ | ||
// a browserify-style object literal that isn't a parameter shouldn't be optimized. | ||
var a = { | ||
1:[ | ||
function(o,r,t){ | ||
console.log("browserify style!"); | ||
}, | ||
{} | ||
] | ||
}; |
9 changes: 9 additions & 0 deletions
9
test/cases/browserify-object-literal-in-global-scope/output.js
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,9 @@ | ||
// a browserify-style object literal that isn't a parameter shouldn't be optimized. | ||
var a = { | ||
1:[ | ||
function(o,r,t){ | ||
console.log("browserify style!"); | ||
}, | ||
{} | ||
] | ||
}; |
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,24 @@ | ||
!function(o){ | ||
return o[0](); | ||
}( | ||
{ | ||
1:[ | ||
function(o,r,t){ | ||
console.log("browserify style!"); | ||
}, | ||
{} | ||
], | ||
2:[ | ||
function(o,r,t){ | ||
console.log("browserify style!"); | ||
}, | ||
{} | ||
], | ||
3:[ | ||
function(o,r,t){ | ||
console.log("browserify style!"); | ||
}, | ||
{} | ||
] | ||
} | ||
); |
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,24 @@ | ||
!(function(o){ | ||
return o[0](); | ||
})( | ||
{ | ||
1:[ | ||
(function(o,r,t){ | ||
console.log("browserify style!"); | ||
}), | ||
{} | ||
], | ||
2:[ | ||
(function(o,r,t){ | ||
console.log("browserify style!"); | ||
}), | ||
{} | ||
], | ||
3:[ | ||
(function(o,r,t){ | ||
console.log("browserify style!"); | ||
}), | ||
{} | ||
] | ||
} | ||
); |
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,10 @@ | ||
foo( | ||
{ | ||
1:[ | ||
function(o,r,t){ | ||
console.log("browserify style!"); | ||
}, | ||
{} | ||
] | ||
} | ||
); |
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,10 @@ | ||
foo( | ||
{ | ||
1:[ | ||
function(o,r,t){ | ||
console.log("browserify style!"); | ||
}, | ||
{} | ||
] | ||
} | ||
); |
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,12 @@ | ||
!function(o){ | ||
return o[0](); | ||
}( | ||
{ | ||
1:[ | ||
function(o,r,t){ | ||
console.log("browserify style!"); | ||
}, | ||
{} | ||
] | ||
} | ||
); |
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,12 @@ | ||
!(function(o){ | ||
return o[0](); | ||
})( | ||
{ | ||
1:[ | ||
(function(o,r,t){ | ||
console.log("browserify style!"); | ||
}), | ||
{} | ||
] | ||
} | ||
); |
14 changes: 14 additions & 0 deletions
14
test/cases/browserify-style-with-non-numeric-propname/input.js
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,14 @@ | ||
// a browserify-style function call that has non-numeric object indices shouldn't | ||
// be optimized. | ||
!function(o){ | ||
return o[0](); | ||
}( | ||
{ | ||
a:[ | ||
function(o,r,t){ | ||
console.log("browserify style!"); | ||
}, | ||
{} | ||
] | ||
} | ||
); |
14 changes: 14 additions & 0 deletions
14
test/cases/browserify-style-with-non-numeric-propname/output.js
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,14 @@ | ||
// a browserify-style function call that has non-numeric object indices shouldn't | ||
// be optimized. | ||
!(function(o){ | ||
return o[0](); | ||
})( | ||
{ | ||
a:[ | ||
function(o,r,t){ | ||
console.log("browserify style!"); | ||
}, | ||
{} | ||
] | ||
} | ||
); |