Unable to parse
Closed this issue · 4 comments
Describe the bug
Running the following vuepress-jsdoc --source ./src --dist ./docs --folder code --title API --exclude *.test.js,exclude.js,*.md,*.gql
inside of a large Vue/Typescript project and am receiving the following error:
ERROR: Unable to parse /var/folders/z_/53b8n6wn5ysf78x0m0xrxf440000gn/T/2lxi6oo7198arjxo05wq3w.js: Unexpected token (6:17)
error ./src/bindings/local-binding.ts -> ./docs/code/bindings/local-binding.md
ERROR: Unable to parse /var/folders/z_/53b8n6wn5ysf78x0m0xrxf440000gn/T/ob09t9tje6ghg2el2es3c.js: Unexpected token (14:17)
error ./src/components/button-triggered-dialogs/card-table-selection-dialog.tsx -> ./docs/code/components/button-triggered-dialogs/card-table-selection-dialog.md
ERROR: Unable to parse /var/folders/z_/53b8n6wn5ysf78x0m0xrxf440000gn/T/m1y900xsepawm2ffw5a8s.js: Unexpected token, expected "," (1:37)
error ./src/components/button-triggered-dialogs/get-place-icon-name.ts -> ./docs/code/components/button-triggered-dialogs/get-place-icon-name.md
ERROR: Unable to parse /var/folders/z_/53b8n6wn5ysf78x0m0xrxf440000gn/T/m9fv3letqunvd95rrzat7.js: Unexpected reserved word 'interface' (15:0)
error ./src/components/button-triggered-dialogs/places-tree-selection-dialog.tsx -> ./docs/code/components/button-triggered-dialogs/places-tree-selection-dialog.md
ERROR: Unable to parse /var/folders/z_/53b8n6wn5ysf78x0m0xrxf440000gn/T/ofio7afi8yhlo6guhcrkp.js: Unexpected token, expected "," (11:32)
error ./src/components/button-triggered-dialogs/selection-dialogs.tsx -> ./docs/code/components/button-triggered-dialogs/selection-dialogs.md
^C
The error is occurring on nearly all files, I haven't seen it hit one successfully.
Node (please complete the following information):
Have tried both 10.16.0
and 12.16.1
.
Additional context
We use GraphQL and have a lot of custom types being defined, I am a bit of a newbie with this stuff and this may be something that I have failed to setup on my end to get this working.
Hi @rebz (:
Could you please give me an example, so I can reproduce it?
Thanks for reporting!
I ran into similar error messages when trying to run vuepress-js-doc
on top of a simplified Typescript repository. I can currently reproduce the results @rebz is seeing every time if there are *.ts files in my source directory. This is a pretty new repository so at the time of writing all these devDependencies should be close to their latest versions:
"@babel/cli": "^7.8.4",
"@babel/core": "^7.9.0",
"@babel/plugin-proposal-class-properties": "^7.8.3",
"@babel/preset-env": "^7.9.5",
"@babel/preset-typescript": "^7.9.0",
"@types/jest": "^25.2.1",
"babel-jest": "^25.3.0",
"jest": "^25.3.0",
"typescript": "^3.8.3",
"vuepress": "^1.4.0",
"vuepress-jsdoc": "^2.1.1"
I bypassed the issue by manually building my output files, then updating the --source
parameter to point at the lib
output directory instead of my src
directory.
Example:
vuepress-jsdoc --source ./lib --dist ./documentation --folder code --title API --exclude *.test.ts,*.d.ts,exclude.js
Alrighty! I'll try to reproduce it. Thank you ;)
Hi again. I've added a full working example inside the ./example
folder and added a small typescript section to the README.md. Hopefully this will work for you.
tl;dr: You have to specify a jsdoc.json
and install some babel dependencies.