Skip to content

Commit 0b783d7

Browse files
committed
bump theme + vitepress, make search box lazy
1 parent 14d0e5a commit 0b783d7

File tree

5 files changed

+56
-48
lines changed

5 files changed

+56
-48
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
},
77
"dependencies": {
88
"@vue/repl": "^0.4.7",
9-
"@vue/theme": "^0.1.20",
10-
"vitepress": "^0.20.8",
9+
"@vue/theme": "^0.1.22",
10+
"vitepress": "^0.20.9",
1111
"vue": "^3.2.25"
1212
},
1313
"devDependencies": {

pnpm-lock.yaml

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

src/.vitepress/config.ts

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -478,43 +478,6 @@ export const sidebar = {
478478
export default defineConfig({
479479
extends: baseConfig,
480480

481-
vite: {
482-
define: {
483-
__VUE_OPTIONS_API__: false
484-
},
485-
optimizeDeps: {
486-
exclude: ['@vue/repl']
487-
},
488-
// @ts-ignore
489-
ssr: {
490-
external: ['@vue/repl']
491-
},
492-
server: {
493-
host: true,
494-
fs: {
495-
// for when developing with locally linked theme
496-
allow: ['../..']
497-
}
498-
},
499-
build: {
500-
minify: 'terser',
501-
chunkSizeWarningLimit: Infinity
502-
},
503-
json: {
504-
stringify: true
505-
}
506-
},
507-
508-
vue: {
509-
template: {
510-
compilerOptions: {
511-
directiveTransforms: {
512-
focus: () => ({ props: [] })
513-
}
514-
}
515-
}
516-
},
517-
518481
lang: 'en-US',
519482
title: 'Vue.js',
520483
description: 'Vue.js - The Progressive JavaScript Framework',
@@ -570,5 +533,42 @@ export default defineConfig({
570533
},
571534
copyright: 'Copyright © 2014-2021 Evan You'
572535
}
536+
},
537+
538+
vite: {
539+
define: {
540+
__VUE_OPTIONS_API__: false
541+
},
542+
optimizeDeps: {
543+
exclude: ['@vue/repl']
544+
},
545+
// @ts-ignore
546+
ssr: {
547+
external: ['@vue/repl']
548+
},
549+
server: {
550+
host: true,
551+
fs: {
552+
// for when developing with locally linked theme
553+
allow: ['../..']
554+
}
555+
},
556+
build: {
557+
minify: 'terser',
558+
chunkSizeWarningLimit: Infinity
559+
},
560+
json: {
561+
stringify: true
562+
}
563+
},
564+
565+
vue: {
566+
template: {
567+
compilerOptions: {
568+
directiveTransforms: {
569+
focus: () => ({ props: [] })
570+
}
571+
}
572+
}
573573
}
574574
})

src/api/ApiIndex.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
<script setup lang="ts">
2-
import { APIGroup, data as apiIndex } from './api.data'
2+
// in .vue components or .md pages:
3+
// named import "data" is the resolved static data
4+
// can also import types for type consistency
5+
import { data as apiIndex, APIGroup } from './api.data'
36
import { ref, computed } from 'vue'
47
58
const query = ref('')

src/api/api.data.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// api.data.ts
2+
// a file ending with data.(j|t)s will be evaluated in Node.js
13
import fs from 'fs'
24
import path from 'path'
35
import { sidebar } from '../.vitepress/config'
@@ -11,10 +13,13 @@ export interface APIGroup {
1113
}[]
1214
}
1315

16+
// declare resolved data type
1417
export declare const data: APIGroup[]
1518

1619
export default {
20+
// declare files that should trigger HMR
1721
watch: './*.md',
22+
// read from fs and generate the data
1823
load(): APIGroup[] {
1924
return sidebar['/api/'].map((group) => ({
2025
text: group.text,

0 commit comments

Comments
 (0)