Skip to content

Commit 27a02d3

Browse files
committed
📘 feat: use shiki in type-strict block
1 parent f6247cb commit 27a02d3

File tree

5 files changed

+81
-89
lines changed

5 files changed

+81
-89
lines changed

‎components/midori/index.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@ const isDark = useDark()
5252
<JustReturn>
5353
<slot name="justreturn"></slot>
5454
</JustReturn>
55-
<TypeStrict />
55+
<TypeStrict>
56+
<slot name="typestrict"></slot>
57+
</TypeStrict>
5658
<OpenAPI />
5759
</section>
5860
<E2ETypeSafety />

‎components/midori/type-strict.vue

Lines changed: 6 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,18 @@
1-
<script setup lang="ts">
2-
import Prism from 'vue-prism-component'
3-
4-
const code = `import { Elysia, t } from 'elysia'
5-
6-
new Elysia()
7-
.post(
8-
'/profile',
9-
({ body }) => body,
10-
{
11-
body: t.Object({
12-
username: t.String()
13-
})
14-
}
15-
)
16-
.listen(3000)
17-
`
18-
</script>
19-
201
<template>
21-
<article
22-
class="flex flex-col-reverse md:flex-row justify-between items-center gap-4 md:gap-12 w-full max-w-6xl"
23-
>
24-
<section class="w-full">
25-
<Prism
26-
class="!text-base !font-mono rounded-xl"
27-
language="typescript"
28-
>
29-
{{ code }}
30-
</Prism>
2+
<article class="flex flex-col-reverse md:flex-row justify-between items-center gap-4 md:gap-12 w-full max-w-6xl">
3+
<section class="w-full !text-base !font-mono rounded-xl">
4+
<slot></slot>
315
</section>
326
<header class="flex flex-col gap-3 w-full">
337
<h3
34-
class="text-5xl leading-tight font-bold text-transparent bg-clip-text bg-gradient-to-br from-teal-300 to-blue-300"
35-
>
8+
class="text-5xl leading-tight font-bold text-transparent bg-clip-text bg-gradient-to-br from-teal-300 to-blue-300">
369
Type Safety
3710
</h3>
38-
<p
39-
class="text-xl leading-normal text-gray-400 w-full max-w-lg mb-4"
40-
>
11+
<p class="text-xl leading-normal text-gray-400 w-full max-w-lg mb-4">
4112
Powered by TypeBox, Elysia enforces type-strict validation to
4213
ensure type integrity by default
4314
</p>
44-
<p
45-
class="text-xl leading-normal text-gray-400 w-full max-w-lg mb-4"
46-
>
15+
<p class="text-xl leading-normal text-gray-400 w-full max-w-lg mb-4">
4716
Elysia infers types to TypeScript automatically to create
4817
unified type system like statically typed language
4918
</p>

‎docs/.vitepress/config.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ export default defineConfig({
1616
}
1717
},
1818
// ![INFO] uncomment for support hot reload on WSL - https://github.com/vitejs/vite/issues/1153#issuecomment-785467271
19-
// vite: {
20-
// server: {
21-
// watch: {
22-
// usePolling: true
23-
// }
24-
// }
25-
// },
19+
vite: {
20+
server: {
21+
watch: {
22+
usePolling: true
23+
}
24+
}
25+
},
2626
head: [
2727
['link', { rel: 'preconnect', href: 'https://fonts.googleapis.com' }],
2828
[

‎docs/index.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,29 @@ new Elysia()
3232
hello: 'world'
3333
}))
3434
.listen(3000)
35+
3536
```
3637

3738
</template>
39+
40+
<template v-slot:typestrict>
41+
42+
```typescript
43+
import { Elysia, t } from 'elysia'
44+
45+
new Elysia()
46+
.post(
47+
'/profile',
48+
({ body }) => body,
49+
{
50+
body: t.Object({
51+
username: t.String()
52+
})
53+
}
54+
)
55+
.listen(3000)
56+
57+
```
58+
</template>
3859
</Landing>
3960
```

