mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-11 11:27:50 +00:00
Ensure --output paths containing build commands are processed w/o problems.
Former-commit-id: 4790e4e2ea2eba6af8c93e3576858d1f6ff45e70
This commit is contained in:
24
build.js
24
build.js
@@ -1638,7 +1638,7 @@
|
|||||||
|
|
||||||
// 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) {
|
||||||
var match = value.match(/iife=(.*)/);
|
var match = value.match(/^iife=(.*)$/);
|
||||||
return match ? match[1] : result;
|
return match ? match[1] : result;
|
||||||
}, null);
|
}, null);
|
||||||
|
|
||||||
@@ -1693,7 +1693,7 @@
|
|||||||
|
|
||||||
// used to specify the ways to export the `lodash` function
|
// used to specify the ways to export the `lodash` function
|
||||||
var exportsOptions = options.reduce(function(result, value) {
|
var exportsOptions = options.reduce(function(result, value) {
|
||||||
return /exports/.test(value) ? optionToArray(value).sort() : result;
|
return /^exports=.*$/.test(value) ? optionToArray(value).sort() : result;
|
||||||
}, isUnderscore
|
}, isUnderscore
|
||||||
? ['commonjs', 'global', 'node']
|
? ['commonjs', 'global', 'node']
|
||||||
: exportsAll.slice()
|
: exportsAll.slice()
|
||||||
@@ -1701,13 +1701,13 @@
|
|||||||
|
|
||||||
// used to specify the AMD module ID of Lo-Dash used by precompiled templates
|
// used to specify the AMD module ID of Lo-Dash used by precompiled templates
|
||||||
var moduleId = options.reduce(function(result, value) {
|
var moduleId = options.reduce(function(result, value) {
|
||||||
var match = value.match(/moduleId=(.*)/);
|
var match = value.match(/^moduleId=(.*)$/);
|
||||||
return match ? match[1] : result;
|
return match ? match[1] : result;
|
||||||
}, 'lodash');
|
}, 'lodash');
|
||||||
|
|
||||||
// used to specify the output path for builds
|
// used to specify the output path for builds
|
||||||
var outputPath = options.reduce(function(result, value, index) {
|
var outputPath = options.reduce(function(result, value, index) {
|
||||||
if (/-o|--output/.test(value)) {
|
if (/^(?:-o|--output)$/.test(value)) {
|
||||||
result = options[index + 1];
|
result = options[index + 1];
|
||||||
var dirname = path.dirname(result);
|
var dirname = path.dirname(result);
|
||||||
fs.mkdirpSync(dirname);
|
fs.mkdirpSync(dirname);
|
||||||
@@ -1718,7 +1718,7 @@
|
|||||||
|
|
||||||
// used to match external template files to precompile
|
// used to match external template files to precompile
|
||||||
var templatePattern = options.reduce(function(result, value) {
|
var templatePattern = options.reduce(function(result, value) {
|
||||||
var match = value.match(/template=(.+)$/);
|
var match = value.match(/^template=(.+)$/);
|
||||||
return match
|
return match
|
||||||
? path.join(fs.realpathSync(path.dirname(match[1])), path.basename(match[1]))
|
? path.join(fs.realpathSync(path.dirname(match[1])), path.basename(match[1]))
|
||||||
: result;
|
: result;
|
||||||
@@ -1726,7 +1726,7 @@
|
|||||||
|
|
||||||
// used as the template settings for precompiled templates
|
// used as the template settings for precompiled templates
|
||||||
var templateSettings = options.reduce(function(result, value) {
|
var templateSettings = options.reduce(function(result, value) {
|
||||||
var match = value.match(/settings=(.+)$/);
|
var match = value.match(/^settings=(.+)$/);
|
||||||
return match
|
return match
|
||||||
? _.assign(result, Function('return {' + match[1].replace(/^{|}$/g, '') + '}')())
|
? _.assign(result, Function('return {' + match[1].replace(/^{|}$/g, '') + '}')())
|
||||||
: result;
|
: result;
|
||||||
@@ -1759,30 +1759,30 @@
|
|||||||
|
|
||||||
// methods to include in the build
|
// methods to include in the build
|
||||||
var includeMethods = options.reduce(function(accumulator, value) {
|
var includeMethods = options.reduce(function(accumulator, value) {
|
||||||
return /include/.test(value)
|
return /^include=.*$/.test(value)
|
||||||
? _.union(accumulator, optionToMethodsArray(source, value))
|
? _.union(accumulator, optionToMethodsArray(source, value))
|
||||||
: accumulator;
|
: 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)
|
||||||
? _.union(accumulator, optionToMethodsArray(source, value))
|
? _.union(accumulator, optionToMethodsArray(source, value))
|
||||||
: accumulator;
|
: accumulator;
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
// methods to add to the build
|
// methods to add to the build
|
||||||
var plusMethods = options.reduce(function(accumulator, value) {
|
var plusMethods = options.reduce(function(accumulator, value) {
|
||||||
return /plus/.test(value)
|
return /^plus=.*$/.test(value)
|
||||||
? _.union(accumulator, optionToMethodsArray(source, value))
|
? _.union(accumulator, optionToMethodsArray(source, value))
|
||||||
: accumulator;
|
: accumulator;
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
// methods categories to include in the build
|
// methods categories to include in the build
|
||||||
var categories = options.reduce(function(accumulator, value) {
|
var categories = options.reduce(function(accumulator, value) {
|
||||||
if (/category|exclude|include|minus|plus/.test(value)) {
|
if (/^(category|exclude|include|minus|plus)=.+$/.test(value)) {
|
||||||
var array = optionToArray(value);
|
var array = optionToArray(value);
|
||||||
accumulator = _.union(accumulator, /category/.test(value)
|
accumulator = _.union(accumulator, /^category=.*$/.test(value)
|
||||||
? array.map(capitalize)
|
? array.map(capitalize)
|
||||||
: array.filter(function(category) { return /^[A-Z]/.test(category); })
|
: array.filter(function(category) { return /^[A-Z]/.test(category); })
|
||||||
);
|
);
|
||||||
@@ -3131,7 +3131,7 @@
|
|||||||
// flag to specify creating a custom build
|
// flag to specify creating a custom build
|
||||||
var isCustom = (
|
var isCustom = (
|
||||||
isLegacy || isMapped || isModern || isNoDep || isStrict || isUnderscore || outputPath ||
|
isLegacy || isMapped || isModern || isNoDep || isStrict || isUnderscore || outputPath ||
|
||||||
/(?:category|exclude|exports|iife|include|minus|plus)=/.test(options) ||
|
/(?:category|exclude|exports|iife|include|minus|plus)=.*$/.test(options) ||
|
||||||
!_.isEqual(exportsOptions, exportsAll)
|
!_.isEqual(exportsOptions, exportsAll)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -1334,7 +1334,8 @@
|
|||||||
'--output b.js',
|
'--output b.js',
|
||||||
'-o ' + path.join('a', 'b', 'c.js'),
|
'-o ' + path.join('a', 'b', 'c.js'),
|
||||||
'-o ' + relativePrefix + path.join('a', 'b', 'c.js'),
|
'-o ' + relativePrefix + path.join('a', 'b', 'c.js'),
|
||||||
'-o ' + path.join(nestedPath, 'c.js')
|
'-o ' + path.join(nestedPath, 'c.js'),
|
||||||
|
'-o name_with_keywords_like_category_include_exclude_plus_minus.js'
|
||||||
];
|
];
|
||||||
|
|
||||||
commands.forEach(function(command) {
|
commands.forEach(function(command) {
|
||||||
|
|||||||
Reference in New Issue
Block a user