hyperbook 0.69.0 → 0.70.1

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/index.js CHANGED
@@ -103628,29 +103628,36 @@ var getNavigationForFile = async (pageList, currentFile) => {
103628
103628
  if (currentFile) {
103629
103629
  let i = pageList.findIndex((p) => p.href === currentFile.path.href);
103630
103630
  current = pageList[i] || null;
103631
- pageList = pageList.filter(
103631
+ const allPages = pageList;
103632
+ const filteredPageList = pageList.filter(
103632
103633
  (p) => (!p.isEmpty || p.href === currentFile.path.href) && !p.hide
103633
103634
  );
103634
- i = pageList.findIndex((p) => p.href === currentFile.path.href);
103635
+ i = filteredPageList.findIndex((p) => p.href === currentFile.path.href);
103636
+ const resolveLink = (link) => {
103637
+ if (!link) {
103638
+ return null;
103639
+ }
103640
+ if (link.startsWith("/@/")) {
103641
+ return allPages.find((p) => p.permaid === link.split("/@/")[1].trim()) || null;
103642
+ } else if (link.startsWith("./") || link.startsWith("../")) {
103643
+ const currentDir = external_path_.posix.dirname(currentFile.path.href || "/");
103644
+ const resolvedHref = external_path_.posix.normalize(
103645
+ external_path_.posix.join(currentDir, link)
103646
+ );
103647
+ return allPages.find((p) => p.href === resolvedHref) || null;
103648
+ } else {
103649
+ return allPages.find((p) => p.href === link) || null;
103650
+ }
103651
+ };
103635
103652
  if (current !== null && current.next !== void 0) {
103636
- next = pageList.find((p) => {
103637
- if (current?.next?.startsWith("/@/")) {
103638
- return p.permaid === current.next.split("/@/")[1].trim();
103639
- }
103640
- return p.href === current?.next;
103641
- }) || null;
103653
+ next = resolveLink(current.next);
103642
103654
  } else {
103643
- next = pageList[i + 1] || null;
103655
+ next = filteredPageList[i + 1] || null;
103644
103656
  }
103645
103657
  if (current !== null && current.prev !== void 0) {
103646
- previous = pageList.find((p) => {
103647
- if (current?.prev?.startsWith("/@/")) {
103648
- return p.permaid === current.prev.split("/@/")[1].trim();
103649
- }
103650
- return p.href === current?.prev;
103651
- }) || null;
103658
+ previous = resolveLink(current.prev);
103652
103659
  } else {
103653
- previous = pageList[i - 1] || null;
103660
+ previous = filteredPageList[i - 1] || null;
103654
103661
  }
103655
103662
  }
103656
103663
  return {
@@ -183506,7 +183513,7 @@ module.exports = /*#__PURE__*/JSON.parse('{"application/1d-interleaved-parityfec
183506
183513
  /***/ ((module) => {
183507
183514
 
183508
183515
  "use strict";
183509
- module.exports = /*#__PURE__*/JSON.parse('{"name":"hyperbook","version":"0.69.0","author":"Mike Barkmin","homepage":"https://github.com/openpatch/hyperbook#readme","license":"MIT","bin":{"hyperbook":"./dist/index.js"},"files":["dist"],"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/openpatch/hyperbook.git","directory":"packages/hyperbook"},"bugs":{"url":"https://github.com/openpatch/hyperbook/issues"},"engines":{"node":">=12.22.0"},"scripts":{"version":"pnpm build","lint":"tsc --noEmit","dev":"ncc build ./index.ts -w -o dist/","build":"rimraf dist && ncc build ./index.ts -o ./dist/ --no-cache --no-source-map-register --external favicons --external sharp && node postbuild.mjs"},"dependencies":{"favicons":"^7.2.0"},"devDependencies":{"@hyperbook/fs":"workspace:*","@hyperbook/markdown":"workspace:*","@hyperbook/types":"workspace:*","@pnpm/exportable-manifest":"1000.0.6","@types/archiver":"6.0.3","@types/async-retry":"1.4.9","@types/cross-spawn":"6.0.6","@types/lunr":"^2.3.7","@types/prompts":"2.4.9","@types/tar":"6.1.13","@types/ws":"^8.5.14","@vercel/ncc":"0.38.3","archiver":"7.0.1","async-retry":"1.3.3","chalk":"5.4.1","chokidar":"4.0.3","commander":"12.1.0","cpy":"11.1.0","cross-spawn":"7.0.6","domutils":"^3.2.2","extract-zip":"^2.0.1","got":"12.6.0","htmlparser2":"^10.0.0","lunr":"^2.3.9","lunr-languages":"^1.14.0","mime":"^4.0.6","prompts":"2.4.2","rimraf":"6.0.1","tar":"7.4.3","update-check":"1.5.4","ws":"^8.18.0"}}');
183516
+ module.exports = /*#__PURE__*/JSON.parse('{"name":"hyperbook","version":"0.70.1","author":"Mike Barkmin","homepage":"https://github.com/openpatch/hyperbook#readme","license":"MIT","bin":{"hyperbook":"./dist/index.js"},"files":["dist"],"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/openpatch/hyperbook.git","directory":"packages/hyperbook"},"bugs":{"url":"https://github.com/openpatch/hyperbook/issues"},"engines":{"node":">=12.22.0"},"scripts":{"version":"pnpm build","lint":"tsc --noEmit","dev":"ncc build ./index.ts -w -o dist/","build":"rimraf dist && ncc build ./index.ts -o ./dist/ --no-cache --no-source-map-register --external favicons --external sharp && node postbuild.mjs"},"dependencies":{"favicons":"^7.2.0"},"devDependencies":{"@hyperbook/fs":"workspace:*","@hyperbook/markdown":"workspace:*","@hyperbook/types":"workspace:*","@pnpm/exportable-manifest":"1000.0.6","@types/archiver":"6.0.3","@types/async-retry":"1.4.9","@types/cross-spawn":"6.0.6","@types/lunr":"^2.3.7","@types/prompts":"2.4.9","@types/tar":"6.1.13","@types/ws":"^8.5.14","@vercel/ncc":"0.38.3","archiver":"7.0.1","async-retry":"1.3.3","chalk":"5.4.1","chokidar":"4.0.3","commander":"12.1.0","cpy":"11.1.0","cross-spawn":"7.0.6","domutils":"^3.2.2","extract-zip":"^2.0.1","got":"12.6.0","htmlparser2":"^10.0.0","lunr":"^2.3.9","lunr-languages":"^1.14.0","mime":"^4.0.6","prompts":"2.4.2","rimraf":"6.0.1","tar":"7.4.3","update-check":"1.5.4","ws":"^8.18.0"}}');
183510
183517
 
183511
183518
  /***/ })
183512
183519
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hyperbook",
3
- "version": "0.69.0",
3
+ "version": "0.70.1",
4
4
  "author": "Mike Barkmin",
5
5
  "homepage": "https://github.com/openpatch/hyperbook#readme",
6
6
  "license": "MIT",
@@ -56,9 +56,9 @@
56
56
  "tar": "7.4.3",
57
57
  "update-check": "1.5.4",
58
58
  "ws": "^8.18.0",
59
- "@hyperbook/fs": "0.20.0",
59
+ "@hyperbook/fs": "0.21.0",
60
60
  "@hyperbook/types": "0.18.0",
61
- "@hyperbook/markdown": "0.43.0"
61
+ "@hyperbook/markdown": "0.43.1"
62
62
  },
63
63
  "scripts": {
64
64
  "version": "pnpm build",