You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
vitepress/src/node/worker_shikiResolveLang.ts

15 lines
386 B

import { bundledLanguages, type DynamicImportLanguageRegistration } from 'shiki'
import { runAsWorker } from 'synckit'
async function resolveLang(lang: string) {
return (
(bundledLanguages as Record<string, DynamicImportLanguageRegistration>)
[lang]?.()
.then((m) => m.default) || []
)
}
runAsWorker(resolveLang)
export type ShikiResolveLang = typeof resolveLang