fumadocs-mdx 13.0.1 → 13.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/bin.cjs +23 -18
- package/dist/vite/index.cjs +23 -18
- package/dist/vite/index.js +23 -18
- package/package.json +1 -1
package/dist/bin.cjs
CHANGED
|
@@ -1486,12 +1486,12 @@ ${obj}
|
|
|
1486
1486
|
}
|
|
1487
1487
|
function doc(name, collection) {
|
|
1488
1488
|
const patterns = getGlobPatterns(collection);
|
|
1489
|
-
const
|
|
1489
|
+
const dir = getCollectionDir(collection);
|
|
1490
1490
|
const docGlob = generateGlob(patterns, {
|
|
1491
1491
|
query: {
|
|
1492
1492
|
collection: name
|
|
1493
1493
|
},
|
|
1494
|
-
base
|
|
1494
|
+
base: dir
|
|
1495
1495
|
});
|
|
1496
1496
|
if (collection.async) {
|
|
1497
1497
|
const headBlob = generateGlob(patterns, {
|
|
@@ -1500,32 +1500,32 @@ ${obj}
|
|
|
1500
1500
|
collection: name
|
|
1501
1501
|
},
|
|
1502
1502
|
import: "frontmatter",
|
|
1503
|
-
base
|
|
1503
|
+
base: dir
|
|
1504
1504
|
});
|
|
1505
|
-
return `create.docLazy("${name}", "${
|
|
1505
|
+
return `create.docLazy("${name}", "${dir}", ${headBlob}, ${docGlob})`;
|
|
1506
1506
|
}
|
|
1507
|
-
return `create.doc("${name}", "${
|
|
1507
|
+
return `create.doc("${name}", "${dir}", ${docGlob})`;
|
|
1508
1508
|
}
|
|
1509
1509
|
function meta(name, collection) {
|
|
1510
1510
|
const patterns = getGlobPatterns(collection);
|
|
1511
|
-
const
|
|
1512
|
-
return `create.meta("${name}", "${
|
|
1511
|
+
const dir = getCollectionDir(collection);
|
|
1512
|
+
return `create.meta("${name}", "${dir}", ${generateGlob(patterns, {
|
|
1513
1513
|
import: "default",
|
|
1514
|
-
base,
|
|
1514
|
+
base: dir,
|
|
1515
1515
|
query: {
|
|
1516
1516
|
collection: name
|
|
1517
1517
|
}
|
|
1518
1518
|
})})`;
|
|
1519
1519
|
}
|
|
1520
1520
|
function generateGlob(patterns, options2) {
|
|
1521
|
-
patterns =
|
|
1521
|
+
patterns = patterns.map(normalizeGlobPath);
|
|
1522
1522
|
if (runtime === "node" || runtime === "bun") {
|
|
1523
1523
|
return generateGlobImport(patterns, options2);
|
|
1524
1524
|
} else {
|
|
1525
1525
|
return `import.meta.glob(${JSON.stringify(patterns)}, ${JSON.stringify(
|
|
1526
1526
|
{
|
|
1527
1527
|
...options2,
|
|
1528
|
-
base: import_node_path10.default.relative(outDir, options2.base)
|
|
1528
|
+
base: normalizeGlobPath(import_node_path10.default.relative(outDir, options2.base))
|
|
1529
1529
|
},
|
|
1530
1530
|
null,
|
|
1531
1531
|
2
|
|
@@ -1546,24 +1546,29 @@ ${obj}
|
|
|
1546
1546
|
}
|
|
1547
1547
|
return lines.join("\n");
|
|
1548
1548
|
}
|
|
1549
|
-
function
|
|
1550
|
-
|
|
1551
|
-
}
|
|
1552
|
-
function enforceRelative(file) {
|
|
1549
|
+
function normalizeGlobPath(file) {
|
|
1550
|
+
file = slash(file);
|
|
1553
1551
|
if (file.startsWith("./")) return file;
|
|
1554
1552
|
if (file.startsWith("/")) return `.${file}`;
|
|
1555
1553
|
return `./${file}`;
|
|
1556
1554
|
}
|
|
1557
|
-
function
|
|
1558
|
-
|
|
1555
|
+
function getCollectionDir(collection) {
|
|
1556
|
+
const dir = collection.dir;
|
|
1559
1557
|
if (Array.isArray(dir)) {
|
|
1560
1558
|
if (dir.length !== 1)
|
|
1561
1559
|
throw new Error(
|
|
1562
1560
|
`[Fumadocs MDX] Vite Plugin doesn't support multiple \`dir\` for a collection at the moment.`
|
|
1563
1561
|
);
|
|
1564
|
-
|
|
1562
|
+
return dir[0];
|
|
1563
|
+
}
|
|
1564
|
+
return dir;
|
|
1565
|
+
}
|
|
1566
|
+
function slash(path16) {
|
|
1567
|
+
const isExtendedLengthPath = path16.startsWith("\\\\?\\");
|
|
1568
|
+
if (isExtendedLengthPath) {
|
|
1569
|
+
return path16;
|
|
1565
1570
|
}
|
|
1566
|
-
return
|
|
1571
|
+
return path16.replaceAll("\\", "/");
|
|
1567
1572
|
}
|
|
1568
1573
|
var import_node_path10;
|
|
1569
1574
|
var init_vite = __esm({
|
package/dist/vite/index.cjs
CHANGED
|
@@ -913,12 +913,12 @@ ${obj}
|
|
|
913
913
|
}
|
|
914
914
|
function doc(name, collection) {
|
|
915
915
|
const patterns = getGlobPatterns(collection);
|
|
916
|
-
const
|
|
916
|
+
const dir = getCollectionDir(collection);
|
|
917
917
|
const docGlob = generateGlob(patterns, {
|
|
918
918
|
query: {
|
|
919
919
|
collection: name
|
|
920
920
|
},
|
|
921
|
-
base
|
|
921
|
+
base: dir
|
|
922
922
|
});
|
|
923
923
|
if (collection.async) {
|
|
924
924
|
const headBlob = generateGlob(patterns, {
|
|
@@ -927,32 +927,32 @@ ${obj}
|
|
|
927
927
|
collection: name
|
|
928
928
|
},
|
|
929
929
|
import: "frontmatter",
|
|
930
|
-
base
|
|
930
|
+
base: dir
|
|
931
931
|
});
|
|
932
|
-
return `create.docLazy("${name}", "${
|
|
932
|
+
return `create.docLazy("${name}", "${dir}", ${headBlob}, ${docGlob})`;
|
|
933
933
|
}
|
|
934
|
-
return `create.doc("${name}", "${
|
|
934
|
+
return `create.doc("${name}", "${dir}", ${docGlob})`;
|
|
935
935
|
}
|
|
936
936
|
function meta(name, collection) {
|
|
937
937
|
const patterns = getGlobPatterns(collection);
|
|
938
|
-
const
|
|
939
|
-
return `create.meta("${name}", "${
|
|
938
|
+
const dir = getCollectionDir(collection);
|
|
939
|
+
return `create.meta("${name}", "${dir}", ${generateGlob(patterns, {
|
|
940
940
|
import: "default",
|
|
941
|
-
base,
|
|
941
|
+
base: dir,
|
|
942
942
|
query: {
|
|
943
943
|
collection: name
|
|
944
944
|
}
|
|
945
945
|
})})`;
|
|
946
946
|
}
|
|
947
947
|
function generateGlob(patterns, options2) {
|
|
948
|
-
patterns =
|
|
948
|
+
patterns = patterns.map(normalizeGlobPath);
|
|
949
949
|
if (runtime === "node" || runtime === "bun") {
|
|
950
950
|
return generateGlobImport(patterns, options2);
|
|
951
951
|
} else {
|
|
952
952
|
return `import.meta.glob(${JSON.stringify(patterns)}, ${JSON.stringify(
|
|
953
953
|
{
|
|
954
954
|
...options2,
|
|
955
|
-
base: import_node_path8.default.relative(outDir, options2.base)
|
|
955
|
+
base: normalizeGlobPath(import_node_path8.default.relative(outDir, options2.base))
|
|
956
956
|
},
|
|
957
957
|
null,
|
|
958
958
|
2
|
|
@@ -973,24 +973,29 @@ ${obj}
|
|
|
973
973
|
}
|
|
974
974
|
return lines.join("\n");
|
|
975
975
|
}
|
|
976
|
-
function
|
|
977
|
-
|
|
978
|
-
}
|
|
979
|
-
function enforceRelative(file) {
|
|
976
|
+
function normalizeGlobPath(file) {
|
|
977
|
+
file = slash(file);
|
|
980
978
|
if (file.startsWith("./")) return file;
|
|
981
979
|
if (file.startsWith("/")) return `.${file}`;
|
|
982
980
|
return `./${file}`;
|
|
983
981
|
}
|
|
984
|
-
function
|
|
985
|
-
|
|
982
|
+
function getCollectionDir(collection) {
|
|
983
|
+
const dir = collection.dir;
|
|
986
984
|
if (Array.isArray(dir)) {
|
|
987
985
|
if (dir.length !== 1)
|
|
988
986
|
throw new Error(
|
|
989
987
|
`[Fumadocs MDX] Vite Plugin doesn't support multiple \`dir\` for a collection at the moment.`
|
|
990
988
|
);
|
|
991
|
-
|
|
989
|
+
return dir[0];
|
|
990
|
+
}
|
|
991
|
+
return dir;
|
|
992
|
+
}
|
|
993
|
+
function slash(path13) {
|
|
994
|
+
const isExtendedLengthPath = path13.startsWith("\\\\?\\");
|
|
995
|
+
if (isExtendedLengthPath) {
|
|
996
|
+
return path13;
|
|
992
997
|
}
|
|
993
|
-
return
|
|
998
|
+
return path13.replaceAll("\\", "/");
|
|
994
999
|
}
|
|
995
1000
|
|
|
996
1001
|
// src/core.ts
|
package/dist/vite/index.js
CHANGED
|
@@ -98,12 +98,12 @@ ${obj}
|
|
|
98
98
|
}
|
|
99
99
|
function doc(name, collection) {
|
|
100
100
|
const patterns = getGlobPatterns(collection);
|
|
101
|
-
const
|
|
101
|
+
const dir = getCollectionDir(collection);
|
|
102
102
|
const docGlob = generateGlob(patterns, {
|
|
103
103
|
query: {
|
|
104
104
|
collection: name
|
|
105
105
|
},
|
|
106
|
-
base
|
|
106
|
+
base: dir
|
|
107
107
|
});
|
|
108
108
|
if (collection.async) {
|
|
109
109
|
const headBlob = generateGlob(patterns, {
|
|
@@ -112,32 +112,32 @@ ${obj}
|
|
|
112
112
|
collection: name
|
|
113
113
|
},
|
|
114
114
|
import: "frontmatter",
|
|
115
|
-
base
|
|
115
|
+
base: dir
|
|
116
116
|
});
|
|
117
|
-
return `create.docLazy("${name}", "${
|
|
117
|
+
return `create.docLazy("${name}", "${dir}", ${headBlob}, ${docGlob})`;
|
|
118
118
|
}
|
|
119
|
-
return `create.doc("${name}", "${
|
|
119
|
+
return `create.doc("${name}", "${dir}", ${docGlob})`;
|
|
120
120
|
}
|
|
121
121
|
function meta(name, collection) {
|
|
122
122
|
const patterns = getGlobPatterns(collection);
|
|
123
|
-
const
|
|
124
|
-
return `create.meta("${name}", "${
|
|
123
|
+
const dir = getCollectionDir(collection);
|
|
124
|
+
return `create.meta("${name}", "${dir}", ${generateGlob(patterns, {
|
|
125
125
|
import: "default",
|
|
126
|
-
base,
|
|
126
|
+
base: dir,
|
|
127
127
|
query: {
|
|
128
128
|
collection: name
|
|
129
129
|
}
|
|
130
130
|
})})`;
|
|
131
131
|
}
|
|
132
132
|
function generateGlob(patterns, options2) {
|
|
133
|
-
patterns =
|
|
133
|
+
patterns = patterns.map(normalizeGlobPath);
|
|
134
134
|
if (runtime === "node" || runtime === "bun") {
|
|
135
135
|
return generateGlobImport(patterns, options2);
|
|
136
136
|
} else {
|
|
137
137
|
return `import.meta.glob(${JSON.stringify(patterns)}, ${JSON.stringify(
|
|
138
138
|
{
|
|
139
139
|
...options2,
|
|
140
|
-
base: path2.relative(outDir, options2.base)
|
|
140
|
+
base: normalizeGlobPath(path2.relative(outDir, options2.base))
|
|
141
141
|
},
|
|
142
142
|
null,
|
|
143
143
|
2
|
|
@@ -158,24 +158,29 @@ ${obj}
|
|
|
158
158
|
}
|
|
159
159
|
return lines.join("\n");
|
|
160
160
|
}
|
|
161
|
-
function
|
|
162
|
-
|
|
163
|
-
}
|
|
164
|
-
function enforceRelative(file) {
|
|
161
|
+
function normalizeGlobPath(file) {
|
|
162
|
+
file = slash(file);
|
|
165
163
|
if (file.startsWith("./")) return file;
|
|
166
164
|
if (file.startsWith("/")) return `.${file}`;
|
|
167
165
|
return `./${file}`;
|
|
168
166
|
}
|
|
169
|
-
function
|
|
170
|
-
|
|
167
|
+
function getCollectionDir(collection) {
|
|
168
|
+
const dir = collection.dir;
|
|
171
169
|
if (Array.isArray(dir)) {
|
|
172
170
|
if (dir.length !== 1)
|
|
173
171
|
throw new Error(
|
|
174
172
|
`[Fumadocs MDX] Vite Plugin doesn't support multiple \`dir\` for a collection at the moment.`
|
|
175
173
|
);
|
|
176
|
-
|
|
174
|
+
return dir[0];
|
|
175
|
+
}
|
|
176
|
+
return dir;
|
|
177
|
+
}
|
|
178
|
+
function slash(path4) {
|
|
179
|
+
const isExtendedLengthPath = path4.startsWith("\\\\?\\");
|
|
180
|
+
if (isExtendedLengthPath) {
|
|
181
|
+
return path4;
|
|
177
182
|
}
|
|
178
|
-
return
|
|
183
|
+
return path4.replaceAll("\\", "/");
|
|
179
184
|
}
|
|
180
185
|
|
|
181
186
|
// src/vite/index.ts
|