lodash-contrib
Advanced tools
Comparing version 241.4.9 to 241.4.10
@@ -1,2 +0,2 @@ | ||
// lodash-contrib v241.4.8 | ||
// lodash-contrib v241.4.9 | ||
// ========================= | ||
@@ -3,0 +3,0 @@ |
@@ -1,2 +0,2 @@ | ||
// lodash-contrib v241.4.8 | ||
// lodash-contrib v241.4.9 | ||
// ========================= | ||
@@ -3,0 +3,0 @@ |
@@ -50,3 +50,4 @@ module.exports = function (grunt) { | ||
concat: ['test/dist-concat.html'], | ||
min: ['test/dist-min.html'] | ||
min: ['test/dist-min.html'], | ||
browserified: ['test/browserified.html'] | ||
}, | ||
@@ -109,2 +110,8 @@ | ||
} | ||
}, | ||
test: { | ||
files: { | ||
'gen/double.browserified.js' : 'index.js' | ||
}, | ||
browserifyOptions: { debug: true } | ||
} | ||
@@ -151,7 +158,17 @@ }, | ||
var code = 'function sandbox(inNewContext) {\n'; | ||
code += '\tvar lodashModule = require.cache[require.resolve("lodash")];\n'; | ||
code += '\tvar original_ = lodashModule.exports;\n'; | ||
code += '\tlodashModule.exports = inNewContext;\n'; | ||
code += setup.src.reduce(function (seed, val) { return seed + '\trequire("./' + val + '");\n'; }, ''); | ||
code += '\tlodashModule.exports = original_;\n'; | ||
code += ' var lodashModule = {}, original_;\n'; | ||
code += ' try {\n'; | ||
code += ' lodashModule = require.cache[require.resolve("lodash")];\n'; | ||
code += ' } catch (e) {\n'; | ||
code += ' if (typeof(window) == "undefined")\n'; | ||
code += ' window = {};\n'; | ||
code += ' if (!window._)\n'; | ||
code += ' window._ = require("lodash");\n'; | ||
code += ' inNewContext = window._;\n'; | ||
code += ' }\n'; | ||
code += ' original_ = lodashModule.exports;\n'; | ||
code += ' lodashModule.exports = inNewContext;\n'; | ||
code += setup.src.reduce(function (seed, val) { return seed + ' require("./' + val + '");\n'; }, ''); | ||
code += ' lodashModule.exports = original_;\n'; | ||
code += ' return inNewContext;\n'; | ||
code += '}'; | ||
@@ -166,3 +183,3 @@ sandboxCode = code; | ||
var code = 'var inNewContext = require("lodash").runInContext();\n'; | ||
code += '(' + sandboxCode + ')(inNewContext);\n'; | ||
code += 'inNewContext = (' + sandboxCode + ')(inNewContext);\n'; | ||
code += setup.src.reduce(function (seed, val) { return seed + 'require("./' + val + '")(inNewContext);\n'; }, ''); | ||
@@ -174,8 +191,8 @@ code += 'module.exports = inNewContext;\n'; | ||
grunt.registerTask('webGen', ['webScaffold', 'browserify']); | ||
grunt.registerTask('webGen', ['webScaffold', 'browserify:dist']); | ||
grunt.registerTask('nodeGen', ['sandboxCode', 'wrapForNode']); | ||
grunt.registerTask('gen', ['webGen', 'nodeGen']); | ||
grunt.registerTask('test', ['gen', 'jshint', 'qunit:main', 'mochaTest']); | ||
grunt.registerTask('dist', ['test', 'concat', 'qunit:concat', 'uglify', 'qunit:min']); | ||
grunt.registerTask('dist', ['test', 'concat', 'qunit:concat', 'uglify', 'qunit:min', 'browserify:test', 'qunit:browserified']); | ||
grunt.registerTask('default', ['dist']); | ||
}; |
44
index.js
var inNewContext = require("lodash").runInContext(); | ||
(function sandbox(inNewContext) { | ||
var lodashModule = require.cache[require.resolve("lodash")]; | ||
var original_ = lodashModule.exports; | ||
lodashModule.exports = inNewContext; | ||
require("./_.collections.walk.js"); | ||
require("./_.function.arity.js"); | ||
require("./_.function.combinators.js"); | ||
require("./_.function.dispatch.js"); | ||
require("./_.function.iterators.js"); | ||
require("./_.function.predicates.js"); | ||
require("./_.object.builders.js"); | ||
require("./_.object.selectors.js"); | ||
require("./_.util.existential.js"); | ||
require("./_.util.operators.js"); | ||
require("./_.util.strings.js"); | ||
require("./_.util.trampolines.js"); | ||
lodashModule.exports = original_; | ||
inNewContext = (function sandbox(inNewContext) { | ||
var lodashModule = {}, original_; | ||
try { | ||
lodashModule = require.cache[require.resolve("lodash")]; | ||
} catch (e) { | ||
if (typeof(window) == "undefined") | ||
window = {}; | ||
if (!window._) | ||
window._ = require("lodash"); | ||
inNewContext = window._; | ||
} | ||
original_ = lodashModule.exports; | ||
lodashModule.exports = inNewContext; | ||
require("./_.collections.walk.js"); | ||
require("./_.function.arity.js"); | ||
require("./_.function.combinators.js"); | ||
require("./_.function.dispatch.js"); | ||
require("./_.function.iterators.js"); | ||
require("./_.function.predicates.js"); | ||
require("./_.object.builders.js"); | ||
require("./_.object.selectors.js"); | ||
require("./_.util.existential.js"); | ||
require("./_.util.operators.js"); | ||
require("./_.util.strings.js"); | ||
require("./_.util.trampolines.js"); | ||
lodashModule.exports = original_; | ||
return inNewContext; | ||
})(inNewContext); | ||
@@ -20,0 +30,0 @@ require("./common-js/_.array.builders.js")(inNewContext); |
{ | ||
"name": "lodash-contrib", | ||
"description": "The brass buckles on lodash's utility belt", | ||
"version": "241.4.9", | ||
"version": "241.4.10", | ||
"main": "index.js", | ||
@@ -6,0 +6,0 @@ "dependencies": { |
1525290
94
29120