fumadocs-mdx 11.2.3 → 11.3.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.
@@ -1,12 +1,9 @@
1
1
  import {
2
2
  findConfigFile,
3
3
  getConfigHash,
4
- getTypeFromPath,
5
4
  loadConfig,
6
- loadConfigCached,
7
- writeManifest
8
- } from "../chunk-UMDOD6VX.js";
9
- import "../chunk-MKWJLEE7.js";
5
+ loadConfigCached
6
+ } from "../chunk-2ZPSMAUV.js";
10
7
 
11
8
  // src/next/create.ts
12
9
  import path3 from "node:path";
@@ -20,6 +17,18 @@ import grayMatter from "gray-matter";
20
17
  // src/map/generate.ts
21
18
  import * as path from "node:path";
22
19
  import fg from "fast-glob";
20
+
21
+ // src/utils/get-type-from-path.ts
22
+ import { extname } from "node:path";
23
+ var docTypes = [".mdx", ".md"];
24
+ var metaTypes = [".json", ".yaml"];
25
+ function getTypeFromPath(path5) {
26
+ const ext = extname(path5);
27
+ if (docTypes.includes(ext)) return "doc";
28
+ if (metaTypes.includes(ext)) return "meta";
29
+ }
30
+
31
+ // src/map/generate.ts
23
32
  async function generateJS(configPath, config, outputPath, configHash, getFrontmatter) {
24
33
  const outDir2 = path.dirname(outputPath);
25
34
  const imports = [
@@ -30,24 +39,26 @@ async function generateJS(configPath, config, outputPath, configHash, getFrontma
30
39
  }
31
40
  ];
32
41
  const importedCollections = /* @__PURE__ */ new Set();
42
+ async function generateEntry(file, collectionName, collection, importId) {
43
+ if (collection.type === "doc" && collection.async) {
44
+ const importPath = `${toImportPath(file.absolutePath, outDir2)}?hash=${configHash}&collection=${collectionName}`;
45
+ const frontmatter = await getFrontmatter(file.absolutePath);
46
+ return `toRuntimeAsync(${JSON.stringify(frontmatter)}, () => import(${JSON.stringify(importPath)}), ${JSON.stringify(file)})`;
47
+ }
48
+ imports.push({
49
+ type: "namespace",
50
+ name: importId,
51
+ specifier: `${toImportPath(file.absolutePath, outDir2)}?collection=${collectionName}&hash=${configHash}`
52
+ });
53
+ return `toRuntime("${collection.type}", ${importId}, ${JSON.stringify(file)})`;
54
+ }
33
55
  config._runtime.files.clear();
34
56
  const entries = Array.from(config.collections.entries());
35
57
  const declares = entries.map(async ([k, collection]) => {
36
58
  const files = await getCollectionFiles(collection);
37
59
  const items = files.map(async (file, i) => {
38
60
  config._runtime.files.set(file.absolutePath, k);
39
- if (collection.type === "doc" && collection.async) {
40
- const importPath = `${toImportPath(file.absolutePath, outDir2)}?hash=${configHash}&collection=${k}`;
41
- const frontmatter = await getFrontmatter(file.absolutePath);
42
- return `toRuntimeAsync(${JSON.stringify(frontmatter)}, () => import(${JSON.stringify(importPath)}), ${JSON.stringify(file)})`;
43
- }
44
- const importName = `${k}_${i.toString()}`;
45
- imports.push({
46
- type: "namespace",
47
- name: importName,
48
- specifier: `${toImportPath(file.absolutePath, outDir2)}?collection=${k}&hash=${configHash}`
49
- });
50
- return `toRuntime("${collection.type}", ${importName}, ${JSON.stringify(file)})`;
61
+ return generateEntry(file, k, collection, `${k}_${i}`);
51
62
  });
52
63
  const resolvedItems = await Promise.all(items);
53
64
  if (collection.transform) {
@@ -125,7 +136,6 @@ function generateTypes(configPath, config, outputPath) {
125
136
  async function start(dev, configPath, outDir2) {
126
137
  let configHash = await getConfigHash(configPath);
127
138
  let config = await loadConfigCached(configPath, configHash);
128
- const manifestPath = path2.resolve(outDir2, "manifest.json");
129
139
  const jsOut = path2.resolve(outDir2, `index.js`);
130
140
  const typeOut = path2.resolve(outDir2, `index.d.ts`);
131
141
  const frontmatterCache = /* @__PURE__ */ new Map();
@@ -183,12 +193,6 @@ async function start(dev, configPath, outDir2) {
183
193
  void instance.close();
184
194
  });
185
195
  }
186
- if (config.global?.generateManifest && !dev) {
187
- process.on("exit", () => {
188
- console.log("[MDX] writing manifest");
189
- writeManifest(manifestPath, config);
190
- });
191
- }
192
196
  }
193
197
 
194
198
  // src/next/create.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-mdx",
3
- "version": "11.2.3",
3
+ "version": "11.3.0",
4
4
  "description": "The built-in source for Fumadocs",
5
5
  "keywords": [
6
6
  "NextJs",
@@ -15,15 +15,18 @@
15
15
  "./loader-mdx": "./loader-mdx.cjs",
16
16
  "./config": {
17
17
  "import": "./dist/config/index.js",
18
- "types": "./dist/config/index.d.ts"
18
+ "types": "./dist/config/index.d.ts",
19
+ "require": "./dist/config/index.cjs"
19
20
  },
20
21
  "./next": {
21
22
  "import": "./dist/next/index.js",
22
- "types": "./dist/next/index.d.ts"
23
+ "types": "./dist/next/index.d.ts",
24
+ "require": "./dist/next/index.cjs"
23
25
  },
24
26
  ".": {
25
27
  "import": "./dist/index.js",
26
- "types": "./dist/index.d.ts"
28
+ "types": "./dist/index.d.ts",
29
+ "require": "./dist/index.cjs"
27
30
  }
28
31
  },
29
32
  "main": "./dist/index.js",
@@ -40,7 +43,7 @@
40
43
  "cross-spawn": "^7.0.6",
41
44
  "esbuild": "^0.24.2",
42
45
  "estree-util-value-to-estree": "^3.2.1",
43
- "fast-glob": "^3.3.1",
46
+ "fast-glob": "^3.3.3",
44
47
  "gray-matter": "^4.0.3",
45
48
  "micromatch": "^4.0.8",
46
49
  "unist-util-visit": "^5.0.0",
@@ -51,15 +54,15 @@
51
54
  "@types/mdast": "^4.0.3",
52
55
  "@types/mdx": "^2.0.13",
53
56
  "@types/micromatch": "^4.0.9",
54
- "@types/react": "^19.0.2",
57
+ "@types/react": "^19.0.4",
55
58
  "mdast-util-mdx-jsx": "^3.1.3",
56
- "next": "^15.1.3",
59
+ "next": "^15.1.4",
57
60
  "unified": "^11.0.5",
58
61
  "vfile": "^6.0.3",
59
62
  "webpack": "^5.97.1",
60
63
  "eslint-config-custom": "0.0.0",
61
- "fumadocs-core": "14.7.1",
62
- "tsconfig": "0.0.0"
64
+ "tsconfig": "0.0.0",
65
+ "fumadocs-core": "14.7.2"
63
66
  },
64
67
  "peerDependencies": {
65
68
  "fumadocs-core": "^14.0.0",
File without changes