@eagleoutice/flowr-dev
Version:
Static Dataflow Analyzer and Program Slicer for the R Programming Language
60 lines • 3.31 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.toPosixPath = exports.FlowrRAdapter = exports.FlowrRStudioAddin = exports.FlowrPositron = exports.FlowrVsCode = exports.FlowrCodecovRef = exports.FlowrDockerRef = exports.FlowrNpmRef = exports.FlowrGithubRef = exports.FlowrWikiBaseRef = exports.RemoteFlowrFilePathBaseRef = exports.FlowrSiteBaseRef = exports.FlowrGithubBaseRef = exports.FlowrGithubGroupName = void 0;
exports.getFilePathMd = getFilePathMd;
exports.getFileContentFromRoot = getFileContentFromRoot;
exports.linkFlowRSourceFile = linkFlowRSourceFile;
exports.flowrSourceFileUrl = flowrSourceFileUrl;
const fs_1 = __importDefault(require("fs"));
const path_1 = __importDefault(require("path"));
const files_1 = require("../../util/files");
Object.defineProperty(exports, "toPosixPath", { enumerable: true, get: function () { return files_1.toPosixPath; } });
exports.FlowrGithubGroupName = 'flowr-analysis';
exports.FlowrGithubBaseRef = `https://github.com/${exports.FlowrGithubGroupName}`;
exports.FlowrSiteBaseRef = `https://${exports.FlowrGithubGroupName}.github.io/flowr`;
exports.RemoteFlowrFilePathBaseRef = `${exports.FlowrGithubBaseRef}/flowr/tree/main/`;
exports.FlowrWikiBaseRef = `${exports.FlowrGithubBaseRef}/flowr/wiki`;
exports.FlowrGithubRef = exports.FlowrGithubBaseRef + '/flowr';
exports.FlowrNpmRef = 'https://www.npmjs.com/package/@eagleoutice/flowr';
exports.FlowrDockerRef = 'https://hub.docker.com/r/eagleoutice/flowr';
exports.FlowrCodecovRef = `https://app.codecov.io/gh/${exports.FlowrGithubGroupName}/flowr`;
exports.FlowrVsCode = 'https://marketplace.visualstudio.com/items?itemName=code-inspect.vscode-flowr';
exports.FlowrPositron = 'https://open-vsx.org/extension/code-inspect/vscode-flowr';
exports.FlowrRStudioAddin = `${exports.FlowrGithubBaseRef}/rstudio-addin-flowr`;
exports.FlowrRAdapter = `${exports.FlowrGithubBaseRef}/flowr-r-adapter`;
/**
* Returns a markdown link to the given file path relative to the project root.
*/
function getFilePathMd(filePath) {
// we go one up as we are in doc-util now :D #convenience
const fullpath = require.resolve('../' + filePath);
const relative = (0, files_1.toPosixPath)(path_1.default.relative(process.cwd(), fullpath));
return `[\`./${relative}\`](${flowrSourceFileUrl(relative)})`;
}
/**
* Returns the content of a file located at the given path relative to the project root.
* This reads the file synchronously from disk.
*/
function getFileContentFromRoot(path) {
const fullpath = require.resolve('../../../' + path);
return fs_1.default.readFileSync(fullpath, 'utf-8');
}
/**
* Returns a markdown link to the given flowr source file path.
*/
function linkFlowRSourceFile(path) {
return `[${path}](${flowrSourceFileUrl(path)})`;
}
/**
* Returns the remote url for the given flowr source file path,
* ensuring exactly one slash between the base ref and the path.
*/
function flowrSourceFileUrl(path) {
const base = exports.RemoteFlowrFilePathBaseRef.replace(/\/+$/, '');
const suffix = path.startsWith('/') ? path : '/' + path;
return base + suffix;
}
//# sourceMappingURL=doc-files.js.map