WIP: Contributors

pull/4356/head
Sidharth Vinod 2023-02-24 23:03:51 +05:30
parent d688f1fe94
commit 00a14ee811
No known key found for this signature in database
GPG Key ID: FB5CCD378D3907CD
15 changed files with 3345 additions and 323 deletions

View File

@ -5,11 +5,13 @@
"acyclicer",
"adamiecki",
"alois",
"aloisklink",
"antiscript",
"appli",
"applitools",
"asciidoctor",
"ashish",
"ashishjain",
"astah",
"bbox",
"bilkent",
@ -48,6 +50,7 @@
"greywolf",
"inkdrop",
"jaoude",
"jgreywolf",
"jison",
"kaufmann",
"khroma",
@ -55,11 +58,13 @@
"klink",
"knsv",
"knut",
"knutsveidqvist",
"laganeckas",
"lintstagedrc",
"logmsg",
"lucida",
"matthieu",
"matthieumorel",
"mdast",
"mdbook",
"mermerd",
@ -68,9 +73,11 @@
"mindmaps",
"mitigations",
"mkdocs",
"mmorel",
"mult",
"ohmyfetch",
"orlandoni",
"pbrolin",
"phpbb",
"plantuml",
"playfair",
@ -100,8 +107,10 @@
"treemap",
"ts-nocheck",
"tuleap",
"tylerlong",
"ugge",
"unist",
"Unocss",
"verdana",
"viewports",
"vinod",

View File

@ -1,3 +1,5 @@
src/vitepress
src/docs/config/setup
README.*
README.*
src/docs/public/user-avatars/
src/docs/.vitepress/cache

View File

@ -27,8 +27,8 @@
"docs:build": "rimraf ../../docs && pnpm docs:spellcheck && pnpm docs:code && ts-node-esm src/docs.mts",
"docs:verify": "pnpm docs:spellcheck && pnpm docs:code && ts-node-esm src/docs.mts --verify",
"docs:pre:vitepress": "rimraf src/vitepress && pnpm docs:code && ts-node-esm src/docs.mts --vitepress",
"docs:build:vitepress": "pnpm docs:pre:vitepress && vitepress build src/vitepress && cpy --flat src/docs/landing/ ./src/vitepress/.vitepress/dist/landing",
"docs:dev": "pnpm docs:pre:vitepress && concurrently \"vitepress dev src/vitepress\" \"ts-node-esm src/docs.mts --watch --vitepress\"",
"docs:build:vitepress": "pnpm docs:pre:vitepress && (cd src/vitepress && pnpm --filter ./ install && pnpm run build) && cpy --flat src/docs/landing/ ./src/vitepress/.vitepress/dist/landing",
"docs:dev": "pnpm docs:pre:vitepress && concurrently \"pnpm --filter ./ src/vitepress dev\" \"ts-node-esm src/docs.mts --watch --vitepress\"",
"docs:serve": "pnpm docs:build:vitepress && vitepress serve src/vitepress",
"docs:spellcheck": "cspell --config ../../cSpell.json \"src/docs/**/*.md\"",
"release": "pnpm build",

View File

