Skip to content

Commit c46ecc9

Browse files
committed
🎉 feat: optimize bundle size
1 parent 325f088 commit c46ecc9

File tree

12 files changed

+274
-516
lines changed

12 files changed

+274
-516
lines changed

bun.lock

Lines changed: 192 additions & 390 deletions
Large diffs are not rendered by default.

docs/.vitepress/config.ts

Lines changed: 44 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@ import { createFileSystemTypesCache } from '@shikijs/vitepress-twoslash/cache-fs
66
import tailwindcss from '@tailwindcss/vite'
77

88
import llmstxt from 'vitepress-plugin-llms'
9+
import { analyzer } from 'vite-bundle-analyzer'
910

10-
// import { UnlazyImages } from '@nolebase/markdown-it-unlazy-img'
11-
import {
12-
GitChangelog,
13-
GitChangelogMarkdownSection
14-
} from '@nolebase/vitepress-plugin-git-changelog/vite'
11+
// import {
12+
// GitChangelog,
13+
// GitChangelogMarkdownSection
14+
// } from '@nolebase/vitepress-plugin-git-changelog/vite'
1515
import { InlineLinkPreviewElementTransform } from '@nolebase/vitepress-plugin-inline-link-preview/markdown-it'
16-
// import { ThumbnailHashImages } from '@nolebase/vitepress-plugin-thumbnail-hash/vite'
1716

