From 7768255b863be4a141d0c551cd3425faee19238e Mon Sep 17 00:00:00 2001 From: Jonson Petard <41122242+greenhat616@users.noreply.github.com> Date: Mon, 15 Jan 2024 19:51:49 +0800 Subject: [PATCH] fix(vite): rm useless shikiji langs support (#267) --- src/utils/shiki.ts | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/utils/shiki.ts b/src/utils/shiki.ts index fa8bb48a52..1840219171 100644 --- a/src/utils/shiki.ts +++ b/src/utils/shiki.ts @@ -1,12 +1,19 @@ -import { getHighlighter, type Highlighter } from "shikiji"; +import type { Highlighter } from "shikiji"; +import { getHighlighterCore } from "shikiji/core"; + +import minLight from "shikiji/themes/min-light.mjs"; +import nord from "shikiji/themes/nord.mjs"; +import getWasm from "shikiji/wasm"; let shiki: Highlighter | null = null; export async function getShikiSingleton() { if (!shiki) { - shiki = await getHighlighter({ - themes: ["nord", "min-light"], - langs: ["ansi"], + shiki = await getHighlighterCore({ + themes: [nord, minLight], + langs: [], + + loadWasm: getWasm, }); } return shiki;