fumadocs-mdx 15.6.4 → 15.6.5

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.
@@ -3,6 +3,7 @@ import { n as ValidationError } from "./core-r1WHKfaI.js";
3
3
  import { t as loadConfig } from "./load-from-file-Bt3g8VEm.js";
4
4
  import { existsSync, readFileSync } from "node:fs";
5
5
  import fs from "node:fs/promises";
6
+ import path from "node:path";
6
7
  import { fileURLToPath } from "node:url";
7
8
  import { parse } from "node:querystring";
8
9
  // src/loaders/config.ts
@@ -127,6 +128,9 @@ function toBun(test, loader) {
127
128
  };
128
129
  }
129
130
  return (build) => {
131
+ build.onResolve({ filter: test ?? /.+/ }, (args) => {
132
+ if (args.path.includes("?")) return { path: path.resolve(path.dirname(args.importer), args.path) };
133
+ });
130
134
  build.onLoad({ filter: test ?? /.+/ }, (args) => {
131
135
  const [filePath, query = ""] = args.path.split("?", 2);
132
136
  const input = {
@@ -3,10 +3,10 @@ import { t as __exportAll } from "./rolldown-runtime-D3KUYPsf.js";
3
3
  var build_exports = /* @__PURE__ */ __exportAll({ buildMDX: () => buildMDX });
4
4
  async function buildMDX(core, collection, options) {
5
5
  if ((collection ? collection.compiler : core.getConfig().global.compiler) === "satteri") {
6
- const { buildSatteriMDX } = await import("./build-satteri-D5Wi9P9C.js");
6
+ const { buildSatteriMDX } = await import("./build-satteri-BIE-M-JZ.js");
7
7
  return buildSatteriMDX(core, collection, options);
8
8
  }
9
- const { buildJSMDX } = await import("./build-default-CQWQe8Am.js");
9
+ const { buildJSMDX } = await import("./build-default-vTNu4xsh.js");
10
10
  return buildJSMDX(core, collection, options);
11
11
  }
12
12
  export { build_exports as n, buildMDX as t };
@@ -1,6 +1,6 @@
1
1
  import { t as applyMdxPreset } from "./preset-CUfyGsn3.js";
2
2
  import { t as listCode } from "./code-output-CvL35taM.js";
3
- import { r as walkBranches, t as resolveLastModified } from "./last-modified-CCz7qakL.js";
3
+ import { r as walkBranches, t as resolveLastModified } from "./last-modified-DZQhqrFZ.js";
4
4
  import { Parser } from "acorn";
5
5
  import { remarkInclude } from "fumadocs-core/mdx-plugins/remark-include";
6
6
  import { createProcessor } from "@mdx-js/mdx";
@@ -1,4 +1,4 @@
1
- import { n as showConditions, t as resolveLastModified } from "./last-modified-CCz7qakL.js";
1
+ import { n as showConditions, t as resolveLastModified } from "./last-modified-DZQhqrFZ.js";
2
2
  import { t as listCode } from "./code-output-CvL35taM.js";
3
3
  import { pathToFileURL } from "node:url";
4
4
  // src/loaders/mdx/build-satteri.ts
package/dist/bun/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import { t as createMdxLoader } from "../mdx-oiwGpmIR.js";
1
+ import { t as createMdxLoader } from "../mdx-CwVlI0Qe.js";
2
2
  import { r as buildConfig } from "../build-Dc0aOaCg.js";
3
3
  import { t as createCore } from "../core-r1WHKfaI.js";
4
- import { a as createIntegratedConfigLoader, t as toBun } from "../adapter-DJT55ieR.js";
4
+ import { a as createIntegratedConfigLoader, t as toBun } from "../adapter-Clt8sB1g.js";
5
5
  import { t as createMetaLoader } from "../meta-CsSsB7_T.js";
6
6
  import { r as metaLoaderGlob, t as mdxLoaderGlob } from "../loaders-3R0gLmlP.js";
7
7
  import { i as resolveMacroOptions, n as NodeModulesRegex, r as createMacroMatcher } from "../options-DZSjmVhY.js";
@@ -10,6 +10,8 @@ import { randomUUID } from "node:crypto";
10
10
  import { pathToFileURL } from "node:url";
11
11
  // src/bun/index.ts
12
12
  const EvalQueryKey = "fd-macro-eval";
13
+ const pendingEvals = /* @__PURE__ */ new Map();
14
+ let runtimeEvalHook = false;
13
15
  /**
14
16
  * JS/TS modules outside of `node_modules`, with an optional import query.
15
17
  *
@@ -40,7 +42,6 @@ function createMdxPlugin(options = {}) {
40
42
  if (macroOptions) {
41
43
  const root = process.cwd();
42
44
  const { MacroCollector } = await import("../eval-Ch9sPj_e.js").then((n) => n.r);
43
- const pendingEvals = /* @__PURE__ */ new Map();
44
45
  core.macro = new MacroCollector({
45
46
  root,
46
47
  outDir: core.outDir,
@@ -57,7 +58,7 @@ function createMdxPlugin(options = {}) {
57
58
  }
58
59
  });
59
60
  const matcher = createMacroMatcher(root, macroOptions);
60
- build.onLoad({ filter: macroFilter }, async (args) => {
61
+ const load = async (args) => {
61
62
  const [file, query = ""] = args.path.split("?", 2);
62
63
  const loader = bunLoader(file);
63
64
  const source = await Bun.file(file).text();
@@ -81,7 +82,17 @@ function createMdxPlugin(options = {}) {
81
82
  }))?.code ?? source,
82
83
  loader
83
84
  };
84
- });
85
+ };
86
+ build.onLoad({ filter: macroFilter }, load);
87
+ if (build.config && !runtimeEvalHook) {
88
+ runtimeEvalHook = true;
89
+ Bun.plugin({
90
+ name: "bun-plugin-fumadocs-mdx:macro-eval",
91
+ setup(runtime) {
92
+ runtime.onLoad({ filter: new RegExp(`[?&]${EvalQueryKey}=`) }, load);
93
+ }
94
+ });
95
+ }
85
96
  }
