Fix legacy build
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.
This commit is contained in:
@@ -11,8 +11,9 @@
|
||||
},
|
||||
"plugins": [
|
||||
"jsdoc-plugin-typescript",
|
||||
"config/jsdoc/info/define-plugin.cjs",
|
||||
"config/jsdoc/info/virtual-plugin.cjs"
|
||||
"config/jsdoc/plugins/define-plugin.cjs",
|
||||
"config/jsdoc/plugins/virtual-plugin.cjs",
|
||||
"config/jsdoc/plugins/default-export.cjs"
|
||||
],
|
||||
"typescript": {
|
||||
"moduleRoot": "src"
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
/* eslint-disable import/no-commonjs */
|
||||
|
||||
/**
|
||||
* @fileoverview This plugin extracts info from boolean defines. This only
|
||||
* handles boolean defines with the default value in the description. Default
|
||||
* is assumed to be provided with something like "default is `true`" (case
|
||||
* insensitive, with or without ticks).
|
||||
*/
|
||||
|
||||
const DEFAULT_VALUE = /default\s+is\s+`?(true|false)`?/i;
|
||||
|
||||
/**
|
||||
* Hook to define new tags.
|
||||
* @param {Object} dictionary The tag dictionary.
|
||||
*/
|
||||
exports.defineTags = function (dictionary) {
|
||||
dictionary.defineTag('define', {
|
||||
canHaveType: true,
|
||||
mustHaveValue: true,
|
||||
onTagged: function (doclet, tag) {
|
||||
const types = tag.value.type.names;
|
||||
if (types.length === 1 && types[0] === 'boolean') {
|
||||
const match = tag.value.description.match(DEFAULT_VALUE);
|
||||
if (match) {
|
||||
doclet.define = {
|
||||
default: match[1] === 'true',
|
||||
};
|
||||
doclet.description = tag.value.description;
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
};
|
||||
@@ -137,6 +137,9 @@ exports.publish = function (data, opts) {
|
||||
return true;
|
||||
});
|
||||
}
|
||||
if (doc.isDefaultExport) {
|
||||
symbol.isDefaultExport = true;
|
||||
}
|
||||
|
||||
const target = isExterns ? externs : symbols;
|
||||
const existingSymbol = symbolsByName[symbol.name];
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
/* eslint-disable import/no-commonjs */
|
||||
|
||||
/**
|
||||
* Handle the interface and abstract annotations.
|
||||
* @param {Object} dictionary The tag dictionary.
|
||||
*/
|
||||
exports.defineTags = function (dictionary) {
|
||||
const classTag = dictionary.lookUp('class');
|
||||
dictionary.defineTag('interface', {
|
||||
mustNotHaveValue: true,
|
||||
onTagged: function (doclet, tag) {
|
||||
classTag.onTagged.apply(this, arguments);
|
||||
doclet.virtual = true;
|
||||
},
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user