rn-shiki 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. package/LICENCE +21 -0
  2. package/babel.cjs +150 -0
  3. package/babel.config.cjs +14 -0
  4. package/lib/commonjs/components/syntax/SyntaxHighlighter.js +73 -0
  5. package/lib/commonjs/components/syntax/SyntaxHighlighter.js.map +1 -0
  6. package/lib/commonjs/components/syntax/SyntaxLine.js +36 -0
  7. package/lib/commonjs/components/syntax/SyntaxLine.js.map +1 -0
  8. package/lib/commonjs/components/syntax/index.js +21 -0
  9. package/lib/commonjs/components/syntax/index.js.map +1 -0
  10. package/lib/commonjs/hooks/useSyntaxHighlighter.js +62 -0
  11. package/lib/commonjs/hooks/useSyntaxHighlighter.js.map +1 -0
  12. package/lib/commonjs/index.js +26 -0
  13. package/lib/commonjs/index.js.map +1 -0
  14. package/lib/commonjs/package.json +1 -0
  15. package/lib/commonjs/syntax/highlighter/index.js +128 -0
  16. package/lib/commonjs/syntax/highlighter/index.js.map +1 -0
  17. package/lib/commonjs/syntax/index.js +26 -0
  18. package/lib/commonjs/syntax/index.js.map +1 -0
  19. package/lib/commonjs/syntax/parser/index.js +26 -0
  20. package/lib/commonjs/syntax/parser/index.js.map +1 -0
  21. package/lib/commonjs/types/index.js +2 -0
  22. package/lib/commonjs/types/index.js.map +1 -0
  23. package/lib/commonjs/utils/index.js +17 -0
  24. package/lib/commonjs/utils/index.js.map +1 -0
  25. package/lib/commonjs/utils/string.js +28 -0
  26. package/lib/commonjs/utils/string.js.map +1 -0
  27. package/lib/module/components/syntax/SyntaxHighlighter.js +68 -0
  28. package/lib/module/components/syntax/SyntaxHighlighter.js.map +1 -0
  29. package/lib/module/components/syntax/SyntaxLine.js +31 -0
  30. package/lib/module/components/syntax/SyntaxLine.js.map +1 -0
  31. package/lib/module/components/syntax/index.js +5 -0
  32. package/lib/module/components/syntax/index.js.map +1 -0
  33. package/lib/module/hooks/useSyntaxHighlighter.js +58 -0
  34. package/lib/module/hooks/useSyntaxHighlighter.js.map +1 -0
  35. package/lib/module/index.js +5 -0
  36. package/lib/module/index.js.map +1 -0
  37. package/lib/module/package.json +1 -0
  38. package/lib/module/syntax/highlighter/index.js +121 -0
  39. package/lib/module/syntax/highlighter/index.js.map +1 -0
  40. package/lib/module/syntax/index.js +5 -0
  41. package/lib/module/syntax/index.js.map +1 -0
  42. package/lib/module/syntax/parser/index.js +22 -0
  43. package/lib/module/syntax/parser/index.js.map +1 -0
  44. package/lib/module/types/index.js +2 -0
  45. package/lib/module/types/index.js.map +1 -0
  46. package/lib/module/utils/index.js +4 -0
  47. package/lib/module/utils/index.js.map +1 -0
  48. package/lib/module/utils/string.js +22 -0
  49. package/lib/module/utils/string.js.map +1 -0
  50. package/lib/typescript/components/syntax/SyntaxHighlighter.d.ts +11 -0
  51. package/lib/typescript/components/syntax/SyntaxHighlighter.d.ts.map +1 -0
  52. package/lib/typescript/components/syntax/SyntaxLine.d.ts +9 -0
  53. package/lib/typescript/components/syntax/SyntaxLine.d.ts.map +1 -0
  54. package/lib/typescript/components/syntax/index.d.ts +3 -0
  55. package/lib/typescript/components/syntax/index.d.ts.map +1 -0
  56. package/lib/typescript/hooks/useSyntaxHighlighter.d.ts +11 -0
  57. package/lib/typescript/hooks/useSyntaxHighlighter.d.ts.map +1 -0
  58. package/lib/typescript/index.d.ts +4 -0
  59. package/lib/typescript/index.d.ts.map +1 -0
  60. package/lib/typescript/syntax/highlighter/index.d.ts +14 -0
  61. package/lib/typescript/syntax/highlighter/index.d.ts.map +1 -0
  62. package/lib/typescript/syntax/index.d.ts +4 -0
  63. package/lib/typescript/syntax/index.d.ts.map +1 -0
  64. package/lib/typescript/syntax/parser/index.d.ts +10 -0
  65. package/lib/typescript/syntax/parser/index.d.ts.map +1 -0
  66. package/lib/typescript/types/index.d.ts +7 -0
  67. package/lib/typescript/types/index.d.ts.map +1 -0
  68. package/lib/typescript/utils/index.d.ts +2 -0
  69. package/lib/typescript/utils/index.d.ts.map +1 -0
  70. package/lib/typescript/utils/string.d.ts +5 -0
  71. package/lib/typescript/utils/string.d.ts.map +1 -0
  72. package/package.json +78 -0
  73. package/src/components/syntax/SyntaxHighlighter.tsx +57 -0
  74. package/src/components/syntax/SyntaxLine.tsx +34 -0
  75. package/src/components/syntax/index.ts +2 -0
  76. package/src/hooks/useSyntaxHighlighter.ts +65 -0
  77. package/src/index.ts +3 -0
  78. package/src/syntax/highlighter/index.ts +139 -0
  79. package/src/syntax/index.ts +3 -0
  80. package/src/syntax/parser/index.ts +32 -0
  81. package/src/types/index.ts +6 -0
  82. package/src/utils/index.ts +1 -0
  83. package/src/utils/string.ts +37 -0
