rn-shiki 0.0.23 → 0.0.25
Sign up to get free protection for your applications and to get access to all the features.
- package/babel.config.js +22 -0
- package/lib/commonjs/components/syntax/SyntaxHighlighter.js +2 -2
- package/lib/commonjs/components/syntax/SyntaxHighlighter.js.map +1 -1
- package/lib/commonjs/index.js +5 -3
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/syntax/highlighter/index.js +3 -5
- package/lib/commonjs/syntax/highlighter/index.js.map +1 -1
- package/lib/commonjs/vendor/shiki/index.d.js +20 -0
- package/lib/commonjs/vendor/shiki/index.d.js.map +1 -0
- package/lib/commonjs/vendor/shiki/index.js +10 -0
- package/lib/commonjs/vendor/shiki/index.js.map +1 -0
- package/lib/commonjs/vendor/shiki/manifest.json +365 -365
- package/lib/typescript/components/syntax/SyntaxHighlighter.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +3 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/syntax/highlighter/index.d.ts +1 -1
- package/lib/typescript/syntax/highlighter/index.d.ts.map +1 -1
- package/package.json +3 -3
- package/scripts/build.js +29 -0
- package/src/components/syntax/SyntaxHighlighter.tsx +2 -2
- package/src/syntax/highlighter/index.ts +1 -3
- package/src/vendor/shiki/index.d.ts +7 -0
- package/src/vendor/shiki/index.js +8 -0
- package/src/vendor/shiki/manifest.json +365 -365
- package/tsconfig.json +2 -3
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"SyntaxHighlighter.d.ts","sourceRoot":"","sources":["../../../../src/components/syntax/SyntaxHighlighter.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;
|
1
|
+
{"version":3,"file":"SyntaxHighlighter.d.ts","sourceRoot":"","sources":["../../../../src/components/syntax/SyntaxHighlighter.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAGtD,OAAO,KAAK,MAAM,OAAO,CAAA;AAIzB,UAAU,sBAAsB;IAC9B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,aAAa,CAAA;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,UAAU,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,iBAAS,iBAAiB,CAAC,EACzB,IAAI,EACJ,IAAiB,EACjB,QAAuB,EACvB,KAAkB,EAClB,SAAyB,EACzB,QAAQ,GACT,EAAE,sBAAsB,qBA6CxB;AAED,eAAe,iBAAiB,CAAA"}
|
@@ -1,3 +1,5 @@
|
|
1
|
-
|
1
|
+
import SyntaxHighlighter from './components/syntax/SyntaxHighlighter';
|
2
|
+
import SyntaxLine from './components/syntax/SyntaxLine';
|
2
3
|
export * from './types/shiki';
|
4
|
+
export { SyntaxHighlighter, SyntaxLine };
|
3
5
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,MAAM,uCAAuC,CAAA;AACrE,OAAO,UAAU,MAAM,gCAAgC,CAAA;AAEvD,cAAc,eAAe,CAAA;AAE7B,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,CAAA"}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import type { LanguageInput, ThemedToken, ThemeInput } from 'shiki';
|
2
2
|
import type { TokenType } from '../../types';
|
3
|
-
import { createHighlighterCore } from 'vendor/shiki
|
3
|
+
import { createHighlighterCore } from '@vendor/shiki';
|
4
4
|
export declare function createHighlighter({ langs, themes }: {
|
5
5
|
langs: LanguageInput[];
|
6
6
|
themes: ThemeInput[];
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/syntax/highlighter/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AACnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,EAAE,qBAAqB,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/syntax/highlighter/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AACnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,EAAE,qBAAqB,EAA+B,MAAM,eAAe,CAAA;AAUlF,wBAAsB,iBAAiB,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;IAAE,KAAK,EAAE,aAAa,EAAE,CAAC;IAAC,MAAM,EAAE,UAAU,EAAE,CAAA;CAAE,GAAG,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC,CAAC,CAavK;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,WAAW,EAAE,GAAG,SAAS,EAAE,CAMhE"}
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "rn-shiki",
|
3
3
|
"type": "module",
|
4
|
-
"version": "0.0.
|
4
|
+
"version": "0.0.25",
|
5
5
|
"description": "Shiki syntax highlighter for React Native.",
|
6
6
|
"author": "Ryan Skinner <hello@ryanskinner.com>",
|
7
7
|
"license": "MIT",
|
@@ -41,6 +41,7 @@
|
|
41
41
|
"@eslint-react/eslint-plugin": "^1.15.0",
|
42
42
|
"@types/react": "^18.2.0",
|
43
43
|
"@types/react-native": "^0.73.0",
|
44
|
+
"babel-plugin-module-resolver": "^5.0.2",
|
44
45
|
"eslint": "^9.13.0",
|
45
46
|
"eslint-plugin-react-hooks": "^5.0.0",
|
46
47
|
"eslint-plugin-react-refresh": "^0.4.13",
|
@@ -54,8 +55,7 @@
|
|
54
55
|
"output": "lib",
|
55
56
|
"targets": [
|
56
57
|
[
|
57
|
-
"commonjs"
|
58
|
-
"module"
|
58
|
+
"commonjs"
|
59
59
|
],
|
60
60
|
[
|
61
61
|
"typescript",
|
package/scripts/build.js
CHANGED
@@ -170,6 +170,33 @@ const modules = [
|
|
170
170
|
...themeFiles,
|
171
171
|
]
|
172
172
|
|
173
|
+
function createVendorIndex() {
|
174
|
+
const vendorIndexPath = path.join(VENDOR_DIR, 'index.js')
|
175
|
+
const vendorIndexContent = `\
|
176
|
+
"use strict";
|
177
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
178
|
+
|
179
|
+
exports.createHighlighterCore = require('./core/core').createHighlighterCore;
|
180
|
+
exports.createJavaScriptRegexEngine = require('./core/engine-javascript').createJavaScriptRegexEngine;
|
181
|
+
|
182
|
+
exports.themes = {};
|
183
|
+
exports.languages = {};
|
184
|
+
`
|
185
|
+
fs.writeFileSync(vendorIndexPath, vendorIndexContent)
|
186
|
+
|
187
|
+
const vendorDtsPath = path.join(VENDOR_DIR, 'index.d.ts')
|
188
|
+
const vendorDtsContent = `\
|
189
|
+
import type { ThemeInput, LanguageInput } from 'shiki'
|
190
|
+
|
191
|
+
export { createHighlighterCore } from './core/core'
|
192
|
+
export { createJavaScriptRegexEngine } from './core/engine-javascript'
|
193
|
+
|
194
|
+
export declare const themes: Record<string, ThemeInput>
|
195
|
+
export declare const languages: Record<string, LanguageInput>
|
196
|
+
`
|
197
|
+
fs.writeFileSync(vendorDtsPath, vendorDtsContent)
|
198
|
+
}
|
199
|
+
|
173
200
|
// Initialize manifest
|
174
201
|
const manifest = {
|
175
202
|
version: JSON.parse(fs.readFileSync(path.join(__dirname, '../node_modules/shiki/package.json'), 'utf8')).version,
|
@@ -226,5 +253,7 @@ for (const module of modules) {
|
|
226
253
|
}
|
227
254
|
}
|
228
255
|
|
256
|
+
createVendorIndex()
|
257
|
+
|
229
258
|
// Write manifest
|
230
259
|
fs.writeFileSync(path.join(VENDOR_DIR, 'manifest.json'), JSON.stringify(manifest, null, 2))
|
@@ -1,9 +1,9 @@
|
|
1
1
|
import type { LanguageInput, ThemeInput } from 'shiki'
|
2
|
+
import typescript from '@vendor/shiki/langs/typescript'
|
3
|
+
import githubDark from '@vendor/shiki/themes/github-dark'
|
2
4
|
import React from 'react'
|
3
5
|
import { Text, View } from 'react-native'
|
4
6
|
import { useSyntaxHighlighter } from '../../hooks/useSyntaxHighlighter'
|
5
|
-
import typescript from '../../vendor/shiki/langs/typescript'
|
6
|
-
import githubDark from '../../vendor/shiki/themes/github-dark'
|
7
7
|
|
8
8
|
interface SyntaxHighlighterProps {
|
9
9
|
text: string
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import type { LanguageInput, ThemedToken, ThemeInput } from 'shiki'
|
2
2
|
import type { TokenType } from '../../types'
|
3
|
-
import { createHighlighterCore } from 'vendor/shiki
|
4
|
-
import { createJavaScriptRegexEngine } from 'vendor/shiki/core/engine-javascript'
|
3
|
+
import { createHighlighterCore, createJavaScriptRegexEngine } from '@vendor/shiki'
|
5
4
|
|
6
5
|
async function initializeHighlighter(langs: LanguageInput[], themes: ThemeInput[]): Promise<Awaited<ReturnType<typeof createHighlighterCore>>> {
|
7
6
|
return createHighlighterCore({
|
@@ -18,7 +17,6 @@ export async function createHighlighter({ langs, themes }: { langs: LanguageInpu
|
|
18
17
|
|
19
18
|
try {
|
20
19
|
const highlighter = await initializeHighlighter(langs, themes)
|
21
|
-
console.log('Initialized highlighter:', highlighter)
|
22
20
|
return highlighter
|
23
21
|
}
|
24
22
|
catch (error) {
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import type { ThemeInput, LanguageInput } from 'shiki'
|
2
|
+
|
3
|
+
export { createHighlighterCore } from './core/core'
|
4
|
+
export { createJavaScriptRegexEngine } from './core/engine-javascript'
|
5
|
+
|
6
|
+
export declare const themes: Record<string, ThemeInput>
|
7
|
+
export declare const languages: Record<string, LanguageInput>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
|
4
|
+
exports.createHighlighterCore = require('./core/core').createHighlighterCore;
|
5
|
+
exports.createJavaScriptRegexEngine = require('./core/engine-javascript').createJavaScriptRegexEngine;
|
6
|
+
|
7
|
+
exports.themes = {};
|
8
|
+
exports.languages = {};
|