@ -362,7 +362,7 @@ const transformHtml = (filename: string) => {
};
const getGlobs = (globs: string[]): string[] => {
globs.push('!**/dist', '!**/redirect.spec.ts', '!**/landing');
globs.push('!**/dist', '!**/redirect.spec.ts', '!**/landing', '!**/node_modules');
if (!vitepress) {
globs.push('!**/.vitepress', '!**/vite.config.ts', '!src/docs/index.md');
}

View File

@ -0,0 +1,13 @@
// generated by unplugin-vue-components
// We suggest you to commit this file into source control
// Read more: https://github.com/vuejs/core/pull/3399
import '@vue/runtime-core'
export {}
declare module '@vue/runtime-core' {
export interface GlobalComponents {
Contributors: typeof import('./components/Contributors.vue')['default']
HomePage: typeof import('./components/HomePage.vue')['default']
}
}

View File

@ -0,0 +1,26 @@
<script setup lang="ts">
import { VPTeamMembers } from 'vitepress/theme';
import { teamMembers } from '../contributors';
</script>
<template>
<div class="content">
<div class="content-container">
<main class="main">
<div class="vp-doc" flex flex-col items-center mt-10>
<h2 id="meet-the-team" op50 font-normal p="t-10 b-2">Meet The Team</h2>
<div w-full p-10>
<VPTeamMembers size="small" :members="teamMembers" />
</div>
<h2 id="the-team" op50 font-normal pt-5 pb-2>Contributors</h2>
<p text-lg max-w-200 text-center leading-7>
<Contributors />
<br />
<a href="https://chat.vitest.dev" rel="noopener noreferrer">Join the community</a> and
get involved!
</p>
</div>
</main>
</div>
</div>
</template>

View File

@ -1,4 +1,4 @@
import contributorNames from './contributor-names.json';
import contributorNamesJson from './contributor-names.json';
export interface Contributor {
name: string;
@ -6,7 +6,7 @@ export interface Contributor {
}
export interface SocialEntry {
icon: string;
icon: string | { svg: string };
link: string;
}
@ -15,97 +15,143 @@ export interface CoreTeam {
name: string;
// required to download avatars from GitHub
github: string;
twitter: string;
twitter?: string;
mastodon?: string
sponsor?: string;
website?: string;
linkedIn?: string;
title?: string;
org?: string;
desc?: string;
links?: SocialEntry[];
}
const contributorNames: string[] = contributorNamesJson;
const contributorsAvatars: Record<string, string> = {};
const getAvatarUrl = (name: string) =>
import.meta.hot ? `https://github.com/${name}.png` : `/user-avatars/${name}.png`;
export const contributors = (contributorNames as string[]).reduce((acc, name) => {
contributorsAvatars[name] = getAvatarUrl(name);
acc.push({ name, avatar: contributorsAvatars[name] });
return acc;
}, [] as Contributor[]);
contributorsAvatars[name] = getAvatarUrl(name)
acc.push({ name, avatar: contributorsAvatars[name] })
return acc
}, [] as Contributor[])
// const createLinks = (tm: CoreTeam): CoreTeam => {
// tm.links = [
// { icon: 'github', link: `https://github.com/${tm.github}` },
// { icon: 'twitter', link: `https://twitter.com/${tm.twitter}` },
// ];
// return tm;
// };
const websiteSVG = {
svg: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-globe"><circle cx="12" cy="12" r="10"></circle><line x1="2" y1="12" x2="22" y2="12"></line><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"></path></svg>'
}
// const plainTeamMembers: CoreTeam[] = [
// {
// avatar: contributorsAvatars.antfu,
// name: 'Anthony Fu',
// github: 'antfu',
// twitter: 'antfu7',
// sponsor: 'https://github.com/sponsors/antfu',
// title: 'A fanatical open sourceror, working',
// org: 'NuxtLabs',
// desc: 'Core team member of Vite & Vue',
// },
// {
// avatar: contributorsAvatars['sheremet-va'],
// name: 'Vladimir',
// github: 'sheremet-va',
// twitter: 'sheremet_va',
// sponsor: 'https://github.com/sponsors/sheremet-va',
// title: 'An open source fullstack developer',
// desc: 'Core team member of Vitest',
// },
// {
// avatar: contributorsAvatars['patak-dev'],
// name: 'Patak',
// github: 'patak-dev',
// twitter: 'patak_dev',
// sponsor: 'https://github.com/sponsors/patak-dev',
// title: 'A collaborative being, working',
// org: 'StackBlitz',
// desc: 'Core team member of Vite & Vue',
// },
// {
// avatar: contributorsAvatars.Aslemammad,
// name: 'Mohammad Bagher',
// github: 'Aslemammad',
// twitter: 'asleMammadam',
// title: 'An open source developer',
// desc: 'Team member of Poimandres & Vike',
// },
// {
// avatar: contributorsAvatars.Demivan,
// name: 'Ivan Demchuk',
// github: 'Demivan',
// twitter: 'IvanDemchuk',
// title: 'A tech lead, fullstack developer',
// desc: 'Author of fluent-vue',
// },
// {
// avatar: contributorsAvatars.userquin,
// name: 'Joaquín Sánchez',
// github: 'userquin',
// twitter: 'userquin',
// title: 'A fullstack and android developer',
// desc: "Vite's fanatical follower",
// },
// {
// avatar: contributorsAvatars.zxch3n,
// name: 'Zixuan Chen',
// github: 'zxch3n',
// twitter: 'zxch3n',
// title: 'A fullstack developer',
// desc: 'Creating tools for collaboration',
// },
// ];
const createLinks = (tm: CoreTeam): CoreTeam => {
tm.links = [{ icon: 'github', link: `https://github.com/${tm.github}` }]
if (tm.mastodon) {
tm.links.push({ icon: 'mastodon', link: tm.mastodon })
}
if (tm.twitter) {
tm.links.push({ icon: 'twitter', link: `https://twitter.com/${tm.twitter}` })
}
if (tm.website) {
tm.links.push({ icon: websiteSVG, link: tm.website })
}
if (tm.linkedIn) {
tm.links.push({ icon: 'linkedin', link: `https://www.linkedin.com/in/${tm.linkedIn}` })
}
return tm
}
// const teamMembers = plainTeamMembers.map((tm) => createLinks(tm));
const plainTeamMembers: CoreTeam[] = [
{
github: 'knsv',
avatar: contributorsAvatars.knsv,
name: 'Knut Sveidqvist',
title: 'Creator',
twitter: 'knutsveidqvist',
sponsor: 'https://github.com/sponsors/knsv',
},
{
github: 'NeilCuzon',
avatar: contributorsAvatars.NeilCuzon,
name: 'Neil Cuzon',
title: 'Developer'
},
{
github: 'tylerlong',
avatar: contributorsAvatars.tylerlong,
name: 'Tyler Liu',
title: 'Developer'
},
{
github: 'sidharthv96',
avatar: contributorsAvatars.sidharthv96,
name: 'Sidharth Vinod',
title: 'Developer',
twitter: 'sidv42',
mastodon: 'https://techhub.social/@sidv',
sponsor: 'https://github.com/sponsors/sidharthv96',
linkedIn: 'sidharth-vinod',
website: 'https://sidharth.dev'
},
{
github: 'ashishjain0512',
avatar: contributorsAvatars.ashishjain0512,
name: 'Ashish Jain',
title: 'Developer'
},
{
github: 'mmorel-35',
avatar: contributorsAvatars['mmorel-35'],
name: 'Matthieu Morel',
title: 'Developer',
linkedIn: 'matthieumorel35'
},
{
github: 'aloisklink',
avatar: contributorsAvatars.aloisklink,
name: 'Alois Klink',
title: 'Developer',
linkedIn: 'aloisklink',
website: 'https://aloisklink.com'
},
{
github: 'pbrolin47',
avatar: contributorsAvatars.pbrolin47,
name: 'Per Brolin',
title: 'Developer'
},
{
github: 'Yash-Singh1',
avatar: contributorsAvatars['Yash-Singh1'],
name: 'Yash Singh',
title: 'Developer'
},
{
github: 'GDFaber',
avatar: contributorsAvatars.GDFaber,
name: 'Marc Faber',
title: 'Developer',
linkedIn: 'marc-faber'
},
{
github: 'MindaugasLaganeckas',
avatar: contributorsAvatars.MindaugasLaganeckas,
name: 'Mindaugas Laganeckas',
title: 'Developer'
},
{
github: 'jgreywolf',
avatar: contributorsAvatars.jgreywolf,
name: 'Justin Greywolf',
title: 'Developer'
},
{
github: 'IOrlandoni',
avatar: contributorsAvatars.IOrlandoni,
name: 'Nacho Orlandoni',
title: 'Developer'
},
]
// export { teamMembers };
const teamMembers = plainTeamMembers.map(tm => createLinks(tm))
teamMembers.sort((a, b) => contributorNames.indexOf(a.github) - contributorNames.indexOf(b.github))
export { teamMembers }

