hyperbook 0.73.1 → 0.73.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.
Files changed (2) hide show
  1. package/dist/index.js +16 -8
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -55531,13 +55531,21 @@ async function runBuild(root, rootProject, basePath, prefix, out, filter) {
55531
55531
  console.log(`${chalk_1.default.blue(`[${prefix}]`)} Cleaning output folder ${rootOut}.`);
55532
55532
  await (0, archive_1.runArchive)(root, rootOut, prefix);
55533
55533
  // Helper function to resolve relative paths
55534
- const resolveRelativePath = (path, currentPageHref) => {
55534
+ const resolveRelativePath = (path, page) => {
55535
+ var _a;
55535
55536
  // If path is absolute, return as-is
55536
55537
  if (path.startsWith("/")) {
55537
55538
  return path;
55538
55539
  }
55539
55540
  // Get the directory of the current page
55540
- const currentPageDir = path_1.posix.dirname(currentPageHref);
55541
+ // Use page.path.directory if available, otherwise derive from href
55542
+ let currentPageDir;
55543
+ if ((_a = page.path) === null || _a === void 0 ? void 0 : _a.directory) {
55544
+ currentPageDir = path_1.posix.join("/", page.path.directory);
55545
+ }
55546
+ else {
55547
+ currentPageDir = path_1.posix.dirname(page.href || "/");
55548
+ }
55541
55549
  // Resolve the relative path and normalize
55542
55550
  return path_1.posix.normalize(path_1.posix.resolve(currentPageDir, path));
55543
55551
  };
@@ -55560,16 +55568,16 @@ async function runBuild(root, rootProject, basePath, prefix, out, filter) {
55560
55568
  path = path.slice(0, -7);
55561
55569
  }
55562
55570
  // Handle relative paths when we have a current page context
55563
- if ((page === null || page === void 0 ? void 0 : page.href) && !path.startsWith("/")) {
55564
- path = resolveRelativePath(path, page.href);
55571
+ if (page && !path.startsWith("/")) {
55572
+ path = resolveRelativePath(path, page);
55565
55573
  }
55566
55574
  path = [path];
55567
55575
  }
55568
55576
  // Handle array paths - resolve relative segments
55569
- if (Array.isArray(path) && (page === null || page === void 0 ? void 0 : page.href)) {
55577
+ if (Array.isArray(path) && page) {
55570
55578
  path = path.map((segment) => {
55571
55579
  if (typeof segment === "string" && !segment.startsWith("/")) {
55572
- return resolveRelativePath(segment, page.href || "");
55580
+ return resolveRelativePath(segment, page);
55573
55581
  }
55574
55582
  return segment;
55575
55583
  });
@@ -93390,7 +93398,7 @@ var getNavigationForFile = async (pageList, currentFile) => {
93390
93398
  if (link.startsWith("/@/")) {
93391
93399
  return allPages.find((p) => p.permaid === link.split("/@/")[1].trim()) || null;
93392
93400
  } else if (link.startsWith("./") || link.startsWith("../")) {
93393
- const currentDir = external_path_.posix.dirname(currentFile.path.href || "/");
93401
+ const currentDir = currentFile.path.directory ? external_path_.posix.join("/", currentFile.path.directory) : external_path_.posix.dirname(currentFile.path.href || "/");
93394
93402
  const resolvedHref = external_path_.posix.normalize(
93395
93403
  external_path_.posix.join(currentDir, link)
93396
93404
  );
@@ -173945,7 +173953,7 @@ module.exports = /*#__PURE__*/JSON.parse('{"application/1d-interleaved-parityfec
173945
173953
  /***/ ((module) => {
173946
173954
 
173947
173955
  "use strict";
173948
- module.exports = /*#__PURE__*/JSON.parse('{"name":"hyperbook","version":"0.73.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":{"create-hyperbook":"workspace:*","@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"}}');
173956
+ module.exports = /*#__PURE__*/JSON.parse('{"name":"hyperbook","version":"0.73.2","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":{"create-hyperbook":"workspace:*","@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"}}');
173949
173957
 
173950
173958
  /***/ })
173951
173959
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hyperbook",
3
- "version": "0.73.1",
3
+ "version": "0.73.2",
4
4
  "author": "Mike Barkmin",
5
5
  "homepage": "https://github.com/openpatch/hyperbook#readme",
6
6
  "license": "MIT",
@@ -57,7 +57,7 @@
57
57
  "update-check": "1.5.4",
58
58
  "ws": "^8.18.0",
59
59
  "create-hyperbook": "0.3.0",
60
- "@hyperbook/fs": "0.21.0",
60
+ "@hyperbook/fs": "0.21.1",
61
61
  "@hyperbook/markdown": "0.46.1",
62
62
  "@hyperbook/types": "0.18.0"
63
63
  },