Skip to content

Commit fee64dd

Browse files
committed
docs: improve dtsx docs
1 parent 729d2b5 commit fee64dd

41 files changed

Lines changed: 2495 additions & 288 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

bun.lock

Lines changed: 1011 additions & 121 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/.vitepress/components.d.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/* eslint-disable */
2+
// @ts-nocheck
3+
// Generated by unplugin-vue-components
4+
// Read more: https://github.com/vuejs/core/pull/3399
5+
export {}
6+
7+
/* prettier-ignore */
8+
declare module 'vue' {
9+
export interface GlobalComponents {
10+
Home: typeof import('./theme/components/Home.vue')['default']
11+
HomeContributors: typeof import('./theme/components/HomeContributors.vue')['default']
12+
HomeSponsors: typeof import('./theme/components/HomeSponsors.vue')['default']
13+
HomeTeam: typeof import('./theme/components/HomeTeam.vue')['default']
14+
TeamMember: typeof import('./theme/components/TeamMember.vue')['default']
15+
}
16+
}

docs/.vitepress/config.ts

Lines changed: 141 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,152 @@
1+
import type { HeadConfig } from 'vitepress'
2+
import { transformerTwoslash } from '@shikijs/vitepress-twoslash'
3+
import { withPwa } from '@vite-pwa/vitepress'
14
import { defineConfig } from 'vitepress'
25