View File

@ -0,0 +1,40 @@
import { join, resolve } from 'pathe'
import fs from 'fs-extra'
import { $fetch } from 'ohmyfetch'
const docsDir = resolve(__dirname, '../..')
const pathContributors = resolve(docsDir, '.vitepress/contributor-names.json')
const dirAvatars = resolve(docsDir, 'public/user-avatars/')
const dirSponsors = resolve(docsDir, 'public/sponsors/')
let contributors: string[] = []
async function download(url: string, fileName: string) {
if (fs.existsSync(fileName))
return
// eslint-disable-next-line no-console
console.log('downloading', fileName)
try {
const image = await $fetch(url, { responseType: 'arrayBuffer' })
await fs.writeFile(fileName, Buffer.from(image))
}
catch {
}
}
async function fetchAvatars() {
await fs.ensureDir(dirAvatars)
contributors = JSON.parse(await fs.readFile(pathContributors, { encoding: 'utf-8' }))
await Promise.all(contributors.map(name => download(`https://github.com/${name}.png?size=100`, join(dirAvatars, `${name}.png`))))
}
// async function fetchSponsors() {
// await fs.ensureDir(dirSponsors)
// await download('https://cdn.jsdelivr.net/gh/antfu/static/sponsors.svg', join(dirSponsors, 'antfu.svg'))
// await download('https://cdn.jsdelivr.net/gh/patak-dev/static/sponsors.svg', join(dirSponsors, 'patak-dev.svg'))
// await download('https://cdn.jsdelivr.net/gh/sheremet-va/static/sponsors.svg', join(dirSponsors, 'sheremet-va.svg'))
// }
fetchAvatars()
// fetchSponsors()

