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

Function startServer

lib/bootstrap.js:109–148  ·  view source on GitHub ↗
(dir, config, options)

Source from the content-addressed store, hash-verified

107}
108
109function startServer(dir, config, options) {
110 var defs = findDefs(dir, config, options);
111 var plugins = loadPlugins(dir, config, options);
112 var ternConfig = {
113 getFile: function(name, c) {
114 if (config.dontLoad && config.dontLoad.some(function(pat) {return minimatch(name, pat)}))
115 c(null, "");
116 else
117 fs.readFile(path.resolve(dir, name), "utf8", c);
118 },
119 normalizeFilename: function(name) {
120 var pt = path.resolve(dir, name);
121 try { pt = fs.realPathSync(path.resolve(dir, name), true) }
122 catch(e) {}
123 return path.relative(dir, pt);
124 },
125 async: true,
126 defs: defs,
127 plugins: plugins,
128 projectDir: dir,
129 ecmaVersion: config.ecmaVersion,
130 dependencyBudget: config.dependencyBudget,
131 };
132 if (options.tern) {
133 for (var option in options.tern) {
134 if (options.tern.hasOwnProperty(option)) {
135 ternConfig[option] = options.tern[option];
136 }
137 }
138 }
139 var server = new tern.Server(ternConfig);
140
141 if (config.loadEagerly) config.loadEagerly.forEach(function(pat) {
142 glob.sync(pat, { cwd: dir }).forEach(function(file) {
143 server.addFile(file);
144 });
145 });
146 server.flush(function(){});
147 return server;
148}
149
150module.exports = function bootstrapServer(options) {
151 var projectDir = options.projectDir;

Callers 1

bootstrap.jsFile · 0.85

Calls 3

findDefsFunction · 0.85
loadPluginsFunction · 0.85
cFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…