-
Notifications
You must be signed in to change notification settings - Fork 0
Description
When processing documentation tags in comments of a JS source file bit-docs-js passes an empty docObject. This is done here:
bit-docs-js/process/code_and_comment.js
Lines 57 to 66 in 091899e
| processTags({ | |
| comment: options.comment, | |
| scope: options.scope, | |
| docMap: options.docMap, | |
| docObject: {}, | |
| tags: options.tags || {}, | |
| siteConfig: options.siteConfig || {} | |
| }, function(newDoc, newScope){ | |
| callback(newDoc, newScope); | |
| }); |
This causes usage of tags like @sourceref to fail, since it expects to be able to reference the src property of the docObject.
This issue is easily reproduced by trying to use @sourceref in any documentation comment of a JS file and then attempting to generate the docs. This will result in an error like the following:
TypeError: Cannot read property 'path' of undefined
at Object.add (/Users/nlundqu/canjs/node_modules/bit-docs/lib/configure/node_modules/bit-docs-tag-sourceref/sourceref.js:18:21)
at module.exports (/Users/nlundqu/canjs/node_modules/bit-docs/lib/configure/node_modules/bit-docs-process-tags/process-tags.js:95:29)
at module.exports (/Users/nlundqu/canjs/node_modules/bit-docs/lib/configure/node_modules/bit-docs-js/process/code_and_comment.js:54:3)
at /Users/nlundqu/canjs/node_modules/bit-docs/lib/configure/node_modules/bit-docs-js/process/javascript.js:26:13
at Array.map (<anonymous>)
at module.exports (/Users/nlundqu/canjs/node_modules/bit-docs/lib/configure/node_modules/bit-docs-js/process/javascript.js:25:29)
at /Users/nlundqu/canjs/node_modules/bit-docs/lib/process/file.js:80:17
at Array.some (<anonymous>)
at processFile (/Users/nlundqu/canjs/node_modules/bit-docs/lib/process/file.js:79:40)
at /Users/nlundqu/canjs/node_modules/bit-docs/lib/process/process.js:79:9
I attempted a naive fix by changing line 61 of code_and_comment.js above to docObject: options.docObject || {}, since options.docObject was defined while I was debugging, however this introduced new errors while processing the tags of other source files in the CanJS docs.