View File

@ -0,0 +1,77 @@
.dark [img-light] {
display: none;
}
html:not(.dark) [img-dark] {
display: none;
}
/* Overrides */
.VPSocialLink {
transform: scale(0.9);
}
.vp-doc th,
.vp-doc td {
padding: 6px 10px;
border: 1px solid #8882;
}
/* h3 breaks SEO => replaced with h2 with the same size */
.home-content h2 {
margin-top: 2rem;
font-size: 1.35rem;
border-bottom: none;
margin-bottom: 0;
}
img.resizable-img {
width: unset;
height: unset;
}
/* fix height ~ 2 lines of text: 3 or more cards per row */
.VPTeamMembersItem.small .profile .data .affiliation {
min-height: 3rem;
}
.VPTeamMembersItem.small .profile .data .desc {
min-height: 3rem;
}
/* fix height ~ 3 lines of text: 4 cards per row */
@media (min-width: 1064px) and (max-width: 1143px) {
.VPTeamMembersItem.small .profile .data .affiliation {
min-height: 4rem;
}
.VPTeamMembersItem.small .profile .data .desc {
min-height: 4rem;
}
}
/* fix height ~ 3 lines of text: 3 cards per row */
@media (min-width: 815px) and (max-width: 875px) {
.VPTeamMembersItem.small .profile .data .affiliation {
min-height: 4rem;
}
.VPTeamMembersItem.small .profile .data .desc {
min-height: 4rem;
}
}
/* fix height ~ 3 lines of text: 2 cards per row */
@media (max-width: 612px) {
.VPTeamMembersItem.small .profile .data .affiliation {
min-height: 4rem;
}
.VPTeamMembersItem.small .profile .data .desc {
min-height: 4rem;
}
}
/* fix height: one card per row */
@media (max-width: 568px) {
.VPTeamMembersItem.small .profile .data .affiliation {
min-height: unset;
}
.VPTeamMembersItem.small .profile .data .desc {
min-height: unset;
}
}

View File

@ -2,13 +2,29 @@ import DefaultTheme from 'vitepress/theme';
import './custom.css';
// @ts-ignore
import Mermaid from './Mermaid.vue';
// @ts-ignore
import Contributors from '../components/Contributors.vue';
// @ts-ignore
import HomePage from '../components/HomePage.vue'
import { getRedirect } from './redirect';
import { h } from 'vue'
import Theme from 'vitepress/theme'
import '../style/main.css'
import 'uno.css'
export default {
...DefaultTheme,
Layout() {
return h(Theme.Layout, null, {
'home-features-after': () => h(HomePage),
})
},
enhanceApp({ app, router }) {
// register global components
app.component('Mermaid', Mermaid);
app.component('Contributors', Contributors);
router.onBeforeRouteChange = (to) => {
try {
const newPath = getRedirect(to);
@ -17,7 +33,8 @@ export default {
// router.go isn't loading the ID properly.
window.location.href = `/${newPath}`;
}
} catch (e) {}
} catch (e) { }
};
},
} as typeof DefaultTheme;
};

View File

