MCPcopy Create free account
hub / github.com/socketstream/socketstream / projectOrHereRequire

Function projectOrHereRequire

lib/utils/require.js:138–160  ·  view source on GitHub ↗
(id,root)

Source from the content-addressed store, hash-verified

136
137// return path to found, project first
138function projectOrHereRequire(id,root) {
139 try {
140 return resolve.sync(id, {
141 package: path.join(root,'package.json'),
142 paths: [root],
143 basedir:root
144 });
145 } catch(ex) {
146 // console.error(ex);
147 }
148
149 var here = path.join(__dirname,'..','..');
150 try {
151 var p = resolve.sync(id, {
152 package: path.join(here,'package.json'),
153 paths: [here],
154 basedir:here
155 });
156 return p;
157 } catch(ex) {
158 // console.error(ex);
159 }
160}

Callers 2

requiresFunction · 0.85
resolvesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected