Skip to content

Commit

Permalink
feat: improve shiki bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Jan 15, 2025
1 parent abdec8d commit 3b94fb9
Show file tree
Hide file tree
Showing 4 changed files with 231 additions and 693 deletions.
11 changes: 6 additions & 5 deletions app/composables/shiki.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { HighlighterCore } from 'shiki/core'
import { createJavaScriptRegexEngine } from '@shikijs/engine-javascript'
import { createHighlighterCore } from 'shiki/core'
import { computed, shallowRef } from 'vue'
import { isDark } from './dark'
Expand All @@ -7,15 +8,15 @@ export const shiki = shallowRef<HighlighterCore>()

createHighlighterCore({
themes: [
import('shiki/themes/vitesse-light.mjs'),
import('shiki/themes/vitesse-dark.mjs'),
import('@shikijs/themes/vitesse-light'),
import('@shikijs/themes/vitesse-dark'),
],
langs: [
import('shiki/langs/javascript.mjs'),
import('shiki/langs/typescript.mjs'),
import('@shikijs/langs-precompiled/javascript'),
import('@shikijs/langs-precompiled/typescript'),
import('textmate-grammar-glob/grammars/glob.json') as any,
],
loadWasm: import('shiki/wasm'),
engine: createJavaScriptRegexEngine(),
}).then((highlighter) => {
shiki.value = highlighter
})
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"@iconify-json/twemoji": "catalog:",
"@iconify-json/vscode-icons": "catalog:",
"@nuxt/eslint": "catalog:",
"@shikijs/langs-precompiled": "catalog:",
"@shikijs/transformers": "catalog:",
"@types/connect": "catalog:",
"@types/ws": "catalog:",
Expand Down
Loading

0 comments on commit 3b94fb9

Please sign in to comment.