@ -1,5 +1,6 @@
---
layout: home
sidebar: false
title: Mermaid
titleTemplate: Diagramming and charting tool
@ -33,156 +34,3 @@ features:
details: 2019 JavaScript Open Source Award winner for "The Most Exciting Use of Technology".
link: https://osawards.com/javascript/2019
---
<script setup>
import { VPTeamMembers } from 'vitepress/theme'
const websiteSVG = {
svg: '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-globe"><circle cx="12" cy="12" r="10"></circle><line x1="2" y1="12" x2="22" y2="12"></line><path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"></path></svg>'
}
const members = [
{
avatar: "https://avatars.githubusercontent.com/u/5837277?v=4",
name: "Knut Sveidqvist",
title: "Creator",
links: [{ icon: "github", link: "https://github.com/knsv" }],
},
{
avatar: "https://avatars.githubusercontent.com/u/58763315?v=4",
name: "Neil Cuzon",
title: "Developer",
links: [{ icon: "github", link: "https://github.com/NeilCuzon" }],
},
{
avatar: "https://avatars.githubusercontent.com/u/733544?v=4",
name: "Tyler Liu",
title: "Developer",
links: [{ icon: "github", link: "https://github.com/tylerlong" }],
},
{
avatar: "https://avatars.githubusercontent.com/u/10703445?v=4",
name: "Sidharth Vinod",
title: "Developer",
links: [
{ icon: "github", link: "https://github.com/sidharthv96" },
{ icon: websiteSVG, link: "https://sidharth.dev" },
{ icon: "linkedin", link: "https://www.linkedin.com/in/sidharth-vinod/" },
],
},
{
avatar: "https://avatars.githubusercontent.com/u/16836093?v=4",
name: "Ashish Jain",
title: "Developer",
links: [{ icon: "github", link: "https://github.com/ashishjain0512" }],
},
{
avatar: "https://avatars.githubusercontent.com/u/6032561?v=4",
name: "Matthieu Morel",
title: "Developer",
links: [
{ icon: "github", link: "https://github.com/mmorel-35" },
{
icon: "linkedin",
link: "https://www.linkedin.com/in/matthieumorel35/",
},
],
},
{
avatar: "https://avatars.githubusercontent.com/u/6552521?v=4",
name: "Christian Klemm",
title: "Developer",
links: [{ icon: "github", link: "https://github.com/klemmchr" }],
},
{
avatar: "https://avatars.githubusercontent.com/u/19716675?v=4",
name: "Alois Klink",
title: "Developer",
links: [
{ icon: "github", link: "https://github.com/aloisklink" },
{ icon: websiteSVG, link: "https://aloisklink.com" },
{ icon: "linkedin", link: "https://www.linkedin.com/in/aloisklink/" },
],
},
{
avatar: "https://avatars.githubusercontent.com/u/114684273?v=4",
name: "Per Brolin",
title: "Developer",
links: [{ icon: "github", link: "https://github.com/pbrolin47" }],
},
{
avatar: "https://avatars.githubusercontent.com/u/53054099?v=4",
name: "Yash Singh",
title: "Developer",
links: [{ icon: "github", link: "https://github.com/Yash-Singh1" }],
},
{
avatar: "https://avatars.githubusercontent.com/u/1912783?v=4",
name: "Marc Faber",
title: "Developer",
links: [
{ icon: "github", link: "https://gdfaber.github.io/" },
{ icon: "linkedin", link: "https://www.linkedin.com/in/marc-faber/" },
],
},
{
avatar: "https://avatars.githubusercontent.com/u/12032557?v=4",
name: "Mindaugas Laganeckas",
title: "Developer",
links: [{ icon: "github", link: "https://github.com/MindaugasLaganeckas" }],
},
{
avatar: "https://avatars.githubusercontent.com/u/300077?v=4",
name: "Justin Greywolf",
title: "Developer",
links: [{ icon: "github", link: "https://github.com/jgreywolf" }],
},
{
avatar: "https://avatars.githubusercontent.com/u/1564825?v=4",
name: "Nacho Orlandoni",
title: "Developer",
links: [{ icon: "github", link: "https://github.com/IOrlandoni" }],
},
{
avatar: "https://avatars.githubusercontent.com/u/19526120?v=4",
name: "Adrian Hall",
title: "Developer",
links: [{ icon: "github", link: "https://github.com/spopida" }],
},
];
</script>
<div class="vp-doc" >
<h2 id="meet-the-team"> Meet The Team </h2>
<VPTeamMembers size="small" :members="members" />
</div>
<style>
.image-container .image-src {
margin: 1rem auto;
max-width: 100%;
width: 100%;
}
.dark .image-src{
filter: invert(1) hue-rotate(217deg) contrast(0.72);
max-width: 100%;
}
.vp-doc {
align-items: center;
flex-direction: column;
display: flex;
margin: 1.5rem;
}
.vp-doc h2 {
margin: 48px 0 16px;
border-top: 1px solid var(--vp-c-divider-light);
padding-top: 24px;
letter-spacing: -.02em;
line-height: 32px;
font-size: 24px;
}
</style>

