Skip to content

Parsing control with options.features

Choose a tag to compare

@demsking demsking released this 01 Nov 15:44

This major release add a new feature and uses the NodeJS v6.11.2 as default engine.

New option: 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))

Bug fix

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.

NodeJS v6.11.2

Now @vuedoc/parser requires the v6.11.2 (or higher) of NodeJS.