Skip to content

Commit 5663c71

Browse files
committed
fix: vitepress documentation build | update dependencies
Signed-off-by: Ferdinand Thiessen <[email protected]>
1 parent a105803 commit 5663c71

File tree

8 files changed

+3583
-1529
lines changed

8 files changed

+3583
-1529
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ coverage
2222

2323
# genereated file
2424
docs/components
25+
docs/.vitepress
2526

2627
# Docs compiled build
2728
styleguide/*

docs/.vitepress/config.mjs

+2-3
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ import * as path from "path";
22
import * as fs from 'fs'
33
import { fileURLToPath } from "url";
44
import { defineConfig } from "vitepress";
5-
// Not supported with vite4, wait for next release "vitepress-plugin-search": "^1.0.4-alpha.16",
6-
// import { SearchPlugin } from 'vitepress-plugin-search'
5+
import { SearchPlugin } from 'vitepress-plugin-search'
76
import PackageJSON from '../../package.json'
87
import vueLiveMd from './vue-live-md-it.mjs'
98

@@ -100,7 +99,7 @@ export default defineConfig({
10099

101100
outDir: '../styleguide',
102101
vite: {
103-
plugins: [vueDocsPlugin /*, SearchPlugin()*/],
102+
plugins: [vueDocsPlugin, SearchPlugin()],
104103
},
105104

106105
markdown: {

docs/.vitepress/theme/components/vue-live-with-layout.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { h, onMounted, ref, defineComponent } from "vue"
1+
import { h, onMounted, ref, defineComponent, markRaw } from "vue"
22
import { VueLive } from "vue-live";
33
import layout from "./vue-live-layout.vue";
44

@@ -9,13 +9,13 @@ export default defineComponent({
99
const props = {...attrs}
1010
onMounted(async () => {
1111
const NcComponents = (await import('../../../../dist/index.esm.js')).NcComponents
12+
props.components = markRaw({...NcComponents})
1213
if ("requires" in props) {
13-
props.requires = {}
14+
props.requires = markRaw({})
1415
await Promise.allSettled(Object.keys(attrs.requires).map(async (key) => {
1516
props.requires[key] = (await attrs.requires[key]).default
1617
}))
1718
}
18-
props.components = {...NcComponents}
1919
ready.value = true
2020
})
2121
// return the render function

docs/.vitepress/vue-live-md-it.mjs

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function addVueLive(md, opts) {
2525
// put all requires into a "requires" object
2626
// add this as a prop
2727
const imports = getImports(code)
28-
const requires = imports.map(mod => `'${mod[1]}': import('../../node_modules/${mod[1]}${mod[1].startsWith('vue-material-design') ? '.vue' : ''}')`)
28+
const requires = imports.map(mod => `"${mod[1]}": import("../../node_modules/${mod[1]}${mod[1].startsWith('vue-material-design') ? '.vue' : ''}")`)
2929
const langArray = lang.split(' ')
3030
const langClean = langArray[0]
3131
const codeClean = md.utils.escapeHtml(code).replace(/\`/g, '\\`').replace(/\$/g, '\\$')
@@ -34,7 +34,7 @@ function addVueLive(md, opts) {
3434
const markdownGenerated = `<vue-live ${jsx}
3535
:layoutProps="{lang:'${langClean}'}"
3636
:code="\`${codeClean}\`"
37-
:requires="{${requires.join(',')}}"
37+
:requires='{${requires.join(',')}}'
3838
${editorProps ? ` :editorProps="${editorProps}"` : ''}
3939
/>`
4040
return markdownGenerated

0 commit comments

Comments
 (0)