@eagleoutice/flowr
Version:
Static Dataflow Analyzer and Program Slicer for the R Programming Language
35 lines • 1.59 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.FlowrAnalyzerNewsFilePlugin = 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_news_file_1 = require("./files/flowr-news-file");
const NewsFilePattern = /^NEWS(\.(rd|md))?$/i;
/**
* This plugin provides support for R `NEWS` files.
* @see https://rdrr.io/r/utils/news.html
*/
class FlowrAnalyzerNewsFilePlugin extends flowr_analyzer_file_plugin_1.FlowrAnalyzerFilePlugin {
name = 'flowr-analyzer-news-file-plugin';
description = 'This plugin provides support for NEWS files and extracts their content into version chunks.';
version = new semver_1.SemVer('0.1.0');
pattern;
/**
* Creates a new instance of the NEWS file plugin.
* @param filePattern - The pattern to identify NEWS files, see {@link NewsFilePattern} for the default pattern.
*/
constructor(filePattern = NewsFilePattern) {
super();
this.pattern = filePattern;
}
applies(file) {
return this.pattern.test((0, built_in_source_1.platformBasename)(file.toString()));
}
process(_ctx, file) {
return flowr_news_file_1.FlowrNewsFile.from(file, flowr_file_1.FileRole.News);
}
}
exports.FlowrAnalyzerNewsFilePlugin = FlowrAnalyzerNewsFilePlugin;
//# sourceMappingURL=flowr-analyzer-news-file-plugin.js.map