Skip to content

Commit 8415def

Browse files
committed
Releasing AMDClean v0.3.0
1 parent 4b89e3c commit 8415def

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "amdclean",
3-
"version": "0.2.7",
3+
"version": "0.3.0",
44
"description": "A build tool that converts AMD code to standard JavaScript",
55
"main": "./src/amdclean",
66
"repository": {

src/amdclean.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! amdclean - v0.2.7 - 2013-11-25
1+
/*! amdclean - v0.3.0 - 2013-11-25
22
* http://gregfranko.com/amdclean
33
* Copyright (c) 2013 Greg Franko; Licensed MIT*/
44

@@ -416,6 +416,9 @@
416416
if(currentName === 'exports') {
417417
hasExportsParam = true;
418418
}
419+
if(currentName === '{}') {
420+
currentName = 'module';
421+
}
419422
deps.push({
420423
'type': 'Identifier',
421424
'name': currentName

test/specs/convert.js

+8
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,14 @@ describe('amdclean specs', function() {
5757
expect(cleanedCode).toBe(standardJavaScript);
5858
});
5959

60+
it('should support the plain simplified CJS wrapper', function() {
61+
var AMDcode = "define('foo',['require','exports','module','bar'],function(require, exports){exports.bar = require('bar');});",
62+
cleanedCode = amdclean.clean({ code: AMDcode, escodegen: { format: { compact: true } } }),
63+
standardJavaScript = "var foo=function (require,exports,module,bar){exports.bar=bar;return exports;}({},{},{},bar);";
64+
65+
expect(cleanedCode).toBe(standardJavaScript);
66+
});
67+
6068
it('should support global modules', function() {
6169
var AMDcode = "define('foo', ['require', 'exports', './bar'], function(require, exports){exports.bar = require('./bar');});",
6270
cleanedCode = amdclean.clean({ globalModules: ['foo'], code: AMDcode, escodegen: { format: { compact: true } } }),

0 commit comments

Comments
 (0)