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.
@@ -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, _h, _i;
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
- const extractResult = extractor.exec(item);
111
- const path = resolvePath(
112
- folder.file.path,
113
- (_h = (_g = extractResult == null ? void 0 : extractResult.groups) == null ? void 0 : _g.name) != null ? _h : item
114
- );
115
- const itemNode = (_i = ctx.storage.readDir(path)) != null ? _i : ctx.storage.read(path, "page");
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 extractResult ? node.children : [node];
125
+ return isExtract ? node.children : [node];
121
126
  }
122
127
  return [buildFileNode(itemNode, ctx)];
123
128
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-core",
3
- "version": "12.1.3",
3
+ "version": "12.2.0",
4
4
  "description": "The library for building a documentation website in Next.js",
5
5
  "keywords": [
6
6
  "NextJs",