@readme/syntax-highlighter 15.0.0 → 15.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.vscode/extensions.json +3 -0
- package/.vscode/settings.json +20 -2
- package/LICENSE +1 -1
- package/dist/index.js +44313 -44288
- package/dist/index.node.js +34 -34
- package/dist-utils/{canonical.d.ts → utils/canonical.d.ts} +1 -1
- package/dist-utils/{index.d.ts → utils/index.d.ts} +1 -1
- package/knip.ts +12 -1
- package/package.json +24 -26
- package/src/codeEditor/index.tsx +0 -3
- package/src/codeMirror/index.jsx +1 -1
- package/src/index.js +2 -1
- package/src/utils/cm-mode-imports.js +1 -0
- package/src/utils/modes/solidity.js +20 -14
- package/tsconfig.json +1 -0
- package/webpack.config.dev.js +1 -0
- package/webpack.config.js +1 -0
- /package/dist-utils/{canonical.js → utils/canonical.js} +0 -0
- /package/dist-utils/{index.js → utils/index.js} +0 -0
- /package/dist-utils/{modes.d.ts → utils/modes.d.ts} +0 -0
- /package/dist-utils/{modes.js → utils/modes.js} +0 -0
- /package/dist-utils/{uppercase.d.ts → utils/uppercase.d.ts} +0 -0
- /package/dist-utils/{uppercase.js → utils/uppercase.js} +0 -0
package/dist/index.node.js
CHANGED
|
@@ -2,6 +2,40 @@
|
|
|
2
2
|
/******/ "use strict";
|
|
3
3
|
/******/ var __webpack_modules__ = ({
|
|
4
4
|
|
|
5
|
+
/***/ 638
|
|
6
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
var __importDefault = this && this.__importDefault || function (mod) {
|
|
11
|
+
return mod && mod.__esModule ? mod : {
|
|
12
|
+
"default": mod
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
16
|
+
value: true
|
|
17
|
+
}));
|
|
18
|
+
exports.getMode = exports.modes = exports.canonical = exports.uppercase = void 0;
|
|
19
|
+
var canonical_1 = __importDefault(__webpack_require__(42));
|
|
20
|
+
exports.canonical = canonical_1.default;
|
|
21
|
+
var modes_1 = __webpack_require__(476);
|
|
22
|
+
Object.defineProperty(exports, "modes", ({
|
|
23
|
+
enumerable: true,
|
|
24
|
+
get: function get() {
|
|
25
|
+
return modes_1.modes;
|
|
26
|
+
}
|
|
27
|
+
}));
|
|
28
|
+
Object.defineProperty(exports, "getMode", ({
|
|
29
|
+
enumerable: true,
|
|
30
|
+
get: function get() {
|
|
31
|
+
return modes_1.getMode;
|
|
32
|
+
}
|
|
33
|
+
}));
|
|
34
|
+
var uppercase_1 = __importDefault(__webpack_require__(704));
|
|
35
|
+
exports.uppercase = uppercase_1.default;
|
|
36
|
+
|
|
37
|
+
/***/ },
|
|
38
|
+
|
|
5
39
|
/***/ 42
|
|
6
40
|
(__unused_webpack_module, exports) {
|
|
7
41
|
|
|
@@ -199,40 +233,6 @@ function getMode(lang) {
|
|
|
199
233
|
|
|
200
234
|
/***/ },
|
|
201
235
|
|
|
202
|
-
/***/ 638
|
|
203
|
-
(__unused_webpack_module, exports, __webpack_require__) {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
var __importDefault = this && this.__importDefault || function (mod) {
|
|
208
|
-
return mod && mod.__esModule ? mod : {
|
|
209
|
-
"default": mod
|
|
210
|
-
};
|
|
211
|
-
};
|
|
212
|
-
Object.defineProperty(exports, "__esModule", ({
|
|
213
|
-
value: true
|
|
214
|
-
}));
|
|
215
|
-
exports.getMode = exports.modes = exports.canonical = exports.uppercase = void 0;
|
|
216
|
-
var canonical_1 = __importDefault(__webpack_require__(42));
|
|
217
|
-
exports.canonical = canonical_1.default;
|
|
218
|
-
var modes_1 = __webpack_require__(476);
|
|
219
|
-
Object.defineProperty(exports, "modes", ({
|
|
220
|
-
enumerable: true,
|
|
221
|
-
get: function get() {
|
|
222
|
-
return modes_1.modes;
|
|
223
|
-
}
|
|
224
|
-
}));
|
|
225
|
-
Object.defineProperty(exports, "getMode", ({
|
|
226
|
-
enumerable: true,
|
|
227
|
-
get: function get() {
|
|
228
|
-
return modes_1.getMode;
|
|
229
|
-
}
|
|
230
|
-
}));
|
|
231
|
-
var uppercase_1 = __importDefault(__webpack_require__(704));
|
|
232
|
-
exports.uppercase = uppercase_1.default;
|
|
233
|
-
|
|
234
|
-
/***/ },
|
|
235
|
-
|
|
236
236
|
/***/ 704
|
|
237
237
|
(__unused_webpack_module, exports) {
|
|
238
238
|
|
|
@@ -56,5 +56,5 @@ declare const modeAliases: {
|
|
|
56
56
|
readonly yml: "yaml";
|
|
57
57
|
readonly zsh: "shell";
|
|
58
58
|
};
|
|
59
|
-
declare const canonical: (language: keyof typeof modeAliases) => "stylus" | "html" | "ruby" | "rb" | "asp" | "shell" | "cplusplus" | "csharp" | "clojure" | "javascript" | "sql" | "dockerfile" | "erlang" | "graphql" | "groovy" | "julia" | "kotlin" | "css" | "markdown" | "ocaml" | "objectivec" | "objectivecplusplus" | "perl" | "powershell" | "python" | "rust" | "sol" | "yaml" | "aspx" | "bash" | "c++" | "c#" | "clj" | "cljc" | "cljx" | "coffeescript" | "cpp" | "cql" | "cs" | "docker" | "ecmascript" | "erl" | "gql" | "gradle" | "handlebars" | "hbs" | "jl" | "jruby" | "js" | "kt" | "
|
|
59
|
+
declare const canonical: (language: keyof typeof modeAliases) => "less" | "stylus" | "html" | "ruby" | "rb" | "asp" | "shell" | "cplusplus" | "csharp" | "clojure" | "javascript" | "sql" | "dockerfile" | "erlang" | "graphql" | "groovy" | "julia" | "kotlin" | "css" | "markdown" | "ocaml" | "objectivec" | "objectivecplusplus" | "perl" | "powershell" | "python" | "rust" | "sol" | "yaml" | "aspx" | "bash" | "c++" | "c#" | "clj" | "cljc" | "cljx" | "coffeescript" | "cpp" | "cql" | "cs" | "docker" | "ecmascript" | "erl" | "gql" | "gradle" | "handlebars" | "hbs" | "jl" | "jruby" | "js" | "kt" | "macruby" | "md" | "ml" | "mssql" | "mysql" | "node" | "obj-c" | "obj-c++" | "objc++" | "objc" | "objcpp" | "objectivecpp" | "pgsql" | "pl" | "plsql" | "postgres" | "postgresql" | "ps1" | "py" | "rake" | "rbx" | "rs" | "sass" | "scss" | "sh" | "solidity" | "sqlite" | "styl" | "xhtml" | "yml" | "zsh";
|
|
60
60
|
export default canonical;
|
|
@@ -2,7 +2,7 @@ import { getMode } from './modes';
|
|
|
2
2
|
import uppercase from './uppercase';
|
|
3
3
|
declare const _default: {
|
|
4
4
|
uppercase: typeof uppercase;
|
|
5
|
-
canonical: (language: "stylus" | "rb" | "aspx" | "bash" | "c++" | "c#" | "clj" | "cljc" | "cljx" | "coffeescript" | "cpp" | "cql" | "cs" | "docker" | "ecmascript" | "erl" | "gql" | "gradle" | "handlebars" | "hbs" | "jl" | "jruby" | "js" | "kt" | "
|
|
5
|
+
canonical: (language: "less" | "stylus" | "rb" | "aspx" | "bash" | "c++" | "c#" | "clj" | "cljc" | "cljx" | "coffeescript" | "cpp" | "cql" | "cs" | "docker" | "ecmascript" | "erl" | "gql" | "gradle" | "handlebars" | "hbs" | "jl" | "jruby" | "js" | "kt" | "macruby" | "md" | "ml" | "mssql" | "mysql" | "node" | "obj-c" | "obj-c++" | "objc++" | "objc" | "objcpp" | "objectivecpp" | "pgsql" | "pl" | "plsql" | "postgres" | "postgresql" | "ps1" | "py" | "rake" | "rbx" | "rs" | "sass" | "scss" | "sh" | "solidity" | "sqlite" | "styl" | "xhtml" | "yml" | "zsh") => "less" | "stylus" | "html" | "ruby" | "rb" | "asp" | "shell" | "cplusplus" | "csharp" | "clojure" | "javascript" | "sql" | "dockerfile" | "erlang" | "graphql" | "groovy" | "julia" | "kotlin" | "css" | "markdown" | "ocaml" | "objectivec" | "objectivecplusplus" | "perl" | "powershell" | "python" | "rust" | "sol" | "yaml" | "aspx" | "bash" | "c++" | "c#" | "clj" | "cljc" | "cljx" | "coffeescript" | "cpp" | "cql" | "cs" | "docker" | "ecmascript" | "erl" | "gql" | "gradle" | "handlebars" | "hbs" | "jl" | "jruby" | "js" | "kt" | "macruby" | "md" | "ml" | "mssql" | "mysql" | "node" | "obj-c" | "obj-c++" | "objc++" | "objc" | "objcpp" | "objectivecpp" | "pgsql" | "pl" | "plsql" | "postgres" | "postgresql" | "ps1" | "py" | "rake" | "rbx" | "rs" | "sass" | "scss" | "sh" | "solidity" | "sqlite" | "styl" | "xhtml" | "yml" | "zsh";
|
|
6
6
|
modes: {
|
|
7
7
|
readonly asp: "clike";
|
|
8
8
|
readonly aspx: "clike";
|
package/knip.ts
CHANGED
|
@@ -2,10 +2,21 @@ import type { KnipConfig } from 'knip';
|
|
|
2
2
|
|
|
3
3
|
const config: KnipConfig = {
|
|
4
4
|
entry: ['src/utils/index.ts', 'public/index.js', 'public/index.legacy.js'],
|
|
5
|
-
ignore: ['
|
|
5
|
+
ignore: ['test/__fixtures__/**'],
|
|
6
6
|
ignoreDependencies: [
|
|
7
7
|
'@csstools/css-parser-algorithms', // required in order to get vitest/jsdom running in CI
|
|
8
|
+
'eslint-plugin-readme', // pulled in and used by oxlint
|
|
8
9
|
],
|
|
10
|
+
oxfmt: {
|
|
11
|
+
config: ['oxfmt.config.ts'],
|
|
12
|
+
},
|
|
13
|
+
oxlint: {
|
|
14
|
+
config: ['oxlint.config.ts'],
|
|
15
|
+
},
|
|
16
|
+
vitest: {
|
|
17
|
+
config: ['vitest.config.ts'],
|
|
18
|
+
entry: ['test/**/*.ts(x)?'],
|
|
19
|
+
},
|
|
9
20
|
};
|
|
10
21
|
|
|
11
22
|
export default config;
|
package/package.json
CHANGED
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@readme/syntax-highlighter",
|
|
3
|
+
"version": "15.0.1",
|
|
3
4
|
"description": "ReadMe's React-based syntax highlighter",
|
|
4
|
-
"
|
|
5
|
-
"main": "dist/index.node.js",
|
|
6
|
-
"browser": "dist/index.js",
|
|
5
|
+
"homepage": "https://readmeio.github.io/syntax-highlighter/",
|
|
7
6
|
"license": "ISC",
|
|
8
7
|
"repository": {
|
|
9
8
|
"type": "git",
|
|
10
9
|
"url": "https://github.com/readmeio/syntax-highlighter.git"
|
|
11
10
|
},
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"node": ">=22"
|
|
15
|
-
},
|
|
11
|
+
"main": "dist/index.node.js",
|
|
12
|
+
"browser": "dist/index.js",
|
|
16
13
|
"exports": {
|
|
17
14
|
".": {
|
|
18
15
|
"browser": "./dist/index.js",
|
|
@@ -31,12 +28,11 @@
|
|
|
31
28
|
},
|
|
32
29
|
"scripts": {
|
|
33
30
|
"build": "webpack --progress && tsc",
|
|
34
|
-
"format": "
|
|
35
|
-
"lint": "
|
|
31
|
+
"format": "npx oxlint --fix && npx oxfmt --write",
|
|
32
|
+
"lint": "knip && npx oxlint && npx oxfmt --check",
|
|
36
33
|
"prebuild": "rm -rf dist && rm -rf dist-utils",
|
|
37
34
|
"prepack": "npm run build",
|
|
38
|
-
"pretest": "npm run lint &&
|
|
39
|
-
"prettier": "prettier --check .",
|
|
35
|
+
"pretest": "npm run lint && tsc --noEmit",
|
|
40
36
|
"start": "webpack serve --open --config ./webpack.config.dev.js",
|
|
41
37
|
"test": "vitest run --coverage",
|
|
42
38
|
"watch": "webpack -w --progress"
|
|
@@ -47,36 +43,38 @@
|
|
|
47
43
|
"prop-types": "^15.7.2",
|
|
48
44
|
"react-codemirror2": "^8.0.0"
|
|
49
45
|
},
|
|
50
|
-
"peerDependencies": {
|
|
51
|
-
"@readme/variable": "^18.0.0",
|
|
52
|
-
"react": "18.x",
|
|
53
|
-
"react-dom": "18.x"
|
|
54
|
-
},
|
|
55
46
|
"devDependencies": {
|
|
56
47
|
"@babel/preset-env": "^7.24.4",
|
|
57
48
|
"@babel/preset-react": "^7.24.1",
|
|
58
49
|
"@csstools/css-parser-algorithms": "^4.0.0",
|
|
59
|
-
"@readme/
|
|
50
|
+
"@readme/oxlint-config": "^1.1.2",
|
|
60
51
|
"@testing-library/jest-dom": "^6.4.2",
|
|
61
52
|
"@testing-library/react": "^16.3.0",
|
|
62
53
|
"@types/node": "^25.0.3",
|
|
63
|
-
"@vitest/coverage-v8": "^4.
|
|
54
|
+
"@vitest/coverage-v8": "^4.1.5",
|
|
64
55
|
"babel-loader": "^10.0.0",
|
|
65
56
|
"css-loader": "^7.1.1",
|
|
66
|
-
"eslint": "^8.57.0",
|
|
67
57
|
"html-webpack-plugin": "^5.6.0",
|
|
68
|
-
"jsdom": "^
|
|
69
|
-
"knip": "^
|
|
70
|
-
"
|
|
58
|
+
"jsdom": "^29.1.1",
|
|
59
|
+
"knip": "^6.10.0",
|
|
60
|
+
"oxfmt": "^0.47.0",
|
|
61
|
+
"oxlint": "^1.62.0",
|
|
71
62
|
"sass": "^1.89.2",
|
|
72
63
|
"sass-loader": "^13.3.2",
|
|
73
64
|
"style-loader": "^4.0.0",
|
|
74
65
|
"ts-loader": "^9.5.4",
|
|
75
|
-
"typescript": "^
|
|
76
|
-
"vitest": "^4.
|
|
66
|
+
"typescript": "^6.0.3",
|
|
67
|
+
"vitest": "^4.1.5",
|
|
77
68
|
"webpack": "^5.91.0",
|
|
78
|
-
"webpack-cli": "^
|
|
69
|
+
"webpack-cli": "^7.0.2",
|
|
79
70
|
"webpack-dev-server": "^5.0.4"
|
|
80
71
|
},
|
|
81
|
-
"
|
|
72
|
+
"peerDependencies": {
|
|
73
|
+
"@readme/variable": "^18.0.0",
|
|
74
|
+
"react": "18.x",
|
|
75
|
+
"react-dom": "18.x"
|
|
76
|
+
},
|
|
77
|
+
"engines": {
|
|
78
|
+
"node": ">=22"
|
|
79
|
+
}
|
|
82
80
|
}
|
package/src/codeEditor/index.tsx
CHANGED
|
@@ -17,7 +17,6 @@ const CodeEditor: React.FC<{
|
|
|
17
17
|
options?: ICodeMirror['options'];
|
|
18
18
|
theme?: 'material-palenight' | 'neo' | 'tomorrow-night';
|
|
19
19
|
}> = ({
|
|
20
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
21
20
|
className = '', // unused, I think on purpose? but not sure
|
|
22
21
|
code = '',
|
|
23
22
|
lang,
|
|
@@ -31,12 +30,10 @@ const CodeEditor: React.FC<{
|
|
|
31
30
|
|
|
32
31
|
useEffect(() => {
|
|
33
32
|
const incValue = children && typeof children === 'string' ? children : code;
|
|
34
|
-
// eslint-disable-next-line react-hooks/set-state-in-effect -- @fixme
|
|
35
33
|
setValue(incValue);
|
|
36
34
|
}, [code, children]);
|
|
37
35
|
|
|
38
36
|
useEffect(() => {
|
|
39
|
-
// eslint-disable-next-line react-hooks/set-state-in-effect -- @fixme
|
|
40
37
|
setMode(prevMode => {
|
|
41
38
|
const newMode = getMode(lang as string);
|
|
42
39
|
if (newMode !== prevMode) return newMode;
|
package/src/codeMirror/index.jsx
CHANGED
|
@@ -225,7 +225,7 @@ const ReadmeCodeMirror = (
|
|
|
225
225
|
const token = reinsertVariables(accum);
|
|
226
226
|
|
|
227
227
|
const styledToken = curStyle ? (
|
|
228
|
-
//
|
|
228
|
+
// oxlint-disable-next-line no-plusplus
|
|
229
229
|
<span key={key++} className={`${curStyle.replace(/(^|\s+)/g, '$1cm-')}`}>
|
|
230
230
|
{token}
|
|
231
231
|
</span>
|
package/src/index.js
CHANGED
|
@@ -20,7 +20,6 @@ const SyntaxHighlighter = (
|
|
|
20
20
|
},
|
|
21
21
|
props = {},
|
|
22
22
|
) => {
|
|
23
|
-
// eslint-disable-next-line react/prop-types
|
|
24
23
|
const { mdx, ...editorProps } = props;
|
|
25
24
|
let theme = opts.dark ? 'material-palenight' : 'neo';
|
|
26
25
|
if (opts.customTheme) {
|
|
@@ -30,8 +29,10 @@ const SyntaxHighlighter = (
|
|
|
30
29
|
if (opts.foldGutter) {
|
|
31
30
|
// `foldGutter` does not work with runmode and has to be done with the codeEditor component
|
|
32
31
|
// NOTE: To disable editing, to still allow folding, `readOnly` must be `true`.
|
|
32
|
+
// oxlint-disable-next-line no-param-reassign
|
|
33
33
|
opts.editable = true;
|
|
34
34
|
// Default CSS classes
|
|
35
|
+
// oxlint-disable-next-line no-param-reassign
|
|
35
36
|
opts.gutters = ['CodeMirror-linenumbers', 'CodeMirror-foldgutter'];
|
|
36
37
|
}
|
|
37
38
|
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
// oxlint-disable react/no-this-in-sfc
|
|
2
|
+
// oxlint-disable unicorn/consistent-function-scoping
|
|
3
|
+
// oxlint-disable curly
|
|
4
|
+
// oxlint-disable no-param-reassign
|
|
5
|
+
// oxlint-disable typescript/no-require-imports
|
|
6
|
+
// oxlint-disable func-names
|
|
7
|
+
// oxlint-disable operator-assignment
|
|
8
|
+
// oxlint-disable prefer-template
|
|
9
|
+
// oxlint-disable no-return-assign
|
|
10
|
+
// oxlint-disable no-unused-expressions
|
|
11
|
+
// oxlint-disable no-prototype-builtins
|
|
12
|
+
// oxlint-disable no-useless-escape
|
|
13
|
+
// oxlint-disable eqeqeq
|
|
14
|
+
// oxlint-disable global-require
|
|
12
15
|
|
|
13
16
|
/**
|
|
14
17
|
* This mode has been adapted from the source of `codemirror-solidity` as the way that library is
|
|
@@ -23,13 +26,16 @@
|
|
|
23
26
|
if (typeof exports === 'object' && typeof module === 'object') {
|
|
24
27
|
// CommonJS
|
|
25
28
|
mod(require('codemirror/lib/codemirror'));
|
|
26
|
-
|
|
29
|
+
|
|
30
|
+
// oxlint-disable-next-line no-undef
|
|
27
31
|
} else if (typeof define === 'function' && define.amd) {
|
|
28
32
|
// AMD
|
|
29
|
-
|
|
33
|
+
// oxlint-disable-next-line no-undef
|
|
34
|
+
define(['codemirror/lib/codemirror'], mod);
|
|
30
35
|
} else {
|
|
31
36
|
// Plain browser env
|
|
32
|
-
|
|
37
|
+
// oxlint-disable-next-line no-undef
|
|
38
|
+
mod(CodeMirror);
|
|
33
39
|
}
|
|
34
40
|
})(function (CodeMirror) {
|
|
35
41
|
CodeMirror.defineMode('solidity', function (config) {
|
package/tsconfig.json
CHANGED
package/webpack.config.dev.js
CHANGED
package/webpack.config.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|