fumadocs-mdx 14.0.0 → 14.0.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.
- package/dist/{build-mdx-6UAK5FF5.js → build-mdx-W3233QBZ.js} +1 -1
- package/dist/bun/index.d.ts +7 -1
- package/dist/bun/index.js +9 -8
- package/dist/{chunk-5YXP7JLN.js → chunk-5OBUOALK.js} +8 -5
- package/dist/{chunk-ZY6UZ7NH.js → chunk-6RPNS75C.js} +1 -1
- package/dist/{chunk-XHJCLBZ4.js → chunk-ED3ON275.js} +86 -162
- package/dist/{chunk-7L2KNF6B.js → chunk-GB4W3YCZ.js} +51 -7
- package/dist/{chunk-SLY7WXTX.js → chunk-KOPLIEVQ.js} +5 -6
- package/dist/{chunk-OXSRIWQW.js → chunk-LPX7ZO66.js} +4 -3
- package/dist/{chunk-SRSRFOVI.js → chunk-OLL7FM7W.js} +3 -3
- package/dist/{chunk-5UMZCWKV.js → chunk-Q5OSGLJL.js} +1 -1
- package/dist/{chunk-E5DJTSIM.js → chunk-S7KOJHHO.js} +4 -1
- package/dist/{chunk-6NISOLQ6.js → chunk-USWQVJWR.js} +1 -1
- package/dist/chunk-WBIHDYMN.js +126 -0
- package/dist/config/index.d.ts +6 -1
- package/dist/config/index.js +1 -1
- package/dist/{index-D7JdSMpp.d.cts → core-C3QZSdEx.d.ts} +73 -4
- package/dist/{index-BlVBvy-z.d.ts → index-RVIZxMZG.d.ts} +1 -1
- package/dist/index.d.ts +56 -3
- package/dist/load-from-file-OZ5N7DXU.js +8 -0
- package/dist/next/index.cjs +263 -193
- package/dist/next/index.d.ts +7 -2
- package/dist/next/index.js +12 -10
- package/dist/node/loader.js +4 -4
- package/dist/plugins/index-file.d.ts +7 -22
- package/dist/plugins/index-file.js +2 -2
- package/dist/plugins/json-schema.d.ts +7 -1
- package/dist/plugins/last-modified.d.ts +15 -2
- package/dist/plugins/last-modified.js +43 -6
- package/dist/runtime/browser.d.ts +22 -19
- package/dist/runtime/browser.js +5 -6
- package/dist/runtime/dynamic.d.ts +12 -12
- package/dist/runtime/dynamic.js +12 -11
- package/dist/runtime/server.d.ts +10 -157
- package/dist/runtime/server.js +3 -3
- package/dist/runtime/types.d.ts +61 -0
- package/dist/runtime/types.js +0 -0
- package/dist/vite/index.d.ts +7 -2
- package/dist/vite/index.js +10 -9
- package/dist/webpack/mdx.d.ts +8 -2
- package/dist/webpack/mdx.js +5 -5
- package/dist/webpack/meta.d.ts +8 -2
- package/dist/webpack/meta.js +4 -4
- package/package.json +4 -6
- package/dist/bin.cjs +0 -1889
- package/dist/bin.d.cts +0 -1
- package/dist/bun/index.cjs +0 -1112
- package/dist/bun/index.d.cts +0 -19
- package/dist/chunk-PKI7ZDA5.js +0 -29
- package/dist/config/index.cjs +0 -400
- package/dist/config/index.d.cts +0 -13
- package/dist/index-D7JdSMpp.d.ts +0 -272
- package/dist/index-P2NNUkHn.d.cts +0 -8
- package/dist/index.cjs +0 -18
- package/dist/index.d.cts +0 -8
- package/dist/load-from-file-I3ALLIVB.js +0 -8
- package/dist/next/index.d.cts +0 -28
- package/dist/node/loader.cjs +0 -1165
- package/dist/node/loader.d.cts +0 -5
- package/dist/plugins/index-file.cjs +0 -471
- package/dist/plugins/index-file.d.cts +0 -29
- package/dist/plugins/json-schema.cjs +0 -114
- package/dist/plugins/json-schema.d.cts +0 -25
- package/dist/plugins/last-modified.cjs +0 -75
- package/dist/plugins/last-modified.d.cts +0 -27
- package/dist/runtime/browser.cjs +0 -94
- package/dist/runtime/browser.d.cts +0 -50
- package/dist/runtime/dynamic.cjs +0 -985
- package/dist/runtime/dynamic.d.cts +0 -27
- package/dist/runtime/server.cjs +0 -173
- package/dist/runtime/server.d.cts +0 -161
- package/dist/vite/index.cjs +0 -1620
- package/dist/vite/index.d.cts +0 -39
- package/dist/webpack/mdx.cjs +0 -1089
- package/dist/webpack/mdx.d.cts +0 -14
- package/dist/webpack/meta.cjs +0 -649
- package/dist/webpack/meta.d.cts +0 -14
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
|
|
30
|
-
// src/plugins/last-modified.ts
|
|
31
|
-
var last_modified_exports = {};
|
|
32
|
-
__export(last_modified_exports, {
|
|
33
|
-
default: () => lastModified
|
|
34
|
-
});
|
|
35
|
-
module.exports = __toCommonJS(last_modified_exports);
|
|
36
|
-
var import_node_path = __toESM(require("path"), 1);
|
|
37
|
-
var import_tinyexec = require("tinyexec");
|
|
38
|
-
var cache = /* @__PURE__ */ new Map();
|
|
39
|
-
function lastModified(options = {}) {
|
|
40
|
-
const { versionControl = "git" } = options;
|
|
41
|
-
return {
|
|
42
|
-
name: "last-modified",
|
|
43
|
-
doc: {
|
|
44
|
-
async vfile(file) {
|
|
45
|
-
if (versionControl === "git") {
|
|
46
|
-
const timestamp = await getGitTimestamp(this.filePath).then(
|
|
47
|
-
(v) => v?.getTime()
|
|
48
|
-
);
|
|
49
|
-
if (timestamp === void 0) return;
|
|
50
|
-
file.data["mdx-export"] ??= [];
|
|
51
|
-
file.data["mdx-export"].push({
|
|
52
|
-
name: "lastModified",
|
|
53
|
-
value: timestamp
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
async function getGitTimestamp(file) {
|
|
61
|
-
const cached = cache.get(file);
|
|
62
|
-
if (cached) return cached;
|
|
63
|
-
const timePromise = (async () => {
|
|
64
|
-
const out = await (0, import_tinyexec.x)(
|
|
65
|
-
"git",
|
|
66
|
-
["log", "-1", '--pretty="%ai"', import_node_path.default.relative(process.cwd(), file)],
|
|
67
|
-
{
|
|
68
|
-
throwOnError: true
|
|
69
|
-
}
|
|
70
|
-
);
|
|
71
|
-
return new Date(out.stdout);
|
|
72
|
-
})();
|
|
73
|
-
cache.set(file, timePromise);
|
|
74
|
-
return timePromise.catch(() => void 0);
|
|
75
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { j as Plugin } from '../index-D7JdSMpp.cjs';
|
|
2
|
-
import '@mdx-js/mdx';
|
|
3
|
-
import '@standard-schema/spec';
|
|
4
|
-
import 'unified';
|
|
5
|
-
import 'fumadocs-core/mdx-plugins';
|
|
6
|
-
import 'zod';
|
|
7
|
-
import 'chokidar';
|
|
8
|
-
import 'vfile';
|
|
9
|
-
|
|
10
|
-
interface LastModifiedPluginOptions {
|
|
11
|
-
/**
|
|
12
|
-
* Version control to obtain the last modified time.
|
|
13
|
-
*
|
|
14
|
-
* - `git`: Requires `git` to be installed.
|
|
15
|
-
*
|
|
16
|
-
* If you are using Vercel, please set `VERCEL_DEEP_CLONE` environment variable to `true`.
|
|
17
|
-
*
|
|
18
|
-
* @defaultValue 'git'
|
|
19
|
-
*/
|
|
20
|
-
versionControl?: 'git';
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Injects `lastModified` property to page exports.
|
|
24
|
-
*/
|
|
25
|
-
declare function lastModified(options?: LastModifiedPluginOptions): Plugin;
|
|
26
|
-
|
|
27
|
-
export { type LastModifiedPluginOptions, lastModified as default };
|
package/dist/runtime/browser.cjs
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/runtime/browser.ts
|
|
21
|
-
var browser_exports = {};
|
|
22
|
-
__export(browser_exports, {
|
|
23
|
-
createClientLoader: () => createClientLoader,
|
|
24
|
-
fromConfig: () => fromConfig
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(browser_exports);
|
|
27
|
-
var import_react = require("react");
|
|
28
|
-
function fromConfig() {
|
|
29
|
-
return {
|
|
30
|
-
doc(_name, glob) {
|
|
31
|
-
const raw = glob;
|
|
32
|
-
const out = {
|
|
33
|
-
raw,
|
|
34
|
-
createClientLoader({ id = _name, ...options }) {
|
|
35
|
-
return createClientLoader(raw, { id, ...options });
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
return out;
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
var loaderStore = /* @__PURE__ */ new Map();
|
|
43
|
-
function createClientLoader(globEntries, options) {
|
|
44
|
-
const { id = "", component } = options;
|
|
45
|
-
const renderers = {};
|
|
46
|
-
const loaders = /* @__PURE__ */ new Map();
|
|
47
|
-
const store = loaderStore.get(id) ?? {
|
|
48
|
-
preloaded: /* @__PURE__ */ new Map()
|
|
49
|
-
};
|
|
50
|
-
loaderStore.set(id, store);
|
|
51
|
-
for (const k in globEntries) {
|
|
52
|
-
loaders.set(k.startsWith("./") ? k.slice(2) : k, globEntries[k]);
|
|
53
|
-
}
|
|
54
|
-
function getLoader(path) {
|
|
55
|
-
const loader = loaders.get(path);
|
|
56
|
-
if (!loader)
|
|
57
|
-
throw new Error(
|
|
58
|
-
`[createClientLoader] ${path} does not exist in available entries`
|
|
59
|
-
);
|
|
60
|
-
return loader;
|
|
61
|
-
}
|
|
62
|
-
function getRenderer(path) {
|
|
63
|
-
if (path in renderers) return renderers[path];
|
|
64
|
-
const OnDemand = (0, import_react.lazy)(async () => {
|
|
65
|
-
const loaded = await getLoader(path)();
|
|
66
|
-
return { default: (props) => component(loaded, props) };
|
|
67
|
-
});
|
|
68
|
-
renderers[path] = (props) => {
|
|
69
|
-
const cached = store.preloaded.get(path);
|
|
70
|
-
if (!cached) return (0, import_react.createElement)(OnDemand, props);
|
|
71
|
-
return component(cached, props);
|
|
72
|
-
};
|
|
73
|
-
return renderers[path];
|
|
74
|
-
}
|
|
75
|
-
return {
|
|
76
|
-
async preload(path) {
|
|
77
|
-
const loaded = await getLoader(path)();
|
|
78
|
-
store.preloaded.set(path, loaded);
|
|
79
|
-
return loaded;
|
|
80
|
-
},
|
|
81
|
-
getComponent(path) {
|
|
82
|
-
return getRenderer(path);
|
|
83
|
-
},
|
|
84
|
-
useContent(path, props) {
|
|
85
|
-
const Comp = this.getComponent(path);
|
|
86
|
-
return (0, import_react.createElement)(Comp, props);
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
91
|
-
0 && (module.exports = {
|
|
92
|
-
createClientLoader,
|
|
93
|
-
fromConfig
|
|
94
|
-
});
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { ReactNode, FC } from 'react';
|
|
2
|
-
import { CompiledMDXFile } from './server.cjs';
|
|
3
|
-
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
4
|
-
import { D as DocCollection, b as DocsCollection } from '../index-D7JdSMpp.cjs';
|
|
5
|
-
import 'fumadocs-core/source';
|
|
6
|
-
import 'fumadocs-core/mdx-plugins';
|
|
7
|
-
import 'fumadocs-core/toc';
|
|
8
|
-
import 'mdx/types';
|
|
9
|
-
import 'mdast';
|
|
10
|
-
import '@mdx-js/mdx';
|
|
11
|
-
import 'unified';
|
|
12
|
-
import 'zod';
|
|
13
|
-
import 'chokidar';
|
|
14
|
-
import 'vfile';
|
|
15
|
-
|
|
16
|
-
interface ClientLoaderOptions<Frontmatter, Props> {
|
|
17
|
-
/**
|
|
18
|
-
* Loader ID (usually your collection name)
|
|
19
|
-
*
|
|
20
|
-
* The code splitting strategy of frameworks like Tanstack Start may duplicate `createClientLoader()` into different chunks.
|
|
21
|
-
*
|
|
22
|
-
* We use loader ID to share cache between multiple instances of client loader.
|
|
23
|
-
*
|
|
24
|
-
* @defaultValue ''
|
|
25
|
-
*/
|
|
26
|
-
id?: string;
|
|
27
|
-
component: (loaded: CompiledMDXFile<Frontmatter>, props: Props) => ReactNode;
|
|
28
|
-
}
|
|
29
|
-
interface ClientLoader<Frontmatter, Props> {
|
|
30
|
-
preload: (path: string) => Promise<CompiledMDXFile<Frontmatter>>;
|
|
31
|
-
/**
|
|
32
|
-
* Get a component that renders content with `React.lazy`.
|
|
33
|
-
*/
|
|
34
|
-
getComponent: (path: string) => FC<Props>;
|
|
35
|
-
/**
|
|
36
|
-
* Get react nodes that renders content with `React.lazy`.
|
|
37
|
-
*/
|
|
38
|
-
useContent: (path: string, props: Props) => ReactNode;
|
|
39
|
-
}
|
|
40
|
-
type BrowserCreate<Config> = ReturnType<typeof fromConfig<Config>>;
|
|
41
|
-
interface DocCollectionEntry<Frontmatter> {
|
|
42
|
-
raw: Record<string, () => Promise<CompiledMDXFile<Frontmatter>>>;
|
|
43
|
-
createClientLoader: <Props extends object>(options: ClientLoaderOptions<Frontmatter, Props>) => ClientLoader<Frontmatter, Props>;
|
|
44
|
-
}
|
|
45
|
-
declare function fromConfig<Config>(): {
|
|
46
|
-
doc<Name extends keyof Config>(_name: Name, glob: Record<string, () => Promise<unknown>>): Config[Name] extends DocCollection<infer Schema> | DocsCollection<infer Schema> ? DocCollectionEntry<StandardSchemaV1.InferOutput<Schema>> : never;
|
|
47
|
-
};
|
|
48
|
-
declare function createClientLoader<Frontmatter, Props extends object = object>(globEntries: Record<string, () => Promise<CompiledMDXFile<Frontmatter>>>, options: ClientLoaderOptions<Frontmatter, Props>): ClientLoader<Frontmatter, Props>;
|
|
49
|
-
|
|
50
|
-
export { type BrowserCreate, type ClientLoader, type ClientLoaderOptions, type DocCollectionEntry, createClientLoader, fromConfig };
|