MCPcopy
hub / github.com/brunch/brunch / cacheModule

Function cacheModule

test/fixtures/public/javascripts/app.js:35–48  ·  view source on GitHub ↗
(name, path, contentFn)

Source from the content-addressed store, hash-verified

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);

Callers 1

requireFunction · 0.70

Calls 2

requireFunction · 0.70
dirnameFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…