1817
const description =
1918
'Ergonomic Framework for Humans. TypeScript framework supercharged by Bun with End - to - End Type Safety, unified type system and outstanding developer experience'
@@ -30,6 +29,7 @@ export default defineConfig({
3029
dark: 'github-dark'
3130
},
3231
codeTransformers: [
32+
// @ts-ignore
3333
transformerTwoslash({
3434
typesCache: createFileSystemTypesCache({
3535
dir: './docs/.vitepress/cache/twoslash'
@@ -61,49 +61,50 @@ export default defineConfig({
6161
plugins: [
6262
tailwindcss() as any,
6363
process.env.NODE_ENV === 'production' ? llmstxt() : [],
64-
GitChangelog({
65-
repoURL: () => 'https://github.com/elysiajs/documentation',
66-
mapAuthors: [
67-
{
68-
mapByEmailAliases: ['[email protected]'],
69-
avatar: '/blog/authors/aris.webp',
70-
links: [
71-
{
72-
type: 'GitHub',
73-
link: 'https://github.com/SaltyAom'
74-
}
75-
]
76-
},
77-
{
78-
mapByNameAliases: ['bogeychan'],
79-
links: [
80-
{
81-
type: 'GitHub',
82-
link: 'http://github.com/bogeychan'
83-
}
84-
]
85-
},
86-
{
87-
mapByNameAliases: ['Fecony'],
88-
links: [
89-
{
90-
type: 'GitHub',
91-
link: 'https://github.com/fecony'
92-
}
93-
]
94-
}
95-
]
96-
}),
97-
GitChangelogMarkdownSection(),
98-
// ThumbnailHashImages()
64+
process.env.ANALYZE === 'true' ? analyzer() : [],
65+
// GitChangelog({
66+
// repoURL: () => 'https://github.com/elysiajs/documentation',
67+
// mapAuthors: [
68+
// {
69+
// mapByEmailAliases: ['[email protected]'],
70+
// avatar: '/blog/authors/aris.webp',
71+
// links: [
72+
// {
73+
// type: 'GitHub',
74+
// link: 'https://github.com/SaltyAom'
75+
// }
76+
// ]
77+
// },
78+
// {
79+
// mapByNameAliases: ['bogeychan'],
80+
// links: [
81+
// {
82+
// type: 'GitHub',
83+
// link: 'http://github.com/bogeychan'
84+
// }
85+
// ]
86+
// },
87+
// {
88+
// mapByNameAliases: ['Fecony'],
89+
// links: [
90+
// {
91+
// type: 'GitHub',
92+
// link: 'https://github.com/fecony'
93+
// }
94+
// ]
95+
// }
96+
// ]
97+
// }),
98+
// GitChangelogMarkdownSection()
9999
],
100100
optimizeDeps: {
101101
exclude: ['@nolebase/vitepress-plugin-inline-link-preview/client']
102102
},
103103
ssr: {
104104
noExternal: [
105105
'@nolebase/vitepress-plugin-inline-link-preview',
106-
'@unlazy/vue'
106+
'@unlazy/vue',
107+
'@nolebase/ui'
107108
]
108109
}
109110
},
@@ -441,7 +442,7 @@ export default defineConfig({
441442
{
442443
text: 'SvelteKit',
443444
link: '/integrations/sveltekit'
444-
},
445+
}
445446
]
446447
}
447448
],

docs/.vitepress/polyfill/fs.js

Lines changed: 0 additions & 2 deletions
This file was deleted.

docs/.vitepress/theme/index.ts

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,31 @@
1-
import { useData, useRoute } from 'vitepress'
2-
import type { EnhanceAppContext, Theme } from 'vitepress'
1+
import { toRefs } from 'vue'
2+
import { useData, useRoute, type EnhanceAppContext, type Theme } from 'vitepress'
33

4-
import DefaultTheme from 'vitepress/theme'
4+
import DefaultTheme from 'vitepress/theme-without-fonts'
55

66
// @ts-ignore
77
import Layout from './layout.vue'
88

99
import TwoslashFloatingVue from '@shikijs/vitepress-twoslash/client'
1010
import '@shikijs/vitepress-twoslash/style.css'
1111

12-
import { NolebaseGitChangelogPlugin } from '@nolebase/vitepress-plugin-git-changelog/client'
13-
import '@nolebase/vitepress-plugin-git-changelog/client/style.css'
14-
1512
import { NolebaseInlineLinkPreviewPlugin } from '@nolebase/vitepress-plugin-inline-link-preview/client'
1613
import '@nolebase/vitepress-plugin-inline-link-preview/client/style.css'
1714

18-
// import { NolebaseUnlazyImg } from '@nolebase/vitepress-plugin-thumbnail-hash/client'
19-
// import '@nolebase/vitepress-plugin-thumbnail-hash/client/style.css'
15+
// import { NolebaseGitChangelogPlugin } from '@nolebase/vitepress-plugin-git-changelog/client'
16+
// import '@nolebase/vitepress-plugin-git-changelog/client/style.css'
2017

2118
import giscusTalk from 'vitepress-plugin-comment-with-giscus'
2219

2320
import '../../tailwind.css'
24-
import { toRefs } from 'vue'
2521

2622
export default {
2723
extends: DefaultTheme,
2824
Layout,
2925
enhanceApp({ app }: EnhanceAppContext) {
3026
app.use(TwoslashFloatingVue)
31-
app.use(NolebaseGitChangelogPlugin)
3227
app.use(NolebaseInlineLinkPreviewPlugin)
33-
// app.component('NolebaseUnlazyImg', NolebaseUnlazyImg)
28+
// app.use(NolebaseGitChangelogPlugin)
3429
},
3530
setup() {
3631
// Get frontmatter and route

docs/.vitepress/theme/layout.vue

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script setup lang="ts">
22
import { useData } from 'vitepress'
3-
import DefaultTheme from 'vitepress/theme'
3+
import DefaultTheme from 'vitepress/theme-without-fonts'
44
import { nextTick, provide } from 'vue'
55
66
import useDark from '../../components/midori/use-dark'
@@ -44,7 +44,7 @@ provide('toggle-appearance', async ({ clientX: x, clientY: y }: MouseEvent) => {
4444
<template>
4545
<link rel="preload" as="image" href="/assets/elysia_v.webp" fetchpriority="high">
4646
<link rel="preload" as="image" href="/assets/elysia.svg" fetchpriority="high">
47-
<link rel="preload" as="image" href="/assets/shigure-ui.webp" fetchpriority="low">
47+
<link rel="preload" as="image" href="/assets/shigure-ui-smol.gif" fetchpriority="low">
4848
<DefaultTheme.Layout>
4949
<template #doc-top>
5050
<Ray
@@ -91,7 +91,7 @@ provide('toggle-appearance', async ({ clientX: x, clientY: y }: MouseEvent) => {
9191
}
9292
9393
::view-transition-new(root) {
94-
mask: url('/assets/shigure-ui.webp')
94+
mask: url('/assets/shigure-ui-smol.gif')
9595
center / 0 no-repeat;
9696
animation: var(--switch-name) var(--switch-duration);
9797
}
@@ -106,13 +106,13 @@ provide('toggle-appearance', async ({ clientX: x, clientY: y }: MouseEvent) => {
106106
mask-size: 0;
107107
}
108108
10% {
109-
mask-size: 50vmax;
109+
mask-size: 25vmax;
110110
}
111111
90% {
112-
mask-size: 50vmax;
112+
mask-size: 25vmax;
113113
}
114114
100% {
115-
mask-size: 2000vmax;
115+
mask-size: 1000vmax;
116116
}
117117
}
118118
@@ -121,13 +121,13 @@ provide('toggle-appearance', async ({ clientX: x, clientY: y }: MouseEvent) => {
121121
mask-size: 0;
122122
}
123123
10% {
124-
mask-size: 50vmax;
124+
mask-size: 25vmax;
125125
}
126126
80% {
127-
mask-size: 50vmax;
127+
mask-size: 25vmax;
128128
}
129129
100% {
130-
mask-size: 2000vmax;
130+
mask-size: 1000vmax;
131131
}
132132
}
133133

docs/components/fern/fern.vue

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,6 @@ import BuiltWithLove from './built-with-love.vue'
1515
</script>
1616

1717
<template>
18-
<link rel="preconnect" href="https://fonts.googleapis.com" />
19-
<link
20-
rel="preconnect"
21-
href="https://fonts.gstatic.com"
22-
crossorigin="anonymous"
23-
/>
24-
<link
25-
href="https://fonts.googleapis.com/css2?family=Borel&display=swap"
26-
rel="stylesheet"
27-
/>
28-
2918
<div id="landing" class="dark:bg-gray-900/60">
3019
<Hero />
3120
<article

docs/components/fern/type-integrity.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,17 +111,17 @@ watch(form, (index) => {
111111
112112
&:nth-child(1) {
113113
background-color: rgba(237, 106, 94);
114-
border: 1px solid rgba(195, 75, 70);
114+
border: 0.5px solid rgba(195, 75, 70);
115115
}
116116
117117
&:nth-child(2) {
118118
background-color: rgba(245, 191, 79);
119-
border: 1px solid rgba(203, 156, 78);
119+
border: 0.5px solid rgba(203, 156, 78);
120120
}
121121
122122
&:nth-child(3) {
123123
background-color: rgba(101, 192, 93);
124-
border: 1px solid rgba(82, 162, 74);
124+
border: 0.5px solid rgba(82, 162, 74);
125125
}
126126
}
127127
}

docs/components/midori/index.vue

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,6 @@ import BuiltWithLove from './built-with-love.vue'
1818
</script>
1919

2020
<template>
21-
<link rel="preconnect" href="https://fonts.googleapis.com" />
22-
<link
23-
rel="preconnect"
24-
href="https://fonts.gstatic.com"
25-
crossorigin="true"
26-
/>
27-
2821
<div id="landing" class="dark:bg-gray-900/60">
2922
<Hero />
3023
<article class="flex flex-col gap-4 px-6">
73 KB
Loading

package.json

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,6 @@
88
"author": "",
99
"license": "MIT",
1010
"dependencies": {
11-
"@iconify/json": "^2.2.324",
12-
"@shikijs/vitepress-twoslash": "^3.2.1",
13-
"@tailwindcss/postcss7-compat": "^2.2.17",
14-
"@tailwindcss/vite": "^4.1.3",
15-
"autoprefixer": "^10.4.21",
16-
"daisyui": "^5.0.15",
17-
"dayjs": "^1.11.13",
18-
"elysia": "^1.2.25",
19-
"postcss": "^8.5.3",
20-
"postcss-nesting": "^13.0.1",
21-
"postcss-preset-env": "^10.1.5",
22-
"shiki": "^3.2.1",
23-
"tailwindcss": "^4.1.3",
24-
"vite": "^6.2.5"
25-
},
26-
"devDependencies": {
2711
"@elysiajs/apollo": "^1.2.0",
2812
"@elysiajs/bearer": "^1.2.0",
2913
"@elysiajs/cors": "^1.2.0",
@@ -36,28 +20,42 @@
3620
"@elysiajs/server-timing": "^1.2.1",
3721
"@elysiajs/static": "^1.2.0",
3822
"@elysiajs/swagger": "^1.2.2",
23+
"@iconify/json": "^2.2.329",
24+
"@tailwindcss/vite": "^4.1.4",
25+
"dayjs": "^1.11.13",
26+
"elysia": "^1.2.25",
27+
"shiki": "^3.2.2",
28+
"tailwindcss": "^4.1.4"
29+
},
30+
"devDependencies": {
3931
"@nolebase/markdown-it-unlazy-img": "^2.16.0",
4032
"@nolebase/vitepress-plugin-git-changelog": "^2.16.0",
4133
"@nolebase/vitepress-plugin-inline-link-preview": "^2.16.0",
4234
"@nolebase/vitepress-plugin-thumbnail-hash": "^2.16.0",
4335
"@rollup/plugin-node-resolve": "^16.0.1",
44-
"@tailwindcss/postcss": "^4.1.3",
45-
"@types/bun": "^1.2.8",
46-
"@types/node": "^22.14.0",
47-
"@types/react": "^19.1.0",
36+
"@shikijs/vitepress-twoslash": "^3.2.2",
37+
"@tailwindcss/postcss": "^4.1.4",
38+
"@types/bun": "^1.2.10",
39+
"@types/node": "^22.14.1",
40+
"@types/react": "^19.1.2",
4841
"cheerio": "1.0.0",
4942
"markdown-it": "^14.1.0",
43+
"postcss": "^8.5.3",
44+
"postcss-nesting": "^13.0.1",
45+
"postcss-preset-env": "^10.1.6",
5046
"react": "^19.1.0",
5147
"typescript": "^5.8.3",
5248
"view-transitions-api-types": "^0.1.1",
49+
"vite": "^6.3.2",
50+
"vite-bundle-analyzer": "^0.19.0",
5351
"vite-plugin-node-polyfills": "^0.23.0",
5452
"vitepress": "^1.6.3",
5553
"vitepress-plugin-comment-with-giscus": "^1.1.15",
56-
"vitepress-plugin-llms": "^1.0.5",
54+
"vitepress-plugin-llms": "^1.1.0",
5755
"vue": "^3.5.13"
5856
},
5957
"overrides": {
60-
"vite": "^6.2.5",
58+
"vite": "^6.3.2",
6159
"vitepress": "^1.6.3",
6260
"vue": "^3.5.13"
6361
},

0 commit comments

Comments
 (0)