UNPKG

@eagleoutice/flowr-dev

Version:

Static Dataflow Analyzer and Program Slicer for the R Programming Language

53 lines 2.5 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.FlowrAnalyzerUvrManifestFilePlugin = exports.FlowrAnalyzerRProjectFilePlugin = void 0; const flowr_analyzer_file_plugin_1 = require("./flowr-analyzer-file-plugin"); const semver_1 = require("semver"); const flowr_file_1 = require("../../context/flowr-file"); const built_in_source_1 = require("../../../dataflow/internal/process/functions/call/built-in/built-in-source"); const flowr_manifest_files_1 = require("./files/flowr-manifest-files"); const RProjectFilePattern = /^rproject\.toml$/i; const UvrManifestFilePattern = /^uvr\.toml$/i; /** * Tags a project manifest with the {@link FileRole.Manifest} role and lifts it, so the meta plugins reading it * can look it up by role. */ class FlowrAnalyzerManifestFilePlugin extends flowr_analyzer_file_plugin_1.FlowrAnalyzerFilePlugin { version = new semver_1.SemVer('0.1.0'); pathPattern; /** * @param pathPattern - The pattern to identify the manifest, see the respective subclass for its default. */ constructor(pathPattern) { super(); this.pathPattern = pathPattern; } applies(file) { return this.pathPattern.test((0, built_in_source_1.platformBasename)(file.toString())); } } /** Lifts an rv `rproject.toml` to a {@link FlowrRProjectFile}. */ class FlowrAnalyzerRProjectFilePlugin extends FlowrAnalyzerManifestFilePlugin { name = 'flowr-analyzer-rproject-file-plugin'; description = 'Marks the rproject.toml manifest of an rv project.'; constructor(pathPattern = RProjectFilePattern) { super(pathPattern); } process(_ctx, file) { return [flowr_manifest_files_1.FlowrRProjectFile.from(file, flowr_file_1.FileRole.Manifest), true]; } } exports.FlowrAnalyzerRProjectFilePlugin = FlowrAnalyzerRProjectFilePlugin; /** Lifts a uvr `uvr.toml` to a {@link FlowrUvrManifestFile}. */ class FlowrAnalyzerUvrManifestFilePlugin extends FlowrAnalyzerManifestFilePlugin { name = 'flowr-analyzer-uvr-manifest-file-plugin'; description = 'Marks the uvr.toml manifest of a uvr project.'; constructor(pathPattern = UvrManifestFilePattern) { super(pathPattern); } process(_ctx, file) { return [flowr_manifest_files_1.FlowrUvrManifestFile.from(file, flowr_file_1.FileRole.Manifest), true]; } } exports.FlowrAnalyzerUvrManifestFilePlugin = FlowrAnalyzerUvrManifestFilePlugin; //# sourceMappingURL=flowr-analyzer-manifest-file-plugin.js.map