fumadocs-core 15.2.9 → 15.2.10

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.
@@ -54,16 +54,17 @@ async function getHighlighter(engineType, options) {
54
54
  const { createHighlighter } = await import("shiki");
55
55
  let highlighter = highlighters.get(engineType);
56
56
  if (!highlighter) {
57
- let engine = options.engine;
57
+ let engine;
58
58
  if (engineType === "js") {
59
59
  engine = import("shiki/engine/javascript").then(
60
60
  (res) => res.createJavaScriptRegexEngine()
61
61
  );
62
- }
63
- if (engineType === "oniguruma" || !engine) {
62
+ } else if (engineType === "oniguruma" || !options.engine) {
64
63
  engine = import("shiki/engine/oniguruma").then(
65
64
  (res) => res.createOnigurumaEngine(import("shiki/wasm"))
66
65
  );
66
+ } else {
67
+ engine = options.engine;
67
68
  }
68
69
  highlighter = createHighlighter({
69
70
  ...options,
@@ -3,7 +3,7 @@ import {
3
3
  _highlight,
4
4
  _renderHighlight,
5
5
  highlight
6
- } from "../chunk-BUCUQ3WX.js";
6
+ } from "../chunk-SRVMHXJD.js";
7
7
  import "../chunk-MLKGABMK.js";
8
8
 
9
9
  // src/highlight/client.tsx
@@ -1,4 +1,4 @@
1
- import { CodeToHastOptionsCommon, BundledLanguage, CodeOptionsMeta, Awaitable, RegexEngine, CodeOptionsThemes, ShikiTransformer } from 'shiki';
1
+ import { CodeToHastOptionsCommon, BundledLanguage, CodeOptionsMeta, Awaitable, RegexEngine, CodeOptionsThemes, ShikiTransformer, BundledHighlighterOptions, Highlighter } from 'shiki';
2
2
  import { BundledTheme } from 'shiki/themes';
3
3
  import { Components } from 'hast-util-to-jsx-runtime';
4
4
  import { ReactNode } from 'react';
@@ -10,6 +10,13 @@ type HighlightOptionsCommon = CodeToHastOptionsCommon<BundledLanguage> & CodeOpt
10
10
  };
11
11
  type HighlightOptionsThemes = CodeOptionsThemes<BundledTheme>;
12
12
  type HighlightOptions = HighlightOptionsCommon & (HighlightOptionsThemes | Record<never, never>);
13
+ /**
14
+ * Get Shiki highlighter instance of Fumadocs (mostly for internal use, don't recommend you to use it).
15
+ *
16
+ * @param engineType - engine type, the engine specified in `options` will only be effective when this is set to `custom`.
17
+ * @param options - Shiki options.
18
+ */
19
+ declare function getHighlighter(engineType: 'js' | 'oniguruma' | 'custom', options: BundledHighlighterOptions<BundledLanguage, BundledTheme>): Promise<Highlighter>;
13
20
  declare function highlight(code: string, options: HighlightOptions): Promise<ReactNode>;
14
21
 
15
- export { type HighlightOptions, type HighlightOptionsCommon, type HighlightOptionsThemes, createStyleTransformer, highlight };
22
+ export { type HighlightOptions, type HighlightOptionsCommon, type HighlightOptionsThemes, createStyleTransformer, getHighlighter, highlight };
@@ -1,9 +1,11 @@
1
1
  import {
2
2
  createStyleTransformer,
3
+ getHighlighter,
3
4
  highlight
4
- } from "../chunk-BUCUQ3WX.js";
5
+ } from "../chunk-SRVMHXJD.js";
5
6
  import "../chunk-MLKGABMK.js";
6
7
  export {
7
8
  createStyleTransformer,
9
+ getHighlighter,
8
10
  highlight
9
11
  };
@@ -10,7 +10,7 @@ import {
10
10
  createStyleTransformer,
11
11
  defaultThemes,
12
12
  getHighlighter
13
- } from "../chunk-BUCUQ3WX.js";
13
+ } from "../chunk-SRVMHXJD.js";
14
14
  import "../chunk-MLKGABMK.js";
15
15
 
16
16
  // src/mdx-plugins/index.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-core",
3
- "version": "15.2.9",
3
+ "version": "15.2.10",
4
4
  "description": "The library for building a documentation website in Next.js",
5
5
  "keywords": [
6
6
  "NextJs",
@@ -79,8 +79,8 @@
79
79
  "dependencies": {
80
80
  "@formatjs/intl-localematcher": "^0.6.1",
81
81
  "@orama/orama": "^3.1.6",
82
- "@shikijs/rehype": "^3.2.2",
83
- "@shikijs/transformers": "^3.2.2",
82
+ "@shikijs/rehype": "^3.3.0",
83
+ "@shikijs/transformers": "^3.3.0",
84
84
  "github-slugger": "^2.0.0",
85
85
  "hast-util-to-estree": "^3.1.3",
86
86
  "hast-util-to-jsx-runtime": "^2.3.6",
@@ -90,7 +90,7 @@
90
90
  "remark": "^15.0.0",
91
91
  "remark-gfm": "^4.0.1",
92
92
  "scroll-into-view-if-needed": "^3.1.0",
93
- "shiki": "^3.2.2",
93
+ "shiki": "^3.3.0",
94
94
  "unist-util-visit": "^5.0.0"
95
95
  },
96
96
  "devDependencies": {