-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathshiki.bundle.b.ts
More file actions
96 lines (90 loc) · 2.57 KB
/
Copy pathshiki.bundle.b.ts
File metadata and controls
96 lines (90 loc) · 2.57 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/* Generate by @shikijs/codegen */
import type {
DynamicImportLanguageRegistration,
DynamicImportThemeRegistration,
HighlighterGeneric,
} from '@shikijs/types'
import {
createBundledHighlighter,
createSingletonShorthands,
} from '@shikijs/core'
import { createJavaScriptRegexEngine } from '@shikijs/engine-javascript'
type BundledLanguage =
| 'typescript'
| 'ts'
| 'cts'
| 'mts'
| 'javascript'
| 'js'
| 'cjs'
| 'mjs'
| 'html'
| 'xml'
| 'json'
| 'diff'
| 'dotenv'
| 'css'
| 'json5'
| 'jsonc'
| 'jsonl'
| 'regexp'
| 'regex'
type BundledTheme = 'light-plus' | 'dark-plus'
type Highlighter = HighlighterGeneric<BundledLanguage, BundledTheme>
const bundledLanguages = {
typescript: () => import('@shikijs/langs/typescript'),
ts: () => import('@shikijs/langs/typescript'),
cts: () => import('@shikijs/langs/typescript'),
mts: () => import('@shikijs/langs/typescript'),
javascript: () => import('@shikijs/langs/javascript'),
js: () => import('@shikijs/langs/javascript'),
cjs: () => import('@shikijs/langs/javascript'),
mjs: () => import('@shikijs/langs/javascript'),
html: () => import('@shikijs/langs/html'),
xml: () => import('@shikijs/langs/xml'),
json: () => import('@shikijs/langs/json'),
diff: () => import('@shikijs/langs/diff'),
dotenv: () => import('@shikijs/langs/dotenv'),
css: () => import('@shikijs/langs/css'),
json5: () => import('@shikijs/langs/json5'),
jsonc: () => import('@shikijs/langs/jsonc'),
jsonl: () => import('@shikijs/langs/jsonl'),
regexp: () => import('@shikijs/langs/regexp'),
regex: () => import('@shikijs/langs/regexp'),
} as Record<BundledLanguage, DynamicImportLanguageRegistration>
const bundledThemes = {
'light-plus': () => import('@shikijs/themes/light-plus'),
'dark-plus': () => import('@shikijs/themes/dark-plus'),
} as Record<BundledTheme, DynamicImportThemeRegistration>
const createHighlighter = /* @__PURE__ */ createBundledHighlighter<
BundledLanguage,
BundledTheme
>({
langs: bundledLanguages,
themes: bundledThemes,
engine: () => createJavaScriptRegexEngine(),
})
const {
codeToHtml,
codeToHast,
codeToTokensBase,
codeToTokens,
codeToTokensWithThemes,
getSingletonHighlighter,
getLastGrammarState,
} = /* @__PURE__ */ createSingletonShorthands<BundledLanguage, BundledTheme>(
createHighlighter,
)
export {
bundledLanguages,
bundledThemes,
codeToHast,
codeToHtml,
codeToTokens,
codeToTokensBase,
codeToTokensWithThemes,
createHighlighter,
getLastGrammarState,
getSingletonHighlighter,
}
export type { BundledLanguage, BundledTheme, Highlighter }