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
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
entry path, 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 a.md
and b.md
true
string
outDir path
For example: lib
true
string
name of the component library.
true
string
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) => { module?: string; symbol: string } | { file: string; offset: number }
{ symbol: title }
rewriting the source of web-types. (the name of export from conmonents library)
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 webstrom
string
(This is a regular string and ignores case.)props
name of props table. other string in the header will be identified as sub-component
string
Name
name for props header name
string
Description
name for props header description
string
Type
name for props header type
string
Options
name for props header options
string
Default
name for props header default
string
(This is a regular string and ignores case.)events
name of events table. other string in the header will be identified as sub-component
string
Name
name for events header name
string
Description
name for events header description
string
(This is a regular string and ignores case.)slots
name of slots table. other string in the header will be identified as sub-component
string
Name
name for slots header name
string
Description
name for slots header description
string
Subtags
name for slots header subtags
string
(This is a regular string and ignores case.)directives
name of directives table. other string in the header will be identified as sub-component
string
Name
name for directives header name
string
Description
name for directives header description
string
Type
name for directives header type
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 table content information from docs
RegExp
| string
(This is a regular string.)/\/((\w|-)+)\.\w+$/
matches the file name from 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 table, 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 |
Props
Events
Slots
and Directives
, this component are not created.2.0.0
feat
titleRegExp
tableRegExp
and fileNameRegExp
- const helper = require('../lib/index')
+ const helper = require('../lib/index').default
# or
- const helper = require('../lib/index')
+ const { main } = require('../lib/index')
It is recommended to replace regular strings with RegExp
{
- titleRegExp: '#+\\s+(.*)\\n+([^(#|\\n)]*)',
+ titleRegExp: /#+\s+(.*)\n+([^(#|\n)]*)/g,
- titleRegExp: '#+\\s+(.*)\\n+>\\s*([^(#|\\n)]*)',
+ titleRegExp: /#+\s+(.*)\n+>\s*([^(#|\n)]*)/g,
- tableRegExp: '#+\\s+(.*)\\n+(\\|?.+\\|.+)\\n\\|?\\s*:?-+:?\\s*\\|.+((\\n\\|?.+\\|.+)+)',
+ tableRegExp: /#+\s+(.*)\n+(\|?.+\|.+)\n\|?\s*:?-+:?\s*\|.+((\n\|?.+\|.+)+)/g,
- tableRegExp: '#+\\s+(.*\\s*Props|.*\\s*Events|.*\\s*Slots|.*\\s*Directives)\\s*\\n+(\\|?.+\\|.+)\\n\\|?\\s*:?-+:?\\s*\\|.+((\\n\\|?.+\\|.+)+)',
+ tableRegExp: /#+\s+(.*\s*Props|.*\s*Events|.*\s*Slots|.*\s*Directives)\n+(\|?.+\|.+)\n\|?\s*:?-+:?\s*\|.+((\n\|?.+\|.+)+)/g,
- fileNameRegExp: '\\/((\\w|-)+)\\.\\w+$',
+ fileNameRegExp: /\/((\w|-)+)\.\w+$/,
}
FAQs
Based on the docs to provide code prompt files for vue component library
The npm package components-helper receives a total of 245 weekly downloads. As such, components-helper popularity was classified as not popular.
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.