fumadocs-core 16.0.0 → 16.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.
@@ -5,6 +5,11 @@ import 'shiki/themes';
5
5
  import 'hast-util-to-jsx-runtime';
6
6
  import 'hast';
7
7
 
8
+ /**
9
+ * get highlighted results, should be used with React Suspense API.
10
+ *
11
+ * note: results are cached with (lang, code) as keys, if this is not the desired behaviour, pass a `deps` instead.
12
+ */
8
13
  declare function useShiki(code: string, options: HighlightOptions, deps?: DependencyList): ReactNode;
9
14
 
10
15
  export { useShiki };
@@ -5,18 +5,12 @@ import {
5
5
  import "../chunk-U67V476Y.js";
6
6
 
7
7
  // src/highlight/client.tsx
8
- import {
9
- use,
10
- useId,
11
- useMemo
12
- } from "react";
8
+ import { use, useMemo } from "react";
13
9
  var promises = {};
14
10
  function useShiki(code, options, deps) {
15
- const id = useId();
16
11
  const key = useMemo(() => {
17
- const state = deps ? JSON.stringify(deps) : `${options.lang}:${code}`;
18
- return `${id}:${state}`;
19
- }, [code, deps, id, options.lang]);
12
+ return deps ? JSON.stringify(deps) : `${options.lang}:${code}`;
13
+ }, [code, deps, options.lang]);
20
14
  return use(promises[key] ??= highlight(code, options));
21
15
  }
22
16
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-core",
3
- "version": "16.0.0",
3
+ "version": "16.0.1",
4
4
  "description": "The library for building a documentation website in any React.js framework",
5
5
  "keywords": [
6
6
  "Fumadocs",