MCPcopy Create free account
hub / github.com/browserify/crypto-browserify / loadAsDirectorySync

Function loadAsDirectorySync

example/bundle.js:56–75  ·  view source on GitHub ↗
(x)

Source from the content-addressed store, hash-verified

54 }
55
56 function loadAsDirectorySync(x) {
57 x = x.replace(/\/+$/, '');
58 var pkgfile = x + '/package.json';
59 if (require.modules[pkgfile]) {
60 var pkg = require.modules[pkgfile]();
61 var b = pkg.browserify;
62 if (typeof b === 'object' && b.main) {
63 var m = loadAsFileSync(path.resolve(x, b.main));
64 if (m) { return m; }
65 } else if (typeof b === 'string') {
66 var m = loadAsFileSync(path.resolve(x, b));
67 if (m) { return m; }
68 } else if (pkg.main) {
69 var m = loadAsFileSync(path.resolve(x, pkg.main));
70 if (m) { return m; }
71 }
72 }
73
74 return loadAsFileSync(x + '/index');
75 }
76
77 function loadNodeModulesSync(x, start) {
78 var dirs = nodeModulesPathsSync(start);

Callers 2

bundle.jsFile · 0.85
loadNodeModulesSyncFunction · 0.85

Calls 1

loadAsFileSyncFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…