Generate a JSON documentation for a SFC Vue component. Contribute: https://gitlab.com/vuedoc/parser#contribute
The vuedoc/parser
is now able to parse a JS file component. This enhancement closes the #21
const parser = require('@vuedoc/parser')
const options = {
filename: 'components/checkbox.js'
}
parser.parse(options).then((component) => {
console.log(component)
})
This release just improves the documentation with more samples
This major release add a new feature and uses the NodeJS v6.11.2 as default engine.
options.features
The new options.features
lets you select which Vue Features you want to parse and extract.
The default value is define by Parser.SUPPORTED_FEATURES
array.
Usage
Only parse name
, props
, computed properties
and events
:
const vuedoc = require('@vuedoc/parser')
const options = {
filename: 'test/fixtures/checkbox.vue',
features: [ 'name', 'props', 'computed', 'events' ]
}
vuedoc.parse(options)
.then((component) => console.log(component)) // => { name, props, computed, events }
.catch((err) => console.error(err))
Parse all features except data
:
const vuedoc = require('@vuedoc/parser')
const Parser = require('@vuedoc/parser/lib/parser')
const options = {
filename: 'test/fixtures/checkbox.vue',
features: Parser.SUPPORTED_FEATURES.filter((feature) => feature !== 'data')
}
vuedoc.parse(options)
.then((component) => console.log(component)) // => { name, description, keywords, props, computed, events, methods }
.catch((err) => console.error(err))
There was a bug when the given component file didn't have a script entry. In this case, the parser was not able to emit the end
event. This is now fixed.
Now @vuedoc/parser
requires the v6.11.2
(or higher) of NodeJS.
This release add the support of Computed Getters
component.data
parsingThis new release introduces Keywords Extraction Feature. This enable to attach keywords to a comment and then extract them using the parser.
Decoration:
/**
* Component description
*
* @author Sébastien
* @license MIT
*/
export default {
name: 'my-checkbox',
created () {
/**
* @param boolean
*/
this.$emit('created', true)
}
}
Parsing result:
{
"name": "my-checkbox",
"description": "Component description",
"keywords": [
{
"name": "author",
"description": "Sébastien"
},
{
"name": "license",
"description": "MIT"
}
],
"props": [],
"methods": [],
"events": [
{
"name": "created",
"description": "",
"visibility": "public",
"keywords": [
{
"name": "param",
"description": "boolean"
}
]
}
],
"slots": []
}
This release also fixes some issues:
-