package/LICENCE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Ryan Skinner
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/babel.cjs ADDED
@@ -0,0 +1,150 @@
1
+ const path = require('node:path')
2
+ const process = require('node:process')
3
+
4
+ const DEFAULT_CONFIG = {
5
+ languages: ['typescript', 'javascript', 'json', 'html', 'css', 'php'],
6
+ themes: ['github-light', 'github-dark'],
7
+ }
8
+
9
+ function validateConfig(config) {
10
+ const errors = []
11
+
12
+ if (!Array.isArray(config.languages)) {
13
+ errors.push('languages must be an array')
14
+ }
15
+ if (!Array.isArray(config.themes)) {
16
+ errors.push('themes must be an array')
17
+ }
18
+
19
+ if (config.languages?.length) {
20
+ config.languages.forEach((lang) => {
21
+ if (typeof lang !== 'string') {
22
+ errors.push(`Invalid language: ${lang}. Must be a string.`)
23
+ }
24
+ })
25
+ }
26
+
27
+ if (config.themes?.length) {
28
+ config.themes.forEach((theme) => {
29
+ if (typeof theme !== 'string') {
30
+ errors.push(`Invalid theme: ${theme}. Must be a string.`)
31
+ }
32
+ })
33
+ }
34
+
35
+ if (errors.length > 0) {
36
+ throw new Error(`Invalid rn-shiki config:\n${errors.join('\n')}`)
37
+ }
38
+ }
39
+
40
+ function mergeConfigs(userConfig = {}) {
41
+ return {
42
+ languages: [...new Set([...DEFAULT_CONFIG.languages, ...(userConfig.languages || [])])],
43
+ themes: [...new Set([...DEFAULT_CONFIG.themes, ...(userConfig.themes || [])])],
44
+ }
45
+ }
46
+
47
+ function loadProjectConfig() {
48
+ try {
49
+ const configPath = path.resolve(process.cwd(), 'rn-shiki.config.js')
50
+ return require(configPath)
51
+ }
52
+ catch (error) {
53
+ if (error.code !== 'MODULE_NOT_FOUND') {
54
+ console.warn('Error loading rn-shiki.config.js:', error.message)
55
+ }
56
+ return {}
57
+ }
58
+ }
59
+
60
+ function createResourceImport(t, type, name) {
61
+ return t.objectProperty(
62
+ t.stringLiteral(name),
63
+ t.callExpression(
64
+ t.identifier('require'),
65
+ [t.stringLiteral(`shiki/${type}/${name}.mjs`)],
66
+ ),
67
+ )
68
+ }
69
+
70
+ module.exports = function (babel) {
71
+ const { types: t } = babel
72
+
73
+ return {
74
+ name: 'rn-shiki-transform',
75
+ visitor: {
76
+ ImportDeclaration(path, state) {
77
+ // Merge configurations with defaults
78
+ const config = mergeConfigs({
79
+ ...loadProjectConfig(),
80
+ ...(state.opts?.shiki || state.opts || {}),
81
+ })
82
+
83
+ try {
84
+ validateConfig(config)
85
+ }
86
+ catch (error) {
87
+ throw path.buildCodeFrameError(error.message)
88
+ }
89
+
90
+ // Handle direct shiki resource imports
91
+ if (path.node.source.value.startsWith('shiki/')) {
92
+ const match = path.node.source.value.match(/shiki\/(langs|themes)\/(.+)\.mjs/)
93
+ if (match) {
94
+ const [, type, name] = match
95
+ const configKey = type === 'langs' ? 'languages' : 'themes'
96
+
97
+ if (!config[configKey].includes(name)) {
98
+ throw path.buildCodeFrameError(
99
+ `${type === 'langs' ? 'Language' : 'Theme'} "${name}" is not configured.\n`
100
+ + `Configure it in rn-shiki.config.js or babel plugin options.\n`
101
+ + `Available ${configKey}: ${config[configKey].join(', ')}`,
102
+ )
103
+ }
104
+ }
105
+ }
106
+
107
+ // Handle shiki package imports
108
+ if (path.node.source.value === 'shiki') {
109
+ // Transform bundledLanguages
110
+ const langSpec = path.node.specifiers.find(
111
+ spec => spec.imported?.name === 'bundledLanguages'
112
+ || spec.local?.name === 'bundledLanguages',
113
+ )
114
+
115
+ if (langSpec) {
116
+ const languagesObject = t.objectExpression(
117
+ config.languages.map(lang => createResourceImport(t, 'langs', lang)),
118
+ )
119
+
120
+ const binding = path.scope.getBinding(langSpec.local.name)
121
+ if (binding) {
122
+ binding.referencePaths.forEach((refPath) => {
123
+ refPath.replaceWith(languagesObject)
124
+ })
125
+ }
126
+ }
127
+
128
+ // Transform bundledThemes
129
+ const themeSpec = path.node.specifiers.find(
130
+ spec => spec.imported?.name === 'bundledThemes'
131
+ || spec.local?.name === 'bundledThemes',
132
+ )
133
+
134
+ if (themeSpec) {
135
+ const themesObject = t.objectExpression(
136
+ config.themes.map(theme => createResourceImport(t, 'themes', theme)),
137
+ )
138
+
139
+ const binding = path.scope.getBinding(themeSpec.local.name)
140
+ if (binding) {
141
+ binding.referencePaths.forEach((refPath) => {
142
+ refPath.replaceWith(themesObject)
143
+ })
144
+ }
145
+ }
146
+ }
147
+ },
148
+ },
149
+ }
150
+ }
@@ -0,0 +1,14 @@
1
+ module.exports = {
2
+ presets: [
3
+ [
4
+ '@babel/preset-env',
5
+ {
6
+ targets: {
7
+ node: 'current',
8
+ },
9
+ },
10
+ ],
11
+ '@babel/preset-typescript',
12
+ ],
13
+ plugins: ['@babel/plugin-transform-modules-commonjs', '@babel/plugin-transform-runtime'],
14
+ }
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _reactNative = require("react-native");
9
+ var _useSyntaxHighlighter = require("../../hooks/useSyntaxHighlighter");
10
+ var _jsxRuntime = require("react/jsx-runtime");
11
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
+ function SyntaxHighlighter({
13
+ text,
14
+ lang,
15
+ theme = 'github-dark',
16
+ fontSize
17
+ }) {
18
+ const {
19
+ tokens,
20
+ error,
21
+ isLoading
22
+ } = (0, _useSyntaxHighlighter.useSyntaxHighlighter)({
23
+ text,
24
+ lang,
25
+ theme
26
+ });
27
+ if (error) {
28
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.Text, {
29
+ style: {
30
+ color: '#ff6b6b',
31
+ fontFamily: 'monospace',
32
+ fontSize
33
+ },
34
+ children: ["Error:", error]
35
+ });
36
+ }
37
+ if (isLoading) {
38
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
39
+ style: {
40
+ color: '#f8f8f2',
41
+ fontFamily: 'monospace',
42
+ fontSize
43
+ },
44
+ children: "Loading..."
45
+ });
46
+ }
47
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
48
+ children: tokens.map((line, lineIndex) => /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactNative.View, {
49
+ style: {
50
+ flexDirection: 'row',
51
+ flexWrap: 'wrap'
52
+ },
53
+ children: [line.map((token, tokenIndex) => /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
54
+ style: {
55
+ color: token.color || '#FFFFFF',
56
+ fontFamily: 'monospace',
57
+ fontSize,
58
+ fontStyle: token.fontStyle
59
+ },
60
+ children: token.content.replace(/ /g, '\u00A0')
61
+ }, `${lineIndex}-${tokenIndex}`)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
62
+ style: {
63
+ color: '#FFFFFF',
64
+ fontFamily: 'monospace',
65
+ fontSize
66
+ },
67
+ children: '\n'
68
+ })]
69
+ }, `line-${lineIndex}`))
70
+ });
71
+ }
72
+ var _default = exports.default = SyntaxHighlighter;
73
+ //# sourceMappingURL=SyntaxHighlighter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_useSyntaxHighlighter","_jsxRuntime","e","__esModule","default","SyntaxHighlighter","text","lang","theme","fontSize","tokens","error","isLoading","useSyntaxHighlighter","jsxs","Text","style","color","fontFamily","children","jsx","View","map","line","lineIndex","flexDirection","flexWrap","token","tokenIndex","fontStyle","content","replace","_default","exports"],"sourceRoot":"../../../../src","sources":["components/syntax/SyntaxHighlighter.tsx"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,qBAAA,GAAAF,OAAA;AAAuE,IAAAG,WAAA,GAAAH,OAAA;AAAA,SAAAD,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AASvE,SAASG,iBAAiBA,CAAC;EAAEC,IAAI;EAAEC,IAAI;EAAEC,KAAK,GAAG,aAAa;EAAEC;AAAiC,CAAC,EAAE;EAClG,MAAM;IAAEC,MAAM;IAAEC,KAAK;IAAEC;EAAU,CAAC,GAAG,IAAAC,0C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WAAA,CAAAmB,GAAA,EAACrB,YAAA,CAAAgB,IAAI;QAACC,KAAK,EAAE;UAAEC,KAAK,EAAE,SAAS;UAAEC,UAAU,EAAE,WAAW;UAAET;QAAS,CAAE;QAAAU,QAAA,EAAE;MAAI,CAAO,CAAC;IAAA,GAd1E,QAAQK,SAAS,EAetB,CACP;EAAC,CACE,CAAC;AAEX;AAAC,IAAAQ,QAAA,GAAAC,OAAA,CAAA7B,OAAA,GAEcC,iBAAiB","ignoreList":[]}
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _reactNative = require("react-native");
9
+ var _jsxRuntime = require("react/jsx-runtime");
10
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
+ function SyntaxLine({
12
+ line,
13
+ fontSize
14
+ }) {
15
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
16
+ style: {
17
+ flexDirection: 'row',
18
+ flexWrap: 'wrap'
19
+ },
20
+ children: line.map((token, tokenIndex) => {
21
+ // Preserve whitespace
22
+ const content = token.content.replace(/ /g, '\u00A0');
23
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.Text, {
24
+ style: {
25
+ color: token.color,
26
+ fontFamily: 'monospace',
27
+ fontSize,
28
+ fontStyle: token.fontStyle
29
+ },
30
+ children: content
31
+ }, `${content}-${tokenIndex}`);
32
+ })
33
+ });
34
+ }
35
+ var _default = exports.default = SyntaxLine;
36
+ //# sourceMappingURL=SyntaxLine.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","_jsxRuntime","e","__esModule","default","SyntaxLine","line","fontSize","jsx","View","style","flexDirection","flexWrap","children","map","token","tokenIndex","content","replace","Text","color","fontFamily","fontStyle","_default","exports"],"sourceRoot":"../../../../src","sources":["components/syntax/SyntaxLine.tsx"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAAyC,IAAAE,WAAA,GAAAF,OAAA;AAAA,SAAAD,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAOzC,SAASG,UAAUA,CAAC;EAAEC,IAAI;EAAEC;AAA0B,CAAC,EAAE;EACvD,oBACE,IAAAN,WAAA,CAAAO,GAAA,EAACR,YAAA,CAAAS,IAAI;IAACC,KAAK,EAAE;MAAEC,aAAa,EAAE,KAAK;MAAEC,QAAQ,EAAE;IAAO,CAAE;IAAAC,QAAA,EACrDP,IAAI,CAACQ,GAAG,CAAC,CAACC,KAAK,EAAEC,UAAU,KAAK;MAC/B;MACA,MAAMC,OAAO,GAAGF,KAAK,CAACE,OAAO,CAACC,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC;MACrD,oBACE,IAAAjB,WAAA,CAAAO,GAAA,EAACR,YAAA,CAAAmB,IAAI;QAEHT,KAAK,EAAE;UACLU,KAAK,EAAEL,KAAK,CAACK,KAAK;UAClBC,UAAU,EAAE,WAAW;UACvBd,QAAQ;UACRe,SAAS,EAAEP,KAAK,CAACO;QACnB,CAAE;QAAAT,QAAA,EAEDI;MAAO,GARH,GAAGA,OAAO,IAAID,UAAU,EASzB,CAAC;IAEX,CAAC;EAAC,CACE,CAAC;AAEX;AAAC,IAAAO,QAAA,GAAAC,OAAA,CAAApB,OAAA,GAEcC,UAAU","ignoreList":[]}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "SyntaxHighlighter", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _SyntaxHighlighter.default;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "SyntaxLine", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _SyntaxLine.default;
16
+ }
17
+ });
18
+ var _SyntaxHighlighter = _interopRequireDefault(require("./SyntaxHighlighter"));
19
+ var _SyntaxLine = _interopRequireDefault(require("./SyntaxLine"));
20
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_SyntaxHighlighter","_interopRequireDefault","require","_SyntaxLine","e","__esModule","default"],"sourceRoot":"../../../../src","sources":["components/syntax/index.ts"],"mappings":";;;;;;;;;;;;;;;;;AAAA,IAAAA,kBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAF,sBAAA,CAAAC,OAAA;AAAoD,SAAAD,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA","ignoreList":[]}
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.useSyntaxHighlighter = useSyntaxHighlighter;
7
+ var _react = require("react");
8
+ var _syntax = require("../syntax");
9
+ function useSyntaxHighlighter({
10
+ text,
11
+ lang,
12
+ theme
13
+ }) {
14
+ const [tokens, setTokens] = (0, _react.useState)([]);
15
+ const [error, setError] = (0, _react.useState)();
16
+ const [isLoading, setIsLoading] = (0, _react.useState)(true);
17
+ (0, _react.useEffect)(() => {
18
+ let mounted = true;
19
+ setIsLoading(true);
20
+ async function highlight() {
21
+ if (!text) {
22
+ setIsLoading(false);
23
+ setTokens([]);
24
+ return;
25
+ }
26
+ try {
27
+ const highlighter = await (0, _syntax.createHighlighter)({
28
+ langs: [lang],
29
+ themes: [theme]
30
+ });
31
+ const result = highlighter.codeToTokens(text, {
32
+ lang,
33
+ theme
34
+ });
35
+ if (mounted && result.tokens) {
36
+ setTokens(result.tokens);
37
+ setError(undefined);
38
+ }
39
+ } catch (err) {
40
+ console.error('Highlighting error:', err);
41
+ if (mounted) {
42
+ setError(err instanceof Error ? err.message : 'Syntax highlighting failed');
43
+ setTokens([]);
44
+ }
45
+ } finally {
46
+ if (mounted) {
47
+ setIsLoading(false);
48
+ }
49
+ }
50
+ }
51
+ highlight();
52
+ return () => {
53
+ mounted = false;
54
+ };
55
+ }, [text, lang, theme]);
56
+ return {
57
+ tokens,
58
+ error,
59
+ isLoading
60
+ };
61
+ }
62
+ //# sourceMappingURL=useSyntaxHighlighter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","require","_syntax","useSyntaxHighlighter","text","lang","theme","tokens","setTokens","useState","error","setError","isLoading","setIsLoading","useEffect","mounted","highlight","highlighter","createHighlighter","langs","themes","result","codeToTokens","undefined","err","console","Error","message"],"sourceRoot":"../../../src","sources":["hooks/useSyntaxHighlighter.ts"],"mappings":";;;;;;AAEA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAQO,SAASE,oBAAoBA,CAAC;EAAEC,IAAI;EAAEC,IAAI;EAAEC;AAAoE,CAAC,EAAE;EACxH,MAAM,CAACC,MAAM,EAAEC,SAAS,CAAC,GAAG,IAAAC,eAAQ,EAAkB,EAAE,CAAC;EACzD,MAAM,CAACC,KAAK,EAAEC,QAAQ,CAAC,GAAG,IAAAF,eAAQ,EAAS,CAAC;EAC5C,MAAM,CAACG,SAAS,EAAEC,YAAY,CAAC,GAAG,IAAAJ,eAAQ,EAAC,IAAI,CAAC;EAEhD,IAAAK,gBAAS,EAAC,MAAM;IACd,IAAIC,OAAO,GAAG,IAAI;IAClBF,YAAY,CAAC,IAAI,CAAC;IAElB,eAAeG,SAASA,CAAA,EAAG;MACzB,IAAI,CAACZ,IAAI,EAAE;QACTS,YAAY,CAAC,KAAK,CAAC;QACnBL,SAAS,CAAC,EAAE,CAAC;QACb;MACF;MAEA,IAAI;QACF,MAAMS,WAAW,GAAG,MAAM,IAAAC,yBAAiB,EAAC;UAC1CC,KAAK,EAAE,CAACd,IAAI,CAAsB;UAClCe,MAAM,EAAE,CAACd,KAAK;QAChB,CAAC,CAAC;QAEF,MAAMe,MAAM,GAAGJ,WAAW,CAACK,YAAY,CAAClB,IAAI,EAAE;UAC5CC,IAAI;UACJC;QACF,CAAC,CAAgB;QAEjB,IAAIS,OAAO,IAAIM,MAAM,CAACd,MAAM,EAAE;UAC5BC,SAAS,CAACa,MAAM,CAACd,MAAM,CAAC;UACxBI,QAAQ,CAACY,SAAS,CAAC;QACrB;MACF,CAAC,CACD,OAAOC,GAAG,EAAE;QACVC,OAAO,CAACf,KAAK,CAAC,qBAAqB,EAAEc,GAAG,CAAC;QACzC,IAAIT,OAAO,EAAE;UACXJ,QAAQ,CAACa,GAAG,YAAYE,KAAK,GAAGF,GAAG,CAACG,OAAO,GAAG,4BAA4B,CAAC;UAC3EnB,SAAS,CAAC,EAAE,CAAC;QACf;MACF,CAAC,SACO;QACN,IAAIO,OAAO,EAAE;UACXF,YAAY,CAAC,KAAK,CAAC;QACrB;MACF;IACF;IAEAG,SAAS,CAAC,CAAC;IACX,OAAO,MAAM;MACXD,OAAO,GAAG,KAAK;IACjB,CAAC;EACH,CAAC,EAAE,CAACX,IAAI,EAAEC,IAAI,EAAEC,KAAK,CAAC,CAAC;EAEvB,OAAO;IAAEC,MAAM;IAAEG,KAAK;IAAEE;EAAU,CAAC;AACrC","ignoreList":[]}
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "SyntaxHighlighter", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _syntax.SyntaxHighlighter;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "SyntaxLine", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _syntax.SyntaxLine;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "parseCodeFence", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _syntax2.parseCodeFence;
22
+ }
23
+ });
24
+ var _syntax = require("./components/syntax");
25
+ var _syntax2 = require("./syntax");
26
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_syntax","require","_syntax2"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA","ignoreList":[]}
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}
@@ -0,0 +1,128 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createHighlighter = createHighlighter;
7
+ exports.loadLanguage = loadLanguage;
8
+ exports.loadTheme = loadTheme;
9
+ exports.processTokens = processTokens;
10
+ var _core = require("shiki/core");
11
+ var _engineJavascript = require("shiki/engine-javascript.mjs");
12
+ var _css = _interopRequireDefault(require("shiki/langs/css.mjs"));
13
+ var _html = _interopRequireDefault(require("shiki/langs/html.mjs"));
14
+ var _javascript = _interopRequireDefault(require("shiki/langs/javascript.mjs"));
15
+ var _json = _interopRequireDefault(require("shiki/langs/json.mjs"));
16
+ var _php = _interopRequireDefault(require("shiki/langs/php.mjs"));
17
+ var _typescript = _interopRequireDefault(require("shiki/langs/typescript.mjs"));
18
+ var _githubDark = _interopRequireDefault(require("shiki/themes/github-dark.mjs"));
19
+ var _githubLight = _interopRequireDefault(require("shiki/themes/github-light.mjs"));
20
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
21
+ // Import languages
22
+
23
+ // Import themes
24
+
25
+ // Define supported languages and themes explicitly
26
+
27
+ // Bundled languages mapping - using the imported grammars directly
28
+ const LANGUAGE_IMPORTS = {
29
+ css: _css.default,
30
+ html: _html.default,
31
+ javascript: _javascript.default,
32
+ json: _json.default,
33
+ php: _php.default,
34
+ typescript: _typescript.default
35
+ };
36
+
37
+ // Bundled themes mapping
38
+ const THEME_IMPORTS = {
39
+ 'github-dark': _githubDark.default,
40
+ 'github-light': _githubLight.default
41
+ };
42
+
43
+ // Singleton highlighter instance with tracking
44
+
45
+ let highlighterInstance = null;
46
+ async function createHighlighter({
47
+ langs,
48
+ themes
49
+ }) {
50
+ if (!langs || !themes) {
51
+ throw new Error('Please provide both `langs` and `themes` when creating a highlighter.');
52
+ }
53
+
54
+ // Return existing instance if already initialized
55
+ if (highlighterInstance?.highlighter) {
56
+ // Load any new languages that weren't previously loaded
57
+ for (const lang of langs) {
58
+ if (!highlighterInstance.loadedLanguages.has(lang)) {
59
+ const langData = LANGUAGE_IMPORTS[lang];
60
+ await highlighterInstance.highlighter.loadLanguage(langData);
61
+ highlighterInstance.loadedLanguages.add(lang);
62
+ }
63
+ }
64
+
65
+ // Load any new themes that weren't previously loaded
66
+ for (const theme of themes) {
67
+ if (!highlighterInstance.loadedThemes.has(theme)) {
68
+ const themeData = THEME_IMPORTS[theme];
69
+ await highlighterInstance.highlighter.loadTheme(themeData);
70
+ highlighterInstance.loadedThemes.add(theme);
71
+ }
72
+ }
73
+ return highlighterInstance.highlighter;
74
+ }
75
+ try {
76
+ // Create highlighter with initial languages and themes
77
+ const highlighter = await (0, _core.createHighlighterCore)({
78
+ engine: (0, _engineJavascript.createJavaScriptRegexEngine)(),
79
+ langs: langs.map(lang => LANGUAGE_IMPORTS[lang]),
80
+ themes: themes.map(theme => THEME_IMPORTS[theme])
81
+ });
82
+
83
+ // Store the instance with tracking sets
84
+ highlighterInstance = {
85
+ highlighter,
86
+ loadedLanguages: new Set(langs),
87
+ loadedThemes: new Set(themes)
88
+ };
89
+ return highlighter;
90
+ } catch (error) {
91
+ console.error('Failed to create highlighter:', error);
92
+ throw error;
93
+ }
94
+ }
95
+
96
+ // Function to ensure a theme is loaded
97
+ async function loadTheme(theme) {
98
+ if (!highlighterInstance?.highlighter) {
99
+ throw new Error('Highlighter not initialized');
100
+ }
101
+ if (highlighterInstance.loadedThemes.has(theme)) {
102
+ return;
103
+ }
104
+ const themeData = THEME_IMPORTS[theme];
105
+ await highlighterInstance.highlighter.loadTheme(themeData);
106
+ highlighterInstance.loadedThemes.add(theme);
107
+ }
108
+
109
+ // Function to ensure a language is loaded
110
+ async function loadLanguage(lang) {
111
+ if (!highlighterInstance?.highlighter) {
112
+ throw new Error('Highlighter not initialized');
113
+ }
114
+ if (highlighterInstance.loadedLanguages.has(lang)) {
115
+ return;
116
+ }
117
+ const langData = LANGUAGE_IMPORTS[lang];
118
+ await highlighterInstance.highlighter.loadLanguage(langData);
119
+ highlighterInstance.loadedLanguages.add(lang);
120
+ }
121
+ function processTokens(tokens) {
122
+ return tokens.map(token => ({
123
+ content: token.content,
124
+ color: token.color || '#000000',
125
+ fontStyle: token.fontStyle?.toString()
126
+ }));
127
+ }
128
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_core","require","_engineJavascript","_css","_interopRequireDefault","_html","_javascript","_json","_php","_typescript","_githubDark","_githubLight","e","__esModule","default","LANGUAGE_IMPORTS","css","html","javascript","json","php","typescript","THEME_IMPORTS","githubDark","githubLight","highlighterInstance","createHighlighter","langs","themes","Error","highlighter","lang","loadedLanguages","has","langData","loadLanguage","add","theme","loadedThemes","themeData","loadTheme","createHighlighterCore","engine","createJavaScriptRegexEngine","map","Set","error","console","processTokens","tokens","token","content","color","fontStyle","toString"],"sourceRoot":"../../../../src","sources":["syntax/highlighter/index.ts"],"mappings":";;;;;;;;;AAEA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAD,OAAA;AAGA,IAAAE,IAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,KAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,WAAA,GAAAF,sBAAA,CAAAH,OAAA;AACA,IAAAM,KAAA,GAAAH,sBAAA,CAAAH,OAAA;AACA,IAAAO,IAAA,GAAAJ,sBAAA,CAAAH,OAAA;AACA,IAAAQ,WAAA,GAAAL,sBAAA,CAAAH,OAAA;AAGA,IAA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AAYA,CAACJ,IAAuB,EAAE;EAC1D,IAAI,CAACN,mBAAmB,EAAEK,WAAW,EAAE;IACrC,MAAM,IAAID,KAAK,CAAC,6BAA6B,CAAC;EAChD;EAEA,IAAIJ,mBAAmB,CAACO,eAAe,CAACC,GAAG,CAACF,IAAI,CAAC,EAAE;IACjD;EACF;EAEA,MAAMG,QAAQ,GAAGnB,gBAAgB,CAACgB,IAAI,CAAC;EACvC,MAAMN,mBAAmB,CAACK,WAAW,CAACK,YAAY,CAACD,QAAQ,CAAC;EAC5DT,mBAAmB,CAACO,eAAe,CAACI,GAAG,CAACL,IAAI,CAAC;AAC/C;AAEO,SAASiB,aAAaA,CAACC,MAAqB,EAAe;EAChE,OAAOA,MAAM,CAACL,GAAG,CAACM,KAAK,KAAK;IAC1BC,OAAO,EAAED,KAAK,CAACC,OAAO;IACtBC,KAAK,EAAEF,KAAK,CAACE,KAAK,IAAI,SAAS;IAC/BC,SAAS,EAAEH,KAAK,CAACG,SAAS,EAAEC,QAAQ,CAAC;EACvC,CAAC,CAAC,CAAC;AACL","ignoreList":[]}
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "createHighlighter", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _highlighter.createHighlighter;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "parseCodeFence", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _parser.parseCodeFence;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "processTokens", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _highlighter.processTokens;
22
+ }
23
+ });
24
+ var _highlighter = require("./highlighter");
25
+ var _parser = require("./parser");
26
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_highlighter","require","_parser"],"sourceRoot":"../../../src","sources":["syntax/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA","ignoreList":[]}
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.parseCodeFence = parseCodeFence;
7
+ var _utils = require("../../utils");
8
+ const CODE_BLOCK_REGEX = /```([a-z0-9]+)?\n([\s\S]*?)\n```/gi;
9
+ function parseCodeFence(text, defaultLang) {
10
+ const matches = [...text.matchAll(CODE_BLOCK_REGEX)];
11
+ if (matches.length === 0) {
12
+ return {
13
+ code: text
14
+ };
15
+ }
16
+ const code = matches[0]?.[2] || '';
17
+ const language = matches[0]?.[1] || defaultLang;
18
+ const outsideText = text.split(CODE_BLOCK_REGEX).filter(Boolean);
19
+ return {
20
+ code: (0, _utils.removeExtraIndentation)(code),
21
+ language,
22
+ valid: true,
23
+ outsideText
24
+ };
25
+ }
26
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_utils","require","CODE_BLOCK_REGEX","parseCodeFence","text","defaultLang","matches","matchAll","length","code","language","outsideText","split","filter","Boolean","removeExtraIndentation","valid"],"sourceRoot":"../../../../src","sources":["syntax/parser/index.ts"],"mappings":";;;;;;AAEA,IAAAA,MAAA,GAAAC,OAAA;AASA,MAAMC,gBAAgB,GAAG,oCAAoC;AAEtD,SAASC,cAAcA,CAACC,IAAY,EAAEC,WAA+B,EAAmB;EAC7F,MAAMC,OAAO,GAAG,CAAC,GAAGF,IAAI,CAACG,QAAQ,CAACL,gBAAgB,CAAC,CAAC;EACpD,IAAII,OAAO,CAACE,MAAM,KAAK,CAAC,EAAE;IACxB,OAAO;MACLC,IAAI,EAAEL;IACR,CAAC;EACH;EAEA,MAAMK,IAAI,GAAGH,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE;EAClC,MAAMI,QAAQ,GAAIJ,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAqCD,WAAW;EACjF,MAAMM,WAAW,GAAGP,IAAI,CAACQ,KAAK,CAACV,gBAAgB,CAAC,CAACW,MAAM,CAACC,OAAO,CAAC;EAEhE,OAAO;IACLL,IAAI,EAAE,IAAAM,6BAAsB,EAACN,IAAI,CAAC;IAClCC,QAAQ;IACRM,KAAK,EAAE,IAAI;IACXL;EACF,CAAC;AACH","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/index.ts"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _string = require("./string");
7
+ Object.keys(_string).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _string[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _string[key];
14
+ }
15
+ });
16
+ });
17
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_string","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sourceRoot":"../../../src","sources":["utils/index.ts"],"mappings":";;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,OAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,OAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,OAAA,CAAAK,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}