(name, path, contentFn)
| 33 | }; |
| 34 | |
| 35 | var cacheModule = function(name, path, contentFn) { |
| 36 | var module = {id: path, exports: {}}; |
| 37 | try { |
| 38 | cache[path] = module.exports; |
| 39 | contentFn(module.exports, function(name) { |
| 40 | return require(name, dirname(path)); |
| 41 | }, module); |
| 42 | cache[path] = module.exports; |
| 43 | } catch (err) { |
| 44 | delete cache[path]; |
| 45 | throw err; |
| 46 | } |
| 47 | return cache[path]; |
| 48 | }; |
| 49 | |
| 50 | var require = function(name, root) { |
| 51 | var path = expand(root, name); |