diff --git a/package.json b/package.json index 310b914..de80010 100644 --- a/package.json +++ b/package.json @@ -66,7 +66,7 @@ "floss": "^1.2.0", "gh-pages": "^0.11.0", "jaguarjs-jsdoc": "^1.0.1", - "jsdoc": "git+https://github.com/jsdoc3/jsdoc.git#releases/3.4", + "jsdoc": "^3.4.2", "minimist": "^1.2.0", "mkdirp": "^0.5.1", "parallelshell": "^2.0.0", diff --git a/package.json b/package.json index 310b914..de80010 100644 --- a/package.json +++ b/package.json @@ -66,7 +66,7 @@ "floss": "^1.2.0", "gh-pages": "^0.11.0", "jaguarjs-jsdoc": "^1.0.1", - "jsdoc": "git+https://github.com/jsdoc3/jsdoc.git#releases/3.4", + "jsdoc": "^3.4.2", "minimist": "^1.2.0", "mkdirp": "^0.5.1", "parallelshell": "^2.0.0", diff --git a/scripts/jsdoc-fix.js b/scripts/jsdoc-fix.js new file mode 100644 index 0000000..3f239b3 --- /dev/null +++ b/scripts/jsdoc-fix.js @@ -0,0 +1,22 @@ +'use strict'; + +// JSDoc has issues getting the name of `export default class NAME {}` +// this gross regex hacks around that issue until it is fixed. +// See: https://github.com/jsdoc3/jsdoc/issues/1137#issuecomment-174829004 + +const rgxGross = /(\/\*{2}[\W\w]+?\*\/)\s*export\s+default\s+class\s+([^\s]*)/g; +const grossReplace = 'export default $2;\n\n$1\nclass $2'; + +exports.handlers = { + /** + * Called before parsing a file, giving us a change to replace the source. + * + * @param {*} e - The `beforeParse` event data. + * @param {string} e.filename - The name of the file being parsed. + * @param {string} e.source - The source of the file being parsed. + */ + beforeParse(e) + { + e.source = e.source.replace(rgxGross, grossReplace); + }, +}; diff --git a/package.json b/package.json index 310b914..de80010 100644 --- a/package.json +++ b/package.json @@ -66,7 +66,7 @@ "floss": "^1.2.0", "gh-pages": "^0.11.0", "jaguarjs-jsdoc": "^1.0.1", - "jsdoc": "git+https://github.com/jsdoc3/jsdoc.git#releases/3.4", + "jsdoc": "^3.4.2", "minimist": "^1.2.0", "mkdirp": "^0.5.1", "parallelshell": "^2.0.0", diff --git a/scripts/jsdoc-fix.js b/scripts/jsdoc-fix.js new file mode 100644 index 0000000..3f239b3 --- /dev/null +++ b/scripts/jsdoc-fix.js @@ -0,0 +1,22 @@ +'use strict'; + +// JSDoc has issues getting the name of `export default class NAME {}` +// this gross regex hacks around that issue until it is fixed. +// See: https://github.com/jsdoc3/jsdoc/issues/1137#issuecomment-174829004 + +const rgxGross = /(\/\*{2}[\W\w]+?\*\/)\s*export\s+default\s+class\s+([^\s]*)/g; +const grossReplace = 'export default $2;\n\n$1\nclass $2'; + +exports.handlers = { + /** + * Called before parsing a file, giving us a change to replace the source. + * + * @param {*} e - The `beforeParse` event data. + * @param {string} e.filename - The name of the file being parsed. + * @param {string} e.source - The source of the file being parsed. + */ + beforeParse(e) + { + e.source = e.source.replace(rgxGross, grossReplace); + }, +}; diff --git a/scripts/jsdoc.conf.json b/scripts/jsdoc.conf.json index a935b29..553e61c 100644 --- a/scripts/jsdoc.conf.json +++ b/scripts/jsdoc.conf.json @@ -13,7 +13,8 @@ "excludePattern": "(^|\\/|\\\\)_" }, "plugins": [ - "plugins/markdown" + "./node_modules/jsdoc/plugins/markdown", + "./scripts/jsdoc-fix" ], "templates": { "cleverLinks" : false,