fumadocs-mdx 15.0.13 → 15.1.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.
- package/dist/{adapter-CUkbjVed.js → adapter-DPEpBHhE.js} +2 -2
- package/dist/build-BnKCFeb6.js +13 -0
- package/dist/{build-mdx-B5ntJ10C.js → build-default-DCQTM_P7.js} +31 -8
- package/dist/build-satteri-Mk7OLtzu.js +91 -0
- package/dist/bun/index.d.ts +1 -2
- package/dist/bun/index.js +4 -4
- package/dist/config/index.d.ts +2 -2
- package/dist/config/index.js +8 -3
- package/dist/{core-Blh9aCh7.d.ts → core-Br7DNGl3.d.ts} +80 -42
- package/dist/{core-C5neSoHN.js → core-Cq6V99iz.js} +1 -18
- package/dist/{dist-Bw6UIEZC.js → dist-CQ17lmpt.js} +0 -5
- package/dist/{index-Bn0W07OX.d.ts → index-Bb7u_Fzy.d.ts} +1 -0
- package/dist/index.d.ts +1 -2
- package/dist/{load-from-file-Du50S5f9.js → load-from-file-CVTAyohB.js} +1 -1
- package/dist/{mdx-VyLPp3lL.js → mdx-wSuDwc6c.js} +2 -2
- package/dist/{meta-UmuO8lue.js → meta-BDiR5cQC.js} +5 -5
- package/dist/next/index.d.ts +1 -2
- package/dist/next/index.js +2 -2
- package/dist/node/_loader.d.ts +0 -1
- package/dist/node/_loader.js +4 -4
- package/dist/node/index.d.ts +1 -2
- package/dist/node/loader.d.ts +0 -1
- package/dist/node/loader.js +4 -4
- package/dist/plugins/index-file.d.ts +1 -1
- package/dist/plugins/json-schema.d.ts +2 -5
- package/dist/plugins/last-modified.d.ts +1 -2
- package/dist/plugins/last-modified.js +24 -10
- package/dist/{remark-include-DJN_j9Y9.js → remark-include-B6rmf4sh.js} +59 -1
- package/dist/rolldown/index.d.ts +0 -1
- package/dist/rolldown/index.js +4 -4
- package/dist/runtime/browser.d.ts +2 -4
- package/dist/runtime/dynamic.d.ts +2 -3
- package/dist/runtime/dynamic.js +4 -5
- package/dist/runtime/server.d.ts +1 -1
- package/dist/runtime/server.js +3 -2
- package/dist/runtime/types.d.ts +1 -1
- package/dist/{types-CCb8V6-O.d.ts → types-DWoea9Sq.d.ts} +1 -2
- package/dist/vite/index.d.ts +1 -2
- package/dist/vite/index.js +6 -6
- package/dist/webpack/mdx.d.ts +1 -2
- package/dist/webpack/mdx.js +3 -3
- package/dist/webpack/meta.d.ts +1 -2
- package/dist/webpack/meta.js +3 -3
- package/dist/{webpack-C5OhQxDb.js → webpack-BZVbRnxp.js} +1 -1
- package/package.json +23 -12
- package/dist/build-mdx-1yRXUhuv.d.ts +0 -52
- package/dist/preset-NZprPlqc.js +0 -59
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { r as ValidationError } from "./core-
|
|
2
|
-
import { t as loadConfig } from "./load-from-file-
|
|
1
|
+
import { r as ValidationError } from "./core-Cq6V99iz.js";
|
|
2
|
+
import { t as loadConfig } from "./load-from-file-CVTAyohB.js";
|
|
3
3
|
import { readFileSync } from "node:fs";
|
|
4
4
|
import fs from "node:fs/promises";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
|
|
2
|
+
//#region src/loaders/mdx/build.ts
|
|
3
|
+
var build_exports = /* @__PURE__ */ __exportAll({ buildMDX: () => buildMDX });
|
|
4
|
+
async function buildMDX(core, collection, options) {
|
|
5
|
+
if ((collection ? collection.compiler : core.getConfig().global.compiler) === "satteri") {
|
|
6
|
+
const { buildSatteriMDX } = await import("./build-satteri-Mk7OLtzu.js");
|
|
7
|
+
return buildSatteriMDX(core, collection, options);
|
|
8
|
+
}
|
|
9
|
+
const { buildJSMDX } = await import("./build-default-DCQTM_P7.js");
|
|
10
|
+
return buildJSMDX(core, collection, options);
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { build_exports as n, buildMDX as t };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
import { n as flattenNode, t as remarkInclude } from "./remark-include-DJN_j9Y9.js";
|
|
1
|
+
import { n as flattenNode, r as applyMdxPreset, t as remarkInclude } from "./remark-include-B6rmf4sh.js";
|
|
3
2
|
import { visit } from "unist-util-visit";
|
|
4
3
|
import { VFile } from "vfile";
|
|
5
4
|
import { createProcessor } from "@mdx-js/mdx";
|
|
@@ -86,10 +85,9 @@ function getMdastExport(name, value) {
|
|
|
86
85
|
};
|
|
87
86
|
}
|
|
88
87
|
//#endregion
|
|
89
|
-
//#region src/loaders/mdx/build-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
const mdxOptions = await core.getConfig().getMDXOptions(collection, environment);
|
|
88
|
+
//#region src/loaders/mdx/build-default.ts
|
|
89
|
+
async function buildJSMDX(core, collection, { filePath, frontmatter, source, _compiler, environment, isDevelopment }) {
|
|
90
|
+
const mdxOptions = await getMDXOptions(core.getConfig(), collection, environment);
|
|
93
91
|
function getProcessor(format) {
|
|
94
92
|
const cache = core.cache;
|
|
95
93
|
const key = `build-mdx:${collection?.name ?? "global"}:${format}`;
|
|
@@ -129,7 +127,32 @@ async function buildMDX(core, collection, { filePath, frontmatter, source, _comp
|
|
|
129
127
|
filePath,
|
|
130
128
|
source
|
|
131
129
|
}, vfile);
|
|
132
|
-
|
|
130
|
+
const out = await getProcessor(filePath.endsWith(".mdx") ? "mdx" : "md").process(vfile);
|
|
131
|
+
return {
|
|
132
|
+
code: String(out.value),
|
|
133
|
+
map: out.map
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
const mdxOptionsCache = /* @__PURE__ */ new WeakMap();
|
|
137
|
+
function getMDXOptions(config, collection, environment = "bundler") {
|
|
138
|
+
let cacheMap = mdxOptionsCache.get(config);
|
|
139
|
+
if (!cacheMap) {
|
|
140
|
+
cacheMap = /* @__PURE__ */ new Map();
|
|
141
|
+
mdxOptionsCache.set(config, cacheMap);
|
|
142
|
+
}
|
|
143
|
+
const key = collection ? `${environment}:${collection.name}` : environment;
|
|
144
|
+
const cached = cacheMap.get(key);
|
|
145
|
+
if (cached) return cached;
|
|
146
|
+
let result;
|
|
147
|
+
if (collection?.mdxOptions) {
|
|
148
|
+
const optionsFn = collection.mdxOptions;
|
|
149
|
+
result = typeof optionsFn === "function" ? optionsFn(environment) : optionsFn;
|
|
150
|
+
} else result = (async () => {
|
|
151
|
+
const optionsFn = config.global.mdxOptions;
|
|
152
|
+
return applyMdxPreset(typeof optionsFn === "function" ? await optionsFn() : optionsFn)(environment);
|
|
153
|
+
})();
|
|
154
|
+
cacheMap.set(key, result);
|
|
155
|
+
return result;
|
|
133
156
|
}
|
|
134
157
|
//#endregion
|
|
135
|
-
export {
|
|
158
|
+
export { buildJSMDX };
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { pathToFileURL } from "node:url";
|
|
2
|
+
//#region src/loaders/mdx/build-satteri.ts
|
|
3
|
+
async function buildSatteriMDX(core, collection, { filePath, frontmatter, source, _compiler, environment, isDevelopment }) {
|
|
4
|
+
const satteriOptions = await getSatteriOptions(core.getConfig(), collection, environment);
|
|
5
|
+
const postprocess = {
|
|
6
|
+
_format: filePath.endsWith(".mdx") ? "mdx" : "md",
|
|
7
|
+
...collection?.postprocess
|
|
8
|
+
};
|
|
9
|
+
const [{ compileMdx }, { remarkLlms }, { remarkInclude }] = await Promise.all([
|
|
10
|
+
import(
|
|
11
|
+
/* turbopackOptional: true */
|
|
12
|
+
"@fumadocs/satteri/compile"
|
|
13
|
+
),
|
|
14
|
+
import(
|
|
15
|
+
/* turbopackOptional: true */
|
|
16
|
+
"@fumadocs/satteri/remark-llms"
|
|
17
|
+
),
|
|
18
|
+
import(
|
|
19
|
+
/* turbopackOptional: true */
|
|
20
|
+
"@fumadocs/satteri/remark-include"
|
|
21
|
+
)
|
|
22
|
+
]);
|
|
23
|
+
const data = {
|
|
24
|
+
frontmatter,
|
|
25
|
+
_compiler,
|
|
26
|
+
_cwd: collection?.cwd,
|
|
27
|
+
_valueToExport: collection?.postprocess?.valueToExport
|
|
28
|
+
};
|
|
29
|
+
const mdastPlugins = [remarkInclude({ cwd: collection?.cwd })];
|
|
30
|
+
if (satteriOptions.mdastPlugins) mdastPlugins.push(...satteriOptions.mdastPlugins);
|
|
31
|
+
if (postprocess.includeProcessedMarkdown) mdastPlugins.push(remarkLlms(typeof postprocess.includeProcessedMarkdown === "object" ? postprocess.includeProcessedMarkdown : void 0));
|
|
32
|
+
mdastPlugins.push(postprocessPlugin(postprocess));
|
|
33
|
+
return { code: (await compileMdx({
|
|
34
|
+
source,
|
|
35
|
+
filePath,
|
|
36
|
+
frontmatter,
|
|
37
|
+
isDevelopment,
|
|
38
|
+
environment,
|
|
39
|
+
options: {
|
|
40
|
+
...satteriOptions,
|
|
41
|
+
fileURL: pathToFileURL(filePath),
|
|
42
|
+
data,
|
|
43
|
+
mdastPlugins
|
|
44
|
+
}
|
|
45
|
+
})).code };
|
|
46
|
+
}
|
|
47
|
+
function postprocessPlugin({ extractLinkReferences = false }) {
|
|
48
|
+
return {
|
|
49
|
+
name: "remark-postprocess",
|
|
50
|
+
heading(node, ctx) {
|
|
51
|
+
const frontmatter = ctx.data.frontmatter ??= {};
|
|
52
|
+
if (!frontmatter.title && node.depth === 1) frontmatter.title = ctx.textContent(node);
|
|
53
|
+
},
|
|
54
|
+
link(node, ctx) {
|
|
55
|
+
if (extractLinkReferences) (ctx.data.extractedReferences ??= []).push({ href: node.url });
|
|
56
|
+
},
|
|
57
|
+
afterToJs({ result }) {
|
|
58
|
+
if (extractLinkReferences) {
|
|
59
|
+
result.data.extractedReferences ??= [];
|
|
60
|
+
result.code += `\nexport const extractedReferences = ${JSON.stringify(result.data.extractedReferences)};`;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
const satteriOptionsCache = /* @__PURE__ */ new WeakMap();
|
|
66
|
+
async function resolvePresetOptions(input, environment) {
|
|
67
|
+
const options = typeof input === "function" ? await input(environment) : input;
|
|
68
|
+
const { applySatteriPreset } = await import(
|
|
69
|
+
/* turbopackOptional: true */
|
|
70
|
+
"@fumadocs/satteri/preset"
|
|
71
|
+
);
|
|
72
|
+
return applySatteriPreset(options)(environment);
|
|
73
|
+
}
|
|
74
|
+
function getSatteriOptions(config, collection, environment = "bundler") {
|
|
75
|
+
let cache = satteriOptionsCache.get(config);
|
|
76
|
+
if (!cache) {
|
|
77
|
+
cache = /* @__PURE__ */ new Map();
|
|
78
|
+
satteriOptionsCache.set(config, cache);
|
|
79
|
+
}
|
|
80
|
+
const key = collection ? `${environment}:${collection.name}` : environment;
|
|
81
|
+
const cached = cache.get(key);
|
|
82
|
+
if (cached) return cached;
|
|
83
|
+
let result;
|
|
84
|
+
if (collection?.compiler === "satteri") result = resolvePresetOptions(collection.satteriOptions ?? config.global.satteriOptions, environment);
|
|
85
|
+
else if (collection) throw new Error(`Collection "${collection.name}" uses the default MDX compiler. Use getMDXOptions() instead of getSatteriOptions().`);
|
|
86
|
+
else result = resolvePresetOptions(config.global.satteriOptions, environment);
|
|
87
|
+
cache.set(key, result);
|
|
88
|
+
return result;
|
|
89
|
+
}
|
|
90
|
+
//#endregion
|
|
91
|
+
export { buildSatteriMDX };
|
package/dist/bun/index.d.ts
CHANGED
package/dist/bun/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as createMdxLoader } from "../mdx-
|
|
2
|
-
import { i as buildConfig, n as createCore, t as _Defaults } from "../core-
|
|
3
|
-
import { a as createIntegratedConfigLoader, t as toBun } from "../adapter-
|
|
4
|
-
import { t as createMetaLoader } from "../meta-
|
|
1
|
+
import { t as createMdxLoader } from "../mdx-wSuDwc6c.js";
|
|
2
|
+
import { i as buildConfig, n as createCore, t as _Defaults } from "../core-Cq6V99iz.js";
|
|
3
|
+
import { a as createIntegratedConfigLoader, t as toBun } from "../adapter-DPEpBHhE.js";
|
|
4
|
+
import { t as createMetaLoader } from "../meta-BDiR5cQC.js";
|
|
5
5
|
import { r as metaLoaderGlob, t as mdxLoaderGlob } from "../loaders-CUuRGbiE.js";
|
|
6
6
|
import { pathToFileURL } from "node:url";
|
|
7
7
|
//#region src/bun/index.ts
|
package/dist/config/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as DocCollection, B as
|
|
2
|
-
export { AnyCollection, BaseCollection, CollectionSchema, DefaultMDXOptions, DocCollection, DocsCollection, GlobalConfig, MDXPresetOptions, MetaCollection, type PostprocessOptions, applyMdxPreset, defineCollections, defineConfig, defineDocs, frontmatterSchema, metaSchema, remarkInclude };
|
|
1
|
+
import { A as DocCollection, B as defineCollections, D as AnyCollection, E as remarkInclude, F as DocsCollection, H as defineDocs, I as GlobalConfig, J as DefaultMDXOptions, L as MetaCollection, M as DocCollectionMdx, N as DocCollectionSatteri, O as BaseCollection, P as DocCollectionSatteriTyped, R as SatteriGlobalConfig, T as metaSchema, U as defineSatteriCollections, V as defineConfig, W as defineSatteriConfig, X as applyMdxPreset, Y as MDXPresetOptions, j as DocCollectionBase, k as CollectionSchema, q as PostprocessOptions, w as frontmatterSchema, z as SatteriPresetOptions } from "../core-Br7DNGl3.js";
|
|
2
|
+
export { AnyCollection, BaseCollection, CollectionSchema, DefaultMDXOptions, DocCollection, DocCollectionBase, DocCollectionMdx, DocCollectionSatteri, DocCollectionSatteriTyped, DocsCollection, GlobalConfig, MDXPresetOptions, MetaCollection, type PostprocessOptions, SatteriGlobalConfig, type SatteriPresetOptions, applyMdxPreset, defineCollections, defineConfig, defineDocs, defineSatteriCollections, defineSatteriConfig, frontmatterSchema, metaSchema, remarkInclude };
|
package/dist/config/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as remarkInclude } from "../remark-include-DJN_j9Y9.js";
|
|
1
|
+
import { r as applyMdxPreset, t as remarkInclude } from "../remark-include-B6rmf4sh.js";
|
|
3
2
|
import { metaSchema as metaSchema$1, pageSchema } from "fumadocs-core/source/schema";
|
|
4
3
|
//#region src/config/define.ts
|
|
5
4
|
function defineCollections(options) {
|
|
@@ -27,6 +26,12 @@ function defineDocs(options) {
|
|
|
27
26
|
function defineConfig(config = {}) {
|
|
28
27
|
return config;
|
|
29
28
|
}
|
|
29
|
+
function defineSatteriConfig(config = {}) {
|
|
30
|
+
return config;
|
|
31
|
+
}
|
|
32
|
+
function defineSatteriCollections(options) {
|
|
33
|
+
return options;
|
|
34
|
+
}
|
|
30
35
|
//#endregion
|
|
31
36
|
//#region src/config/index.ts
|
|
32
37
|
/** @deprecated import `pageSchema` from `fumadocs-core/source/schema` instead (since 16.2.3) */
|
|
@@ -34,4 +39,4 @@ const frontmatterSchema = pageSchema;
|
|
|
34
39
|
/** @deprecated import from `fumadocs-core/source/schema` instead (since 16.2.3) */
|
|
35
40
|
const metaSchema = metaSchema$1;
|
|
36
41
|
//#endregion
|
|
37
|
-
export { applyMdxPreset, defineCollections, defineConfig, defineDocs, frontmatterSchema, metaSchema, remarkInclude };
|
|
42
|
+
export { applyMdxPreset, defineCollections, defineConfig, defineDocs, defineSatteriCollections, defineSatteriConfig, frontmatterSchema, metaSchema, remarkInclude };
|
|
@@ -1,16 +1,19 @@
|
|
|
1
|
-
import { a as MetaMethods, i as InternalTypeConfig, n as DocMethods, t as DocData } from "./types-
|
|
1
|
+
import { a as MetaMethods, i as InternalTypeConfig, n as DocMethods, t as DocData } from "./types-DWoea9Sq.js";
|
|
2
2
|
import { metaSchema, pageSchema } from "fumadocs-core/source/schema";
|
|
3
3
|
import { Pluggable, Processor, Transformer } from "unified";
|
|
4
4
|
import * as Plugins from "fumadocs-core/mdx-plugins";
|
|
5
|
-
import { LLMsOptions } from "fumadocs-core/mdx-plugins";
|
|
5
|
+
import { LLMsOptions, StructuredData } from "fumadocs-core/mdx-plugins";
|
|
6
6
|
import { VFile } from "vfile";
|
|
7
|
+
import { FC } from "react";
|
|
7
8
|
import { ProcessorOptions } from "@mdx-js/mdx";
|
|
8
9
|
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
9
10
|
import { Root } from "mdast";
|
|
11
|
+
import { SatteriPresetOptions, SatteriPresetOptions as SatteriPresetOptions$1 } from "@fumadocs/satteri/preset";
|
|
12
|
+
import { TOCItemType } from "fumadocs-core/toc";
|
|
13
|
+
import { MDXProps } from "mdx/types";
|
|
10
14
|
import { FSWatcher } from "chokidar";
|
|
11
15
|
import { MetaData, PageData, Source } from "fumadocs-core/source";
|
|
12
16
|
import { StructuredData as StructuredData$1 } from "fumadocs-core/mdx-plugins/remark-structure";
|
|
13
|
-
|
|
14
17
|
//#region src/config/preset.d.ts
|
|
15
18
|
type ResolvePlugins = Pluggable[] | ((v: Pluggable[]) => Pluggable[]);
|
|
16
19
|
type DefaultMDXOptions = Omit<NonNullable<ProcessorOptions>, 'rehypePlugins' | 'remarkPlugins' | '_ctx'> & {
|
|
@@ -63,19 +66,37 @@ interface PostprocessOptions {
|
|
|
63
66
|
};
|
|
64
67
|
}
|
|
65
68
|
//#endregion
|
|
69
|
+
//#region src/loaders/mdx/build.d.ts
|
|
70
|
+
interface CompiledMDXProperties<Frontmatter = Record<string, unknown>> {
|
|
71
|
+
frontmatter: Frontmatter;
|
|
72
|
+
structuredData: StructuredData;
|
|
73
|
+
toc: TOCItemType[];
|
|
74
|
+
default: FC<MDXProps>;
|
|
75
|
+
/**
|
|
76
|
+
* Enable from `postprocess` option.
|
|
77
|
+
*/
|
|
78
|
+
_markdown?: string;
|
|
79
|
+
/**
|
|
80
|
+
* Enable from `postprocess` option.
|
|
81
|
+
*/
|
|
82
|
+
_mdast?: string;
|
|
83
|
+
}
|
|
84
|
+
//#endregion
|
|
85
|
+
//#region src/loaders/mdx/build-satteri.d.ts
|
|
86
|
+
declare module 'satteri' {
|
|
87
|
+
interface DataMap {
|
|
88
|
+
extractedReferences?: {
|
|
89
|
+
href: string;
|
|
90
|
+
}[];
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
type SatteriOptionsInput = SatteriPresetOptions | ((environment: BuildEnvironment) => SatteriPresetOptions | Promise<SatteriPresetOptions>) | undefined;
|
|
94
|
+
//#endregion
|
|
66
95
|
//#region src/config/define.d.ts
|
|
67
96
|
type CollectionSchema<Schema extends StandardSchemaV1, Context> = Schema | ((ctx: Context) => Schema);
|
|
68
97
|
type AnyCollection = DocsCollection | DocCollection | MetaCollection;
|
|
69
98
|
interface BaseCollection {
|
|
70
|
-
/**
|
|
71
|
-
* Directory to scan
|
|
72
|
-
*/
|
|
73
99
|
dir: string;
|
|
74
|
-
/**
|
|
75
|
-
* what files to include/exclude (glob patterns)
|
|
76
|
-
*
|
|
77
|
-
* Include all files if not specified
|
|
78
|
-
*/
|
|
79
100
|
files?: string[];
|
|
80
101
|
}
|
|
81
102
|
interface MetaCollection<Schema extends StandardSchemaV1 = StandardSchemaV1> extends BaseCollection {
|
|
@@ -85,28 +106,34 @@ interface MetaCollection<Schema extends StandardSchemaV1 = StandardSchemaV1> ext
|
|
|
85
106
|
source: string;
|
|
86
107
|
}>;
|
|
87
108
|
}
|
|
88
|
-
interface
|
|
89
|
-
type: 'doc';
|
|
109
|
+
interface DocCollectionBase<Schema extends StandardSchemaV1 = StandardSchemaV1> extends BaseCollection {
|
|
90
110
|
postprocess?: Partial<PostprocessOptions>;
|
|
91
|
-
/**
|
|
92
|
-
* By defining a collection-level MDX options, **the default options & plugins will be removed**.
|
|
93
|
-
*
|
|
94
|
-
* See [`mdxOptions`](https://fumadocs.dev/docs/mdx/collections#mdxoptions) for details.
|
|
95
|
-
*/
|
|
96
|
-
mdxOptions?: ProcessorOptions | ((environment: BuildEnvironment) => Promise<ProcessorOptions>);
|
|
97
|
-
/**
|
|
98
|
-
* Load files with async
|
|
99
|
-
*/
|
|
100
111
|
async?: boolean;
|
|
101
|
-
/**
|
|
102
|
-
* Compile files on-demand
|
|
103
|
-
*/
|
|
104
112
|
dynamic?: boolean;
|
|
105
113
|
schema?: CollectionSchema<Schema, {
|
|
106
114
|
path: string;
|
|
107
115
|
source: string;
|
|
108
116
|
}>;
|
|
109
117
|
}
|
|
118
|
+
interface DocCollectionMdx<Schema extends StandardSchemaV1 = StandardSchemaV1> extends DocCollectionBase<Schema> {
|
|
119
|
+
type: 'doc';
|
|
120
|
+
compiler?: 'mdx';
|
|
121
|
+
/**
|
|
122
|
+
* By defining a collection-level MDX options, **the default options & plugins will be removed**.
|
|
123
|
+
*/
|
|
124
|
+
mdxOptions?: ProcessorOptions | ((environment: BuildEnvironment) => Promise<ProcessorOptions>);
|
|
125
|
+
satteriOptions?: never;
|
|
126
|
+
}
|
|
127
|
+
interface DocCollectionSatteri<Schema extends StandardSchemaV1 = StandardSchemaV1> extends DocCollectionBase<Schema> {
|
|
128
|
+
type: 'doc';
|
|
129
|
+
compiler: 'satteri';
|
|
130
|
+
/**
|
|
131
|
+
* Sätteri compile options. When omitted, the global `satteriOptions` preset is used.
|
|
132
|
+
*/
|
|
133
|
+
satteriOptions?: SatteriOptionsInput;
|
|
134
|
+
mdxOptions?: never;
|
|
135
|
+
}
|
|
136
|
+
type DocCollection<Schema extends StandardSchemaV1 = StandardSchemaV1> = DocCollectionMdx<Schema> | DocCollectionSatteri<Schema>;
|
|
110
137
|
interface DocsCollection<DocSchema extends StandardSchemaV1 = StandardSchemaV1, MetaSchema extends StandardSchemaV1 = StandardSchemaV1> {
|
|
111
138
|
type: 'docs';
|
|
112
139
|
dir: string;
|
|
@@ -116,40 +143,53 @@ interface DocsCollection<DocSchema extends StandardSchemaV1 = StandardSchemaV1,
|
|
|
116
143
|
interface GlobalConfig {
|
|
117
144
|
plugins?: PluginOption[];
|
|
118
145
|
/**
|
|
119
|
-
*
|
|
146
|
+
* The compiler for files compiled without a collection (e.g. `page.mdx` routes).
|
|
147
|
+
*
|
|
148
|
+
* Collections choose their own compiler via the collection-level `compiler` option.
|
|
149
|
+
*
|
|
150
|
+
* @defaultValue 'mdx'
|
|
151
|
+
*/
|
|
152
|
+
compiler?: 'mdx' | 'satteri';
|
|
153
|
+
/**
|
|
154
|
+
* Configure global MDX options, used by `doc` collections with the default MDX compiler.
|
|
120
155
|
*/
|
|
121
156
|
mdxOptions?: MDXPresetOptions | (() => Promise<MDXPresetOptions>);
|
|
157
|
+
/**
|
|
158
|
+
* Configure global Sätteri options, used by `doc` collections with `compiler: "satteri"`.
|
|
159
|
+
*/
|
|
160
|
+
satteriOptions?: SatteriOptionsInput;
|
|
122
161
|
workspaces?: Record<string, {
|
|
123
162
|
dir: string;
|
|
124
163
|
config: Record<string, unknown>;
|
|
125
164
|
}>;
|
|
126
|
-
/**
|
|
127
|
-
* specify a directory to access & store cache (disabled during development mode).
|
|
128
|
-
*
|
|
129
|
-
* The cache will never be updated, delete the cache folder to clean.
|
|
130
|
-
*/
|
|
131
165
|
experimentalBuildCache?: string;
|
|
132
166
|
}
|
|
167
|
+
type SatteriOptionsFactory = (environment: BuildEnvironment) => SatteriPresetOptions$1 | Promise<SatteriPresetOptions$1>;
|
|
168
|
+
interface DocCollectionSatteriTyped<Schema extends StandardSchemaV1 = StandardSchemaV1> extends DocCollectionBase<Schema> {
|
|
169
|
+
type: 'doc';
|
|
170
|
+
compiler: 'satteri';
|
|
171
|
+
satteriOptions?: SatteriPresetOptions$1 | SatteriOptionsFactory;
|
|
172
|
+
mdxOptions?: never;
|
|
173
|
+
}
|
|
174
|
+
interface SatteriGlobalConfig extends Omit<GlobalConfig, 'satteriOptions'> {
|
|
175
|
+
satteriOptions?: SatteriPresetOptions$1 | SatteriOptionsFactory;
|
|
176
|
+
}
|
|
133
177
|
declare function defineCollections<Schema extends StandardSchemaV1 = StandardSchemaV1>(options: DocCollection<Schema>): DocCollection<Schema>;
|
|
134
178
|
declare function defineCollections<Schema extends StandardSchemaV1 = StandardSchemaV1>(options: MetaCollection<Schema>): MetaCollection<Schema>;
|
|
135
179
|
declare function defineDocs<DocSchema extends StandardSchemaV1 = typeof pageSchema, MetaSchema extends StandardSchemaV1 = typeof metaSchema>(options: {
|
|
136
|
-
/**
|
|
137
|
-
* The content directory to scan files
|
|
138
|
-
*
|
|
139
|
-
* @defaultValue 'content/docs'
|
|
140
|
-
*/
|
|
141
180
|
dir?: string;
|
|
142
181
|
docs?: Omit<DocCollection<DocSchema>, 'dir' | 'type'>;
|
|
143
182
|
meta?: Omit<MetaCollection<MetaSchema>, 'dir' | 'type'>;
|
|
144
183
|
}): DocsCollection<DocSchema, MetaSchema>;
|
|
145
184
|
declare function defineConfig(config?: GlobalConfig): GlobalConfig;
|
|
185
|
+
declare function defineSatteriConfig(config?: SatteriGlobalConfig): SatteriGlobalConfig;
|
|
186
|
+
declare function defineSatteriCollections<Schema extends StandardSchemaV1 = StandardSchemaV1>(options: DocCollectionSatteriTyped<Schema>): DocCollectionSatteriTyped<Schema>;
|
|
146
187
|
//#endregion
|
|
147
188
|
//#region src/config/build.d.ts
|
|
148
189
|
type BuildEnvironment = 'bundler' | 'runtime';
|
|
149
190
|
interface LoadedConfig {
|
|
150
191
|
collections: Map<string, CollectionItem>;
|
|
151
192
|
global: GlobalConfig;
|
|
152
|
-
getMDXOptions(collection?: DocCollectionItem, environment?: BuildEnvironment): ProcessorOptions | Promise<ProcessorOptions>;
|
|
153
193
|
workspaces: Record<string, {
|
|
154
194
|
dir: string;
|
|
155
195
|
config: LoadedConfig;
|
|
@@ -365,12 +405,10 @@ declare function createCore(options: CoreOptions): {
|
|
|
365
405
|
* Convenient cache store, reset when config changes
|
|
366
406
|
*/
|
|
367
407
|
cache: Map<string, unknown>;
|
|
368
|
-
init({
|
|
369
|
-
config: newConfig
|
|
370
|
-
}: {
|
|
408
|
+
init({ config: newConfig }: {
|
|
371
409
|
config: Awaitable<LoadedConfig>;
|
|
372
410
|
}): Promise<void>;
|
|
373
|
-
getWorkspaces(): Map<string, /*elided*/any>;
|
|
411
|
+
getWorkspaces(): Map<string, /*elided*/ any>;
|
|
374
412
|
getOptions(): CoreOptions;
|
|
375
413
|
getConfig(): LoadedConfig;
|
|
376
414
|
/**
|
|
@@ -389,4 +427,4 @@ declare function createCore(options: CoreOptions): {
|
|
|
389
427
|
};
|
|
390
428
|
type Core = ReturnType<typeof createCore>;
|
|
391
429
|
//#endregion
|
|
392
|
-
export { DocCollection as A,
|
|
430
|
+
export { DocCollection as A, defineCollections as B, toFumadocsSource as C, AnyCollection as D, remarkInclude as E, DocsCollection as F, CompiledMDXProperties as G, defineDocs as H, GlobalConfig as I, DefaultMDXOptions as J, ExtractedReference as K, MetaCollection as L, DocCollectionMdx as M, DocCollectionSatteri as N, BaseCollection as O, DocCollectionSatteriTyped as P, SatteriGlobalConfig as R, server as S, metaSchema$1 as T, defineSatteriCollections as U, defineConfig as V, defineSatteriConfig as W, applyMdxPreset as X, MDXPresetOptions as Y, DocCollectionEntry as _, EmitOptions as a, ServerCreate as b, PluginContext as c, TransformOptions as d, IndexFilePlugin as f, AsyncDocsCollectionEntry as g, AsyncDocCollectionEntry as h, EmitEntry as i, DocCollectionBase as j, CollectionSchema as k, PluginOption as l, indexFile as m, Core as n, EmitOutput as o, IndexFilePluginOptions as p, PostprocessOptions as q, CoreOptions as r, Plugin as s, CompilationContext as t, ServerContext as u, DocsCollectionEntry as v, frontmatterSchema as w, ServerOptions as x, MetaCollectionEntry as y, SatteriPresetOptions$1 as z };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { t as applyMdxPreset } from "./preset-NZprPlqc.js";
|
|
2
1
|
import { n as ident } from "./codegen-ESdi9CDJ.js";
|
|
3
2
|
import fs from "node:fs/promises";
|
|
4
3
|
import path from "node:path";
|
|
@@ -68,7 +67,6 @@ function buildConfig(config, cwd) {
|
|
|
68
67
|
}
|
|
69
68
|
throw new Error(`Unknown export "${k}", you can only export collections from source configuration file.`);
|
|
70
69
|
}
|
|
71
|
-
const mdxOptionsCache = /* @__PURE__ */ new Map();
|
|
72
70
|
return {
|
|
73
71
|
global: loaded,
|
|
74
72
|
collections,
|
|
@@ -77,22 +75,7 @@ function buildConfig(config, cwd) {
|
|
|
77
75
|
dir: value.dir,
|
|
78
76
|
config: buildConfig(value.config, path.resolve(cwd, value.dir))
|
|
79
77
|
}];
|
|
80
|
-
}))
|
|
81
|
-
getMDXOptions(collection, environment = "bundler") {
|
|
82
|
-
const key = collection ? `${environment}:${collection.name}` : environment;
|
|
83
|
-
const cached = mdxOptionsCache.get(key);
|
|
84
|
-
if (cached) return cached;
|
|
85
|
-
let result;
|
|
86
|
-
if (collection?.mdxOptions) {
|
|
87
|
-
const optionsFn = collection.mdxOptions;
|
|
88
|
-
result = typeof optionsFn === "function" ? optionsFn(environment) : optionsFn;
|
|
89
|
-
} else result = (async () => {
|
|
90
|
-
const optionsFn = this.global.mdxOptions;
|
|
91
|
-
return applyMdxPreset(typeof optionsFn === "function" ? await optionsFn() : optionsFn)(environment);
|
|
92
|
-
})();
|
|
93
|
-
mdxOptionsCache.set(key, result);
|
|
94
|
-
return result;
|
|
95
|
-
}
|
|
78
|
+
}))
|
|
96
79
|
};
|
|
97
80
|
}
|
|
98
81
|
//#endregion
|
|
@@ -27,18 +27,15 @@ var generated_default = {
|
|
|
27
27
|
"@fumadocs/mdx-remote > @mdx-js/mdx > hast-util-to-jsx-runtime > style-to-js",
|
|
28
28
|
"@fumadocs/mdx-remote > @mdx-js/mdx > remark-parse > mdast-util-from-markdown > micromark > debug",
|
|
29
29
|
"@fumadocs/mdx-remote > @mdx-js/mdx > source-map",
|
|
30
|
-
"@fumadocs/mdx-remote > js-yaml > argparse",
|
|
31
30
|
"@fumadocs/mdx-remote > unified > extend",
|
|
32
31
|
"@fumadocs/story > ts-morph",
|
|
33
32
|
"fumadocs-core > hast-util-to-estree > style-to-js",
|
|
34
|
-
"fumadocs-core > js-yaml > argparse",
|
|
35
33
|
"fumadocs-core > mdast-util-mdx > mdast-util-from-markdown > micromark > debug",
|
|
36
34
|
"fumadocs-core > tinyglobby > picomatch",
|
|
37
35
|
"fumadocs-core > unified > extend",
|
|
38
36
|
"fumadocs-mdx > @mdx-js/mdx > hast-util-to-jsx-runtime > style-to-js",
|
|
39
37
|
"fumadocs-mdx > @mdx-js/mdx > source-map",
|
|
40
38
|
"fumadocs-mdx > esbuild",
|
|
41
|
-
"fumadocs-mdx > js-yaml > argparse",
|
|
42
39
|
"fumadocs-mdx > mdast-util-mdx > mdast-util-from-markdown > micromark > debug",
|
|
43
40
|
"fumadocs-mdx > picocolors",
|
|
44
41
|
"fumadocs-mdx > picomatch",
|
|
@@ -50,7 +47,6 @@ var generated_default = {
|
|
|
50
47
|
"fumadocs-typescript > unified > extend"
|
|
51
48
|
],
|
|
52
49
|
"exclude": [
|
|
53
|
-
"@fumadocs/base-ui",
|
|
54
50
|
"@fumadocs/basehub",
|
|
55
51
|
"@fumadocs/local-md",
|
|
56
52
|
"@fumadocs/mdx-remote",
|
|
@@ -65,7 +61,6 @@ var generated_default = {
|
|
|
65
61
|
]
|
|
66
62
|
},
|
|
67
63
|
ssr: { "noExternal": [
|
|
68
|
-
"@fumadocs/base-ui",
|
|
69
64
|
"@fumadocs/basehub",
|
|
70
65
|
"@fumadocs/local-md",
|
|
71
66
|
"@fumadocs/mdx-remote",
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as CompiledMDXProperties } from "./build-mdx-1yRXUhuv.js";
|
|
1
|
+
import { G as CompiledMDXProperties, K as ExtractedReference, a as EmitOptions, c as PluginContext, d as TransformOptions, i as EmitEntry, l as PluginOption, n as Core, o as EmitOutput, r as CoreOptions, s as Plugin, t as CompilationContext, u as ServerContext } from "./core-Br7DNGl3.js";
|
|
3
2
|
export type { CompilationContext, CompiledMDXProperties, Core, CoreOptions, EmitEntry, EmitOptions, EmitOutput, ExtractedReference, Plugin, PluginContext, PluginOption, ServerContext, TransformOptions };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
|
|
2
|
-
import { i as buildConfig } from "./core-
|
|
2
|
+
import { i as buildConfig } from "./core-Cq6V99iz.js";
|
|
3
3
|
import { pathToFileURL } from "node:url";
|
|
4
4
|
//#region src/config/load-from-file.ts
|
|
5
5
|
var load_from_file_exports = /* @__PURE__ */ __exportAll({ loadConfig: () => loadConfig });
|
|
@@ -55,7 +55,7 @@ function createMdxLoader({ getCore }) {
|
|
|
55
55
|
code: `export const frontmatter = ${JSON.stringify(matter.data)}`,
|
|
56
56
|
map: null
|
|
57
57
|
};
|
|
58
|
-
const { buildMDX } = await import("./build-
|
|
58
|
+
const { buildMDX } = await import("./build-BnKCFeb6.js").then((n) => n.n);
|
|
59
59
|
const compiled = await buildMDX(core, docCollection, {
|
|
60
60
|
isDevelopment,
|
|
61
61
|
source: "\n".repeat(countLines(matter.matter)) + matter.content,
|
|
@@ -65,7 +65,7 @@ function createMdxLoader({ getCore }) {
|
|
|
65
65
|
environment: "bundler"
|
|
66
66
|
});
|
|
67
67
|
const out = {
|
|
68
|
-
code:
|
|
68
|
+
code: compiled.code,
|
|
69
69
|
moduleType: "js",
|
|
70
70
|
map: compiled.map
|
|
71
71
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import {
|
|
2
|
+
import { parse } from "yaml";
|
|
3
3
|
//#region src/loaders/meta.ts
|
|
4
4
|
const querySchema = z.looseObject({
|
|
5
5
|
collection: z.string().optional(),
|
|
@@ -10,10 +10,10 @@ const querySchema = z.looseObject({
|
|
|
10
10
|
*/
|
|
11
11
|
function createMetaLoader({ getCore }, resolve = {}) {
|
|
12
12
|
const { json: resolveJson = "js" } = resolve;
|
|
13
|
-
function parse(filePath, source) {
|
|
13
|
+
function parse$1(filePath, source) {
|
|
14
14
|
try {
|
|
15
15
|
if (filePath.endsWith(".json")) return JSON.parse(source);
|
|
16
|
-
if (filePath.endsWith(".yaml")) return
|
|
16
|
+
if (filePath.endsWith(".yaml")) return parse(source);
|
|
17
17
|
} catch (e) {
|
|
18
18
|
throw new Error(`invalid data in ${filePath}`, { cause: e });
|
|
19
19
|
}
|
|
@@ -36,7 +36,7 @@ function createMetaLoader({ getCore }, resolve = {}) {
|
|
|
36
36
|
metaCollection = collection.meta;
|
|
37
37
|
break;
|
|
38
38
|
}
|
|
39
|
-
const data = parse(filePath, source);
|
|
39
|
+
const data = parse$1(filePath, source);
|
|
40
40
|
if (!metaCollection) return data;
|
|
41
41
|
return core.transformMeta({
|
|
42
42
|
collection: metaCollection,
|
|
@@ -63,7 +63,7 @@ function createMetaLoader({ getCore }, resolve = {}) {
|
|
|
63
63
|
const result = onMeta(source, input);
|
|
64
64
|
if (result === null) return {
|
|
65
65
|
loader: "object",
|
|
66
|
-
exports: parse(input.filePath, source)
|
|
66
|
+
exports: parse$1(input.filePath, source)
|
|
67
67
|
};
|
|
68
68
|
return result().then((data) => ({
|
|
69
69
|
loader: "object",
|
package/dist/next/index.d.ts
CHANGED
package/dist/next/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as createCore, t as _Defaults } from "../core-
|
|
2
|
-
import { t as loadConfig } from "../load-from-file-
|
|
1
|
+
import { n as createCore, t as _Defaults } from "../core-Cq6V99iz.js";
|
|
2
|
+
import { t as loadConfig } from "../load-from-file-CVTAyohB.js";
|
|
3
3
|
import { i as metaLoaderQueryGlob, n as metaLoaderFileGlob, t as mdxLoaderGlob } from "../loaders-CUuRGbiE.js";
|
|
4
4
|
import { t as indexFile } from "../index-file-C9Bw7He1.js";
|
|
5
5
|
import * as path$1 from "node:path";
|
package/dist/node/_loader.d.ts
CHANGED
package/dist/node/_loader.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as createMdxLoader } from "../mdx-
|
|
2
|
-
import { n as createCore, t as _Defaults } from "../core-
|
|
3
|
-
import { n as toNode, o as createStandaloneConfigLoader } from "../adapter-
|
|
4
|
-
import { t as createMetaLoader } from "../meta-
|
|
1
|
+
import { t as createMdxLoader } from "../mdx-wSuDwc6c.js";
|
|
2
|
+
import { n as createCore, t as _Defaults } from "../core-Cq6V99iz.js";
|
|
3
|
+
import { n as toNode, o as createStandaloneConfigLoader } from "../adapter-DPEpBHhE.js";
|
|
4
|
+
import { t as createMetaLoader } from "../meta-BDiR5cQC.js";
|
|
5
5
|
import { r as metaLoaderGlob, t as mdxLoaderGlob } from "../loaders-CUuRGbiE.js";
|
|
6
6
|
//#region src/node/_loader.ts
|
|
7
7
|
let cachedLoaders;
|
package/dist/node/index.d.ts
CHANGED
package/dist/node/loader.d.ts
CHANGED
package/dist/node/loader.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as createMdxLoader } from "../mdx-
|
|
2
|
-
import { n as createCore, t as _Defaults } from "../core-
|
|
3
|
-
import { n as toNode, o as createStandaloneConfigLoader } from "../adapter-
|
|
4
|
-
import { t as createMetaLoader } from "../meta-
|
|
1
|
+
import { t as createMdxLoader } from "../mdx-wSuDwc6c.js";
|
|
2
|
+
import { n as createCore, t as _Defaults } from "../core-Cq6V99iz.js";
|
|
3
|
+
import { n as toNode, o as createStandaloneConfigLoader } from "../adapter-DPEpBHhE.js";
|
|
4
|
+
import { t as createMetaLoader } from "../meta-BDiR5cQC.js";
|
|
5
5
|
import { r as metaLoaderGlob, t as mdxLoaderGlob } from "../loaders-CUuRGbiE.js";
|
|
6
6
|
//#region src/node/loader.ts
|
|
7
7
|
const configLoader = createStandaloneConfigLoader({
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { f as IndexFilePlugin, m as indexFile, p as IndexFilePluginOptions } from "../core-
|
|
1
|
+
import { f as IndexFilePlugin, m as indexFile, p as IndexFilePluginOptions } from "../core-Br7DNGl3.js";
|
|
2
2
|
export { IndexFilePlugin, IndexFilePluginOptions, indexFile as default };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { s as Plugin } from "../core-
|
|
2
|
-
|
|
1
|
+
import { s as Plugin } from "../core-Br7DNGl3.js";
|
|
3
2
|
//#region src/plugins/json-schema.d.ts
|
|
4
3
|
interface JSONSchemaOptions {
|
|
5
4
|
/**
|
|
@@ -14,8 +13,6 @@ interface JSONSchemaOptions {
|
|
|
14
13
|
*
|
|
15
14
|
* note: **it only works with Zod**
|
|
16
15
|
*/
|
|
17
|
-
declare function jsonSchema({
|
|
18
|
-
insert
|
|
19
|
-
}?: JSONSchemaOptions): Plugin;
|
|
16
|
+
declare function jsonSchema({ insert }?: JSONSchemaOptions): Plugin;
|
|
20
17
|
//#endregion
|
|
21
18
|
export { JSONSchemaOptions, jsonSchema as default };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { s as Plugin } from "../core-
|
|
2
|
-
|
|
1
|
+
import { s as Plugin } from "../core-Br7DNGl3.js";
|
|
3
2
|
//#region src/plugins/last-modified.d.ts
|
|
4
3
|
type VersionControlFn = (filePath: string) => Promise<Date | null | undefined>;
|
|
5
4
|
interface LastModifiedPluginOptions {
|
|
@@ -58,21 +58,35 @@ function lastModified(options = {}) {
|
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
60
|
async function getGitTimestamp(file, cwd) {
|
|
61
|
-
|
|
61
|
+
return (await getGitTimestamps(cwd)).get(path.resolve(cwd, file)) ?? null;
|
|
62
|
+
}
|
|
63
|
+
function getGitTimestamps(cwd) {
|
|
64
|
+
const cached = cache.get(cwd);
|
|
62
65
|
if (cached) return cached;
|
|
63
|
-
const
|
|
66
|
+
const promise = (async () => {
|
|
67
|
+
const timestamps = /* @__PURE__ */ new Map();
|
|
68
|
+
const root = await x("git", ["rev-parse", "--show-toplevel"], { nodeOptions: { cwd } });
|
|
69
|
+
if (root.exitCode !== 0) return timestamps;
|
|
64
70
|
const out = await x("git", [
|
|
71
|
+
"-c",
|
|
72
|
+
"core.quotepath=off",
|
|
65
73
|
"log",
|
|
66
|
-
"
|
|
67
|
-
"--
|
|
68
|
-
path.relative(cwd, file)
|
|
74
|
+
"--format=commit:%aI",
|
|
75
|
+
"--name-only"
|
|
69
76
|
], { nodeOptions: { cwd } });
|
|
70
|
-
if (out.exitCode !== 0) return
|
|
71
|
-
|
|
72
|
-
|
|
77
|
+
if (out.exitCode !== 0) return timestamps;
|
|
78
|
+
let date;
|
|
79
|
+
for (const line of out.stdout.split("\n")) if (line.startsWith("commit:")) {
|
|
80
|
+
const parsed = new Date(line.slice(7));
|
|
81
|
+
date = isNaN(parsed.getTime()) ? void 0 : parsed;
|
|
82
|
+
} else if (line.length > 0 && date) {
|
|
83
|
+
const file = path.join(root.stdout.trim(), line);
|
|
84
|
+
if (!timestamps.has(file)) timestamps.set(file, date);
|
|
85
|
+
}
|
|
86
|
+
return timestamps;
|
|
73
87
|
})();
|
|
74
|
-
cache.set(
|
|
75
|
-
return
|
|
88
|
+
cache.set(cwd, promise);
|
|
89
|
+
return promise;
|
|
76
90
|
}
|
|
77
91
|
//#endregion
|
|
78
92
|
export { lastModified as default };
|
|
@@ -5,6 +5,64 @@ import { unified } from "unified";
|
|
|
5
5
|
import { visit } from "unist-util-visit";
|
|
6
6
|
import { remarkHeading } from "fumadocs-core/mdx-plugins";
|
|
7
7
|
import { VFile } from "vfile";
|
|
8
|
+
//#region src/config/preset.ts
|
|
9
|
+
function pluginOption(def, options = []) {
|
|
10
|
+
const list = def(Array.isArray(options) ? options : []).filter(Boolean);
|
|
11
|
+
if (typeof options === "function") return options(list);
|
|
12
|
+
return list;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* apply MDX processor presets
|
|
16
|
+
*/
|
|
17
|
+
function applyMdxPreset(options = {}) {
|
|
18
|
+
return async (environment = "bundler") => {
|
|
19
|
+
if (options.preset === "minimal") return options;
|
|
20
|
+
const plugins = await import("fumadocs-core/mdx-plugins");
|
|
21
|
+
const { valueToExport = [], rehypeCodeOptions, remarkImageOptions, remarkHeadingOptions, remarkStructureOptions, remarkCodeTabOptions, remarkNpmOptions, ...mdxOptions } = options;
|
|
22
|
+
const remarkPlugins = pluginOption((v) => [
|
|
23
|
+
plugins.remarkGfm,
|
|
24
|
+
[plugins.remarkHeading, {
|
|
25
|
+
generateToc: false,
|
|
26
|
+
...remarkHeadingOptions
|
|
27
|
+
}],
|
|
28
|
+
remarkImageOptions !== false && [plugins.remarkImage, {
|
|
29
|
+
...remarkImageOptions,
|
|
30
|
+
useImport: remarkImageOptions?.useImport ?? environment === "bundler"
|
|
31
|
+
}],
|
|
32
|
+
"remarkCodeTab" in plugins && remarkCodeTabOptions !== false && [plugins.remarkCodeTab, remarkCodeTabOptions],
|
|
33
|
+
"remarkNpm" in plugins && remarkNpmOptions !== false && [plugins.remarkNpm, remarkNpmOptions],
|
|
34
|
+
...v,
|
|
35
|
+
remarkStructureOptions !== false && [plugins.remarkStructure, {
|
|
36
|
+
exportAs: "structuredData",
|
|
37
|
+
...remarkStructureOptions
|
|
38
|
+
}],
|
|
39
|
+
valueToExport.length > 0 && (() => {
|
|
40
|
+
return (_, file) => {
|
|
41
|
+
file.data["mdx-export"] ??= [];
|
|
42
|
+
for (const name of valueToExport) {
|
|
43
|
+
if (!(name in file.data)) continue;
|
|
44
|
+
file.data["mdx-export"].push({
|
|
45
|
+
name,
|
|
46
|
+
value: file.data[name]
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
})
|
|
51
|
+
], mdxOptions.remarkPlugins);
|
|
52
|
+
const rehypePlugins = pluginOption((v) => [
|
|
53
|
+
rehypeCodeOptions !== false && [plugins.rehypeCode, rehypeCodeOptions],
|
|
54
|
+
...v,
|
|
55
|
+
plugins.rehypeToc
|
|
56
|
+
], mdxOptions.rehypePlugins);
|
|
57
|
+
return {
|
|
58
|
+
...mdxOptions,
|
|
59
|
+
outputFormat: environment === "runtime" ? "function-body" : mdxOptions.outputFormat,
|
|
60
|
+
remarkPlugins,
|
|
61
|
+
rehypePlugins
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
//#endregion
|
|
8
66
|
//#region src/loaders/mdx/remark-unravel.ts
|
|
9
67
|
function remarkMarkAndUnravel() {
|
|
10
68
|
return (tree) => {
|
|
@@ -239,4 +297,4 @@ function remarkInclude() {
|
|
|
239
297
|
};
|
|
240
298
|
}
|
|
241
299
|
//#endregion
|
|
242
|
-
export { flattenNode as n, remarkInclude as t };
|
|
300
|
+
export { flattenNode as n, applyMdxPreset as r, remarkInclude as t };
|
package/dist/rolldown/index.d.ts
CHANGED
package/dist/rolldown/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as createMdxLoader } from "../mdx-
|
|
2
|
-
import { i as buildConfig, n as createCore, t as _Defaults } from "../core-
|
|
3
|
-
import { a as createIntegratedConfigLoader, r as toVite } from "../adapter-
|
|
4
|
-
import { t as createMetaLoader } from "../meta-
|
|
1
|
+
import { t as createMdxLoader } from "../mdx-wSuDwc6c.js";
|
|
2
|
+
import { i as buildConfig, n as createCore, t as _Defaults } from "../core-Cq6V99iz.js";
|
|
3
|
+
import { a as createIntegratedConfigLoader, r as toVite } from "../adapter-DPEpBHhE.js";
|
|
4
|
+
import { t as createMetaLoader } from "../meta-BDiR5cQC.js";
|
|
5
5
|
import { r as metaLoaderGlob, t as mdxLoaderGlob } from "../loaders-CUuRGbiE.js";
|
|
6
6
|
import fs from "node:fs/promises";
|
|
7
7
|
//#region src/rolldown/index.ts
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { A as DocCollection,
|
|
2
|
-
import { i as InternalTypeConfig } from "../types-
|
|
3
|
-
import { t as CompiledMDXProperties } from "../build-mdx-1yRXUhuv.js";
|
|
1
|
+
import { A as DocCollection, F as DocsCollection, G as CompiledMDXProperties } from "../core-Br7DNGl3.js";
|
|
2
|
+
import { i as InternalTypeConfig } from "../types-DWoea9Sq.js";
|
|
4
3
|
import { FC, ReactNode } from "react";
|
|
5
4
|
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
6
|
-
|
|
7
5
|
//#region src/runtime/browser.d.ts
|
|
8
6
|
type CompiledMDXFile<Name extends string, Frontmatter, TC extends InternalTypeConfig> = CompiledMDXProperties<Frontmatter> & TC['DocData'][Name] & Record<string, unknown>;
|
|
9
7
|
interface ClientLoaderOptions<Doc, Props> {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { A as DocCollection,
|
|
2
|
-
import { i as InternalTypeConfig, r as FileInfo } from "../types-
|
|
3
|
-
|
|
1
|
+
import { A as DocCollection, F as DocsCollection, g as AsyncDocsCollectionEntry, h as AsyncDocCollectionEntry, r as CoreOptions, x as ServerOptions } from "../core-Br7DNGl3.js";
|
|
2
|
+
import { i as InternalTypeConfig, r as FileInfo } from "../types-DWoea9Sq.js";
|
|
4
3
|
//#region src/runtime/dynamic.d.ts
|
|
5
4
|
interface LazyEntry<Data = unknown> {
|
|
6
5
|
info: FileInfo;
|
package/dist/runtime/dynamic.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { i as buildConfig, n as createCore } from "../core-
|
|
2
|
-
import { t as buildMDX } from "../build-
|
|
1
|
+
import { i as buildConfig, n as createCore } from "../core-Cq6V99iz.js";
|
|
2
|
+
import { t as buildMDX } from "../build-BnKCFeb6.js";
|
|
3
3
|
import { server } from "./server.js";
|
|
4
4
|
import { frontmatter } from "fumadocs-core/content/md/frontmatter";
|
|
5
5
|
import fs from "node:fs/promises";
|
|
@@ -37,14 +37,13 @@ async function dynamic(configExports, coreOptions, serverOptions) {
|
|
|
37
37
|
async function compile({ info, data }) {
|
|
38
38
|
let content = await fs.readFile(info.fullPath, "utf-8");
|
|
39
39
|
content = frontmatter(content).content;
|
|
40
|
-
|
|
40
|
+
return await executeMdx((await buildMDX(core, collection, {
|
|
41
41
|
filePath: info.fullPath,
|
|
42
42
|
source: content,
|
|
43
43
|
frontmatter: data,
|
|
44
44
|
isDevelopment: false,
|
|
45
45
|
environment: "runtime"
|
|
46
|
-
});
|
|
47
|
-
return await executeMdx(String(compiled.value), { baseUrl: pathToFileURL(info.fullPath) });
|
|
46
|
+
})).code, { baseUrl: pathToFileURL(info.fullPath) });
|
|
48
47
|
}
|
|
49
48
|
for (const entry of entries) {
|
|
50
49
|
head[entry.info.path] = () => entry.data;
|
package/dist/runtime/server.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as toFumadocsSource, S as server, _ as DocCollectionEntry, b as ServerCreate, g as AsyncDocsCollectionEntry, h as AsyncDocCollectionEntry, v as DocsCollectionEntry, x as ServerOptions, y as MetaCollectionEntry } from "../core-
|
|
1
|
+
import { C as toFumadocsSource, S as server, _ as DocCollectionEntry, b as ServerCreate, g as AsyncDocsCollectionEntry, h as AsyncDocCollectionEntry, v as DocsCollectionEntry, x as ServerOptions, y as MetaCollectionEntry } from "../core-Br7DNGl3.js";
|
|
2
2
|
export { AsyncDocCollectionEntry, AsyncDocsCollectionEntry, DocCollectionEntry, DocsCollectionEntry, MetaCollectionEntry, ServerCreate, ServerOptions, server, toFumadocsSource };
|
package/dist/runtime/server.js
CHANGED
|
@@ -98,8 +98,9 @@ function createDocMethods(info, load) {
|
|
|
98
98
|
async getText(type) {
|
|
99
99
|
if (type === "raw") return await (await import("node:fs/promises")).readFile(info.fullPath, "utf-8");
|
|
100
100
|
const data = await load();
|
|
101
|
-
|
|
102
|
-
|
|
101
|
+
const markdown = data._markdown ?? data._exports?._markdown;
|
|
102
|
+
if (typeof markdown !== "string") throw new Error("getText('processed') requires `includeProcessedMarkdown` to be enabled in your collection config.");
|
|
103
|
+
return markdown;
|
|
103
104
|
},
|
|
104
105
|
async getMDAST() {
|
|
105
106
|
const data = await load();
|
package/dist/runtime/types.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as MetaMethods, i as InternalTypeConfig, n as DocMethods, r as FileInfo, t as DocData } from "../types-
|
|
1
|
+
import { a as MetaMethods, i as InternalTypeConfig, n as DocMethods, r as FileInfo, t as DocData } from "../types-DWoea9Sq.js";
|
|
2
2
|
export { DocData, DocMethods, FileInfo, InternalTypeConfig, MetaMethods };
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { Root } from "mdast";
|
|
2
|
-
import { StructuredData } from "fumadocs-core/mdx-plugins/remark-structure";
|
|
3
2
|
import { TOCItemType } from "fumadocs-core/toc";
|
|
4
3
|
import { MDXContent } from "mdx/types";
|
|
5
|
-
|
|
4
|
+
import { StructuredData } from "fumadocs-core/mdx-plugins/remark-structure";
|
|
6
5
|
//#region src/runtime/types.d.ts
|
|
7
6
|
interface DocData {
|
|
8
7
|
/**
|
package/dist/vite/index.d.ts
CHANGED
package/dist/vite/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { t as createMdxLoader } from "../mdx-
|
|
2
|
-
import { i as buildConfig, n as createCore, t as _Defaults } from "../core-
|
|
3
|
-
import { a as createIntegratedConfigLoader, r as toVite } from "../adapter-
|
|
4
|
-
import { t as createMetaLoader } from "../meta-
|
|
1
|
+
import { t as createMdxLoader } from "../mdx-wSuDwc6c.js";
|
|
2
|
+
import { i as buildConfig, n as createCore, t as _Defaults } from "../core-Cq6V99iz.js";
|
|
3
|
+
import { a as createIntegratedConfigLoader, r as toVite } from "../adapter-DPEpBHhE.js";
|
|
4
|
+
import { t as createMetaLoader } from "../meta-BDiR5cQC.js";
|
|
5
5
|
import { r as metaLoaderGlob, t as mdxLoaderGlob } from "../loaders-CUuRGbiE.js";
|
|
6
6
|
import { t as indexFile } from "../index-file-C9Bw7He1.js";
|
|
7
7
|
import path from "node:path";
|
|
@@ -43,7 +43,7 @@ function mdx(forcedConfig, pluginOptions = {}) {
|
|
|
43
43
|
};
|
|
44
44
|
if ("_fumadocs_skipViteConfig" in config && config._fumadocs_skipViteConfig) return;
|
|
45
45
|
if (!options.updateViteConfig) return;
|
|
46
|
-
const { getConfig } = await import("../dist-
|
|
46
|
+
const { getConfig } = await import("../dist-CQ17lmpt.js");
|
|
47
47
|
return getConfig({ root });
|
|
48
48
|
},
|
|
49
49
|
async buildStart() {
|
|
@@ -64,7 +64,7 @@ function mdx(forcedConfig, pluginOptions = {}) {
|
|
|
64
64
|
];
|
|
65
65
|
}
|
|
66
66
|
async function postInstall(pluginOptions = {}) {
|
|
67
|
-
const { loadConfig } = await import("../load-from-file-
|
|
67
|
+
const { loadConfig } = await import("../load-from-file-CVTAyohB.js").then((n) => n.n);
|
|
68
68
|
const core = createViteCore(applyDefaults(process.cwd(), pluginOptions));
|
|
69
69
|
await core.init({ config: loadConfig(core, true) });
|
|
70
70
|
await core.emit({ write: true });
|
package/dist/webpack/mdx.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { t as WebpackLoaderOptions } from "../index-
|
|
1
|
+
import { t as WebpackLoaderOptions } from "../index-Bb7u_Fzy.js";
|
|
2
2
|
import { LoaderDefinitionFunction } from "webpack";
|
|
3
|
-
|
|
4
3
|
//#region src/webpack/mdx.d.ts
|
|
5
4
|
declare const loader: LoaderDefinitionFunction<WebpackLoaderOptions>;
|
|
6
5
|
//#endregion
|
package/dist/webpack/mdx.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as createMdxLoader } from "../mdx-
|
|
2
|
-
import { i as toWebpack, o as createStandaloneConfigLoader } from "../adapter-
|
|
3
|
-
import { t as getCore } from "../webpack-
|
|
1
|
+
import { t as createMdxLoader } from "../mdx-wSuDwc6c.js";
|
|
2
|
+
import { i as toWebpack, o as createStandaloneConfigLoader } from "../adapter-DPEpBHhE.js";
|
|
3
|
+
import { t as getCore } from "../webpack-BZVbRnxp.js";
|
|
4
4
|
//#region src/webpack/mdx.ts
|
|
5
5
|
let instance;
|
|
6
6
|
const loader = function loader(source) {
|
package/dist/webpack/meta.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { t as WebpackLoaderOptions } from "../index-
|
|
1
|
+
import { t as WebpackLoaderOptions } from "../index-Bb7u_Fzy.js";
|
|
2
2
|
import { LoaderDefinitionFunction } from "webpack";
|
|
3
|
-
|
|
4
3
|
//#region src/webpack/meta.d.ts
|
|
5
4
|
declare const loader: LoaderDefinitionFunction<WebpackLoaderOptions>;
|
|
6
5
|
//#endregion
|
package/dist/webpack/meta.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { i as toWebpack, o as createStandaloneConfigLoader } from "../adapter-
|
|
2
|
-
import { t as createMetaLoader } from "../meta-
|
|
3
|
-
import { t as getCore } from "../webpack-
|
|
1
|
+
import { i as toWebpack, o as createStandaloneConfigLoader } from "../adapter-DPEpBHhE.js";
|
|
2
|
+
import { t as createMetaLoader } from "../meta-BDiR5cQC.js";
|
|
3
|
+
import { t as getCore } from "../webpack-BZVbRnxp.js";
|
|
4
4
|
//#region src/webpack/meta.ts
|
|
5
5
|
let instance;
|
|
6
6
|
const loader = function(source) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fumadocs-mdx",
|
|
3
|
-
"version": "15.
|
|
3
|
+
"version": "15.1.1",
|
|
4
4
|
"description": "The built-in source for Fumadocs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Docs",
|
|
@@ -55,40 +55,44 @@
|
|
|
55
55
|
"chokidar": "^5.0.0",
|
|
56
56
|
"esbuild": "^0.28.1",
|
|
57
57
|
"estree-util-value-to-estree": "^3.5.0",
|
|
58
|
-
"
|
|
58
|
+
"github-slugger": "^2.0.0",
|
|
59
59
|
"mdast-util-mdx": "^3.0.0",
|
|
60
60
|
"picocolors": "^1.1.1",
|
|
61
|
-
"picomatch": "^4.0.
|
|
61
|
+
"picomatch": "^4.0.5",
|
|
62
62
|
"tinyexec": "^1.2.4",
|
|
63
63
|
"tinyglobby": "^0.2.17",
|
|
64
64
|
"unified": "^11.0.5",
|
|
65
65
|
"unist-util-remove-position": "^5.0.0",
|
|
66
66
|
"unist-util-visit": "^5.1.0",
|
|
67
67
|
"vfile": "^6.0.3",
|
|
68
|
+
"yaml": "^2.9.0",
|
|
68
69
|
"zod": "^4.4.3"
|
|
69
70
|
},
|
|
70
71
|
"devDependencies": {
|
|
71
72
|
"@types/bun": "^1.3.14",
|
|
72
73
|
"@types/mdast": "^4.0.4",
|
|
73
74
|
"@types/mdx": "^2.0.14",
|
|
74
|
-
"@types/node": "^26.
|
|
75
|
+
"@types/node": "^26.1.1",
|
|
75
76
|
"@types/picomatch": "^4.0.3",
|
|
76
77
|
"@types/react": "^19.2.17",
|
|
77
78
|
"mdast-util-directive": "^3.1.0",
|
|
78
|
-
"next": "^16.2.
|
|
79
|
+
"next": "^16.2.10",
|
|
79
80
|
"react": "^19.2.7",
|
|
80
81
|
"remark": "^15.0.1",
|
|
81
82
|
"remark-directive": "^4.0.0",
|
|
82
83
|
"remark-mdx": "^3.1.1",
|
|
83
|
-
"rolldown": "^1.1.
|
|
84
|
-
"
|
|
85
|
-
"
|
|
86
|
-
"
|
|
87
|
-
"
|
|
88
|
-
"fumadocs
|
|
89
|
-
"tsconfig": "0.0.0"
|
|
84
|
+
"rolldown": "^1.1.5",
|
|
85
|
+
"satteri": "^0.9.5",
|
|
86
|
+
"tsdown": "0.22.5",
|
|
87
|
+
"vite": "^8.1.4",
|
|
88
|
+
"webpack": "^5.108.4",
|
|
89
|
+
"@fumadocs/satteri": "0.2.2",
|
|
90
|
+
"tsconfig": "0.0.0",
|
|
91
|
+
"@fumadocs/vite": "0.1.0",
|
|
92
|
+
"fumadocs-core": "16.11.4"
|
|
90
93
|
},
|
|
91
94
|
"peerDependencies": {
|
|
95
|
+
"@fumadocs/satteri": "0.x.x",
|
|
92
96
|
"@types/mdast": "*",
|
|
93
97
|
"@types/mdx": "*",
|
|
94
98
|
"@types/react": "*",
|
|
@@ -97,9 +101,16 @@
|
|
|
97
101
|
"next": "^15.3.0 || ^16.0.0",
|
|
98
102
|
"react": "^19.2.0",
|
|
99
103
|
"rolldown": "*",
|
|
104
|
+
"satteri": "^0.9.4",
|
|
100
105
|
"vite": "7.x.x || 8.x.x"
|
|
101
106
|
},
|
|
102
107
|
"peerDependenciesMeta": {
|
|
108
|
+
"@fumadocs/satteri": {
|
|
109
|
+
"optional": true
|
|
110
|
+
},
|
|
111
|
+
"satteri": {
|
|
112
|
+
"optional": true
|
|
113
|
+
},
|
|
103
114
|
"rolldown": {
|
|
104
115
|
"optional": true
|
|
105
116
|
},
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { StructuredData } from "fumadocs-core/mdx-plugins";
|
|
2
|
-
import { VFile } from "vfile";
|
|
3
|
-
import { FC } from "react";
|
|
4
|
-
import { createProcessor } from "@mdx-js/mdx";
|
|
5
|
-
import { TOCItemType } from "fumadocs-core/toc";
|
|
6
|
-
import { MDXProps } from "mdx/types";
|
|
7
|
-
|
|
8
|
-
//#region src/loaders/mdx/build-mdx.d.ts
|
|
9
|
-
type Processor = ReturnType<typeof createProcessor>;
|
|
10
|
-
interface CompilerOptions {
|
|
11
|
-
addDependency: (file: string) => void;
|
|
12
|
-
}
|
|
13
|
-
interface CompiledMDXProperties<Frontmatter = Record<string, unknown>> {
|
|
14
|
-
frontmatter: Frontmatter;
|
|
15
|
-
structuredData: StructuredData;
|
|
16
|
-
toc: TOCItemType[];
|
|
17
|
-
default: FC<MDXProps>;
|
|
18
|
-
/**
|
|
19
|
-
* Enable from `postprocess` option.
|
|
20
|
-
*/
|
|
21
|
-
_markdown?: string;
|
|
22
|
-
/**
|
|
23
|
-
* Enable from `postprocess` option.
|
|
24
|
-
*/
|
|
25
|
-
_mdast?: string;
|
|
26
|
-
}
|
|
27
|
-
interface FumadocsDataMap {
|
|
28
|
-
/**
|
|
29
|
-
* [Fumadocs MDX] raw frontmatter, you can modify it
|
|
30
|
-
*/
|
|
31
|
-
frontmatter?: Record<string, unknown>;
|
|
32
|
-
/**
|
|
33
|
-
* [Fumadocs MDX] additional ESM exports to write
|
|
34
|
-
*/
|
|
35
|
-
'mdx-export'?: {
|
|
36
|
-
name: string;
|
|
37
|
-
value: unknown;
|
|
38
|
-
}[];
|
|
39
|
-
/**
|
|
40
|
-
* [Fumadocs MDX] The compiler object from loader
|
|
41
|
-
*/
|
|
42
|
-
_compiler?: CompilerOptions;
|
|
43
|
-
/**
|
|
44
|
-
* [Fumadocs MDX] get internal processor, do not use this on user land.
|
|
45
|
-
*/
|
|
46
|
-
_getProcessor?: (format: 'md' | 'mdx') => Processor;
|
|
47
|
-
}
|
|
48
|
-
declare module 'vfile' {
|
|
49
|
-
interface DataMap extends FumadocsDataMap {}
|
|
50
|
-
}
|
|
51
|
-
//#endregion
|
|
52
|
-
export { CompiledMDXProperties as t };
|
package/dist/preset-NZprPlqc.js
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
//#region src/config/preset.ts
|
|
2
|
-
function pluginOption(def, options = []) {
|
|
3
|
-
const list = def(Array.isArray(options) ? options : []).filter(Boolean);
|
|
4
|
-
if (typeof options === "function") return options(list);
|
|
5
|
-
return list;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* apply MDX processor presets
|
|
9
|
-
*/
|
|
10
|
-
function applyMdxPreset(options = {}) {
|
|
11
|
-
return async (environment = "bundler") => {
|
|
12
|
-
if (options.preset === "minimal") return options;
|
|
13
|
-
const plugins = await import("fumadocs-core/mdx-plugins");
|
|
14
|
-
const { valueToExport = [], rehypeCodeOptions, remarkImageOptions, remarkHeadingOptions, remarkStructureOptions, remarkCodeTabOptions, remarkNpmOptions, ...mdxOptions } = options;
|
|
15
|
-
const remarkPlugins = pluginOption((v) => [
|
|
16
|
-
plugins.remarkGfm,
|
|
17
|
-
[plugins.remarkHeading, {
|
|
18
|
-
generateToc: false,
|
|
19
|
-
...remarkHeadingOptions
|
|
20
|
-
}],
|
|
21
|
-
remarkImageOptions !== false && [plugins.remarkImage, {
|
|
22
|
-
...remarkImageOptions,
|
|
23
|
-
useImport: remarkImageOptions?.useImport ?? environment === "bundler"
|
|
24
|
-
}],
|
|
25
|
-
"remarkCodeTab" in plugins && remarkCodeTabOptions !== false && [plugins.remarkCodeTab, remarkCodeTabOptions],
|
|
26
|
-
"remarkNpm" in plugins && remarkNpmOptions !== false && [plugins.remarkNpm, remarkNpmOptions],
|
|
27
|
-
...v,
|
|
28
|
-
remarkStructureOptions !== false && [plugins.remarkStructure, {
|
|
29
|
-
exportAs: "structuredData",
|
|
30
|
-
...remarkStructureOptions
|
|
31
|
-
}],
|
|
32
|
-
valueToExport.length > 0 && (() => {
|
|
33
|
-
return (_, file) => {
|
|
34
|
-
file.data["mdx-export"] ??= [];
|
|
35
|
-
for (const name of valueToExport) {
|
|
36
|
-
if (!(name in file.data)) continue;
|
|
37
|
-
file.data["mdx-export"].push({
|
|
38
|
-
name,
|
|
39
|
-
value: file.data[name]
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
})
|
|
44
|
-
], mdxOptions.remarkPlugins);
|
|
45
|
-
const rehypePlugins = pluginOption((v) => [
|
|
46
|
-
rehypeCodeOptions !== false && [plugins.rehypeCode, rehypeCodeOptions],
|
|
47
|
-
...v,
|
|
48
|
-
plugins.rehypeToc
|
|
49
|
-
], mdxOptions.rehypePlugins);
|
|
50
|
-
return {
|
|
51
|
-
...mdxOptions,
|
|
52
|
-
outputFormat: environment === "runtime" ? "function-body" : mdxOptions.outputFormat,
|
|
53
|
-
remarkPlugins,
|
|
54
|
-
rehypePlugins
|
|
55
|
-
};
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
//#endregion
|
|
59
|
-
export { applyMdxPreset as t };
|