UNPKG

@knodes/typedoc-pluginutils

Version:
24 lines 1.36 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createSourceReference = exports.getReflectionSourceFileName = void 0; const typedoc_1 = require("typedoc"); const path_1 = require("./path"); const base_plugin_1 = require("../base-plugin"); const getReflectionSourceFileName = (reflection) => { var _a; if (!reflection) { return; } return (_a = reflection.sources) === null || _a === void 0 ? void 0 : _a[0].fullFileName; }; exports.getReflectionSourceFileName = getReflectionSourceFileName; const createSourceReference = (pluginAccessor, absoluteFilename, line, character) => { var _a; const source = new typedoc_1.SourceReference((0, path_1.normalize)(absoluteFilename), line !== null && line !== void 0 ? line : 1, character !== null && character !== void 0 ? character : 1); source.fileName = (0, base_plugin_1.getPlugin)(pluginAccessor).relativeToRoot(absoluteFilename); const repo = (_a = (0, base_plugin_1.getApplication)(pluginAccessor).converter.getComponent('source')) === null || _a === void 0 ? void 0 : _a.getRepository(source.fullFileName); source.url = repo === null || repo === void 0 ? void 0 : repo.getURL(source.fullFileName, source.line); return source; }; exports.createSourceReference = createSourceReference; //# sourceMappingURL=reflection-source.js.map