Skip to content

Commit

Permalink
chore: fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Sep 23, 2024
1 parent 90a8f1f commit 657b5fc
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/components/SnippetPreview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ async function onShow() {
const highlightCode = computedAsync(async () => {
const c = code.value
const formatted = await prettierCode(c, props.snippet.prettierParser)
const formatted = (await prettierCode(c, props.snippet.prettierParser)).trim()
return highlight(formatted, props.snippet.lang)
})
</script>
Expand Down
28 changes: 10 additions & 18 deletions src/utils/shiki.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,20 @@
import type { HighlighterCore } from 'shiki/core'
import { createHighlighterCore } from 'shiki/core'
import langAstro from 'shiki/langs/astro.mjs'
import langHtml from 'shiki/langs/html.mjs'
import langJsx from 'shiki/langs/jsx.mjs'
import langSvelte from 'shiki/langs/svelte.mjs'
import langTsx from 'shiki/langs/tsx.mjs'
import langVue from 'shiki/langs/vue.mjs'
import vitesseDark from 'shiki/themes/vitesse-dark.mjs'
import vitesseLight from 'shiki/themes/vitesse-light.mjs'
import { createHighlighterCore, createJavaScriptRegexEngine } from 'shiki/core'

export const shiki = computedAsync<HighlighterCore>(async (onCancel) => {
const shiki = await createHighlighterCore({
loadWasm: () => import('shiki/wasm'),
engine: createJavaScriptRegexEngine(),
themes: [
vitesseDark,
vitesseLight,
() => import('shiki/themes/vitesse-dark.mjs'),
() => import('shiki/themes/vitesse-light.mjs'),
],
langs: [
langHtml,
langJsx,
langTsx,
langVue,
langAstro,
langSvelte,
() => import('shiki/langs/html.mjs'),
() => import('shiki/langs/jsx.mjs'),
() => import('shiki/langs/tsx.mjs'),
() => import('shiki/langs/vue.mjs'),
() => import('shiki/langs/astro.mjs'),
() => import('shiki/langs/svelte.mjs'),
],
})

Expand Down
3 changes: 3 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ export default defineConfig(({ mode }) => {
},
],
},
injectManifest: {
maximumFileSizeToCacheInBytes: 5 * 1024 * 1024,
},
integration: {
configureOptions(viteConfig, options) {
if (viteConfig.command === 'build')
Expand Down

0 comments on commit 657b5fc

Please sign in to comment.