Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
components-helper
Advanced tools
Based on the docs to provide code prompt files for vue component library
:warning: This library is no longer maintained.
With the WebStorm support of Volar, you may no longer need this library.
It is more recommended that you use Volar's code prompt by improving the type declaration.
If you still need this library, you can continue to use it, but this library will no longer have new feature updates.
Based on the documents to provide code prompt files for vue component library
Reference documents format reference test files
yarn add components-helper -D
# or
npm i components-helper --save-dev
const { main } = require('components-helper')
main({
// Options
})
then in package.json
{
"scripts": {
+ "build:helper": "node helper/file.js"
},
+ "vetur": {
+ "tags": "config outDir/tags.json",
+ "attributes": "config outDir/attributes.json"
+ },
+ "web-types": "config outDir/web-types.json"
}
true
string
| string[]
Specify the entry directory. refer: fast-glob
for example:
docs/*.md
-- matches all files in the docsdocs/(a|b).md
-- matches files a.md
and b.md
docs/!(a|b).md
-- matches files except for a.md
and b.md
object
The config of fast-glob
true
string
Specify the output directory. For example, `lib``
true
string
name of the component library.
true
string
the version of the component library.
number
| string
Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read
string
/
the separator for propsOptions, slotsSubtags, type ...
(title: string, fileName: string, path: string) => string
hyphenate(title || fileName)
rewriting the name of the component
for example (title) => 'prefix-' + title.replace(/\B([A-Z])/g, '-$1').toLowerCase()
(fileName: string, header?: string, path: string) => string | undefind
rewriting the doc url of the component
(value: string, key: string, row: string[], title: string) => string | undefined
rewriting the attribute of the component
(description?: string, defaultValue?: string, docUrl?: string) => string
${description}, default: ${defaultValue}.\n\n[Docs](${docUrl})
rewriting the description of vetur
(title: string, fileName: string, path: string) => Source
rewriting the source of web-types. (the name of export from the component library)
(type: string) => undefined | string | BaseContribution
Only some common types are processed internally, and the rest are exported from the component library by default. If your document also references types in third-party libraries, you can choose to override the relevant behavior through this function
string
tags.json
name for tags of the vetur
string
attributes.json
name for attributes of the Vetur
string
web-types.json
name for web-types of the WebStorm
string
(This is a regular string and ignores case.)props
The title of the props table. other string in the header will be identified as sub-component
string
Name
The header name of the Name
in the props table
string
Description
The header name of the Description
in the props table
string
Type
The header name of the Type
in the props table
string
Options
The header name of the Options
in the props table
string
Default
The header name of the Default
in the props table
string
(This is a regular string and ignores case.)events
The title of the events table. other string in the header will be identified as sub-component
string
Name
The header name of the Name
in the events table
string
Description
The header name of the Description
in the events table
string
(This is a regular string and ignores case.)slots
The title of the slots table. other string in the header will be identified as sub-component
string
Name
The header name of the Name
in the slots table
string
Description
The header name of the Description
in the slots table
string
Type
The header name of the Type
in the slots table
string
Subtags
The header name of the Subtags
in the slots table
string
(This is a regular string and ignores case.)directives
The title of the directives table. other string in the header will be identified as sub-component
string
Name
The header name of the Name
in the directives table
string
Description
The header name of the Description
in the directives table
string
Type
The header name of the Type
in the directives table
RegExp
| string
(This is a regular string.)/#+\s+(.*)\n+([^(#|\n)]*)/g
matches the title and description information from docs
RegExp
| string
(This is a regular string.)/#+\s+(.*)\n+(\|?.+\|.+)\n\|?\s*:?-+:?\s*\|.+((\n\|?.+\|.+)+)/g
matches the title and table header and the table contains information from docs
RegExp
| string
(This is a regular string.)/\/((\w|-)+)\.\w+$/
matches the file name from the path
matches the first format information in the docs
/#+\s+(.*
)\n+([^(#|\n)]*
)/
title
description
and
title
matches other formats, For example:
/#+\s+(.*
)\n+>\s*([^(#|\n)]*
)/g
title
description
matches the format information in the docs
/#+\s+(.*
)\n+(\|?.+\|.+
)\n|?\s*:?-+:?\s*|.+((\n\|?.+\|.+)+
)/g
title
| header |
| column |
| column |
and
sub-component title
| header |
| column |
| column |
by default matches all tables, Optimize it through tableRegExp, For example:
/#+\s+(.*\s*Props|.*\s*Events|.*\s*Slots|.*\s*Directives
)\n+(\|?.+\|.+
)\n|?\s*:?-+:?\s*|.+((\n\|?.+\|.+)+
)/g
Props / Events / Slots / Directives
| header |
| column |
| column |
and
sub-component Props
| header |
| column |
| column |
When this document does not include the primary title or Props
Events
Slots
and Directives
, this component is not created.
FAQs
Based on the docs to provide code prompt files for vue component library
We found that components-helper demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.