fumadocs-core 12.1.3 → 12.2.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/source/index.js +14 -9
- package/package.json +1 -1
package/dist/source/index.js
CHANGED
|
@@ -64,7 +64,6 @@ function resolvePath(from, join) {
|
|
|
64
64
|
var link = new RegExp("^\\[(?<text>.+)]\\((?<url>.+)\\)$");
|
|
65
65
|
var separator = new RegExp("^---(?<name>.*?)---$");
|
|
66
66
|
var rest = "...";
|
|
67
|
-
var extractor = new RegExp("^\\.\\.\\.(?<name>.+)$");
|
|
68
67
|
function buildAll(nodes, ctx, skipIndex) {
|
|
69
68
|
const output = [];
|
|
70
69
|
for (const node of [...nodes].sort(
|
|
@@ -85,7 +84,7 @@ function buildAll(nodes, ctx, skipIndex) {
|
|
|
85
84
|
return output;
|
|
86
85
|
}
|
|
87
86
|
function resolveFolderItem(folder, item, ctx, addedNodePaths) {
|
|
88
|
-
var _a, _b, _c, _d, _e, _f, _g
|
|
87
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
89
88
|
if (item === rest) return "...";
|
|
90
89
|
const separateResult = separator.exec(item);
|
|
91
90
|
if (separateResult == null ? void 0 : separateResult.groups) {
|
|
@@ -107,17 +106,23 @@ function resolveFolderItem(folder, item, ctx, addedNodePaths) {
|
|
|
107
106
|
};
|
|
108
107
|
return [(_f = (_e = (_d = ctx.options).attachFile) == null ? void 0 : _e.call(_d, node)) != null ? _f : node];
|
|
109
108
|
}
|
|
110
|
-
|
|
111
|
-
const
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
const
|
|
109
|
+
let filename = item;
|
|
110
|
+
const isExcept = item.startsWith("!");
|
|
111
|
+
if (isExcept) {
|
|
112
|
+
filename = item.slice(1);
|
|
113
|
+
}
|
|
114
|
+
const isExtract = item.startsWith("...");
|
|
115
|
+
if (isExtract) {
|
|
116
|
+
filename = item.slice(3);
|
|
117
|
+
}
|
|
118
|
+
const path = resolvePath(folder.file.path, filename);
|
|
119
|
+
const itemNode = (_g = ctx.storage.readDir(path)) != null ? _g : ctx.storage.read(path, "page");
|
|
116
120
|
if (!itemNode) return [];
|
|
117
121
|
addedNodePaths.add(itemNode.file.path);
|
|
122
|
+
if (isExcept) return [];
|
|
118
123
|
if ("children" in itemNode) {
|
|
119
124
|
const node = buildFolderNode(itemNode, false, ctx);
|
|
120
|
-
return
|
|
125
|
+
return isExtract ? node.children : [node];
|
|
121
126
|
}
|
|
122
127
|
return [buildFileNode(itemNode, ctx)];
|
|
123
128
|
}
|