From b58bc3a4ddcf63569d82a2828fb4f45490cf16c0 Mon Sep 17 00:00:00 2001 From: pei-pay Date: Sat, 13 Apr 2024 16:09:31 +0900 Subject: [PATCH 01/20] chapter: wip markdown transform --- meta/packages.ts | 157 +++++++++++++++ package.json | 9 +- packages/.vitepress/config.ts | 71 ++++++- .../.vitepress/plugins/markdownTransform.ts | 182 ++++++++++++++++++ packages/.vitepress/vite.config.ts | 23 +++ packages/metadata/index.json | 54 ++++++ packages/metadata/index.ts | 3 + packages/metadata/metadata.ts | 35 ++++ packages/metadata/package.json | 8 + packages/metadata/scripts/update.ts | 160 +++++++++++++++ packages/metadata/types.ts | 66 +++++++ packages/metadata/utils.ts | 20 ++ pnpm-lock.yaml | 105 ++++++++++ tsconfig.app.json | 4 +- 14 files changed, 885 insertions(+), 12 deletions(-) create mode 100644 meta/packages.ts create mode 100644 packages/.vitepress/plugins/markdownTransform.ts create mode 100644 packages/.vitepress/vite.config.ts create mode 100644 packages/metadata/index.json create mode 100644 packages/metadata/index.ts create mode 100644 packages/metadata/metadata.ts create mode 100644 packages/metadata/package.json create mode 100644 packages/metadata/scripts/update.ts create mode 100644 packages/metadata/types.ts create mode 100644 packages/metadata/utils.ts diff --git a/meta/packages.ts b/meta/packages.ts new file mode 100644 index 0000000..d113626 --- /dev/null +++ b/meta/packages.ts @@ -0,0 +1,157 @@ +import type { PackageManifest } from '@vueyous/metadata'; + +export const packages: PackageManifest[] = [ + { + name: 'metadata', + display: 'Metadata for VueUse functions', + manualImport: true, + iife: false, + utils: true, + target: 'node14', + }, + { + name: 'shared', + display: 'Shared utilities', + }, + { + name: 'core', + display: 'VueUse', + description: 'Collection of essential Vue Composition Utilities', + }, + // { + // name: 'components', + // display: 'Components', + // description: 'Renderless components for VueUse', + // author: 'Jacob Clevenger', + // external: [ + // '@vueuse/core', + // '@vueuse/shared', + // ], + // }, + // { + // name: 'math', + // display: 'Math', + // description: 'Math functions for VueUse', + // external: [ + // '@vueuse/shared', + // ], + // }, + // { + // name: 'nuxt', + // display: 'Nuxt', + // description: 'VueUse Nuxt Module', + // manualImport: true, + // addon: true, + // iife: false, + // cjs: false, + // utils: true, + // target: 'node14', + // external: [ + // '@vueuse/core', + // '@vueuse/shared', + // '@nuxt/kit', + // 'local-pkg', + // 'fs', + // 'path', + // 'url', + // 'node:fs', + // 'node:path', + // 'node:url', + // ], + // }, + // { + // name: 'router', + // display: 'Router', + // description: 'Utilities for vue-router', + // addon: true, + // external: [ + // 'vue-router', + // ], + // globals: { + // 'vue-router': 'VueRouter', + // }, + // }, + // { + // name: 'integrations', + // display: 'Integrations', + // description: 'Integration wrappers for utility libraries', + // addon: true, + // submodules: true, + // external: [ + // 'axios', + // 'universal-cookie', + // 'qrcode', + // 'http', + // 'nprogress', + // 'jwt-decode', + // 'focus-trap', + // 'change-case', + // 'drauu', + // '@vueuse/core', + // '@vueuse/shared', + // 'fuse.js', + // 'async-validator', + // 'idb-keyval', + // 'sortablejs', + // 'node:http', + // ], + // globals: { + // 'axios': 'axios', + // 'universal-cookie': 'UniversalCookie', + // 'qrcode': 'QRCode', + // 'nprogress': 'nprogress', + // 'jwt-decode': 'jwt_decode', + // 'focus-trap': 'focusTrap', + // 'drauu': 'Drauu', + // 'fuse.js': 'Fuse', + // 'change-case': 'changeCase', + // 'async-validator': 'AsyncValidator', + // 'idb-keyval': 'idbKeyval', + // 'sortablejs': 'Sortable', + // }, + // }, + // { + // name: 'rxjs', + // display: 'RxJS', + // description: 'Enables RxJS reactive functions in Vue', + // addon: true, + // external: [ + // 'rxjs', + // 'rxjs/operators', + // ], + // globals: { + // 'rxjs': 'rxjs', + // 'rxjs/operators': 'rxjs.operator', + // }, + // }, + // { + // name: 'firebase', + // display: 'Firebase', + // description: 'Enables realtime bindings for Firebase', + // addon: true, + // submodules: true, + // external: [ + // 'firebase', + // 'firebase/app', + // 'firebase/database', + // 'firebase/firestore', + // ], + // globals: { + // 'firebase': 'firebase', + // 'firebase/app': 'firebase', + // 'firebase/database': 'firebase', + // 'firebase/firestore': 'firebase', + // }, + // }, + // { + // name: 'electron', + // display: 'Electron', + // description: 'Electron renderer process modules for VueUse', + // author: 'Archer Gu', + // addon: true, + // external: [ + // 'electron', + // ], + // iife: false, + // }, +]; diff --git a/package.json b/package.json index 7d929d9..ecd380f 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,8 @@ "lint:text": "textlint .", "docs:dev": "vitepress dev packages", "docs:build": "vitepress build packages", - "docs:preview": "vitepress preview packages" + "docs:preview": "vitepress preview packages", + "update": "nr -C packages/metadata update" }, "dependencies": { "@vueuse/core": "^10.9.0", @@ -23,6 +24,7 @@ }, "devDependencies": { "@antfu/eslint-config": "^2.13.3", + "@antfu/ni": "^0.21.12", "@tsconfig/node20": "^20.1.2", "@types/fs-extra": "^11.0.4", "@types/jsdom": "^21.1.6", @@ -33,9 +35,14 @@ "@vueyous/core": "workspace:*", "@vueyous/shared": "workspace:*", "eslint": "^8.49.0", + "@vueyous/metadata": "workspace:*", + "esno": "^4.7.0", + "fast-glob": "^3.3.2", "fs-extra": "^11.2.0", + "gray-matter": "^4.0.3", "jsdom": "^24.0.0", "npm-run-all2": "^6.1.2", + "simple-git": "^3.24.0", "textlint": "^14.0.4", "textlint-rule-ja-space-between-half-and-full-width": "^2.3.1", "typescript": "~5.4.0", diff --git a/packages/.vitepress/config.ts b/packages/.vitepress/config.ts index 8d4d6e7..408f636 100644 --- a/packages/.vitepress/config.ts +++ b/packages/.vitepress/config.ts @@ -1,10 +1,25 @@ -import { defineConfig } from 'vitepress' +import { defineConfig } from 'vitepress'; + +import { categoryNames, coreCategoryNames, metadata } from '../metadata/metadata'; const Guide = [ { text: 'はじめに', link: '/guide/' }, { text: 'VueUseとは', link: '/guide/what-is-vueuse' }, { text: '環境構築', link: '/guide/setup' }, -] +]; + +const CoreCategories = coreCategoryNames.map(c => ({ + text: c, + activeMatch: '___', // never active + link: `/functions#category=${c}`, +})); + +const DefaultSideBar = [ + { text: 'Guide', items: Guide }, + { text: 'Core Functions', items: CoreCategories }, +]; + +const FunctionsSideBar = getFunctionsSideBar(); // https://vitepress.dev/reference/site-config export default defineConfig({ @@ -22,15 +37,51 @@ export default defineConfig({ nav: [ { text: 'Home', link: '/' }, { text: 'Guide', items: Guide }, - ], - - sidebar: [ { - text: 'Guide', - items: Guide, + text: 'Functions', + items: [ + { + text: '', + items: [ + { text: 'All Functions', link: '/functions#' }, + ], + }, + { text: 'Core', items: CoreCategories }, + ], }, ], - socialLinks: [{ icon: 'github', link: 'https://github.com/pei-pay/VueYous' }], - }, -}) + sidebar: { + '/guide/': DefaultSideBar, + '/functions': FunctionsSideBar, + '/core/': FunctionsSideBar, + '/shared/': FunctionsSideBar, + }, + + socialLinks: [{ icon: 'github', link: 'https://github.com/pei-pay/VueYous' }] + } +}); + +function getFunctionsSideBar() { + const links: any = []; + + for (const name of categoryNames) { + if (name.startsWith('_')) + continue; + + const functions = metadata.functions.filter(i => i.category === name && !i.internal); + + links.push({ + text: name, + items: functions.map(i => ({ + text: i.name, + link: i.external || `/${i.package}/${i.name}/`, + })), + link: name.startsWith('@') + ? (functions[0].external || `/${functions[0].package}/README`) + : undefined, + }); + } + + return links; +} diff --git a/packages/.vitepress/plugins/markdownTransform.ts b/packages/.vitepress/plugins/markdownTransform.ts new file mode 100644 index 0000000..25a2e1c --- /dev/null +++ b/packages/.vitepress/plugins/markdownTransform.ts @@ -0,0 +1,182 @@ +import { join, resolve } from 'node:path'; +import type { Plugin } from 'vite'; +import fs from 'fs-extra'; +import ts from 'typescript'; +import { format } from 'prettier'; +import { packages } from '../../../meta/packages'; +import { functionNames, getFunction } from '../../../packages/metadata/metadata'; +// import { getTypeDefinition, replacer } from '../../../scripts/utils'; + +export function MarkdownTransform(): Plugin { + // const DIR_TYPES = resolve(__dirname, '../../../types/packages'); + // const hasTypes = fs.existsSync(DIR_TYPES); + + // if (!hasTypes) + // console.warn('No types dist found, run `npm run build:types` first.'); + + return { + name: 'vueyous-md-transform', + enforce: 'pre', + async transform(code, id) { + if (!id.match(/\.md\b/)) + return null; + + // linkify function names + code = code.replace( + new RegExp(`\`({${functionNames.join('|')}})\`(.)`, 'g'), + (_, name, ending) => { + if (ending === ']') // already a link + return _; + const fn = getFunction(name)!; + return `[\`${fn.name}\`](${fn.docs}) `; + }, + ); + // convert links to relative + // code = code.replace(/https?:\/\/vueuse\.org\//g, '/'); + + const [pkg, _name, i] = id.split('/').slice(-3); + + const name = functionNames.find(n => n.toLowerCase() === _name.toLowerCase()) || _name; + + if (functionNames.includes(name) && i === 'index.md') { + const frontmatterEnds = code.indexOf('---\n\n'); + const firstHeader = code.search(/\n#{2,6}\s.+/); + const sliceIndex = firstHeader < 0 ? frontmatterEnds < 0 ? 0 : frontmatterEnds + 4 : firstHeader; + + // Insert JS/TS code blocks + code = await replaceAsync(code, /\n```ts( [^\n]+)?\n(.+?)\n```\n/gs, async (_, meta = '', snippet = '') => { + const formattedTS = (await format(snippet.replace(/\n+/g, '\n'), { semi: false, singleQuote: true, parser: 'typescript' })).trim(); + const js = ts.transpileModule(formattedTS, { + compilerOptions: { target: 99 }, + }); + const formattedJS = (await format(js.outputText, { semi: false, singleQuote: true, parser: 'typescript' })) + .trim(); + if (formattedJS === formattedTS) + return _; + return ` + +
+ +\`\`\`ts ${meta} +${snippet} +\`\`\` + +
+
+ +\`\`\`js +${formattedJS} +\`\`\` + +
+
\n`; + }); + + const { header } = await getFunctionMarkdown(pkg, name); + + // if (hasTypes) + // code = replacer(code, footer, 'FOOTER', 'tail'); + if (header) + code = code.slice(0, sliceIndex) + header + code.slice(sliceIndex); + + code = code + .replace(/(# \w+?)\n/, `$1\n\n\n`); + // .replace(/## (Components?(?:\sUsage)?)/i, '## $1\n\n\n') + // .replace(/## (Directives?(?:\sUsage)?)/i, '## $1\n\n\n'); + } + + return code; + }, + }; +} + +const DIR_SRC = resolve(__dirname, '../..'); +// const GITHUB_BLOB_URL = 'https://github.com/vueuse/vueuse/blob/main/packages'; +const GITHUB_BLOB_URL = 'https://github.com/pei-pay/VueYous/blob/main/packages'; + +export async function getFunctionMarkdown(pkg: string, name: string) { + const URL = `${GITHUB_BLOB_URL}/${pkg}/${name}`; + + const dirname = join(DIR_SRC, pkg, name); + const demoPath = ['demo.vue'].find(i => fs.existsSync(join(dirname, i))); + // const types = await getTypeDefinition(pkg, name); + + // if (!types) + // console.warn(`No types found for ${pkg}/${name}`); + + // let typingSection = ''; + + // if (types) { + // const code = `\`\`\`typescript\n${types.trim()}\n\`\`\``; + // typingSection = types.length > 1000 + // ? ` + // ## Type Declarations + + //
+ // Show Type Declarations + + // ${code} + + //
+ // ` + // : `\n## Type Declarations\n\n${code}`; + // } + + const links = ([ + ['Source', `${URL}/index.ts`], + demoPath ? ['Demo', `${URL}/${demoPath}`] : undefined, + ['Docs', `${URL}/index.md`], + ]) + .filter(i => i) + .map(i => `[${i![0]}](${i![1]})`).join(' • '); + + const sourceSection = `## Source\n\n${links}\n`; + // const ContributorsSection = ` + // ## Contributors + + // + // `; + // const changelogSection = ` + // ## Changelog + + // + // `; + + const demoSection = demoPath + ? ` + + +## Demo + + + + + +` + : ''; + + const packageNote = packages.find(p => p.name === pkg)!.addon + ? `Available in the @vueuse/${pkg} add-on.\n` + : ''; + + // const footer = `${typingSection}\n\n${sourceSection}\n${ContributorsSection}\n${changelogSection}\n`; + const footer = `${sourceSection}`; + + const header = demoSection + packageNote; + + return { + footer, + header, + }; +} + +function replaceAsync(str: string, match: RegExp, replacer: (substring: string, ...args: any[]) => Promise) { + const promises: Promise[] = []; + str.replace(match, (...args) => { + promises.push(replacer(...args)); + return ''; + }); + return Promise.all(promises).then(replacements => str.replace(match, () => replacements.shift()!)); +} diff --git a/packages/.vitepress/vite.config.ts b/packages/.vitepress/vite.config.ts new file mode 100644 index 0000000..647e6a8 --- /dev/null +++ b/packages/.vitepress/vite.config.ts @@ -0,0 +1,23 @@ +import { resolve } from 'node:path'; +import { defineConfig } from 'vite'; +import { MarkdownTransform } from './plugins/markdownTransform'; + + +export default defineConfig({ + server: { + fs: { + allow: [ + resolve(__dirname, '..'), + ], + }, + }, + plugins: [MarkdownTransform()], + resolve: { + alias: { + '@vueyous/shared': resolve(__dirname, '../shared/index.ts'), + '@vueyous/core': resolve(__dirname, '../core/index.ts'), + '@vueyous/metadata': resolve(__dirname, '../metadata/index.ts'), + }, + dedupe: ['vue'], + } +}); diff --git a/packages/metadata/index.json b/packages/metadata/index.json new file mode 100644 index 0000000..9a3b2e0 --- /dev/null +++ b/packages/metadata/index.json @@ -0,0 +1,54 @@ +{ + "packages": { + "shared": { + "name": "shared", + "display": "Shared utilities", + "dir": "packages/shared" + }, + "core": { + "name": "core", + "display": "VueUse", + "description": "Collection of essential Vue Composition Utilities", + "dir": "packages/core" + } + }, + "categories": [ + "State" + ], + "functions": [ + { + "name": "useCloned", + "package": "core", + "lastUpdated": 1712496642000, + "internal": true + }, + { + "name": "useManualRefHistory", + "package": "core", + "lastUpdated": 1712496642000, + "category": "State", + "description": "", + "related": [ + "useManualRefHistory" + ] + }, + { + "name": "useRefHistory", + "package": "core", + "lastUpdated": 1712984153000, + "internal": true + }, + { + "name": "utils", + "package": "shared", + "lastUpdated": 1712496642000, + "internal": true + }, + { + "name": "watchIgnorable", + "package": "shared", + "lastUpdated": 1712496642000, + "internal": true + } + ] +} diff --git a/packages/metadata/index.ts b/packages/metadata/index.ts new file mode 100644 index 0000000..11eb27f --- /dev/null +++ b/packages/metadata/index.ts @@ -0,0 +1,3 @@ +export * from './types'; +export * from './metadata'; +export * from './utils'; diff --git a/packages/metadata/metadata.ts b/packages/metadata/metadata.ts new file mode 100644 index 0000000..79081bb --- /dev/null +++ b/packages/metadata/metadata.ts @@ -0,0 +1,35 @@ +import type { PackageIndexes } from './types'; +import _metadata, { categories as _categories, functions as _functions, packages as _packages } from './index.json'; + +const categoriesOrder = [ + 'State', + 'Elements', + 'Browser', + 'Sensors', + 'Network', + 'Animation', + 'Component', + 'Watch', + 'Reactivity', + 'Array', + 'Time', + 'Utilities', +]; + +export const metadata = _metadata as PackageIndexes; +export const functions = _functions as PackageIndexes['functions']; +export const packages = _packages as PackageIndexes['packages']; +export const categories = _categories as PackageIndexes['categories']; + +export const functionNames = functions.map(f => f.name); +export const categoryNames = Array.from(categories) + .sort((a, b) => categoriesOrder.indexOf(a) - categoriesOrder.indexOf(b)) + .sort((a, b) => a.startsWith('@') ? 1 : b.startsWith('@') ? -1 : 0); +export const coreCategoryNames = categoryNames + .filter(f => !f.startsWith('@')); +// export const addonCategoryNames = categoryNames +// .filter(f => f.startsWith('@')); + +export function getFunction(name: string) { + return metadata.functions.find(f => f.name === name); +} diff --git a/packages/metadata/package.json b/packages/metadata/package.json new file mode 100644 index 0000000..79dd785 --- /dev/null +++ b/packages/metadata/package.json @@ -0,0 +1,8 @@ +{ + "name": "@vueyous/metadata", + "version": "0.0.1-alpha.1", + "type": "module", + "scripts": { + "update": "esno scripts/update.ts" + } +} \ No newline at end of file diff --git a/packages/metadata/scripts/update.ts b/packages/metadata/scripts/update.ts new file mode 100644 index 0000000..9888111 --- /dev/null +++ b/packages/metadata/scripts/update.ts @@ -0,0 +1,160 @@ +import { join, relative, resolve } from 'node:path'; +import { fileURLToPath } from 'node:url'; +import fs from 'fs-extra'; +import matter from 'gray-matter'; +import type { PackageIndexes, VueUseFunction, VueUsePackage } from '@vueyous/metadata'; +import fg from 'fast-glob'; +import Git from 'simple-git'; +import { packages } from '../../../meta/packages'; +// import { ecosystemFunctions } from '../../../meta/ecosystem-functions'; +import { getCategories } from '../utils'; + +const __dirname = fileURLToPath(new URL('.', import.meta.url)); + +// TODO: put url after deployed +// export const DOCS_URL = 'https://vueuse.org'; +export const DIR_PACKAGE = resolve(__dirname, '..'); +export const DIR_ROOT = resolve(__dirname, '../../..'); +export const DIR_SRC = resolve(DIR_ROOT, 'packages'); +export const DIR_TYPES = resolve(DIR_ROOT, 'types/packages'); + +export const git = Git(DIR_ROOT); + +export async function listFunctions(dir: string, ignore: string[] = []) { + const files = await fg('*', { + onlyDirectories: true, + cwd: dir, + ignore: [ + '_*', + 'dist', + 'node_modules', + ...ignore, + ], + }); + files.sort(); + return files; +} + +export async function readMetadata() { + const indexes: PackageIndexes = { + packages: {}, + categories: [], + functions: [ + // ...ecosystemFunctions, + ], + }; + + for (const info of packages) { + if (info.utils) + continue; + + const dir = join(DIR_SRC, info.name); + + const functions = await listFunctions(dir); + + const pkg: VueUsePackage = { + ...info, + dir: relative(DIR_ROOT, dir).replace(/\\/g, '/'), + // docs: info.addon ? `${DOCS_URL}/${info.name}/README.html` : undefined, + }; + + indexes.packages[info.name] = pkg; + + await Promise.all(functions.map(async (fnName) => { + const mdPath = join(dir, fnName, 'index.md'); + const tsPath = join(dir, fnName, 'index.ts'); + + const fn: VueUseFunction = { + name: fnName, + package: pkg.name, + lastUpdated: +await git.raw(['log', '-1', '--format=%at', tsPath]) * 1000, + }; + + if (fs.existsSync(join(dir, fnName, 'component.ts'))) + fn.component = true; + if (fs.existsSync(join(dir, fnName, 'directive.ts'))) + fn.directive = true; + + if (!fs.existsSync(mdPath)) { + fn.internal = true; + indexes.functions.push(fn); + return; + } + + // fn.docs = `${DOCS_URL}/${pkg.name}/${fnName}/`; + + const mdRaw = await fs.readFile(mdPath, 'utf-8'); + + const { content: md, data: frontmatter } = matter(mdRaw); + const category = frontmatter.category; + + let alias = frontmatter.alias; + if (typeof alias === 'string') + alias = alias.split(',').map(s => s.trim()).filter(Boolean); + let related = frontmatter.related; + if (typeof related === 'string') + related = related.split(',').map(s => s.trim()).filter(Boolean); + else if (Array.isArray(related)) + related = related.map(s => s.trim()).filter(Boolean); + + let description = ( + md + // normalize newlines + .replace(/\r\n/g, '\n') + // remove ::: tip blocks + .replace(/(:{3,}(?=[^:\n]*\n))[^\n]*\n[\s\S]*?(?:\1 *(?=\n))/g, '') + // remove headers + .match(/#(?=\s).*(?:\n+)(.+?)(?:, |\. |\n|\.\n)/m) || [] + )[1] || ''; + + description = description.trim(); + description = description.charAt(0).toLowerCase() + description.slice(1); + + fn.category = ['core', 'shared'].includes(pkg.name) ? category : `@${pkg.display}`; + fn.description = description; + + if (description.includes('DEPRECATED') || frontmatter.deprecated) + fn.deprecated = true; + + if (alias?.length) + fn.alias = alias; + + if (related?.length) + fn.related = related; + + if (pkg.submodules) + fn.importPath = `${pkg.name}/${fn.name}`; + + indexes.functions.push(fn); + })); + } + + indexes.functions.sort((a, b) => a.name.localeCompare(b.name)); + indexes.categories = getCategories(indexes.functions); + + // interop related + indexes.functions.forEach((fn) => { + if (!fn.related) + return; + + fn.related.forEach((name) => { + const target = indexes.functions.find(f => f.name === name); + if (!target) + throw new Error(`Unknown related function: ${name}`); + if (!target.related) + target.related = []; + if (!target.related.includes(fn.name)) + target.related.push(fn.name); + }); + }); + indexes.functions.forEach(fn => fn.related?.sort()); + + return indexes; +} + +async function run() { + const indexes = await readMetadata(); + await fs.writeJSON(join(DIR_PACKAGE, 'index.json'), indexes, { spaces: 2 }); +} + +run(); diff --git a/packages/metadata/types.ts b/packages/metadata/types.ts new file mode 100644 index 0000000..8731c91 --- /dev/null +++ b/packages/metadata/types.ts @@ -0,0 +1,66 @@ +export interface PackageManifest { + name: string; + display: string; + addon?: boolean; + author?: string; + description?: string; + external?: string[]; + globals?: Record; + manualImport?: boolean; + deprecated?: boolean; + submodules?: boolean; + build?: boolean; + iife?: boolean; + cjs?: boolean; + mjs?: boolean; + dts?: boolean; + target?: string; + utils?: boolean; + copy?: string[]; +} + +export interface VueYousFunction { + name: string; + package: string; + importPath?: string; + lastUpdated?: number; + category?: string; + description?: string; + docs?: string; + deprecated?: boolean; + internal?: boolean; + component?: boolean; + directive?: boolean; + external?: string; + alias?: string[]; + related?: string[]; +} + +export interface VueYousPackage extends PackageManifest { + dir: string; + docs?: string; +} + +export interface PackageIndexes { + packages: Record; + categories: string[]; + functions: VueYousFunction[]; +} + +// export interface CommitInfo { +// functions: string[]; +// version?: string; +// hash: string; +// date: string; +// message: string; +// refs?: string; +// body?: string; +// author_name: string; +// author_email: string; +// } + +// export interface ContributorInfo { +// name: string; +// count: number; +// hash: string; +// } diff --git a/packages/metadata/utils.ts b/packages/metadata/utils.ts new file mode 100644 index 0000000..ff3d975 --- /dev/null +++ b/packages/metadata/utils.ts @@ -0,0 +1,20 @@ +import type { VueUseFunction } from './types'; + +export function getCategories(functions: VueUseFunction[]): string[] { + return uniq( + functions + .filter(i => !i.internal) + .map(i => i.category) + .filter(Boolean), + ).sort( + (a, b) => (a.startsWith('@') && !b.startsWith('@')) + ? 1 + : (b.startsWith('@') && !a.startsWith('@')) + ? -1 + : a.localeCompare(b), + ); +} + +export function uniq(a: T) { + return Array.from(new Set(a)); +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0eeea62..e76caec 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -18,6 +18,9 @@ importers: '@antfu/eslint-config': specifier: ^2.13.3 version: 2.13.3(@vue/compiler-sfc@3.4.21)(eslint@8.49.0)(typescript@5.4.2) + '@antfu/ni': + specifier: ^0.21.12 + version: 0.21.12 '@tsconfig/node20': specifier: ^20.1.2 version: 20.1.2 @@ -42,21 +45,36 @@ importers: '@vueyous/core': specifier: workspace:* version: link:packages/core + '@vueyous/metadata': + specifier: workspace:* + version: link:packages/metadata '@vueyous/shared': specifier: workspace:* version: link:packages/shared eslint: specifier: ^8.49.0 version: 8.49.0 + esno: + specifier: ^4.7.0 + version: 4.7.0 + fast-glob: + specifier: ^3.3.2 + version: 3.3.2 fs-extra: specifier: ^11.2.0 version: 11.2.0 + gray-matter: + specifier: ^4.0.3 + version: 4.0.3 jsdom: specifier: ^24.0.0 version: 24.0.0 npm-run-all2: specifier: ^6.1.2 version: 6.1.2 + simple-git: + specifier: ^3.24.0 + version: 3.24.0 textlint: specifier: ^14.0.4 version: 14.0.4 @@ -82,6 +100,8 @@ importers: specifier: workspace:* version: link:../shared + packages/metadata: {} + packages/shared: {} packages: @@ -332,6 +352,11 @@ packages: execa: 8.0.1 dev: true + /@antfu/ni@0.21.12: + resolution: {integrity: sha512-2aDL3WUv8hMJb2L3r/PIQWsTLyq7RQr3v9xD16fiz6O8ys1xEyLhhTOv8gxtZvJiTzjTF5pHoArvRdesGL1DMQ==} + hasBin: true + dev: true + /@azu/format-text@1.0.2: resolution: {integrity: sha512-Swi4N7Edy1Eqq82GxgEECXSSLyn6GOb5htRFPzBDdUkECGXtlf12ynO5oJSpWKPwCaUssOu7NfhDcCWpIC6Ywg==} dev: true @@ -938,6 +963,18 @@ packages: /@jridgewell/sourcemap-codec@1.4.15: resolution: {integrity: sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==} + /@kwsites/file-exists@1.1.1: + resolution: {integrity: sha512-m9/5YGR18lIwxSFDwfE3oA7bWuq9kdau6ugN4H2rJeyhFQZcG9AgSHkQtSD15a8WvTgfz9aikZMrKPHvbpqFiw==} + dependencies: + debug: 4.3.4 + transitivePeerDependencies: + - supports-color + dev: true + + /@kwsites/promise-deferred@1.1.1: + resolution: {integrity: sha512-GaHYm+c0O9MjZRu0ongGBRbinu8gVAMd2UZjji6jVmqKtZluZnptXGWhz1E8j8D2HJ3f/yMxKAUC0b+57wncIw==} + dev: true + /@nodelib/fs.scandir@2.1.5: resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==} engines: {node: '>= 8'} @@ -2911,6 +2948,13 @@ packages: - supports-color dev: true + /esno@4.7.0: + resolution: {integrity: sha512-81owrjxIxOwqcABt20U09Wn8lpBo9K6ttqbGvQcB3VYNLJyaV1fvKkDtpZd3Rj5BX3WXiGiJCjUevKQGNICzJg==} + hasBin: true + dependencies: + tsx: 4.7.2 + dev: true + /espree@9.6.1: resolution: {integrity: sha512-oruZaFkjorTpF32kDSI5/75ViwGeZginGGy2NoOSg3Q9bnwlnmDm4HLnkl0RE3n+njDXR037aY1+x58Z/zFdwQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -2968,6 +3012,13 @@ packages: strip-final-newline: 3.0.0 dev: true + /extend-shallow@2.0.1: + resolution: {integrity: sha512-zCnTtlxNoAiDc3gqY2aYAWFx7XWWiasuF2K8Me5WbN8otHKTUKBwjPtNpRs/rbUZm7KxWAaNj7P1a/p52GbVug==} + engines: {node: '>=0.10.0'} + dependencies: + is-extendable: 0.1.1 + dev: true + /extend@3.0.2: resolution: {integrity: sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==} dev: true @@ -3291,6 +3342,16 @@ packages: resolution: {integrity: sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==} dev: true + /gray-matter@4.0.3: + resolution: {integrity: sha512-5v6yZd4JK3eMI3FqqCouswVqwugaA9r4dNZB1wwcmrD02QkV5H0y7XBQW8QwQqEaZY1pM9aqORSORhJRdNK44Q==} + engines: {node: '>=6.0'} + dependencies: + js-yaml: 3.14.1 + kind-of: 6.0.3 + section-matter: 1.0.0 + strip-bom-string: 1.0.0 + dev: true + /has-bigints@1.0.2: resolution: {integrity: sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==} dev: true @@ -3516,6 +3577,11 @@ packages: resolution: {integrity: sha512-RGdriMmQQvZ2aqaQq3awNA6dCGtKpiDFcOzrTWrDAT2MiWrKQVPmxLGHl7Y2nNu6led0kEyoX0enY0qXYsv9zw==} dev: true + /is-extendable@0.1.1: + resolution: {integrity: sha512-5BMULNob1vgFX6EjQw5izWDxrecWK9AM72rugNr0TFldMOi0fj6Jk+zeKIt0xGj4cEfQIJth4w3OKWOJ4f+AFw==} + engines: {node: '>=0.10.0'} + dev: true + /is-extglob@2.1.1: resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==} engines: {node: '>=0.10.0'} @@ -3787,6 +3853,11 @@ packages: json-buffer: 3.0.1 dev: true + /kind-of@6.0.3: + resolution: {integrity: sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==} + engines: {node: '>=0.10.0'} + dev: true + /levn@0.4.1: resolution: {integrity: sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==} engines: {node: '>= 0.8.0'} @@ -4860,6 +4931,14 @@ packages: resolution: {integrity: sha512-Orrsjf9trHHxFRuo9/rzm0KIWmgzE8RMlZMzuhZOJ01Rnz3D0YBAe+V6473t6/H6c7irs6Lt48brULAiRWb3Vw==} dev: true + /section-matter@1.0.0: + resolution: {integrity: sha512-vfD3pmTzGpufjScBh50YHKzEu2lxBWhVEHsNGoEXmCmn2hKGfeNLYMzCJpe8cD7gqX7TJluOVpBkAequ6dgMmA==} + engines: {node: '>=4'} + dependencies: + extend-shallow: 2.0.1 + kind-of: 6.0.3 + dev: true + /semver@5.7.2: resolution: {integrity: sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==} hasBin: true @@ -4932,6 +5011,16 @@ packages: engines: {node: '>=14'} dev: true + /simple-git@3.24.0: + resolution: {integrity: sha512-QqAKee9Twv+3k8IFOFfPB2hnk6as6Y6ACUpwCtQvRYBAes23Wv3SZlHVobAzqcE8gfsisCvPw3HGW3HYM+VYYw==} + dependencies: + '@kwsites/file-exists': 1.1.1 + '@kwsites/promise-deferred': 1.1.1 + debug: 4.3.4 + transitivePeerDependencies: + - supports-color + dev: true + /sisteransi@1.0.5: resolution: {integrity: sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==} dev: true @@ -5051,6 +5140,11 @@ packages: ansi-regex: 6.0.1 dev: true + /strip-bom-string@1.0.0: + resolution: {integrity: sha512-uCC2VHvQRYu+lMh4My/sFNmF2klFymLX1wHJeXnbEJERpV/ZsVuonzerjfrGpIGF7LBVa1O7i9kjiWvJiFck8g==} + engines: {node: '>=0.10.0'} + dev: true + /strip-bom@2.0.0: resolution: {integrity: sha512-kwrX1y7czp1E69n2ajbG65mIo9dqvJ+8aBQXOGVxqwvNbsXdFM6Lq37dLAY3mknUwru8CfcCbfOLL/gMo+fi3g==} engines: {node: '>=0.10.0'} @@ -5255,6 +5349,17 @@ packages: resolution: {integrity: sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==} dev: true + /tsx@4.7.2: + resolution: {integrity: sha512-BCNd4kz6fz12fyrgCTEdZHGJ9fWTGeUzXmQysh0RVocDY3h4frk05ZNCXSy4kIenF7y/QnrdiVpTsyNRn6vlAw==} + engines: {node: '>=18.0.0'} + hasBin: true + dependencies: + esbuild: 0.19.12 + get-tsconfig: 4.7.3 + optionalDependencies: + fsevents: 2.3.3 + dev: true + /type-check@0.4.0: resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==} engines: {node: '>= 0.8.0'} diff --git a/tsconfig.app.json b/tsconfig.app.json index 03f1730..95e950a 100644 --- a/tsconfig.app.json +++ b/tsconfig.app.json @@ -9,7 +9,9 @@ "@vueyous/core": ["./packages/core/index.ts"], "@vueyous/core/*": ["./packages/core/*"], "@vueyous/shared": ["./packages/shared/index.ts"], - "@vueyous/shared/*": ["./packages/shared/*"] + "@vueyous/shared/*": ["./packages/shared/*"], + "@vueyous/metadata": ["./packages/metadata/index.ts"], + "@vueyous/metadata/*": ["./packages/metadata/*"] } }, "include": ["env.d.ts", "src/**/*", "src/**/*.vue", "packages/core", "packages/shared"], From 4e3088c582db3d996594d5082d0d74b66ec12040 Mon Sep 17 00:00:00 2001 From: pei-pay Date: Sat, 13 Apr 2024 16:11:29 +0900 Subject: [PATCH 02/20] tweak: lint fix --- meta/packages.ts | 4 +- package.json | 2 +- packages/.vitepress/config.ts | 28 ++-- .../.vitepress/plugins/markdownTransform.ts | 90 ++++++------ packages/.vitepress/vite.config.ts | 11 +- packages/metadata/index.ts | 6 +- packages/metadata/metadata.ts | 22 +-- packages/metadata/package.json | 4 +- packages/metadata/scripts/update.ts | 130 +++++++++--------- packages/metadata/types.ts | 74 +++++----- packages/metadata/utils.ts | 10 +- 11 files changed, 190 insertions(+), 191 deletions(-) diff --git a/meta/packages.ts b/meta/packages.ts index d113626..ff34e72 100644 --- a/meta/packages.ts +++ b/meta/packages.ts @@ -1,4 +1,4 @@ -import type { PackageManifest } from '@vueyous/metadata'; +import type { PackageManifest } from '@vueyous/metadata' export const packages: PackageManifest[] = [ { @@ -154,4 +154,4 @@ export const packages: PackageManifest[] = [ // ], // iife: false, // }, -]; +] diff --git a/package.json b/package.json index ecd380f..96fc612 100644 --- a/package.json +++ b/package.json @@ -33,9 +33,9 @@ "@vue/test-utils": "^2.4.5", "@vue/tsconfig": "^0.5.1", "@vueyous/core": "workspace:*", + "@vueyous/metadata": "workspace:*", "@vueyous/shared": "workspace:*", "eslint": "^8.49.0", - "@vueyous/metadata": "workspace:*", "esno": "^4.7.0", "fast-glob": "^3.3.2", "fs-extra": "^11.2.0", diff --git a/packages/.vitepress/config.ts b/packages/.vitepress/config.ts index 408f636..b793e72 100644 --- a/packages/.vitepress/config.ts +++ b/packages/.vitepress/config.ts @@ -1,25 +1,25 @@ -import { defineConfig } from 'vitepress'; +import { defineConfig } from 'vitepress' -import { categoryNames, coreCategoryNames, metadata } from '../metadata/metadata'; +import { categoryNames, coreCategoryNames, metadata } from '../metadata/metadata' const Guide = [ { text: 'はじめに', link: '/guide/' }, { text: 'VueUseとは', link: '/guide/what-is-vueuse' }, { text: '環境構築', link: '/guide/setup' }, -]; +] const CoreCategories = coreCategoryNames.map(c => ({ text: c, activeMatch: '___', // never active link: `/functions#category=${c}`, -})); +})) const DefaultSideBar = [ { text: 'Guide', items: Guide }, { text: 'Core Functions', items: CoreCategories }, -]; +] -const FunctionsSideBar = getFunctionsSideBar(); +const FunctionsSideBar = getFunctionsSideBar() // https://vitepress.dev/reference/site-config export default defineConfig({ @@ -58,18 +58,18 @@ export default defineConfig({ '/shared/': FunctionsSideBar, }, - socialLinks: [{ icon: 'github', link: 'https://github.com/pei-pay/VueYous' }] - } -}); + socialLinks: [{ icon: 'github', link: 'https://github.com/pei-pay/VueYous' }], + }, +}) function getFunctionsSideBar() { - const links: any = []; + const links: any = [] for (const name of categoryNames) { if (name.startsWith('_')) - continue; + continue - const functions = metadata.functions.filter(i => i.category === name && !i.internal); + const functions = metadata.functions.filter(i => i.category === name && !i.internal) links.push({ text: name, @@ -80,8 +80,8 @@ function getFunctionsSideBar() { link: name.startsWith('@') ? (functions[0].external || `/${functions[0].package}/README`) : undefined, - }); + }) } - return links; + return links } diff --git a/packages/.vitepress/plugins/markdownTransform.ts b/packages/.vitepress/plugins/markdownTransform.ts index 25a2e1c..43161e2 100644 --- a/packages/.vitepress/plugins/markdownTransform.ts +++ b/packages/.vitepress/plugins/markdownTransform.ts @@ -1,10 +1,10 @@ -import { join, resolve } from 'node:path'; -import type { Plugin } from 'vite'; -import fs from 'fs-extra'; -import ts from 'typescript'; -import { format } from 'prettier'; -import { packages } from '../../../meta/packages'; -import { functionNames, getFunction } from '../../../packages/metadata/metadata'; +import { join, resolve } from 'node:path' +import type { Plugin } from 'vite' +import fs from 'fs-extra' +import ts from 'typescript' +import { format } from 'prettier' +import { packages } from '../../../meta/packages' +import { functionNames, getFunction } from '../../../packages/metadata/metadata' // import { getTypeDefinition, replacer } from '../../../scripts/utils'; export function MarkdownTransform(): Plugin { @@ -19,40 +19,40 @@ export function MarkdownTransform(): Plugin { enforce: 'pre', async transform(code, id) { if (!id.match(/\.md\b/)) - return null; + return null // linkify function names code = code.replace( new RegExp(`\`({${functionNames.join('|')}})\`(.)`, 'g'), (_, name, ending) => { if (ending === ']') // already a link - return _; - const fn = getFunction(name)!; - return `[\`${fn.name}\`](${fn.docs}) `; + return _ + const fn = getFunction(name)! + return `[\`${fn.name}\`](${fn.docs}) ` }, - ); + ) // convert links to relative // code = code.replace(/https?:\/\/vueuse\.org\//g, '/'); - const [pkg, _name, i] = id.split('/').slice(-3); + const [pkg, _name, i] = id.split('/').slice(-3) - const name = functionNames.find(n => n.toLowerCase() === _name.toLowerCase()) || _name; + const name = functionNames.find(n => n.toLowerCase() === _name.toLowerCase()) || _name if (functionNames.includes(name) && i === 'index.md') { - const frontmatterEnds = code.indexOf('---\n\n'); - const firstHeader = code.search(/\n#{2,6}\s.+/); - const sliceIndex = firstHeader < 0 ? frontmatterEnds < 0 ? 0 : frontmatterEnds + 4 : firstHeader; + const frontmatterEnds = code.indexOf('---\n\n') + const firstHeader = code.search(/\n#{2,6}\s.+/) + const sliceIndex = firstHeader < 0 ? frontmatterEnds < 0 ? 0 : frontmatterEnds + 4 : firstHeader // Insert JS/TS code blocks code = await replaceAsync(code, /\n```ts( [^\n]+)?\n(.+?)\n```\n/gs, async (_, meta = '', snippet = '') => { - const formattedTS = (await format(snippet.replace(/\n+/g, '\n'), { semi: false, singleQuote: true, parser: 'typescript' })).trim(); + const formattedTS = (await format(snippet.replace(/\n+/g, '\n'), { semi: false, singleQuote: true, parser: 'typescript' })).trim() const js = ts.transpileModule(formattedTS, { compilerOptions: { target: 99 }, - }); + }) const formattedJS = (await format(js.outputText, { semi: false, singleQuote: true, parser: 'typescript' })) - .trim(); + .trim() if (formattedJS === formattedTS) - return _; + return _ return `
@@ -69,36 +69,36 @@ ${formattedJS} \`\`\`
-
\n`; - }); +\n` + }) - const { header } = await getFunctionMarkdown(pkg, name); + const { header } = await getFunctionMarkdown(pkg, name) // if (hasTypes) // code = replacer(code, footer, 'FOOTER', 'tail'); if (header) - code = code.slice(0, sliceIndex) + header + code.slice(sliceIndex); + code = code.slice(0, sliceIndex) + header + code.slice(sliceIndex) code = code - .replace(/(# \w+?)\n/, `$1\n\n\n`); + .replace(/(# \w+?)\n/, `$1\n\n\n`) // .replace(/## (Components?(?:\sUsage)?)/i, '## $1\n\n\n') // .replace(/## (Directives?(?:\sUsage)?)/i, '## $1\n\n\n'); } - return code; + return code }, - }; + } } -const DIR_SRC = resolve(__dirname, '../..'); +const DIR_SRC = resolve(__dirname, '../..') // const GITHUB_BLOB_URL = 'https://github.com/vueuse/vueuse/blob/main/packages'; -const GITHUB_BLOB_URL = 'https://github.com/pei-pay/VueYous/blob/main/packages'; +const GITHUB_BLOB_URL = 'https://github.com/pei-pay/VueYous/blob/main/packages' export async function getFunctionMarkdown(pkg: string, name: string) { - const URL = `${GITHUB_BLOB_URL}/${pkg}/${name}`; + const URL = `${GITHUB_BLOB_URL}/${pkg}/${name}` - const dirname = join(DIR_SRC, pkg, name); - const demoPath = ['demo.vue'].find(i => fs.existsSync(join(dirname, i))); + const dirname = join(DIR_SRC, pkg, name) + const demoPath = ['demo.vue'].find(i => fs.existsSync(join(dirname, i))) // const types = await getTypeDefinition(pkg, name); // if (!types) @@ -128,9 +128,9 @@ export async function getFunctionMarkdown(pkg: string, name: string) { ['Docs', `${URL}/index.md`], ]) .filter(i => i) - .map(i => `[${i![0]}](${i![1]})`).join(' • '); + .map(i => `[${i![0]}](${i![1]})`).join(' • ') - const sourceSection = `## Source\n\n${links}\n`; + const sourceSection = `## Source\n\n${links}\n` // const ContributorsSection = ` // ## Contributors @@ -155,28 +155,28 @@ import Demo from \'./${demoPath}\' ` - : ''; + : '' const packageNote = packages.find(p => p.name === pkg)!.addon ? `Available in the @vueuse/${pkg} add-on.\n` - : ''; + : '' // const footer = `${typingSection}\n\n${sourceSection}\n${ContributorsSection}\n${changelogSection}\n`; - const footer = `${sourceSection}`; + const footer = `${sourceSection}` - const header = demoSection + packageNote; + const header = demoSection + packageNote return { footer, header, - }; + } } function replaceAsync(str: string, match: RegExp, replacer: (substring: string, ...args: any[]) => Promise) { - const promises: Promise[] = []; + const promises: Promise[] = [] str.replace(match, (...args) => { - promises.push(replacer(...args)); - return ''; - }); - return Promise.all(promises).then(replacements => str.replace(match, () => replacements.shift()!)); + promises.push(replacer(...args)) + return '' + }) + return Promise.all(promises).then(replacements => str.replace(match, () => replacements.shift()!)) } diff --git a/packages/.vitepress/vite.config.ts b/packages/.vitepress/vite.config.ts index 647e6a8..6548ca6 100644 --- a/packages/.vitepress/vite.config.ts +++ b/packages/.vitepress/vite.config.ts @@ -1,7 +1,6 @@ -import { resolve } from 'node:path'; -import { defineConfig } from 'vite'; -import { MarkdownTransform } from './plugins/markdownTransform'; - +import { resolve } from 'node:path' +import { defineConfig } from 'vite' +import { MarkdownTransform } from './plugins/markdownTransform' export default defineConfig({ server: { @@ -19,5 +18,5 @@ export default defineConfig({ '@vueyous/metadata': resolve(__dirname, '../metadata/index.ts'), }, dedupe: ['vue'], - } -}); + }, +}) diff --git a/packages/metadata/index.ts b/packages/metadata/index.ts index 11eb27f..13d3f68 100644 --- a/packages/metadata/index.ts +++ b/packages/metadata/index.ts @@ -1,3 +1,3 @@ -export * from './types'; -export * from './metadata'; -export * from './utils'; +export * from './types' +export * from './metadata' +export * from './utils' diff --git a/packages/metadata/metadata.ts b/packages/metadata/metadata.ts index 79081bb..f46e2f6 100644 --- a/packages/metadata/metadata.ts +++ b/packages/metadata/metadata.ts @@ -1,5 +1,5 @@ -import type { PackageIndexes } from './types'; -import _metadata, { categories as _categories, functions as _functions, packages as _packages } from './index.json'; +import type { PackageIndexes } from './types' +import _metadata, { categories as _categories, functions as _functions, packages as _packages } from './index.json' const categoriesOrder = [ 'State', @@ -14,22 +14,22 @@ const categoriesOrder = [ 'Array', 'Time', 'Utilities', -]; +] -export const metadata = _metadata as PackageIndexes; -export const functions = _functions as PackageIndexes['functions']; -export const packages = _packages as PackageIndexes['packages']; -export const categories = _categories as PackageIndexes['categories']; +export const metadata = _metadata as PackageIndexes +export const functions = _functions as PackageIndexes['functions'] +export const packages = _packages as PackageIndexes['packages'] +export const categories = _categories as PackageIndexes['categories'] -export const functionNames = functions.map(f => f.name); +export const functionNames = functions.map(f => f.name) export const categoryNames = Array.from(categories) .sort((a, b) => categoriesOrder.indexOf(a) - categoriesOrder.indexOf(b)) - .sort((a, b) => a.startsWith('@') ? 1 : b.startsWith('@') ? -1 : 0); + .sort((a, b) => a.startsWith('@') ? 1 : b.startsWith('@') ? -1 : 0) export const coreCategoryNames = categoryNames - .filter(f => !f.startsWith('@')); + .filter(f => !f.startsWith('@')) // export const addonCategoryNames = categoryNames // .filter(f => f.startsWith('@')); export function getFunction(name: string) { - return metadata.functions.find(f => f.name === name); + return metadata.functions.find(f => f.name === name) } diff --git a/packages/metadata/package.json b/packages/metadata/package.json index 79dd785..b967290 100644 --- a/packages/metadata/package.json +++ b/packages/metadata/package.json @@ -1,8 +1,8 @@ { "name": "@vueyous/metadata", - "version": "0.0.1-alpha.1", "type": "module", + "version": "0.0.1-alpha.1", "scripts": { "update": "esno scripts/update.ts" } -} \ No newline at end of file +} diff --git a/packages/metadata/scripts/update.ts b/packages/metadata/scripts/update.ts index 9888111..03df44a 100644 --- a/packages/metadata/scripts/update.ts +++ b/packages/metadata/scripts/update.ts @@ -1,24 +1,24 @@ -import { join, relative, resolve } from 'node:path'; -import { fileURLToPath } from 'node:url'; -import fs from 'fs-extra'; -import matter from 'gray-matter'; -import type { PackageIndexes, VueUseFunction, VueUsePackage } from '@vueyous/metadata'; -import fg from 'fast-glob'; -import Git from 'simple-git'; -import { packages } from '../../../meta/packages'; +import { join, relative, resolve } from 'node:path' +import { fileURLToPath } from 'node:url' +import fs from 'fs-extra' +import matter from 'gray-matter' +import type { PackageIndexes, VueUseFunction, VueUsePackage } from '@vueyous/metadata' +import fg from 'fast-glob' +import Git from 'simple-git' +import { packages } from '../../../meta/packages' // import { ecosystemFunctions } from '../../../meta/ecosystem-functions'; -import { getCategories } from '../utils'; +import { getCategories } from '../utils' -const __dirname = fileURLToPath(new URL('.', import.meta.url)); +const __dirname = fileURLToPath(new URL('.', import.meta.url)) // TODO: put url after deployed // export const DOCS_URL = 'https://vueuse.org'; -export const DIR_PACKAGE = resolve(__dirname, '..'); -export const DIR_ROOT = resolve(__dirname, '../../..'); -export const DIR_SRC = resolve(DIR_ROOT, 'packages'); -export const DIR_TYPES = resolve(DIR_ROOT, 'types/packages'); +export const DIR_PACKAGE = resolve(__dirname, '..') +export const DIR_ROOT = resolve(__dirname, '../../..') +export const DIR_SRC = resolve(DIR_ROOT, 'packages') +export const DIR_TYPES = resolve(DIR_ROOT, 'types/packages') -export const git = Git(DIR_ROOT); +export const git = Git(DIR_ROOT) export async function listFunctions(dir: string, ignore: string[] = []) { const files = await fg('*', { @@ -30,9 +30,9 @@ export async function listFunctions(dir: string, ignore: string[] = []) { 'node_modules', ...ignore, ], - }); - files.sort(); - return files; + }) + files.sort() + return files } export async function readMetadata() { @@ -42,60 +42,60 @@ export async function readMetadata() { functions: [ // ...ecosystemFunctions, ], - }; + } for (const info of packages) { if (info.utils) - continue; + continue - const dir = join(DIR_SRC, info.name); + const dir = join(DIR_SRC, info.name) - const functions = await listFunctions(dir); + const functions = await listFunctions(dir) const pkg: VueUsePackage = { ...info, dir: relative(DIR_ROOT, dir).replace(/\\/g, '/'), // docs: info.addon ? `${DOCS_URL}/${info.name}/README.html` : undefined, - }; + } - indexes.packages[info.name] = pkg; + indexes.packages[info.name] = pkg await Promise.all(functions.map(async (fnName) => { - const mdPath = join(dir, fnName, 'index.md'); - const tsPath = join(dir, fnName, 'index.ts'); + const mdPath = join(dir, fnName, 'index.md') + const tsPath = join(dir, fnName, 'index.ts') const fn: VueUseFunction = { name: fnName, package: pkg.name, lastUpdated: +await git.raw(['log', '-1', '--format=%at', tsPath]) * 1000, - }; + } if (fs.existsSync(join(dir, fnName, 'component.ts'))) - fn.component = true; + fn.component = true if (fs.existsSync(join(dir, fnName, 'directive.ts'))) - fn.directive = true; + fn.directive = true if (!fs.existsSync(mdPath)) { - fn.internal = true; - indexes.functions.push(fn); - return; + fn.internal = true + indexes.functions.push(fn) + return } // fn.docs = `${DOCS_URL}/${pkg.name}/${fnName}/`; - const mdRaw = await fs.readFile(mdPath, 'utf-8'); + const mdRaw = await fs.readFile(mdPath, 'utf-8') - const { content: md, data: frontmatter } = matter(mdRaw); - const category = frontmatter.category; + const { content: md, data: frontmatter } = matter(mdRaw) + const category = frontmatter.category - let alias = frontmatter.alias; + let alias = frontmatter.alias if (typeof alias === 'string') - alias = alias.split(',').map(s => s.trim()).filter(Boolean); - let related = frontmatter.related; + alias = alias.split(',').map(s => s.trim()).filter(Boolean) + let related = frontmatter.related if (typeof related === 'string') - related = related.split(',').map(s => s.trim()).filter(Boolean); + related = related.split(',').map(s => s.trim()).filter(Boolean) else if (Array.isArray(related)) - related = related.map(s => s.trim()).filter(Boolean); + related = related.map(s => s.trim()).filter(Boolean) let description = ( md @@ -105,56 +105,56 @@ export async function readMetadata() { .replace(/(:{3,}(?=[^:\n]*\n))[^\n]*\n[\s\S]*?(?:\1 *(?=\n))/g, '') // remove headers .match(/#(?=\s).*(?:\n+)(.+?)(?:, |\. |\n|\.\n)/m) || [] - )[1] || ''; + )[1] || '' - description = description.trim(); - description = description.charAt(0).toLowerCase() + description.slice(1); + description = description.trim() + description = description.charAt(0).toLowerCase() + description.slice(1) - fn.category = ['core', 'shared'].includes(pkg.name) ? category : `@${pkg.display}`; - fn.description = description; + fn.category = ['core', 'shared'].includes(pkg.name) ? category : `@${pkg.display}` + fn.description = description if (description.includes('DEPRECATED') || frontmatter.deprecated) - fn.deprecated = true; + fn.deprecated = true if (alias?.length) - fn.alias = alias; + fn.alias = alias if (related?.length) - fn.related = related; + fn.related = related if (pkg.submodules) - fn.importPath = `${pkg.name}/${fn.name}`; + fn.importPath = `${pkg.name}/${fn.name}` - indexes.functions.push(fn); - })); + indexes.functions.push(fn) + })) } - indexes.functions.sort((a, b) => a.name.localeCompare(b.name)); - indexes.categories = getCategories(indexes.functions); + indexes.functions.sort((a, b) => a.name.localeCompare(b.name)) + indexes.categories = getCategories(indexes.functions) // interop related indexes.functions.forEach((fn) => { if (!fn.related) - return; + return fn.related.forEach((name) => { - const target = indexes.functions.find(f => f.name === name); + const target = indexes.functions.find(f => f.name === name) if (!target) - throw new Error(`Unknown related function: ${name}`); + throw new Error(`Unknown related function: ${name}`) if (!target.related) - target.related = []; + target.related = [] if (!target.related.includes(fn.name)) - target.related.push(fn.name); - }); - }); - indexes.functions.forEach(fn => fn.related?.sort()); + target.related.push(fn.name) + }) + }) + indexes.functions.forEach(fn => fn.related?.sort()) - return indexes; + return indexes } async function run() { - const indexes = await readMetadata(); - await fs.writeJSON(join(DIR_PACKAGE, 'index.json'), indexes, { spaces: 2 }); + const indexes = await readMetadata() + await fs.writeJSON(join(DIR_PACKAGE, 'index.json'), indexes, { spaces: 2 }) } -run(); +run() diff --git a/packages/metadata/types.ts b/packages/metadata/types.ts index 8731c91..4f7117e 100644 --- a/packages/metadata/types.ts +++ b/packages/metadata/types.ts @@ -1,50 +1,50 @@ export interface PackageManifest { - name: string; - display: string; - addon?: boolean; - author?: string; - description?: string; - external?: string[]; - globals?: Record; - manualImport?: boolean; - deprecated?: boolean; - submodules?: boolean; - build?: boolean; - iife?: boolean; - cjs?: boolean; - mjs?: boolean; - dts?: boolean; - target?: string; - utils?: boolean; - copy?: string[]; + name: string + display: string + addon?: boolean + author?: string + description?: string + external?: string[] + globals?: Record + manualImport?: boolean + deprecated?: boolean + submodules?: boolean + build?: boolean + iife?: boolean + cjs?: boolean + mjs?: boolean + dts?: boolean + target?: string + utils?: boolean + copy?: string[] } export interface VueYousFunction { - name: string; - package: string; - importPath?: string; - lastUpdated?: number; - category?: string; - description?: string; - docs?: string; - deprecated?: boolean; - internal?: boolean; - component?: boolean; - directive?: boolean; - external?: string; - alias?: string[]; - related?: string[]; + name: string + package: string + importPath?: string + lastUpdated?: number + category?: string + description?: string + docs?: string + deprecated?: boolean + internal?: boolean + component?: boolean + directive?: boolean + external?: string + alias?: string[] + related?: string[] } export interface VueYousPackage extends PackageManifest { - dir: string; - docs?: string; + dir: string + docs?: string } export interface PackageIndexes { - packages: Record; - categories: string[]; - functions: VueYousFunction[]; + packages: Record + categories: string[] + functions: VueYousFunction[] } // export interface CommitInfo { diff --git a/packages/metadata/utils.ts b/packages/metadata/utils.ts index ff3d975..39a792b 100644 --- a/packages/metadata/utils.ts +++ b/packages/metadata/utils.ts @@ -1,4 +1,4 @@ -import type { VueUseFunction } from './types'; +import type { VueUseFunction } from './types' export function getCategories(functions: VueUseFunction[]): string[] { return uniq( @@ -10,11 +10,11 @@ export function getCategories(functions: VueUseFunction[]): string[] { (a, b) => (a.startsWith('@') && !b.startsWith('@')) ? 1 : (b.startsWith('@') && !a.startsWith('@')) - ? -1 - : a.localeCompare(b), - ); + ? -1 + : a.localeCompare(b), + ) } export function uniq(a: T) { - return Array.from(new Set(a)); + return Array.from(new Set(a)) } From a1c90537f4390b4f8d3a52a5d05ec3ef70c38b65 Mon Sep 17 00:00:00 2001 From: pei-pay Date: Sat, 13 Apr 2024 16:15:54 +0900 Subject: [PATCH 03/20] chapter: add md file --- package.json | 2 +- packages/metadata/index.json | 19 ++++++++++++------- packages/shared/watchIgnorable/index.md | 6 ++++++ 3 files changed, 19 insertions(+), 8 deletions(-) create mode 100644 packages/shared/watchIgnorable/index.md diff --git a/package.json b/package.json index 96fc612..a9fadb5 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "lint": "eslint .", "lint:fix": "eslint . --fix", "lint:text": "textlint .", - "docs:dev": "vitepress dev packages", + "docs:dev": "nr update && vitepress dev packages", "docs:build": "vitepress build packages", "docs:preview": "vitepress preview packages", "update": "nr -C packages/metadata update" diff --git a/packages/metadata/index.json b/packages/metadata/index.json index 9a3b2e0..67cc2c8 100644 --- a/packages/metadata/index.json +++ b/packages/metadata/index.json @@ -13,19 +13,20 @@ } }, "categories": [ - "State" + "State", + "Watch" ], "functions": [ { "name": "useCloned", "package": "core", - "lastUpdated": 1712496642000, + "lastUpdated": 1712991826000, "internal": true }, { "name": "useManualRefHistory", "package": "core", - "lastUpdated": 1712496642000, + "lastUpdated": 1712991826000, "category": "State", "description": "", "related": [ @@ -35,20 +36,24 @@ { "name": "useRefHistory", "package": "core", - "lastUpdated": 1712984153000, + "lastUpdated": 1712991826000, "internal": true }, { "name": "utils", "package": "shared", - "lastUpdated": 1712496642000, + "lastUpdated": 1712991826000, "internal": true }, { "name": "watchIgnorable", "package": "shared", - "lastUpdated": 1712496642000, - "internal": true + "lastUpdated": 1712991826000, + "category": "Watch", + "description": "", + "alias": [ + "ignorableWatch" + ] } ] } diff --git a/packages/shared/watchIgnorable/index.md b/packages/shared/watchIgnorable/index.md new file mode 100644 index 0000000..542cf1e --- /dev/null +++ b/packages/shared/watchIgnorable/index.md @@ -0,0 +1,6 @@ +--- +category: Watch +alias: ignorableWatch +--- + +# watchIgnorable \ No newline at end of file From ff50dde24d40b70e2b5cae6db1fc0d190ba1be5a Mon Sep 17 00:00:00 2001 From: pei-pay Date: Sat, 13 Apr 2024 16:41:49 +0900 Subject: [PATCH 04/20] chapter: functions file --- packages/functions.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 packages/functions.md diff --git a/packages/functions.md b/packages/functions.md new file mode 100644 index 0000000..7f18806 --- /dev/null +++ b/packages/functions.md @@ -0,0 +1,3 @@ +# Functions + + From 139d3f526f46c06ac997fdef2cbf1c129fb50515 Mon Sep 17 00:00:00 2001 From: pei-pay Date: Sat, 13 Apr 2024 20:12:55 +0900 Subject: [PATCH 05/20] tweak: comment --- meta/packages.ts | 8 +- .../.vitepress/plugins/markdownTransform.ts | 144 +++++++++--------- packages/core/useManualRefHistory/index.md | 2 +- packages/metadata/index.json | 9 +- 4 files changed, 83 insertions(+), 80 deletions(-) diff --git a/meta/packages.ts b/meta/packages.ts index ff34e72..64d3fb1 100644 --- a/meta/packages.ts +++ b/meta/packages.ts @@ -1,9 +1,9 @@ -import type { PackageManifest } from '@vueyous/metadata' +import type { PackageManifest } from '@vueyous/metadata'; export const packages: PackageManifest[] = [ { name: 'metadata', - display: 'Metadata for VueUse functions', + display: 'Metadata for VueYous functions', manualImport: true, iife: false, utils: true, @@ -15,7 +15,7 @@ export const packages: PackageManifest[] = [ }, { name: 'core', - display: 'VueUse', + display: 'VueYous', description: 'Collection of essential Vue Composition Utilities', }, // { @@ -154,4 +154,4 @@ export const packages: PackageManifest[] = [ // ], // iife: false, // }, -] +]; diff --git a/packages/.vitepress/plugins/markdownTransform.ts b/packages/.vitepress/plugins/markdownTransform.ts index 43161e2..6bb9c86 100644 --- a/packages/.vitepress/plugins/markdownTransform.ts +++ b/packages/.vitepress/plugins/markdownTransform.ts @@ -1,10 +1,9 @@ -import { join, resolve } from 'node:path' -import type { Plugin } from 'vite' -import fs from 'fs-extra' -import ts from 'typescript' -import { format } from 'prettier' -import { packages } from '../../../meta/packages' -import { functionNames, getFunction } from '../../../packages/metadata/metadata' +import { join, resolve } from 'node:path'; +import type { Plugin } from 'vite'; +import fs from 'fs-extra'; +// import ts from 'typescript'; +import { packages } from '../../../meta/packages'; +import { functionNames, getFunction } from '../../../packages/metadata/metadata'; // import { getTypeDefinition, replacer } from '../../../scripts/utils'; export function MarkdownTransform(): Plugin { @@ -19,86 +18,87 @@ export function MarkdownTransform(): Plugin { enforce: 'pre', async transform(code, id) { if (!id.match(/\.md\b/)) - return null + return null; // linkify function names code = code.replace( new RegExp(`\`({${functionNames.join('|')}})\`(.)`, 'g'), (_, name, ending) => { if (ending === ']') // already a link - return _ - const fn = getFunction(name)! - return `[\`${fn.name}\`](${fn.docs}) ` + return _; + const fn = getFunction(name)!; + return `[\`${fn.name}\`](${fn.docs}) `; }, - ) + ); + + // TODO: set link after deployed // convert links to relative // code = code.replace(/https?:\/\/vueuse\.org\//g, '/'); - const [pkg, _name, i] = id.split('/').slice(-3) + const [pkg, _name, i] = id.split('/').slice(-3); - const name = functionNames.find(n => n.toLowerCase() === _name.toLowerCase()) || _name + const name = functionNames.find(n => n.toLowerCase() === _name.toLowerCase()) || _name; if (functionNames.includes(name) && i === 'index.md') { - const frontmatterEnds = code.indexOf('---\n\n') - const firstHeader = code.search(/\n#{2,6}\s.+/) - const sliceIndex = firstHeader < 0 ? frontmatterEnds < 0 ? 0 : frontmatterEnds + 4 : firstHeader + const frontmatterEnds = code.indexOf('---\n\n'); + const firstHeader = code.search(/\n#{2,6}\s.+/); + const sliceIndex = firstHeader < 0 ? frontmatterEnds < 0 ? 0 : frontmatterEnds + 4 : firstHeader; // Insert JS/TS code blocks - code = await replaceAsync(code, /\n```ts( [^\n]+)?\n(.+?)\n```\n/gs, async (_, meta = '', snippet = '') => { - const formattedTS = (await format(snippet.replace(/\n+/g, '\n'), { semi: false, singleQuote: true, parser: 'typescript' })).trim() - const js = ts.transpileModule(formattedTS, { - compilerOptions: { target: 99 }, - }) - const formattedJS = (await format(js.outputText, { semi: false, singleQuote: true, parser: 'typescript' })) - .trim() - if (formattedJS === formattedTS) - return _ - return ` - -
- -\`\`\`ts ${meta} -${snippet} -\`\`\` - -
-
- -\`\`\`js -${formattedJS} -\`\`\` - -
-
\n` - }) - - const { header } = await getFunctionMarkdown(pkg, name) + // code = await replaceAsync(code, /\n```ts( [^\n]+)?\n(.+?)\n```\n/gs, async (_, meta = '', snippet = '') => { + // const formattedTS = (await format(snippet.replace(/\n+/g, '\n'), { semi: false, singleQuote: true, parser: 'typescript' })).trim(); + // const js = ts.transpileModule(formattedTS, { + // compilerOptions: { target: 99 }, + // }); + // const formattedJS = (await format(js.outputText, { semi: false, singleQuote: true, parser: 'typescript' })) + // .trim(); + // if (formattedJS === formattedTS) + // return _; + // return ` + // + //
+ + // \`\`\`ts ${meta} + // ${snippet} + // \`\`\` + + //
+ //
+ + // \`\`\`js + // ${formattedJS} + // \`\`\` + + //
+ //
\n`; + // }); + + const { header } = await getFunctionMarkdown(pkg, name); // if (hasTypes) // code = replacer(code, footer, 'FOOTER', 'tail'); if (header) - code = code.slice(0, sliceIndex) + header + code.slice(sliceIndex) + code = code.slice(0, sliceIndex) + header + code.slice(sliceIndex); code = code - .replace(/(# \w+?)\n/, `$1\n\n\n`) + .replace(/(# \w+?)\n/, `$1\n\n\n`); // .replace(/## (Components?(?:\sUsage)?)/i, '## $1\n\n\n') // .replace(/## (Directives?(?:\sUsage)?)/i, '## $1\n\n\n'); } - return code + return code; }, - } + }; } -const DIR_SRC = resolve(__dirname, '../..') -// const GITHUB_BLOB_URL = 'https://github.com/vueuse/vueuse/blob/main/packages'; -const GITHUB_BLOB_URL = 'https://github.com/pei-pay/VueYous/blob/main/packages' +const DIR_SRC = resolve(__dirname, '../..'); +const GITHUB_BLOB_URL = 'https://github.com/pei-pay/VueYous/blob/main/packages'; export async function getFunctionMarkdown(pkg: string, name: string) { - const URL = `${GITHUB_BLOB_URL}/${pkg}/${name}` + const URL = `${GITHUB_BLOB_URL}/${pkg}/${name}`; - const dirname = join(DIR_SRC, pkg, name) - const demoPath = ['demo.vue'].find(i => fs.existsSync(join(dirname, i))) + const dirname = join(DIR_SRC, pkg, name); + const demoPath = ['demo.vue'].find(i => fs.existsSync(join(dirname, i))); // const types = await getTypeDefinition(pkg, name); // if (!types) @@ -128,9 +128,9 @@ export async function getFunctionMarkdown(pkg: string, name: string) { ['Docs', `${URL}/index.md`], ]) .filter(i => i) - .map(i => `[${i![0]}](${i![1]})`).join(' • ') + .map(i => `[${i![0]}](${i![1]})`).join(' • '); - const sourceSection = `## Source\n\n${links}\n` + const sourceSection = `## Source\n\n${links}\n`; // const ContributorsSection = ` // ## Contributors @@ -155,28 +155,28 @@ import Demo from \'./${demoPath}\' ` - : '' + : ''; const packageNote = packages.find(p => p.name === pkg)!.addon - ? `Available in the @vueuse/${pkg} add-on.\n` - : '' + ? `Available in the @vueyous/${pkg} add-on.\n` + : ''; // const footer = `${typingSection}\n\n${sourceSection}\n${ContributorsSection}\n${changelogSection}\n`; - const footer = `${sourceSection}` + const footer = `${sourceSection}`; - const header = demoSection + packageNote + const header = demoSection + packageNote; return { footer, header, - } + }; } -function replaceAsync(str: string, match: RegExp, replacer: (substring: string, ...args: any[]) => Promise) { - const promises: Promise[] = [] - str.replace(match, (...args) => { - promises.push(replacer(...args)) - return '' - }) - return Promise.all(promises).then(replacements => str.replace(match, () => replacements.shift()!)) -} +// function replaceAsync(str: string, match: RegExp, replacer: (substring: string, ...args: any[]) => Promise) { +// const promises: Promise[] = []; +// str.replace(match, (...args) => { +// promises.push(replacer(...args)); +// return ''; +// }); +// return Promise.all(promises).then(replacements => str.replace(match, () => replacements.shift()!)); +// } diff --git a/packages/core/useManualRefHistory/index.md b/packages/core/useManualRefHistory/index.md index 8f26cd7..9a136d0 100644 --- a/packages/core/useManualRefHistory/index.md +++ b/packages/core/useManualRefHistory/index.md @@ -1,6 +1,6 @@ --- category: State -related: useManualRefHistory +related: useRefHistory --- # useManualRefHistory diff --git a/packages/metadata/index.json b/packages/metadata/index.json index 67cc2c8..a915216 100644 --- a/packages/metadata/index.json +++ b/packages/metadata/index.json @@ -7,7 +7,7 @@ }, "core": { "name": "core", - "display": "VueUse", + "display": "VueYous", "description": "Collection of essential Vue Composition Utilities", "dir": "packages/core" } @@ -30,14 +30,17 @@ "category": "State", "description": "", "related": [ - "useManualRefHistory" + "useRefHistory" ] }, { "name": "useRefHistory", "package": "core", "lastUpdated": 1712991826000, - "internal": true + "internal": true, + "related": [ + "useManualRefHistory" + ] }, { "name": "utils", From a81bc603fe21514779dfb6caf0c51b48a80f1a75 Mon Sep 17 00:00:00 2001 From: pei-pay Date: Sat, 13 Apr 2024 20:19:32 +0900 Subject: [PATCH 06/20] chapter: demo css --- package.json | 2 + packages/.vitepress/theme/index.ts | 8 +- packages/.vitepress/theme/styles/demo.css | 199 +++++ pnpm-lock.yaml | 916 +++++++++++++++++++++- unocss.config.ts | 36 + 5 files changed, 1156 insertions(+), 5 deletions(-) create mode 100644 packages/.vitepress/theme/styles/demo.css create mode 100644 unocss.config.ts diff --git a/package.json b/package.json index a9fadb5..b35ccd0 100644 --- a/package.json +++ b/package.json @@ -46,6 +46,8 @@ "textlint": "^14.0.4", "textlint-rule-ja-space-between-half-and-full-width": "^2.3.1", "typescript": "~5.4.0", + "unocss": "^0.59.2", + "unplugin-vue-components": "^0.26.0", "vite": "^5.1.6", "vitepress": "^1.0.2", "vue-tsc": "^2.0.6" diff --git a/packages/.vitepress/theme/index.ts b/packages/.vitepress/theme/index.ts index 11f0945..ac8a84a 100644 --- a/packages/.vitepress/theme/index.ts +++ b/packages/.vitepress/theme/index.ts @@ -1,5 +1,7 @@ -import DefaultTheme from 'vitepress/theme' +import DefaultTheme from 'vitepress/theme'; -import './styles/main.css' +import './styles/main.css'; +import './styles/demo.css'; +import 'uno.css'; -export default DefaultTheme +export default DefaultTheme; diff --git a/packages/.vitepress/theme/styles/demo.css b/packages/.vitepress/theme/styles/demo.css new file mode 100644 index 0000000..e5fa9c7 --- /dev/null +++ b/packages/.vitepress/theme/styles/demo.css @@ -0,0 +1,199 @@ +.demo { + font-size: var(--vt-doc-code-font-size); + background: var(--vp-code-block-bg); + padding: 2em; + position: relative; + margin-bottom: 10px; + border-radius: 8px; + transition: background-color 0.5s; +} + +.demo-source-link { + color: var(--vp-c-text-2) !important; + position: absolute; + top: 0; + right: 10px; + font-size: 12px; + font-weight: 500; + transition: color 0.5s; +} + +@media (min-width: 720px) { + .demo { + --width: calc( + 100vw - var(--sidebar-width) - var(--scrollbar-width) + ) !important; + --content-width: min(48rem, var(--width)) !important; + --margin-left: calc( + calc(calc(var(--content-width) - var(--width)) / 2) - 1.5rem + ) !important; + } +} + +.note { + opacity: 0.7; + font-size: 0.9rem; + margin-bottom: -0.2rem; +} + +.demo { + p { + margin: 0.5rem 0; + } + + button { + padding: 3px 15px; + background-color: var(--vp-c-brand); + border: none; + outline: none; + color: white; + margin: 0.5rem 0; + border-bottom: 2px solid var(--vp-c-brand-2); + text-shadow: 1px 1px 1px var(--vp-c-brand-2); + border-radius: 4px; + font-size: 1rem; + box-sizing: border-box; + vertical-align: middle; + } + + button.small { + padding: 0.25em 0.7em 0.2em 0.7em; + } + + button.orange { + --vp-c-brand: #db8742; + --vp-c-brand-dark: #ad6e39; + --vp-c-brand-active: #d67e36; + } + + button.red { + --vp-c-brand: #f56c6c; + --vp-c-brand-dark: #e41c1c; + --vp-c-brand-active: #e94c4c; + } + + button:hover { + background-color: var(--vp-c-brand-2); + } + + button:active { + border-bottom: 0; + border-top: 2px solid var(--vp-c-brand-2); + } + button ~ button { + margin-left: 0.5rem; + } + button[disabled], + button.disabled { + cursor: default; + background-color: var(--vp-c-disabled-bg); + color: var(--vp-c-disabled-fg); + border-bottom: 2px solid var(--vp-c-disabled-bg); + pointer-events: none; + text-shadow: none; + border-top: 0; + opacity: 0.8; + } + + textarea { + display: block; + min-width: 20rem; + font-size: 1.05rem; + padding: 0.5em 1em 0.4em 1em; + border-radius: 4px; + box-shadow: var(--vp-c-divider) 0 0 0 1px; + margin: 0.5rem 0; + outline: none; + background: var(--vp-c-bg); + color: var(--vp-c-text); + transition: background-color 0.5s; + } + + textarea[readonly] { + background: var(--vp-c-bg-soft); + } + + input[type='text'], + input[type='search'], + input[type='number'] { + display: block; + font-size: 0.9rem; + padding: 0.5em 1em 0.4em 1em; + border: 1px solid var(--vp-c-divider); + border-radius: 4px; + outline: none; + background: var(--vp-c-bg); + color: var(--vp-c-text); + min-width: 20rem; + margin: 0.5rem 0; + } + + input[type='number'] { + min-width: 15rem; + outline: none; + } + + input:focus { + border: 1px solid var(--vp-c-border); + } + + pre, + .code-block { + opacity: 0.8; + overflow: auto; + } + + .code-block { + background-color: var(--vp-c-bg-soft) !important; + padding: 4px 8px; + margin: 12px 0; + border-radius: 4px; + } + + code { + background-color: var(--vp-c-bg-soft) !important; + } + + .resizer { + resize: both; + padding: 1rem; + width: 200px; + height: 200px; + border: 1px solid var(--vp-c-divider); + border-radius: 4px; + background: white; + outline: none; + white-space: pre; + overflow-wrap: normal; + overflow: hidden; + } + + .float { + position: fixed; + bottom: 0; + right: 0; + padding: 1rem 2rem; + border: 1px solid var(--vp-c-divider); + background: var(--vp-c-bg); + z-index: 100; + min-width: 100px; + } + + .area { + border-width: 2px; + border-style: dashed; + padding: 1rem; + } + + dialog { + z-index: 1000000; + background: var(--vp-c-bg); + } +} + +html.dark .demo { + .resizer { + background: #222; + color: white; + } +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e76caec..3d13542 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -84,12 +84,18 @@ importers: typescript: specifier: ~5.4.0 version: 5.4.2 + unocss: + specifier: ^0.59.2 + version: 0.59.2(postcss@8.4.38)(vite@5.1.6) + unplugin-vue-components: + specifier: ^0.26.0 + version: 0.26.0(vue@3.4.21) vite: specifier: ^5.1.6 version: 5.1.6(@types/node@20.11.28) vitepress: specifier: ^1.0.2 - version: 1.0.2(@algolia/client-search@4.23.2)(@types/node@20.11.28)(search-insights@2.13.0)(typescript@5.4.2) + version: 1.0.2(@algolia/client-search@4.23.2)(@types/node@20.11.28)(postcss@8.4.38)(search-insights@2.13.0)(typescript@5.4.2) vue-tsc: specifier: ^2.0.6 version: 2.0.6(typescript@5.4.2) @@ -261,6 +267,14 @@ packages: '@algolia/requester-common': 4.23.2 dev: true + /@ampproject/remapping@2.3.0: + resolution: {integrity: sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==} + engines: {node: '>=6.0.0'} + dependencies: + '@jridgewell/gen-mapping': 0.3.5 + '@jridgewell/trace-mapping': 0.3.25 + dev: true + /@antfu/eslint-config@2.13.3(@vue/compiler-sfc@3.4.21)(eslint@8.49.0)(typescript@5.4.2): resolution: {integrity: sha512-DCyrnFgWtIc0mUTn8HeVB15Z/t9oEQZk8ce6S14Kq6z42LbMfZxPu6hs4SmPFYWLJoEzYq87dxsRv3glOX+aGw==} hasBin: true @@ -346,6 +360,13 @@ packages: - vitest dev: true + /@antfu/install-pkg@0.1.1: + resolution: {integrity: sha512-LyB/8+bSfa0DFGC06zpCEfs89/XoWZwws5ygEa5D+Xsm3OfI+aXQ86VgVG7Acyef+rSZ5HE7J8rrxzrQeM3PjQ==} + dependencies: + execa: 5.1.1 + find-up: 5.0.0 + dev: true + /@antfu/install-pkg@0.3.2: resolution: {integrity: sha512-FFYqME8+UHlPnRlX/vn+8cTD4Wo/nG/lzRxpABs3XANBmdJdNImVz3QvjNAE/W3PSCNbG387FOz8o5WelnWOlg==} dependencies: @@ -357,6 +378,10 @@ packages: hasBin: true dev: true + /@antfu/utils@0.7.7: + resolution: {integrity: sha512-gFPqTG7otEJ8uP6wrhDv6mqwGWYZKNvAcCq6u9hOj0c+IKCEsY4L1oC9trPq2SaWIzAfHvqfBDxF591JkMf+kg==} + dev: true + /@azu/format-text@1.0.2: resolution: {integrity: sha512-Swi4N7Edy1Eqq82GxgEECXSSLyn6GOb5htRFPzBDdUkECGXtlf12ynO5oJSpWKPwCaUssOu7NfhDcCWpIC6Ywg==} dev: true @@ -375,6 +400,173 @@ packages: picocolors: 1.0.0 dev: true + /@babel/compat-data@7.24.4: + resolution: {integrity: sha512-vg8Gih2MLK+kOkHJp4gBEIkyaIi00jgWot2D9QOmmfLC8jINSOzmCLta6Bvz/JSBCqnegV0L80jhxkol5GWNfQ==} + engines: {node: '>=6.9.0'} + dev: true + + /@babel/core@7.24.4: + resolution: {integrity: sha512-MBVlMXP+kkl5394RBLSxxk/iLTeVGuXTV3cIDXavPpMMqnSnt6apKgan/U8O3USWZCWZT/TbgfEpKa4uMgN4Dg==} + engines: {node: '>=6.9.0'} + dependencies: + '@ampproject/remapping': 2.3.0 + '@babel/code-frame': 7.24.2 + '@babel/generator': 7.24.4 + '@babel/helper-compilation-targets': 7.23.6 + '@babel/helper-module-transforms': 7.23.3(@babel/core@7.24.4) + '@babel/helpers': 7.24.4 + '@babel/parser': 7.24.4 + '@babel/template': 7.24.0 + '@babel/traverse': 7.24.1 + '@babel/types': 7.24.0 + convert-source-map: 2.0.0 + debug: 4.3.4 + gensync: 1.0.0-beta.2 + json5: 2.2.3 + semver: 6.3.1 + transitivePeerDependencies: + - supports-color + dev: true + + /@babel/generator@7.24.4: + resolution: {integrity: sha512-Xd6+v6SnjWVx/nus+y0l1sxMOTOMBkyL4+BIdbALyatQnAe/SRVjANeDPSCYaX+i1iJmuGSKf3Z+E+V/va1Hvw==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/types': 7.24.0 + '@jridgewell/gen-mapping': 0.3.5 + '@jridgewell/trace-mapping': 0.3.25 + jsesc: 2.5.2 + dev: true + + /@babel/helper-annotate-as-pure@7.22.5: + resolution: {integrity: sha512-LvBTxu8bQSQkcyKOU+a1btnNFQ1dMAd0R6PyW3arXes06F6QLWLIrd681bxRPIXlrMGR3XYnW9JyML7dP3qgxg==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/types': 7.24.0 + dev: true + + /@babel/helper-compilation-targets@7.23.6: + resolution: {integrity: sha512-9JB548GZoQVmzrFgp8o7KxdgkTGm6xs9DW0o/Pim72UDjzr5ObUQ6ZzYPqA+g9OTS2bBQoctLJrky0RDCAWRgQ==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/compat-data': 7.24.4 + '@babel/helper-validator-option': 7.23.5 + browserslist: 4.23.0 + lru-cache: 5.1.1 + semver: 6.3.1 + dev: true + + /@babel/helper-create-class-features-plugin@7.24.4(@babel/core@7.24.4): + resolution: {integrity: sha512-lG75yeuUSVu0pIcbhiYMXBXANHrpUPaOfu7ryAzskCgKUHuAxRQI5ssrtmF0X9UXldPlvT0XM/A4F44OXRt6iQ==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0 + dependencies: + '@babel/core': 7.24.4 + '@babel/helper-annotate-as-pure': 7.22.5 + '@babel/helper-environment-visitor': 7.22.20 + '@babel/helper-function-name': 7.23.0 + '@babel/helper-member-expression-to-functions': 7.23.0 + '@babel/helper-optimise-call-expression': 7.22.5 + '@babel/helper-replace-supers': 7.24.1(@babel/core@7.24.4) + '@babel/helper-skip-transparent-expression-wrappers': 7.22.5 + '@babel/helper-split-export-declaration': 7.22.6 + semver: 6.3.1 + dev: true + + /@babel/helper-environment-visitor@7.22.20: + resolution: {integrity: sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA==} + engines: {node: '>=6.9.0'} + dev: true + + /@babel/helper-function-name@7.23.0: + resolution: {integrity: sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/template': 7.24.0 + '@babel/types': 7.24.0 + dev: true + + /@babel/helper-hoist-variables@7.22.5: + resolution: {integrity: sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/types': 7.24.0 + dev: true + + /@babel/helper-member-expression-to-functions@7.23.0: + resolution: {integrity: sha512-6gfrPwh7OuT6gZyJZvd6WbTfrqAo7vm4xCzAXOusKqq/vWdKXphTpj5klHKNmRUU6/QRGlBsyU9mAIPaWHlqJA==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/types': 7.24.0 + dev: true + + /@babel/helper-module-imports@7.24.3: + resolution: {integrity: sha512-viKb0F9f2s0BCS22QSF308z/+1YWKV/76mwt61NBzS5izMzDPwdq1pTrzf+Li3npBWX9KdQbkeCt1jSAM7lZqg==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/types': 7.24.0 + dev: true + + /@babel/helper-module-transforms@7.23.3(@babel/core@7.24.4): + resolution: {integrity: sha512-7bBs4ED9OmswdfDzpz4MpWgSrV7FXlc3zIagvLFjS5H+Mk7Snr21vQ6QwrsoCGMfNC4e4LQPdoULEt4ykz0SRQ==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0 + dependencies: + '@babel/core': 7.24.4 + '@babel/helper-environment-visitor': 7.22.20 + '@babel/helper-module-imports': 7.24.3 + '@babel/helper-simple-access': 7.22.5 + '@babel/helper-split-export-declaration': 7.22.6 + '@babel/helper-validator-identifier': 7.22.20 + dev: true + + /@babel/helper-optimise-call-expression@7.22.5: + resolution: {integrity: sha512-HBwaojN0xFRx4yIvpwGqxiV2tUfl7401jlok564NgB9EHS1y6QT17FmKWm4ztqjeVdXLuC4fSvHc5ePpQjoTbw==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/types': 7.24.0 + dev: true + + /@babel/helper-plugin-utils@7.24.0: + resolution: {integrity: sha512-9cUznXMG0+FxRuJfvL82QlTqIzhVW9sL0KjMPHhAOOvpQGL8QtdxnBKILjBqxlHyliz0yCa1G903ZXI/FuHy2w==} + engines: {node: '>=6.9.0'} + dev: true + + /@babel/helper-replace-supers@7.24.1(@babel/core@7.24.4): + resolution: {integrity: sha512-QCR1UqC9BzG5vZl8BMicmZ28RuUBnHhAMddD8yHFHDRH9lLTZ9uUPehX8ctVPT8l0TKblJidqcgUUKGVrePleQ==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0 + dependencies: + '@babel/core': 7.24.4 + '@babel/helper-environment-visitor': 7.22.20 + '@babel/helper-member-expression-to-functions': 7.23.0 + '@babel/helper-optimise-call-expression': 7.22.5 + dev: true + + /@babel/helper-simple-access@7.22.5: + resolution: {integrity: sha512-n0H99E/K+Bika3++WNL17POvo4rKWZ7lZEp1Q+fStVbUi8nxPQEBOlTmCOxW/0JsS56SKKQ+ojAe2pHKJHN35w==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/types': 7.24.0 + dev: true + + /@babel/helper-skip-transparent-expression-wrappers@7.22.5: + resolution: {integrity: sha512-tK14r66JZKiC43p8Ki33yLBVJKlQDFoA8GYN67lWCDCqoL6EMMSuM9b+Iff2jHaM/RRFYl7K+iiru7hbRqNx8Q==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/types': 7.24.0 + dev: true + + /@babel/helper-split-export-declaration@7.22.6: + resolution: {integrity: sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/types': 7.24.0 + dev: true + /@babel/helper-string-parser@7.24.1: resolution: {integrity: sha512-2ofRCjnnA9y+wk8b9IAREroeUP02KHp431N2mhKniy2yKIDKpbrHv9eXwm8cBeWQYcJmzv5qKCu65P47eCF7CQ==} engines: {node: '>=6.9.0'} @@ -383,6 +575,22 @@ packages: resolution: {integrity: sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==} engines: {node: '>=6.9.0'} + /@babel/helper-validator-option@7.23.5: + resolution: {integrity: sha512-85ttAOMLsr53VgXkTbkx8oA6YTfT4q7/HzXSLEYmjcSTJPMPQtvq1BD79Byep5xMUYbGRzEpDsjUf3dyp54IKw==} + engines: {node: '>=6.9.0'} + dev: true + + /@babel/helpers@7.24.4: + resolution: {integrity: sha512-FewdlZbSiwaVGlgT1DPANDuCHaDMiOo+D/IDYRFYjHOuv66xMSJ7fQwwODwRNAPkADIO/z1EoF/l2BCWlWABDw==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/template': 7.24.0 + '@babel/traverse': 7.24.1 + '@babel/types': 7.24.0 + transitivePeerDependencies: + - supports-color + dev: true + /@babel/highlight@7.24.2: resolution: {integrity: sha512-Yac1ao4flkTxTteCDZLEvdxg2fZfz1v8M4QpaGypq/WPDqg3ijHYbDfs+LG5hvzSoqaSZ9/Z9lKSP3CjZjv+pA==} engines: {node: '>=6.9.0'} @@ -400,6 +608,100 @@ packages: dependencies: '@babel/types': 7.24.0 + /@babel/parser@7.24.4: + resolution: {integrity: sha512-zTvEBcghmeBma9QIGunWevvBAp4/Qu9Bdq+2k0Ot4fVMD6v3dsC9WOcRSKk7tRRyBM/53yKMJko9xOatGQAwSg==} + engines: {node: '>=6.0.0'} + hasBin: true + dependencies: + '@babel/types': 7.24.0 + dev: true + + /@babel/plugin-syntax-jsx@7.24.1(@babel/core@7.24.4): + resolution: {integrity: sha512-2eCtxZXf+kbkMIsXS4poTvT4Yu5rXiRa+9xGVT56raghjmBTKMpFNc9R4IDiB4emao9eO22Ox7CxuJG7BgExqA==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + dependencies: + '@babel/core': 7.24.4 + '@babel/helper-plugin-utils': 7.24.0 + dev: true + + /@babel/plugin-syntax-typescript@7.24.1(@babel/core@7.24.4): + resolution: {integrity: sha512-Yhnmvy5HZEnHUty6i++gcfH1/l68AHnItFHnaCv6hn9dNh0hQvvQJsxpi4BMBFN5DLeHBuucT/0DgzXif/OyRw==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + dependencies: + '@babel/core': 7.24.4 + '@babel/helper-plugin-utils': 7.24.0 + dev: true + + /@babel/plugin-transform-modules-commonjs@7.24.1(@babel/core@7.24.4): + resolution: {integrity: sha512-szog8fFTUxBfw0b98gEWPaEqF42ZUD/T3bkynW/wtgx2p/XCP55WEsb+VosKceRSd6njipdZvNogqdtI4Q0chw==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + dependencies: + '@babel/core': 7.24.4 + '@babel/helper-module-transforms': 7.23.3(@babel/core@7.24.4) + '@babel/helper-plugin-utils': 7.24.0 + '@babel/helper-simple-access': 7.22.5 + dev: true + + /@babel/plugin-transform-typescript@7.24.4(@babel/core@7.24.4): + resolution: {integrity: sha512-79t3CQ8+oBGk/80SQ8MN3Bs3obf83zJ0YZjDmDaEZN8MqhMI760apl5z6a20kFeMXBwJX99VpKT8CKxEBp5H1g==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + dependencies: + '@babel/core': 7.24.4 + '@babel/helper-annotate-as-pure': 7.22.5 + '@babel/helper-create-class-features-plugin': 7.24.4(@babel/core@7.24.4) + '@babel/helper-plugin-utils': 7.24.0 + '@babel/plugin-syntax-typescript': 7.24.1(@babel/core@7.24.4) + dev: true + + /@babel/preset-typescript@7.24.1(@babel/core@7.24.4): + resolution: {integrity: sha512-1DBaMmRDpuYQBPWD8Pf/WEwCrtgRHxsZnP4mIy9G/X+hFfbI47Q2G4t1Paakld84+qsk2fSsUPMKg71jkoOOaQ==} + engines: {node: '>=6.9.0'} + peerDependencies: + '@babel/core': ^7.0.0-0 + dependencies: + '@babel/core': 7.24.4 + '@babel/helper-plugin-utils': 7.24.0 + '@babel/helper-validator-option': 7.23.5 + '@babel/plugin-syntax-jsx': 7.24.1(@babel/core@7.24.4) + '@babel/plugin-transform-modules-commonjs': 7.24.1(@babel/core@7.24.4) + '@babel/plugin-transform-typescript': 7.24.4(@babel/core@7.24.4) + dev: true + + /@babel/template@7.24.0: + resolution: {integrity: sha512-Bkf2q8lMB0AFpX0NFEqSbx1OkTHf0f+0j82mkw+ZpzBnkk7e9Ql0891vlfgi+kHwOk8tQjiQHpqh4LaSa0fKEA==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/code-frame': 7.24.2 + '@babel/parser': 7.24.4 + '@babel/types': 7.24.0 + dev: true + + /@babel/traverse@7.24.1: + resolution: {integrity: sha512-xuU6o9m68KeqZbQuDt2TcKSxUw/mrsvavlEqQ1leZ/B+C9tk6E4sRWy97WaXgvq5E+nU3cXMxv3WKOCanVMCmQ==} + engines: {node: '>=6.9.0'} + dependencies: + '@babel/code-frame': 7.24.2 + '@babel/generator': 7.24.4 + '@babel/helper-environment-visitor': 7.22.20 + '@babel/helper-function-name': 7.23.0 + '@babel/helper-hoist-variables': 7.22.5 + '@babel/helper-split-export-declaration': 7.22.6 + '@babel/parser': 7.24.4 + '@babel/types': 7.24.0 + debug: 4.3.4 + globals: 11.12.0 + transitivePeerDependencies: + - supports-color + dev: true + /@babel/types@7.24.0: resolution: {integrity: sha512-+j7a5c253RfKh8iABBhywc8NSfP5LURe7Uh4qpsh6jc+aLJguvmIUBdjSdEMQv2bENrCR5MfRdjGo7vzS/ob7w==} engines: {node: '>=6.9.0'} @@ -948,6 +1250,24 @@ packages: resolution: {integrity: sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA==} dev: true + /@iconify/types@2.0.0: + resolution: {integrity: sha512-+wluvCrRhXrhyOmRDJ3q8mux9JkKy5SJ/v8ol2tu4FVjyYvtEzkc/3pK15ET6RKg4b4w4BmTk1+gsCUhf21Ykg==} + dev: true + + /@iconify/utils@2.1.22: + resolution: {integrity: sha512-6UHVzTVXmvO8uS6xFF+L/QTSpTzA/JZxtgU+KYGFyDYMEObZ1bu/b5l+zNJjHy+0leWjHI+C0pXlzGvv3oXZMA==} + dependencies: + '@antfu/install-pkg': 0.1.1 + '@antfu/utils': 0.7.7 + '@iconify/types': 2.0.0 + debug: 4.3.4 + kolorist: 1.8.0 + local-pkg: 0.5.0 + mlly: 1.6.1 + transitivePeerDependencies: + - supports-color + dev: true + /@isaacs/cliui@8.0.2: resolution: {integrity: sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==} engines: {node: '>=12'} @@ -960,9 +1280,35 @@ packages: wrap-ansi-cjs: /wrap-ansi@7.0.0 dev: true + /@jridgewell/gen-mapping@0.3.5: + resolution: {integrity: sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg==} + engines: {node: '>=6.0.0'} + dependencies: + '@jridgewell/set-array': 1.2.1 + '@jridgewell/sourcemap-codec': 1.4.15 + '@jridgewell/trace-mapping': 0.3.25 + dev: true + + /@jridgewell/resolve-uri@3.1.2: + resolution: {integrity: sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==} + engines: {node: '>=6.0.0'} + dev: true + + /@jridgewell/set-array@1.2.1: + resolution: {integrity: sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==} + engines: {node: '>=6.0.0'} + dev: true + /@jridgewell/sourcemap-codec@1.4.15: resolution: {integrity: sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==} + /@jridgewell/trace-mapping@0.3.25: + resolution: {integrity: sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==} + dependencies: + '@jridgewell/resolve-uri': 3.1.2 + '@jridgewell/sourcemap-codec': 1.4.15 + dev: true + /@kwsites/file-exists@1.1.1: resolution: {integrity: sha512-m9/5YGR18lIwxSFDwfE3oA7bWuq9kdau6ugN4H2rJeyhFQZcG9AgSHkQtSD15a8WvTgfz9aikZMrKPHvbpqFiw==} dependencies: @@ -1007,6 +1353,24 @@ packages: dev: true optional: true + /@polka/url@1.0.0-next.25: + resolution: {integrity: sha512-j7P6Rgr3mmtdkeDGTe0E/aYyWEWVtc5yFXtHCRHs28/jptDEWfaVOc5T7cblqy1XKPPfCxJc/8DwQ5YgLOZOVQ==} + dev: true + + /@rollup/pluginutils@5.1.0: + resolution: {integrity: sha512-XTIWOPPcpvyKI6L1NHo0lFlCyznUEyPmPY1mc3KpPVDYulHSTvyeLNVW00QTLIAFNhR3kYnJTQHeGqU4M3n09g==} + engines: {node: '>=14.0.0'} + peerDependencies: + rollup: ^1.20.0||^2.0.0||^3.0.0||^4.0.0 + peerDependenciesMeta: + rollup: + optional: true + dependencies: + '@types/estree': 1.0.5 + estree-walker: 2.0.2 + picomatch: 2.3.1 + dev: true + /@rollup/rollup-android-arm-eabi@4.13.2: resolution: {integrity: sha512-3XFIDKWMFZrMnao1mJhnOT1h2g0169Os848NhhmGweEcfJ4rCi+3yMCOLG4zA61rbJdkcrM/DjVZm9Hg5p5w7g==} cpu: [arm] @@ -1643,6 +2007,220 @@ packages: eslint-visitor-keys: 3.4.3 dev: true + /@unocss/astro@0.59.2(vite@5.1.6): + resolution: {integrity: sha512-vchGjdGxwDELAWJX6Ql5FCg+eDsJmT4Pn752h4oCy6cZHq/0i4p+CovT/Rb8AkfCpCW+DtdjKRRhfAnmKjJquQ==} + peerDependencies: + vite: ^2.9.0 || ^3.0.0-0 || ^4.0.0 || ^5.0.0-0 + peerDependenciesMeta: + vite: + optional: true + dependencies: + '@unocss/core': 0.59.2 + '@unocss/reset': 0.59.2 + '@unocss/vite': 0.59.2(vite@5.1.6) + vite: 5.1.6(@types/node@20.11.28) + transitivePeerDependencies: + - rollup + dev: true + + /@unocss/cli@0.59.2: + resolution: {integrity: sha512-B7DjC49obmf9LXDxlAcy+K4ItYYgjHUALv+PVzPRcFml2H1DqSSWmOAHmbr12a81MWXXRlS1s7Z24LKqX6vFKg==} + engines: {node: '>=14'} + hasBin: true + dependencies: + '@ampproject/remapping': 2.3.0 + '@rollup/pluginutils': 5.1.0 + '@unocss/config': 0.59.2 + '@unocss/core': 0.59.2 + '@unocss/preset-uno': 0.59.2 + cac: 6.7.14 + chokidar: 3.6.0 + colorette: 2.0.20 + consola: 3.2.3 + fast-glob: 3.3.2 + magic-string: 0.30.9 + pathe: 1.1.2 + perfect-debounce: 1.0.0 + transitivePeerDependencies: + - rollup + dev: true + + /@unocss/config@0.59.2: + resolution: {integrity: sha512-KknR9kcid1w/8IuujZ8msE5pU930GD5e2v84H9Ftcv308yfuj+j/0zQ/ORtG8qMx+97p7uFy3xspzI2yoRYRpQ==} + engines: {node: '>=14'} + dependencies: + '@unocss/core': 0.59.2 + unconfig: 0.3.12 + dev: true + + /@unocss/core@0.59.2: + resolution: {integrity: sha512-0NtauY7v5bG0UIcvIABWnD2ssD5b9UcFkyw4iRIsT9NvR0e7QqGIOvZEg5XN0j25o50GtxlotMmTAAiaazHZ0Q==} + dev: true + + /@unocss/extractor-arbitrary-variants@0.59.2: + resolution: {integrity: sha512-v+1cdybFmi7sRUG8/B2vSVaBi/CgViithbiwjTjzeKETA5Cw/pWgk1Rf/MDu4jfux4MZ0+mLULm20HSUg0oXdg==} + dependencies: + '@unocss/core': 0.59.2 + dev: true + + /@unocss/inspector@0.59.2: + resolution: {integrity: sha512-9BbtPrxYZVazODkNM5pZJ0j0XXIxdWxwG7PigyqJCBJbtUyM35jEZRQPNKAeGAlcnxoZE6UAJneG1M+BgFZt/w==} + dependencies: + '@unocss/core': 0.59.2 + '@unocss/rule-utils': 0.59.2 + gzip-size: 6.0.0 + sirv: 2.0.4 + dev: true + + /@unocss/postcss@0.59.2(postcss@8.4.38): + resolution: {integrity: sha512-9pRixhnL9B1sdhzY7zlhnBXc8nVNwDCT4nMQRgSdWNvT76dImVv1N3609veIrCfLEHQJi52Juo//trSNLjUzZQ==} + engines: {node: '>=14'} + peerDependencies: + postcss: ^8.4.21 + dependencies: + '@unocss/config': 0.59.2 + '@unocss/core': 0.59.2 + '@unocss/rule-utils': 0.59.2 + css-tree: 2.3.1 + fast-glob: 3.3.2 + magic-string: 0.30.9 + postcss: 8.4.38 + dev: true + + /@unocss/preset-attributify@0.59.2: + resolution: {integrity: sha512-iQsKoQAaEwosqe9199rhlZqUeRZ3A39QKqLNxLRf+zkiIQaL0yHlsTYVg9VjbiEb8A1JDi7nHDgZNRBJRyb3nQ==} + dependencies: + '@unocss/core': 0.59.2 + dev: true + + /@unocss/preset-icons@0.59.2: + resolution: {integrity: sha512-Qg/zXqzlt0qLdC7DmDVilX0gdgiM1IPqy+fZ8sAfWy3CtAfMIg4rSHn3qELZdExGvp0WfnkLC+q0t7AwyVyQPw==} + dependencies: + '@iconify/utils': 2.1.22 + '@unocss/core': 0.59.2 + ofetch: 1.3.4 + transitivePeerDependencies: + - supports-color + dev: true + + /@unocss/preset-mini@0.59.2: + resolution: {integrity: sha512-OFFPNyuuQcPJU4lIE1nQXnmH6uOuinA0+bCAjyB6/1Bj7LCLJGPqdviud/to6cLT90PUsKTIG2TTEQisO3CWAQ==} + dependencies: + '@unocss/core': 0.59.2 + '@unocss/extractor-arbitrary-variants': 0.59.2 + '@unocss/rule-utils': 0.59.2 + dev: true + + /@unocss/preset-tagify@0.59.2: + resolution: {integrity: sha512-/dhu5G3P0084wn+gxqaLpChv8EyXh9q070uYUxdzNjmZgZ0JDZaeSrcfiyzLJO5RoYCyJNAsp32mBK+//N3XPg==} + dependencies: + '@unocss/core': 0.59.2 + dev: true + + /@unocss/preset-typography@0.59.2: + resolution: {integrity: sha512-02NSGlEhxSDYl58ZiorP4EUiFI5z+j9ez5XjF+FKrZwK2J/L3/DRXcW00n9ERhtc44H6RP2Laj3X7sH8ggJ37A==} + dependencies: + '@unocss/core': 0.59.2 + '@unocss/preset-mini': 0.59.2 + dev: true + + /@unocss/preset-uno@0.59.2: + resolution: {integrity: sha512-+decQShFqTz00w6rpNRQZEZm8PV1MHHs0thUNaooBUF+pISNhJlXJisE2rz4V7KVCCMgZZTRtyPZxmblGVXbJg==} + dependencies: + '@unocss/core': 0.59.2 + '@unocss/preset-mini': 0.59.2 + '@unocss/preset-wind': 0.59.2 + '@unocss/rule-utils': 0.59.2 + dev: true + + /@unocss/preset-web-fonts@0.59.2: + resolution: {integrity: sha512-F7NTjDnmmWlu/NlFjtFR92PnONGax1geXFQFb/dh7QlEBZiVe/qzHRtKLtsYaOGSPr5CSamo0LORx4wug7gjIA==} + dependencies: + '@unocss/core': 0.59.2 + ofetch: 1.3.4 + dev: true + + /@unocss/preset-wind@0.59.2: + resolution: {integrity: sha512-LbdsxU8M90guqV4e7K1weDp3wWcSwzcSmxkogSI/R818SJgnocv4eNzeIR5/mbZu8y8ENtEiE8rEYL1jA6L2GQ==} + dependencies: + '@unocss/core': 0.59.2 + '@unocss/preset-mini': 0.59.2 + '@unocss/rule-utils': 0.59.2 + dev: true + + /@unocss/reset@0.59.2: + resolution: {integrity: sha512-xEo2ogs42FlNUca3BiPesGg9/FevJ6cmkxnzzbwlqIEeZjiCH6o+nGdNNUbi6p+gto2P9v4L8ZOeMFYQCwpFzg==} + dev: true + + /@unocss/rule-utils@0.59.2: + resolution: {integrity: sha512-2F1Q1pCfeG65GxPEhGQDZXXoZk38fX4o5LOYf35XkknhjQmkaeK76szVYXLDoyK30n9EiwXqoc0MdKrGjeCMUA==} + engines: {node: '>=14'} + dependencies: + '@unocss/core': 0.59.2 + magic-string: 0.30.9 + dev: true + + /@unocss/scope@0.59.2: + resolution: {integrity: sha512-V6ZS+QonrmqRfZ1/oYmEusASBjbbO+eeL+Fau3bh8IZyPq2HkngJvLNwcyQUPk3/pH18anuzBktSYP0BD2GsKA==} + dev: true + + /@unocss/transformer-attributify-jsx-babel@0.59.2: + resolution: {integrity: sha512-tFFncKR9WkGs8asi00lboVbQ/GjHWrE3YBY1GCrSZpeW+XOpGkkEEo03ncVW2c2s0ie4Zl5T7UWcRzFY8gyITQ==} + dependencies: + '@babel/core': 7.24.4 + '@babel/plugin-syntax-jsx': 7.24.1(@babel/core@7.24.4) + '@babel/preset-typescript': 7.24.1(@babel/core@7.24.4) + '@unocss/core': 0.59.2 + transitivePeerDependencies: + - supports-color + dev: true + + /@unocss/transformer-attributify-jsx@0.59.2: + resolution: {integrity: sha512-mqcA02tkgeEdMH99K3YJFwHhyT/qvM/0+amfZ3nYlNAiiyCumdb980fSdUvx/cTyXmnocD6tG+UPnx2kD3zdQg==} + dependencies: + '@unocss/core': 0.59.2 + dev: true + + /@unocss/transformer-compile-class@0.59.2: + resolution: {integrity: sha512-yXKoAJU0QcRx3c2XAalHgcVculIPDRCanBm5A3XZPp35eKhcni3VedzUQY6RYFfoETOgQ5x0SV73Ttbj/zvZBQ==} + dependencies: + '@unocss/core': 0.59.2 + dev: true + + /@unocss/transformer-directives@0.59.2: + resolution: {integrity: sha512-FiLcBtwUIUNFpE2SxeUeslJGShHimOJyk30+m2BP+Af7QsxcamWb8/w7YKRMz5MAmE6ZnzAzx/ZAdrK540ho0A==} + dependencies: + '@unocss/core': 0.59.2 + '@unocss/rule-utils': 0.59.2 + css-tree: 2.3.1 + dev: true + + /@unocss/transformer-variant-group@0.59.2: + resolution: {integrity: sha512-nlEI5ts2YVKvL0dFaIozFIefPUTDZhYCNS6Oie5DPVXDTVufkh9OinLiCo/2ggytkY/VZL00wJm6Iknrp7HL7Q==} + dependencies: + '@unocss/core': 0.59.2 + dev: true + + /@unocss/vite@0.59.2(vite@5.1.6): + resolution: {integrity: sha512-cCATFcyoHKr/5c/ccnwhtYoUA42v+SXp2xmpR4hgE0U4WFgGqIYOx5pzWap73DbywQJuU0hklq7lgvO9b+L/sQ==} + peerDependencies: + vite: ^2.9.0 || ^3.0.0-0 || ^4.0.0 || ^5.0.0-0 + dependencies: + '@ampproject/remapping': 2.3.0 + '@rollup/pluginutils': 5.1.0 + '@unocss/config': 0.59.2 + '@unocss/core': 0.59.2 + '@unocss/inspector': 0.59.2 + '@unocss/scope': 0.59.2 + '@unocss/transformer-directives': 0.59.2 + chokidar: 3.6.0 + fast-glob: 3.3.2 + magic-string: 0.30.9 + vite: 5.1.6(@types/node@20.11.28) + transitivePeerDependencies: + - rollup + dev: true + /@vitejs/plugin-vue@5.0.4(vite@5.1.6)(vue@3.4.21): resolution: {integrity: sha512-WS3hevEszI6CEVEx28F8RjTX97k3KsrcY6kvTg7+Whm5y3oYvcqzVeGCU3hxSAn4uY2CLCkeokkGKpoctccilQ==} engines: {node: ^18.0.0 || >=20.0.0} @@ -1971,6 +2549,14 @@ packages: engines: {node: '>=12'} dev: true + /anymatch@3.1.3: + resolution: {integrity: sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==} + engines: {node: '>= 8'} + dependencies: + normalize-path: 3.0.0 + picomatch: 2.3.1 + dev: true + /are-docs-informative@0.0.2: resolution: {integrity: sha512-ixiS0nLNNG5jNQzgZJNoUpBKdo9yTYZMGJ+QgT2jmjR7G7+QHRCc4v6LQ3NgE7EBJq+o0ams3waJwkrlBom8Ig==} engines: {node: '>=14'} @@ -2037,6 +2623,11 @@ packages: resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} dev: true + /binary-extensions@2.3.0: + resolution: {integrity: sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==} + engines: {node: '>=8'} + dev: true + /boolbase@1.0.0: resolution: {integrity: sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==} dev: true @@ -2081,6 +2672,11 @@ packages: engines: {node: '>=6'} dev: true + /cac@6.7.14: + resolution: {integrity: sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==} + engines: {node: '>=8'} + dev: true + /call-bind@1.0.7: resolution: {integrity: sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==} engines: {node: '>= 0.4'} @@ -2138,6 +2734,21 @@ packages: resolution: {integrity: sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA==} dev: true + /chokidar@3.6.0: + resolution: {integrity: sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==} + engines: {node: '>= 8.10.0'} + dependencies: + anymatch: 3.1.3 + braces: 3.0.2 + glob-parent: 5.1.2 + is-binary-path: 2.1.0 + is-glob: 4.0.3 + normalize-path: 3.0.0 + readdirp: 3.6.0 + optionalDependencies: + fsevents: 2.3.3 + dev: true + /ci-info@4.0.0: resolution: {integrity: sha512-TdHqgGf9odd8SXNuxtUBVx8Nv+qZOejE6qyqiy5NtbYYQOeFa6zmHkxlPzmaLxWWHsU6nJmB7AETdVPi+2NBUg==} engines: {node: '>=8'} @@ -2180,6 +2791,10 @@ packages: resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==} dev: true + /colorette@2.0.20: + resolution: {integrity: sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==} + dev: true + /combined-stream@1.0.8: resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==} engines: {node: '>= 0.8'} @@ -2212,6 +2827,15 @@ packages: proto-list: 1.2.4 dev: true + /consola@3.2.3: + resolution: {integrity: sha512-I5qxpzLv+sJhTVEoLYNcTW+bThDCPsit0vLNKShZx6rLtpilNpmmeTPaeqJb9ZE9dV3DGaeby6Vuhrw38WjeyQ==} + engines: {node: ^14.18.0 || >=16.10.0} + dev: true + + /convert-source-map@2.0.0: + resolution: {integrity: sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==} + dev: true + /core-js-compat@3.36.1: resolution: {integrity: sha512-Dk997v9ZCt3X/npqzyGdTlq6t7lDBhZwGvV94PKzDArjp7BTRm7WlDAXYd/OWdeFHO8OChQYRJNJvUCqCbrtKA==} dependencies: @@ -2231,6 +2855,14 @@ packages: resolution: {integrity: sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow==} dev: true + /css-tree@2.3.1: + resolution: {integrity: sha512-6Fv1DV/TYw//QF5IzQdqsNDjx/wc8TrMBZsqjL9eW01tWb7R7k/mq+/VXfJCl7SoD5emsJop9cOByJZfs8hYIw==} + engines: {node: ^10 || ^12.20.0 || ^14.13.0 || >=15.0.0} + dependencies: + mdn-data: 2.0.30 + source-map-js: 1.2.0 + dev: true + /cssesc@3.0.0: resolution: {integrity: sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==} engines: {node: '>=4'} @@ -2335,11 +2967,19 @@ packages: object-keys: 1.1.1 dev: true + /defu@6.1.4: + resolution: {integrity: sha512-mEQCMmwJu317oSz8CwdIOdwf3xMif1ttiM8LTufzc3g6kR+9Pe236twL8j3IYT1F7GfRgGcW6MWxzZjLIkuHIg==} + dev: true + /delayed-stream@1.0.0: resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==} engines: {node: '>=0.4.0'} dev: true + /destr@2.0.3: + resolution: {integrity: sha512-2N3BOUU4gYMpTP24s5rF5iP7BDr7uNTCs4ozw3kf/eKfvWSIu93GEBi5m427YoyJoeOzQ5smuu4nNAPGb8idSQ==} + dev: true + /diff@5.2.0: resolution: {integrity: sha512-uIFDxqpRZGZ6ThOk84hEfqWoHx2devRFvpTZcTHur85vImfaxUbTW9Ryh4CpCuDnToOP1CEtXKIgytHBPVff5A==} engines: {node: '>=0.3.1'} @@ -2359,6 +2999,10 @@ packages: esutils: 2.0.3 dev: true + /duplexer@0.1.2: + resolution: {integrity: sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg==} + dev: true + /eastasianwidth@0.2.0: resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==} dev: true @@ -2997,6 +3641,21 @@ packages: engines: {node: '>=0.10.0'} dev: true + /execa@5.1.1: + resolution: {integrity: sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==} + engines: {node: '>=10'} + dependencies: + cross-spawn: 7.0.3 + get-stream: 6.0.1 + human-signals: 2.1.0 + is-stream: 2.0.1 + merge-stream: 2.0.0 + npm-run-path: 4.0.1 + onetime: 5.1.2 + signal-exit: 3.0.7 + strip-final-newline: 2.0.0 + dev: true + /execa@8.0.1: resolution: {integrity: sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg==} engines: {node: '>=16.17'} @@ -3214,6 +3873,11 @@ packages: resolution: {integrity: sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==} dev: true + /gensync@1.0.0-beta.2: + resolution: {integrity: sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==} + engines: {node: '>=6.9.0'} + dev: true + /get-caller-file@2.0.5: resolution: {integrity: sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==} engines: {node: 6.* || 8.* || >= 10.*} @@ -3235,6 +3899,11 @@ packages: engines: {node: '>=0.12.0'} dev: true + /get-stream@6.0.1: + resolution: {integrity: sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==} + engines: {node: '>=10'} + dev: true + /get-stream@8.0.1: resolution: {integrity: sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA==} engines: {node: '>=16'} @@ -3292,6 +3961,11 @@ packages: path-is-absolute: 1.0.1 dev: true + /globals@11.12.0: + resolution: {integrity: sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==} + engines: {node: '>=4'} + dev: true + /globals@13.24.0: resolution: {integrity: sha512-AhO5QUcj8llrbG09iWhPU2B204J1xnPeL8kQmVorSsy+Sjj1sk8gIyh6cUocGmH4L0UuhAJy+hJMRA4mgA4mFQ==} engines: {node: '>=8'} @@ -3352,6 +4026,13 @@ packages: strip-bom-string: 1.0.0 dev: true + /gzip-size@6.0.0: + resolution: {integrity: sha512-ax7ZYomf6jqPTQ4+XCpUGyXKHk5WweS+e05MBO4/y3WJ5RkmPXNKvX+bx1behVILVwr6JSQvZAku021CHPXG3Q==} + engines: {node: '>=10'} + dependencies: + duplexer: 0.1.2 + dev: true + /has-bigints@1.0.2: resolution: {integrity: sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ==} dev: true @@ -3436,6 +4117,11 @@ packages: - supports-color dev: true + /human-signals@2.1.0: + resolution: {integrity: sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==} + engines: {node: '>=10.17.0'} + dev: true + /human-signals@5.0.0: resolution: {integrity: sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==} engines: {node: '>=16.17.0'} @@ -3524,6 +4210,13 @@ packages: has-bigints: 1.0.2 dev: true + /is-binary-path@2.1.0: + resolution: {integrity: sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==} + engines: {node: '>=8'} + dependencies: + binary-extensions: 2.3.0 + dev: true + /is-boolean-object@1.1.2: resolution: {integrity: sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==} engines: {node: '>= 0.4'} @@ -3649,6 +4342,11 @@ packages: call-bind: 1.0.7 dev: true + /is-stream@2.0.1: + resolution: {integrity: sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==} + engines: {node: '>=8'} + dev: true + /is-stream@3.0.0: resolution: {integrity: sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} @@ -3702,6 +4400,11 @@ packages: '@pkgjs/parseargs': 0.11.0 dev: true + /jiti@1.21.0: + resolution: {integrity: sha512-gFqAIbuKyyso/3G2qhiO2OM6shY6EPP/R0+mkDbyspxKazh8BXDC5FiFsUjlczgdNz/vfra0da2y+aHrusLG/Q==} + hasBin: true + dev: true + /js-beautify@1.15.1: resolution: {integrity: sha512-ESjNzSlt/sWE8sciZH8kBF8BPlwXPwhR6pWKAw8bw4Bwj+iZcnKW6ONWUutJ7eObuBZQpiIb8S7OYspWrKt7rA==} engines: {node: '>=14'} @@ -3784,6 +4487,12 @@ packages: hasBin: true dev: true + /jsesc@2.5.2: + resolution: {integrity: sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==} + engines: {node: '>=4'} + hasBin: true + dev: true + /jsesc@3.0.2: resolution: {integrity: sha512-xKqzzWXDttJuOcawBt4KnKHHIf5oQ/Cxax+0PWFG+DFDgHNAdi+TXECADI+RYiFUMmx8792xsMbbgXj4CwnP4g==} engines: {node: '>=6'} @@ -3858,6 +4567,10 @@ packages: engines: {node: '>=0.10.0'} dev: true + /kolorist@1.8.0: + resolution: {integrity: sha512-Y+60/zizpJ3HRH8DCss+q95yr6145JXZo46OTpFvDZWLfRCE4qChOyk1b26nMaNpfHHgxagk9dXT5OP0Tfe+dQ==} + dev: true + /levn@0.4.1: resolution: {integrity: sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==} engines: {node: '>= 0.8.0'} @@ -3891,6 +4604,11 @@ packages: strip-bom: 3.0.0 dev: true + /local-pkg@0.4.3: + resolution: {integrity: sha512-SFppqq5p42fe2qcZQqqEOiVRXl+WCP1MdT6k7BDEW1j++sp5fIY+/fdRQitvKgB5BrBcmrs5m/L0v2FrU5MY1g==} + engines: {node: '>=14'} + dev: true + /local-pkg@0.5.0: resolution: {integrity: sha512-ok6z3qlYyCDS4ZEU27HaU6x/xZa9Whf8jD4ptH5UZTQYZVYeb9bnZ3ojVhiJNLiXK1Hfc0GNbLXcmZ5plLDDBg==} engines: {node: '>=14'} @@ -3949,6 +4667,12 @@ packages: engines: {node: 14 || >=16.14} dev: true + /lru-cache@5.1.1: + resolution: {integrity: sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==} + dependencies: + yallist: 3.1.1 + dev: true + /lru-cache@6.0.0: resolution: {integrity: sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==} engines: {node: '>=10'} @@ -3962,6 +4686,13 @@ packages: dependencies: '@jridgewell/sourcemap-codec': 1.4.15 + /magic-string@0.30.9: + resolution: {integrity: sha512-S1+hd+dIrC8EZqKyT9DstTH/0Z+f76kmmvZnkfQVmOpDEF9iVgdYif3Q/pIWHmCoo59bQVGW0kVL3e2nl+9+Sw==} + engines: {node: '>=12'} + dependencies: + '@jridgewell/sourcemap-codec': 1.4.15 + dev: true + /mark.js@8.11.1: resolution: {integrity: sha512-1I+1qpDt4idfgLQG+BNWmrqku+7/2bi5nLf4YwF8y8zXvmfiTBY3PV3ZibfrjBueCByROpuBjLLFCajqkgYoLQ==} dev: true @@ -4077,6 +4808,10 @@ packages: resolution: {integrity: sha512-AW4DRS3QbBayY/jJmD8437V1Gombjf8RSOUCMFBuo5iHi58AGEgVCKQ+ezHkZZDpAQS75hcBMpLqjpJTjtUL7w==} dev: true + /mdn-data@2.0.30: + resolution: {integrity: sha512-GaqWWShW4kv/G9IEucWScBx9G1/vsFZZJUO+tD26M8J8z3Kw5RDQjaoZe03YAClgeS/SWPOcb4nkFBTEi5DUEA==} + dev: true + /memorystream@0.3.1: resolution: {integrity: sha512-S3UwM3yj5mtUSEfP41UZmt/0SCoVYUcU1rkXv+BQ5Ig8ndL4sPoJNBUJERafdPb5jjHJGuMgytgKvKIf58XNBw==} engines: {node: '>= 0.10.0'} @@ -4183,6 +4918,11 @@ packages: mime-db: 1.52.0 dev: true + /mimic-fn@2.1.0: + resolution: {integrity: sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==} + engines: {node: '>=6'} + dev: true + /mimic-fn@4.0.0: resolution: {integrity: sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==} engines: {node: '>=12'} @@ -4253,6 +4993,11 @@ packages: ufo: 1.5.3 dev: true + /mrmime@2.0.0: + resolution: {integrity: sha512-eu38+hdgojoyq63s+yTpN4XMBdt5l8HhMhc4VKLO9KM5caLIBvUm4thi7fFaxyTmCKeNnXZ5pAlBwCUnhA09uw==} + engines: {node: '>=10'} + dev: true + /ms@2.1.2: resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==} dev: true @@ -4274,6 +5019,10 @@ packages: resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} dev: true + /node-fetch-native@1.6.4: + resolution: {integrity: sha512-IhOigYzAKHd244OC0JIMIUrjzctirCmPkaIfhDeGcEETWof5zKYUW7e7MYvChGWh/4CJeXEgsRyGzuF334rOOQ==} + dev: true + /node-releases@2.0.14: resolution: {integrity: sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw==} dev: true @@ -4295,6 +5044,11 @@ packages: validate-npm-package-license: 3.0.4 dev: true + /normalize-path@3.0.0: + resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==} + engines: {node: '>=0.10.0'} + dev: true + /npm-normalize-package-bin@3.0.1: resolution: {integrity: sha512-dMxCf+zZ+3zeQZXKxmyuCKlIDPGuv8EF940xbkC4kQVDTtqoh6rJFO+JTKSA6/Rwi0getWmtuy4Itup0AMcaDQ==} engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} @@ -4314,6 +5068,13 @@ packages: shell-quote: 1.8.1 dev: true + /npm-run-path@4.0.1: + resolution: {integrity: sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==} + engines: {node: '>=8'} + dependencies: + path-key: 3.1.1 + dev: true + /npm-run-path@5.3.0: resolution: {integrity: sha512-ppwTtiJZq0O/ai0z7yfudtBpWIoxM8yE6nHi1X47eFR2EWORqfbu6CnPlNsjeN683eT0qG6H/Pyf9fCcvjnnnQ==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} @@ -4350,12 +5111,27 @@ packages: object-keys: 1.1.1 dev: true + /ofetch@1.3.4: + resolution: {integrity: sha512-KLIET85ik3vhEfS+3fDlc/BAZiAp+43QEC/yCo5zkNoY2YaKvNkOaFr/6wCFgFH1kuYQM5pMNi0Tg8koiIemtw==} + dependencies: + destr: 2.0.3 + node-fetch-native: 1.6.4 + ufo: 1.5.3 + dev: true + /once@1.4.0: resolution: {integrity: sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==} dependencies: wrappy: 1.0.2 dev: true + /onetime@5.1.2: + resolution: {integrity: sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==} + engines: {node: '>=6'} + dependencies: + mimic-fn: 2.1.0 + dev: true + /onetime@6.0.0: resolution: {integrity: sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==} engines: {node: '>=12'} @@ -4747,6 +5523,13 @@ packages: type-fest: 0.6.0 dev: true + /readdirp@3.6.0: + resolution: {integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==} + engines: {node: '>=8.10.0'} + dependencies: + picomatch: 2.3.1 + dev: true + /regexp-tree@0.1.27: resolution: {integrity: sha512-iETxpjK6YoRWJG5o6hXLwvjYAoW+FEZn9os0PD/b6AP6xQwsa/Y7lCVgIixBbUPMfhu+i2LtdeAqVTgGlQarfA==} hasBin: true @@ -4944,6 +5727,11 @@ packages: hasBin: true dev: true + /semver@6.3.1: + resolution: {integrity: sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==} + hasBin: true + dev: true + /semver@7.6.0: resolution: {integrity: sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==} engines: {node: '>=10'} @@ -5006,6 +5794,10 @@ packages: object-inspect: 1.13.1 dev: true + /signal-exit@3.0.7: + resolution: {integrity: sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==} + dev: true + /signal-exit@4.1.0: resolution: {integrity: sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==} engines: {node: '>=14'} @@ -5021,6 +5813,15 @@ packages: - supports-color dev: true + /sirv@2.0.4: + resolution: {integrity: sha512-94Bdh3cC2PKrbgSOUqTiGPWVZeSiXfKOVZNJniWoqrWrRkB1CJzBU3NEbiTsPcYy1lDsANA/THzS+9WBiy5nfQ==} + engines: {node: '>= 10'} + dependencies: + '@polka/url': 1.0.0-next.25 + mrmime: 2.0.0 + totalist: 3.0.1 + dev: true + /sisteransi@1.0.5: resolution: {integrity: sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==} dev: true @@ -5157,6 +5958,11 @@ packages: engines: {node: '>=4'} dev: true + /strip-final-newline@2.0.0: + resolution: {integrity: sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==} + engines: {node: '>=6'} + dev: true + /strip-final-newline@3.0.0: resolution: {integrity: sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==} engines: {node: '>=12'} @@ -5302,6 +6108,11 @@ packages: eslint-visitor-keys: 3.4.3 dev: true + /totalist@3.0.1: + resolution: {integrity: sha512-sf4i37nQ2LBx4m3wB74y+ubopq6W/dIzXg0FDGjsYnZHVa1Da8FH853wlL2gtUhg+xJXjfk3kUZS3BRoQeoQBQ==} + engines: {node: '>=6'} + dev: true + /tough-cookie@4.1.3: resolution: {integrity: sha512-aX/y5pVRkfRnfmuX+OdbSdXvPe6ieKX/G2s7e98f4poJHnqH3281gDPm/metm6E/WRamfx7WC4HUqkWHfQHprw==} engines: {node: '>=6'} @@ -5456,6 +6267,15 @@ packages: which-boxed-primitive: 1.0.2 dev: true + /unconfig@0.3.12: + resolution: {integrity: sha512-oDtfWDC0TMYFuwdt7E7CaqYZGqq1wAiC12PRTFe/93IkgNi+wVlF/LCjcD/bgNkGoopb0RsU363Ge3YXy7NGSw==} + dependencies: + '@antfu/utils': 0.7.7 + defu: 6.1.4 + jiti: 1.21.0 + mlly: 1.6.1 + dev: true + /undici-types@5.26.5: resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==} dev: true @@ -5516,6 +6336,84 @@ packages: engines: {node: '>= 10.0.0'} dev: true + /unocss@0.59.2(postcss@8.4.38)(vite@5.1.6): + resolution: {integrity: sha512-9puB1L+VxpCAgeidkd67otmA0pbqNPxBPT/8l6gncF0i2RE0WkKITlMflP0PhLNpOdHUfUWb9Cdj1aVnjRnXFA==} + engines: {node: '>=14'} + peerDependencies: + '@unocss/webpack': 0.59.2 + vite: ^2.9.0 || ^3.0.0-0 || ^4.0.0 || ^5.0.0-0 + peerDependenciesMeta: + '@unocss/webpack': + optional: true + vite: + optional: true + dependencies: + '@unocss/astro': 0.59.2(vite@5.1.6) + '@unocss/cli': 0.59.2 + '@unocss/core': 0.59.2 + '@unocss/extractor-arbitrary-variants': 0.59.2 + '@unocss/postcss': 0.59.2(postcss@8.4.38) + '@unocss/preset-attributify': 0.59.2 + '@unocss/preset-icons': 0.59.2 + '@unocss/preset-mini': 0.59.2 + '@unocss/preset-tagify': 0.59.2 + '@unocss/preset-typography': 0.59.2 + '@unocss/preset-uno': 0.59.2 + '@unocss/preset-web-fonts': 0.59.2 + '@unocss/preset-wind': 0.59.2 + '@unocss/reset': 0.59.2 + '@unocss/transformer-attributify-jsx': 0.59.2 + '@unocss/transformer-attributify-jsx-babel': 0.59.2 + '@unocss/transformer-compile-class': 0.59.2 + '@unocss/transformer-directives': 0.59.2 + '@unocss/transformer-variant-group': 0.59.2 + '@unocss/vite': 0.59.2(vite@5.1.6) + vite: 5.1.6(@types/node@20.11.28) + transitivePeerDependencies: + - postcss + - rollup + - supports-color + dev: true + + /unplugin-vue-components@0.26.0(vue@3.4.21): + resolution: {integrity: sha512-s7IdPDlnOvPamjunVxw8kNgKNK8A5KM1YpK5j/p97jEKTjlPNrA0nZBiSfAKKlK1gWZuyWXlKL5dk3EDw874LQ==} + engines: {node: '>=14'} + peerDependencies: + '@babel/parser': ^7.15.8 + '@nuxt/kit': ^3.2.2 + vue: 2 || 3 + peerDependenciesMeta: + '@babel/parser': + optional: true + '@nuxt/kit': + optional: true + dependencies: + '@antfu/utils': 0.7.7 + '@rollup/pluginutils': 5.1.0 + chokidar: 3.6.0 + debug: 4.3.4 + fast-glob: 3.3.2 + local-pkg: 0.4.3 + magic-string: 0.30.8 + minimatch: 9.0.4 + resolve: 1.22.8 + unplugin: 1.10.1 + vue: 3.4.21(typescript@5.4.2) + transitivePeerDependencies: + - rollup + - supports-color + dev: true + + /unplugin@1.10.1: + resolution: {integrity: sha512-d6Mhq8RJeGA8UfKCu54Um4lFA0eSaRa3XxdAJg8tIdxbu1ubW0hBCZUL7yI2uGyYCRndvbK8FLHzqy2XKfeMsg==} + engines: {node: '>=14.0.0'} + dependencies: + acorn: 8.11.3 + chokidar: 3.6.0 + webpack-sources: 3.2.3 + webpack-virtual-modules: 0.6.1 + dev: true + /update-browserslist-db@1.0.13(browserslist@4.23.0): resolution: {integrity: sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg==} hasBin: true @@ -5639,7 +6537,7 @@ packages: fsevents: 2.3.3 dev: true - /vitepress@1.0.2(@algolia/client-search@4.23.2)(@types/node@20.11.28)(search-insights@2.13.0)(typescript@5.4.2): + /vitepress@1.0.2(@algolia/client-search@4.23.2)(@types/node@20.11.28)(postcss@8.4.38)(search-insights@2.13.0)(typescript@5.4.2): resolution: {integrity: sha512-bEj9yTEdWyewJFOhEREZF+mXuAgOq27etuJZT6DZSp+J3XpQstXMJc5piSVwhZBtuj8OfA0iXy+jdP1c71KMYQ==} hasBin: true peerDependencies: @@ -5663,6 +6561,7 @@ packages: focus-trap: 7.5.4 mark.js: 8.11.1 minisearch: 6.3.0 + postcss: 8.4.38 shiki: 1.2.3 vite: 5.2.7(@types/node@20.11.28) vue: 3.4.21(typescript@5.4.2) @@ -5776,6 +6675,15 @@ packages: engines: {node: '>=12'} dev: true + /webpack-sources@3.2.3: + resolution: {integrity: sha512-/DyMEOrDgLKKIG0fmvtz+4dUX/3Ghozwgm6iPp8KRhvn+eQf9+Q7GWxVNMk3+uCPWfdXYC4ExGBckIXdFEfH1w==} + engines: {node: '>=10.13.0'} + dev: true + + /webpack-virtual-modules@0.6.1: + resolution: {integrity: sha512-poXpCylU7ExuvZK8z+On3kX+S8o/2dQ/SVYueKA0D4WEMXROXgY8Ez50/bQEUmvoSMMrWcrJqCHuhAbsiwg7Dg==} + dev: true + /whatwg-encoding@3.1.1: resolution: {integrity: sha512-6qN4hJdMwfYBtE3YBTTHhoeuUrDBPZmbQaxWAqSALV/MeEnR5z1xd8UKud2RAkFoPkmB+hli1TZSnyi84xz1vQ==} engines: {node: '>=18'} @@ -5886,6 +6794,10 @@ packages: engines: {node: '>=10'} dev: true + /yallist@3.1.1: + resolution: {integrity: sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==} + dev: true + /yallist@4.0.0: resolution: {integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==} dev: true diff --git a/unocss.config.ts b/unocss.config.ts new file mode 100644 index 0000000..fee9368 --- /dev/null +++ b/unocss.config.ts @@ -0,0 +1,36 @@ +import { + defineConfig, + presetAttributify, + presetIcons, + presetUno, + transformerDirectives, + transformerVariantGroup, +} from 'unocss'; + +export default defineConfig({ + shortcuts: { + 'border-main': 'border-$vp-c-divider', + 'bg-main': 'bg-gray-400', + 'bg-base': 'bg-white dark:bg-hex-1a1a1a', + }, + presets: [ + presetUno(), + presetAttributify(), + presetIcons({ + scale: 1.2, + warn: true, + }), + ], + theme: { + colors: { + primary: '#3eaf7c', + }, + fontFamily: { + mono: 'var(--vp-font-family-mono)', + }, + }, + transformers: [ + transformerDirectives(), + transformerVariantGroup(), + ], +}); From 9170905c4193f05c844b22a723596137d73aa715 Mon Sep 17 00:00:00 2001 From: pei-pay Date: Sat, 13 Apr 2024 20:19:51 +0900 Subject: [PATCH 07/20] chapter: demo container --- .../theme/components/DemoContainer.vue | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 packages/.vitepress/theme/components/DemoContainer.vue diff --git a/packages/.vitepress/theme/components/DemoContainer.vue b/packages/.vitepress/theme/components/DemoContainer.vue new file mode 100644 index 0000000..3984f60 --- /dev/null +++ b/packages/.vitepress/theme/components/DemoContainer.vue @@ -0,0 +1,18 @@ + + + From f9302f93bb73897a41e71b7fe6f49b4f5a2ae45f Mon Sep 17 00:00:00 2001 From: pei-pay Date: Sat, 13 Apr 2024 20:21:26 +0900 Subject: [PATCH 08/20] chapter: markdown transform --- .gitignore | 3 ++- packages/.vitepress/config.ts | 28 ++++++++++++++++------------ packages/.vitepress/vite.config.ts | 24 +++++++++++++++++++----- vite.config.ts | 14 -------------- 4 files changed, 37 insertions(+), 32 deletions(-) delete mode 100644 vite.config.ts diff --git a/.gitignore b/.gitignore index d04d400..6382317 100644 --- a/.gitignore +++ b/.gitignore @@ -29,6 +29,7 @@ coverage *.tsbuildinfo - +components.d.ts +index.json packages/.vitepress/cache packages/.vitepress/dist \ No newline at end of file diff --git a/packages/.vitepress/config.ts b/packages/.vitepress/config.ts index b793e72..ec9f0fe 100644 --- a/packages/.vitepress/config.ts +++ b/packages/.vitepress/config.ts @@ -1,25 +1,27 @@ -import { defineConfig } from 'vitepress' +import { defineConfig } from 'vitepress'; -import { categoryNames, coreCategoryNames, metadata } from '../metadata/metadata' +import { categoryNames, coreCategoryNames, metadata } from '../metadata/metadata'; + +import viteConfig from './vite.config'; const Guide = [ { text: 'はじめに', link: '/guide/' }, { text: 'VueUseとは', link: '/guide/what-is-vueuse' }, { text: '環境構築', link: '/guide/setup' }, -] +]; const CoreCategories = coreCategoryNames.map(c => ({ text: c, activeMatch: '___', // never active link: `/functions#category=${c}`, -})) +})); const DefaultSideBar = [ { text: 'Guide', items: Guide }, { text: 'Core Functions', items: CoreCategories }, -] +]; -const FunctionsSideBar = getFunctionsSideBar() +const FunctionsSideBar = getFunctionsSideBar(); // https://vitepress.dev/reference/site-config export default defineConfig({ @@ -60,16 +62,18 @@ export default defineConfig({ socialLinks: [{ icon: 'github', link: 'https://github.com/pei-pay/VueYous' }], }, -}) + // FIXME: any + vite: viteConfig as any, +}); function getFunctionsSideBar() { - const links: any = [] + const links: any = []; for (const name of categoryNames) { if (name.startsWith('_')) - continue + continue; - const functions = metadata.functions.filter(i => i.category === name && !i.internal) + const functions = metadata.functions.filter(i => i.category === name && !i.internal); links.push({ text: name, @@ -80,8 +84,8 @@ function getFunctionsSideBar() { link: name.startsWith('@') ? (functions[0].external || `/${functions[0].package}/README`) : undefined, - }) + }); } - return links + return links; } diff --git a/packages/.vitepress/vite.config.ts b/packages/.vitepress/vite.config.ts index 6548ca6..3f4e150 100644 --- a/packages/.vitepress/vite.config.ts +++ b/packages/.vitepress/vite.config.ts @@ -1,6 +1,9 @@ -import { resolve } from 'node:path' -import { defineConfig } from 'vite' -import { MarkdownTransform } from './plugins/markdownTransform' +import { resolve } from 'node:path'; +import { defineConfig } from 'vite'; +import Components from 'unplugin-vue-components/vite'; +import UnoCSS from 'unocss/vite'; + +import { MarkdownTransform } from './plugins/markdownTransform'; export default defineConfig({ server: { @@ -10,7 +13,18 @@ export default defineConfig({ ], }, }, - plugins: [MarkdownTransform()], + plugins: [ + // custom + MarkdownTransform(), + // plugins + Components({ + dirs: resolve(__dirname, 'theme/components'), + include: [/\.vue$/, /\.vue\?vue/, /\.md$/], + dts: resolve(__dirname, 'components.d.ts'), + transformer: 'vue3', + }), + UnoCSS(), + ], resolve: { alias: { '@vueyous/shared': resolve(__dirname, '../shared/index.ts'), @@ -19,4 +33,4 @@ export default defineConfig({ }, dedupe: ['vue'], }, -}) +}); diff --git a/vite.config.ts b/vite.config.ts deleted file mode 100644 index 51ef967..0000000 --- a/vite.config.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { URL, fileURLToPath } from 'node:url' - -import { defineConfig } from 'vite' -import vue from '@vitejs/plugin-vue' - -// https://vitejs.dev/config/ -export default defineConfig({ - plugins: [vue()], - resolve: { - alias: { - '@': fileURLToPath(new URL('./src', import.meta.url)), - }, - }, -}) From 7acb3d3562000ef0e59632ea9a409fc14278e828 Mon Sep 17 00:00:00 2001 From: pei-pay Date: Sat, 13 Apr 2024 20:23:44 +0900 Subject: [PATCH 09/20] tweak: delete ignore file --- packages/metadata/index.json | 62 ------------------------------------ 1 file changed, 62 deletions(-) delete mode 100644 packages/metadata/index.json diff --git a/packages/metadata/index.json b/packages/metadata/index.json deleted file mode 100644 index a915216..0000000 --- a/packages/metadata/index.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "packages": { - "shared": { - "name": "shared", - "display": "Shared utilities", - "dir": "packages/shared" - }, - "core": { - "name": "core", - "display": "VueYous", - "description": "Collection of essential Vue Composition Utilities", - "dir": "packages/core" - } - }, - "categories": [ - "State", - "Watch" - ], - "functions": [ - { - "name": "useCloned", - "package": "core", - "lastUpdated": 1712991826000, - "internal": true - }, - { - "name": "useManualRefHistory", - "package": "core", - "lastUpdated": 1712991826000, - "category": "State", - "description": "", - "related": [ - "useRefHistory" - ] - }, - { - "name": "useRefHistory", - "package": "core", - "lastUpdated": 1712991826000, - "internal": true, - "related": [ - "useManualRefHistory" - ] - }, - { - "name": "utils", - "package": "shared", - "lastUpdated": 1712991826000, - "internal": true - }, - { - "name": "watchIgnorable", - "package": "shared", - "lastUpdated": 1712991826000, - "category": "Watch", - "description": "", - "alias": [ - "ignorableWatch" - ] - } - ] -} From 39e4e78c09d043dff77b44bfcab4c55ac9d1c8bd Mon Sep 17 00:00:00 2001 From: pei-pay Date: Sat, 13 Apr 2024 21:09:46 +0900 Subject: [PATCH 10/20] feat: funcitonInfo --- .../theme/components/FunctionInfo.vue | 61 +++++++++++++++++++ packages/core/useManualRefHistory/index.md | 4 ++ 2 files changed, 65 insertions(+) create mode 100644 packages/.vitepress/theme/components/FunctionInfo.vue diff --git a/packages/.vitepress/theme/components/FunctionInfo.vue b/packages/.vitepress/theme/components/FunctionInfo.vue new file mode 100644 index 0000000..4af38e6 --- /dev/null +++ b/packages/.vitepress/theme/components/FunctionInfo.vue @@ -0,0 +1,61 @@ + + + diff --git a/packages/core/useManualRefHistory/index.md b/packages/core/useManualRefHistory/index.md index 9a136d0..af8dc83 100644 --- a/packages/core/useManualRefHistory/index.md +++ b/packages/core/useManualRefHistory/index.md @@ -4,3 +4,7 @@ related: useRefHistory --- # useManualRefHistory + +Manually track the change history of a ref when the using calls `commit()`, also provides undo and redo functionality + +## How to make \ No newline at end of file From d20b22673ade235120bbb1ca0c9a3b47e50ed60f Mon Sep 17 00:00:00 2001 From: pei-pay Date: Sat, 13 Apr 2024 21:13:08 +0900 Subject: [PATCH 11/20] tweak: lint fix --- meta/packages.ts | 4 +- packages/.vitepress/config.ts | 26 ++++---- .../.vitepress/plugins/markdownTransform.ts | 64 +++++++++---------- .../theme/components/DemoContainer.vue | 8 +-- .../theme/components/FunctionInfo.vue | 18 +++--- packages/.vitepress/theme/index.ts | 10 +-- packages/.vitepress/vite.config.ts | 12 ++-- packages/core/useManualRefHistory/index.md | 2 +- packages/shared/watchIgnorable/index.md | 2 +- unocss.config.ts | 4 +- 10 files changed, 75 insertions(+), 75 deletions(-) diff --git a/meta/packages.ts b/meta/packages.ts index 64d3fb1..8742f1f 100644 --- a/meta/packages.ts +++ b/meta/packages.ts @@ -1,4 +1,4 @@ -import type { PackageManifest } from '@vueyous/metadata'; +import type { PackageManifest } from '@vueyous/metadata' export const packages: PackageManifest[] = [ { @@ -154,4 +154,4 @@ export const packages: PackageManifest[] = [ // ], // iife: false, // }, -]; +] diff --git a/packages/.vitepress/config.ts b/packages/.vitepress/config.ts index ec9f0fe..bc55a26 100644 --- a/packages/.vitepress/config.ts +++ b/packages/.vitepress/config.ts @@ -1,27 +1,27 @@ -import { defineConfig } from 'vitepress'; +import { defineConfig } from 'vitepress' -import { categoryNames, coreCategoryNames, metadata } from '../metadata/metadata'; +import { categoryNames, coreCategoryNames, metadata } from '../metadata/metadata' -import viteConfig from './vite.config'; +import viteConfig from './vite.config' const Guide = [ { text: 'はじめに', link: '/guide/' }, { text: 'VueUseとは', link: '/guide/what-is-vueuse' }, { text: '環境構築', link: '/guide/setup' }, -]; +] const CoreCategories = coreCategoryNames.map(c => ({ text: c, activeMatch: '___', // never active link: `/functions#category=${c}`, -})); +})) const DefaultSideBar = [ { text: 'Guide', items: Guide }, { text: 'Core Functions', items: CoreCategories }, -]; +] -const FunctionsSideBar = getFunctionsSideBar(); +const FunctionsSideBar = getFunctionsSideBar() // https://vitepress.dev/reference/site-config export default defineConfig({ @@ -64,16 +64,16 @@ export default defineConfig({ }, // FIXME: any vite: viteConfig as any, -}); +}) function getFunctionsSideBar() { - const links: any = []; + const links: any = [] for (const name of categoryNames) { if (name.startsWith('_')) - continue; + continue - const functions = metadata.functions.filter(i => i.category === name && !i.internal); + const functions = metadata.functions.filter(i => i.category === name && !i.internal) links.push({ text: name, @@ -84,8 +84,8 @@ function getFunctionsSideBar() { link: name.startsWith('@') ? (functions[0].external || `/${functions[0].package}/README`) : undefined, - }); + }) } - return links; + return links } diff --git a/packages/.vitepress/plugins/markdownTransform.ts b/packages/.vitepress/plugins/markdownTransform.ts index 6bb9c86..01a46e3 100644 --- a/packages/.vitepress/plugins/markdownTransform.ts +++ b/packages/.vitepress/plugins/markdownTransform.ts @@ -1,9 +1,9 @@ -import { join, resolve } from 'node:path'; -import type { Plugin } from 'vite'; -import fs from 'fs-extra'; +import { join, resolve } from 'node:path' +import type { Plugin } from 'vite' +import fs from 'fs-extra' // import ts from 'typescript'; -import { packages } from '../../../meta/packages'; -import { functionNames, getFunction } from '../../../packages/metadata/metadata'; +import { packages } from '../../../meta/packages' +import { functionNames, getFunction } from '../../../packages/metadata/metadata' // import { getTypeDefinition, replacer } from '../../../scripts/utils'; export function MarkdownTransform(): Plugin { @@ -18,31 +18,31 @@ export function MarkdownTransform(): Plugin { enforce: 'pre', async transform(code, id) { if (!id.match(/\.md\b/)) - return null; + return null // linkify function names code = code.replace( new RegExp(`\`({${functionNames.join('|')}})\`(.)`, 'g'), (_, name, ending) => { if (ending === ']') // already a link - return _; - const fn = getFunction(name)!; - return `[\`${fn.name}\`](${fn.docs}) `; + return _ + const fn = getFunction(name)! + return `[\`${fn.name}\`](${fn.docs}) ` }, - ); + ) // TODO: set link after deployed // convert links to relative // code = code.replace(/https?:\/\/vueuse\.org\//g, '/'); - const [pkg, _name, i] = id.split('/').slice(-3); + const [pkg, _name, i] = id.split('/').slice(-3) - const name = functionNames.find(n => n.toLowerCase() === _name.toLowerCase()) || _name; + const name = functionNames.find(n => n.toLowerCase() === _name.toLowerCase()) || _name if (functionNames.includes(name) && i === 'index.md') { - const frontmatterEnds = code.indexOf('---\n\n'); - const firstHeader = code.search(/\n#{2,6}\s.+/); - const sliceIndex = firstHeader < 0 ? frontmatterEnds < 0 ? 0 : frontmatterEnds + 4 : firstHeader; + const frontmatterEnds = code.indexOf('---\n\n') + const firstHeader = code.search(/\n#{2,6}\s.+/) + const sliceIndex = firstHeader < 0 ? frontmatterEnds < 0 ? 0 : frontmatterEnds + 4 : firstHeader // Insert JS/TS code blocks // code = await replaceAsync(code, /\n```ts( [^\n]+)?\n(.+?)\n```\n/gs, async (_, meta = '', snippet = '') => { @@ -73,32 +73,32 @@ export function MarkdownTransform(): Plugin { // \n`; // }); - const { header } = await getFunctionMarkdown(pkg, name); + const { header } = await getFunctionMarkdown(pkg, name) // if (hasTypes) // code = replacer(code, footer, 'FOOTER', 'tail'); if (header) - code = code.slice(0, sliceIndex) + header + code.slice(sliceIndex); + code = code.slice(0, sliceIndex) + header + code.slice(sliceIndex) code = code - .replace(/(# \w+?)\n/, `$1\n\n\n`); + .replace(/(# \w+?)\n/, `$1\n\n\n`) // .replace(/## (Components?(?:\sUsage)?)/i, '## $1\n\n\n') // .replace(/## (Directives?(?:\sUsage)?)/i, '## $1\n\n\n'); } - return code; + return code }, - }; + } } -const DIR_SRC = resolve(__dirname, '../..'); -const GITHUB_BLOB_URL = 'https://github.com/pei-pay/VueYous/blob/main/packages'; +const DIR_SRC = resolve(__dirname, '../..') +const GITHUB_BLOB_URL = 'https://github.com/pei-pay/VueYous/blob/main/packages' export async function getFunctionMarkdown(pkg: string, name: string) { - const URL = `${GITHUB_BLOB_URL}/${pkg}/${name}`; + const URL = `${GITHUB_BLOB_URL}/${pkg}/${name}` - const dirname = join(DIR_SRC, pkg, name); - const demoPath = ['demo.vue'].find(i => fs.existsSync(join(dirname, i))); + const dirname = join(DIR_SRC, pkg, name) + const demoPath = ['demo.vue'].find(i => fs.existsSync(join(dirname, i))) // const types = await getTypeDefinition(pkg, name); // if (!types) @@ -128,9 +128,9 @@ export async function getFunctionMarkdown(pkg: string, name: string) { ['Docs', `${URL}/index.md`], ]) .filter(i => i) - .map(i => `[${i![0]}](${i![1]})`).join(' • '); + .map(i => `[${i![0]}](${i![1]})`).join(' • ') - const sourceSection = `## Source\n\n${links}\n`; + const sourceSection = `## Source\n\n${links}\n` // const ContributorsSection = ` // ## Contributors @@ -155,21 +155,21 @@ import Demo from \'./${demoPath}\' ` - : ''; + : '' const packageNote = packages.find(p => p.name === pkg)!.addon ? `Available in the @vueyous/${pkg} add-on.\n` - : ''; + : '' // const footer = `${typingSection}\n\n${sourceSection}\n${ContributorsSection}\n${changelogSection}\n`; - const footer = `${sourceSection}`; + const footer = `${sourceSection}` - const header = demoSection + packageNote; + const header = demoSection + packageNote return { footer, header, - }; + } } // function replaceAsync(str: string, match: RegExp, replacer: (substring: string, ...args: any[]) => Promise) { diff --git a/packages/.vitepress/theme/components/DemoContainer.vue b/packages/.vitepress/theme/components/DemoContainer.vue index 3984f60..37bec84 100644 --- a/packages/.vitepress/theme/components/DemoContainer.vue +++ b/packages/.vitepress/theme/components/DemoContainer.vue @@ -1,11 +1,11 @@