From 0f9d20129dc43d36e45f818c77577fdcc1552eab Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sun, 14 Jul 2013 13:10:46 -0700 Subject: [PATCH 1/2] Ensure category modules reference dependencies with relative paths. Former-commit-id: 5a12a4b2f4cd3a56456238303e7d941b06f76d9f --- build.js | 7 +++++-- test/index.html | 1 - 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/build.js b/build.js index 7bafac8f6..2d8f34e24 100644 --- a/build.js +++ b/build.js @@ -829,8 +829,11 @@ fromPath || (fromPath = ''); return dependencies.map(function(depName) { var toPath = getPath(depName), - relative = (path.relative(fromPath, toPath) || '.').replace(RegExp(path.sepEscaped, 'g'), sep); + relative = path.relative(fromPath, toPath).replace(RegExp(path.sepEscaped, 'g'), sep); + if (relative.charAt(0) != '.') { + relative = '.' + (relative ? sep + relative : ''); + } return relative + sep + depName; }); }; @@ -899,7 +902,7 @@ (function() { var deps = _.invoke(categories, 'toLowerCase'), depArgs = deps.join(', '), - depPaths = "['" + deps.join("', './") + "'], ", + depPaths = "['" + (deps.length ? './' + deps.join("', './") : '') + "'], ", iife = []; if (isAMD) { diff --git a/test/index.html b/test/index.html index 0af34d0b7..6372bb415 100644 --- a/test/index.html +++ b/test/index.html @@ -69,7 +69,6 @@ 'test.js' ); - console.log(testPath) QUnit.config.autostart = false; // load Lo-Dash as a module From 23cd5b906b89838dfcff35417864f9bd2505736b Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sun, 14 Jul 2013 13:40:17 -0700 Subject: [PATCH 2/2] Minify `dependencyObject` properties correctly. Former-commit-id: a0d57812420a347938a438d9ecb13467401bcc96 --- build/pre-compile.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/build/pre-compile.js b/build/pre-compile.js index a4ecb3bc8..a73da1271 100644 --- a/build/pre-compile.js +++ b/build/pre-compile.js @@ -331,6 +331,11 @@ 'sortBy' ]; + var depObjProps = [ + 'isEqual', + 'keys' + ]; + var props = [ 'cache', 'criteria', @@ -339,18 +344,19 @@ ]; // minify `dependencyObject` properties - source = source.replace(/\b(dependencyObject(?:\.|\['))\w+/g, function(match, prelude) { - return prelude + minNames[iteratorOptions.length + props.length]; + depObjProps.forEach(function(prop, index) { + source = source.replace(RegExp("\\b(dependencyObject(?:\\.|\\['))" + prop + '\\b', 'g'), function(match, prelude) { + return prelude + minNames[iteratorOptions.length + props.length + index]; + }); }); + // minify other properties used in functions var snippets = source.match(RegExp('^( *)(?:var|function) +(?:' + funcNames.join('|') + ')\\b[\\s\\S]+?\\n\\1}', 'gm')); if (!snippets) { return; } snippets.forEach(function(snippet) { var modified = snippet; - - // minify properties props.forEach(function(prop, index) { // use minified names different than those chosen for `iteratorOptions` var minName = minNames[iteratorOptions.length + index],