Fix some JSDoc issues

Also makes a few minor changes to the template, so it can be used until
we have a new doc generation process. JSDoc output is written to
build/apidoc.
This commit is contained in:
ahocevar
2018-05-10 17:14:17 +02:00
parent 1e0086460b
commit e810387956
17 changed files with 66 additions and 61 deletions

View File

@@ -76,15 +76,12 @@ function extractTypes(item) {
}
function includeTypes(doclet) {
if (doclet.params && doclet.kind != 'class') {
if (doclet.params) {
doclet.params.forEach(extractTypes);
}
if (doclet.returns) {
doclet.returns.forEach(extractTypes);
}
if (doclet.isEnum) {
types[doclet.meta.code.name] = true;
}
if (doclet.type && doclet.meta.code.type == 'MemberExpression') {
extractTypes(doclet);
}
@@ -131,6 +128,10 @@ exports.handlers = {
continue;
}
if (doclet.kind == 'module' && doclet.longname in modules) {
// Document all modules that are referenced by the API
continue;
}
if (doclet.isEnum) {
continue;
}
if (doclet.kind == 'class' && api.some(hasApiMembers, doclet)) {

View File

@@ -22,7 +22,7 @@ function addDefaultExportPath(obj) {
const lines = file.split('\n');
let hasDefaultExport = false;
for (let i = 0, ii = lines.length; i < ii; ++i) {
hasDefaultExport = hasDefaultExport || lines[i].indexOf('export default ') == 0;
hasDefaultExport = hasDefaultExport || /^export default [^\{]/.test(lines[i]);
const match = lines[i].match(/^export default ([A-Za-z_$][A-Za-z0-9_$]+);$/);
if (match) {
// Use variable name if default export is assigned to a variable.

View File

@@ -47,7 +47,7 @@ exports.handlers = {
if (!cls.fires) {
cls.fires = [];
}
event = 'ol.Object.Event#event:change:' + name;
event = 'module:ol/Object~ObjectEvent#event:change:' + name;
if (cls.fires.indexOf(event) == -1) {
cls.fires.push(event);
}