mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-23 08:20:39 +01:00
docs(deps): update @nuxt/content (#1310)
Co-authored-by: Benjamin Canac <canacb1@gmail.com>
This commit is contained in:
@@ -52,9 +52,14 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { transformContent } from '@nuxt/content/transformers'
|
||||
// @ts-ignore
|
||||
import { useShikiHighlighter } from '@nuxtjs/mdc/runtime'
|
||||
import { createShikiHighlighter } from '@nuxtjs/mdc/runtime/highlighter/shiki'
|
||||
import { upperFirst, camelCase, kebabCase } from 'scule'
|
||||
import MaterialTheme from 'shiki/themes/material-theme.mjs'
|
||||
import MaterialThemeLighter from 'shiki/themes/material-theme-lighter.mjs'
|
||||
import MaterialThemePalenight from 'shiki/themes/material-theme-palenight.mjs'
|
||||
import HtmlLang from 'shiki/langs/html.mjs'
|
||||
import MdcLang from 'shiki/langs/mdc.mjs'
|
||||
import VueLang from 'shiki/langs/vue.mjs'
|
||||
|
||||
// eslint-disable-next-line vue/no-dupe-keys
|
||||
const props = defineProps({
|
||||
@@ -268,8 +273,18 @@ function renderObject (obj: any) {
|
||||
return obj
|
||||
}
|
||||
|
||||
const shikiHighlighter = useShikiHighlighter({})
|
||||
const codeHighlighter = async (code: string, lang: string, theme: any, highlights: number[]) => shikiHighlighter.getHighlightedAST(code, lang, theme, { highlights })
|
||||
const highlighter = createShikiHighlighter({
|
||||
bundledThemes: {
|
||||
'material-theme': MaterialTheme,
|
||||
'material-theme-lighter': MaterialThemeLighter,
|
||||
'material-theme-palenight': MaterialThemePalenight
|
||||
},
|
||||
bundledLangs: {
|
||||
html: HtmlLang,
|
||||
mdc: MdcLang,
|
||||
vue: VueLang
|
||||
}
|
||||
})
|
||||
const { data: ast } = await useAsyncData(
|
||||
`${name}-ast-${JSON.stringify({ props: componentProps, slots: props.slots, code: props.code })}`,
|
||||
async () => {
|
||||
@@ -283,7 +298,7 @@ const { data: ast } = await useAsyncData(
|
||||
return transformContent('content:_markdown.md', formatted, {
|
||||
markdown: {
|
||||
highlight: {
|
||||
highlighter: codeHighlighter,
|
||||
highlighter,
|
||||
theme: {
|
||||
light: 'material-theme-lighter',
|
||||
default: 'material-theme',
|
||||
|
||||
@@ -22,8 +22,13 @@
|
||||
import { camelCase } from 'scule'
|
||||
import { fetchContentExampleCode } from '~/composables/useContentExamplesCode'
|
||||
import { transformContent } from '@nuxt/content/transformers'
|
||||
// @ts-ignore
|
||||
import { useShikiHighlighter } from '@nuxtjs/mdc/runtime'
|
||||
import { createShikiHighlighter } from '@nuxtjs/mdc/runtime/highlighter/shiki'
|
||||
import MaterialTheme from 'shiki/themes/material-theme.mjs'
|
||||
import MaterialThemeLighter from 'shiki/themes/material-theme-lighter.mjs'
|
||||
import MaterialThemePalenight from 'shiki/themes/material-theme-palenight.mjs'
|
||||
import HtmlLang from 'shiki/langs/html.mjs'
|
||||
import MdcLang from 'shiki/langs/mdc.mjs'
|
||||
import VueLang from 'shiki/langs/vue.mjs'
|
||||
|
||||
const props = defineProps({
|
||||
component: {
|
||||
@@ -80,12 +85,22 @@ const data = await fetchContentExampleCode(camelName)
|
||||
|
||||
const hasCode = computed(() => !props.hiddenCode && (data?.code || instance.slots.code))
|
||||
|
||||
const shikiHighlighter = useShikiHighlighter({})
|
||||
const codeHighlighter = async (code: string, lang: string, theme: any, highlights: number[]) => shikiHighlighter.getHighlightedAST(code, lang, theme, { highlights })
|
||||
const highlighter = createShikiHighlighter({
|
||||
bundledThemes: {
|
||||
'material-theme': MaterialTheme,
|
||||
'material-theme-lighter': MaterialThemeLighter,
|
||||
'material-theme-palenight': MaterialThemePalenight
|
||||
},
|
||||
bundledLangs: {
|
||||
html: HtmlLang,
|
||||
mdc: MdcLang,
|
||||
vue: VueLang
|
||||
}
|
||||
})
|
||||
const { data: ast } = await useAsyncData(`content-example-${camelName}-ast`, () => transformContent('content:_markdown.md', `\`\`\`vue\n${data?.code ?? ''}\n\`\`\``, {
|
||||
markdown: {
|
||||
highlight: {
|
||||
highlighter: codeHighlighter,
|
||||
highlighter,
|
||||
theme: {
|
||||
light: 'material-theme-lighter',
|
||||
default: 'material-theme',
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
"devDependencies": {
|
||||
"@iconify-json/heroicons": "^1.1.19",
|
||||
"@iconify-json/simple-icons": "^1.1.90",
|
||||
"@nuxt/content": "^2.11.0",
|
||||
"@nuxt/content": "^2.12.0",
|
||||
"@nuxt/devtools": "^1.0.8",
|
||||
"@nuxt/eslint-config": "^0.2.0",
|
||||
"@nuxt/image": "^1.3.0",
|
||||
|
||||
85
pnpm-lock.yaml
generated
85
pnpm-lock.yaml
generated
@@ -153,8 +153,8 @@ importers:
|
||||
specifier: ^1.1.90
|
||||
version: 1.1.90
|
||||
'@nuxt/content':
|
||||
specifier: ^2.11.0
|
||||
version: 2.11.0(nuxt@3.10.0)(rollup@3.29.4)(vue@3.4.15)
|
||||
specifier: ^2.12.0
|
||||
version: 2.12.0(nuxt@3.10.0)(rollup@3.29.4)(vue@3.4.15)
|
||||
'@nuxt/devtools':
|
||||
specifier: ^1.0.8
|
||||
version: 1.0.8(nuxt@3.10.0)(rollup@3.29.4)(vite@5.0.12)
|
||||
@@ -1578,11 +1578,11 @@ packages:
|
||||
- bluebird
|
||||
- supports-color
|
||||
|
||||
/@nuxt/content@2.11.0(nuxt@3.10.0)(rollup@3.29.4)(vue@3.4.15):
|
||||
resolution: {integrity: sha512-bHk4Vs+9k94z9WDdQcjTKWeXEkHiRsatTPx/914okegKaWz3yntt3x6NUPv6Ch3zI5JJZvepqbVPoWxuySFmmQ==}
|
||||
/@nuxt/content@2.12.0(nuxt@3.10.0)(rollup@3.29.4)(vue@3.4.15):
|
||||
resolution: {integrity: sha512-XQkbkJzFRWKdX4aoVDprqLphbQGDsRX35ZRgHe4i7Phe3F1z2EzXVhZ9WXBTmpXau3MkLlmsQ+NzcRns1kOOvQ==}
|
||||
dependencies:
|
||||
'@nuxt/kit': 3.10.0(rollup@3.29.4)
|
||||
'@nuxtjs/mdc': 0.3.2(rollup@3.29.4)
|
||||
'@nuxtjs/mdc': 0.5.0(rollup@3.29.4)
|
||||
'@vueuse/core': 10.7.2(vue@3.4.15)
|
||||
'@vueuse/head': 2.0.0(vue@3.4.15)
|
||||
'@vueuse/nuxt': 10.7.2(nuxt@3.10.0)(rollup@3.29.4)(vue@3.4.15)
|
||||
@@ -1601,7 +1601,7 @@ packages:
|
||||
ohash: 1.1.3
|
||||
pathe: 1.1.2
|
||||
scule: 1.2.0
|
||||
shikiji: 0.9.19
|
||||
shiki: 1.0.0-rc.0
|
||||
slugify: 1.6.6
|
||||
socket.io-client: 4.7.4
|
||||
ufo: 1.3.2
|
||||
@@ -2169,14 +2169,16 @@ packages:
|
||||
- supports-color
|
||||
dev: true
|
||||
|
||||
/@nuxtjs/mdc@0.3.2(rollup@3.29.4):
|
||||
resolution: {integrity: sha512-iSepiwfNCh5dgO3ETqSdBHWdendRuRIZ7OsgIpEQXX2J9ubHK5XvRsK3DSUOqZZ8PHbRZ3eSr/9ZF9+IeZ0GFw==}
|
||||
/@nuxtjs/mdc@0.5.0(rollup@3.29.4):
|
||||
resolution: {integrity: sha512-480Ajc7o/YAl9b21btd0oRtVe/UjUWmVSEWauS+H+izwEGdGvJTVfZRdaiAXcXKl+UmUTpf+POel027sE9HAZQ==}
|
||||
dependencies:
|
||||
'@nuxt/kit': 3.10.0(rollup@3.29.4)
|
||||
'@types/hast': 3.0.3
|
||||
'@shikijs/transformers': 1.0.0-rc.0
|
||||
'@types/hast': 3.0.4
|
||||
'@types/mdast': 4.0.3
|
||||
'@vue/compiler-core': 3.4.15
|
||||
consola: 3.2.3
|
||||
debug: 4.3.4
|
||||
defu: 6.1.4
|
||||
destr: 2.0.2
|
||||
detab: 3.0.2
|
||||
@@ -2185,6 +2187,8 @@ packages:
|
||||
mdast-util-to-hast: 13.1.0
|
||||
micromark-util-sanitize-uri: 2.0.0
|
||||
ohash: 1.1.3
|
||||
parse5: 7.1.2
|
||||
pathe: 1.1.2
|
||||
property-information: 6.4.1
|
||||
rehype-external-links: 3.0.0
|
||||
rehype-raw: 7.0.0
|
||||
@@ -2197,8 +2201,7 @@ packages:
|
||||
remark-parse: 11.0.0
|
||||
remark-rehype: 11.1.0
|
||||
scule: 1.2.0
|
||||
shikiji: 0.9.19
|
||||
shikiji-transformers: 0.9.19
|
||||
shiki: 1.0.0-rc.0
|
||||
ufo: 1.3.2
|
||||
unified: 11.0.4
|
||||
unist-builder: 4.0.0
|
||||
@@ -2972,6 +2975,16 @@ packages:
|
||||
resolution: {integrity: sha512-RbhOOTCNoCrbfkRyoXODZp75MlpiHMgbE5MEBZAnnnLyQNgrigEj4p0lzsMDyc1zVsJDLrivB58tgg3emX0eEA==}
|
||||
dev: true
|
||||
|
||||
/@shikijs/core@1.0.0-rc.0:
|
||||
resolution: {integrity: sha512-j/7te+hvEYlQTvk/wPoA+1rOklZTz8QuyqVvV81KcEN/g1WXKVnqp9WZ7jFuv0ZVLqBtDx/V8viRDROJniyMLA==}
|
||||
dev: true
|
||||
|
||||
/@shikijs/transformers@1.0.0-rc.0:
|
||||
resolution: {integrity: sha512-1W4QpLKDM+hnlO6vqGre7orZxW4CrnO4F1zftj1KE6MdaEvy1awZKYUXPswvDIARvuetbzTvgc/ZE2yYVT/6GA==}
|
||||
dependencies:
|
||||
shiki: 1.0.0-rc.0
|
||||
dev: true
|
||||
|
||||
/@shuding/opentype.js@1.4.0-beta.0:
|
||||
resolution: {integrity: sha512-3NgmNyH3l/Hv6EvsWJbsvpcpUba6R8IREQ83nH83cyakCw7uM1arZKNfHwv1Wz6jgqrF/j4x5ELvR6PnK9nTcA==}
|
||||
engines: {node: '>= 8.0.0'}
|
||||
@@ -3182,8 +3195,8 @@ packages:
|
||||
'@types/node': 20.11.10
|
||||
dev: true
|
||||
|
||||
/@types/hast@3.0.3:
|
||||
resolution: {integrity: sha512-2fYGlaDy/qyLlhidX42wAH0KBi2TCjKMH8CHmBXgRlJ3Y+OXTiqsPQ6IWarZKwF1JoUcAJdPogv1d4b0COTpmQ==}
|
||||
/@types/hast@3.0.4:
|
||||
resolution: {integrity: sha512-WPs+bbQw5aCj+x6laNGWLH3wviHtoCv/P3+otBhbOhJgG8qtpdAMlTCxLtsTWA7LH1Oh/bFCHsBn0TPS5m30EQ==}
|
||||
dependencies:
|
||||
'@types/unist': 3.0.2
|
||||
dev: true
|
||||
@@ -6813,7 +6826,7 @@ packages:
|
||||
/hast-util-from-parse5@8.0.1:
|
||||
resolution: {integrity: sha512-Er/Iixbc7IEa7r/XLtuG52zoqn/b3Xng/w6aZQ0xGVxzhw5xUFxcRqdPzP6yFi/4HBYRaifaI5fQ1RH8n0ZeOQ==}
|
||||
dependencies:
|
||||
'@types/hast': 3.0.3
|
||||
'@types/hast': 3.0.4
|
||||
'@types/unist': 3.0.2
|
||||
devlop: 1.1.0
|
||||
hastscript: 8.0.0
|
||||
@@ -6826,25 +6839,25 @@ packages:
|
||||
/hast-util-heading-rank@3.0.0:
|
||||
resolution: {integrity: sha512-EJKb8oMUXVHcWZTDepnr+WNbfnXKFNf9duMesmr4S8SXTJBJ9M4Yok08pu9vxdJwdlGRhVumk9mEhkEvKGifwA==}
|
||||
dependencies:
|
||||
'@types/hast': 3.0.3
|
||||
'@types/hast': 3.0.4
|
||||
dev: true
|
||||
|
||||
/hast-util-is-element@3.0.0:
|
||||
resolution: {integrity: sha512-Val9mnv2IWpLbNPqc/pUem+a7Ipj2aHacCwgNfTiK0vJKl0LF+4Ba4+v1oPHFpf3bLYmreq0/l3Gud9S5OH42g==}
|
||||
dependencies:
|
||||
'@types/hast': 3.0.3
|
||||
'@types/hast': 3.0.4
|
||||
dev: true
|
||||
|
||||
/hast-util-parse-selector@4.0.0:
|
||||
resolution: {integrity: sha512-wkQCkSYoOGCRKERFWcxMVMOcYE2K1AaNLU8DXS9arxnLOUEWbOXKXiJUNzEpqZ3JOKpnha3jkFrumEjVliDe7A==}
|
||||
dependencies:
|
||||
'@types/hast': 3.0.3
|
||||
'@types/hast': 3.0.4
|
||||
dev: true
|
||||
|
||||
/hast-util-raw@9.0.2:
|
||||
resolution: {integrity: sha512-PldBy71wO9Uq1kyaMch9AHIghtQvIwxBUkv823pKmkTM3oV1JxtsTNYdevMxvUHqcnOAuO65JKU2+0NOxc2ksA==}
|
||||
dependencies:
|
||||
'@types/hast': 3.0.3
|
||||
'@types/hast': 3.0.4
|
||||
'@types/unist': 3.0.2
|
||||
'@ungap/structured-clone': 1.2.0
|
||||
hast-util-from-parse5: 8.0.1
|
||||
@@ -6862,7 +6875,7 @@ packages:
|
||||
/hast-util-to-parse5@8.0.0:
|
||||
resolution: {integrity: sha512-3KKrV5ZVI8if87DVSi1vDeByYrkGzg4mEfeu4alwgmmIeARiBLKCZS2uw5Gb6nU9x9Yufyj3iudm6i7nl52PFw==}
|
||||
dependencies:
|
||||
'@types/hast': 3.0.3
|
||||
'@types/hast': 3.0.4
|
||||
comma-separated-tokens: 2.0.3
|
||||
devlop: 1.1.0
|
||||
property-information: 6.4.1
|
||||
@@ -6874,13 +6887,13 @@ packages:
|
||||
/hast-util-to-string@3.0.0:
|
||||
resolution: {integrity: sha512-OGkAxX1Ua3cbcW6EJ5pT/tslVb90uViVkcJ4ZZIMW/R33DX/AkcJcRrPebPwJkHYwlDHXz4aIwvAAaAdtrACFA==}
|
||||
dependencies:
|
||||
'@types/hast': 3.0.3
|
||||
'@types/hast': 3.0.4
|
||||
dev: true
|
||||
|
||||
/hastscript@8.0.0:
|
||||
resolution: {integrity: sha512-dMOtzCEd3ABUeSIISmrETiKuyydk1w0pa+gE/uormcTpSYuaNJPbX1NU3JLyscSLjwAQM8bWMhhIlnCqnRvDTw==}
|
||||
dependencies:
|
||||
'@types/hast': 3.0.3
|
||||
'@types/hast': 3.0.4
|
||||
comma-separated-tokens: 2.0.3
|
||||
hast-util-parse-selector: 4.0.0
|
||||
property-information: 6.4.1
|
||||
@@ -8152,7 +8165,7 @@ packages:
|
||||
/mdast-util-to-hast@13.1.0:
|
||||
resolution: {integrity: sha512-/e2l/6+OdGp/FB+ctrJ9Avz71AN/GRH3oi/3KAx/kMnoUsD6q0woXlDT8lLEeViVKE7oZxE7RXzvO3T8kF2/sA==}
|
||||
dependencies:
|
||||
'@types/hast': 3.0.3
|
||||
'@types/hast': 3.0.4
|
||||
'@types/mdast': 4.0.3
|
||||
'@ungap/structured-clone': 1.2.0
|
||||
devlop: 1.1.0
|
||||
@@ -10346,7 +10359,7 @@ packages:
|
||||
/rehype-external-links@3.0.0:
|
||||
resolution: {integrity: sha512-yp+e5N9V3C6bwBeAC4n796kc86M4gJCdlVhiMTxIrJG5UHDMh+PJANf9heqORJbt1nrCbDwIlAZKjANIaVBbvw==}
|
||||
dependencies:
|
||||
'@types/hast': 3.0.3
|
||||
'@types/hast': 3.0.4
|
||||
'@ungap/structured-clone': 1.2.0
|
||||
hast-util-is-element: 3.0.0
|
||||
is-absolute-url: 4.0.1
|
||||
@@ -10357,7 +10370,7 @@ packages:
|
||||
/rehype-raw@7.0.0:
|
||||
resolution: {integrity: sha512-/aE8hCfKlQeA8LmyeyQvQF3eBiLRGNlfBJEvWH7ivp9sBqs7TNqBL5X3v157rM4IFETqDnIOO+z5M/biZbo9Ww==}
|
||||
dependencies:
|
||||
'@types/hast': 3.0.3
|
||||
'@types/hast': 3.0.4
|
||||
hast-util-raw: 9.0.2
|
||||
vfile: 6.0.1
|
||||
dev: true
|
||||
@@ -10365,7 +10378,7 @@ packages:
|
||||
/rehype-slug@6.0.0:
|
||||
resolution: {integrity: sha512-lWyvf/jwu+oS5+hL5eClVd3hNdmwM1kAC0BUvEGD19pajQMIzcNUd/k9GsfQ+FfECvX+JE+e9/btsKH0EjJT6A==}
|
||||
dependencies:
|
||||
'@types/hast': 3.0.3
|
||||
'@types/hast': 3.0.4
|
||||
github-slugger: 2.0.0
|
||||
hast-util-heading-rank: 3.0.0
|
||||
hast-util-to-string: 3.0.0
|
||||
@@ -10375,7 +10388,7 @@ packages:
|
||||
/rehype-sort-attribute-values@5.0.0:
|
||||
resolution: {integrity: sha512-dQdHdCIRnpiU+BkrLSqH+aM4lWJyLqGzv49KvH4gHj+JxYwNqvGhoTXckS3AJu4V9ZutwsTcawP0pC7PhwX0tQ==}
|
||||
dependencies:
|
||||
'@types/hast': 3.0.3
|
||||
'@types/hast': 3.0.4
|
||||
hast-util-is-element: 3.0.0
|
||||
unist-util-visit: 5.0.0
|
||||
dev: true
|
||||
@@ -10383,7 +10396,7 @@ packages:
|
||||
/rehype-sort-attributes@5.0.0:
|
||||
resolution: {integrity: sha512-6tJUH4xHFcdO85CZRwAcEtHNCzjZ9V9S0VZLgo1pzbN04qy8jiVCZ3oAxDmBVG3Rth5b1xFTDet5WG/UYZeJLQ==}
|
||||
dependencies:
|
||||
'@types/hast': 3.0.3
|
||||
'@types/hast': 3.0.4
|
||||
unist-util-visit: 5.0.0
|
||||
dev: true
|
||||
|
||||
@@ -10487,7 +10500,7 @@ packages:
|
||||
/remark-rehype@11.1.0:
|
||||
resolution: {integrity: sha512-z3tJrAs2kIs1AqIIy6pzHmAHlF1hWQ+OdY4/hv+Wxe35EhyLKcajL33iUEn3ScxtFox9nUvRufR/Zre8Q08H/g==}
|
||||
dependencies:
|
||||
'@types/hast': 3.0.3
|
||||
'@types/hast': 3.0.4
|
||||
'@types/mdast': 4.0.3
|
||||
mdast-util-to-hast: 13.1.0
|
||||
unified: 11.0.4
|
||||
@@ -10892,20 +10905,10 @@ packages:
|
||||
deprecated: Please migrate to https://github.com/antfu/shikiji
|
||||
dev: true
|
||||
|
||||
/shikiji-core@0.9.19:
|
||||
resolution: {integrity: sha512-AFJu/vcNT21t0e6YrfadZ+9q86gvPum6iywRyt1OtIPjPFe25RQnYJyxHQPMLKCCWA992TPxmEmbNcOZCAJclw==}
|
||||
dev: true
|
||||
|
||||
/shikiji-transformers@0.9.19:
|
||||
resolution: {integrity: sha512-lGLI7Z8frQrIBbhZ74/eiJtxMoCQRbpaHEB+gcfvdIy+ZFaAtXncJGnc52932/UET+Y4GyKtwwC/vjWUCp+c/Q==}
|
||||
/shiki@1.0.0-rc.0:
|
||||
resolution: {integrity: sha512-aeEjERF5qeK+YChgEv94LOjcEcjZBLd0acPaHginz0N8FvyTn2iSLhO0AtoqfvlZ8cWGCJRKLWtDApnQVQB6/Q==}
|
||||
dependencies:
|
||||
shikiji: 0.9.19
|
||||
dev: true
|
||||
|
||||
/shikiji@0.9.19:
|
||||
resolution: {integrity: sha512-Kw2NHWktdcdypCj1GkKpXH4o6Vxz8B8TykPlPuLHOGSV8VkhoCLcFOH4k19K4LXAQYRQmxg+0X/eM+m2sLhAkg==}
|
||||
dependencies:
|
||||
shikiji-core: 0.9.19
|
||||
'@shikijs/core': 1.0.0-rc.0
|
||||
dev: true
|
||||
|
||||
/side-channel@1.0.4:
|
||||
|
||||
Reference in New Issue
Block a user