Releases: gfranko/amdclean
Improved AMD Support and Removed Unique Module Name Checking
- Internally,
escodegen,estraverse,escodegen, andunderscoreare listed as AMD dependencies. As long as you use those exact names for each respective library, everything will work with AMD. - No longer checking for unique module names/ids, since requirejs will handle this.
Bug Fixes
Support Ignoring Certain Define() and/or Require() Methods
If you don't want one or more define() and require() methods to be removed by amdclean, then you must put a comment with only the words amdclean on the same line or one line above the method in question. For example, amdclean would not remove the define() method below:
// amdclean
define('example', [], function() {});Improved CommonJS Support and Relative File Path Normalizing
With this release, there is now support for converting CommonJS require() variable declarations inside of define() modules. This can be extremely helpful when using the r.js cjsTranslate configuration option.
CommonJS
Here are a few examples:
This:
var x = require('third');Becomes:
var x = third;This:
var x = require('third').exampleProp;Becomes:
var x = third.prop;This:
var x = require('third').exampleProp();Becomes:
var x = third.exampleProp();Relative File Paths
Also, relative file paths are also now getting normalized to JavaScript-standard variable names.
This:
define('./someModule', function() {}Becomes:
var someModule = function() {})();define('../modules/someModule', function() {}Becomes:
var modules_someModule = function() {})();Replace semicolon removal logic with Estraverse
Use Estraverse to remove left-over semicolons from removing require() calls
Improved Define() Function Conversion
Define() method calls that have one or more dependencies will now be converted like this:
AMD
define('example', ['example1', 'example2'], function(one, two) {
});Standard
var example = function (one, two) {
}(example1, example2);Unit Tests, Doc Updates, Minor Tweaks
- Created Jasmine unit tests and added Travis CI support
- Updated the README to demonstrate how to use amdclean with Grunt
- Added comments to the source code for clarity
- Reset the internal
moduleNameStoreback to an empty object after eachclean()method call to prevent unnecessaryduplicate module nameerrors.
Make the Browser Module Consistent
Expose a global amdclean windows property instead of a cleanamd windows property.
Initial Release
- Added documentation
- Published to NPM