fumadocs-mdx 13.0.3 → 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 +352 -272
- package/dist/{build-mdx-TtQzmq6W.d.cts → build-mdx-BjXOmv0b.d.cts} +1 -1
- package/dist/{build-mdx--WI4tf2-.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-DhfmVKRA.d.cts → core-DB7TdlyC.d.cts} +21 -7
- package/dist/{core-DhfmVKRA.d.ts → core-DB7TdlyC.d.ts} +21 -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 +145 -139
- package/dist/next/index.js +56 -36
- 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-zrV4v6mp.d.cts → types-Bnh9n7mj.d.cts} +2 -2
- package/dist/{types-CMva20Zp.d.ts → types-ey1AZqrg.d.ts} +2 -2
- package/dist/vite/index.cjs +238 -159
- package/dist/vite/index.js +113 -118
- 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 +6 -3
- 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
package/dist/chunk-XZY2AWJI.js
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
// src/utils/collections.ts
|
|
2
|
-
import picomatch from "picomatch";
|
|
3
|
-
import { glob } from "tinyglobby";
|
|
4
|
-
import path from "path";
|
|
5
|
-
var SupportedFormats = {
|
|
6
|
-
doc: ["mdx", "md"],
|
|
7
|
-
meta: ["json", "yaml"]
|
|
8
|
-
};
|
|
9
|
-
function getGlobPatterns(collection) {
|
|
10
|
-
if (collection.files) return collection.files;
|
|
11
|
-
return [`**/*.{${SupportedFormats[collection.type].join(",")}}`];
|
|
12
|
-
}
|
|
13
|
-
function isFileSupported(filePath, collection) {
|
|
14
|
-
return SupportedFormats[collection.type].some(
|
|
15
|
-
(format) => filePath.endsWith(`.${format}`)
|
|
16
|
-
);
|
|
17
|
-
}
|
|
18
|
-
function createCollectionMatcher(core) {
|
|
19
|
-
const CacheKey = "collection-matcher";
|
|
20
|
-
return {
|
|
21
|
-
scan(config) {
|
|
22
|
-
const scanned = [];
|
|
23
|
-
function scan(name, collection) {
|
|
24
|
-
const patterns = getGlobPatterns(collection);
|
|
25
|
-
for (const dir of Array.isArray(collection.dir) ? collection.dir : [collection.dir]) {
|
|
26
|
-
scanned.push({
|
|
27
|
-
name,
|
|
28
|
-
collection,
|
|
29
|
-
matcher: picomatch(patterns, {
|
|
30
|
-
cwd: dir
|
|
31
|
-
})
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
for (const [name, collection] of config.collections) {
|
|
36
|
-
if (collection.type === "docs") {
|
|
37
|
-
scan(name, collection.meta);
|
|
38
|
-
scan(name, collection.docs);
|
|
39
|
-
} else {
|
|
40
|
-
scan(name, collection);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
return scanned;
|
|
44
|
-
},
|
|
45
|
-
getFileCollection(file) {
|
|
46
|
-
const scanned = core.cache.get(CacheKey) ?? this.scan(core.getConfig());
|
|
47
|
-
core.cache.set(CacheKey, scanned);
|
|
48
|
-
for (const item of scanned) {
|
|
49
|
-
if (isFileSupported(file, item.collection) && item.matcher(file))
|
|
50
|
-
return { name: item.name, collection: item.collection };
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
async function getCollectionFiles(collection) {
|
|
56
|
-
const files = /* @__PURE__ */ new Map();
|
|
57
|
-
const dirs = Array.isArray(collection.dir) ? collection.dir : [collection.dir];
|
|
58
|
-
const patterns = getGlobPatterns(collection);
|
|
59
|
-
await Promise.all(
|
|
60
|
-
dirs.map(async (dir) => {
|
|
61
|
-
const result = await glob(patterns, {
|
|
62
|
-
cwd: path.resolve(dir)
|
|
63
|
-
});
|
|
64
|
-
for (const item of result) {
|
|
65
|
-
if (!isFileSupported(item, collection)) continue;
|
|
66
|
-
const fullPath = path.join(dir, item);
|
|
67
|
-
files.set(fullPath, {
|
|
68
|
-
path: item,
|
|
69
|
-
fullPath
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
})
|
|
73
|
-
);
|
|
74
|
-
return Array.from(files.values());
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
export {
|
|
78
|
-
getGlobPatterns,
|
|
79
|
-
createCollectionMatcher,
|
|
80
|
-
getCollectionFiles
|
|
81
|
-
};
|
package/dist/chunk-YVCR6FUH.js
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ValidationError
|
|
3
|
-
} from "./chunk-EELYB2XC.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, filterByPath) {
|
|
11
|
-
return async (url, _context, nextLoad) => {
|
|
12
|
-
if (!url.startsWith("file:///")) return nextLoad(url);
|
|
13
|
-
const parsedUrl = new URL(url);
|
|
14
|
-
const filePath = fileURLToPath(parsedUrl);
|
|
15
|
-
if (filterByPath(filePath)) {
|
|
16
|
-
const source = (await fs.readFile(filePath)).toString();
|
|
17
|
-
const result = await loader({
|
|
18
|
-
filePath,
|
|
19
|
-
query: Object.fromEntries(parsedUrl.searchParams.entries()),
|
|
20
|
-
source,
|
|
21
|
-
development: false,
|
|
22
|
-
compiler: {
|
|
23
|
-
addDependency() {
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
return {
|
|
28
|
-
source: result.code,
|
|
29
|
-
format: "module",
|
|
30
|
-
shortCircuit: true
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
return nextLoad(url);
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
function toVite(loader) {
|
|
37
|
-
return async function(file, query, value) {
|
|
38
|
-
const result = await loader({
|
|
39
|
-
filePath: file,
|
|
40
|
-
query: parse(query),
|
|
41
|
-
source: value,
|
|
42
|
-
development: this.environment.mode === "dev",
|
|
43
|
-
compiler: {
|
|
44
|
-
addDependency: (file2) => {
|
|
45
|
-
this.addWatchFile(file2);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
return {
|
|
50
|
-
code: result.code,
|
|
51
|
-
map: result.map
|
|
52
|
-
};
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
function toWebpack(loader) {
|
|
56
|
-
return async function(source, callback) {
|
|
57
|
-
try {
|
|
58
|
-
const result = await loader({
|
|
59
|
-
filePath: this.resourcePath,
|
|
60
|
-
query: parse(this.resourceQuery.slice(1)),
|
|
61
|
-
source,
|
|
62
|
-
development: this.mode === "development",
|
|
63
|
-
compiler: this
|
|
64
|
-
});
|
|
65
|
-
callback(void 0, result.code, result.map);
|
|
66
|
-
} catch (error) {
|
|
67
|
-
if (error instanceof ValidationError) {
|
|
68
|
-
return callback(new Error(error.toStringFormatted()));
|
|
69
|
-
}
|
|
70
|
-
if (!(error instanceof Error)) throw error;
|
|
71
|
-
const fpath = path.relative(this.context, this.resourcePath);
|
|
72
|
-
error.message = `${fpath}:${error.name}: ${error.message}`;
|
|
73
|
-
callback(error);
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export {
|
|
79
|
-
toNode,
|
|
80
|
-
toVite,
|
|
81
|
-
toWebpack
|
|
82
|
-
};
|
package/dist/load-MNG3CLET.js
DELETED
package/dist/webpack/index.d.cts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { LoaderContext } from 'webpack';
|
|
2
|
-
|
|
3
|
-
interface Options {
|
|
4
|
-
configPath: string;
|
|
5
|
-
outDir: string;
|
|
6
|
-
isDev: boolean;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Load MDX/markdown files
|
|
10
|
-
*
|
|
11
|
-
* it supports frontmatter by parsing and injecting the data in `vfile.data.frontmatter`
|
|
12
|
-
*/
|
|
13
|
-
declare function loader(this: LoaderContext<Options>, source: string, callback: LoaderContext<Options>['callback']): Promise<void>;
|
|
14
|
-
|
|
15
|
-
export { type Options, loader as default };
|
package/dist/webpack/index.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { LoaderContext } from 'webpack';
|
|
2
|
-
|
|
3
|
-
interface Options {
|
|
4
|
-
configPath: string;
|
|
5
|
-
outDir: string;
|
|
6
|
-
isDev: boolean;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Load MDX/markdown files
|
|
10
|
-
*
|
|
11
|
-
* it supports frontmatter by parsing and injecting the data in `vfile.data.frontmatter`
|
|
12
|
-
*/
|
|
13
|
-
declare function loader(this: LoaderContext<Options>, source: string, callback: LoaderContext<Options>['callback']): Promise<void>;
|
|
14
|
-
|
|
15
|
-
export { type Options, loader as default };
|