@eagleoutice/flowr-dev
Version:
Static Dataflow Analyzer and Program Slicer for the R Programming Language
39 lines • 1.82 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.FlowrAnalyzerMetaInstFilesPlugin = 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 InstPathPattern = /(^|\/)inst(\/|$)/;
/**
* This plugin provides supports for the identification of installed files (files below an `inst/` folder).
* If you use multiple plugins, this should be included *before* other plugins.
*/
class FlowrAnalyzerMetaInstFilesPlugin extends flowr_analyzer_file_plugin_1.FlowrAnalyzerFilePlugin {
name = 'flowr-analyzer-inst-files-plugin';
description = 'Loads installed files.';
version = new semver_1.SemVer('0.1.0');
pathPattern;
/**
* Creates a new instance of the INST file plugin.
* @param pathPattern - The pathPattern to identify INST files, see {@link InstPathPattern} for the default pathPattern.
*/
constructor(pathPattern = InstPathPattern) {
super();
this.pathPattern = pathPattern;
}
applies(file) {
return this.pathPattern.test((0, built_in_source_1.platformDirname)(file.toString()));
}
/**
* Processes the given file, assigning it the {@link FileRole.Install} role.
* Given that the file may still need to be processed by other plugins, this method returns the `true` flag for that purpose.
*/
process(_ctx, file) {
file.assignRole(flowr_file_1.FileRole.Install);
return [file, true];
}
}
exports.FlowrAnalyzerMetaInstFilesPlugin = FlowrAnalyzerMetaInstFilesPlugin;
//# sourceMappingURL=flowr-analyzer-inst-file-plugin.js.map