mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-15 13:17:50 +00:00
Fix modularize legacy builds.
Former-commit-id: 17b09cce67bdf0ec2fd7373beb5b58240b08877b
This commit is contained in:
36
build.js
36
build.js
@@ -265,13 +265,13 @@
|
||||
/** Used to track Lo-Dash property dependencies of identifiers */
|
||||
var propDependencyMap = {
|
||||
'at': ['support'],
|
||||
'baseClone': ['support'],
|
||||
'baseIsEqual': ['support'],
|
||||
'bind': ['support'],
|
||||
'clone': ['support'],
|
||||
'createBound': ['support'],
|
||||
'forEachRight': ['support'],
|
||||
'isArguments': ['support'],
|
||||
'isEmpty': ['support'],
|
||||
'isEqual': ['support'],
|
||||
'isPlainObject': ['support'],
|
||||
'iteratorTemplate': ['support'],
|
||||
'keys': ['support'],
|
||||
@@ -1439,22 +1439,6 @@
|
||||
return result ? result[0] : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the `templateSettings` assignment from `source`.
|
||||
*
|
||||
* @private
|
||||
* @param {String} source The source to inspect.
|
||||
* @returns {String} Returns the assignment.
|
||||
*/
|
||||
function getTemplateSettings(source) {
|
||||
var result = source.match(RegExp(
|
||||
multilineComment +
|
||||
'( *)(?:var +|lodash\\.)templateSettings *=[\\s\\S]+?\\n\\1};\\n'
|
||||
));
|
||||
|
||||
return result ? result[0] : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a sorted array of all variables defined outside of Lo-Dash functions.
|
||||
*
|
||||
@@ -3942,7 +3926,7 @@
|
||||
.replace(/iteratorTemplate *&& */g, '')
|
||||
.replace(/iteratorTemplate\s*\?\s*([^:]+?)\s*:[^,;]+/g, '$1');
|
||||
});
|
||||
}
|
||||
|
||||
if (isModern || isUnderscore) {
|
||||
iteratorOptions.forEach(function(prop) {
|
||||
if (prop != 'array') {
|
||||
@@ -4045,6 +4029,7 @@
|
||||
}, match);
|
||||
});
|
||||
}
|
||||
}
|
||||
if (isModularize) {
|
||||
source = removeGetIndexOf(source);
|
||||
|
||||
@@ -4062,15 +4047,18 @@
|
||||
return match.replace(/(?: *\/\/.*\n)*( *)if *\(!source[\s\S]+?\n\1}/, '');
|
||||
});
|
||||
|
||||
// remove debug sourceURL use in `_.template`
|
||||
source = source.replace(matchFunction(source, 'template'), function(match) {
|
||||
return match.replace(/(?:\s*\/\/.*\n)* *var sourceURL[^;]+;|\+ *sourceURL/g, '');
|
||||
});
|
||||
|
||||
// replace `lodash` use in `_.templateSettings.imports`
|
||||
source = source.replace(matchProp(source, 'templateSettings'), function(match) {
|
||||
return match.replace(/(:\s*)lodash\b/, "$1{ 'escape': escape }");
|
||||
});
|
||||
|
||||
source = source.replace(matchFunction(source, 'template'), function(match) {
|
||||
return match
|
||||
// assign `settings` variable from the reassigned `templateSettings.imports`
|
||||
.replace(/= *templateSettings\b/, '$&.imports._.templateSettings')
|
||||
// remove debug sourceURL use in `_.template`
|
||||
.replace(/(?:\s*\/\/.*\n)* *var sourceURL[^;]+;|\+ *sourceURL/g, '');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user