rn-shiki 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "rn-shiki",
3
3
  "type": "module",
4
- "version": "0.0.3",
4
+ "version": "0.0.4",
5
5
  "description": "Shiki syntax highlighter for React Native.",
6
6
  "author": "Ryan Skinner <hello@ryanskinner.com>",
7
7
  "license": "MIT",
@@ -3,36 +3,36 @@ import type { TokenType } from '../../types'
3
3
  import { createHighlighterCore } from 'shiki/core'
4
4
  import { createJavaScriptRegexEngine } from 'shiki/engine-javascript.mjs'
5
5
 
6
- // Import languages
7
- import css from 'shiki/langs/css.mjs'
8
- import html from 'shiki/langs/html.mjs'
9
- import javascript from 'shiki/langs/javascript.mjs'
10
- import json from 'shiki/langs/json.mjs'
11
- import php from 'shiki/langs/php.mjs'
12
- import typescript from 'shiki/langs/typescript.mjs'
13
-
14
- // Import themes
15
- import githubDark from 'shiki/themes/github-dark.mjs'
16
- import githubLight from 'shiki/themes/github-light.mjs'
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
+
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
- // Bundled languages mapping - using the imported grammars directly
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
- // Bundled themes mapping
32
+ // Use full theme definitions
33
33
  const THEME_IMPORTS: Record<SupportedTheme, ThemeInput> = {
34
- 'github-dark': githubDark,
35
- 'github-light': githubLight,
34
+ 'github-dark': githubDarkTheme,
35
+ 'github-light': githubLightTheme,
36
36
  }
37
37
 
38
38
  // Singleton highlighter instance with tracking