Skip to content

Commit 6203ae0

Browse files
committed
jsdoc - PIXI documentation filtering
Added the filterpixi.js jsdoc plugin which marks some PIXI interaction-related methods and properties as private. This ensures that they do not show up in the final Phaser documentation.
1 parent 0744ddd commit 6203ae0

2 files changed

Lines changed: 45 additions & 2 deletions

File tree

tasks/jsdoc-conf.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
"./src/system/",
2121
"./src/tilemap/",
2222
"./src/time/",
23-
"./src/tween/",
24-
"./src/utils/"
23+
"./src/tween/",
24+
"./src/utils/"
2525
],
2626
"exclude": [
2727
"./src/physics/p2/p2.js"
@@ -30,6 +30,7 @@
3030
"excludePattern": "(^|\\/|\\\\)_"
3131
},
3232
"plugins" : [
33+
"./tasks/jsdoc-plugins/filterpixi",
3334
"./tasks/jsdoc-plugins/proptomember",
3435
"./tasks/jsdoc-plugins/sourceproxy",
3536
"plugins/markdown"

tasks/jsdoc-plugins/filterpixi.js

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/**
2+
* Mark various PIXI properties/methods as private if they are not relevant to Phaser.
3+
*/
4+
5+
var path = require('path');
6+
7+
function docletParamsAcceptInteractionData (doclet) {
8+
9+
if (Array.isArray(doclet.params)) {
10+
return doclet.params.some(function (p) {
11+
return p.type && p.type.names.some(function (n) {
12+
return n === 'PIXI.InteractionData';
13+
});
14+
});
15+
}
16+
17+
}
18+
19+
var unwantedNames = {
20+
'PIXI.DisplayObject#defaultCursor': 1,
21+
'PIXI.DisplayObject#interactive' : 1
22+
};
23+
24+
function hasUnwantedName (doclet) {
25+
26+
var longname = doclet.longname;
27+
return unwantedNames[longname];
28+
29+
}
30+
31+
exports.handlers = {};
32+
exports.handlers.newDoclet = function (e) {
33+
34+
var doclet = e.doclet;
35+
36+
if (docletParamsAcceptInteractionData(doclet) ||
37+
hasUnwantedName(doclet))
38+
{
39+
doclet.access = 'private';
40+
}
41+
42+
};

0 commit comments

Comments
 (0)