UNPKG

docusaurus-plugin-typedoc-api

Version:

Docusaurus plugin that provides source code API documentation powered by TypeDoc.

39 lines (37 loc) 945 B
'use strict'; // The JSON output does not include hierarchy information, so we need to duplicate the logic! // https://github.com/TypeStrong/typedoc/blob/master/src/lib/converter/plugins/TypePlugin.ts#L98 function createHierarchy(reflection) { let root; let hierarchy; function push(types) { if (!types) { return; } const level = { types }; if (hierarchy) { hierarchy.next = level; hierarchy = level; } else { root = level; hierarchy = level; } } if ('extendedTypes' in reflection && reflection.extendedTypes) { push(reflection.extendedTypes); } push([{ name: reflection.name, target: reflection.id, type: 'reference' }]); hierarchy.isTarget = true; if ('extendedBy' in reflection && reflection.extendedBy) { push(reflection.extendedBy); } return root; } exports.createHierarchy = createHierarchy; //# sourceMappingURL=hierarchy.js.map