Skip to content

New config option, updated prefixTransform, and fixed Regression Bug

Latest
Compare
Choose a tag to compare
@gfranko gfranko released this 08 Oct 17:03
· 42 commits to master since this release

Examples

onModuleBundleComplete: function (data) {
  var fs = module.require('fs'),
    amdclean = module.require('amdclean'),
    outputFile = data.path,
    cleanedCode = amdclean.clean({
        'filePath': outputFile,
        'config': {
            'test': {
                'size': 'large'
            }
        }
    });

  fs.writeFileSync(outputFile, cleanedCode);
}

//test.js, which uses simplified CJS wrapping:
//http://requirejs.org/docs/whyamd.html#sugar
define(function (require, exports, module) {
    //Will be the value 'large'
    var size = module.config().size;
});

//test.js which uses a dependency array,
//it asks for the special module ID, 'module':
//https://github.com/jrburke/requirejs/wiki/Differences-between-the-simplified-CommonJS-wrapper-and-standard-AMD-define#wiki-magic
define(['module'], function (module) {
    //Will be the value 'large'
    var size = module.config().size;
});
  • Updated the prefixTransform option to pass BOTH post normalized and pre normalized module names #59
  'prefixTransform': function(postNormalizedModuleName, preNormalizedModuleName) {
    return postNormalizedModuleName;
  }
  • Fixed a regression bug that did not correctly catch all conditional AMD statements #61