rn-shiki 0.0.3 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +1 -1
- package/src/syntax/highlighter/index.ts +21 -21
package/package.json
CHANGED
@@ -1,38 +1,38 @@
|
|
1
1
|
import type { LanguageInput, ThemedToken, ThemeInput } from 'shiki'
|
2
2
|
import type { TokenType } from '../../types'
|
3
3
|
import { createHighlighterCore } from 'shiki/core'
|
4
|
-
import { createJavaScriptRegexEngine } from 'shiki/engine
|
4
|
+
import { createJavaScriptRegexEngine } from 'shiki/engine/javascript'
|
5
5
|
|
6
|
-
// Import
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
6
|
+
// Import grammar JSON files using require
|
7
|
+
const cssGrammar = require('tm-grammars/grammars/css.json')
|
8
|
+
const htmlGrammar = require('tm-grammars/grammars/html.json')
|
9
|
+
const javascriptGrammar = require('tm-grammars/grammars/javascript.json')
|
10
|
+
const jsonGrammar = require('tm-grammars/grammars/json.json')
|
11
|
+
const phpGrammar = require('tm-grammars/grammars/php.json')
|
12
|
+
const typescriptGrammar = require('tm-grammars/grammars/typescript.json')
|
13
13
|
|
14
|
-
// Import
|
15
|
-
|
16
|
-
|
14
|
+
// Import theme JSON files using require
|
15
|
+
const githubDarkTheme = require('tm-themes/themes/github-dark.json')
|
16
|
+
const githubLightTheme = require('tm-themes/themes/github-light.json')
|
17
17
|
|
18
18
|
// Define supported languages and themes explicitly
|
19
19
|
export type SupportedLanguage = 'css' | 'html' | 'javascript' | 'json' | 'php' | 'typescript'
|
20
20
|
export type SupportedTheme = 'github-dark' | 'github-light'
|
21
21
|
|
22
|
-
//
|
22
|
+
// Use full grammar definitions
|
23
23
|
const LANGUAGE_IMPORTS: Record<SupportedLanguage, LanguageInput> = {
|
24
|
-
css,
|
25
|
-
html,
|
26
|
-
javascript,
|
27
|
-
json,
|
28
|
-
php,
|
29
|
-
typescript,
|
24
|
+
css: cssGrammar,
|
25
|
+
html: htmlGrammar,
|
26
|
+
javascript: javascriptGrammar,
|
27
|
+
json: jsonGrammar,
|
28
|
+
php: phpGrammar,
|
29
|
+
typescript: typescriptGrammar,
|
30
30
|
}
|
31
31
|
|
32
|
-
//
|
32
|
+
// Use full theme definitions
|
33
33
|
const THEME_IMPORTS: Record<SupportedTheme, ThemeInput> = {
|
34
|
-
'github-dark':
|
35
|
-
'github-light':
|
34
|
+
'github-dark': githubDarkTheme,
|
35
|
+
'github-light': githubLightTheme,
|
36
36
|
}
|
37
37
|
|
38
38
|
// Singleton highlighter instance with tracking
|