Update dependency maps and remove properties in pre-compile.js that no longer exist.

Former-commit-id: d24f0ac4575ab1c2d12f3e8b4bc5f089424407ca
This commit is contained in:
John-David Dalton
2013-06-06 08:44:20 -07:00
parent 7dfa383968
commit a5d459749f
2 changed files with 46 additions and 33 deletions

View File

@@ -96,7 +96,7 @@
'defaults': ['createIterator', 'isArguments', 'keys'], 'defaults': ['createIterator', 'isArguments', 'keys'],
'defer': ['bind'], 'defer': ['bind'],
'delay': [], 'delay': [],
'difference': ['createCache'], 'difference': ['cacheIndexOf', 'createCache', 'getIndexOf', 'releaseObject'],
'escape': ['escapeHtmlChar'], 'escape': ['escapeHtmlChar'],
'every': ['basicEach', 'createCallback', 'isArray'], 'every': ['basicEach', 'createCallback', 'isArray'],
'filter': ['basicEach', 'createCallback', 'isArray'], 'filter': ['basicEach', 'createCallback', 'isArray'],
@@ -114,7 +114,7 @@
'identity': [], 'identity': [],
'indexOf': ['basicIndexOf', 'sortedIndex'], 'indexOf': ['basicIndexOf', 'sortedIndex'],
'initial': ['slice'], 'initial': ['slice'],
'intersection': ['createCache', 'getArray', 'releaseArray'], 'intersection': ['cacheIndexOf', 'createCache', 'getArray', 'getIndexOf', 'releaseArray', 'releaseObject'],
'invert': ['keys'], 'invert': ['keys'],
'invoke': ['forEach'], 'invoke': ['forEach'],
'isArguments': [], 'isArguments': [],
@@ -173,7 +173,7 @@
'transform': ['createCallback', 'createObject', 'forOwn', 'isArray'], 'transform': ['createCallback', 'createObject', 'forOwn', 'isArray'],
'unescape': ['unescapeHtmlChar'], 'unescape': ['unescapeHtmlChar'],
'union': ['isArray', 'uniq'], 'union': ['isArray', 'uniq'],
'uniq': ['createCache', 'getArray', 'getIndexOf', 'overloadWrapper', 'releaseArray'], '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', 'lodashWrapper'],
@@ -187,10 +187,12 @@
// private methods // private methods
'basicEach': ['createIterator', 'isArguments', 'isArray', 'isString', 'keys'], 'basicEach': ['createIterator', 'isArguments', 'isArray', 'isString', 'keys'],
'basicIndexOf': [], 'basicIndexOf': [],
'cacheIndexOf': ['basicIndexOf'],
'cachePush': [],
'charAtCallback': [], 'charAtCallback': [],
'compareAscending': [], 'compareAscending': [],
'createBound': ['createObject', 'isFunction', 'isObject'], 'createBound': ['createObject', 'isFunction', 'isObject'],
'createCache': ['basicIndexOf', 'getArray', 'getIndexOf', 'getObject', 'releaseObject'], 'createCache': ['cachePush', 'getObject', 'releaseObject'],
'createIterator': ['getObject', 'iteratorTemplate', 'releaseObject'], 'createIterator': ['getObject', 'iteratorTemplate', 'releaseObject'],
'createObject': [ 'isObject', 'noop'], 'createObject': [ 'isObject', 'noop'],
'escapeHtmlChar': [], 'escapeHtmlChar': [],
@@ -218,7 +220,7 @@
/** Used to inline `iteratorTemplate` */ /** Used to inline `iteratorTemplate` */
var iteratorOptions = [ var iteratorOptions = [
'args', 'args',
'arrays', 'array',
'bottom', 'bottom',
'firstArg', 'firstArg',
'init', 'init',
@@ -334,6 +336,8 @@
var privateMethods = [ var privateMethods = [
'basicEach', 'basicEach',
'basicIndex', 'basicIndex',
'cacheIndexOf',
'cachePush',
'charAtCallback', 'charAtCallback',
'compareAscending', 'compareAscending',
'createBound', 'createBound',
@@ -1077,31 +1081,41 @@
.replace(/,(?=\s*\))/, ''); .replace(/,(?=\s*\))/, '');
}); });
return removeFromObjectPoolFunctions(source, identifier); return removeFromGetObject(source, identifier);
} }
/** /**
* Removes all references to `identifier` from the `objectPool` functions in `source`. * Removes all references to `identifier` from `getObject` in `source`.
* *
* @private * @private
* @param {String} source The source to process. * @param {String} source The source to process.
* @param {String} identifier The name of the property to remove. * @param {String} identifier The name of the property to remove.
* @returns {String} Returns the modified source. * @returns {String} Returns the modified source.
*/ */
function removeFromObjectPoolFunctions(source, identifier) { function removeFromGetObject(source, identifier) {
_.each(['getObject', 'releaseObject'], function(methodName) { return source.replace(matchFunction(source, 'getObject'), function(match) {
source = source.replace(matchFunction(source, methodName), function(match) { // remove object property assignments
// remove object property assignments return match
return match .replace(RegExp("^(?: *\\/\\/.*\\n)* *'" + identifier + "':.+\\n+", 'm'), '')
.replace(RegExp("^(?: *\\/\\/.*\\n)* *'" + identifier + "':.+\\n+", 'm'), '') .replace(/,(?=\s*})/, '');
.replace(/,(?=\s*})/, '') });
.replace(RegExp("^(?: *\\/\\/.*\\n)* *(\\w+)\\." + identifier + " *= *(.+\\n+)", 'm'), function(match, object, postlude) { }
return RegExp('\\b' + object + '\\.').test(postlude) ? postlude : '';
}); /**
* Removes all references to `identifier` from `releaseObject` in `source`.
*
* @private
* @param {String} source The source to process.
* @param {String} identifier The name of the property to remove.
* @returns {String} Returns the modified source.
*/
function removeFromReleaseObject(source, identifier) {
return source.replace(matchFunction(source, 'releaseObject'), function(match) {
// remove object property assignments
return match.replace(RegExp("(?:(^ *)| *)(\\w+)\\." + identifier + " *= *(.+\\n+)", 'm'), function(match, indent, object, postlude) {
return (indent || '') + RegExp('\\b' + object + '\\.').test(postlude) ? postlude : '';
}); });
}); });
return source;
} }
/** /**
@@ -1481,7 +1495,7 @@
// remove `support.unindexedChars` from `iteratorTemplate` // remove `support.unindexedChars` from `iteratorTemplate`
source = source.replace(getIteratorTemplate(source), function(match) { source = source.replace(getIteratorTemplate(source), function(match) {
return match return match
.replace(/'if *\(<%= *arrays *%>[^']*/, '$&\\n') .replace(/'if *\(<%= *array *%>[^']*/, '$&\\n')
.replace(/(?: *\/\/.*\n)* *["']( *)<% *if *\(support\.unindexedChars[\s\S]+?["']\1<% *} *%>.+/, ''); .replace(/(?: *\/\/.*\n)* *["']( *)<% *if *\(support\.unindexedChars[\s\S]+?["']\1<% *} *%>.+/, '');
}); });
@@ -1999,7 +2013,7 @@
_.each(['difference', 'intersection', 'uniq'], function(methodName) { _.each(['difference', 'intersection', 'uniq'], function(methodName) {
if (!useLodashMethod(methodName)) { if (!useLodashMethod(methodName)) {
dependencyMap[methodName] = ['getIndexOf'].concat(_.without(dependencyMap[methodName], 'createCache')); dependencyMap[methodName] = ['getIndexOf'].concat(_.without(dependencyMap[methodName], 'cacheIndexOf', 'createCache'));
} }
}); });
@@ -2291,9 +2305,9 @@
}); });
}); });
// replace `arrays` property value of `eachIteratorOptions` with `false` // replace `array` property value of `eachIteratorOptions` with `false`
source = source.replace(/^( *)var eachIteratorOptions *= *[\s\S]+?\n\1};\n/m, function(match) { source = source.replace(/^( *)var eachIteratorOptions *= *[\s\S]+?\n\1};\n/m, function(match) {
return match.replace(/(^ *'arrays':)[^,]+/m, '$1 false'); return match.replace(/(^ *'array':)[^,]+/m, '$1 false');
}); });
} }
} }
@@ -3033,7 +3047,9 @@
source = removeFunction(source, 'createIterator'); source = removeFunction(source, 'createIterator');
iteratorOptions.forEach(function(prop) { iteratorOptions.forEach(function(prop) {
source = removeFromObjectPoolFunctions(source, prop); if (prop != 'array') {
source = removeFromGetObject(source, prop);
}
}); });
// inline all functions defined with `createIterator` // inline all functions defined with `createIterator`
@@ -3309,9 +3325,11 @@
source = removeVar(source, 'whitespace'); source = removeVar(source, 'whitespace');
} }
if (isRemoved(source, 'sortBy')) { if (isRemoved(source, 'sortBy')) {
source = removeFromObjectPoolFunctions(source, 'criteria'); _.each([removeFromGetObject, removeFromReleaseObject], function(func) {
source = removeFromObjectPoolFunctions(source, 'index'); source = func(source, 'criteria');
source = removeFromObjectPoolFunctions(source, 'value'); source = func(source, 'index');
source = func(source, 'value');
});
} }
if (isRemoved(source, 'template')) { if (isRemoved(source, 'template')) {
// remove `templateSettings` assignment // remove `templateSettings` assignment

View File

@@ -48,7 +48,7 @@
/** Used to minify `iteratorTemplate` data properties */ /** Used to minify `iteratorTemplate` data properties */
var iteratorOptions = [ var iteratorOptions = [
'args', 'args',
'arrays', 'array',
'bottom', 'bottom',
'firstArg', 'firstArg',
'init', 'init',
@@ -326,14 +326,9 @@
]; ];
var props = [ var props = [
'array',
'cache', 'cache',
'contains',
'criteria', 'criteria',
'index', 'index',
'indexOf',
'initedArray',
'release',
'value' 'value'
]; ];