Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

components-helper

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

components-helper - npm Package Compare versions

Comparing version 1.0.0 to 1.0.2

lib/.DS_Store

46

lib/index.es.js

@@ -37,2 +37,5 @@ import { readFileSync, mkdir, writeFileSync } from 'fs';

}
function checkArray(item) {
return item && item.length ? item : undefined;
}
function isFunction(val) {

@@ -75,3 +78,3 @@ return typeof val === 'function';

if (header && columns) {
content = parseColumns(options, header, columns);
content = parseColumns(options, title, header, columns);
}

@@ -84,5 +87,11 @@ return {

function parseColumn(str) {
return str.replace(/^\|/, '').replace(/\|$/, '').split('|').map(function (item) { return item.trim(); });
return str
.replace(/^\|/, '')
.replace(/\|$/, '')
.replace(/([^\\])\|/g, '$1 |')
.replace(/\|\|/g, '| |')
.split(/[^\\]\|/)
.map(function (item) { return item.replace(/\\\|/g, '|').trim(); });
}
function parseColumns(options, header, str) {
function parseColumns(options, title, header, str) {
var reAttribute = options.reAttribute;

@@ -95,7 +104,8 @@ var list = str.split('\n');

var column_1 = {};
parseColumn(item).forEach(function (value, index) {
var list_1 = parseColumn(item);
list_1.forEach(function (value, index) {
var key = header[index];
if (key) {
column_1[key] = isFunction(reAttribute)
? reAttribute(value, key)
? reAttribute(value, key, list_1, title)
: value;

@@ -187,3 +197,4 @@ }

fileName: fileName,
title: childTitle
title: childTitle,
description: childTitle === data.title ? data.description : undefined
},

@@ -256,3 +267,3 @@ _b[key] = item,

tagsList[name] = {
attributes: tagsProps,
attributes: checkArray(tagsProps),
description: reDescription(options, fileName, description, title),

@@ -328,4 +339,8 @@ };

var child = getWebTypes(options, children);
tagsList = tagsList.concat(child.tags);
directivesList = directivesList.concat(child.attributes);
if (child.tags) {
tagsList = tagsList.concat(child.tags);
}
if (child.attributes) {
directivesList = directivesList.concat(child.attributes);
}
}

@@ -375,5 +390,5 @@ if (!name || (!props && !events && !slots))

'doc-url': getDocUrl(options, fileName, title),
attributes: propsList,
events: eventsList,
slots: slotsList,
attributes: checkArray(propsList),
events: checkArray(eventsList),
slots: checkArray(slotsList),
});

@@ -384,3 +399,6 @@ };

}
return { tags: tagsList, attributes: directivesList };
return {
tags: checkArray(tagsList),
attributes: checkArray(directivesList),
};
}

@@ -390,3 +408,3 @@

var path = join(options.outDir, options[type]).replace(/\\/, '/');
var buffer = JSON.stringify(data);
var buffer = JSON.stringify(data, null, options.space);
writeFileRecursive(path, buffer);

@@ -393,0 +411,0 @@ }

