Skip to content

Commit

Permalink
Releasing AMDClean v0.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
gfranko committed Nov 25, 2013
1 parent 4b89e3c commit 8415def
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "amdclean",
"version": "0.2.7",
"version": "0.3.0",
"description": "A build tool that converts AMD code to standard JavaScript",
"main": "./src/amdclean",
"repository": {
Expand Down
5 changes: 4 additions & 1 deletion src/amdclean.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! amdclean - v0.2.7 - 2013-11-25
/*! amdclean - v0.3.0 - 2013-11-25
* http://gregfranko.com/amdclean
* Copyright (c) 2013 Greg Franko; Licensed MIT*/

Expand Down Expand Up @@ -416,6 +416,9 @@
if(currentName === 'exports') {
hasExportsParam = true;
}
if(currentName === '{}') {
currentName = 'module';
}
deps.push({
'type': 'Identifier',
'name': currentName
Expand Down
8 changes: 8 additions & 0 deletions test/specs/convert.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ describe('amdclean specs', function() {
expect(cleanedCode).toBe(standardJavaScript);
});

it('should support the plain simplified CJS wrapper', function() {
var AMDcode = "define('foo',['require','exports','module','bar'],function(require, exports){exports.bar = require('bar');});",
cleanedCode = amdclean.clean({ code: AMDcode, escodegen: { format: { compact: true } } }),
standardJavaScript = "var foo=function (require,exports,module,bar){exports.bar=bar;return exports;}({},{},{},bar);";

expect(cleanedCode).toBe(standardJavaScript);
});

it('should support global modules', function() {
var AMDcode = "define('foo', ['require', 'exports', './bar'], function(require, exports){exports.bar = require('./bar');});",
cleanedCode = amdclean.clean({ globalModules: ['foo'], code: AMDcode, escodegen: { format: { compact: true } } }),
Expand Down

0 comments on commit 8415def

Please sign in to comment.