6+
import viteConfig from './vite.config'
7+
38
// https://vitepress.dev/reference/site-config
4-
export default defineConfig({
5-
title: 'Reverse Proxy',
6-
description: 'A better developer environment.',
7-
themeConfig: {
8-
// https://vitepress.dev/reference/default-theme-config
9-
nav: [
10-
{ text: 'Home', link: '/' },
11-
{ text: 'Examples', link: '/markdown-examples' },
12-
],
139

14-
sidebar: [
10+
const analyticsHead: HeadConfig[] = [
11+
[
12+
'script',
13+
{
14+
'src': 'https://cdn.usefathom.com/script.js',
15+
'data-site': 'DCOEHMGA',
16+
'defer': '',
17+
},
18+
],
19+
]
20+
21+
const nav = [
22+
{ text: 'News', link: 'https://stacksjs.org/news' },
23+
{
24+
text: 'Changelog',
25+
link: 'https://github.com/stacksjs/dtsx/blob/main/CHANGELOG.md',
26+
},
27+
// { text: 'Blog', link: 'https://updates.ow3.org' },
28+
{
29+
text: 'Resources',
30+
items: [
31+
{ text: 'Team', link: '/team' },
32+
{ text: 'Sponsors', link: '/sponsors' },
33+
{ text: 'Partners', link: '/partners' },
34+
{ text: 'Postcardware', link: '/postcardware' },
35+
{ text: 'License', link: '/license' },
1536
{
16-
text: 'Examples',
1737
items: [
18-
{ text: 'Markdown Examples', link: '/markdown-examples' },
19-
{ text: 'Runtime API Examples', link: '/api-examples' },
38+
{
39+
text: 'Awesome Stacks',
40+
link: 'https://github.com/stacksjs/awesome-stacks',
41+
},
42+
{
43+
text: 'Contributing',
44+
link: 'https://github.com/stacksjs/stacks/blob/main/.github/CONTRIBUTING.md',
45+
},
2046
],
2147
},
2248
],
49+
},
50+
]
2351

24-
socialLinks: [{ icon: 'github', link: 'https://github.com/vuejs/vitepress' }],
52+
const sidebar = [
53+
{
54+
text: 'Get Started',
55+
items: [
56+
{ text: 'Intro', link: '/intro' },
57+
{ text: 'Install', link: '/install' },
58+
{ text: 'Usage', link: '/usage' },
59+
{ text: 'Config', link: '/config' },
60+
],
2561
},
26-
})
62+
{ text: 'Showcase', link: '/Showcase' },
63+
]
64+
const description = 'Extremely fast & configurable DTS emitter.'
65+
const title = `ts-collect | ${description}`
66+
67+
export default withPwa(
68+
defineConfig({
69+
lang: 'en-US',
70+
title: 'dtsx',
71+
description,
72+
metaChunk: true,
73+
cleanUrls: true,
74+
75+
head: [
76+
['link', { rel: 'icon', type: 'image/svg+xml', href: './images/logo-mini.svg' }],
77+
['link', { rel: 'icon', type: 'image/png', href: './images/logo.png' }],
78+
['meta', { name: 'theme-color', content: '#0A0ABC' }],
79+
['meta', { name: 'title', content: title }],
80+
['meta', { name: 'description', content: description }],
81+
['meta', { name: 'author', content: 'Stacks.js, Inc.' }],
82+
['meta', {
83+
name: 'tags',
84+
content: 'dtsx, typescript, compiler, stacksjs, lightweight, Cross-Platform',
85+
}],
86+
87+
['meta', { property: 'og:type', content: 'website' }],
88+
['meta', { property: 'og:locale', content: 'en' }],
89+
['meta', { property: 'og:title', content: title }],
90+
['meta', { property: 'og:description', content: description }],
91+
92+
['meta', { property: 'og:site_name', content: 'dtsx' }],
93+
['meta', { property: 'og:image', content: './images/og-image.jpg' }],
94+
['meta', { property: 'og:url', content: 'https://dtsx.sh/' }],
95+
// ['script', { 'src': 'https://cdn.usefathom.com/script.js', 'data-site': '', 'data-spa': 'auto', 'defer': '' }],
96+
...analyticsHead,
97+
],
98+
99+
themeConfig: {
100+
logo: {
101+
light: './images/logo-transparent.svg',
102+
dark: './images/logo-white-transparent.svg',
103+
},
104+
105+
nav,
106+
sidebar,
107+
108+
editLink: {
109+
pattern: 'https://github.com/stacksjs/stacks/edit/main/docs/docs/:path',
110+
text: 'Edit this page on GitHub',
111+
},
112+
113+
footer: {
114+
message: 'Released under the MIT License.',
115+
copyright: 'Copyright © 2024-present Stacks.js, Inc.',
116+
},
117+
118+
socialLinks: [
119+
{ icon: 'twitter', link: 'https://twitter.com/stacksjs' },
120+
{ icon: 'bluesky', link: 'https://bsky.app/profile/chrisbreuer.dev' },
121+
{ icon: 'github', link: 'https://github.com/stacksjs/dtsx' },
122+
{ icon: 'discord', link: 'https://discord.gg/stacksjs' },
123+
],
124+
125+
// algolia: services.algolia,
126+
127+
// carbonAds: {
128+
// code: '',
129+
// placement: '',
130+
// },
131+
},
132+
133+
pwa: {
134+
manifest: {
135+
theme_color: '#0A0ABC',
136+
},
137+
},
138+
139+
markdown: {
140+
theme: {
141+
light: 'vitesse-light',
142+
dark: 'vitesse-dark',
143+
},
144+
145+
codeTransformers: [
146+
transformerTwoslash(),
147+
],
148+
},
149+
150+
vite: viteConfig,
151+
}),
152+
)

docs/.vitepress/sw.ts

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
/// <reference types="vite/client" />
2+
3+
/// <reference lib="webworker" />
4+
5+
import { CacheableResponsePlugin } from 'workbox-cacheable-response'
6+
import { ExpirationPlugin } from 'workbox-expiration'
7+
import { cleanupOutdatedCaches, createHandlerBoundToURL, precacheAndRoute } from 'workbox-precaching'
8+
import { NavigationRoute, registerRoute } from 'workbox-routing'
9+
import { NetworkFirst, NetworkOnly, StaleWhileRevalidate } from 'workbox-strategies'
10+
11+
declare let self: ServiceWorkerGlobalScope
12+
13+
const entries = self.__WB_MANIFEST
14+
15+
// self.__WB_MANIFEST is the default injection point
16+
precacheAndRoute(entries)
17+
18+
// clean old assets
19+
cleanupOutdatedCaches()
20+
21+
let allowlist: undefined | RegExp[]
22+
if (import.meta.env.DEV)
23+
allowlist = [/^\/$/]
24+
25+
if (import.meta.env.PROD) {
26+
const swPath = self.location.pathname.lastIndexOf('/')
27+
const base = swPath === 0 ? '/' : self.location.pathname.slice(0, swPath + 1)
28+
function escapeStringRegexp(value: string) {
29+
// Escape characters with special meaning either inside or outside character sets.
30+
// Use a simple backslash escape when it’s always valid, and a `\xnn` escape when the simpler form would be disallowed by Unicode patterns’ stricter grammar.
31+
return value
32+
.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&')
33+
.replace(/-/g, '\\x2d')
34+
}
35+
allowlist = entries.filter((page) => {
36+
return typeof page === 'string'
37+
? page.endsWith('.html')
38+
: page.url.endsWith('.html')
39+
}).map((page) => {
40+
const url = typeof page === 'string' ? page : page.url
41+
const regex = url === 'index.html'
42+
? escapeStringRegexp(base)
43+
: escapeStringRegexp(`${base}${url.replace(/\.html$/, '')}`)
44+
return new RegExp(`^${regex}(\\.html)?$`)
45+
})
46+
registerRoute(
47+
({ request, sameOrigin }) => {
48+
return sameOrigin && request.mode === 'navigate'
49+
},
50+
new NetworkOnly({
51+
plugins: [{
52+
/* this callback will be called when the fetch call fails */
53+
handlerDidError: async () => Response.redirect('404', 302),
54+
/* this callback will prevent caching the response */
55+
cacheWillUpdate: async () => null,
56+
}],
57+
}),
58+
'GET',
59+
)
60+
// googleapis
61+
registerRoute(
62+
/^https:\/\/fonts\.googleapis\.com\/.*/i,
63+
new NetworkFirst({
64+
cacheName: 'google-fonts-cache',
65+
plugins: [
66+
new CacheableResponsePlugin({ statuses: [0, 200] }),
67+
// we only need a few entries
68+
new ExpirationPlugin({
69+
maxEntries: 10,
70+
maxAgeSeconds: 60 * 60 * 24 * 365, // <== 365 days
71+
}),
72+
],
73+
}),
74+
)
75+
// gstatic
76+
registerRoute(
77+
/^https:\/\/fonts\.gstatic\.com\/.*/i,
78+
new StaleWhileRevalidate({
79+
cacheName: 'google-fonts-cache',
80+
plugins: [
81+
new CacheableResponsePlugin({ statuses: [0, 200] }),
82+
// we only need a few entries
83+
new ExpirationPlugin({
84+
maxEntries: 10,
85+
maxAgeSeconds: 60 * 60 * 24 * 365, // <== 365 days
86+
}),
87+
],
88+
}),
89+
)
90+
// antfu sponsors
91+
registerRoute(
92+
/^https:\/\/cdn\.jsdelivr\.net\/.*/i,
93+
new NetworkFirst({
94+
cacheName: 'jsdelivr-images-cache',
95+
plugins: [
96+
new CacheableResponsePlugin({ statuses: [0, 200] }),
97+
// we only need a few entries
98+
new ExpirationPlugin({
99+
maxEntries: 10,
100+
maxAgeSeconds: 60 * 60 * 24 * 7, // <== 7 days
101+
}),
102+
],
103+
}),
104+
)
105+
}
106+
107+
// to allow work offline
108+
registerRoute(new NavigationRoute(
109+
createHandlerBoundToURL('index.html'),
110+
{ allowlist },
111+
))
112+
113+
// Skip-Waiting Service Worker-based solution
114+
self.addEventListener('activate', async () => {
115+
// after we've taken over, iterate over all the current clients (windows)
116+
const clients = await self.clients.matchAll({ type: 'window' })
117+
clients.forEach((client) => {
118+
// ...and refresh each one of them
119+
client.navigate(client.url)
120+
})
121+
})
122+
123+
self.skipWaiting()
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<template>
2+
<div class="flex flex-col items-center mt-4 home">
3+
<HomeTeam />
4+
5+
<HomeSponsors />
6+
7+
<HomeContributors />
8+
</div>
9+
</template>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<script setup lang="ts">
2+
import { contributors } from './contributors'
3+
</script>
4+
5+
<template>
6+
<div class="vp-doc">
7+
<h2 pb-2 pt-5 font-normal op50>
8+
Contributors
9+
</h2>
10+
</div>
11+
12+
<div max-w-200 p-10 text-center text-lg leading-7>
13+
<div flex="~ wrap gap-1" justify-center>
14+
<a v-for="{ name, avatar } of contributors" :key="name" :href="`https://github.com/${name}`" m-0 rel="noopener noreferrer" :aria-label="`${name} on GitHub`">
15+
<img loading="lazy" :src="avatar" width="40" height="40" h-10 min-h-10 min-w-10 w-10 rounded-full :alt="`${name}'s avatar`">
16+
</a>
17+
</div>
18+
<br>
19+
</div>
20+
</template>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<template>
2+
<div class="vp-doc">
3+
<h2 pb-2 pt-5 font-normal op50>
4+
Stacks Sponsors
5+
</h2>
6+
</div>
7+
8+
<p id="sponsor" class="mt-5 text-center">
9+
<a href="https://github.com/sponsors/chrisbbreuer">
10+
<img src="https://cdn.jsdelivr.net/gh/stacksjs/sponsors/sponsorkit/sponsors.svg" class="m-auto">
11+
</a>
12+
</p>
13+
14+
<p class="mt-5 text-center">
15+
<a href="https://github.com/sponsors/chrisbbreuer" class="text-xs italic">
16+
Click here to become a sponsor.
17+
</a>
18+
</p>
19+
</template>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<script setup lang="ts">
2+
import { coreTeamMembers } from './contributors'
3+
</script>
4+
5+
<template>
6+
<div class="vp-doc">
7+
<h2 pb-2 pt-5 font-normal op50>
8+
Meet The Team
9+
</h2>
10+
</div>
11+
12+
<div grid="~ cols-2 lg:cols-4 gap-x-3 gap-y-20 items-stretch" p-10>
13+
<TeamMember
14+
v-for="c of coreTeamMembers"
15+
:key="c.github"
16+
:data="c"
17+
class="flex flex-col items-center text-center p-4 h-full"
18+
/>
19+
</div>
20+
</template>

0 commit comments

Comments
 (0)