fumadocs-core 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/dynamic-link.js +1 -1
- package/dist/source/index.js +6 -8
- package/package.json +1 -1
package/dist/dynamic-link.js
CHANGED
|
@@ -12,7 +12,7 @@ var DynamicLink = forwardRef(
|
|
|
12
12
|
({ href, ...props }, ref) => {
|
|
13
13
|
const params = useParams();
|
|
14
14
|
const url = useMemo(() => {
|
|
15
|
-
return href?.replace(/\[
|
|
15
|
+
return href?.replace(/\[.*]/, (key) => {
|
|
16
16
|
const mappedKey = key.slice(1, -1);
|
|
17
17
|
const value = mappedKey in params ? params[mappedKey] : "undefined";
|
|
18
18
|
return typeof value === "string" ? value : value.join("/");
|
package/dist/source/index.js
CHANGED
|
@@ -104,13 +104,11 @@ function resolveFolderItem(folder, item, ctx, addedNodePaths) {
|
|
|
104
104
|
};
|
|
105
105
|
return [ctx.options.attachFile?.(node) ?? node];
|
|
106
106
|
}
|
|
107
|
+
const isExcept = item.startsWith("!"), isExtract = item.startsWith("...");
|
|
107
108
|
let filename = item;
|
|
108
|
-
const isExcept = item.startsWith("!");
|
|
109
109
|
if (isExcept) {
|
|
110
110
|
filename = item.slice(1);
|
|
111
|
-
}
|
|
112
|
-
const isExtract = item.startsWith("...");
|
|
113
|
-
if (isExtract) {
|
|
111
|
+
} else if (isExtract) {
|
|
114
112
|
filename = item.slice(3);
|
|
115
113
|
}
|
|
116
114
|
const path = resolvePath(folder.file.path, filename);
|
|
@@ -124,7 +122,7 @@ function resolveFolderItem(folder, item, ctx, addedNodePaths) {
|
|
|
124
122
|
}
|
|
125
123
|
return [buildFileNode(itemNode, ctx)];
|
|
126
124
|
}
|
|
127
|
-
function buildFolderNode(folder,
|
|
125
|
+
function buildFolderNode(folder, isGlobalRoot, ctx) {
|
|
128
126
|
const metaPath = resolvePath(folder.file.path, "meta");
|
|
129
127
|
let meta = ctx.storage.read(metaPath, "meta");
|
|
130
128
|
meta = findLocalizedFile(metaPath, "meta", ctx) ?? meta;
|
|
@@ -136,9 +134,9 @@ function buildFolderNode(folder, defaultIsRoot, ctx) {
|
|
|
136
134
|
const index = indexFile ? buildFileNode(indexFile, ctx) : void 0;
|
|
137
135
|
let children;
|
|
138
136
|
if (!meta) {
|
|
139
|
-
children = buildAll(folder.children, ctx, !
|
|
137
|
+
children = buildAll(folder.children, ctx, !isGlobalRoot);
|
|
140
138
|
} else {
|
|
141
|
-
const isRoot = metadata?.root ??
|
|
139
|
+
const isRoot = metadata?.root ?? isGlobalRoot;
|
|
142
140
|
const addedNodePaths = /* @__PURE__ */ new Set();
|
|
143
141
|
const resolved = metadata?.pages?.flatMap((item) => {
|
|
144
142
|
return resolveFolderItem(folder, item, ctx, addedNodePaths);
|
|
@@ -159,7 +157,7 @@ function buildFolderNode(folder, defaultIsRoot, ctx) {
|
|
|
159
157
|
const node = {
|
|
160
158
|
type: "folder",
|
|
161
159
|
name: metadata?.title ?? index?.name ?? pathToName(folder.file.name, true),
|
|
162
|
-
icon: ctx.options.resolveIcon?.(metadata?.icon),
|
|
160
|
+
icon: ctx.options.resolveIcon?.(metadata?.icon) ?? index?.icon,
|
|
163
161
|
root: metadata?.root,
|
|
164
162
|
defaultOpen: metadata?.defaultOpen,
|
|
165
163
|
index,
|