mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-09 02:17:50 +00:00
Track function dependencies of variables in build.js.
Former-commit-id: 127d9c849cb6a77ed2bb192573bc1f8f7f661838
This commit is contained in:
44
build.js
44
build.js
@@ -84,6 +84,11 @@
|
|||||||
// properties
|
// properties
|
||||||
'templateSettings': ['escape'],
|
'templateSettings': ['escape'],
|
||||||
|
|
||||||
|
// variables
|
||||||
|
'htmlUnescapes': ['invert'],
|
||||||
|
'reEscapedHtml': ['keys'],
|
||||||
|
'reUnescapedHtml': ['keys'],
|
||||||
|
|
||||||
// public functions
|
// public functions
|
||||||
'after': [],
|
'after': [],
|
||||||
'assign': ['createCallback', 'createIterator'],
|
'assign': ['createCallback', 'createIterator'],
|
||||||
@@ -217,7 +222,7 @@
|
|||||||
'shimIsPlainObject': ['forIn', 'isArguments', 'isFunction', 'isNode'],
|
'shimIsPlainObject': ['forIn', 'isArguments', 'isFunction', 'isNode'],
|
||||||
'shimKeys': ['createIterator'],
|
'shimKeys': ['createIterator'],
|
||||||
'slice': [],
|
'slice': [],
|
||||||
'unescapeHtmlChar': ['invert'],
|
'unescapeHtmlChar': [],
|
||||||
'wrapperToString': [],
|
'wrapperToString': [],
|
||||||
'wrapperValueOf': [],
|
'wrapperValueOf': [],
|
||||||
|
|
||||||
@@ -226,7 +231,7 @@
|
|||||||
'findWhere': ['where']
|
'findWhere': ['where']
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Used to track Lo-Dash property dependencies of functions */
|
/** Used to track Lo-Dash property dependencies of identifiers */
|
||||||
var propDependencyMap = {
|
var propDependencyMap = {
|
||||||
'at': ['support'],
|
'at': ['support'],
|
||||||
'bind': ['support'],
|
'bind': ['support'],
|
||||||
@@ -243,7 +248,7 @@
|
|||||||
'toArray': ['support']
|
'toArray': ['support']
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Used to track variable dependencies of functions */
|
/** Used to track variable dependencies of identifiers */
|
||||||
var varDependencyMap = {
|
var varDependencyMap = {
|
||||||
'bind': ['reNative'],
|
'bind': ['reNative'],
|
||||||
'bindKey': ['indicatorObject'],
|
'bindKey': ['indicatorObject'],
|
||||||
@@ -251,6 +256,9 @@
|
|||||||
'createIterator': ['indicatorObject', 'iteratorObject', 'objectTypes'],
|
'createIterator': ['indicatorObject', 'iteratorObject', 'objectTypes'],
|
||||||
'createObject': ['reNative'],
|
'createObject': ['reNative'],
|
||||||
'defer': ['objectTypes', 'reNative'],
|
'defer': ['objectTypes', 'reNative'],
|
||||||
|
'escape': ['reUnescapedHtml'],
|
||||||
|
'escapeHtmlChar': ['htmlEscapes'],
|
||||||
|
'htmlUnescapes': ['htmlEscapes'],
|
||||||
'isArray': ['reNative'],
|
'isArray': ['reNative'],
|
||||||
'isEqual': ['indicatorObject'],
|
'isEqual': ['indicatorObject'],
|
||||||
'isObject': ['objectTypes'],
|
'isObject': ['objectTypes'],
|
||||||
@@ -259,9 +267,13 @@
|
|||||||
'keys': ['iteratorObject', 'reNative'],
|
'keys': ['iteratorObject', 'reNative'],
|
||||||
'merge': ['indicatorObject'],
|
'merge': ['indicatorObject'],
|
||||||
'partialRight': ['indicatorObject'],
|
'partialRight': ['indicatorObject'],
|
||||||
|
'reEscapedHtml': ['htmlUnescapes'],
|
||||||
|
'reUnescapedHtml': ['htmlEscapes'],
|
||||||
'support': ['reNative'],
|
'support': ['reNative'],
|
||||||
'template': ['reInterpolate'],
|
'template': ['reInterpolate'],
|
||||||
'templateSettings': ['reInterpolate']
|
'templateSettings': ['reInterpolate'],
|
||||||
|
'unescape': ['reEscapedHtml'],
|
||||||
|
'unescapeHtmlChar': ['htmlUnescapes']
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Used to track the category of identifiers */
|
/** Used to track the category of identifiers */
|
||||||
@@ -531,18 +543,6 @@
|
|||||||
'wrapperValueOf'
|
'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 */
|
/** List of all property dependencies */
|
||||||
var propDependencies = _.uniq(_.transform(propDependencyMap, function(result, propNames) {
|
var propDependencies = _.uniq(_.transform(propDependencyMap, function(result, propNames) {
|
||||||
push.apply(result, propNames);
|
push.apply(result, propNames);
|
||||||
@@ -553,6 +553,18 @@
|
|||||||
push.apply(result, varNames);
|
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);
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user