chore: removed barrel import of shiki languages 9d0a5825
Steve · 2026-04-30 20:35 2 file(s) · +20 −22
src/pages/git.astro +2 −2
2 2
import PageLayout from "@/layouts/Base.astro";
3 3
import { createHighlighterCore, type ThemeRegistrationRaw } from "shiki/core";
4 4
import { createJavaScriptRegexEngine } from "shiki/engine/javascript";
5 -
import { bundledLanguages } from "shiki";
5 +
import bash from "@shikijs/langs/bash";
6 6
import darkmatter from "../../darkmatter.json";
7 7
8 8
const meta = {
12 12
13 13
const highlighter = await createHighlighterCore({
14 14
	themes: [darkmatter as unknown as ThemeRegistrationRaw],
15 -
	langs: [bundledLanguages.bash],
15 +
	langs: [bash],
16 16
	engine: createJavaScriptRegexEngine(),
17 17
});
18 18
src/utils/markdown.ts +18 −20
1 1
import MarkdownIt from "markdown-it";
2 2
import { createHighlighterCore, type ThemeRegistrationRaw } from "shiki/core";
3 3
import { createJavaScriptRegexEngine } from "shiki/engine/javascript";
4 -
import { bundledLanguages } from "shiki";
5 4
import darkmatter from "../../darkmatter.json";
6 5
7 6
const LANGS = [
8 -
	"javascript",
9 -
	"typescript",
10 -
	"jsx",
11 -
	"tsx",
12 -
	"python",
13 -
	"bash",
14 -
	"shell",
15 -
	"json",
16 -
	"html",
17 -
	"css",
18 -
	"rust",
19 -
	"go",
20 -
	"markdown",
21 -
	"yaml",
22 -
	"toml",
23 -
	"text",
24 -
	"lua",
25 -
] as const;
7 +
	import("@shikijs/langs/javascript"),
8 +
	import("@shikijs/langs/typescript"),
9 +
	import("@shikijs/langs/jsx"),
10 +
	import("@shikijs/langs/tsx"),
11 +
	import("@shikijs/langs/python"),
12 +
	import("@shikijs/langs/bash"),
13 +
	import("@shikijs/langs/shellscript"),
14 +
	import("@shikijs/langs/json"),
15 +
	import("@shikijs/langs/html"),
16 +
	import("@shikijs/langs/css"),
17 +
	import("@shikijs/langs/rust"),
18 +
	import("@shikijs/langs/go"),
19 +
	import("@shikijs/langs/markdown"),
20 +
	import("@shikijs/langs/yaml"),
21 +
	import("@shikijs/langs/toml"),
22 +
	import("@shikijs/langs/lua"),
23 +
];
26 24
27 25
export async function createMarkdownRenderer(): Promise<MarkdownIt> {
28 26
	const highlighter = await createHighlighterCore({
29 27
		themes: [darkmatter as unknown as ThemeRegistrationRaw],
30 -
		langs: LANGS.map((l) => bundledLanguages[l]),
28 +
		langs: LANGS,
31 29
		engine: createJavaScriptRegexEngine(),
32 30
	});
33 31