fumadocs-core 15.0.7 → 15.0.9

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.
@@ -19,23 +19,21 @@ var defaultThemes = {
19
19
  light: "github-light",
20
20
  dark: "github-dark"
21
21
  };
22
+ var defaultEngine;
22
23
  async function _highlight(code, options) {
23
24
  const { getSingletonHighlighter } = await import("shiki");
24
- const { lang, components: _, engine: defaultEngine, ...rest } = options;
25
+ const { lang, components: _, engine, ...rest } = options;
25
26
  let themes = { themes: defaultThemes };
26
27
  if ("theme" in options && options.theme) {
27
28
  themes = { theme: options.theme };
28
29
  } else if ("themes" in options && options.themes) {
29
30
  themes = { themes: options.themes };
30
31
  }
31
- let engine = defaultEngine;
32
- if (!engine) {
33
- const { createOnigurumaEngine } = await import("shiki/engine/oniguruma");
34
- engine = await createOnigurumaEngine(await import("shiki/wasm"));
35
- }
36
32
  const highlighter = await getSingletonHighlighter({
37
33
  langs: [lang],
38
- engine,
34
+ engine: engine ?? (defaultEngine ??= await import("shiki/engine/oniguruma").then(
35
+ (res) => res.createOnigurumaEngine(import("shiki/wasm"))
36
+ )),
39
37
  themes: "theme" in themes ? [themes.theme] : Object.values(themes.themes).filter((v) => v !== void 0)
40
38
  });
41
39
  return highlighter.codeToHast(code, {
@@ -9,7 +9,7 @@ import {
9
9
  import {
10
10
  createStyleTransformer,
11
11
  defaultThemes
12
- } from "../chunk-VD7J34CI.js";
12
+ } from "../chunk-SCQ5QN2V.js";
13
13
  import "../chunk-MLKGABMK.js";
14
14
 
15
15
  // src/mdx-plugins/index.ts
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  createStyleTransformer,
6
6
  highlight
7
- } from "../chunk-VD7J34CI.js";
7
+ } from "../chunk-SCQ5QN2V.js";
8
8
  import "../chunk-MLKGABMK.js";
9
9
 
10
10
  // src/server/get-toc.ts
@@ -3,7 +3,7 @@ import {
3
3
  _highlight,
4
4
  _renderHighlight,
5
5
  highlight
6
- } from "../chunk-VD7J34CI.js";
6
+ } from "../chunk-SCQ5QN2V.js";
7
7
  import "../chunk-MLKGABMK.js";
8
8
 
9
9
  // src/utils/use-shiki.tsx
@@ -28,7 +28,6 @@ function getHighlightOptions(from) {
28
28
  engine: jsEngine
29
29
  };
30
30
  }
31
- var cache = /* @__PURE__ */ new Map();
32
31
  function useShiki(code, {
33
32
  defaultValue,
34
33
  scriptKey,
@@ -45,13 +44,9 @@ function useShiki(code, {
45
44
  });
46
45
  const [rendered, setRendered] = useState(() => {
47
46
  if (defaultValue) return defaultValue;
48
- const cached = cache.get(key);
49
- if (cached) return cached;
50
47
  const hast = globalThis._use_shiki?.get(scriptKey);
51
48
  if (hast) {
52
- const node = _renderHighlight(hast, shikiOptions);
53
- cache.set(key, node);
54
- return node;
49
+ return _renderHighlight(hast, shikiOptions);
55
50
  }
56
51
  currentTask.current = void 0;
57
52
  const Pre = options.components?.pre ?? "pre";
@@ -71,7 +66,6 @@ function useShiki(code, {
71
66
  };
72
67
  currentTask.current = task;
73
68
  highlight(code, shikiOptions).then((result) => {
74
- cache.set(key, result);
75
69
  if (!task.aborted) setRendered(result);
76
70
  });
77
71
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-core",
3
- "version": "15.0.7",
3
+ "version": "15.0.9",
4
4
  "description": "The library for building a documentation website in Next.js",
5
5
  "keywords": [
6
6
  "NextJs",
@@ -83,8 +83,8 @@
83
83
  "dependencies": {
84
84
  "@formatjs/intl-localematcher": "^0.6.0",
85
85
  "@orama/orama": "^2.1.1",
86
- "@shikijs/rehype": "^2.3.2",
87
- "@shikijs/transformers": "^2.3.2",
86
+ "@shikijs/rehype": "^2.4.1",
87
+ "@shikijs/transformers": "^2.4.1",
88
88
  "github-slugger": "^2.0.0",
89
89
  "hast-util-to-estree": "^3.1.1",
90
90
  "hast-util-to-jsx-runtime": "^2.3.2",
@@ -92,9 +92,9 @@
92
92
  "negotiator": "^1.0.0",
93
93
  "react-remove-scroll": "^2.6.3",
94
94
  "remark": "^15.0.0",
95
- "remark-gfm": "^4.0.0",
95
+ "remark-gfm": "^4.0.1",
96
96
  "scroll-into-view-if-needed": "^3.1.0",
97
- "shiki": "^2.3.2",
97
+ "shiki": "^2.4.1",
98
98
  "unist-util-visit": "^5.0.0"
99
99
  },
100
100
  "devDependencies": {
@@ -106,13 +106,13 @@
106
106
  "@types/hast": "^3.0.4",
107
107
  "@types/mdast": "^4.0.3",
108
108
  "@types/negotiator": "^0.6.3",
109
- "@types/node": "22.13.1",
110
- "@types/react": "^19.0.8",
109
+ "@types/node": "22.13.4",
110
+ "@types/react": "^19.0.9",
111
111
  "@types/react-dom": "^19.0.3",
112
112
  "algoliasearch": "4.24.0",
113
113
  "mdast-util-mdx-jsx": "^3.2.0",
114
114
  "mdast-util-mdxjs-esm": "^2.0.1",
115
- "next": "^15.1.6",
115
+ "next": "^15.1.7",
116
116
  "remark-mdx": "^3.1.0",
117
117
  "remark-rehype": "^11.1.1",
118
118
  "typescript": "^5.7.3",