fumadocs-mdx 13.0.2 → 13.0.4
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/bin.cjs +381 -279
- package/dist/{build-mdx-D-r3_eQL.d.cts → build-mdx-BjXOmv0b.d.cts} +1 -1
- package/dist/{build-mdx-CCNr86q6.d.ts → build-mdx-CY5UldCO.d.ts} +1 -1
- package/dist/bun/index.cjs +177 -57
- package/dist/bun/index.d.cts +2 -2
- package/dist/bun/index.d.ts +2 -2
- package/dist/bun/index.js +26 -34
- package/dist/chunk-2HXTGJBI.js +101 -0
- package/dist/chunk-4JSFLXXT.js +8 -0
- package/dist/{chunk-JVZFH6ND.js → chunk-QXHN25N3.js} +2 -2
- package/dist/{chunk-EELYB2XC.js → chunk-TZ5EQBFW.js} +9 -103
- package/dist/chunk-VUEZTR2H.js +26 -0
- package/dist/{chunk-XQ5O7IPO.js → chunk-XYGORKQA.js} +5 -3
- package/dist/chunk-YAIPHUCZ.js +56 -0
- package/dist/chunk-ZNVPB2IR.js +170 -0
- package/dist/config/index.d.cts +2 -2
- package/dist/config/index.d.ts +2 -2
- package/dist/{core-B6j6Fxse.d.cts → core-DB7TdlyC.d.cts} +23 -7
- package/dist/{core-B6j6Fxse.d.ts → core-DB7TdlyC.d.ts} +23 -7
- package/dist/index-D7s7kCc2.d.cts +7 -0
- package/dist/index-D7s7kCc2.d.ts +7 -0
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/load-from-file-AVYOFOI7.js +7 -0
- package/dist/next/index.cjs +147 -142
- package/dist/next/index.js +58 -39
- package/dist/node/loader.cjs +242 -128
- package/dist/node/loader.d.cts +2 -2
- package/dist/node/loader.d.ts +2 -2
- package/dist/node/loader.js +29 -16
- package/dist/plugins/json-schema.cjs +22 -70
- package/dist/plugins/json-schema.d.cts +2 -2
- package/dist/plugins/json-schema.d.ts +2 -2
- package/dist/plugins/json-schema.js +19 -14
- package/dist/runtime/next/async.cjs +56 -11
- package/dist/runtime/next/async.d.cts +4 -6
- package/dist/runtime/next/async.d.ts +4 -6
- package/dist/runtime/next/async.js +3 -6
- package/dist/runtime/next/index.d.cts +5 -5
- package/dist/runtime/next/index.d.ts +5 -5
- package/dist/runtime/vite/browser.d.cts +3 -3
- package/dist/runtime/vite/browser.d.ts +3 -3
- package/dist/runtime/vite/server.d.cts +3 -3
- package/dist/runtime/vite/server.d.ts +3 -3
- package/dist/{types-DKGMoay5.d.cts → types-Bnh9n7mj.d.cts} +2 -2
- package/dist/{types-AGzTfBmf.d.ts → types-ey1AZqrg.d.ts} +2 -2
- package/dist/vite/index.cjs +265 -163
- package/dist/vite/index.d.cts +4 -0
- package/dist/vite/index.d.ts +4 -0
- package/dist/vite/index.js +140 -122
- package/dist/webpack/{index.cjs → mdx.cjs} +126 -104
- package/dist/webpack/mdx.d.cts +6 -0
- package/dist/webpack/mdx.d.ts +6 -0
- package/dist/webpack/{index.js → mdx.js} +12 -14
- package/dist/webpack/meta.cjs +528 -0
- package/dist/webpack/meta.d.cts +6 -0
- package/dist/webpack/meta.d.ts +6 -0
- package/dist/webpack/meta.js +42 -0
- package/loader-mdx.cjs +1 -1
- package/loader-meta.cjs +7 -0
- package/package.json +11 -8
- package/dist/chunk-U4MQ44TS.js +0 -53
- package/dist/chunk-XZY2AWJI.js +0 -81
- package/dist/chunk-YVCR6FUH.js +0 -82
- package/dist/load-MNG3CLET.js +0 -7
- package/dist/webpack/index.d.cts +0 -15
- package/dist/webpack/index.d.ts +0 -15
|
@@ -1,67 +1,3 @@
|
|
|
1
|
-
// src/loaders/config/index.ts
|
|
2
|
-
import path from "path";
|
|
3
|
-
import fs from "fs/promises";
|
|
4
|
-
function findConfigFile() {
|
|
5
|
-
return path.resolve("source.config.ts");
|
|
6
|
-
}
|
|
7
|
-
function staticConfig({
|
|
8
|
-
core,
|
|
9
|
-
buildConfig
|
|
10
|
-
}) {
|
|
11
|
-
let cached;
|
|
12
|
-
async function newConfig() {
|
|
13
|
-
const { loadConfig } = await import("./load-MNG3CLET.js");
|
|
14
|
-
await core.init({
|
|
15
|
-
config: loadConfig(
|
|
16
|
-
core._options.configPath,
|
|
17
|
-
core._options.outDir,
|
|
18
|
-
buildConfig
|
|
19
|
-
)
|
|
20
|
-
});
|
|
21
|
-
return core.getConfig();
|
|
22
|
-
}
|
|
23
|
-
return {
|
|
24
|
-
async getConfig() {
|
|
25
|
-
return cached ??= newConfig();
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
function dynamicConfig({
|
|
30
|
-
core,
|
|
31
|
-
buildConfig
|
|
32
|
-
}) {
|
|
33
|
-
let loaded;
|
|
34
|
-
async function getConfigHash() {
|
|
35
|
-
const stats = await fs.stat(core._options.configPath).catch(() => void 0);
|
|
36
|
-
if (stats) {
|
|
37
|
-
return stats.mtime.getTime().toString();
|
|
38
|
-
}
|
|
39
|
-
throw new Error("Cannot find config file");
|
|
40
|
-
}
|
|
41
|
-
async function newConfig() {
|
|
42
|
-
const { loadConfig } = await import("./load-MNG3CLET.js");
|
|
43
|
-
await core.init({
|
|
44
|
-
config: loadConfig(
|
|
45
|
-
core._options.configPath,
|
|
46
|
-
core._options.outDir,
|
|
47
|
-
buildConfig
|
|
48
|
-
)
|
|
49
|
-
});
|
|
50
|
-
return core.getConfig();
|
|
51
|
-
}
|
|
52
|
-
return {
|
|
53
|
-
async getConfig() {
|
|
54
|
-
const hash = await getConfigHash();
|
|
55
|
-
if (loaded && loaded.hash === hash) return loaded.config;
|
|
56
|
-
loaded = {
|
|
57
|
-
hash,
|
|
58
|
-
config: newConfig()
|
|
59
|
-
};
|
|
60
|
-
return loaded.config;
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
|
|
65
1
|
// src/utils/validation.ts
|
|
66
2
|
import picocolors from "picocolors";
|
|
67
3
|
var ValidationError = class extends Error {
|
|
@@ -101,8 +37,11 @@ async function validate(schema, data, context, errorMessage) {
|
|
|
101
37
|
}
|
|
102
38
|
|
|
103
39
|
// src/core.ts
|
|
104
|
-
import
|
|
105
|
-
import
|
|
40
|
+
import path from "path";
|
|
41
|
+
import fs from "fs/promises";
|
|
42
|
+
function findConfigFile() {
|
|
43
|
+
return path.resolve("source.config.ts");
|
|
44
|
+
}
|
|
106
45
|
function createCore(options, defaultPlugins = []) {
|
|
107
46
|
let config;
|
|
108
47
|
let plugins;
|
|
@@ -139,13 +78,6 @@ function createCore(options, defaultPlugins = []) {
|
|
|
139
78
|
getConfig() {
|
|
140
79
|
return config;
|
|
141
80
|
},
|
|
142
|
-
creatConfigLoader() {
|
|
143
|
-
return {
|
|
144
|
-
getConfig() {
|
|
145
|
-
return config;
|
|
146
|
-
}
|
|
147
|
-
};
|
|
148
|
-
},
|
|
149
81
|
async initServer(server) {
|
|
150
82
|
for (const plugin of plugins) {
|
|
151
83
|
await plugin.configureServer?.call(this.getPluginContext(), server);
|
|
@@ -163,9 +95,9 @@ function createCore(options, defaultPlugins = []) {
|
|
|
163
95
|
);
|
|
164
96
|
await Promise.all(
|
|
165
97
|
out.flat().map(async (entry) => {
|
|
166
|
-
const file =
|
|
167
|
-
await
|
|
168
|
-
await
|
|
98
|
+
const file = path.join(options.outDir, entry.path);
|
|
99
|
+
await fs.mkdir(path.dirname(file), { recursive: true });
|
|
100
|
+
await fs.writeFile(file, entry.content);
|
|
169
101
|
})
|
|
170
102
|
);
|
|
171
103
|
console.log(`[MDX] generated files in ${performance.now() - start}ms`);
|
|
@@ -173,35 +105,9 @@ function createCore(options, defaultPlugins = []) {
|
|
|
173
105
|
};
|
|
174
106
|
}
|
|
175
107
|
|
|
176
|
-
// src/utils/git-timestamp.ts
|
|
177
|
-
import path3 from "path";
|
|
178
|
-
import { x } from "tinyexec";
|
|
179
|
-
var cache = /* @__PURE__ */ new Map();
|
|
180
|
-
async function getGitTimestamp(file) {
|
|
181
|
-
const cached = cache.get(file);
|
|
182
|
-
if (cached) return cached;
|
|
183
|
-
try {
|
|
184
|
-
const out = await x(
|
|
185
|
-
"git",
|
|
186
|
-
["log", "-1", '--pretty="%ai"', path3.relative(process.cwd(), file)],
|
|
187
|
-
{
|
|
188
|
-
throwOnError: true
|
|
189
|
-
}
|
|
190
|
-
);
|
|
191
|
-
const time = new Date(out.stdout);
|
|
192
|
-
cache.set(file, time);
|
|
193
|
-
return time;
|
|
194
|
-
} catch {
|
|
195
|
-
return;
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
|
|
199
108
|
export {
|
|
200
|
-
findConfigFile,
|
|
201
|
-
staticConfig,
|
|
202
|
-
dynamicConfig,
|
|
203
109
|
ValidationError,
|
|
204
110
|
validate,
|
|
205
|
-
|
|
111
|
+
findConfigFile,
|
|
206
112
|
createCore
|
|
207
113
|
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// src/utils/git-timestamp.ts
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { x } from "tinyexec";
|
|
4
|
+
var cache = /* @__PURE__ */ new Map();
|
|
5
|
+
async function getGitTimestamp(file) {
|
|
6
|
+
const cached = cache.get(file);
|
|
7
|
+
if (cached) return cached;
|
|
8
|
+
try {
|
|
9
|
+
const out = await x(
|
|
10
|
+
"git",
|
|
11
|
+
["log", "-1", '--pretty="%ai"', path.relative(process.cwd(), file)],
|
|
12
|
+
{
|
|
13
|
+
throwOnError: true
|
|
14
|
+
}
|
|
15
|
+
);
|
|
16
|
+
const time = new Date(out.stdout);
|
|
17
|
+
cache.set(file, time);
|
|
18
|
+
return time;
|
|
19
|
+
} catch {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export {
|
|
25
|
+
getGitTimestamp
|
|
26
|
+
};
|
|
@@ -2,9 +2,11 @@ import {
|
|
|
2
2
|
buildMDX
|
|
3
3
|
} from "./chunk-3J3WL7WN.js";
|
|
4
4
|
import {
|
|
5
|
-
getGitTimestamp
|
|
5
|
+
getGitTimestamp
|
|
6
|
+
} from "./chunk-VUEZTR2H.js";
|
|
7
|
+
import {
|
|
6
8
|
validate
|
|
7
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-TZ5EQBFW.js";
|
|
8
10
|
import {
|
|
9
11
|
fumaMatter
|
|
10
12
|
} from "./chunk-VWJKRQZR.js";
|
|
@@ -51,7 +53,7 @@ function createMdxLoader(configLoader) {
|
|
|
51
53
|
);
|
|
52
54
|
};
|
|
53
55
|
}
|
|
54
|
-
const collection = parsed.collection ? config.
|
|
56
|
+
const collection = parsed.collection ? config.getCollection(parsed.collection) : void 0;
|
|
55
57
|
let docCollection;
|
|
56
58
|
switch (collection?.type) {
|
|
57
59
|
case "doc":
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import {
|
|
2
|
+
validate
|
|
3
|
+
} from "./chunk-TZ5EQBFW.js";
|
|
4
|
+
|
|
5
|
+
// src/loaders/meta.ts
|
|
6
|
+
import { dump, load } from "js-yaml";
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
var querySchema = z.object({
|
|
9
|
+
collection: z.string().optional()
|
|
10
|
+
}).loose();
|
|
11
|
+
function createMetaLoader(configLoader, resolve = {}) {
|
|
12
|
+
const { json: resolveJson = "js", yaml: resolveYaml = "js" } = resolve;
|
|
13
|
+
return async ({ filePath, query, source }) => {
|
|
14
|
+
const isJson = filePath.endsWith(".json");
|
|
15
|
+
const parsed = querySchema.parse(query);
|
|
16
|
+
const collection = parsed.collection ? (await configLoader.getConfig()).getCollection(parsed.collection) : void 0;
|
|
17
|
+
if (!collection) return null;
|
|
18
|
+
let data;
|
|
19
|
+
try {
|
|
20
|
+
data = isJson ? JSON.parse(source) : load(source);
|
|
21
|
+
} catch (e) {
|
|
22
|
+
throw new Error(`invalid data in ${filePath}`, { cause: e });
|
|
23
|
+
}
|
|
24
|
+
let schema;
|
|
25
|
+
switch (collection?.type) {
|
|
26
|
+
case "meta":
|
|
27
|
+
schema = collection.schema;
|
|
28
|
+
break;
|
|
29
|
+
case "docs":
|
|
30
|
+
schema = collection.meta.schema;
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
if (schema) {
|
|
34
|
+
data = await validate(
|
|
35
|
+
schema,
|
|
36
|
+
data,
|
|
37
|
+
{ path: filePath, source },
|
|
38
|
+
`invalid data in ${filePath}`
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
let code;
|
|
42
|
+
if (isJson) {
|
|
43
|
+
code = resolveJson === "json" ? JSON.stringify(data) : `export default ${JSON.stringify(data)}`;
|
|
44
|
+
} else {
|
|
45
|
+
code = resolveYaml === "yaml" ? dump(data) : `export default ${JSON.stringify(data)}`;
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
code,
|
|
49
|
+
map: null
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export {
|
|
55
|
+
createMetaLoader
|
|
56
|
+
};
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ValidationError
|
|
3
|
+
} from "./chunk-TZ5EQBFW.js";
|
|
4
|
+
|
|
5
|
+
// src/loaders/adapter.ts
|
|
6
|
+
import { fileURLToPath } from "url";
|
|
7
|
+
import fs from "fs/promises";
|
|
8
|
+
import { parse } from "querystring";
|
|
9
|
+
import path from "path";
|
|
10
|
+
function toNode(loader, test) {
|
|
11
|
+
return async (url, _context, nextLoad) => {
|
|
12
|
+
if (url.startsWith("file:///") && test.test(url)) {
|
|
13
|
+
const parsedUrl = new URL(url);
|
|
14
|
+
const filePath = fileURLToPath(parsedUrl);
|
|
15
|
+
const source = (await fs.readFile(filePath)).toString();
|
|
16
|
+
const result = await loader({
|
|
17
|
+
filePath,
|
|
18
|
+
query: Object.fromEntries(parsedUrl.searchParams.entries()),
|
|
19
|
+
source,
|
|
20
|
+
development: false,
|
|
21
|
+
compiler: {
|
|
22
|
+
addDependency() {
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
if (result) {
|
|
27
|
+
return {
|
|
28
|
+
source: result.code,
|
|
29
|
+
format: "module",
|
|
30
|
+
shortCircuit: true
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return nextLoad(url);
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function toVite(loader) {
|
|
38
|
+
return async function(file, query, value) {
|
|
39
|
+
const result = await loader({
|
|
40
|
+
filePath: file,
|
|
41
|
+
query: parse(query),
|
|
42
|
+
source: value,
|
|
43
|
+
development: this.environment.mode === "dev",
|
|
44
|
+
compiler: {
|
|
45
|
+
addDependency: (file2) => {
|
|
46
|
+
this.addWatchFile(file2);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
if (result === null) return null;
|
|
51
|
+
return {
|
|
52
|
+
code: result.code,
|
|
53
|
+
map: result.map
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
function toWebpack(loader) {
|
|
58
|
+
return async function(source, callback) {
|
|
59
|
+
try {
|
|
60
|
+
const result = await loader({
|
|
61
|
+
filePath: this.resourcePath,
|
|
62
|
+
query: parse(this.resourceQuery.slice(1)),
|
|
63
|
+
source,
|
|
64
|
+
development: this.mode === "development",
|
|
65
|
+
compiler: this
|
|
66
|
+
});
|
|
67
|
+
if (result === null) {
|
|
68
|
+
callback(void 0, source);
|
|
69
|
+
} else {
|
|
70
|
+
callback(void 0, result.code, result.map);
|
|
71
|
+
}
|
|
72
|
+
} catch (error) {
|
|
73
|
+
if (error instanceof ValidationError) {
|
|
74
|
+
return callback(new Error(error.toStringFormatted()));
|
|
75
|
+
}
|
|
76
|
+
if (!(error instanceof Error)) throw error;
|
|
77
|
+
const fpath = path.relative(this.context, this.resourcePath);
|
|
78
|
+
error.message = `${fpath}:${error.name}: ${error.message}`;
|
|
79
|
+
callback(error);
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
function toBun(loader, test) {
|
|
84
|
+
return (build) => {
|
|
85
|
+
const queryData = /* @__PURE__ */ new Map();
|
|
86
|
+
build.onResolve({ filter: test }, (args) => {
|
|
87
|
+
const [filePath, query = ""] = args.path.split("?", 2);
|
|
88
|
+
queryData.set(filePath, parse(query));
|
|
89
|
+
return null;
|
|
90
|
+
});
|
|
91
|
+
build.onLoad({ filter: test }, async (args) => {
|
|
92
|
+
const content = await Bun.file(args.path).text();
|
|
93
|
+
const result = await loader({
|
|
94
|
+
source: content,
|
|
95
|
+
query: queryData.get(args.path) ?? {},
|
|
96
|
+
filePath: args.path,
|
|
97
|
+
development: false,
|
|
98
|
+
compiler: {
|
|
99
|
+
addDependency() {
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
if (result === null) {
|
|
104
|
+
return {
|
|
105
|
+
contents: content,
|
|
106
|
+
loader: args.loader
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
return {
|
|
110
|
+
contents: result.code,
|
|
111
|
+
loader: "js"
|
|
112
|
+
};
|
|
113
|
+
});
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// src/loaders/config.ts
|
|
118
|
+
import fs2 from "fs/promises";
|
|
119
|
+
function createStandaloneConfigLoader({
|
|
120
|
+
core,
|
|
121
|
+
buildConfig,
|
|
122
|
+
mode
|
|
123
|
+
}) {
|
|
124
|
+
let loaded;
|
|
125
|
+
async function getConfigHash() {
|
|
126
|
+
if (mode === "production") return "static";
|
|
127
|
+
const stats = await fs2.stat(core._options.configPath).catch(() => {
|
|
128
|
+
throw new Error("Cannot find config file");
|
|
129
|
+
});
|
|
130
|
+
return stats.mtime.getTime().toString();
|
|
131
|
+
}
|
|
132
|
+
async function newConfig() {
|
|
133
|
+
const { loadConfig } = await import("./load-from-file-AVYOFOI7.js");
|
|
134
|
+
await core.init({
|
|
135
|
+
config: loadConfig(
|
|
136
|
+
core._options.configPath,
|
|
137
|
+
core._options.outDir,
|
|
138
|
+
buildConfig
|
|
139
|
+
)
|
|
140
|
+
});
|
|
141
|
+
return core.getConfig();
|
|
142
|
+
}
|
|
143
|
+
return {
|
|
144
|
+
async getConfig() {
|
|
145
|
+
const hash = await getConfigHash();
|
|
146
|
+
if (loaded && loaded.hash === hash) return loaded.config;
|
|
147
|
+
loaded = {
|
|
148
|
+
hash,
|
|
149
|
+
config: newConfig()
|
|
150
|
+
};
|
|
151
|
+
return loaded.config;
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
function createIntegratedConfigLoader(core) {
|
|
156
|
+
return {
|
|
157
|
+
getConfig() {
|
|
158
|
+
return core.getConfig();
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export {
|
|
164
|
+
toNode,
|
|
165
|
+
toVite,
|
|
166
|
+
toWebpack,
|
|
167
|
+
toBun,
|
|
168
|
+
createStandaloneConfigLoader,
|
|
169
|
+
createIntegratedConfigLoader
|
|
170
|
+
};
|
package/dist/config/index.d.cts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { A as AnyCollection, B as BaseCollection, a as CollectionSchema, D as DefaultMDXOptions, b as DocCollection, c as DocsCollection, G as GlobalConfig, M as MetaCollection, P as PostprocessOptions, d as defineCollections, f as defineConfig, e as defineDocs, h as frontmatterSchema, g as getDefaultMDXOptions, m as metaSchema } from '../core-
|
|
1
|
+
export { A as AnyCollection, B as BaseCollection, a as CollectionSchema, D as DefaultMDXOptions, b as DocCollection, c as DocsCollection, G as GlobalConfig, M as MetaCollection, P as PostprocessOptions, d as defineCollections, f as defineConfig, e as defineDocs, h as frontmatterSchema, g as getDefaultMDXOptions, m as metaSchema } from '../core-DB7TdlyC.cjs';
|
|
2
2
|
import { Processor, Transformer } from 'unified';
|
|
3
3
|
import { Root } from 'mdast';
|
|
4
|
+
import '@mdx-js/mdx';
|
|
4
5
|
import '@standard-schema/spec';
|
|
5
6
|
import 'fumadocs-core/mdx-plugins';
|
|
6
|
-
import '@mdx-js/mdx';
|
|
7
7
|
import 'zod';
|
|
8
8
|
import 'chokidar';
|
|
9
9
|
|
package/dist/config/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { A as AnyCollection, B as BaseCollection, a as CollectionSchema, D as DefaultMDXOptions, b as DocCollection, c as DocsCollection, G as GlobalConfig, M as MetaCollection, P as PostprocessOptions, d as defineCollections, f as defineConfig, e as defineDocs, h as frontmatterSchema, g as getDefaultMDXOptions, m as metaSchema } from '../core-
|
|
1
|
+
export { A as AnyCollection, B as BaseCollection, a as CollectionSchema, D as DefaultMDXOptions, b as DocCollection, c as DocsCollection, G as GlobalConfig, M as MetaCollection, P as PostprocessOptions, d as defineCollections, f as defineConfig, e as defineDocs, h as frontmatterSchema, g as getDefaultMDXOptions, m as metaSchema } from '../core-DB7TdlyC.js';
|
|
2
2
|
import { Processor, Transformer } from 'unified';
|
|
3
3
|
import { Root } from 'mdast';
|
|
4
|
+
import '@mdx-js/mdx';
|
|
4
5
|
import '@standard-schema/spec';
|
|
5
6
|
import 'fumadocs-core/mdx-plugins';
|
|
6
|
-
import '@mdx-js/mdx';
|
|
7
7
|
import 'zod';
|
|
8
8
|
import 'chokidar';
|
|
9
9
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { ProcessorOptions } from '@mdx-js/mdx';
|
|
1
2
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
2
3
|
import * as plugins from 'fumadocs-core/mdx-plugins';
|
|
3
|
-
import { ProcessorOptions } from '@mdx-js/mdx';
|
|
4
4
|
import { Pluggable } from 'unified';
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
import { FSWatcher } from 'chokidar';
|
|
@@ -112,9 +112,12 @@ type GlobalConfigMDXOptions = ({
|
|
|
112
112
|
preset: 'minimal';
|
|
113
113
|
} & ProcessorOptions);
|
|
114
114
|
interface GlobalConfig {
|
|
115
|
+
collections?: Record<string, AnyCollection>;
|
|
115
116
|
plugins?: PluginOption[];
|
|
116
117
|
/**
|
|
117
118
|
* Configure global MDX options
|
|
119
|
+
*
|
|
120
|
+
* @remarks `GlobalConfigMDXOptions`
|
|
118
121
|
*/
|
|
119
122
|
mdxOptions?: GlobalConfigMDXOptions | (() => Promise<GlobalConfigMDXOptions>);
|
|
120
123
|
/**
|
|
@@ -143,14 +146,27 @@ declare function defineDocs<DocSchema extends StandardSchemaV1 = typeof frontmat
|
|
|
143
146
|
}): DocsCollection<DocSchema, MetaSchema, Async>;
|
|
144
147
|
declare function defineConfig(config?: GlobalConfig): GlobalConfig;
|
|
145
148
|
|
|
146
|
-
interface ConfigLoader {
|
|
147
|
-
getConfig: () => LoadedConfig | Promise<LoadedConfig>;
|
|
148
|
-
}
|
|
149
149
|
interface LoadedConfig {
|
|
150
|
-
|
|
150
|
+
collectionList: CollectionItem[];
|
|
151
|
+
getCollection(name: string): CollectionItem | undefined;
|
|
151
152
|
global: GlobalConfig;
|
|
152
153
|
getDefaultMDXOptions(mode?: 'default' | 'remote'): Promise<ProcessorOptions>;
|
|
153
154
|
}
|
|
155
|
+
type CollectionItem = MetaCollectionItem | DocCollectionItem | DocsCollectionItem;
|
|
156
|
+
type PrimitiveCollectionItem<T extends DocCollection | MetaCollection> = Omit<T, 'files'> & {
|
|
157
|
+
name: string;
|
|
158
|
+
hasFile: (filePath: string) => boolean;
|
|
159
|
+
isFileSupported: (filePath: string) => boolean;
|
|
160
|
+
patterns: string[];
|
|
161
|
+
};
|
|
162
|
+
type MetaCollectionItem = PrimitiveCollectionItem<MetaCollection>;
|
|
163
|
+
type DocCollectionItem = PrimitiveCollectionItem<DocCollection>;
|
|
164
|
+
interface DocsCollectionItem extends DocsCollection {
|
|
165
|
+
name: string;
|
|
166
|
+
meta: MetaCollectionItem;
|
|
167
|
+
docs: DocCollectionItem;
|
|
168
|
+
}
|
|
169
|
+
declare function buildConfig(config: Record<string, unknown>): LoadedConfig;
|
|
154
170
|
|
|
155
171
|
type Awaitable<T> = T | Promise<T>;
|
|
156
172
|
interface EmitEntry {
|
|
@@ -198,6 +214,7 @@ interface EmitOptions {
|
|
|
198
214
|
*/
|
|
199
215
|
filterPlugin?: (plugin: Plugin) => boolean;
|
|
200
216
|
}
|
|
217
|
+
declare function findConfigFile(): string;
|
|
201
218
|
declare function createCore(options: CoreOptions, defaultPlugins?: PluginOption[]): {
|
|
202
219
|
_options: CoreOptions;
|
|
203
220
|
getPluginContext(): PluginContext;
|
|
@@ -209,10 +226,9 @@ declare function createCore(options: CoreOptions, defaultPlugins?: PluginOption[
|
|
|
209
226
|
config: Awaitable<LoadedConfig>;
|
|
210
227
|
}): Promise</*elided*/ any>;
|
|
211
228
|
getConfig(): LoadedConfig;
|
|
212
|
-
creatConfigLoader(): ConfigLoader;
|
|
213
229
|
initServer(server: ServerContext): Promise<void>;
|
|
214
230
|
emitAndWrite({ filterPlugin, }?: EmitOptions): Promise<void>;
|
|
215
231
|
};
|
|
216
232
|
type Core = ReturnType<typeof createCore>;
|
|
217
233
|
|
|
218
|
-
export { type AnyCollection as A, type BaseCollection as B, type CoreOptions as C, type DefaultMDXOptions as D, type ExtractedReference as E, type GlobalConfig as G, type LoadedConfig as L, type MetaCollection as M, type PostprocessOptions as P, type ServerContext as S, type CollectionSchema as a, type DocCollection as b, type DocsCollection as c, defineCollections as d, defineDocs as e, defineConfig as f, getDefaultMDXOptions as g, frontmatterSchema as h, type Plugin as i,
|
|
234
|
+
export { type AnyCollection as A, type BaseCollection as B, type CoreOptions as C, type DefaultMDXOptions as D, type ExtractedReference as E, type GlobalConfig as G, type LoadedConfig as L, type MetaCollection as M, type PostprocessOptions as P, type ServerContext as S, type CollectionSchema as a, type DocCollection as b, type DocsCollection as c, defineCollections as d, defineDocs as e, defineConfig as f, getDefaultMDXOptions as g, frontmatterSchema as h, type Plugin as i, buildConfig as j, type EmitEntry as k, type PluginContext as l, metaSchema as m, type PluginOption as n, type EmitOptions as o, findConfigFile as p, createCore as q, type Core as r };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { ProcessorOptions } from '@mdx-js/mdx';
|
|
1
2
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
2
3
|
import * as plugins from 'fumadocs-core/mdx-plugins';
|
|
3
|
-
import { ProcessorOptions } from '@mdx-js/mdx';
|
|
4
4
|
import { Pluggable } from 'unified';
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
import { FSWatcher } from 'chokidar';
|
|
@@ -112,9 +112,12 @@ type GlobalConfigMDXOptions = ({
|
|
|
112
112
|
preset: 'minimal';
|
|
113
113
|
} & ProcessorOptions);
|
|
114
114
|
interface GlobalConfig {
|
|
115
|
+
collections?: Record<string, AnyCollection>;
|
|
115
116
|
plugins?: PluginOption[];
|
|
116
117
|
/**
|
|
117
118
|
* Configure global MDX options
|
|
119
|
+
*
|
|
120
|
+
* @remarks `GlobalConfigMDXOptions`
|
|
118
121
|
*/
|
|
119
122
|
mdxOptions?: GlobalConfigMDXOptions | (() => Promise<GlobalConfigMDXOptions>);
|
|
120
123
|
/**
|
|
@@ -143,14 +146,27 @@ declare function defineDocs<DocSchema extends StandardSchemaV1 = typeof frontmat
|
|
|
143
146
|
}): DocsCollection<DocSchema, MetaSchema, Async>;
|
|
144
147
|
declare function defineConfig(config?: GlobalConfig): GlobalConfig;
|
|
145
148
|
|
|
146
|
-
interface ConfigLoader {
|
|
147
|
-
getConfig: () => LoadedConfig | Promise<LoadedConfig>;
|
|
148
|
-
}
|
|
149
149
|
interface LoadedConfig {
|
|
150
|
-
|
|
150
|
+
collectionList: CollectionItem[];
|
|
151
|
+
getCollection(name: string): CollectionItem | undefined;
|
|
151
152
|
global: GlobalConfig;
|
|
152
153
|
getDefaultMDXOptions(mode?: 'default' | 'remote'): Promise<ProcessorOptions>;
|
|
153
154
|
}
|
|
155
|
+
type CollectionItem = MetaCollectionItem | DocCollectionItem | DocsCollectionItem;
|
|
156
|
+
type PrimitiveCollectionItem<T extends DocCollection | MetaCollection> = Omit<T, 'files'> & {
|
|
157
|
+
name: string;
|
|
158
|
+
hasFile: (filePath: string) => boolean;
|
|
159
|
+
isFileSupported: (filePath: string) => boolean;
|
|
160
|
+
patterns: string[];
|
|
161
|
+
};
|
|
162
|
+
type MetaCollectionItem = PrimitiveCollectionItem<MetaCollection>;
|
|
163
|
+
type DocCollectionItem = PrimitiveCollectionItem<DocCollection>;
|
|
164
|
+
interface DocsCollectionItem extends DocsCollection {
|
|
165
|
+
name: string;
|
|
166
|
+
meta: MetaCollectionItem;
|
|
167
|
+
docs: DocCollectionItem;
|
|
168
|
+
}
|
|
169
|
+
declare function buildConfig(config: Record<string, unknown>): LoadedConfig;
|
|
154
170
|
|
|
155
171
|
type Awaitable<T> = T | Promise<T>;
|
|
156
172
|
interface EmitEntry {
|
|
@@ -198,6 +214,7 @@ interface EmitOptions {
|
|
|
198
214
|
*/
|
|
199
215
|
filterPlugin?: (plugin: Plugin) => boolean;
|
|
200
216
|
}
|
|
217
|
+
declare function findConfigFile(): string;
|
|
201
218
|
declare function createCore(options: CoreOptions, defaultPlugins?: PluginOption[]): {
|
|
202
219
|
_options: CoreOptions;
|
|
203
220
|
getPluginContext(): PluginContext;
|
|
@@ -209,10 +226,9 @@ declare function createCore(options: CoreOptions, defaultPlugins?: PluginOption[
|
|
|
209
226
|
config: Awaitable<LoadedConfig>;
|
|
210
227
|
}): Promise</*elided*/ any>;
|
|
211
228
|
getConfig(): LoadedConfig;
|
|
212
|
-
creatConfigLoader(): ConfigLoader;
|
|
213
229
|
initServer(server: ServerContext): Promise<void>;
|
|
214
230
|
emitAndWrite({ filterPlugin, }?: EmitOptions): Promise<void>;
|
|
215
231
|
};
|
|
216
232
|
type Core = ReturnType<typeof createCore>;
|
|
217
233
|
|
|
218
|
-
export { type AnyCollection as A, type BaseCollection as B, type CoreOptions as C, type DefaultMDXOptions as D, type ExtractedReference as E, type GlobalConfig as G, type LoadedConfig as L, type MetaCollection as M, type PostprocessOptions as P, type ServerContext as S, type CollectionSchema as a, type DocCollection as b, type DocsCollection as c, defineCollections as d, defineDocs as e, defineConfig as f, getDefaultMDXOptions as g, frontmatterSchema as h, type Plugin as i,
|
|
234
|
+
export { type AnyCollection as A, type BaseCollection as B, type CoreOptions as C, type DefaultMDXOptions as D, type ExtractedReference as E, type GlobalConfig as G, type LoadedConfig as L, type MetaCollection as M, type PostprocessOptions as P, type ServerContext as S, type CollectionSchema as a, type DocCollection as b, type DocsCollection as c, defineCollections as d, defineDocs as e, defineConfig as f, getDefaultMDXOptions as g, frontmatterSchema as h, type Plugin as i, buildConfig as j, type EmitEntry as k, type PluginContext as l, metaSchema as m, type PluginOption as n, type EmitOptions as o, findConfigFile as p, createCore as q, type Core as r };
|
package/dist/index.d.cts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { StructuredData } from 'fumadocs-core/mdx-plugins';
|
|
2
2
|
import { TOCItemType } from 'fumadocs-core/toc';
|
|
3
3
|
import { MDXContent } from 'mdx/types';
|
|
4
|
-
import { E as ExtractedReference } from './core-
|
|
5
|
-
export {
|
|
4
|
+
import { E as ExtractedReference } from './core-DB7TdlyC.cjs';
|
|
5
|
+
export { r as Core, C as CoreOptions, k as EmitEntry, o as EmitOptions, i as Plugin, l as PluginContext, n as PluginOption, S as ServerContext, q as createCore, p as findConfigFile } from './core-DB7TdlyC.cjs';
|
|
6
6
|
import { Root } from 'mdast';
|
|
7
|
-
import { C as CompiledMDXProperties } from './build-mdx-
|
|
8
|
-
import '@standard-schema/spec';
|
|
7
|
+
import { C as CompiledMDXProperties } from './build-mdx-BjXOmv0b.cjs';
|
|
9
8
|
import '@mdx-js/mdx';
|
|
9
|
+
import '@standard-schema/spec';
|
|
10
10
|
import 'unified';
|
|
11
11
|
import 'zod';
|
|
12
12
|
import 'chokidar';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { StructuredData } from 'fumadocs-core/mdx-plugins';
|
|
2
2
|
import { TOCItemType } from 'fumadocs-core/toc';
|
|
3
3
|
import { MDXContent } from 'mdx/types';
|
|
4
|
-
import { E as ExtractedReference } from './core-
|
|
5
|
-
export {
|
|
4
|
+
import { E as ExtractedReference } from './core-DB7TdlyC.js';
|
|
5
|
+
export { r as Core, C as CoreOptions, k as EmitEntry, o as EmitOptions, i as Plugin, l as PluginContext, n as PluginOption, S as ServerContext, q as createCore, p as findConfigFile } from './core-DB7TdlyC.js';
|
|
6
6
|
import { Root } from 'mdast';
|
|
7
|
-
import { C as CompiledMDXProperties } from './build-mdx-
|
|
8
|
-
import '@standard-schema/spec';
|
|
7
|
+
import { C as CompiledMDXProperties } from './build-mdx-CY5UldCO.js';
|
|
9
8
|
import '@mdx-js/mdx';
|
|
9
|
+
import '@standard-schema/spec';
|
|
10
10
|
import 'unified';
|
|
11
11
|
import 'zod';
|
|
12
12
|
import 'chokidar';
|