86
97
  const configLoader = createIntegratedConfigLoader(core);
87
98
  toBun(mdxLoaderGlob, createMdxLoader(configLoader))(build);
@@ -1,9 +1,12 @@
1
1
  import path from "node:path";
2
2
  import { x } from "tinyexec";
3
- /** the condition of a branch of `<show>`, code checked when rendering */
3
+ /**
4
+ * The condition of a branch of `<show>`, code checked when rendering. Plugins that run before `remarkShow` see the
5
+ * element as `<show>`.
6
+ */
4
7
  function showCondition(node) {
5
8
  const { name, attributes } = node;
6
- if (name !== "_Show") return;
9
+ if (name !== "_Show" && name !== "show") return;
7
10
  for (const attr of attributes) if (attr.type === "mdxJsxAttribute" && attr.name === "when" && typeof attr.value === "object") return attr.value?.value;
8
11
  }
9
12
  /**
@@ -82,7 +82,7 @@ function createMdxLoader({ getCore }) {
82
82
  listed: only === "frontmatter" || !docCollection?.async
83
83
  });
84
84
  if (only === "frontmatter") return { code: `export const frontmatter = ${JSON.stringify(data)}` };
85
- const { buildMDX } = await import("./build-ClrPX9Ea.js").then((n) => n.n);
85
+ const { buildMDX } = await import("./build-Cd_zdUwB.js").then((n) => n.n);
86
86
  const compiled = await buildMDX(core, docCollection, {
87
87
  isDevelopment,
88
88
  source: "\n".repeat(countLines(matter.matter)) + matter.content,
@@ -1,6 +1,6 @@
1
1
  import { t as createCore } from "../core-r1WHKfaI.js";
2
- import { n as toNode, o as createStandaloneConfigLoader } from "../adapter-DJT55ieR.js";
3
- import { t as createMdxLoader } from "../mdx-oiwGpmIR.js";
2
+ import { n as toNode, o as createStandaloneConfigLoader } from "../adapter-Clt8sB1g.js";
3
+ import { t as createMdxLoader } from "../mdx-CwVlI0Qe.js";
4
4
  import { t as createMetaLoader } from "../meta-CsSsB7_T.js";
5
5
  import { r as metaLoaderGlob, t as mdxLoaderGlob } from "../loaders-3R0gLmlP.js";
6
6
  import { n as createNodeEvaluator, t as MacroCollector } from "../eval-Ch9sPj_e.js";
@@ -1,6 +1,6 @@
1
1
  import { t as createCore } from "../core-r1WHKfaI.js";
2
- import { t as createMdxLoader } from "../mdx-oiwGpmIR.js";
3
- import { n as toNode, o as createStandaloneConfigLoader } from "../adapter-DJT55ieR.js";
2
+ import { t as createMdxLoader } from "../mdx-CwVlI0Qe.js";
3
+ import { n as toNode, o as createStandaloneConfigLoader } from "../adapter-Clt8sB1g.js";
4
4
  import { t as createMetaLoader } from "../meta-CsSsB7_T.js";
5
5
  import { r as metaLoaderGlob, t as mdxLoaderGlob } from "../loaders-3R0gLmlP.js";
6
6
  // src/node/loader.ts
@@ -16,6 +16,7 @@ function jsonSchema({ insert = false } = {}) {
16
16
  const outDir = this.core.outDir;
17
17
  if (!server.watcher || !insert) return;
18
18
  server.watcher.on("add", async (file) => {
19
+ if (path.extname(file) !== ".json") return;
19
20
  let parent;
20
21
  let match;
21
22
  for (const collection of this.core.getCollections()) {
@@ -1,8 +1,8 @@
1
1
  import { r as buildConfig } from "../build-Dc0aOaCg.js";
2
2
  import { t as createCore } from "../core-r1WHKfaI.js";
3
3
  import { r as metaLoaderGlob, t as mdxLoaderGlob } from "../loaders-3R0gLmlP.js";
4
- import { a as createIntegratedConfigLoader, r as toVite } from "../adapter-DJT55ieR.js";
5
- import { t as createMdxLoader } from "../mdx-oiwGpmIR.js";
4
+ import { a as createIntegratedConfigLoader, r as toVite } from "../adapter-Clt8sB1g.js";
5
+ import { t as createMdxLoader } from "../mdx-CwVlI0Qe.js";
6
6
  import { t as createMetaLoader } from "../meta-CsSsB7_T.js";
7
7
  import { n as createNodeEvaluator, t as MacroCollector } from "../eval-Ch9sPj_e.js";
8
8
  import { i as resolveMacroOptions, n as NodeModulesRegex, r as createMacroMatcher, t as MacroModuleId } from "../options-DZSjmVhY.js";
@@ -1,5 +1,5 @@
1
1
  import { r as buildConfig } from "../build-Dc0aOaCg.js";
2
- import { t as buildMDX } from "../build-ClrPX9Ea.js";
2
+ import { t as buildMDX } from "../build-Cd_zdUwB.js";
3
3
  import { t as frontmatterCode } from "../code-BWwFhg-7.js";
4
4
  import { server } from "./server.js";
5
5
  import { t as createCore } from "../core-r1WHKfaI.js";
@@ -1,6 +1,6 @@
1
1
  import { r as buildConfig } from "../build-Dc0aOaCg.js";
2
- import { t as createMdxLoader } from "../mdx-oiwGpmIR.js";
3
- import { a as createIntegratedConfigLoader, r as toVite } from "../adapter-DJT55ieR.js";
2
+ import { t as createMdxLoader } from "../mdx-CwVlI0Qe.js";
3
+ import { a as createIntegratedConfigLoader, r as toVite } from "../adapter-Clt8sB1g.js";
4
4
  import { t as createCore } from "../core-r1WHKfaI.js";
5
5
  import { t as createMetaLoader } from "../meta-CsSsB7_T.js";
6
6
  import { t as indexFile } from "../index-file-DHU9QZX_.js";
@@ -1,5 +1,5 @@
1
- import { t as createMdxLoader } from "../mdx-oiwGpmIR.js";
2
- import { i as toWebpack, o as createStandaloneConfigLoader } from "../adapter-DJT55ieR.js";
1
+ import { t as createMdxLoader } from "../mdx-CwVlI0Qe.js";
2
+ import { i as toWebpack, o as createStandaloneConfigLoader } from "../adapter-Clt8sB1g.js";
3
3
  import { t as getCore } from "../webpack-BXq21GfV.js";
4
4
  // src/webpack/mdx.ts
5
5
  let instance;
@@ -1,4 +1,4 @@
1
- import { i as toWebpack, o as createStandaloneConfigLoader } from "../adapter-DJT55ieR.js";
1
+ import { i as toWebpack, o as createStandaloneConfigLoader } from "../adapter-Clt8sB1g.js";
2
2
  import { t as createMetaLoader } from "../meta-CsSsB7_T.js";
3
3
  import { t as getCore } from "../webpack-BXq21GfV.js";
4
4
  // src/webpack/meta.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-mdx",
3
- "version": "15.6.4",
3
+ "version": "15.6.5",
4
4
  "description": "The built-in source for Fumadocs",
5
5
  "keywords": [
6
6
  "Docs",
@@ -79,7 +79,7 @@
79
79
  "zod": "^4.6.7"
80
80
  },
81
81
  "devDependencies": {
82
- "@fumadocs/satteri": "0.8.4",
82
+ "@fumadocs/satteri": "0.8.5",
83
83
  "@fumadocs/vite": "0.1.0",
84
84
  "@types/bun": "^1.4.4",
85
85
  "@types/mdast": "^4.0.4",
@@ -88,7 +88,7 @@
88
88
  "@types/picomatch": "^4.0.3",
89
89
  "@types/react": "^19.3.0",
90
90
  "@vitejs/plugin-rsc": "^0.5.39",
91
- "fumadocs-core": "16.19.5",
91
+ "fumadocs-core": "16.19.9",
92
92
  "mdast-util-directive": "^3.2.0",
93
93
  "next": "^16.4.6",
94
94
  "react": "^19.3.1",