mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-12 20:07:49 +00:00
Update dependencies in build.js.
Former-commit-id: 0de152de0dba9b3349d9234b066a5eb8b7964693
This commit is contained in:
56
build.js
56
build.js
@@ -176,7 +176,7 @@
|
|||||||
'uniq': ['cacheIndexOf', 'createCache', 'getArray', 'getIndexOf', 'overloadWrapper', 'releaseArray', 'releaseObject'],
|
'uniq': ['cacheIndexOf', 'createCache', 'getArray', 'getIndexOf', 'overloadWrapper', 'releaseArray', 'releaseObject'],
|
||||||
'uniqueId': [],
|
'uniqueId': [],
|
||||||
'unzip': ['max', 'pluck'],
|
'unzip': ['max', 'pluck'],
|
||||||
'value': ['basicEach', 'forOwn', 'isArray', 'lodashWrapper'],
|
'value': ['basicEach', 'forOwn', 'isArray', 'lodash', 'wrapperValueOf', 'lodashWrapper'],
|
||||||
'values': ['keys'],
|
'values': ['keys'],
|
||||||
'where': ['filter'],
|
'where': ['filter'],
|
||||||
'without': ['difference'],
|
'without': ['difference'],
|
||||||
@@ -193,15 +193,16 @@
|
|||||||
'compareAscending': [],
|
'compareAscending': [],
|
||||||
'createBound': ['createObject', 'isFunction', 'isObject'],
|
'createBound': ['createObject', 'isFunction', 'isObject'],
|
||||||
'createCache': ['cachePush', 'getObject', 'releaseObject'],
|
'createCache': ['cachePush', 'getObject', 'releaseObject'],
|
||||||
'createIterator': ['getObject', 'isArguments', 'isArray', 'isString', 'iteratorTemplate', 'keys', 'releaseObject'],
|
'createIterator': ['getObject', 'isArguments', 'isArray', 'isString', 'iteratorTemplate', 'lodash', 'releaseObject'],
|
||||||
'createObject': [ 'isObject', 'noop'],
|
'createObject': [ 'isObject', 'noop'],
|
||||||
'escapeHtmlChar': [],
|
'escapeHtmlChar': [],
|
||||||
'escapeStringChar': [],
|
'escapeStringChar': [],
|
||||||
'getArray': [],
|
'getArray': [],
|
||||||
'getIndexOf': ['basicIndexOf', 'indexOf'],
|
'getIndexOf': ['basicIndexOf', 'indexOf'],
|
||||||
'getObject': [],
|
'getObject': [],
|
||||||
'iteratorTemplate': [],
|
|
||||||
'isNode': [],
|
'isNode': [],
|
||||||
|
'iteratorTemplate': [],
|
||||||
|
'lodash': ['lodashWrapper'],
|
||||||
'lodashWrapper': ['wrapperToString', 'wrapperValueOf'],
|
'lodashWrapper': ['wrapperToString', 'wrapperValueOf'],
|
||||||
'noop': [],
|
'noop': [],
|
||||||
'overloadWrapper': ['createCallback'],
|
'overloadWrapper': ['createCallback'],
|
||||||
@@ -219,14 +220,14 @@
|
|||||||
'findWhere': ['where']
|
'findWhere': ['where']
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Used to track property dependencies */
|
/** Used to track variable dependencies of methods */
|
||||||
var propDependencyMap = {
|
var varDependencyMap = {
|
||||||
'at': ['support'],
|
'at': ['support'],
|
||||||
'bind': ['support'],
|
'bind': ['support'],
|
||||||
'bindKey': ['indicatorObject'],
|
'bindKey': ['indicatorObject'],
|
||||||
'clone': ['support'],
|
'clone': ['support'],
|
||||||
'createCallback': ['indicatorObject'],
|
'createCallback': ['indicatorObject'],
|
||||||
'createIterator': ['objectTypes', 'support'],
|
'createIterator': ['indicatorObject', 'iteratorObject', 'objectTypes'],
|
||||||
'isArguments': ['support'],
|
'isArguments': ['support'],
|
||||||
'isEmpty': ['support'],
|
'isEmpty': ['support'],
|
||||||
'isEqual': ['indicatorObject', 'support'],
|
'isEqual': ['indicatorObject', 'support'],
|
||||||
@@ -234,12 +235,12 @@
|
|||||||
'isPlainObject': ['support'],
|
'isPlainObject': ['support'],
|
||||||
'isRegExp': ['objectTypes'],
|
'isRegExp': ['objectTypes'],
|
||||||
'iteratorTemplate': ['support'],
|
'iteratorTemplate': ['support'],
|
||||||
'keys': ['support'],
|
'keys': ['iteratorObject', 'support'],
|
||||||
'merge': ['indicatorObject'],
|
'merge': ['indicatorObject'],
|
||||||
'partialRight': ['indicatorObject'],
|
'partialRight': ['indicatorObject'],
|
||||||
'reduceRight': ['support'],
|
'reduceRight': ['support'],
|
||||||
'shimIsPlainObject': ['support'],
|
'shimIsPlainObject': ['support'],
|
||||||
'template': ['templateSettings'],
|
'template': ['reInterpolate', 'templateSettings'],
|
||||||
'toArray': ['support']
|
'toArray': ['support']
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -430,6 +431,8 @@
|
|||||||
'freeGlobal',
|
'freeGlobal',
|
||||||
'nonEnumProps',
|
'nonEnumProps',
|
||||||
'shadowedProps',
|
'shadowedProps',
|
||||||
|
'support',
|
||||||
|
'templateSettings',
|
||||||
'whitespace'
|
'whitespace'
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -492,14 +495,18 @@
|
|||||||
'getObject',
|
'getObject',
|
||||||
'isNode',
|
'isNode',
|
||||||
'iteratorTemplate',
|
'iteratorTemplate',
|
||||||
|
'lodash',
|
||||||
'lodashWrapper',
|
'lodashWrapper',
|
||||||
|
'noop',
|
||||||
'overloadWrapper',
|
'overloadWrapper',
|
||||||
'releaseArray',
|
'releaseArray',
|
||||||
'releaseObject',
|
'releaseObject',
|
||||||
'shimIsPlainObject',
|
'shimIsPlainObject',
|
||||||
'shimKeys',
|
'shimKeys',
|
||||||
'slice',
|
'slice',
|
||||||
'unescapeHtmlChar'
|
'unescapeHtmlChar',
|
||||||
|
'wrapperToString',
|
||||||
|
'wrapperValueOf'
|
||||||
];
|
];
|
||||||
|
|
||||||
/** List of all methods */
|
/** List of all methods */
|
||||||
@@ -514,6 +521,11 @@
|
|||||||
/** List of Underscore methods */
|
/** List of Underscore methods */
|
||||||
var underscoreMethods = _.difference(allMethods, lodashOnlyMethods.concat(privateMethods));
|
var underscoreMethods = _.difference(allMethods, lodashOnlyMethods.concat(privateMethods));
|
||||||
|
|
||||||
|
/** List of all method variable dependencies */
|
||||||
|
var varDependencies = _.uniq(_.transform(varDependencyMap, function(result, varNames) {
|
||||||
|
push.apply(result, varNames);
|
||||||
|
}, []));
|
||||||
|
|
||||||
/*--------------------------------------------------------------------------*/
|
/*--------------------------------------------------------------------------*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2089,7 +2101,8 @@
|
|||||||
|
|
||||||
// backup dependencies to restore later
|
// backup dependencies to restore later
|
||||||
var dependencyMapBackup = _.cloneDeep(dependencyMap),
|
var dependencyMapBackup = _.cloneDeep(dependencyMap),
|
||||||
propDependencyMapBackup = _.cloneDeep(propDependencyMap);
|
varDependencyMapBackup = _.cloneDeep(varDependencyMap),
|
||||||
|
varMethodDependencyMapBackup = _.cloneDeep(varMethodDependencyMap);
|
||||||
|
|
||||||
// used to specify a custom IIFE to wrap Lo-Dash
|
// used to specify a custom IIFE to wrap Lo-Dash
|
||||||
var iife = options.reduce(function(result, value) {
|
var iife = options.reduce(function(result, value) {
|
||||||
@@ -2416,18 +2429,18 @@
|
|||||||
}
|
}
|
||||||
if (!isLodashMethod('forOwn')) {
|
if (!isLodashMethod('forOwn')) {
|
||||||
_.each(['contains', 'every', 'find', 'forOwn', 'some', 'transform'], function(methodName) {
|
_.each(['contains', 'every', 'find', 'forOwn', 'some', 'transform'], function(methodName) {
|
||||||
(propDependencyMap[methodName] || (propDependencyMap[methodName] = [])).push('indicatorObject');
|
(varDependencyMap[methodName] || (varDependencyMap[methodName] = [])).push('indicatorObject');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (!isLodashMethod('forIn')) {
|
if (!isLodashMethod('forIn')) {
|
||||||
_.each(['isEqual', 'shimIsPlainObject'], function(methodName) {
|
_.each(['isEqual', 'shimIsPlainObject'], function(methodName) {
|
||||||
(propDependencyMap[methodName] || (propDependencyMap[methodName] = [])).push('indicatorObject');
|
(varDependencyMap[methodName] || (varDependencyMap[methodName] = [])).push('indicatorObject');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
_.each(['basicEach', 'forEach', 'forIn', 'forOwn'], function(methodName) {
|
_.each(['basicEach', 'forEach', 'forIn', 'forOwn'], function(methodName) {
|
||||||
if (methodName == 'basicEach' || !isLodashMethod(methodName)) {
|
if (methodName == 'basicEach' || !isLodashMethod(methodName)) {
|
||||||
(propDependencyMap[methodName] || (propDependencyMap[methodName] = [])).push('indicatorObject');
|
(varDependencyMap[methodName] || (varDependencyMap[methodName] = [])).push('indicatorObject');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -2478,23 +2491,23 @@
|
|||||||
|
|
||||||
_.each(['assign', 'basicEach', 'defaults', 'forIn', 'forOwn', 'shimKeys'], function(methodName) {
|
_.each(['assign', 'basicEach', 'defaults', 'forIn', 'forOwn', 'shimKeys'], function(methodName) {
|
||||||
if (!(isUnderscore && isLodashMethod(methodName))) {
|
if (!(isUnderscore && isLodashMethod(methodName))) {
|
||||||
var dependencies = dependencyMap[methodName] = _.without(dependencyMap[methodName], 'createIterator');
|
var deps = dependencyMap[methodName] = _.without(dependencyMap[methodName], 'createIterator');
|
||||||
(propDependencyMap[methodName] || (propDependencyMap[methodName] = [])).push('objectTypes');
|
(varDependencyMap[methodName] || (varDependencyMap[methodName] = [])).push('objectTypes');
|
||||||
|
|
||||||
if (methodName != 'shimKeys') {
|
if (methodName != 'shimKeys') {
|
||||||
dependencies.push('createCallback');
|
deps.push('createCallback');
|
||||||
}
|
}
|
||||||
if (/^(?:assign|basicEach|defaults|forOwn)$/.test(methodName)) {
|
if (/^(?:assign|basicEach|defaults|forOwn)$/.test(methodName)) {
|
||||||
dependencies.push('keys');
|
deps.push('keys');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
_.forOwn(propDependencyMap, function(dependencies, methodName) {
|
_.forOwn(varDependencyMap, function(deps, methodName) {
|
||||||
if (methodName != 'bind' &&
|
if (methodName != 'bind' &&
|
||||||
!(isMobile && methodName == 'keys') &&
|
!(isMobile && methodName == 'keys') &&
|
||||||
!(isUnderscore && isLodashMethod(methodName))) {
|
!(isUnderscore && isLodashMethod(methodName))) {
|
||||||
propDependencyMap[methodName] = _.without(dependencies, 'support');
|
varDependencyMap[methodName] = _.without(deps, 'support');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -2608,7 +2621,7 @@
|
|||||||
|
|
||||||
// replace `_.keys` with `shimKeys`
|
// replace `_.keys` with `shimKeys`
|
||||||
source = source.replace(
|
source = source.replace(
|
||||||
matchFunction(source, 'keys').replace(/[\s\S]+?var keys *= */, ''),
|
matchFunction(source, 'keys').replace(/[\s\S]+?var keys.*= */, ''),
|
||||||
matchFunction(source, 'shimKeys').replace(/[\s\S]+?var shimKeys *= */, '')
|
matchFunction(source, 'shimKeys').replace(/[\s\S]+?var shimKeys *= */, '')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -3884,7 +3897,8 @@
|
|||||||
|
|
||||||
// restore dependency maps
|
// restore dependency maps
|
||||||
dependencyMap = dependencyMapBackup;
|
dependencyMap = dependencyMapBackup;
|
||||||
propDependencyMap = propDependencyMapBackup;
|
varDependencyMap = varDependencyMapBackup;
|
||||||
|
varMethodDependencyMap = varMethodDependencyMapBackup;
|
||||||
|
|
||||||
// output debug build
|
// output debug build
|
||||||
if (!isMinify && (isCustom || isDebug || isTemplate)) {
|
if (!isMinify && (isCustom || isDebug || isTemplate)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user