UNPKG

@eagleoutice/flowr

Version:

Static Dataflow Analyzer and Program Slicer for the R Programming Language

76 lines 4.63 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.BuiltInPlugins = void 0; exports.registerPluginMaker = registerPluginMaker; exports.getPlugin = getPlugin; exports.makePlugin = makePlugin; const flowr_analyzer_description_file_plugin_1 = require("./file-plugins/flowr-analyzer-description-file-plugin"); const flowr_analyzer_package_versions_description_file_plugin_1 = require("./package-version-plugins/flowr-analyzer-package-versions-description-file-plugin"); const flowr_analyzer_loading_order_description_file_plugin_1 = require("./loading-order-plugins/flowr-analyzer-loading-order-description-file-plugin"); const flowr_analyzer_rmd_file_plugin_1 = require("./file-plugins/notebooks/flowr-analyzer-rmd-file-plugin"); const flowr_analyzer_qmd_file_plugin_1 = require("./file-plugins/notebooks/flowr-analyzer-qmd-file-plugin"); const assert_1 = require("../../util/assert"); const flowr_analyzer_jupyter_file_plugin_1 = require("./file-plugins/notebooks/flowr-analyzer-jupyter-file-plugin"); const flowr_analyzer_namespace_files_plugin_1 = require("./file-plugins/flowr-analyzer-namespace-files-plugin"); const flowr_analyzer_news_file_plugin_1 = require("./file-plugins/flowr-analyzer-news-file-plugin"); const flowr_analyzer_vignette_file_plugin_1 = require("./file-plugins/flowr-analyzer-vignette-file-plugin"); const flowr_analyzer_test_file_plugin_1 = require("./file-plugins/flowr-analyzer-test-file-plugin"); const flowr_analyzer_license_file_plugin_1 = require("./file-plugins/flowr-analyzer-license-file-plugin"); const flowr_analyzer_meta_description_file_plugin_1 = require("./package-version-plugins/flowr-analyzer-meta-description-file-plugin"); const flowr_analyzer_sweave_file_plugin_1 = require("./file-plugins/notebooks/flowr-analyzer-sweave-file-plugin"); /** * The built-in Flowr Analyzer plugins that are always available. */ exports.BuiltInPlugins = [ ['file:description', flowr_analyzer_description_file_plugin_1.FlowrAnalyzerDescriptionFilePlugin], ['versions:description', flowr_analyzer_package_versions_description_file_plugin_1.FlowrAnalyzerPackageVersionsDescriptionFilePlugin], ['loading-order:description', flowr_analyzer_loading_order_description_file_plugin_1.FlowrAnalyzerLoadingOrderDescriptionFilePlugin], ['meta:description', flowr_analyzer_meta_description_file_plugin_1.FlowrAnalyzerMetaDescriptionFilePlugin], ['files:vignette', flowr_analyzer_vignette_file_plugin_1.FlowrAnalyzerMetaVignetteFilesPlugin], ['files:test', flowr_analyzer_test_file_plugin_1.FlowrAnalyzerMetaTestFilesPlugin], ['file:rmd', flowr_analyzer_rmd_file_plugin_1.FlowrAnalyzerRmdFilePlugin], ['file:qmd', flowr_analyzer_qmd_file_plugin_1.FlowrAnalyzerQmdFilePlugin], ['file:rnw', flowr_analyzer_sweave_file_plugin_1.FlowrAnalyzerSweaveFilePlugin], ['file:ipynb', flowr_analyzer_jupyter_file_plugin_1.FlowrAnalyzerJupyterFilePlugin], ['file:namespace', flowr_analyzer_namespace_files_plugin_1.FlowrAnalyzerNamespaceFilesPlugin], ['file:news', flowr_analyzer_news_file_plugin_1.FlowrAnalyzerNewsFilePlugin], ['file:license', flowr_analyzer_license_file_plugin_1.FlowrAnalyzerLicenseFilePlugin] ]; /** * The registry of built-in and user-registered Flowr Analyzer plugins. * Used by the {@link FlowrAnalyzerBuilder} and {@link FlowrAnalyzer} to instantiate plugins by name. */ const PluginRegistry = new Map(exports.BuiltInPlugins); /** * Register a new Flowr Analyzer plugin for the registry, * to be used by the {@link FlowrAnalyzerBuilder} and {@link FlowrAnalyzer}. */ function registerPluginMaker(plugin, name = plugin.name) { PluginRegistry.set(name, plugin); } /** * Retrieve a registered Flowr Analyzer plugin by its name. * @see {@link PluginToRegister} */ function getPlugin(name, args) { const plugin = PluginRegistry.get(name); return plugin ? new plugin(...args) : undefined; } /** * Create a Flowr Analyzer plugin from a {@link PluginToRegister} specification. */ function makePlugin(toRegister) { if (toRegister instanceof Object && 'process' in toRegister) { return toRegister; } if (Array.isArray(toRegister)) { const [name, args] = toRegister; const plugin = getPlugin(name, args); (0, assert_1.guard)(plugin !== undefined, () => `Unknown Flowr Analyzer plugin: ${name.toString()}`); return plugin; } const plugin = getPlugin(toRegister, []); (0, assert_1.guard)(plugin !== undefined, () => `Unknown Flowr Analyzer plugin: ${toRegister.toString()}`); return plugin; } //# sourceMappingURL=plugin-registry.js.map