View File

@ -0,0 +1,35 @@
{
"name": "docs",
"private": true,
"scripts": {
"dev": "vitepress --port 3333 --open",
"build": "nr prefetch && vitepress build",
"build-no-prefetch": "vitepress build",
"serve": "vitepress serve",
"preview-https": "pnpm run build && serve .vitepress/dist",
"preview-https-no-prefetch": "pnpm run build-no-prefetch && serve .vitepress/dist",
"prefetch": "esno .vitepress/scripts/fetch-avatars.ts"
},
"dependencies": {
"@vueuse/core": "^9.10.0",
"jiti": "^1.16.1",
"vue": "latest"
},
"devDependencies": {
"@iconify-json/carbon": "^1.1.13",
"@unocss/reset": "^0.48.3",
"@vite-pwa/vitepress": "^0.0.4",
"@vitejs/plugin-vue": "latest",
"esno": "^0.16.3",
"fast-glob": "^3.2.12",
"fs-extra": "^10.1.0",
"https-localhost": "^4.7.1",
"pathe": "^1.1.0",
"unocss": "^0.48.3",
"unplugin-vue-components": "^0.22.12",
"vite": "^4.1.4",
"vite-plugin-pwa": "^0.14.1",
"vitepress": "1.0.0-alpha.47",
"workbox-window": "^6.5.4"
}
}

View File

@ -1,12 +1,43 @@
import { defineConfig, type PluginOption, searchForWorkspaceRoot } from 'vite';
import { defineConfig, searchForWorkspaceRoot } from 'vite';
import type { PluginOption, Plugin } from 'vite';
import path from 'path';
import { SearchPlugin } from 'vitepress-plugin-search';
import fs from 'fs'
import Components from 'unplugin-vue-components/vite'
import Unocss from 'unocss/vite'
import { presetAttributify, presetIcons, presetUno } from 'unocss'
import { resolve } from 'pathe'
const virtualModuleId = 'virtual:mermaid-config';
const resolvedVirtualModuleId = '\0' + virtualModuleId;
export default defineConfig({
optimizeDeps: {
// vitepress is aliased with replacement `join(DIST_CLIENT_PATH, '/index')`
// This needs to be excluded from optimization
exclude: ['vitepress'],
},
plugins: [
Components({
include: [/\.vue/, /\.md/],
dirs: '.vitepress/components',
dts: '.vitepress/components.d.ts',
}) as Plugin,
Unocss({
shortcuts: [
['btn', 'px-4 py-1 rounded inline-flex justify-center gap-2 text-white leading-30px children:mya !no-underline cursor-pointer disabled:cursor-default disabled:bg-gray-600 disabled:opacity-50'],
],
presets: [
presetUno({
dark: 'media',
}),
presetAttributify(),
presetIcons({
scale: 1.2,
}),
],
}) as unknown as Plugin,
IncludesPlugin(),
SearchPlugin() as PluginOption,
{
// TODO: will be fixed in the next vitepress release.
@ -47,3 +78,22 @@ export default defineConfig({
},
},
});
function IncludesPlugin(): Plugin {
return {
name: 'include-plugin',
enforce: 'pre',
transform(code: string, id: string): string | undefined {
let changed = false
code = code.replace(/\[@@include]\((.*?)\)/, (_: string, url: any): string => {
changed = true
const full = resolve(id, url)
return fs.readFileSync(full, 'utf-8')
})
if (changed) {
return code
}
},
} as Plugin
}

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,5 @@
packages:
# all packages in direct subdirs of packages/
- 'packages/*'
- 'packages/mermaid/src/docs'
- 'packages/mermaid/src/vitepress'
- 'tests/*'