Add typedefs for externs/olx.js contents
This commit is contained in:
@@ -40,16 +40,8 @@ function generateExterns(typedefs, symbols) {
|
|||||||
var namespaces = {};
|
var namespaces = {};
|
||||||
var constructors = {};
|
var constructors = {};
|
||||||
|
|
||||||
typedefs.forEach(function(typedef) {
|
function addNamespaces(name) {
|
||||||
lines.push('/**');
|
var parts = name.split('.');
|
||||||
lines.push(' * @typedef {' + typedef.types.join('|') + '}');
|
|
||||||
lines.push(' */');
|
|
||||||
lines.push(typedef.name + ';');
|
|
||||||
lines.push('\n');
|
|
||||||
});
|
|
||||||
|
|
||||||
symbols.forEach(function(symbol) {
|
|
||||||
var parts = symbol.name.split('#')[0].split('.');
|
|
||||||
parts.pop();
|
parts.pop();
|
||||||
var namespace = [];
|
var namespace = [];
|
||||||
parts.forEach(function(part) {
|
parts.forEach(function(part) {
|
||||||
@@ -66,6 +58,19 @@ function generateExterns(typedefs, symbols) {
|
|||||||
lines.push('\n');
|
lines.push('\n');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
typedefs.forEach(function(typedef) {
|
||||||
|
addNamespaces(typedef.name);
|
||||||
|
lines.push('/**');
|
||||||
|
lines.push(' * @typedef {' + typedef.types.join('|') + '}');
|
||||||
|
lines.push(' */');
|
||||||
|
lines.push(typedef.name + ';');
|
||||||
|
lines.push('\n');
|
||||||
|
});
|
||||||
|
|
||||||
|
symbols.forEach(function(symbol) {
|
||||||
|
addNamespaces(symbol.name.split('#')[0]);
|
||||||
|
|
||||||
var name = symbol.name;
|
var name = symbol.name;
|
||||||
if (name.indexOf('#') > 0) {
|
if (name.indexOf('#') > 0) {
|
||||||
@@ -131,9 +136,7 @@ function main(callback) {
|
|||||||
function(typedefs, symbols, done) {
|
function(typedefs, symbols, done) {
|
||||||
var code, err;
|
var code, err;
|
||||||
try {
|
try {
|
||||||
var olx = fs.readFileSync(olxPath, {encoding: 'utf-8'})
|
code = generateExterns(typedefs, symbols);
|
||||||
.replace(/ \* @api ?(.*)?(\r\n|\n|\r)/gm, '');
|
|
||||||
code = olx + '\n\n' + generateExterns(typedefs, symbols);
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
err = e;
|
err = e;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user