Socket
Socket
Sign inDemoInstall

sveltedoc-parser

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sveltedoc-parser

Generate a JSON documentation for a Svelte file


Version published
Weekly downloads
86K
decreased by-1.77%
Maintainers
1
Weekly downloads
 
Created
Source

The sveltedoc parser

Generate a JSON documentation for a Svelte file

npm

Changelog of release versions can be found here

Install

npm install --save sveltedoc-parser

Features

  • JSDoc support
    • Support description extraction for everything items
    • Support visibility scope from JSDoc keywords: @public, @protected, @private
  • Extract list of imported components
    • Extract relative path to imported component (supports full-syntax and short-syntax import styles)
  • Extract data properties
    • Extract description from JSDoc comment
    • Extract JS type from JSDoc (@type {string}) or parse default value if is not provided
  • Extract computed properties with list of dependencies
  • Extract list of references that attached to components or HTML elements
  • Extract all fired events
    • Events that fired by this component by fire(...) method
    • Events that propogated from child component or HTML elements
    • Custom event handlers with private visibility scope
  • Extract list of used default and named slots
  • Extract component methods
    • Extract description from JSDoc comment
    • Extract parameters description from JSDoc comment
    • Extract JS type from JSDoc for parameters (@param {string} parameter)
    • Identify optional parameters (@param [parameter]), Google Closure Compiler syntax supported as well (@param {string=} parameter)
    • Identify default values for optional parameters (@param [parameter=Default value])
  • Extract component helpers
  • Extract component actions
  • Extract component transitions

Configuration

json PathDescriptionDefault value
filenameThe filename to parse. Required, unless fileContent is passed.
fileContentThe file content to parse. Required, unless filename is passed.
encodingThe file encoding.utf8
featuresThe component features to parse and extracting.By default used all supported features (see below).
ignoredVisibilitiesThe list of ignored visibilities.['private', 'protected']

Supported feature names

  • 'name' - Extract the component name.
  • 'data' - Extract and parse the list of component data properties.
  • 'computed' - Extract and parse the list of component computed properties.
  • 'methods' - Extract the list of component methods.
  • 'actions' - Extract the list of component actions.
  • 'helpers' - Extract the list of component helpers.
  • 'components' - Extract the list of imported components.
  • 'description' - Extract the component description.
  • 'events' - Extract the list of events that fired by this component.
  • 'slots' - Extract the list of slots provided by this component.
  • 'transitions' - Extract the list of transitions used by this component.
  • 'refs' - Extract the list of references used by this component.

Output format

Output format are described at this document.

See example of output here presented in JSON format for this component.

Usage

const sveltedoc = require('sveltedoc-parser');
const options = {
    filename: 'main.svelte'
};

sveltedoc.parse(options)
    .then(componentDoc => {
        console.log(componentDoc);
    })
    .catch(e => {
        console.error(e);
    });

Issues

All list of known issues presented at this page.

Found a new issues? Please contribute and write detailed description here.

Contributors

Author Alexey Mulyukin

Based on vuedoc-parse

Keywords

FAQs

Package last updated on 07 Dec 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc