List classes without API constructor

TODO: No import should be listed for these.
This commit is contained in:
ahocevar
2018-05-19 11:16:03 +02:00
committed by Tim Schaub
parent ff729d1357
commit 0482b7ced4
2 changed files with 26 additions and 14 deletions
+3
View File
@@ -79,6 +79,9 @@ exports.publish = function(data, opts) {
if (doc.augments) { if (doc.augments) {
symbol.extends = doc.augments[0]; symbol.extends = doc.augments[0];
} }
if (doc.memberof) {
symbol.memberof = doc.memberof;
}
if (doc.virtual) { if (doc.virtual) {
symbol.virtual = true; symbol.virtual = true;
} }
+23 -14
View File
@@ -14,6 +14,16 @@ info.symbols.forEach(symbol => {
if (!mod) { if (!mod) {
throw new Error(`No module for symbol ${symbol.name}`); throw new Error(`No module for symbol ${symbol.name}`);
} }
if (symbol.memberof || symbol.kind === 'class') {
const name = symbol.memberof || symbol.name;
if (!mod.classes) {
mod.classes = {};
}
if (!mod.classes[name]) {
mod.classes[name] = {};
}
mod.classes[name][symbol.name] = symbol;
}
if (!mod.symbols) { if (!mod.symbols) {
mod.symbols = []; mod.symbols = [];
} }
@@ -44,17 +54,18 @@ class Docs extends Component {
<a name={slug} href={`#${slug}`}> <a name={slug} href={`#${slug}`}>
<h1>{getModuleName(mod.name)}</h1> <h1>{getModuleName(mod.name)}</h1>
<h2>Classes</h2> <h2>Classes</h2>
{mod.symbols {mod.classes &&
.filter(sym => sym.kind === 'class') Object.keys(mod.classes).map(cls => this.renderClass(cls, mod))}
.map(cls => this.renderClass(cls, mod))}
<h2>Functions</h2> <h2>Functions</h2>
{mod.symbols {mod.symbols &&
.filter(sym => sym.kind === 'function' && !isMember(sym)) mod.symbols
.map(fn => this.renderFunction(fn, mod))} .filter(sym => sym.kind === 'function' && !isMember(sym))
.map(fn => this.renderFunction(fn, mod))}
<h2>Constants</h2> <h2>Constants</h2>
{mod.symbols {mod.symbols &&
.filter(sym => sym.kind === 'constant' && !isMember(sym)) mod.symbols
.map(constant => this.renderConstant(constant, mod))} .filter(sym => sym.kind === 'constant' && !isMember(sym))
.map(constant => this.renderConstant(constant, mod))}
</a> </a>
</section> </section>
); );
@@ -62,9 +73,9 @@ class Docs extends Component {
renderClass(cls, mod) { renderClass(cls, mod) {
return ( return (
<p key={cls.name}> <p key={cls}>
<code> <code>
import {getName(cls.name)} from &apos;{getModuleName(mod.name)}&apos;; import {getName(cls)} from &apos;{getModuleName(mod.name)}&apos;;
</code> </code>
</p> </p>
); );
@@ -95,9 +106,7 @@ class Docs extends Component {
} }
render() { render() {
return ( return <div>{modules.map(this.renderModule)}</div>;
<div>{modules.filter(mod => !!mod.symbols).map(this.renderModule)}</div>
);
} }
} }