UNPKG

@eagleoutice/flowr-dev

Version:

Static Dataflow Analyzer and Program Slicer for the R Programming Language

47 lines 2.6 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.FlowrAnalyzerMetaUvrManifestFilePlugin = exports.FlowrAnalyzerMetaRProjectFilePlugin = void 0; const flowr_analyzer_package_versions_plugin_1 = require("./flowr-analyzer-package-versions-plugin"); const semver_1 = require("semver"); const flowr_file_1 = require("../../context/flowr-file"); const flowr_analyzer_meta_context_1 = require("../../context/flowr-analyzer-meta-context"); const flowr_manifest_files_1 = require("../file-plugins/files/flowr-manifest-files"); /** * Extracts the project metadata and the declared dependencies from a project manifest. The name is contributed * without a namespace: such a project is no package, so `a::b` must not resolve against it. */ class FlowrAnalyzerMetaManifestFilePlugin extends flowr_analyzer_package_versions_plugin_1.FlowrAnalyzerPackageVersionsPlugin { version = new semver_1.SemVer('0.1.0'); process(ctx) { for (const file of ctx.files.getFilesByRole(flowr_file_1.FileRole.Manifest)) { if (!(file instanceof this.reads)) { continue; } const declares = file.declares(); ctx.meta.contribute({ name: file.projectName(), rVersion: file.rVersion(), declares }, flowr_analyzer_meta_context_1.MetaPriority.Manifest); // like a `DESCRIPTION` `Suggests`, anything but the imports is reported but not needed to run the project for (const pkg of declares.imports ?? []) { ctx.deps.addDeclaredDependency(pkg); } } } } /** Reads an rv `rproject.toml`. */ class FlowrAnalyzerMetaRProjectFilePlugin extends FlowrAnalyzerMetaManifestFilePlugin { name = 'flowr-analyzer-meta-rproject-file-plugin'; description = 'Extracts project meta information and dependencies from an rproject.toml.'; reads = flowr_manifest_files_1.FlowrRProjectFile; } exports.FlowrAnalyzerMetaRProjectFilePlugin = FlowrAnalyzerMetaRProjectFilePlugin; /** Reads a uvr `uvr.toml`, whose `[dev-dependencies]` land in `suggests`. */ class FlowrAnalyzerMetaUvrManifestFilePlugin extends FlowrAnalyzerMetaManifestFilePlugin { name = 'flowr-analyzer-meta-uvr-manifest-file-plugin'; description = 'Extracts project meta information and dependencies from a uvr.toml.'; reads = flowr_manifest_files_1.FlowrUvrManifestFile; } exports.FlowrAnalyzerMetaUvrManifestFilePlugin = FlowrAnalyzerMetaUvrManifestFilePlugin; //# sourceMappingURL=flowr-analyzer-meta-manifest-file-plugin.js.map