mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-08 02:17:48 +00:00
Remove getCategoryDependencies, getSupport, removeSupport functions from build.js.
Former-commit-id: b55fb46631bb94ffbe986a031d09bf7aefc6ba99
This commit is contained in:
59
build.js
59
build.js
@@ -966,22 +966,6 @@
|
|||||||
}) || '';
|
}) || '';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets an array of category dependencies for a given category.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {String} category The category.
|
|
||||||
* @returns {Array} Returns an array of cetegory dependants.
|
|
||||||
*/
|
|
||||||
function getCategoryDependencies(category) {
|
|
||||||
var methods = _.uniq(_.transform(getMethodsByCategory(category), function(result, methodName) {
|
|
||||||
push.apply(result, getDependencies(methodName));
|
|
||||||
}));
|
|
||||||
|
|
||||||
var categories = _.uniq(methods.map(getCategory));
|
|
||||||
return _.without(categories, category);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the `createObject` fork from `source`.
|
* Gets the `createObject` fork from `source`.
|
||||||
*
|
*
|
||||||
@@ -1193,22 +1177,6 @@
|
|||||||
) || methodName;
|
) || methodName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the `support` object assignment snippet from `source`.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {String} source The source to inspect.
|
|
||||||
* @returns {String} Returns the `support` snippet.
|
|
||||||
*/
|
|
||||||
function getSupport(source) {
|
|
||||||
var result = source.match(RegExp(
|
|
||||||
multilineComment +
|
|
||||||
'( *)var support *=[\\s\\S]+?\n\\1}\\(1\\)\\);\\n'
|
|
||||||
));
|
|
||||||
|
|
||||||
return result ? result[0] : '';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a sorted array of all variables defined outside of Lo-Dash methods.
|
* Creates a sorted array of all variables defined outside of Lo-Dash methods.
|
||||||
*
|
*
|
||||||
@@ -1305,7 +1273,7 @@
|
|||||||
|
|
||||||
var result = source.match(RegExp(
|
var result = source.match(RegExp(
|
||||||
(varName != 'freeGlobal' && _.contains(complexVars, varName))
|
(varName != 'freeGlobal' && _.contains(complexVars, varName))
|
||||||
? '^' + indentA + 'var ' + varName + ' *=[\\s\\S]+?(?:\\(function[\\s\\S]+?\\(\\)\\);\\n(?=\\n)|[;}]\\n(?=\\n(?!\\s*\\(func)))'
|
? '^' + indentA + 'var ' + varName + ' *=[\\s\\S]+?(?:\\(function[\\s\\S]+?\\([^)]*\\)\\);\\n(?=\\n)|[;}]\\n(?=\\n(?!\\s*\\(func)))'
|
||||||
: '^(' + indentA + ')var ' + varName + ' *(?:|= *(?:.+?(?:|&&\\n[^;]+)|(?:\\w+\\(|[{[(]\\n)[\\s\\S]+?\\n\\1[^\\n ]+?));\\n|' +
|
: '^(' + indentA + ')var ' + varName + ' *(?:|= *(?:.+?(?:|&&\\n[^;]+)|(?:\\w+\\(|[{[(]\\n)[\\s\\S]+?\\n\\1[^\\n ]+?));\\n|' +
|
||||||
'^' + indentA + 'var ' + varName + ' *=.+?,\\n(?= *\\w+ *=)|' +
|
'^' + indentA + 'var ' + varName + ' *=.+?,\\n(?= *\\w+ *=)|' +
|
||||||
'^' + indentB + varName + ' *=.+?[,;]\\n'
|
'^' + indentB + varName + ' *=.+?[,;]\\n'
|
||||||
@@ -1582,8 +1550,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes all pseudo private properties from `source`. If a `propName` is
|
* Removes all pseudo private Lo-Dash properties from `source`. If a `propName`
|
||||||
* specified, only the specified property is removed.
|
* is specified, only the specified property is removed.
|
||||||
*
|
*
|
||||||
* @private
|
* @private
|
||||||
* @param {String} source The source to process.
|
* @param {String} source The source to process.
|
||||||
@@ -1654,17 +1622,6 @@
|
|||||||
return source.replace(/(["'])(?:(?!\1)[^\n\\]|\\.)*\1/g, '');
|
return source.replace(/(["'])(?:(?!\1)[^\n\\]|\\.)*\1/g, '');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Removes the `support` object declaration from `source`.
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
* @param {String} source The source to process.
|
|
||||||
* @returns {String} Returns the modified source.
|
|
||||||
*/
|
|
||||||
function removeSupport(source) {
|
|
||||||
return source.replace(getSupport(source), '');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes all `support.argsClass` references from `source`.
|
* Removes all `support.argsClass` references from `source`.
|
||||||
*
|
*
|
||||||
@@ -1907,7 +1864,7 @@
|
|||||||
* @returns {String} Returns the modified source.
|
* @returns {String} Returns the modified source.
|
||||||
*/
|
*/
|
||||||
function removeSupportProp(source, propName) {
|
function removeSupportProp(source, propName) {
|
||||||
return source.replace(getSupport(source), function(match) {
|
return source.replace(matchVar(source, 'support'), function(match) {
|
||||||
return match.replace(RegExp(
|
return match.replace(RegExp(
|
||||||
multilineComment +
|
multilineComment +
|
||||||
// match a `try` block
|
// match a `try` block
|
||||||
@@ -1929,15 +1886,11 @@
|
|||||||
* @returns {String} Returns the modified source.
|
* @returns {String} Returns the modified source.
|
||||||
*/
|
*/
|
||||||
function removeVar(source, varName) {
|
function removeVar(source, varName) {
|
||||||
// defer to specialized removal functions
|
|
||||||
if (varName == 'support') {
|
|
||||||
return removeSupport(source);
|
|
||||||
}
|
|
||||||
// simplify complex variable assignments
|
// simplify complex variable assignments
|
||||||
if (_.contains(complexVars, varName)) {
|
if (_.contains(complexVars, varName)) {
|
||||||
source = source.replace(RegExp(
|
source = source.replace(RegExp(
|
||||||
'^( *var ' + varName + ') *=[\\s\\S]+?' +
|
'^( *var ' + varName + ') *=[\\s\\S]+?' +
|
||||||
'(?:\\(function[\\s\\S]+?\\(\\)\\);(?=\\n\\n)|' +
|
'(?:\\(function[\\s\\S]+?\\([^)]*\\)\\);(?=\\n\\n)|' +
|
||||||
'[;}](?=\\n\\n(?!\\s*\\(func)))'
|
'[;}](?=\\n\\n(?!\\s*\\(func)))'
|
||||||
, 'm'), '$1 = null;')
|
, 'm'), '$1 = null;')
|
||||||
}
|
}
|
||||||
@@ -3806,7 +3759,7 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
// remove code used to resolve unneeded `support` properties
|
// remove code used to resolve unneeded `support` properties
|
||||||
source = source.replace(getSupport(source), function(match) {
|
source = source.replace(matchVar(source, 'support'), function(match) {
|
||||||
return match.replace(/^ *\(function[\s\S]+?\n(( *)var ctor *=[\s\S]+?(?:\n *for.+)+\n)([\s\S]+?)}\(1\)\);\n/m, function(match, setup, indent, body) {
|
return match.replace(/^ *\(function[\s\S]+?\n(( *)var ctor *=[\s\S]+?(?:\n *for.+)+\n)([\s\S]+?)}\(1\)\);\n/m, function(match, setup, indent, body) {
|
||||||
var modified = setup;
|
var modified = setup;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user