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 @@
diff --git a/packages/.vitepress/theme/components/FunctionInfo.vue b/packages/.vitepress/theme/components/FunctionInfo.vue
index 4af38e6..300c23a 100644
--- a/packages/.vitepress/theme/components/FunctionInfo.vue
+++ b/packages/.vitepress/theme/components/FunctionInfo.vue
@@ -1,19 +1,19 @@
diff --git a/packages/.vitepress/theme/index.ts b/packages/.vitepress/theme/index.ts
index ac8a84a..0422867 100644
--- a/packages/.vitepress/theme/index.ts
+++ b/packages/.vitepress/theme/index.ts
@@ -1,7 +1,7 @@
-import DefaultTheme from 'vitepress/theme';
+import DefaultTheme from 'vitepress/theme'
-import './styles/main.css';
-import './styles/demo.css';
-import 'uno.css';
+import './styles/main.css'
+import './styles/demo.css'
+import 'uno.css'
-export default DefaultTheme;
+export default DefaultTheme
diff --git a/packages/.vitepress/vite.config.ts b/packages/.vitepress/vite.config.ts
index 3f4e150..1c15edb 100644
--- a/packages/.vitepress/vite.config.ts
+++ b/packages/.vitepress/vite.config.ts
@@ -1,9 +1,9 @@
-import { resolve } from 'node:path';
-import { defineConfig } from 'vite';
-import Components from 'unplugin-vue-components/vite';
-import UnoCSS from 'unocss/vite';
+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';
+import { MarkdownTransform } from './plugins/markdownTransform'
export default defineConfig({
server: {
@@ -33,4 +33,4 @@ export default defineConfig({
},
dedupe: ['vue'],
},
-});
+})
diff --git a/packages/core/useManualRefHistory/index.md b/packages/core/useManualRefHistory/index.md
index af8dc83..a0b94a9 100644
--- a/packages/core/useManualRefHistory/index.md
+++ b/packages/core/useManualRefHistory/index.md
@@ -7,4 +7,4 @@ related: useRefHistory
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
+## How to make
diff --git a/packages/shared/watchIgnorable/index.md b/packages/shared/watchIgnorable/index.md
index 542cf1e..c7abce7 100644
--- a/packages/shared/watchIgnorable/index.md
+++ b/packages/shared/watchIgnorable/index.md
@@ -3,4 +3,4 @@ category: Watch
alias: ignorableWatch
---
-# watchIgnorable
\ No newline at end of file
+# watchIgnorable
diff --git a/unocss.config.ts b/unocss.config.ts
index fee9368..254257b 100644
--- a/unocss.config.ts
+++ b/unocss.config.ts
@@ -5,7 +5,7 @@ import {
presetUno,
transformerDirectives,
transformerVariantGroup,
-} from 'unocss';
+} from 'unocss'
export default defineConfig({
shortcuts: {
@@ -33,4 +33,4 @@ export default defineConfig({
transformerDirectives(),
transformerVariantGroup(),
],
-});
+})