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

@huyikai/vitepress-helper

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@huyikai/vitepress-helper - npm Package Compare versions

Comparing version 0.0.3 to 0.0.6

bin/create.ts

2

lib/index.esm.js

@@ -1,2 +0,2 @@

import t from"fs-extra";import e from"globby";import r from"gray-matter";import{v4 as i}from"uuid";import{treeToArray as n,arrayToTree as o}from"tree-conver";const a=(t,e)=>t.frontMatter.date<e.frontMatter.date?1:-1;var l=async n=>{const{directory:o}=n,l=await e([`${o}/**/**.md`],{ignore:["node_modules","README.md","packages"]});let d=await Promise.all(l.map((async e=>{const n=await t.readFile(e,"utf-8"),o=r(n);return{frontMatter:o.data,link:e,content:o.content.replace(/[^a-zA-Z0-9._ ]+/g,"").toLowerCase(),uuid:i()}})));return d=d.filter((t=>!t.frontMatter.page||t.link.includes(`${o}/`))),d.sort(a),d};const d=(t,e)=>t.map((t=>{const{link:r,frontMatter:n}=t,o=r.split(`${e}/`)[1].split("/"),a=o.slice(0,-1).join("/"),l=n?.title||o.slice(-1).join("").replace(".md",""),d=o.length-1;return{...t,id:i(),text:l,link:o.join("/"),level:d,dir:a}})),s=t=>{const{pages:e,directory:r,transformItem:a}=t,l=d(e,r).filter((t=>t.level>0)),s=(t=>{const e={children:[]};return t.forEach((t=>{let r=e;t.forEach(((e,n)=>{let o=r.children.find((t=>t.text===e));o||(o={text:e,id:i(),dir:t.slice(0,n+1).join("/"),children:[]},r.children.push(o)),r=o}))})),e.children})(l.map((t=>t.link.split("/").slice(0,-1)))),p=n(s);l.forEach((t=>{p.forEach((e=>{e.dir===t.dir&&(t.parentId=e.id)}))}));const m=[...c(p,"dir"),...c(l,"link")].map((t=>a(t)));return o(m,{idKey:"id",pidKey:"parentId",childrenKey:"items"})},c=(t,e)=>{if(e){const r=(t,r)=>t[e].localeCompare(r.link);return t.sort(r)}return t.sort()};var p=t=>{const{pages:e,directory:r}=t,i=d(e,r).filter((t=>0===t.level));return[...c(i.map((t=>({...t,text:"index.md"===t.link?"Home":t.text,link:`/${t.link}`}))),"text"),...s({pages:e,directory:r,transformItem:t=>({text:t.text,link:t.link?`/${t.link}`:void 0,id:t.id,parentId:t.parentId})})]},m=t=>{const{pages:e,directory:r,collapsible:i}=t;return s({pages:e,directory:r,transformItem:t=>{const{id:e,text:r,link:n,dir:o,parentId:a}=t;return{text:r,id:e,dir:o,parentId:a,collapsed:!(!n&&!0===i)&&void 0,link:n?`/${n}`:void 0}}}).reduce(((t,e)=>{const r=`/${e.text}/`;return t[r]||(t[r]=[]),t[r].push({text:e.text,collapsed:!0!==i&&void 0,items:[...e.items]}),t}),{})},f=async(t={directory:"docs",collapsible:!0})=>{const e=await l(t),r={pages:e,...t};return{nav:p(r),sidebar:m(r),pages:e}};export{f as default,f as init,p as nav,l as pages,m as sidebar};
import t from"fs-extra";import e from"globby";import r from"gray-matter";import{v4 as i}from"uuid";import{treeToArray as n,arrayToTree as o}from"tree-conver";const a=(t,e)=>t.frontMatter.date<e.frontMatter.date?1:-1;var l=async n=>{const{directory:o}=n,l=await e([`${o}/**/**.md`],{ignore:["node_modules","README.md","packages"]});let d=await Promise.all(l.map((async e=>{const n=await t.readFile(e,"utf-8"),o=r(n);return{frontMatter:o.data,link:e,content:o.content.replace(/[^a-zA-Z0-9._ ]+/g,"").toLowerCase(),uuid:i()}})));return d=d.filter((t=>!t.frontMatter.page||t.link.includes(`${o}/`))),d.sort(a),d};const d=(t,e)=>t.map((t=>{const{link:r,frontMatter:n}=t,o=r.split(`${e}/`)[1].split("/"),a=o.slice(0,-1).join("/"),l=n?.title||o.slice(-1).join("").replace(".md",""),d=o.length-1;return{...t,id:i(),text:l,link:o.join("/"),level:d,dir:a}})),s=t=>{const{pages:e,directory:r,transformItem:a}=t,l=d(e,r).filter((t=>t.level>0)),s=(t=>{const e={children:[]};return t.forEach((t=>{let r=e;t.forEach(((e,n)=>{let o=r.children.find((t=>t.text===e));o||(o={text:e,id:i(),dir:t.slice(0,n+1).join("/"),children:[]},r.children.push(o)),r=o}))})),e.children})(l.map((t=>t.link.split("/").slice(0,-1)))),p=n(s);l.forEach((t=>{p.forEach((e=>{e.dir===t.dir&&(t.parentId=e.id)}))}));const m=[...c(l,"link"),...c(p,"dir")].map((t=>a(t)));return o(m,{idKey:"id",pidKey:"parentId",childrenKey:"items"})},c=(t,e)=>{if(e){const r=(t,r)=>t[e].localeCompare(r[e]);return t.sort(r)}return t.sort()};var p=t=>{const{pages:e,directory:r}=t,i=d(e,r).filter((t=>0===t.level));return[...c(i.map((t=>({...t,text:"index.md"===t.link?"Home":t.text,link:`/${t.link}`}))),"text"),...s({pages:e,directory:r,transformItem:t=>({text:t.text,link:t.link?`/${t.link}`:void 0,id:t.id,parentId:t.parentId})})]},m=t=>{const{pages:e,directory:r,collapsible:i}=t;return s({pages:e,directory:r,transformItem:t=>{const{id:e,text:r,link:n,dir:o,parentId:a}=t;return{text:r,id:e,dir:o,parentId:a,collapsed:!(!n&&!0===i)&&void 0,link:n?`/${n}`:void 0}}}).reduce(((t,e)=>{const r=`/${e.text}/`;return t[r]||(t[r]=[]),t[r].push({text:e.text,collapsed:!0!==i&&void 0,items:[...e.items]}),t}),{})},f=async(t={directory:"docs",collapsible:!0})=>{const e=await l(t),r={pages:e,...t};return{nav:p(r),sidebar:m(r),pages:e}};export{f as default,f as init,p as nav,l as pages,m as sidebar};
//# sourceMappingURL=index.esm.js.map
{
"author": "huyikai",
"name": "@huyikai/vitepress-helper",
"private": false,
"version": "0.0.6",
"description": "enhance vitepress experience",
"keywords": [
"vite",
"vitepress",
"vitepress-helper"
],
"homepage": "https://github.com/huyikai/vitepress-helper",
"bugs": {
"url": "https://github.com/huyikai/vitepress-helper/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/huyikai/vitepress-helper"
},
"license": "MIT",
"author": "huyikai",
"type": "module",
"main": "lib/index.esm.js",
"module": "lib/index.esm.js",
"types": "lib/types/index.d.ts",
"bin": {
"vitepress-helper": "./lib/bin/index.js"
},
"files": [
"lib",
"template",
"theme",
"bin"
],
"scripts": {
"build": "rollup --config rollup.config.ts --configPlugin typescript",
"sort": "sort-package-json",
"tsc": "tsc -p ./tsconfig.json",
"release": "release-it"
},
"dependencies": {
"@axolo/tree-array": "^0.2.1",
"chalk": "^5.3.0",
"commander": "^11.1.0",
"figlet": "^1.7.0",
"fs-extra": "^10.1.0",

@@ -14,41 +51,22 @@ "globby": "^11.0.1",

},
"description": "enhance vitepress experience",
"devDependencies": {
"@release-it/conventional-changelog": "^8.0.1",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-terser": "^0.4.1",
"@rollup/plugin-typescript": "^11.1.5",
"@types/figlet": "^1.5.8",
"@types/fs-extra": "^11.0.4",
"@types/inquirer": "^9.0.7",
"@types/node": "^18.16.3",
"@types/uuid": "^9.0.7",
"release-it": "^17.0.1",
"rollup": "^3.21.5",
"rollup-plugin-add-shebang": "^0.3.1",
"tslib": "^2.3.1",
"typescript": "^5.0.4"
},
"files": [
"lib"
],
"homepage": "https://github.com/huyikai/vitepress-helper",
"keywords": [
"vite",
"vitepress",
"vitepress-helper"
],
"license": "MIT",
"main": "lib/index.esm.js",
"module": "lib/index.esm.js",
"name": "@huyikai/vitepress-helper",
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "https://github.com/huyikai/vitepress-helper"
},
"scripts": {
"build": "rollup --config rollup.config.ts --configPlugin typescript",
"tsc": "tsc -p ./tsconfig.json"
},
"type": "module",
"types": "lib/types/index.d.ts",
"version": "0.0.3"
}
"access": "public",
"registry": "https://registry.npmjs.org"
}
}

@@ -1,1 +0,7 @@

# vitepress-helper
# VitePress-Helper
## Usage
```shell
npx @huyikai/vitepress-Helper init
```

Sorry, the diff of this file is not supported yet

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