UNPKG

dgeni-packages

Version:

A collection of dgeni packages for generating documentation from source code

28 lines 1.24 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.FileInfo = void 0; const Location_1 = require("./Location"); const fs_1 = require("fs"); const path = require('canonical-path'); /** * The file (and the location in the file) from where an API doc element was sourced. */ class FileInfo { constructor(declaration, basePath) { this.declaration = declaration; this.basePath = basePath; this.location = new Location_1.Location(this.declaration); this.filePath = path.resolve(this.basePath, this.declaration.getSourceFile().fileName); this.baseName = path.basename(this.filePath, path.extname(this.filePath)); this.extension = path.extname(this.filePath).replace(/^\./, ''); this.relativePath = path.relative(this.basePath, this.filePath); this.projectRelativePath = this.relativePath; this.realFilePath = this.getRealFilePath(this.filePath); this.realProjectRelativePath = path.relative(this.basePath, this.realFilePath); } getRealFilePath(filePath) { return (0, fs_1.realpathSync)(filePath).replace(RegExp('\\' + path.sep, 'g'), '/'); } } exports.FileInfo = FileInfo; //# sourceMappingURL=FileInfo.js.map