Son CV dans un terminal web en Javascript!
https://terminal-cv.gregandev.fr
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
955 B
29 lines
955 B
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.default = loadExternalPlugins;
|
|
|
|
async function loadExternalPlugins(plugins, relative, options) {
|
|
if (Array.isArray(plugins)) {
|
|
return Promise.all(plugins.map(p => loadPlugin(p, relative, null, options.packageManager, options.shouldAutoInstall)).filter(Boolean));
|
|
} else if (typeof plugins === 'object') {
|
|
let mapPlugins = await Promise.all(Object.keys(plugins).map(p => loadPlugin(p, relative, plugins[p], options.packageManager, options.shouldAutoInstall)));
|
|
return mapPlugins.filter(Boolean);
|
|
} else {
|
|
return [];
|
|
}
|
|
}
|
|
|
|
async function loadPlugin(pluginArg, relative, options = {}, packageManager, shouldAutoInstall) {
|
|
if (typeof pluginArg !== 'string') {
|
|
return pluginArg;
|
|
}
|
|
|
|
let plugin = await packageManager.require(pluginArg, relative, {
|
|
shouldAutoInstall
|
|
});
|
|
plugin = plugin.default || plugin;
|
|
return plugin(options);
|
|
} |