rn-shiki 0.0.9 → 0.0.10

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.9",
4
+ "version": "0.0.10",
5
5
  "description": "Shiki syntax highlighter for React Native.",
6
6
  "author": "Ryan Skinner <hello@ryanskinner.com>",
7
7
  "license": "MIT",
package/src/index.ts CHANGED
@@ -1,3 +1 @@
1
1
  export { SyntaxHighlighter, SyntaxLine } from './components/syntax'
2
- export { getLanguage } from './langs'
3
- export { getTheme } from './themes'
package/src/langs.ts DELETED
@@ -1,20 +0,0 @@
1
- import type { LanguageInput } from 'shiki'
2
- import manifest from '../vendor/shiki/manifest.json'
3
-
4
- export type AvailableLanguage = keyof typeof manifest.langs
5
-
6
- export const Languages = Object.keys(manifest.langs).reduce((acc, lang) => {
7
- const key = lang.replace(/-/g, '_').toUpperCase()
8
- return { ...acc, [key]: lang as AvailableLanguage }
9
- }, {} as Record<string, AvailableLanguage>)
10
-
11
- export async function getLanguage(langName: AvailableLanguage): Promise<LanguageInput> {
12
- try {
13
- const lang = await import(`../vendor/shiki/langs/${String(langName)}.js`)
14
- return lang.default
15
- }
16
- catch (err) {
17
- const error = err instanceof Error ? err.message : String(err)
18
- throw new Error(`Language '${String(langName)}' failed to load: ${error}`)
19
- }
20
- }
package/src/themes.ts DELETED
@@ -1,20 +0,0 @@
1
- import type { ThemeInput } from 'shiki'
2
- import manifest from '../vendor/shiki/manifest.json'
3
-
4
- export type AvailableTheme = keyof typeof manifest.themes
5
-
6
- export const Themes = Object.keys(manifest.themes).reduce<Record<string, AvailableTheme>>((acc, theme) => {
7
- const key = (theme as AvailableTheme).replace(/-/g, '_').toUpperCase()
8
- return { ...acc, [key]: theme as AvailableTheme }
9
- }, {} as Record<string, AvailableTheme>)
10
-
11
- export async function getTheme(themeName: AvailableTheme): Promise<ThemeInput> {
12
- try {
13
- const theme = await import(`../vendor/shiki/themes/${String(themeName)}.js`)
14
- return theme.default
15
- }
16
- catch (err) {
17
- const error = err instanceof Error ? err.message : String(err)
18
- throw new Error(`Theme '${String(themeName)}' failed to load: ${error}`)
19
- }
20
- }