MCPcopy
hub / github.com/ternjs/tern / findDefs

Function findDefs

lib/bootstrap.js:64–84  ·  view source on GitHub ↗
(projectDir, config, options)

Source from the content-addressed store, hash-verified

62var distDir = path.resolve(__dirname, "..");
63
64function findDefs(projectDir, config, options) {
65 var defs = [], src = config.libs.slice();
66 if (config.ecmaScript && src.indexOf("ecmascript") == -1)
67 src.unshift("ecmascript");
68 for (var i = 0; i < src.length; ++i) {
69 var file = src[i];
70 if (!/\.json$/.test(file)) file = file + ".json";
71 var found = findFile(file, projectDir, path.resolve(distDir, "defs"), options)
72 || resolveFrom(projectDir, "tern-" + src[i]);
73 if (!found) {
74 try {
75 found = require.resolve("tern-" + src[i]);
76 } catch (e) {
77 process.stderr.write("Failed to find library " + src[i] + ".\n");
78 continue;
79 }
80 }
81 if (found) defs.push(readJSON(found));
82 }
83 return defs;
84}
85
86function loadPlugins(projectDir, config, options) {
87 var plugins = config.plugins, options = {};

Callers 1

startServerFunction · 0.85

Calls 2

findFileFunction · 0.85
readJSONFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…