mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-10 02:47:50 +00:00
Add includeVars and allow include=none in build.js.
Former-commit-id: 7a77e5ea2920c930eb4ca1fee18661819e366282
This commit is contained in:
18
build.js
18
build.js
@@ -2225,6 +2225,13 @@
|
|||||||
: accumulator;
|
: accumulator;
|
||||||
}, categories.slice());
|
}, categories.slice());
|
||||||
|
|
||||||
|
// variables to include in the build
|
||||||
|
var includeVars = options.reduce(function(accumulator, value) {
|
||||||
|
return /^vars=.*$/.test(value)
|
||||||
|
? _.union(accumulator, optionToArray(value))
|
||||||
|
: accumulator;
|
||||||
|
}, []);
|
||||||
|
|
||||||
// methods to remove from the build
|
// methods to remove from the build
|
||||||
var minusMethods = options.reduce(function(accumulator, value) {
|
var minusMethods = options.reduce(function(accumulator, value) {
|
||||||
return /^(?:exclude|minus)=.*$/.test(value)
|
return /^(?:exclude|minus)=.*$/.test(value)
|
||||||
@@ -2266,7 +2273,7 @@
|
|||||||
// used to detect invalid command-line arguments
|
// used to detect invalid command-line arguments
|
||||||
var invalidArgs = _.reject(options.slice(reNode.test(options[0]) ? 2 : 0), function(value, index, options) {
|
var invalidArgs = _.reject(options.slice(reNode.test(options[0]) ? 2 : 0), function(value, index, options) {
|
||||||
if (/^(?:-o|--output)$/.test(options[index - 1]) ||
|
if (/^(?:-o|--output)$/.test(options[index - 1]) ||
|
||||||
/^(?:category|exclude|exports|iife|include|moduleId|minus|plus|settings|template)=[\s\S]*$/.test(value)) {
|
/^(?:category|exclude|exports|iife|include|moduleId|minus|plus|settings|template|vars)=[\s\S]*$/.test(value)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
var result = _.contains([
|
var result = _.contains([
|
||||||
@@ -2328,7 +2335,7 @@
|
|||||||
'validEntries': allMethods
|
'validEntries': allMethods
|
||||||
}
|
}
|
||||||
}, function(data, commandName) {
|
}, function(data, commandName) {
|
||||||
invalidArgs = _.difference(data.entries, data.validEntries);
|
invalidArgs = _.difference(data.entries, data.validEntries.concat('none'));
|
||||||
if (invalidArgs.length) {
|
if (invalidArgs.length) {
|
||||||
warnings.push('Invalid `' + commandName + '` entr' + (invalidArgs.length > 1 ? 'ies' : 'y') + ' passed: ' + invalidArgs.join(', '));
|
warnings.push('Invalid `' + commandName + '` entr' + (invalidArgs.length > 1 ? 'ies' : 'y') + ' passed: ' + invalidArgs.join(', '));
|
||||||
}
|
}
|
||||||
@@ -2532,6 +2539,13 @@
|
|||||||
if (!result) {
|
if (!result) {
|
||||||
result = lodashMethods.slice();
|
result = lodashMethods.slice();
|
||||||
}
|
}
|
||||||
|
// remove special "none" entry
|
||||||
|
if (result == 'none') {
|
||||||
|
result = [];
|
||||||
|
} else {
|
||||||
|
result = _.without(result, 'none');
|
||||||
|
}
|
||||||
|
// add and subtract method names
|
||||||
if (plusMethods.length) {
|
if (plusMethods.length) {
|
||||||
result = _.union(result, plusMethods);
|
result = _.union(result, plusMethods);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user