‎package.json

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,46 @@
11
{
2-
"name": "elysia-docs",
3-
"version": "1.0.0",
4-
"description": "",
5-
"type": "module",
6-
"main": "index.js",
7-
"keywords": [],
8-
"author": "",
9-
"license": "MIT",
10-
"dependencies": {
11-
"@iconify/json": "^2.2.145",
12-
"@saltyaom/gq": "^1.1.9",
13-
"@saltyaom/gql-local-cache": "^1.3.0",
14-
"@tailwindcss/nesting": "0.0.0-insiders.565cd3e",
15-
"@tailwindcss/postcss7-compat": "^2.2.17",
16-
"autoprefixer": "^10.4.16",
17-
"daisyui": "^4.4.2",
18-
"dayjs": "^1.11.10",
19-
"elysia": "^0.7.29",
20-
"openai": "^4.19.1",
21-
"postcss": "^8.4.31",
22-
"postcss-nesting": "^12.0.1",
23-
"postcss-preset-env": "^9.3.0",
24-
"prismjs": "^1.29.0",
25-
"tailwindcss": "^3.3.5",
26-
"vite": "^5.0.2",
27-
"vite-plugin-icons": "^0.6.5",
28-
"vue-prism-component": "^2.0.0",
29-
"windicss": "^3.5.6"
30-
},
31-
"devDependencies": {
32-
"@types/bun": "^1.0.8",
33-
"@types/node": "^20.9.4",
34-
"cheerio": "1.0.0-rc.12",
35-
"flexsearch": "^0.7.31",
36-
"markdown-it": "^13.0.2",
37-
"view-transitions-api-types": "^0.1.1",
38-
"vitepress": "1.0.0-rc.29",
39-
"vue": "^3.3.8"
40-
},
41-
"scripts": {
42-
"dev": "vitepress dev docs",
43-
"build": "vitepress build docs",
44-
"serve": "vitepress serve docs"
45-
}
2+
"name": "elysia-docs",
3+
"version": "1.0.0",
4+
"description": "",
5+
"type": "module",
6+
"main": "index.js",
7+
"keywords": [],
8+
"author": "",
9+
"license": "MIT",
10+
"dependencies": {
11+
"@iconify/json": "^2.2.145",
12+
"@saltyaom/gq": "^1.1.9",
13+
"@saltyaom/gql-local-cache": "^1.3.0",
14+
"@tailwindcss/nesting": "0.0.0-insiders.565cd3e",
15+
"@tailwindcss/postcss7-compat": "^2.2.17",
16+
"autoprefixer": "^10.4.16",
17+
"daisyui": "^4.4.2",
18+
"dayjs": "^1.11.10",
19+
"elysia": "^0.7.29",
20+
"openai": "^4.19.1",
21+
"postcss": "^8.4.31",
22+
"postcss-nesting": "^12.0.1",
23+
"postcss-preset-env": "^9.3.0",
24+
"prismjs": "^1.29.0",
25+
"tailwindcss": "^3.3.5",
26+
"vite": "^5.0.2",
27+
"vite-plugin-icons": "^0.6.5",
28+
"vue-prism-component": "^2.0.0",
29+
"windicss": "^3.5.6"
30+
},
31+
"devDependencies": {
32+
"@types/bun": "^1.0.8",
33+
"@types/node": "^20.9.4",
34+
"cheerio": "1.0.0-rc.12",
35+
"flexsearch": "^0.7.31",
36+
"markdown-it": "^13.0.2",
37+
"view-transitions-api-types": "^0.1.1",
38+
"vitepress": "1.0.0-rc.29",
39+
"vue": "^3.3.8"
40+
},
41+
"scripts": {
42+
"dev": "vitepress dev docs",
43+
"build": "vitepress build docs",
44+
"serve": "vitepress serve docs"
45+
}
4646
}

0 commit comments

Comments
 (0)