@readme/syntax-highlighter 15.0.0-beta.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.
@@ -2,8 +2,42 @@
2
2
  /******/ "use strict";
3
3
  /******/ var __webpack_modules__ = ({
4
4
 
5
- /***/ 42:
6
- /***/ ((__unused_webpack_module, exports) => {
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
+
39
+ /***/ 42
40
+ (__unused_webpack_module, exports) {
7
41
 
8
42
 
9
43
 
@@ -74,10 +108,10 @@ var canonical = function canonical(language) {
74
108
  };
75
109
  exports["default"] = canonical;
76
110
 
77
- /***/ }),
111
+ /***/ },
78
112
 
79
- /***/ 476:
80
- /***/ ((__unused_webpack_module, exports) => {
113
+ /***/ 476
114
+ (__unused_webpack_module, exports) {
81
115
 
82
116
 
83
117
 
@@ -143,6 +177,7 @@ exports.modes = {
143
177
  node: 'javascript',
144
178
  macruby: 'ruby',
145
179
  markdown: 'gfm',
180
+ md: 'gfm',
146
181
  ml: ['mllike', 'text/x-ocaml'],
147
182
  mssql: ['sql', 'text/x-mssql'],
148
183
  mysql: ['sql', 'text/x-mysql'],
@@ -196,44 +231,10 @@ function getMode(lang) {
196
231
  return mode;
197
232
  }
198
233
 
199
- /***/ }),
200
-
201
- /***/ 638:
202
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
203
-
204
-
205
-
206
- var __importDefault = this && this.__importDefault || function (mod) {
207
- return mod && mod.__esModule ? mod : {
208
- "default": mod
209
- };
210
- };
211
- Object.defineProperty(exports, "__esModule", ({
212
- value: true
213
- }));
214
- exports.getMode = exports.modes = exports.canonical = exports.uppercase = void 0;
215
- var canonical_1 = __importDefault(__webpack_require__(42));
216
- exports.canonical = canonical_1.default;
217
- var modes_1 = __webpack_require__(476);
218
- Object.defineProperty(exports, "modes", ({
219
- enumerable: true,
220
- get: function get() {
221
- return modes_1.modes;
222
- }
223
- }));
224
- Object.defineProperty(exports, "getMode", ({
225
- enumerable: true,
226
- get: function get() {
227
- return modes_1.getMode;
228
- }
229
- }));
230
- var uppercase_1 = __importDefault(__webpack_require__(704));
231
- exports.uppercase = uppercase_1.default;
232
-
233
- /***/ }),
234
+ /***/ },
234
235
 
235
- /***/ 704:
236
- /***/ ((__unused_webpack_module, exports) => {
236
+ /***/ 704
237
+ (__unused_webpack_module, exports) {
237
238
 
238
239
 
239
240
 
@@ -353,7 +354,7 @@ function uppercase(language) {
353
354
  return language;
354
355
  }
355
356
 
356
- /***/ })
357
+ /***/ }
357
358
 
358
359
  /******/ });
359
360
  /************************************************************************/
