/
bundle-web.ts
48 lines (43 loc) · 1.35 KB
/
bundle-web.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import type { HighlighterGeneric } from '@shikijs/core'
import { createSingletonShorthands, createdBundledHighlighter } from './core'
import type { BundledLanguage } from './assets/langs-bundle-web'
import type { BundledTheme } from './themes'
import { bundledLanguages } from './assets/langs-bundle-web'
import { bundledThemes } from './themes'
import { getWasmInlined } from './wasm-dynamic'
export * from './core'
export * from './themes'
export * from './assets/langs-bundle-web'
export { getWasmInlined }
export type Highlighter = HighlighterGeneric<BundledLanguage, BundledTheme>
/**
* Initiate a highlighter instance and load the specified languages and themes.
* Later it can be used synchronously to highlight code.
*
* Importing this function will bundle all languages and themes.
* @see https://shiki.style/guide/bundles#shiki-bundle-web
*
* For granular control over the bundle, check:
* @see https://shiki.style/guide/install#fine-grained-bundle
*/
export const getHighlighter = /* @__PURE__ */ createdBundledHighlighter<
BundledLanguage,
BundledTheme
>(
bundledLanguages,
bundledThemes,
getWasmInlined,
)
export const {
codeToHtml,
codeToHast,
codeToTokensBase,
codeToTokens,
codeToTokensWithThemes,
getSingletonHighlighter,
} = /* @__PURE__ */ createSingletonShorthands<
BundledLanguage,
BundledTheme
>(
getHighlighter,
)