Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
sveltedoc-parser
Advanced tools
Generate a JSON documentation for a Svelte file
<script>
blockslocations
was added to items and presents the list of item code locationsloc
for items marked as deprecated, see locations
property insteadThanks to hontas for following fixes:
type
property was setup with wrong structure and data, now it fixed.Thanks to hontas for following changes:
@component
JSDoc attribute.keywords
feature correctly supported.Thanks to hontas for following changes:
@type
keyword.Full changelog of release versions can be found here
npm install --save sveltedoc-parser
@public
, @protected
, @private
@component
. Example script, Example html@type {string}
) or parse default value if is not provided<button on:click>...</button>
... on:click|once
fire(...)
methodprivate
visibility scopeslots
@param {string} parameter
)@param [parameter]
), Google Closure Compiler syntax supported as well (@param {string=} parameter
)@param [parameter=Default value]
)json Path | Description | Default value |
---|---|---|
filename | The filename to parse. Required, unless fileContent is passed. | |
fileContent | The file content to parse. Required, unless filename is passed. | |
encoding | The file encoding. | utf8 |
features | The component features to parse and extracting. | By default used all supported features (see below). |
ignoredVisibilities | The list of ignored visibilities. | ['private', 'protected'] |
includeSourceLocations | Flag, which indicates that source locations should be provided for component symbols. | false |
version | Optional. Use 2 or 3 to specify which svelte syntax should be used. When that is not provided, parser try to detect version of the syntax. | undefined |
defaultVersion | Optional. Specify default version of svelte syntax, if auto-detector can't identify correct version. | undefined |
'name'
- Extract the component name (Supported by Svelte 2 and Svelte 3).'data'
- Extract and parse the list of component data properties (Supported by Svelte 2 and Svelte 3).'computed'
- Extract and parse the list of component computed properties (Supported by Svelte 2 and Svelte 3).'methods'
- Extract the list of component methods (Supported by Svelte 2 and Svelte 3).'actions'
- Extract the list of component actions (Supported by Svelte 2).'helpers'
- Extract the list of component helpers (Supported by Svelte 2).'components'
- Extract the list of imported components (Supported by Svelte 2 and Svelte 3).'description'
- Extract the component description (Supported by Svelte 2 and Svelte 3).'keywords'
- Extract the component keywords (Supported by Svelte 2 and Svelte 3).'events'
- Extract the list of events that fired by this component (Supported by Svelte 2 and Svelte 3).'slots'
- Extract the list of slots provided by this component (Supported by Svelte 2 and Svelte 3).'transitions'
- Extract the list of transitions used by this component (Supported by Svelte 2).'refs'
- Extract the list of references used by this component (Supported by Svelte 2 and Svelte 3).Output format are described at this document.
See example of output for Svelte 2 component here presented in JSON format for this component.
const sveltedoc = require('sveltedoc-parser');
const options = {
filename: 'main.svelte'
};
sveltedoc.parse(options)
.then(componentDoc => {
console.log(componentDoc);
})
.catch(e => {
console.error(e);
});
Method to parse svelte component and provide doc object structure with details information.
Method to detect svelte syntax version
3
when Svelte 3 special syntax feature are used2
when Svelte 2 special syntax feature are useddefaultVersion
or undefined
when specific version can't be identifiedAll list of known issues presented at this page.
Found a new issues? Please contribute and write detailed description here.
Author Alexey Mulyukin
Based on vuedoc-parse
[2.3.4] 10.12.2019
keywords
feature correctly supported.Thanks to hontas for following changes:
@type
keyword.FAQs
Generate a JSON documentation for a Svelte file
The npm package sveltedoc-parser receives a total of 71,799 weekly downloads. As such, sveltedoc-parser popularity was classified as popular.
We found that sveltedoc-parser demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
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.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.