@@ -30,2 +30,5 @@ (function(g,f){typeof exports==='object'&&typeof module!=='undefined'?f(exports,require('fs'),require('path')):typeof define==='function'&&define.amd?define(['exports','fs','path'],f):(g=typeof globalThis!=='undefined'?globalThis:g||self,f(g.ComponentsHelper={},g.fs,g.path));}(this,(function(exports, fs, path){'use strict';var config = {

}
function checkArray(item) {
return item && item.length ? item : undefined;
}
function isFunction(val) {

@@ -66,3 +69,3 @@ return typeof val === 'function';

if (header && columns) {
content = parseColumns(options, header, columns);
content = parseColumns(options, title, header, columns);
}

@@ -75,5 +78,11 @@ return {

function parseColumn(str) {
return str.replace(/^\|/, '').replace(/\|$/, '').split('|').map(function (item) { return item.trim(); });
return str
.replace(/^\|/, '')
.replace(/\|$/, '')
.replace(/([^\\])\|/g, '$1 |')
.replace(/\|\|/g, '| |')
.split(/[^\\]\|/)
.map(function (item) { return item.replace(/\\\|/g, '|').trim(); });
}
function parseColumns(options, header, str) {
function parseColumns(options, title, header, str) {
var reAttribute = options.reAttribute;

@@ -86,7 +95,8 @@ var list = str.split('\n');

var column_1 = {};
parseColumn(item).forEach(function (value, index) {
var list_1 = parseColumn(item);
list_1.forEach(function (value, index) {
var key = header[index];
if (key) {
column_1[key] = isFunction(reAttribute)
? reAttribute(value, key)
? reAttribute(value, key, list_1, title)
: value;

@@ -176,3 +186,4 @@ }

fileName: fileName,
title: childTitle
title: childTitle,
description: childTitle === data.title ? data.description : undefined
},

@@ -243,3 +254,3 @@ _b[key] = item,

tagsList[name] = {
attributes: tagsProps,
attributes: checkArray(tagsProps),
description: reDescription(options, fileName, description, title),

@@ -313,4 +324,8 @@ };

var child = getWebTypes(options, children);
tagsList = tagsList.concat(child.tags);
directivesList = directivesList.concat(child.attributes);
if (child.tags) {
tagsList = tagsList.concat(child.tags);
}
if (child.attributes) {
directivesList = directivesList.concat(child.attributes);
}
}

@@ -360,5 +375,5 @@ if (!name || (!props && !events && !slots))

'doc-url': getDocUrl(options, fileName, title),
attributes: propsList,
events: eventsList,
slots: slotsList,
attributes: checkArray(propsList),
events: checkArray(eventsList),
slots: checkArray(slotsList),
});

@@ -369,6 +384,9 @@ };

}
return { tags: tagsList, attributes: directivesList };
return {
tags: checkArray(tagsList),
attributes: checkArray(directivesList),
};
}function write(options, type, data) {
var path$1 = path.join(options.outDir, options[type]).replace(/\\/, '/');
var buffer = JSON.stringify(data);
var buffer = JSON.stringify(data, null, options.space);
writeFileRecursive(path$1, buffer);

@@ -375,0 +393,0 @@ }

declare type ReComponentName = (title: string, fileName: string, path: string) => string;
declare type ReDocUrl = (fileName: string, header?: string) => string;
declare type ReAttribute = (value: string, key: string) => string | undefined;
declare type ReAttribute = (value: string, key: string, columns: string[], title: string) => string | undefined;
interface OptionsConfig {

@@ -9,2 +9,3 @@ entry: string;

version: string;
space?: string | number;
reComponentName?: ReComponentName;

@@ -62,3 +63,3 @@ reDocUrl?: ReDocUrl;

[key: string]: {
attributes: string[];
attributes?: string[];
description?: string;

@@ -120,4 +121,4 @@ };

'description-markup': string;
tags: WebTag[];
attributes: WebDirective[];
tags?: WebTag[];
attributes?: WebDirective[];
};

@@ -124,0 +125,0 @@ };

import type { Options } from './type';
export declare function hyphenate(str: string): string;
export declare function checkArray<T extends Array<unknown>>(item: T): T | undefined;
export declare function isFunction(val: unknown): val is Function;
export declare function getComponentsName(options: Options, title: string | undefined, fileName: string, path: string): string;
export declare function getDocUrl(options: Options, fileName: string, header?: string): string | undefined;
{
"name": "components-helper",
"version": "1.0.0",
"version": "1.0.2",
"description": "Based on the docs to provide code prompt files for vue component library",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -91,6 +91,12 @@ # components-helper

- Type: `(value: string, key: string) => string | undefined`
- Type: `(value: string, key: string, columns: string[], title: string) => string | undefined`
rewriting the attribute of the component
### space
- Type: `number` | `string`
Adds indentation, white space, and line break characters to the return-value JSON text to make it easier to read
### tags

@@ -97,0 +103,0 @@

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