Skip to content
This repository was archived by the owner on Mar 8, 2019. It is now read-only.

Commit 1e66572

Browse files
authored
feat: use ast to parse doc more quickly (#68)
It would be amazing to avoid execution issues when looking at documentation. Plus, no execution means better performance. Abstract Syntax Tree (ast) are a way to parse code without evalualting or even compiling it. We can then travese those tree structure to find the information we need. New algorythm 1. get the **script block** and **template block** from the **Single File Component** (SFC) using vue-template-compiler.parse 1. get the **AST** from this **script block** using `recast` and `@babel/parser` 1. get the **exported subtree** of this **AST** which will contain the documented component 1. get the **displayName**, **props** and **methods** from this **AST** (to get types, default and parameter names) 1. get the **docblocks** out of the **script block** or the **AST** 1. merge the **docblocks** with the **props** and **mehods** 1. add the **slots** documentations to the documentation object - [x] General Scaffolding - [x] Props Handler - [x] Methods and params Handler - [x] Component description, name and comment Handler (extra tags to be handled) - [x] Slots Handler - [x] Mixins Handler - [x] Events handler - [x] `extends` property of a component (implement like a mixin) - [x] jsx parser - [x] typescript parser - [x] get rid of the `react-docgen` dependency (only used for `resolveToValue`) - [x] rewrite the lib in typescript - [x] deal with require mixins and extends - [x] use typescritpt/flow parsing to determine type of arguments - [x] enable parsing of Decorated class type components `vue-property-decorator` fixes #73, #58, #53, #50, #44, #33, #27, #25, #23, #11, #9 [BREAKING CHANGE]: `comment` properties (containing the full extract of each leading comment (with all the `/**` and the ` * `) are entirely removed from the documentation as they were not useful. Use `description` or `tags` instead. [BREAKING CHANGE]: Events that are not commented near their call will not anymore be parsed. If you want to document events, do it as a leading comment of your event call
1 parent beba3b0 commit 1e66572

File tree

134 files changed

+4776
-4151
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

134 files changed

+4776
-4151
lines changed

.babelrc

Lines changed: 0 additions & 6 deletions
This file was deleted.

.eslintignore

Lines changed: 0 additions & 4 deletions
This file was deleted.

.eslintrc

Lines changed: 0 additions & 38 deletions
This file was deleted.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
/dist/
22
node_modules/
33
.eslintcache
4+
coverage/

.prettierignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
**/*.test.js
2-
dist/**/*.js
1+
dist/

.prettierrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"printWidth": 100,
33
"singleQuote": true,
4-
"trailingComma": "es5",
4+
"trailingComma": "all",
55
"semi": false,
66
"bracketSpacing": true,
77
"useTabs": false,

0 commit comments

Comments
 (0)