fumadocs-mdx 11.9.0 → 11.10.0

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.
Files changed (42) hide show
  1. package/dist/{runtime/vite.d.ts → browser-B2G8uAF2.d.cts} +9 -35
  2. package/dist/{runtime/vite.d.cts → browser-DrH7tKRi.d.ts} +9 -35
  3. package/dist/bun/index.cjs +667 -0
  4. package/dist/bun/index.d.cts +8 -0
  5. package/dist/bun/index.d.ts +8 -0
  6. package/dist/bun/index.js +50 -0
  7. package/dist/{chunk-766EAFX6.js → chunk-2HKRTQYP.js} +64 -0
  8. package/dist/chunk-46UPKP5R.js +77 -0
  9. package/dist/chunk-5XJM5RPV.js +149 -0
  10. package/dist/chunk-NVX3U5YE.js +82 -0
  11. package/dist/config/index.d.cts +1 -1
  12. package/dist/config/index.d.ts +1 -1
  13. package/dist/config/zod-3.d.cts +1 -1
  14. package/dist/config/zod-3.d.ts +1 -1
  15. package/dist/{define-DnJzAZrj.d.ts → define-BH4bnHQl.d.cts} +6 -0
  16. package/dist/{define-DnJzAZrj.d.cts → define-BH4bnHQl.d.ts} +6 -0
  17. package/dist/index.d.cts +2 -2
  18. package/dist/index.d.ts +2 -2
  19. package/dist/loader-mdx.cjs +345 -265
  20. package/dist/loader-mdx.js +11 -80
  21. package/dist/next/index.js +4 -6
  22. package/dist/node/loader.cjs +748 -0
  23. package/dist/node/loader.d.cts +5 -0
  24. package/dist/node/loader.d.ts +5 -0
  25. package/dist/node/loader.js +23 -0
  26. package/dist/runtime/async.d.cts +2 -2
  27. package/dist/runtime/async.d.ts +2 -2
  28. package/dist/runtime/vite/browser.cjs +103 -0
  29. package/dist/runtime/vite/browser.d.cts +11 -0
  30. package/dist/runtime/vite/browser.d.ts +11 -0
  31. package/dist/runtime/vite/browser.js +10 -0
  32. package/dist/runtime/{vite.cjs → vite/server.cjs} +77 -63
  33. package/dist/runtime/vite/server.d.cts +41 -0
  34. package/dist/runtime/vite/server.d.ts +41 -0
  35. package/dist/runtime/{vite.js → vite/server.js} +10 -64
  36. package/dist/{types-WSHJKA8L.d.ts → types-DN9KrG7R.d.ts} +1 -1
  37. package/dist/{types-BmVgoqsr.d.cts → types-DT83Ijs6.d.cts} +1 -1
  38. package/dist/vite/index.cjs +356 -282
  39. package/dist/vite/index.js +12 -78
  40. package/package.json +21 -11
  41. package/dist/chunk-GX3THK2Q.js +0 -66
  42. package/dist/chunk-UCY7OBZG.js +0 -12
@@ -1,92 +1,23 @@
1
1
  import {
2
- getConfigHash,
3
- loadConfig
4
- } from "./chunk-766EAFX6.js";
2
+ toWebpack
3
+ } from "./chunk-NVX3U5YE.js";
5
4
  import {
6
- countLines
7
- } from "./chunk-UCY7OBZG.js";
8
- import {
9
- ValidationError,
10
- getGitTimestamp,
11
- validate
12
- } from "./chunk-GX3THK2Q.js";
13
- import {
14
- buildMDX
15
- } from "./chunk-QQWCBFFE.js";
5
+ createMdxLoader,
6
+ dynamicConfig
7
+ } from "./chunk-5XJM5RPV.js";
8
+ import "./chunk-2HKRTQYP.js";
9
+ import "./chunk-QQWCBFFE.js";
16
10
  import "./chunk-SVTXMVLQ.js";
17
11
  import "./chunk-QVZ7JH4H.js";
18
- import {
19
- fumaMatter
20
- } from "./chunk-VWJKRQZR.js";
12
+ import "./chunk-VWJKRQZR.js";
21
13
 
22
14
  // src/loader-mdx.ts
23
- import * as path from "path";
24
- import { parse } from "querystring";
15
+ var instance;
25
16
  async function loader(source, callback) {
26
17
  this.cacheable(true);
27
- const context = this.context;
28
- const filePath = this.resourcePath;
29
18
  const { configPath, outDir } = this.getOptions();
30
- const matter = fumaMatter(source);
31
- const {
32
- hash: configHash = await getConfigHash(configPath),
33
- collection: collectionId
34
- } = parse(this.resourceQuery.slice(1));
35
- const config = await loadConfig(configPath, outDir, configHash);
36
- let collection = collectionId !== void 0 ? config.collections.get(collectionId) : void 0;
37
- if (collection && collection.type === "docs") collection = collection.docs;
38
- if (collection && collection.type !== "doc") {
39
- collection = void 0;
40
- }
41
- let frontmatter = matter.data;
42
- const mdxOptions = collection?.mdxOptions ?? await config.getDefaultMDXOptions();
43
- if (collection?.schema) {
44
- try {
45
- frontmatter = await validate(
46
- collection.schema,
47
- frontmatter,
48
- {
49
- source,
50
- path: filePath
51
- },
52
- `invalid frontmatter in ${filePath}`
53
- );
54
- } catch (e) {
55
- if (e instanceof ValidationError) {
56
- return callback(new Error(e.toStringFormatted()));
57
- }
58
- return callback(e);
59
- }
60
- }
61
- let timestamp;
62
- if (config.global?.lastModifiedTime === "git") {
63
- timestamp = (await getGitTimestamp(filePath))?.getTime();
64
- }
65
- try {
66
- const lineOffset = "\n".repeat(
67
- this.mode === "development" ? countLines(matter.matter) : 0
68
- );
69
- const file = await buildMDX(
70
- `${configHash}:${collectionId ?? "global"}`,
71
- lineOffset + matter.content,
72
- {
73
- development: this.mode === "development",
74
- ...mdxOptions,
75
- filePath,
76
- frontmatter,
77
- data: {
78
- lastModified: timestamp
79
- },
80
- _compiler: this
81
- }
82
- );
83
- callback(void 0, String(file.value), file.map ?? void 0);
84
- } catch (error) {
85
- if (!(error instanceof Error)) throw error;
86
- const fpath = path.relative(context, filePath);
87
- error.message = `${fpath}:${error.name}: ${error.message}`;
88
- callback(error);
89
- }
19
+ instance ??= toWebpack(createMdxLoader(dynamicConfig(configPath, outDir)));
20
+ await instance.call(this, source, callback);
90
21
  }
91
22
  export {
92
23
  loader as default
@@ -1,8 +1,3 @@
1
- import {
2
- findConfigFile,
3
- getConfigHash,
4
- loadConfig
5
- } from "../chunk-766EAFX6.js";
6
1
  import {
7
2
  entry,
8
3
  getGlobPatterns,
@@ -12,9 +7,12 @@ import {
12
7
  } from "../chunk-COQ4VMK2.js";
13
8
  import {
14
9
  ValidationError,
10
+ findConfigFile,
11
+ getConfigHash,
15
12
  getGitTimestamp,
13
+ loadConfig,
16
14
  validate
17
- } from "../chunk-GX3THK2Q.js";
15
+ } from "../chunk-2HKRTQYP.js";
18
16
  import "../chunk-QVZ7JH4H.js";
19
17
  import {
20
18
  fumaMatter