The build process failed because webpack does not allow failed imports when it is run as a module. This detects modules with default exports and only generates import statements for default exports where they are available.
40 lines
1011 B
JavaScript
40 lines
1011 B
JavaScript
/* eslint-disable import/no-commonjs */
|
|
|
|
const events = {};
|
|
|
|
exports.handlers = {
|
|
newDoclet: function (e) {
|
|
const doclet = e.doclet;
|
|
if (doclet.kind !== 'event') {
|
|
return;
|
|
}
|
|
|
|
const cls = doclet.longname.split('#')[0];
|
|
if (!(cls in events)) {
|
|
events[cls] = [];
|
|
}
|
|
events[cls].push(doclet.longname);
|
|
},
|
|
|
|
parseComplete: function (e) {
|
|
const doclets = e.doclets;
|
|
for (let i = 0, ii = doclets.length - 1; i < ii; ++i) {
|
|
const doclet = doclets[i];
|
|
if (doclet.fires) {
|
|
if (doclet.kind == 'class') {
|
|
const fires = [];
|
|
for (let j = 0, jj = doclet.fires.length; j < jj; ++j) {
|
|
const event = doclet.fires[j].replace('event:', '');
|
|
if (events[event]) {
|
|
fires.push.apply(fires, events[event]);
|
|
} else if (doclet.fires[j] !== 'event:ObjectEvent') {
|
|
fires.push(doclet.fires[j]);
|
|
}
|
|
}
|
|
doclet.fires = fires;
|
|
}
|
|
}
|
|
}
|
|
},
|
|
};
|