@@ -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";
@@ -44,6 +44,7 @@ declare const _default: {
44
44
  readonly node: "javascript";
45
45
  readonly macruby: "ruby";
46
46
  readonly markdown: "gfm";
47
+ readonly md: "gfm";
47
48
  readonly ml: readonly ["mllike", "text/x-ocaml"];
48
49
  readonly mssql: readonly ["sql", "text/x-mssql"];
49
50
  readonly mysql: readonly ["sql", "text/x-mysql"];
@@ -39,6 +39,7 @@ export declare const modes: {
39
39
  readonly node: "javascript";
40
40
  readonly macruby: "ruby";
41
41
  readonly markdown: "gfm";
42
+ readonly md: "gfm";
42
43
  readonly ml: readonly ["mllike", "text/x-ocaml"];
43
44
  readonly mssql: readonly ["sql", "text/x-mssql"];
44
45
  readonly mysql: readonly ["sql", "text/x-mysql"];
@@ -53,6 +53,7 @@ exports.modes = {
53
53
  node: 'javascript',
54
54
  macruby: 'ruby',
55
55
  markdown: 'gfm',
56
+ md: 'gfm',
56
57
  ml: ['mllike', 'text/x-ocaml'],
57
58
  mssql: ['sql', 'text/x-mssql'],
58
59
  mysql: ['sql', 'text/x-mysql'],
package/knip.ts CHANGED
@@ -2,11 +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: ['__tests__/__fixtures__/**'],
5
+ ignore: ['test/__fixtures__/**'],
6
6
  ignoreDependencies: [
7
7
  '@csstools/css-parser-algorithms', // required in order to get vitest/jsdom running in CI
8
- 'jsdom', // this is installed via vitest
8
+ 'eslint-plugin-readme', // pulled in and used by oxlint
9
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
+ },
10
20
  };
11
21
 
12
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
- "version": "15.0.0-beta.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",
@@ -31,51 +28,53 @@
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"
43
39
  },
44
40
  "dependencies": {
45
41
  "codemirror": "^5.54.0",
46
- "codemirror-graphql": "1.0.2",
42
+ "codemirror-graphql": "1.3.2",
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
- "@csstools/css-parser-algorithms": "^3.0.5",
59
- "@readme/eslint-config": "^14.8.1",
49
+ "@csstools/css-parser-algorithms": "^4.0.0",
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
- "@types/node": "^24.10.1",
63
- "@vitest/coverage-v8": "^4.0.8",
53
+ "@types/node": "^25.0.3",
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
- "knip": "^5.69.0",
69
- "prettier": "^3.2.5",
58
+ "jsdom": "^29.1.1",
59
+ "knip": "^6.10.0",
60
+ "oxfmt": "^0.47.0",
61
+ "oxlint": "^1.62.0",
70
62
  "sass": "^1.89.2",
71
63
  "sass-loader": "^13.3.2",
72
64
  "style-loader": "^4.0.0",
73
65
  "ts-loader": "^9.5.4",
74
- "typescript": "^5.9.3",
75
- "vitest": "^4.0.8",
66
+ "typescript": "^6.0.3",
67
+ "vitest": "^4.1.5",
76
68
  "webpack": "^5.91.0",
77
- "webpack-cli": "^6.0.1",
69
+ "webpack-cli": "^7.0.2",
78
70
  "webpack-dev-server": "^5.0.4"
79
71
  },
80
- "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
+ }
81
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,
@@ -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');
@@ -7,6 +8,7 @@ require('codemirror/mode/diff/diff');
7
8
  require('codemirror/mode/dockerfile/dockerfile');
8
9
  require('codemirror/mode/erlang/erlang');
9
10
  require('codemirror/mode/go/go');
11
+ require('codemirror/mode/gfm/gfm');
10
12
  require('codemirror/mode/groovy/groovy');
11
13
  require('codemirror/mode/htmlmixed/htmlmixed');
12
14
  require('codemirror/mode/http/http');
@@ -1,14 +1,17 @@
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-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
- // eslint-disable-next-line no-undef
29
+
30
+ // oxlint-disable-next-line no-undef
27
31
  } else if (typeof define === 'function' && define.amd) {
28
32
  // AMD
29
- define(['codemirror/lib/codemirror'], mod); // eslint-disable-line no-undef
33
+ // oxlint-disable-next-line no-undef
34
+ define(['codemirror/lib/codemirror'], mod);
30
35
  } else {
31
36
  // Plain browser env
32
- mod(CodeMirror); // eslint-disable-line no-undef
37
+ // oxlint-disable-next-line no-undef
38
+ mod(CodeMirror);
33
39
  }
34
40
  })(function (CodeMirror) {
35
41
  CodeMirror.defineMode('solidity', function (config) {
@@ -49,6 +49,7 @@ export const modes = {
49
49
  node: 'javascript',
50
50
  macruby: 'ruby',
51
51
  markdown: 'gfm',
52
+ md: 'gfm',
52
53
  ml: ['mllike', 'text/x-ocaml'],
53
54
  mssql: ['sql', 'text/x-mssql'],
54
55
  mysql: ['sql', 'text/x-mysql'],
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 = {
File without changes
File without changes
File without changes