fumadocs-mdx 11.8.2 → 11.9.0
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/{chunk-BWRDVK5L.js → chunk-766EAFX6.js} +1 -1
- package/dist/chunk-COQ4VMK2.js +158 -0
- package/dist/loader-mdx.cjs +1 -1
- package/dist/loader-mdx.js +1 -1
- package/dist/next/index.cjs +128 -15
- package/dist/next/index.js +29 -13
- package/dist/runtime/vite.cjs +47 -33
- package/dist/runtime/vite.d.cts +16 -11
- package/dist/runtime/vite.d.ts +16 -11
- package/dist/runtime/vite.js +37 -33
- package/dist/vite/index.cjs +112 -84
- package/dist/vite/index.js +27 -92
- package/package.json +10 -10
- package/dist/chunk-6Y5JDZHD.js +0 -65
package/dist/chunk-6Y5JDZHD.js
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
// src/utils/import-formatter.ts
|
|
2
|
-
import path from "path";
|
|
3
|
-
function getImportCode(info) {
|
|
4
|
-
const specifier = JSON.stringify(info.specifier);
|
|
5
|
-
if (info.type === "default") return `import ${info.name} from ${specifier}`;
|
|
6
|
-
if (info.type === "namespace")
|
|
7
|
-
return `import * as ${info.name} from ${specifier}`;
|
|
8
|
-
if (info.type === "named") {
|
|
9
|
-
const names = info.names.map(
|
|
10
|
-
(name) => Array.isArray(name) ? `${name[0]} as ${name[1]}` : name
|
|
11
|
-
);
|
|
12
|
-
return `import { ${names.join(", ")} } from ${specifier}`;
|
|
13
|
-
}
|
|
14
|
-
return `import ${specifier}`;
|
|
15
|
-
}
|
|
16
|
-
function toImportPath(file, config) {
|
|
17
|
-
const ext = path.extname(file);
|
|
18
|
-
let filename;
|
|
19
|
-
if (ext === ".ts" && config.jsExtension) {
|
|
20
|
-
filename = file.substring(0, file.length - ext.length) + ".js";
|
|
21
|
-
} else if (ext === ".ts") {
|
|
22
|
-
filename = file.substring(0, file.length - ext.length);
|
|
23
|
-
} else {
|
|
24
|
-
filename = file;
|
|
25
|
-
}
|
|
26
|
-
let importPath;
|
|
27
|
-
if ("relativeTo" in config) {
|
|
28
|
-
importPath = path.relative(config.relativeTo, filename);
|
|
29
|
-
if (!path.isAbsolute(importPath) && !importPath.startsWith(".")) {
|
|
30
|
-
importPath = `./${importPath}`;
|
|
31
|
-
}
|
|
32
|
-
} else {
|
|
33
|
-
importPath = path.resolve(filename);
|
|
34
|
-
}
|
|
35
|
-
return importPath.replaceAll(path.sep, "/");
|
|
36
|
-
}
|
|
37
|
-
function ident(code, tab = 1) {
|
|
38
|
-
return code.split("\n").map((v) => " ".repeat(tab) + v).join("\n");
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// src/utils/collections.ts
|
|
42
|
-
function getSupportedFormats(collection) {
|
|
43
|
-
return {
|
|
44
|
-
doc: ["mdx", "md"],
|
|
45
|
-
meta: ["json", "yaml"]
|
|
46
|
-
}[collection.type];
|
|
47
|
-
}
|
|
48
|
-
function getGlobPatterns(collection) {
|
|
49
|
-
if (collection.files) return collection.files;
|
|
50
|
-
return [`**/*.{${getSupportedFormats(collection).join(",")}}`];
|
|
51
|
-
}
|
|
52
|
-
function isFileSupported(filePath, collection) {
|
|
53
|
-
for (const format of getSupportedFormats(collection)) {
|
|
54
|
-
if (filePath.endsWith(`.${format}`)) return true;
|
|
55
|
-
}
|
|
56
|
-
return false;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export {
|
|
60
|
-
getImportCode,
|
|
61
|
-
toImportPath,
|
|
62
|
-
ident,
|
|
63
|
-
getGlobPatterns,
|
|
64
|
-
isFileSupported
|
|
65
|
-
};
|