fumadocs-mdx 11.2.1 → 11.2.2

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.
@@ -9,34 +9,20 @@ import * as fs from "node:fs";
9
9
  // src/config/load.ts
10
10
  import * as path from "node:path";
11
11
  import { pathToFileURL } from "node:url";
12
- import { build } from "esbuild";
12
+ import { createJiti } from "jiti";
13
13
  function findConfigFile() {
14
14
  return path.resolve("source.config.ts");
15
15
  }
16
+ var jiti = createJiti(import.meta.url, {
17
+ moduleCache: false
18
+ });
16
19
  async function loadConfig(configPath) {
17
- const outputPath = path.resolve(".source/source.config.mjs");
18
- const transformed = await build({
19
- entryPoints: [{ in: configPath, out: "source.config" }],
20
- bundle: true,
21
- outdir: ".source",
22
- target: "node18",
23
- write: true,
24
- platform: "node",
25
- format: "esm",
26
- packages: "external",
27
- outExtension: {
28
- ".js": ".mjs"
29
- },
30
- allowOverwrite: true,
31
- splitting: true
20
+ const imported = await jiti.import(pathToFileURL(configPath).href).catch((e) => {
21
+ throw new Error("failed to compile configuration file", e);
32
22
  });
33
- if (transformed.errors.length > 0) {
34
- throw new Error("failed to compile configuration file");
35
- }
36
- const url = pathToFileURL(outputPath);
37
23
  const [err, config] = buildConfig(
38
24
  // every call to `loadConfig` will cause the previous cache to be ignored
39
- await import(`${url.toString()}?hash=${Date.now().toString()}`)
25
+ imported
40
26
  );
41
27
  if (err !== null) throw new Error(err);
42
28
  return config;
@@ -89,7 +75,7 @@ async function loadConfigCached(configPath, hash) {
89
75
  return await config;
90
76
  }
91
77
  async function getConfigHash(configPath) {
92
- const hash = createHash("sha256");
78
+ const hash = createHash("md5");
93
79
  const rs = fs.createReadStream(configPath);
94
80
  for await (const chunk of rs) {
95
81
  hash.update(chunk);
package/dist/index.d.ts CHANGED
@@ -11,7 +11,7 @@ import 'webpack';
11
11
 
12
12
  declare function toRuntime(type: 'doc' | 'meta', file: Record<string, unknown>, info: FileInfo): unknown;
13
13
  declare function toRuntimeAsync(frontmatter: Record<string, unknown>, load: () => Promise<Record<string, unknown>>, info: FileInfo): unknown;
14
- declare function createMDXSource<Doc extends PageData & BaseCollectionEntry, Meta extends MetaData & BaseCollectionEntry>(docs: Doc[], meta: Meta[]): Source<{
14
+ declare function createMDXSource<Doc extends PageData & BaseCollectionEntry, Meta extends MetaData & BaseCollectionEntry>(docs: Doc[], meta?: Meta[]): Source<{
15
15
  pageData: Doc;
16
16
  metaData: Meta;
17
17
  }>;
package/dist/index.js CHANGED
@@ -53,7 +53,7 @@ function toRuntimeAsync(frontmatter, load, info) {
53
53
  _file: info
54
54
  };
55
55
  }
56
- function createMDXSource(docs, meta) {
56
+ function createMDXSource(docs, meta = []) {
57
57
  return {
58
58
  files: (rootDir) => resolveFiles({
59
59
  docs,
@@ -5,7 +5,7 @@ import {
5
5
  getConfigHash,
6
6
  getManifestEntryPath,
7
7
  loadConfigCached
8
- } from "./chunk-EVNXCXU4.js";
8
+ } from "./chunk-2KEQHW7J.js";
9
9
  import "./chunk-MKWJLEE7.js";
10
10
 
11
11
  // src/loader-mdx.ts
@@ -5,7 +5,7 @@ import {
5
5
  loadConfig,
6
6
  loadConfigCached,
7
7
  writeManifest
8
- } from "../chunk-EVNXCXU4.js";
8
+ } from "../chunk-2KEQHW7J.js";
9
9
  import "../chunk-MKWJLEE7.js";
10
10
 
11
11
  // src/next/create.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-mdx",
3
- "version": "11.2.1",
3
+ "version": "11.2.2",
4
4
  "description": "The built-in source for Fumadocs",
5
5
  "keywords": [
6
6
  "NextJs",
@@ -38,10 +38,10 @@
38
38
  "@mdx-js/mdx": "^3.1.0",
39
39
  "chokidar": "^4.0.3",
40
40
  "cross-spawn": "^7.0.6",
41
- "esbuild": "^0.24.2",
42
41
  "estree-util-value-to-estree": "^3.2.1",
43
42
  "fast-glob": "^3.3.1",
44
43
  "gray-matter": "^4.0.3",
44
+ "jiti": "^2.4.2",
45
45
  "micromatch": "^4.0.8",
46
46
  "unist-util-visit": "^5.0.0",
47
47
  "zod": "^3.24.1"
@@ -53,12 +53,12 @@
53
53
  "@types/micromatch": "^4.0.9",
54
54
  "@types/react": "^19.0.2",
55
55
  "mdast-util-mdx-jsx": "^3.1.3",
56
- "next": "^15.1.2",
56
+ "next": "^15.1.3",
57
57
  "unified": "^11.0.5",
58
58
  "vfile": "^6.0.3",
59
59
  "webpack": "^5.97.1",
60
60
  "eslint-config-custom": "0.0.0",
61
- "fumadocs-core": "14.6.4",
61
+ "fumadocs-core": "14.7.0",
62
62
  "tsconfig": "0.0.0"
63
63
  },
64
64
  "peerDependencies": {