Handle modules

This commit is contained in:
Andreas Hocevar
2018-01-26 00:08:40 +01:00
parent 08763ef139
commit efd9f2c088
3 changed files with 2 additions and 59 deletions

View File

@@ -53,7 +53,7 @@ exports.publish = function(data, opts) {
docs.filter(function(doc) {
var include = true;
var constructor = doc.memberof;
if (constructor && constructor.substr(-1) === '_') {
if (constructor && constructor.substr(-1) === '_' && constructor.indexOf('module:') === -1) {
assert.strictEqual(doc.inherited, true,
'Unexpected export on private class: ' + doc.longname);
include = false;

View File

@@ -51,7 +51,7 @@
"istanbul": "0.4.5",
"jquery": "3.3.1",
"jscodeshift": "^0.4.0",
"jsdoc": "3.5.5",
"jsdoc": "git://github.com/ahocevar/jsdoc.git#closure-path-types",
"karma": "^2.0.0",
"karma-chrome-launcher": "2.2.0",
"karma-coverage": "^1.1.1",

View File

@@ -208,62 +208,6 @@ function spawnJSDoc(paths, callback) {
}
/**
* Given the path to a source file, get the list of provides.
* @param {string} srcPath Path to source file.
* @param {function(Error, Array.<string>)} callback Called with a list of
* provides or any error.
*/
const getProvides = async.memoize(function(srcPath, callback) {
fs.readFile(srcPath, function(err, data) {
if (err) {
callback(err);
return;
}
const provides = [];
const matcher = /goog\.provide\('(.*)'\)/;
String(data).split('\n').forEach(function(line) {
const match = line.match(matcher);
if (match) {
provides.push(match[1]);
}
});
callback(null, provides);
});
});
/**
* Add provides data to new symbols.
* @param {Object} info Symbols and defines metadata.
* @param {function(Error, Object)} callback Updated metadata.
*/
function addSymbolProvides(info, callback) {
if (!info) {
process.nextTick(function() {
callback(null, null);
});
return;
}
function addProvides(symbol, callback) {
getProvides(symbol.path, function(err, provides) {
if (err) {
callback(err);
return;
}
symbol.provides = provides;
callback(null, symbol);
});
}
async.map(info.symbols, addProvides, function(err, newSymbols) {
info.symbols = newSymbols;
callback(err, info);
});
}
/**
* Write symbol and define metadata to the info file.
* @param {Object} info Symbol and define metadata.
@@ -294,7 +238,6 @@ function main(callback) {
getNewerExterns,
getNewer,
spawnJSDoc,
addSymbolProvides,
writeInfo
], callback);
}