@readme/syntax-highlighter 15.0.0 → 15.0.2

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.
@@ -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" | "less" | "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";
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" | "less" | "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") => "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" | "less" | "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";
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
@@ -1,11 +1,22 @@
1
1
  import type { KnipConfig } from 'knip';
2
2
 
3
3
  const config: KnipConfig = {
4
- entry: ['src/utils/index.ts', 'public/index.js', 'public/index.legacy.js'],
5
- ignore: ['__tests__/__fixtures__/**'],
4
+ entry: ['public/index.js', 'public/index.legacy.js'],
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.2",
3
4
  "description": "ReadMe's React-based syntax highlighter",
4
- "version": "15.0.0",
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
- "homepage": "https://readmeio.github.io/syntax-highlighter/",
13
- "engines": {
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",
@@ -24,19 +21,18 @@
24
21
  "default": "./dist/index.js"
25
22
  },
26
23
  "./utils": {
27
- "require": "./dist-utils/index.js",
28
- "default": "./dist-utils/index.js"
24
+ "require": "./dist-utils/utils/index.js",
25
+ "default": "./dist-utils/utils/index.js"
29
26
  },
30
27
  "./package.json": "./package.json"
31
28
  },
32
29
  "scripts": {
33
30
  "build": "webpack --progress && tsc",
34
- "format": "prettier --write . && eslint . --fix --ext .js,.jsx,.ts,.tsx",
35
- "lint": "eslint . --ext .js,.jsx,.ts,.tsx",
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 && npm run prettier && tsc --noEmit && knip",
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/eslint-config": "^14.8.1",
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.0.8",
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": "^28.0.0",
69
- "knip": "^5.69.0",
70
- "prettier": "^3.2.5",
58
+ "jsdom": "^29.1.1",
59
+ "knip": "^6.10.0",
60
+ "oxfmt": "^0.53.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": "^5.9.3",
76
- "vitest": "^4.0.8",
66
+ "typescript": "^6.0.3",
67
+ "vitest": "^4.1.5",
77
68
  "webpack": "^5.91.0",
78
- "webpack-cli": "^6.0.1",
69
+ "webpack-cli": "^7.0.2",
79
70
  "webpack-dev-server": "^5.0.4"
80
71
  },
81
- "prettier": "@readme/eslint-config/prettier"
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
  }
@@ -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;
@@ -225,7 +225,7 @@ const ReadmeCodeMirror = (
225
225
  const token = reinsertVariables(accum);
226
226
 
227
227
  const styledToken = curStyle ? (
228
- // eslint-disable-next-line no-plusplus
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,3 +1,4 @@
1
+ // oxlint-disable typescript/no-require-imports
1
2
  // Codemirror-specfic mode-integrations, used for styling syntax
2
3
  require('codemirror/mode/clike/clike');
3
4
  require('codemirror/mode/clojure/clojure');
@@ -1,14 +1,18 @@
1
- /* eslint-disable operator-assignment */
2
- /* eslint-disable prefer-template */
3
- /* eslint-disable object-shorthand */
4
- /* eslint-disable no-return-assign */
5
- /* eslint-disable no-unused-expressions */
6
- /* eslint-disable consistent-return */
7
- /* eslint-disable no-prototype-builtins */
8
- /* eslint-disable no-useless-escape */
9
- /* eslint-disable eqeqeq */
10
- /* eslint-disable no-use-before-define */
11
- /* eslint-disable global-require */
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-arrow-callback
9
+ // oxlint-disable prefer-template
10
+ // oxlint-disable no-return-assign
11
+ // oxlint-disable no-unused-expressions
12
+ // oxlint-disable no-prototype-builtins
13
+ // oxlint-disable no-useless-escape
14
+ // oxlint-disable eqeqeq
15
+ // oxlint-disable global-require
12
16
 
13
17
  /**
14
18
  * This mode has been adapted from the source of `codemirror-solidity` as the way that library is
@@ -23,13 +27,16 @@
23
27
  if (typeof exports === 'object' && typeof module === 'object') {
24
28
  // CommonJS
25
29
  mod(require('codemirror/lib/codemirror'));
26
- // eslint-disable-next-line no-undef
30
+
31
+ // oxlint-disable-next-line no-undef
27
32
  } else if (typeof define === 'function' && define.amd) {
28
33
  // AMD
29
- define(['codemirror/lib/codemirror'], mod); // eslint-disable-line no-undef
34
+ // oxlint-disable-next-line no-undef
35
+ define(['codemirror/lib/codemirror'], mod);
30
36
  } else {
31
37
  // Plain browser env
32
- mod(CodeMirror); // eslint-disable-line no-undef
38
+ // oxlint-disable-next-line no-undef
39
+ mod(CodeMirror);
33
40
  }
34
41
  })(function (CodeMirror) {
35
42
  CodeMirror.defineMode('solidity', function (config) {
@@ -537,7 +544,7 @@
537
544
 
538
545
  // Interface
539
546
  return {
540
- startState: function (basecolumn) {
547
+ startState(basecolumn) {
541
548
  return {
542
549
  tokenize: null,
543
550
  context: new Context((basecolumn || 0) - indentUnit, 0, 'top', false),
@@ -546,7 +553,7 @@
546
553
  };
547
554
  },
548
555
 
549
- token: function (stream, state) {
556
+ token(stream, state) {
550
557
  const ctx = state.context;
551
558
  if (stream.sol()) {
552
559
  if (ctx.align == null) ctx.align = false;
@@ -572,7 +579,7 @@
572
579
  return style;
573
580
  },
574
581
 
575
- indent: function (state, textAfter) {
582
+ indent(state, textAfter) {
576
583
  if (state.tokenize != tokenBase && state.tokenize != null) return CodeMirror.Pass;
577
584
  const ctx = state.context;
578
585
  const firstChar = textAfter && textAfter.charAt(0);
package/tsconfig.json CHANGED
@@ -5,6 +5,7 @@
5
5
  "jsx": "react-jsx",
6
6
  "module": "node20",
7
7
  "outDir": "dist-utils",
8
+ "rootDir": "src/",
8
9
  "strict": true,
9
10
  "target": "es2020"
10
11
  },
@@ -1,3 +1,4 @@
1
+ // oxlint-disable typescript/no-require-imports
1
2
  const path = require('path');
2
3
 
3
4
  const HtmlWebPackPlugin = require('html-webpack-plugin');
package/webpack.config.js CHANGED
@@ -1,3 +1,4 @@
1
+ // oxlint-disable typescript/no-require-imports
1
2
  const path = require('path');
2
3
 
3
4
  const base = {
@@ -1,5 +0,0 @@
1
- {
2
- "biome.enabled": false,
3
- "eslint.enable": true,
4
- "prettier.enable": true
5
- }
File without changes
File without changes
File without changes
File without changes
File without changes