Skip to content

Commit 3a14e09

Browse files
Bumped to 2.6.1
1 parent 656d8a1 commit 3a14e09

File tree

4 files changed

+38
-16
lines changed

4 files changed

+38
-16
lines changed

build/amdclean.js

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! amdclean - v2.6.0 - 2015-04-02
1+
/*! amdclean - v2.6.1 - 2015-04-10
22
* http://gregfranko.com/amdclean
33
* Copyright (c) 2015 Greg Franko */
44

@@ -26,7 +26,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2626
2727
*/
2828

29-
;(function(esprima, estraverse, escodegen, _) {
29+
;var sourcemapToAst;(function(esprima, estraverse, escodegen, _) {
3030
// defaultOptions.js
3131
// =================
3232
// AMDclean default options
@@ -1038,7 +1038,10 @@ convertDefinesAndRequires = function convertDefinesAndRequires(node, parent) {
10381038
if (dependencyBlacklist[currentDependency.value] && !shouldOptimize) {
10391039
depNames.push(currentDependency.value);
10401040
} else if (dependencyBlacklist[currentDependency.value] !== 'remove') {
1041-
if (dependencyBlacklist[currentDependency.value]) {
1041+
if (currentDependency.value === 'exports') {
1042+
depNames.push(moduleName);
1043+
amdclean.exportsModules[moduleName] = true;
1044+
} else if (dependencyBlacklist[currentDependency.value]) {
10421045
depNames.push('{}');
10431046
} else {
10441047
depNames.push(currentDependency.value);
@@ -1430,6 +1433,10 @@ clean = function clean() {
14301433
// Creates variable declarations for each AMD module/callback parameter that needs to be hoisted
14311434
_.each(hoistedVariables, function (moduleValue, moduleName) {
14321435
if (!_.contains(options.ignoreModules, moduleName)) {
1436+
var _initValue = amdclean.exportsModules[moduleName] !== true ? null : {
1437+
type: 'ObjectExpression',
1438+
properties: []
1439+
};
14331440
declarations.push({
14341441
'type': 'VariableDeclarator',
14351442
'id': {
@@ -1438,7 +1445,7 @@ clean = function clean() {
14381445
'range': defaultRange,
14391446
'loc': defaultLOC
14401447
},
1441-
'init': null,
1448+
'init': _initValue,
14421449
'range': defaultRange,
14431450
'loc': defaultLOC
14441451
});
@@ -1521,7 +1528,7 @@ clean = function clean() {
15211528
};
15221529
(function () {
15231530
(function (root, factory, undefined) {
1524-
1531+
'use strict';
15251532
// Universal Module Definition (UMD) to support AMD, CommonJS/Node.js, and plain browser loading
15261533
if (typeof define === 'function' && define.amd) {
15271534
factory.amd = true;
@@ -1547,7 +1554,7 @@ clean = function clean() {
15471554
root.amdclean = factory(null, root);
15481555
}
15491556
}(this, function cleanamd(amdDependencies, context) {
1550-
1557+
'use strict';
15511558
// Third-Party Dependencies
15521559
// Note: These dependencies are hoisted to the top (as local variables) at build time (Look in the gulpfile.js file and the AMDclean wrap option for more details)
15531560
sourcemapToAst = function () {
@@ -1642,6 +1649,10 @@ clean = function clean() {
16421649
// --------
16431650
// All of the stored program comments
16441651
this.comments = [];
1652+
// exportsModules
1653+
// --------
1654+
// An object that stores a map of all modules that makes use of the exports parameter in define. Useful when declaring variables and making sure circular dependencies work correctly.
1655+
this.exportsModules = {};
16451656
// options
16461657
// -------
16471658
// Merged user options and default options

0 commit comments

Comments
 (0)