Skip to content

Commit 03817ae

Browse files
committed
【API】优化打包
1 parent ef0a24e commit 03817ae

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

build/jsdocs/template/publish.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,21 @@ function buildNav(members, view, templatePath) {
244244
var sorted = sortNav(members);
245245
view.categories = buildCategories(sorted, templatePath);
246246
view.navMap = buildNavMap(sorted,view.linkto);
247+
var methods = {};
248+
for (const key in view.navMap ) {
249+
if (Object.hasOwnProperty.call(view.navMap , key)) {
250+
const element = view.navMap[key];
251+
const m = element.methods.map(e => {
252+
return e.name;
253+
});
254+
if(!element.fileName && m.length>0){
255+
console.log("没有文件名的类:", element.longname,element.type,m)
256+
}
257+
methods[element.fileName] = m;
258+
}
259+
}
260+
var methodsPath = path.join(outdir, 'methods.json');
261+
fs.writeFileSync(methodsPath, JSON.stringify(methods), 'utf8');
247262
}
248263

249264
function sortNav(members) {
@@ -297,6 +312,7 @@ function buildNavMap(members,linkto) {
297312
var nav;
298313
if (v.kind == 'namespace') {
299314
nav = {
315+
fileName:linkto(v.meta.filename),
300316
type: 'namespace',
301317
longname: v.longname,
302318
version: v.version,
@@ -345,6 +361,7 @@ function buildNavMap(members,linkto) {
345361
};
346362
} else if (v.scope === 'global') {
347363
nav = {
364+
fileName:linkto(v.meta.filename),
348365
type: 'global',
349366
longname: v.longname,
350367
version: v.version,

0 commit comments

Comments
 (0)