Track function dependencies of variables in build.js.

Former-commit-id: 127d9c849cb6a77ed2bb192573bc1f8f7f661838
This commit is contained in:
John-David Dalton
2013-07-14 01:12:18 -07:00
parent ec12f7a5e7
commit c5698e82da

View File

@@ -84,6 +84,11 @@
// properties
'templateSettings': ['escape'],
// variables
'htmlUnescapes': ['invert'],
'reEscapedHtml': ['keys'],
'reUnescapedHtml': ['keys'],
// public functions
'after': [],
'assign': ['createCallback', 'createIterator'],
@@ -217,7 +222,7 @@
'shimIsPlainObject': ['forIn', 'isArguments', 'isFunction', 'isNode'],
'shimKeys': ['createIterator'],
'slice': [],
'unescapeHtmlChar': ['invert'],
'unescapeHtmlChar': [],
'wrapperToString': [],
'wrapperValueOf': [],
@@ -226,7 +231,7 @@
'findWhere': ['where']
};
/** Used to track Lo-Dash property dependencies of functions */
/** Used to track Lo-Dash property dependencies of identifiers */
var propDependencyMap = {
'at': ['support'],
'bind': ['support'],
@@ -243,7 +248,7 @@
'toArray': ['support']
};
/** Used to track variable dependencies of functions */
/** Used to track variable dependencies of identifiers */
var varDependencyMap = {
'bind': ['reNative'],
'bindKey': ['indicatorObject'],
@@ -251,6 +256,9 @@
'createIterator': ['indicatorObject', 'iteratorObject', 'objectTypes'],
'createObject': ['reNative'],
'defer': ['objectTypes', 'reNative'],
'escape': ['reUnescapedHtml'],
'escapeHtmlChar': ['htmlEscapes'],
'htmlUnescapes': ['htmlEscapes'],
'isArray': ['reNative'],
'isEqual': ['indicatorObject'],
'isObject': ['objectTypes'],
@@ -259,9 +267,13 @@
'keys': ['iteratorObject', 'reNative'],
'merge': ['indicatorObject'],
'partialRight': ['indicatorObject'],
'reEscapedHtml': ['htmlUnescapes'],
'reUnescapedHtml': ['htmlEscapes'],
'support': ['reNative'],
'template': ['reInterpolate'],
'templateSettings': ['reInterpolate']
'templateSettings': ['reInterpolate'],
'unescape': ['reEscapedHtml'],
'unescapeHtmlChar': ['htmlUnescapes']
};
/** Used to track the category of identifiers */
@@ -531,18 +543,6 @@
'wrapperValueOf'
];
/** List of all functions */
var allFuncs = _.keys(funcDependencyMap).filter(function(key) {
var type = typeof _[key];
return type == 'function' || type == 'undefined';
});
/** List of Lo-Dash functions */
var lodashFuncs = _.difference(allFuncs, privateFuncs, ['findWhere']);
/** List of Underscore functions */
var underscoreFuncs = _.difference(allFuncs, lodashOnlyFuncs, privateFuncs);
/** List of all property dependencies */
var propDependencies = _.uniq(_.transform(propDependencyMap, function(result, propNames) {
push.apply(result, propNames);
@@ -553,6 +553,18 @@
push.apply(result, varNames);
}, []));
/** List of all functions */
var allFuncs = _.difference(_.keys(funcDependencyMap), propDependencies, varDependencies).filter(function(key) {
var type = typeof _[key];
return type == 'function' || type == 'undefined';
});
/** List of Lo-Dash functions */
var lodashFuncs = _.difference(allFuncs, privateFuncs, ['findWhere']);
/** List of Underscore functions */
var underscoreFuncs = _.difference(allFuncs, lodashOnlyFuncs, privateFuncs);
/*--------------------------------------------------------------------------*/
/**