Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var plugins = config.plugins, options = {};
for (var plugin in plugins) {
var val = plugins[plugin];
if (!val) continue;
var found = findFile(plugin + ".js", projectDir, path.resolve(distDir, "plugin"), options)
|| resolveFrom(projectDir, "tern-" + plugin);
if (!found) {
try {
found = require.resolve("tern-" + plugin);
} catch (e) {
process.stderr.write("Failed to find plugin " + plugin + ".\n");
continue;
}
}
var mod = require(found);
if (mod.hasOwnProperty("initialize")) mod.initialize(distDir);
options[path.basename(plugin)] = val;
}
return options;
}
function loadPlugins(projectDir, config) {
let plugins = config.plugins, options = {}
for (let plugin in plugins) {
let val = plugins[plugin]
if (!val) continue
let found = findFile(plugin + '.js', projectDir, path.resolve(ternRoot, 'plugin'))
if (!found) {
try {
found = require.resolve('tern-' + plugin)
} catch (e) {
process.stderr.write('Failed to find plugin ' + plugin + '.\n')
continue
}
}
let mod = require(found)
if (mod.hasOwnProperty('initialize')) mod.initialize(ternRoot)
options[path.basename(plugin)] = val
}
return options
}
var plugins = config.plugins, options = {};
for (var plugin in plugins) {
var val = plugins[plugin];
if (!val) continue;
var found = findFile(plugin + '.js', projectDir, path.resolve(DIST_DIR, 'plugin'))
|| resolveFrom(projectDir, 'tern-' + plugin);
if (!found) {
try {
found = require.resolve('tern-' + plugin);
} catch (e) {
process.stderr.write('Failed to find plugin ' + plugin + '.\n');
continue;
}
}
var mod = require(found);
if (mod.hasOwnProperty('initialize')) mod.initialize(DIST_DIR);
options[path.basename(plugin)] = val;
}
return options;
}
function loadPlugins(projectDir, plugins) {
var options = {};
for (var plugin in plugins) {
var val = plugins[plugin];
if (!val) continue;
var found = findFile(plugin + ".js", projectDir, path.resolve(distDir, "plugin"));
if (!found) {
try {
found = require.resolve("tern-" + plugin);
} catch (e) {
process.stderr.write("Failed to find plugin " + plugin + ".\n");
continue;
}
}
var mod = require(found);
if (mod.hasOwnProperty("initialize")) mod.initialize(distDir);
options[path.basename(plugin)] = val;
}
defaultPlugins.forEach(function(name) {
if (!plugins.hasOwnProperty(name)) {
options[name] = true;
require("../plugin/" + name);
}
});
return options;
}