MCPcopy
hub / github.com/MithrilJS/mithril.js / resolve

Function resolve

bundler/bundle.js:43–55  ·  view source on GitHub ↗
(filepath, filename)

Source from the content-addressed store, hash-verified

41 }
42
43 var resolve = function(filepath, filename) {
44 if (filename[0] !== ".") {
45 // resolve as npm dependency
46 var packagePath = "./node_modules/" + filename + "/package.json"
47 var meta = isFile(packagePath) ? parse(packagePath) : {}
48 var main = "./node_modules/" + filename + "/" + (meta.main || filename + ".js")
49 return path.resolve(isFile(main) ? main : "./node_modules/" + filename + "/index.js")
50 }
51 else {
52 // resolve as local dependency
53 return path.resolve(path.dirname(filepath), filename + ".js")
54 }
55 }
56
57 var exportCode = function(filename, filepath, def, variable, eq, rest, uuid) {
58 var code = read(filepath)

Callers 15

mithril.jsFile · 0.85
consumeFunction · 0.85
requestFunction · 0.85
jsonpFunction · 0.85
resolveRouteFunction · 0.85
polyfill.jsFile · 0.85
consumeFunction · 0.85
test-promise.jsFile · 0.85
requestFunction · 0.85
jsonpFunction · 0.85
wrapPromiseFunction · 0.85
test-router.jsFile · 0.85

Calls 2

isFileFunction · 0.85
parseFunction · 0.85

Tested by

no test coverage detected