@dimm-city/print-md 0.4.1 → 0.5.0-rc.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/cli.js CHANGED
@@ -22693,7 +22693,7 @@ var package_default;
22693
22693
  var init_package = __esm(() => {
22694
22694
  package_default = {
22695
22695
  name: "@dimm-city/print-md-lib",
22696
- version: "0.4.1",
22696
+ version: "0.5.0-rc.2",
22697
22697
  private: true,
22698
22698
  type: "module",
22699
22699
  main: "dist/index.js",
@@ -22724,6 +22724,7 @@ var init_package = __esm(() => {
22724
22724
  },
22725
22725
  dependencies: {
22726
22726
  chokidar: "^5.0.0",
22727
+ diff3: "0.0.3",
22727
22728
  glob: "^13.0.0",
22728
22729
  htmlhint: "^1.9.2",
22729
22730
  "isomorphic-git": "^1.38.4",
@@ -22941,7 +22942,7 @@ var manifest_schema_default = "./manifest.schema-16z94mx1.json";
22941
22942
  var init_manifest_schema = () => {};
22942
22943
 
22943
22944
  // ../lib/src/assets/preview/scripts/pagedjs-interface.js
22944
- var pagedjs_interface_default = "./pagedjs-interface-er3k3jvc.js";
22945
+ var pagedjs_interface_default = "./pagedjs-interface-x79je7c5.js";
22945
22946
  var init_pagedjs_interface = () => {};
22946
22947
 
22947
22948
  // ../lib/src/assets/preview/scripts/pagedjs-bridge.js
@@ -22949,7 +22950,7 @@ var pagedjs_bridge_default = "./pagedjs-bridge-k1a8jxtv.js";
22949
22950
  var init_pagedjs_bridge = () => {};
22950
22951
 
22951
22952
  // ../lib/src/assets/preview/scripts/preview-shell.js
22952
- var preview_shell_default = "./preview-shell-663marwv.js";
22953
+ var preview_shell_default = "./preview-shell-d3y4np7a.js";
22953
22954
  var init_preview_shell = () => {};
22954
22955
 
22955
22956
  // ../lib/src/assets/vendor/paged.polyfill.js
@@ -93538,13 +93539,19 @@ function resolveExternalAssetRoots(inputPath, assets) {
93538
93539
  function resolveDestinationForChange(filePath2, inputPath, tempDir, externalRoots) {
93539
93540
  if (filePath2 === inputPath || filePath2.startsWith(inputPath + path6.sep)) {
93540
93541
  const relativePath = path6.relative(inputPath, filePath2);
93541
- return { destPath: path6.join(tempDir, relativePath), relativePath };
93542
+ return {
93543
+ destPath: path6.join(tempDir, relativePath),
93544
+ relativePath: relativePath.replace(/\\/g, "/")
93545
+ };
93542
93546
  }
93543
93547
  for (const root2 of externalRoots) {
93544
93548
  if (filePath2 === root2.src || filePath2.startsWith(root2.src + path6.sep)) {
93545
93549
  const relInRoot = path6.relative(root2.src, filePath2);
93546
93550
  const relativePath = path6.join(root2.destName, relInRoot);
93547
- return { destPath: path6.join(tempDir, relativePath), relativePath };
93551
+ return {
93552
+ destPath: path6.join(tempDir, relativePath),
93553
+ relativePath: relativePath.replace(/\\/g, "/")
93554
+ };
93548
93555
  }
93549
93556
  }
93550
93557
  return null;
@@ -93634,44 +93641,69 @@ function createFileWatcher(state) {
93634
93641
  pollInterval: 50
93635
93642
  }
93636
93643
  });
93637
- watcher.on("all", async (event, filePath2) => {
93638
- debug2(`File ${event}: ${filePath2}`);
93644
+ const pendingChanges = new Map;
93645
+ function scheduleRebuild() {
93639
93646
  if (state.rebuildTimer)
93640
93647
  clearTimeout(state.rebuildTimer);
93641
- state.rebuildTimer = setTimeout(async () => {
93642
- if (state.isRebuilding)
93643
- return;
93644
- state.isRebuilding = true;
93645
- try {
93646
- info("Regenerating preview...");
93647
- const dest = resolveDestinationForChange(filePath2, inputResolved, state.tempDir, externalRoots);
93648
- if (dest) {
93648
+ state.rebuildTimer = setTimeout(runRebuild, DEBOUNCE.FILE_WATCH);
93649
+ }
93650
+ async function runRebuild() {
93651
+ if (state.isRebuilding)
93652
+ return;
93653
+ const changes = [...pendingChanges.entries()];
93654
+ pendingChanges.clear();
93655
+ if (changes.length === 0)
93656
+ return;
93657
+ state.isRebuilding = true;
93658
+ try {
93659
+ info("Regenerating preview...");
93660
+ const dests = [];
93661
+ for (const [changedPath, changedEvent] of changes) {
93662
+ const dest = resolveDestinationForChange(changedPath, inputResolved, state.tempDir, externalRoots);
93663
+ if (!dest)
93664
+ continue;
93665
+ if (existsSync13(changedPath)) {
93649
93666
  await fsp2.mkdir(path6.dirname(dest.destPath), { recursive: true });
93650
- await fsp2.copyFile(filePath2, dest.destPath);
93667
+ await fsp2.copyFile(changedPath, dest.destPath);
93651
93668
  debug2(`Updated: ${dest.relativePath}`);
93652
93669
  }
93653
- if (dest && path6.extname(filePath2).toLowerCase() === ".css") {
93654
- state.previewServer?.broadcastCssUpdate(dest.relativePath);
93655
- info(`CSS hot-swapped: ${dest.relativePath}`);
93656
- return;
93657
- }
93658
- const manifest = await loadManifest(state.currentInputPath);
93659
- const updatedConfig = resolveConfig({}, manifest);
93660
- state.config = updatedConfig;
93661
- await generateAndWriteHtml(state.currentInputPath, state.tempDir, updatedConfig);
93662
- if (incrementalPreviewEnabled() && dest && path6.extname(filePath2).toLowerCase() === ".md") {
93663
- state.previewServer?.broadcastContentUpdate(dest.relativePath);
93664
- info(`Chapter updated: ${dest.relativePath}`);
93665
- } else {
93666
- state.previewServer?.broadcastReload();
93667
- info("Preview updated");
93670
+ dests.push({
93671
+ relativePath: dest.relativePath,
93672
+ ext: path6.extname(changedPath).toLowerCase(),
93673
+ event: changedEvent
93674
+ });
93675
+ }
93676
+ if (dests.length === changes.length && dests.length > 0 && dests.every((d) => d.ext === ".css")) {
93677
+ for (const d of dests) {
93678
+ state.previewServer?.broadcastCssUpdate(d.relativePath);
93679
+ info(`CSS hot-swapped: ${d.relativePath}`);
93668
93680
  }
93669
- } catch (err) {
93670
- error("Failed to regenerate preview:", err);
93671
- } finally {
93672
- state.isRebuilding = false;
93681
+ return;
93682
+ }
93683
+ const manifest = await loadManifest(state.currentInputPath);
93684
+ const updatedConfig = resolveConfig({}, manifest);
93685
+ state.config = updatedConfig;
93686
+ await generateAndWriteHtml(state.currentInputPath, state.tempDir, updatedConfig);
93687
+ const only = dests.length === 1 ? dests[0] : null;
93688
+ if (incrementalPreviewEnabled() && changes.length === 1 && only && only.ext === ".md" && only.event !== "unlink" && only.event !== "unlinkDir") {
93689
+ state.previewServer?.broadcastContentUpdate(only.relativePath);
93690
+ info(`Chapter updated: ${only.relativePath}`);
93691
+ } else {
93692
+ state.previewServer?.broadcastReload();
93693
+ info(changes.length > 1 ? `Preview updated (${changes.length} files changed — full reload)` : "Preview updated");
93673
93694
  }
93674
- }, DEBOUNCE.FILE_WATCH);
93695
+ } catch (err) {
93696
+ error("Failed to regenerate preview:", err);
93697
+ } finally {
93698
+ state.isRebuilding = false;
93699
+ if (pendingChanges.size > 0)
93700
+ scheduleRebuild();
93701
+ }
93702
+ }
93703
+ watcher.on("all", (event, filePath2) => {
93704
+ debug2(`File ${event}: ${filePath2}`);
93705
+ pendingChanges.set(filePath2, event);
93706
+ scheduleRebuild();
93675
93707
  });
93676
93708
  info("Watching for file changes...");
93677
93709
  return watcher;
@@ -94054,6 +94086,20 @@ async function createPreviewServer(state, port, restartPreviewFn) {
94054
94086
  }
94055
94087
  return;
94056
94088
  }
94089
+ if (url.pathname === "/__log" && req.method === "POST") {
94090
+ let body = "";
94091
+ req.on("data", (chunk) => {
94092
+ if (body.length < 2048)
94093
+ body += chunk;
94094
+ });
94095
+ req.on("end", () => {
94096
+ if (body)
94097
+ info(`[preview-shell] ${body.slice(0, 1024)}`);
94098
+ res.writeHead(204);
94099
+ res.end();
94100
+ });
94101
+ return;
94102
+ }
94057
94103
  if (url.pathname === "/__chapter") {
94058
94104
  const file = url.searchParams.get("file");
94059
94105
  if (!file || !state.currentInputPath) {
@@ -94379,13 +94425,97 @@ var init_diagnostics = __esm(() => {
94379
94425
  });
94380
94426
 
94381
94427
  // ../lib/src/lib/project-source.ts
94428
+ import { stat as stat5, readFile as readFile21 } from "node:fs/promises";
94429
+ import os3 from "node:os";
94430
+ import path9 from "node:path";
94431
+ async function isDirectory2(target) {
94432
+ try {
94433
+ return (await stat5(target)).isDirectory();
94434
+ } catch {
94435
+ return false;
94436
+ }
94437
+ }
94438
+ function parseRemoteUrl(configText) {
94439
+ const sectionRe = /\[remote\s+"([^"]+)"\]([^[]*)/g;
94440
+ let firstUrl;
94441
+ let originUrl;
94442
+ let match;
94443
+ while ((match = sectionRe.exec(configText)) !== null) {
94444
+ const name = match[1];
94445
+ const body = match[2] ?? "";
94446
+ const urlMatch = /^\s*url\s*=\s*(.+?)\s*$/m.exec(body);
94447
+ if (!urlMatch)
94448
+ continue;
94449
+ const url = urlMatch[1];
94450
+ if (!url)
94451
+ continue;
94452
+ if (firstUrl === undefined)
94453
+ firstUrl = url;
94454
+ if (name === "origin") {
94455
+ originUrl = url;
94456
+ break;
94457
+ }
94458
+ }
94459
+ return originUrl ?? firstUrl;
94460
+ }
94461
+ function parseHeadBranch(headText) {
94462
+ const match = /^ref:\s*refs\/heads\/(.+?)\s*$/m.exec(headText);
94463
+ return match ? match[1] : undefined;
94464
+ }
94465
+ async function findEnclosingRepoDir(folderPath) {
94466
+ const home = path9.resolve(os3.homedir());
94467
+ let dir = path9.resolve(folderPath);
94468
+ for (let i = 0;i < 64; i++) {
94469
+ const parent = path9.dirname(dir);
94470
+ if (parent === dir)
94471
+ return;
94472
+ dir = parent;
94473
+ if (await isDirectory2(path9.join(dir, ".git")))
94474
+ return dir;
94475
+ if (dir === home)
94476
+ return;
94477
+ }
94478
+ return;
94479
+ }
94480
+ async function detectProjectSource(folderPath) {
94481
+ const gitDir = path9.join(folderPath, ".git");
94482
+ if (!await isDirectory2(gitDir)) {
94483
+ const enclosingRepoDir = await findEnclosingRepoDir(folderPath);
94484
+ return {
94485
+ type: "local-folder",
94486
+ path: folderPath,
94487
+ ...enclosingRepoDir !== undefined ? { enclosingRepoDir } : {}
94488
+ };
94489
+ }
94490
+ let remoteUrl;
94491
+ try {
94492
+ const configText = await readFile21(path9.join(gitDir, "config"), "utf8");
94493
+ remoteUrl = parseRemoteUrl(configText);
94494
+ } catch {
94495
+ remoteUrl = undefined;
94496
+ }
94497
+ let branch;
94498
+ try {
94499
+ const headText = await readFile21(path9.join(gitDir, "HEAD"), "utf8");
94500
+ branch = parseHeadBranch(headText);
94501
+ } catch {
94502
+ branch = undefined;
94503
+ }
94504
+ return {
94505
+ type: "local-git-folder",
94506
+ path: folderPath,
94507
+ hasRemote: remoteUrl !== undefined,
94508
+ ...remoteUrl !== undefined ? { remoteUrl } : {},
94509
+ ...branch !== undefined ? { branch } : {}
94510
+ };
94511
+ }
94382
94512
  function capabilitiesFor(source) {
94383
94513
  switch (source.type) {
94384
94514
  case "local-folder":
94385
94515
  return {
94386
94516
  canRead: true,
94387
94517
  canWriteLocal: true,
94388
- canEnableVersionHistory: true,
94518
+ canEnableVersionHistory: source.enclosingRepoDir === undefined,
94389
94519
  canSnapshot: false,
94390
94520
  canViewHistory: false,
94391
94521
  canRestoreSnapshot: false,
@@ -96412,20 +96542,20 @@ var require_ignore = __commonJS((exports, module) => {
96412
96542
  var throwError = (message, Ctor) => {
96413
96543
  throw new Ctor(message);
96414
96544
  };
96415
- var checkPath = (path9, originalPath, doThrow) => {
96416
- if (!isString2(path9)) {
96545
+ var checkPath = (path10, originalPath, doThrow) => {
96546
+ if (!isString2(path10)) {
96417
96547
  return doThrow(`path must be a string, but got \`${originalPath}\``, TypeError);
96418
96548
  }
96419
- if (!path9) {
96549
+ if (!path10) {
96420
96550
  return doThrow(`path must not be empty`, TypeError);
96421
96551
  }
96422
- if (checkPath.isNotRelative(path9)) {
96552
+ if (checkPath.isNotRelative(path10)) {
96423
96553
  const r = "`path.relative()`d";
96424
96554
  return doThrow(`path should be a ${r} string, but got "${originalPath}"`, RangeError);
96425
96555
  }
96426
96556
  return true;
96427
96557
  };
96428
- var isNotRelative = (path9) => REGEX_TEST_INVALID_PATH.test(path9);
96558
+ var isNotRelative = (path10) => REGEX_TEST_INVALID_PATH.test(path10);
96429
96559
  checkPath.isNotRelative = isNotRelative;
96430
96560
  checkPath.convert = (p10) => p10;
96431
96561
 
@@ -96468,7 +96598,7 @@ var require_ignore = __commonJS((exports, module) => {
96468
96598
  addPattern(pattern) {
96469
96599
  return this.add(pattern);
96470
96600
  }
96471
- _testOne(path9, checkUnignored) {
96601
+ _testOne(path10, checkUnignored) {
96472
96602
  let ignored = false;
96473
96603
  let unignored = false;
96474
96604
  this._rules.forEach((rule2) => {
@@ -96476,7 +96606,7 @@ var require_ignore = __commonJS((exports, module) => {
96476
96606
  if (unignored === negative && ignored !== unignored || negative && !ignored && !unignored && !checkUnignored) {
96477
96607
  return;
96478
96608
  }
96479
- const matched = rule2.regex.test(path9);
96609
+ const matched = rule2.regex.test(path10);
96480
96610
  if (matched) {
96481
96611
  ignored = !negative;
96482
96612
  unignored = negative;
@@ -96488,39 +96618,39 @@ var require_ignore = __commonJS((exports, module) => {
96488
96618
  };
96489
96619
  }
96490
96620
  _test(originalPath, cache2, checkUnignored, slices) {
96491
- const path9 = originalPath && checkPath.convert(originalPath);
96492
- checkPath(path9, originalPath, this._allowRelativePaths ? RETURN_FALSE : throwError);
96493
- return this._t(path9, cache2, checkUnignored, slices);
96621
+ const path10 = originalPath && checkPath.convert(originalPath);
96622
+ checkPath(path10, originalPath, this._allowRelativePaths ? RETURN_FALSE : throwError);
96623
+ return this._t(path10, cache2, checkUnignored, slices);
96494
96624
  }
96495
- _t(path9, cache2, checkUnignored, slices) {
96496
- if (path9 in cache2) {
96497
- return cache2[path9];
96625
+ _t(path10, cache2, checkUnignored, slices) {
96626
+ if (path10 in cache2) {
96627
+ return cache2[path10];
96498
96628
  }
96499
96629
  if (!slices) {
96500
- slices = path9.split(SLASH);
96630
+ slices = path10.split(SLASH);
96501
96631
  }
96502
96632
  slices.pop();
96503
96633
  if (!slices.length) {
96504
- return cache2[path9] = this._testOne(path9, checkUnignored);
96634
+ return cache2[path10] = this._testOne(path10, checkUnignored);
96505
96635
  }
96506
96636
  const parent = this._t(slices.join(SLASH) + SLASH, cache2, checkUnignored, slices);
96507
- return cache2[path9] = parent.ignored ? parent : this._testOne(path9, checkUnignored);
96637
+ return cache2[path10] = parent.ignored ? parent : this._testOne(path10, checkUnignored);
96508
96638
  }
96509
- ignores(path9) {
96510
- return this._test(path9, this._ignoreCache, false).ignored;
96639
+ ignores(path10) {
96640
+ return this._test(path10, this._ignoreCache, false).ignored;
96511
96641
  }
96512
96642
  createFilter() {
96513
- return (path9) => !this.ignores(path9);
96643
+ return (path10) => !this.ignores(path10);
96514
96644
  }
96515
96645
  filter(paths) {
96516
96646
  return makeArray(paths).filter(this.createFilter());
96517
96647
  }
96518
- test(path9) {
96519
- return this._test(path9, this._testCache, true);
96648
+ test(path10) {
96649
+ return this._test(path10, this._testCache, true);
96520
96650
  }
96521
96651
  }
96522
96652
  var factory = (options) => new Ignore(options);
96523
- var isPathValid = (path9) => checkPath(path9 && checkPath.convert(path9), path9, RETURN_FALSE);
96653
+ var isPathValid = (path10) => checkPath(path10 && checkPath.convert(path10), path10, RETURN_FALSE);
96524
96654
  factory.isPathValid = isPathValid;
96525
96655
  factory.default = factory;
96526
96656
  module.exports = factory;
@@ -96528,7 +96658,7 @@ var require_ignore = __commonJS((exports, module) => {
96528
96658
  const makePosix = (str) => /^\\\\\?\\/.test(str) || /["<>|\u0000-\u001F]+/u.test(str) ? str : str.replace(/\\/g, "/");
96529
96659
  checkPath.convert = makePosix;
96530
96660
  const REGIX_IS_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\//i;
96531
- checkPath.isNotRelative = (path9) => REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path9) || isNotRelative(path9);
96661
+ checkPath.isNotRelative = (path10) => REGIX_IS_WINDOWS_PATH_ABSOLUTE.test(path10) || isNotRelative(path10);
96532
96662
  }
96533
96663
  });
96534
96664
 
@@ -96565,7 +96695,7 @@ var require_lib3 = __commonJS((exports, module) => {
96565
96695
  // ../../node_modules/.bun/diff3@0.0.3/node_modules/diff3/onp.js
96566
96696
  var require_onp = __commonJS((exports, module) => {
96567
96697
  module.exports = function(a_, b_) {
96568
- var a = a_, b = b_, m = a.length, n = b.length, reverse = false, ed2 = null, offset = m + 1, path9 = [], pathposi = [], ses = [], lcs = "", SES_DELETE = -1, SES_COMMON = 0, SES_ADD = 1;
96698
+ var a = a_, b = b_, m = a.length, n = b.length, reverse = false, ed2 = null, offset = m + 1, path10 = [], pathposi = [], ses = [], lcs = "", SES_DELETE = -1, SES_COMMON = 0, SES_ADD = 1;
96569
96699
  var tmp1, tmp2;
96570
96700
  var init = function() {
96571
96701
  if (m >= n) {
@@ -96595,9 +96725,9 @@ var require_onp = __commonJS((exports, module) => {
96595
96725
  var snake = function(k, p10, pp2) {
96596
96726
  var r, x, y;
96597
96727
  if (p10 > pp2) {
96598
- r = path9[k - 1 + offset];
96728
+ r = path10[k - 1 + offset];
96599
96729
  } else {
96600
- r = path9[k + 1 + offset];
96730
+ r = path10[k + 1 + offset];
96601
96731
  }
96602
96732
  y = Math.max(p10, pp2);
96603
96733
  x = y - k;
@@ -96605,7 +96735,7 @@ var require_onp = __commonJS((exports, module) => {
96605
96735
  ++x;
96606
96736
  ++y;
96607
96737
  }
96608
- path9[k + offset] = pathposi.length;
96738
+ path10[k + offset] = pathposi.length;
96609
96739
  pathposi[pathposi.length] = new P(x, y, r);
96610
96740
  return y;
96611
96741
  };
@@ -96663,7 +96793,7 @@ var require_onp = __commonJS((exports, module) => {
96663
96793
  fp2 = {};
96664
96794
  for (i = 0;i < size; ++i) {
96665
96795
  fp2[i] = -1;
96666
- path9[i] = -1;
96796
+ path10[i] = -1;
96667
96797
  }
96668
96798
  p10 = -1;
96669
96799
  do {
@@ -96677,7 +96807,7 @@ var require_onp = __commonJS((exports, module) => {
96677
96807
  fp2[delta + offset] = snake(delta, fp2[delta - 1 + offset] + 1, fp2[delta + 1 + offset]);
96678
96808
  } while (fp2[delta + offset] !== n);
96679
96809
  ed2 = delta + 2 * p10;
96680
- r = path9[delta + offset];
96810
+ r = path10[delta + offset];
96681
96811
  epc = [];
96682
96812
  while (r !== -1) {
96683
96813
  epc[epc.length] = new P(pathposi[r].x, pathposi[r].y, null);
@@ -97307,17 +97437,17 @@ If you're a developer and you believe this is a bug in isomorphic-git, please fi
97307
97437
  const length = Math.ceil((62 + bpath.length + 1) / 8) * 8;
97308
97438
  const written = Buffer.alloc(length);
97309
97439
  const writer = new BufferCursor(written);
97310
- const stat5 = normalizeStats(entry);
97311
- writer.writeUInt32BE(stat5.ctimeSeconds);
97312
- writer.writeUInt32BE(stat5.ctimeNanoseconds);
97313
- writer.writeUInt32BE(stat5.mtimeSeconds);
97314
- writer.writeUInt32BE(stat5.mtimeNanoseconds);
97315
- writer.writeUInt32BE(stat5.dev);
97316
- writer.writeUInt32BE(stat5.ino);
97317
- writer.writeUInt32BE(stat5.mode);
97318
- writer.writeUInt32BE(stat5.uid);
97319
- writer.writeUInt32BE(stat5.gid);
97320
- writer.writeUInt32BE(stat5.size);
97440
+ const stat6 = normalizeStats(entry);
97441
+ writer.writeUInt32BE(stat6.ctimeSeconds);
97442
+ writer.writeUInt32BE(stat6.ctimeNanoseconds);
97443
+ writer.writeUInt32BE(stat6.mtimeSeconds);
97444
+ writer.writeUInt32BE(stat6.mtimeNanoseconds);
97445
+ writer.writeUInt32BE(stat6.dev);
97446
+ writer.writeUInt32BE(stat6.ino);
97447
+ writer.writeUInt32BE(stat6.mode);
97448
+ writer.writeUInt32BE(stat6.uid);
97449
+ writer.writeUInt32BE(stat6.gid);
97450
+ writer.writeUInt32BE(stat6.size);
97321
97451
  writer.write(entry.oid, 20, "hex");
97322
97452
  writer.writeUInt16BE(renderCacheEntryFlags(entry));
97323
97453
  writer.write(entry.path, bpath.length, "utf8");
@@ -97362,13 +97492,13 @@ If you're a developer and you believe this is a bug in isomorphic-git, please fi
97362
97492
  };
97363
97493
  }
97364
97494
  async function updateCachedIndexFile(fs5, filepath, cache2) {
97365
- const [stat5, rawIndexFile] = await Promise.all([
97495
+ const [stat6, rawIndexFile] = await Promise.all([
97366
97496
  fs5.lstat(filepath),
97367
97497
  fs5.read(filepath)
97368
97498
  ]);
97369
97499
  const index2 = await GitIndex.from(rawIndexFile);
97370
97500
  cache2.map.set(filepath, index2);
97371
- cache2.stats.set(filepath, stat5);
97501
+ cache2.stats.set(filepath, stat6);
97372
97502
  }
97373
97503
  async function isIndexStale(fs5, filepath, cache2) {
97374
97504
  const savedStats = cache2.stats.get(filepath);
@@ -97412,20 +97542,20 @@ If you're a developer and you believe this is a bug in isomorphic-git, please fi
97412
97542
  return result;
97413
97543
  }
97414
97544
  }
97415
- function basename3(path9) {
97416
- const last = Math.max(path9.lastIndexOf("/"), path9.lastIndexOf("\\"));
97545
+ function basename3(path10) {
97546
+ const last = Math.max(path10.lastIndexOf("/"), path10.lastIndexOf("\\"));
97417
97547
  if (last > -1) {
97418
- path9 = path9.slice(last + 1);
97548
+ path10 = path10.slice(last + 1);
97419
97549
  }
97420
- return path9;
97550
+ return path10;
97421
97551
  }
97422
- function dirname6(path9) {
97423
- const last = Math.max(path9.lastIndexOf("/"), path9.lastIndexOf("\\"));
97552
+ function dirname6(path10) {
97553
+ const last = Math.max(path10.lastIndexOf("/"), path10.lastIndexOf("\\"));
97424
97554
  if (last === -1)
97425
97555
  return ".";
97426
97556
  if (last === 0)
97427
97557
  return "/";
97428
- return path9.slice(0, last);
97558
+ return path10.slice(0, last);
97429
97559
  }
97430
97560
  function flatFileListToDirectoryStructure(files) {
97431
97561
  const inodes = new Map;
@@ -97763,15 +97893,15 @@ If you're a developer and you believe this is a bug in isomorphic-git, please fi
97763
97893
  * SPDX-License-Identifier: LGPL-3.0-or-later
97764
97894
  * Copyright (c) James Prevett and other ZenFS contributors.
97765
97895
  */
97766
- function normalizeString(path9, aar) {
97896
+ function normalizeString(path10, aar) {
97767
97897
  let res = "";
97768
97898
  let lastSegmentLength = 0;
97769
97899
  let lastSlash = -1;
97770
97900
  let dots = 0;
97771
97901
  let char = "\x00";
97772
- for (let i = 0;i <= path9.length; ++i) {
97773
- if (i < path9.length)
97774
- char = path9[i];
97902
+ for (let i = 0;i <= path10.length; ++i) {
97903
+ if (i < path10.length)
97904
+ char = path10[i];
97775
97905
  else if (char === "/")
97776
97906
  break;
97777
97907
  else
@@ -97805,9 +97935,9 @@ If you're a developer and you believe this is a bug in isomorphic-git, please fi
97805
97935
  }
97806
97936
  } else {
97807
97937
  if (res.length > 0)
97808
- res += "/" + path9.slice(lastSlash + 1, i);
97938
+ res += "/" + path10.slice(lastSlash + 1, i);
97809
97939
  else
97810
- res = path9.slice(lastSlash + 1, i);
97940
+ res = path10.slice(lastSlash + 1, i);
97811
97941
  lastSegmentLength = i - lastSlash - 1;
97812
97942
  }
97813
97943
  lastSlash = i;
@@ -97820,20 +97950,20 @@ If you're a developer and you believe this is a bug in isomorphic-git, please fi
97820
97950
  }
97821
97951
  return res;
97822
97952
  }
97823
- function normalize2(path9) {
97824
- if (!path9.length)
97953
+ function normalize2(path10) {
97954
+ if (!path10.length)
97825
97955
  return ".";
97826
- const isAbsolute2 = path9[0] === "/";
97827
- const trailingSeparator = path9.at(-1) === "/";
97828
- path9 = normalizeString(path9, !isAbsolute2);
97829
- if (!path9.length) {
97956
+ const isAbsolute2 = path10[0] === "/";
97957
+ const trailingSeparator = path10.at(-1) === "/";
97958
+ path10 = normalizeString(path10, !isAbsolute2);
97959
+ if (!path10.length) {
97830
97960
  if (isAbsolute2)
97831
97961
  return "/";
97832
97962
  return trailingSeparator ? "./" : ".";
97833
97963
  }
97834
97964
  if (trailingSeparator)
97835
- path9 += "/";
97836
- return isAbsolute2 ? `/${path9}` : path9;
97965
+ path10 += "/";
97966
+ return isAbsolute2 ? `/${path10}` : path10;
97837
97967
  }
97838
97968
  function join9(...args) {
97839
97969
  if (args.length === 0)
@@ -97941,8 +98071,8 @@ If you're a developer and you believe this is a bug in isomorphic-git, please fi
97941
98071
  var getPath = (section, subsection, name) => {
97942
98072
  return [lower(section), subsection, lower(name)].filter((a) => a != null).join(".");
97943
98073
  };
97944
- var normalizePath = (path9) => {
97945
- const pathSegments = path9.split(".");
98074
+ var normalizePath = (path10) => {
98075
+ const pathSegments = path10.split(".");
97946
98076
  const section = pathSegments.shift();
97947
98077
  const name = pathSegments.pop();
97948
98078
  const subsection = pathSegments.length ? pathSegments.join(".") : undefined;
@@ -97981,23 +98111,23 @@ If you're a developer and you believe this is a bug in isomorphic-git, please fi
97981
98111
  [name, value] = extractedVariable;
97982
98112
  }
97983
98113
  }
97984
- const path9 = getPath(section, subsection, name);
97985
- return { line, isSection, section, subsection, name, value, path: path9 };
98114
+ const path10 = getPath(section, subsection, name);
98115
+ return { line, isSection, section, subsection, name, value, path: path10 };
97986
98116
  }) : [];
97987
98117
  }
97988
98118
  static from(text4) {
97989
98119
  return new GitConfig(text4);
97990
98120
  }
97991
- async get(path9, getall = false) {
97992
- const normalizedPath = normalizePath(path9).path;
98121
+ async get(path10, getall = false) {
98122
+ const normalizedPath = normalizePath(path10).path;
97993
98123
  const allValues = this.parsedConfig.filter((config) => config.path === normalizedPath).map(({ section, name, value }) => {
97994
98124
  const fn2 = schema[section] && schema[section][name];
97995
98125
  return fn2 ? fn2(value) : value;
97996
98126
  });
97997
98127
  return getall ? allValues : allValues.pop();
97998
98128
  }
97999
- async getall(path9) {
98000
- return this.get(path9, true);
98129
+ async getall(path10) {
98130
+ return this.get(path10, true);
98001
98131
  }
98002
98132
  async getSubsections(section) {
98003
98133
  return this.parsedConfig.filter((config) => config.isSection && config.section === section).map((config) => config.subsection);
@@ -98005,10 +98135,10 @@ If you're a developer and you believe this is a bug in isomorphic-git, please fi
98005
98135
  async deleteSection(section, subsection) {
98006
98136
  this.parsedConfig = this.parsedConfig.filter((config) => !(config.section === section && config.subsection === subsection));
98007
98137
  }
98008
- async append(path9, value) {
98009
- return this.set(path9, value, true);
98138
+ async append(path10, value) {
98139
+ return this.set(path10, value, true);
98010
98140
  }
98011
- async set(path9, value, append = false) {
98141
+ async set(path10, value, append = false) {
98012
98142
  const {
98013
98143
  section,
98014
98144
  subsection,
@@ -98016,7 +98146,7 @@ If you're a developer and you believe this is a bug in isomorphic-git, please fi
98016
98146
  path: normalizedPath,
98017
98147
  sectionPath,
98018
98148
  isSection
98019
- } = normalizePath(path9);
98149
+ } = normalizePath(path10);
98020
98150
  const configIndex = findLastIndex(this.parsedConfig, (config) => config.path === normalizedPath);
98021
98151
  if (value == null) {
98022
98152
  if (configIndex !== -1) {
@@ -98389,13 +98519,13 @@ If you're a developer and you believe this is a bug in isomorphic-git, please fi
98389
98519
  if (mode === "40000")
98390
98520
  mode = "040000";
98391
98521
  const type = mode2type$1(mode);
98392
- const path9 = buffer.slice(space + 1, nullchar).toString("utf8");
98393
- if (path9.includes("\\") || path9.includes("/")) {
98394
- throw new UnsafeFilepathError(path9);
98522
+ const path10 = buffer.slice(space + 1, nullchar).toString("utf8");
98523
+ if (path10.includes("\\") || path10.includes("/")) {
98524
+ throw new UnsafeFilepathError(path10);
98395
98525
  }
98396
98526
  const oid = buffer.slice(nullchar + 1, nullchar + 21).toString("hex");
98397
98527
  cursor = nullchar + 21;
98398
- _entries.push({ mode, path: path9, oid, type });
98528
+ _entries.push({ mode, path: path10, oid, type });
98399
98529
  }
98400
98530
  return _entries;
98401
98531
  }
@@ -98450,10 +98580,10 @@ If you're a developer and you believe this is a bug in isomorphic-git, please fi
98450
98580
  return Buffer.concat(entries.map((entry) => {
98451
98581
  const mode = Buffer.from(entry.mode.replace(/^0/, ""));
98452
98582
  const space = Buffer.from(" ");
98453
- const path9 = Buffer.from(entry.path, "utf8");
98583
+ const path10 = Buffer.from(entry.path, "utf8");
98454
98584
  const nullchar = Buffer.from([0]);
98455
98585
  const oid = Buffer.from(entry.oid, "hex");
98456
- return Buffer.concat([mode, space, path9, nullchar, oid]);
98586
+ return Buffer.concat([mode, space, path10, nullchar, oid]);
98457
98587
  }));
98458
98588
  }
98459
98589
  entries() {
@@ -100035,21 +100165,21 @@ gpgsig`));
100035
100165
  async stat(entry) {
100036
100166
  if (entry._stat === false) {
100037
100167
  const { fs: fs5, dir } = this;
100038
- let stat5 = await fs5.lstat(`${dir}/${entry._fullpath}`);
100039
- if (!stat5) {
100168
+ let stat6 = await fs5.lstat(`${dir}/${entry._fullpath}`);
100169
+ if (!stat6) {
100040
100170
  throw new Error(`ENOENT: no such file or directory, lstat '${entry._fullpath}'`);
100041
100171
  }
100042
- let type = stat5.isDirectory() ? "tree" : "blob";
100043
- if (type === "blob" && !stat5.isFile() && !stat5.isSymbolicLink()) {
100172
+ let type = stat6.isDirectory() ? "tree" : "blob";
100173
+ if (type === "blob" && !stat6.isFile() && !stat6.isSymbolicLink()) {
100044
100174
  type = "special";
100045
100175
  }
100046
100176
  entry._type = type;
100047
- stat5 = normalizeStats(stat5);
100048
- entry._mode = stat5.mode;
100049
- if (stat5.size === -1 && entry._actualSize) {
100050
- stat5.size = entry._actualSize;
100177
+ stat6 = normalizeStats(stat6);
100178
+ entry._mode = stat6.mode;
100179
+ if (stat6.size === -1 && entry._actualSize) {
100180
+ stat6.size = entry._actualSize;
100051
100181
  }
100052
- entry._stat = stat5;
100182
+ entry._stat = stat6;
100053
100183
  }
100054
100184
  return entry._stat;
100055
100185
  }
@@ -100237,10 +100367,10 @@ gpgsig`));
100237
100367
  } else if (entries.length) {
100238
100368
  await Promise.all(entries.map((entry) => {
100239
100369
  const subpath = join9(filepath, entry);
100240
- return fs5.lstat(subpath).then((stat5) => {
100241
- if (!stat5)
100370
+ return fs5.lstat(subpath).then((stat6) => {
100371
+ if (!stat6)
100242
100372
  return;
100243
- return stat5.isDirectory() ? rmRecursive(fs5, subpath) : fs5.rm(subpath);
100373
+ return stat6.isDirectory() ? rmRecursive(fs5, subpath) : fs5.rm(subpath);
100244
100374
  });
100245
100375
  })).then(() => fs5.rmdir(filepath));
100246
100376
  } else {
@@ -100510,13 +100640,13 @@ gpgsig`));
100510
100640
  dir,
100511
100641
  gitdir: updatedGitdir,
100512
100642
  trees,
100513
- map: async function(path9, [head, workdir, index2]) {
100643
+ map: async function(path10, [head, workdir, index2]) {
100514
100644
  const staged = !await modified(workdir, index2);
100515
- const unmerged = unmergedPaths.includes(path9);
100645
+ const unmerged = unmergedPaths.includes(path10);
100516
100646
  const unmodified = !await modified(index2, head);
100517
100647
  if (staged || unmerged) {
100518
100648
  return head ? {
100519
- path: path9,
100649
+ path: path10,
100520
100650
  mode: await head.mode(),
100521
100651
  oid: await head.oid(),
100522
100652
  type: await head.type(),
@@ -100526,7 +100656,7 @@ gpgsig`));
100526
100656
  if (unmodified)
100527
100657
  return false;
100528
100658
  else
100529
- throw new IndexResetError(path9);
100659
+ throw new IndexResetError(path10);
100530
100660
  }
100531
100661
  });
100532
100662
  await GitIndexManager.acquire({ fs: fs5, gitdir: updatedGitdir, cache: cache2 }, async function(index2) {
@@ -100772,9 +100902,9 @@ gpgsig`));
100772
100902
  const fulfilledPromises = settledPromises.filter((settle) => settle.status === "fulfilled" && settle.value).map((settle) => settle.value);
100773
100903
  return fulfilledPromises;
100774
100904
  }
100775
- async function _getConfig({ fs: fs5, gitdir, path: path9 }) {
100905
+ async function _getConfig({ fs: fs5, gitdir, path: path10 }) {
100776
100906
  const config = await GitConfigManager.get({ fs: fs5, gitdir });
100777
- return config.get(path9);
100907
+ return config.get(path10);
100778
100908
  }
100779
100909
  function assignDefined(target, ...sources) {
100780
100910
  for (const source of sources) {
@@ -102064,14 +102194,14 @@ gpgsig`));
102064
102194
  gitdir,
102065
102195
  trees: [ourTree, baseTree, theirTree],
102066
102196
  map: async function(filepath, [ours, base, theirs]) {
102067
- const path9 = basename3(filepath);
102197
+ const path10 = basename3(filepath);
102068
102198
  const ourChange = await modified(ours, base);
102069
102199
  const theirChange = await modified(theirs, base);
102070
102200
  switch (`${ourChange}-${theirChange}`) {
102071
102201
  case "false-false": {
102072
102202
  return {
102073
102203
  mode: await base.mode(),
102074
- path: path9,
102204
+ path: path10,
102075
102205
  oid: await base.oid(),
102076
102206
  type: await base.type()
102077
102207
  };
@@ -102080,14 +102210,14 @@ gpgsig`));
102080
102210
  if (!theirs && await ours.type() === "tree") {
102081
102211
  return {
102082
102212
  mode: await ours.mode(),
102083
- path: path9,
102213
+ path: path10,
102084
102214
  oid: await ours.oid(),
102085
102215
  type: await ours.type()
102086
102216
  };
102087
102217
  }
102088
102218
  return theirs ? {
102089
102219
  mode: await theirs.mode(),
102090
- path: path9,
102220
+ path: path10,
102091
102221
  oid: await theirs.oid(),
102092
102222
  type: await theirs.type()
102093
102223
  } : undefined;
@@ -102096,14 +102226,14 @@ gpgsig`));
102096
102226
  if (!ours && await theirs.type() === "tree") {
102097
102227
  return {
102098
102228
  mode: await theirs.mode(),
102099
- path: path9,
102229
+ path: path10,
102100
102230
  oid: await theirs.oid(),
102101
102231
  type: await theirs.type()
102102
102232
  };
102103
102233
  }
102104
102234
  return ours ? {
102105
102235
  mode: await ours.mode(),
102106
- path: path9,
102236
+ path: path10,
102107
102237
  oid: await ours.oid(),
102108
102238
  type: await ours.type()
102109
102239
  } : undefined;
@@ -102112,7 +102242,7 @@ gpgsig`));
102112
102242
  if (ours && theirs && await ours.type() === "tree" && await theirs.type() === "tree") {
102113
102243
  return {
102114
102244
  mode: await ours.mode(),
102115
- path: path9,
102245
+ path: path10,
102116
102246
  oid: await ours.oid(),
102117
102247
  type: "tree"
102118
102248
  };
@@ -102121,7 +102251,7 @@ gpgsig`));
102121
102251
  return mergeBlobs({
102122
102252
  fs: fs5,
102123
102253
  gitdir,
102124
- path: path9,
102254
+ path: path10,
102125
102255
  ours,
102126
102256
  base,
102127
102257
  theirs,
@@ -102167,7 +102297,7 @@ gpgsig`));
102167
102297
  mode: await theirs.mode(),
102168
102298
  oid: await theirs.oid(),
102169
102299
  type: "blob",
102170
- path: path9
102300
+ path: path10
102171
102301
  };
102172
102302
  }
102173
102303
  if (base && ours && !theirs && await base.type() === "blob" && await ours.type() === "blob") {
@@ -102184,7 +102314,7 @@ gpgsig`));
102184
102314
  mode: await ours.mode(),
102185
102315
  oid: await ours.oid(),
102186
102316
  type: "blob",
102187
- path: path9
102317
+ path: path10
102188
102318
  };
102189
102319
  }
102190
102320
  if (base && !ours && !theirs && (await base.type() === "blob" || await base.type() === "tree")) {
@@ -102224,11 +102354,11 @@ gpgsig`));
102224
102354
  gitdir,
102225
102355
  trees: [TREE({ ref: results.oid })],
102226
102356
  map: async function(filepath, [entry]) {
102227
- const path9 = `${dir}/${filepath}`;
102357
+ const path10 = `${dir}/${filepath}`;
102228
102358
  if (await entry.type() === "blob") {
102229
102359
  const mode = await entry.mode();
102230
102360
  const content4 = new TextDecoder().decode(await entry.content());
102231
- await fs5.write(path9, content4, { mode });
102361
+ await fs5.write(path10, content4, { mode });
102232
102362
  }
102233
102363
  return true;
102234
102364
  }
@@ -102241,7 +102371,7 @@ gpgsig`));
102241
102371
  async function mergeBlobs({
102242
102372
  fs: fs5,
102243
102373
  gitdir,
102244
- path: path9,
102374
+ path: path10,
102245
102375
  ours,
102246
102376
  base,
102247
102377
  theirs,
@@ -102264,19 +102394,19 @@ gpgsig`));
102264
102394
  if (await ours.oid() === await theirs.oid()) {
102265
102395
  return {
102266
102396
  cleanMerge: true,
102267
- mergeResult: { mode, path: path9, oid: await ours.oid(), type }
102397
+ mergeResult: { mode, path: path10, oid: await ours.oid(), type }
102268
102398
  };
102269
102399
  }
102270
102400
  if (await ours.oid() === baseOid) {
102271
102401
  return {
102272
102402
  cleanMerge: true,
102273
- mergeResult: { mode, path: path9, oid: await theirs.oid(), type }
102403
+ mergeResult: { mode, path: path10, oid: await theirs.oid(), type }
102274
102404
  };
102275
102405
  }
102276
102406
  if (await theirs.oid() === baseOid) {
102277
102407
  return {
102278
102408
  cleanMerge: true,
102279
- mergeResult: { mode, path: path9, oid: await ours.oid(), type }
102409
+ mergeResult: { mode, path: path10, oid: await ours.oid(), type }
102280
102410
  };
102281
102411
  }
102282
102412
  const ourContent = Buffer.from(await ours.content()).toString("utf8");
@@ -102284,7 +102414,7 @@ gpgsig`));
102284
102414
  const { mergedText, cleanMerge } = await mergeDriver({
102285
102415
  branches: [baseName, ourName, theirName],
102286
102416
  contents: [baseContent, ourContent, theirContent],
102287
- path: path9
102417
+ path: path10
102288
102418
  });
102289
102419
  const oid = await _writeObject({
102290
102420
  fs: fs5,
@@ -102293,7 +102423,7 @@ gpgsig`));
102293
102423
  object: Buffer.from(mergedText, "utf8"),
102294
102424
  dryRun
102295
102425
  });
102296
- return { cleanMerge, mergeResult: { mode, path: path9, oid, type } };
102426
+ return { cleanMerge, mergeResult: { mode, path: path10, oid, type } };
102297
102427
  }
102298
102428
  var _TreeMap = {
102299
102429
  stage: STAGE,
@@ -102997,7 +103127,7 @@ gpgsig`));
102997
103127
  const remoteHelpers = new Map;
102998
103128
  remoteHelpers.set("http", GitRemoteHTTP);
102999
103129
  remoteHelpers.set("https", GitRemoteHTTP);
103000
- const parts = parseRemoteUrl({ url });
103130
+ const parts = parseRemoteUrl2({ url });
103001
103131
  if (!parts) {
103002
103132
  throw new UrlParseError(url);
103003
103133
  }
@@ -103007,7 +103137,7 @@ gpgsig`));
103007
103137
  throw new UnknownTransportError(url, parts.transport, parts.transport === "ssh" ? translateSSHtoHTTP(url) : undefined);
103008
103138
  }
103009
103139
  }
103010
- function parseRemoteUrl({ url }) {
103140
+ function parseRemoteUrl2({ url }) {
103011
103141
  if (url.startsWith("git@")) {
103012
103142
  return {
103013
103143
  transport: "ssh",
@@ -104464,43 +104594,43 @@ gpgsig`));
104464
104594
  throw err;
104465
104595
  }
104466
104596
  }
104467
- async function getConfig({ fs: fs5, dir, gitdir = join9(dir, ".git"), path: path9 }) {
104597
+ async function getConfig({ fs: fs5, dir, gitdir = join9(dir, ".git"), path: path10 }) {
104468
104598
  try {
104469
104599
  assertParameter("fs", fs5);
104470
104600
  assertParameter("gitdir", gitdir);
104471
- assertParameter("path", path9);
104601
+ assertParameter("path", path10);
104472
104602
  const fsp3 = new FileSystem(fs5);
104473
104603
  const updatedGitdir = await discoverGitdir({ fsp: fsp3, dotgit: gitdir });
104474
104604
  return await _getConfig({
104475
104605
  fs: fsp3,
104476
104606
  gitdir: updatedGitdir,
104477
- path: path9
104607
+ path: path10
104478
104608
  });
104479
104609
  } catch (err) {
104480
104610
  err.caller = "git.getConfig";
104481
104611
  throw err;
104482
104612
  }
104483
104613
  }
104484
- async function _getConfigAll({ fs: fs5, gitdir, path: path9 }) {
104614
+ async function _getConfigAll({ fs: fs5, gitdir, path: path10 }) {
104485
104615
  const config = await GitConfigManager.get({ fs: fs5, gitdir });
104486
- return config.getall(path9);
104616
+ return config.getall(path10);
104487
104617
  }
104488
104618
  async function getConfigAll({
104489
104619
  fs: fs5,
104490
104620
  dir,
104491
104621
  gitdir = join9(dir, ".git"),
104492
- path: path9
104622
+ path: path10
104493
104623
  }) {
104494
104624
  try {
104495
104625
  assertParameter("fs", fs5);
104496
104626
  assertParameter("gitdir", gitdir);
104497
- assertParameter("path", path9);
104627
+ assertParameter("path", path10);
104498
104628
  const fsp3 = new FileSystem(fs5);
104499
104629
  const updatedGitdir = await discoverGitdir({ fsp: fsp3, dotgit: gitdir });
104500
104630
  return await _getConfigAll({
104501
104631
  fs: fsp3,
104502
104632
  gitdir: updatedGitdir,
104503
- path: path9
104633
+ path: path10
104504
104634
  });
104505
104635
  } catch (err) {
104506
104636
  err.caller = "git.getConfigAll";
@@ -106529,21 +106659,21 @@ gpgsig`));
106529
106659
  fs: _fs,
106530
106660
  dir,
106531
106661
  gitdir = join9(dir, ".git"),
106532
- path: path9,
106662
+ path: path10,
106533
106663
  value,
106534
106664
  append = false
106535
106665
  }) {
106536
106666
  try {
106537
106667
  assertParameter("fs", _fs);
106538
106668
  assertParameter("gitdir", gitdir);
106539
- assertParameter("path", path9);
106669
+ assertParameter("path", path10);
106540
106670
  const fs5 = new FileSystem(_fs);
106541
106671
  const updatedGitdir = await discoverGitdir({ fsp: fs5, dotgit: gitdir });
106542
106672
  const config = await GitConfigManager.get({ fs: fs5, gitdir: updatedGitdir });
106543
106673
  if (append) {
106544
- await config.append(path9, value);
106674
+ await config.append(path10, value);
106545
106675
  } else {
106546
- await config.set(path9, value);
106676
+ await config.set(path10, value);
106547
106677
  }
106548
106678
  await GitConfigManager.save({ fs: fs5, gitdir: updatedGitdir, config });
106549
106679
  } catch (err) {
@@ -106837,9 +106967,9 @@ gpgsig`));
106837
106967
  const stashMgr = new GitStashManager({ fs: fs5, dir, gitdir });
106838
106968
  const stashRefPath = [stashMgr.refStashPath, stashMgr.refLogsStashPath];
106839
106969
  await acquireLock$1(stashRefPath, async () => {
106840
- await Promise.all(stashRefPath.map(async (path9) => {
106841
- if (await fs5.exists(path9)) {
106842
- return fs5.rm(path9);
106970
+ await Promise.all(stashRefPath.map(async (path10) => {
106971
+ if (await fs5.exists(path10)) {
106972
+ return fs5.rm(path10);
106843
106973
  }
106844
106974
  }));
106845
106975
  });
@@ -106992,13 +107122,13 @@ gpgsig`));
106992
107122
  throw err;
106993
107123
  }
106994
107124
  }
106995
- async function getOidAtPath({ fs: fs5, cache: cache2, gitdir: updatedGitdir, tree, path: path9 }) {
106996
- if (typeof path9 === "string")
106997
- path9 = path9.split("/");
106998
- const dirname7 = path9.shift();
107125
+ async function getOidAtPath({ fs: fs5, cache: cache2, gitdir: updatedGitdir, tree, path: path10 }) {
107126
+ if (typeof path10 === "string")
107127
+ path10 = path10.split("/");
107128
+ const dirname7 = path10.shift();
106999
107129
  for (const entry of tree) {
107000
107130
  if (entry.path === dirname7) {
107001
- if (path9.length === 0) {
107131
+ if (path10.length === 0) {
107002
107132
  return entry.oid;
107003
107133
  }
107004
107134
  const { type, object } = await _readObject({
@@ -107009,10 +107139,10 @@ gpgsig`));
107009
107139
  });
107010
107140
  if (type === "tree") {
107011
107141
  const tree2 = GitTree.from(object);
107012
- return getOidAtPath({ fs: fs5, cache: cache2, gitdir: updatedGitdir, tree: tree2, path: path9 });
107142
+ return getOidAtPath({ fs: fs5, cache: cache2, gitdir: updatedGitdir, tree: tree2, path: path10 });
107013
107143
  }
107014
107144
  if (type === "blob") {
107015
- throw new ObjectTypeError(entry.oid, type, "blob", path9.join("/"));
107145
+ throw new ObjectTypeError(entry.oid, type, "blob", path10.join("/"));
107016
107146
  }
107017
107147
  }
107018
107148
  }
@@ -107597,11 +107727,33 @@ gpgsig`));
107597
107727
  // ../lib/src/lib/source-provider.ts
107598
107728
  var exports_source_provider = {};
107599
107729
  __export(exports_source_provider, {
107730
+ withRepoLock: () => withRepoLock,
107731
+ snapshotWorkingTreeUnlocked: () => snapshotWorkingTreeUnlocked,
107732
+ restoreVersionWithBackup: () => restoreVersionWithBackup,
107600
107733
  providerFor: () => providerFor,
107601
- gitDirFor: () => gitDirFor
107734
+ isNoChangesError: () => isNoChangesError,
107735
+ isGitInternalPath: () => isGitInternalPath,
107736
+ hasPendingChanges: () => hasPendingChanges,
107737
+ gitDirFor: () => gitDirFor,
107738
+ gitAuthor: () => gitAuthor,
107739
+ autoSnapshotDelayMs: () => autoSnapshotDelayMs,
107740
+ RESTORE_BACKUP_MESSAGE: () => RESTORE_BACKUP_MESSAGE,
107741
+ AUTO_SNAPSHOT_MIN_MINUTES: () => AUTO_SNAPSHOT_MIN_MINUTES,
107742
+ AUTO_SNAPSHOT_MESSAGE: () => AUTO_SNAPSHOT_MESSAGE,
107743
+ AUTO_SNAPSHOT_MAX_MINUTES: () => AUTO_SNAPSHOT_MAX_MINUTES,
107744
+ AUTO_SNAPSHOT_DEFAULT_MINUTES: () => AUTO_SNAPSHOT_DEFAULT_MINUTES
107602
107745
  });
107603
107746
  import * as fs5 from "node:fs";
107604
- import path9 from "node:path";
107747
+ import path10 from "node:path";
107748
+ function withRepoLock(projectDir, fn2) {
107749
+ const key = path10.resolve(projectDir);
107750
+ const prev = repoQueues.get(key) ?? Promise.resolve();
107751
+ const run2 = prev.then(fn2, fn2);
107752
+ repoQueues.set(key, run2.catch(() => {
107753
+ return;
107754
+ }));
107755
+ return run2;
107756
+ }
107605
107757
  function gitAuthor(name) {
107606
107758
  const n = (name ?? "").trim();
107607
107759
  return { name: n || DEFAULT_AUTHOR, email: DEFAULT_EMAIL };
@@ -107610,6 +107762,10 @@ async function stageAll(dir) {
107610
107762
  const status = await import_isomorphic_git.default.statusMatrix({ fs: fs5, dir });
107611
107763
  await Promise.all(status.map(([filepath, , worktreeStatus]) => worktreeStatus === 0 ? import_isomorphic_git.default.remove({ fs: fs5, dir, filepath }) : import_isomorphic_git.default.add({ fs: fs5, dir, filepath })));
107612
107764
  }
107765
+ async function hasPendingChanges(dir) {
107766
+ const status = await import_isomorphic_git.default.statusMatrix({ fs: fs5, dir });
107767
+ return status.some(([, head, worktree, stage]) => !(head === 1 && worktree === 1 && stage === 1));
107768
+ }
107613
107769
 
107614
107770
  class LocalFolderSourceProvider {
107615
107771
  source;
@@ -107618,22 +107774,27 @@ class LocalFolderSourceProvider {
107618
107774
  this.source = source;
107619
107775
  this.capabilities = capabilitiesFor(source);
107620
107776
  }
107621
- async initVersionHistory(options) {
107777
+ initVersionHistory(options) {
107778
+ if (this.source.type === "local-folder" && this.source.enclosingRepoDir !== undefined) {
107779
+ return Promise.reject(new Error("This folder is already inside a versioned project, so print-md " + "won't create a separate history here."));
107780
+ }
107622
107781
  const dir = options.projectDir;
107623
- await import_isomorphic_git.default.init({ fs: fs5, dir, defaultBranch: DEFAULT_BRANCH });
107624
- await stageAll(dir);
107625
- await import_isomorphic_git.default.commit({
107626
- fs: fs5,
107627
- dir,
107628
- message: options.initialMessage?.trim() || "Created project",
107629
- author: gitAuthor(options.authorName)
107782
+ return withRepoLock(dir, async () => {
107783
+ await import_isomorphic_git.default.init({ fs: fs5, dir, defaultBranch: DEFAULT_BRANCH });
107784
+ await stageAll(dir);
107785
+ await import_isomorphic_git.default.commit({
107786
+ fs: fs5,
107787
+ dir,
107788
+ message: options.initialMessage?.trim() || "Created project",
107789
+ author: gitAuthor(options.authorName)
107790
+ });
107791
+ return {
107792
+ type: "local-git-folder",
107793
+ path: dir,
107794
+ hasRemote: false,
107795
+ branch: DEFAULT_BRANCH
107796
+ };
107630
107797
  });
107631
- return {
107632
- type: "local-git-folder",
107633
- path: dir,
107634
- hasRemote: false,
107635
- branch: DEFAULT_BRANCH
107636
- };
107637
107798
  }
107638
107799
  snapshot() {
107639
107800
  return Promise.reject(new Error("This project has no version history yet. Enable version history first."));
@@ -107654,42 +107815,39 @@ class LocalGitSourceProvider {
107654
107815
  this.capabilities = capabilitiesFor(source);
107655
107816
  }
107656
107817
  async initVersionHistory(options) {
107657
- await this.snapshot({
107658
- projectDir: options.projectDir,
107659
- message: options.initialMessage?.trim() || "Created project",
107660
- authorName: options.authorName
107661
- }).catch(() => {
107662
- return;
107663
- });
107818
+ try {
107819
+ await this.snapshot({
107820
+ projectDir: options.projectDir,
107821
+ message: options.initialMessage?.trim() || "Created project",
107822
+ authorName: options.authorName
107823
+ });
107824
+ } catch (e) {
107825
+ if (!isNoChangesError(e))
107826
+ throw e;
107827
+ }
107664
107828
  return this.source;
107665
107829
  }
107666
- async snapshot(options) {
107667
- const dir = options.projectDir;
107668
- await stageAll(dir);
107669
- const author = gitAuthor(options.authorName);
107670
- const id2 = await import_isomorphic_git.default.commit({
107671
- fs: fs5,
107672
- dir,
107673
- message: options.message,
107674
- author
107830
+ snapshot(options) {
107831
+ return withRepoLock(options.projectDir, () => this.snapshotUnlocked(options));
107832
+ }
107833
+ snapshotUnlocked(options) {
107834
+ return snapshotWorkingTreeUnlocked(options);
107835
+ }
107836
+ listHistory(projectDir) {
107837
+ return withRepoLock(projectDir, async () => {
107838
+ const commits = await import_isomorphic_git.default.log({ fs: fs5, dir: projectDir });
107839
+ return commits.map((c) => ({
107840
+ id: c.oid,
107841
+ message: c.commit.message.trim(),
107842
+ timestamp: c.commit.author.timestamp * 1000,
107843
+ author: c.commit.author.name
107844
+ }));
107675
107845
  });
107676
- return {
107677
- id: id2,
107678
- message: options.message,
107679
- timestamp: Date.now(),
107680
- author: author.name
107681
- };
107682
- }
107683
- async listHistory(projectDir) {
107684
- const commits = await import_isomorphic_git.default.log({ fs: fs5, dir: projectDir });
107685
- return commits.map((c) => ({
107686
- id: c.oid,
107687
- message: c.commit.message.trim(),
107688
- timestamp: c.commit.author.timestamp * 1000,
107689
- author: c.commit.author.name
107690
- }));
107691
107846
  }
107692
- async restore(options) {
107847
+ restore(options) {
107848
+ return withRepoLock(options.projectDir, () => this.restoreUnlocked(options));
107849
+ }
107850
+ async restoreUnlocked(options) {
107693
107851
  await import_isomorphic_git.default.checkout({
107694
107852
  fs: fs5,
107695
107853
  dir: options.projectDir,
@@ -107699,6 +107857,30 @@ class LocalGitSourceProvider {
107699
107857
  });
107700
107858
  }
107701
107859
  }
107860
+ async function snapshotWorkingTreeUnlocked(options) {
107861
+ const dir = options.projectDir;
107862
+ if (!await hasPendingChanges(dir)) {
107863
+ throw new Error("No changes since the last snapshot — there is nothing new to save.");
107864
+ }
107865
+ await stageAll(dir);
107866
+ const author = gitAuthor(options.authorName);
107867
+ const id2 = await import_isomorphic_git.default.commit({
107868
+ fs: fs5,
107869
+ dir,
107870
+ message: options.message,
107871
+ author
107872
+ });
107873
+ const [head] = await import_isomorphic_git.default.log({ fs: fs5, dir, depth: 1 });
107874
+ return {
107875
+ id: id2,
107876
+ message: options.message,
107877
+ timestamp: head ? head.commit.author.timestamp * 1000 : Date.now(),
107878
+ author: author.name
107879
+ };
107880
+ }
107881
+ function isNoChangesError(e) {
107882
+ return e instanceof Error && /no changes since the last snapshot/i.test(e.message);
107883
+ }
107702
107884
  function providerFor(source) {
107703
107885
  switch (source.type) {
107704
107886
  case "local-folder":
@@ -107710,18 +107892,57 @@ function providerFor(source) {
107710
107892
  }
107711
107893
  }
107712
107894
  function gitDirFor(projectDir) {
107713
- return path9.join(projectDir, ".git");
107895
+ return path10.join(projectDir, ".git");
107714
107896
  }
107715
- var import_isomorphic_git, DEFAULT_AUTHOR = "print-md", DEFAULT_EMAIL = "noreply@print-md.local", DEFAULT_BRANCH = "main";
107897
+ function autoSnapshotDelayMs(policy) {
107898
+ const enabled = policy?.autoSnapshot ?? true;
107899
+ if (!enabled)
107900
+ return null;
107901
+ const raw = policy?.autoSnapshotMinutes;
107902
+ const minutes = typeof raw === "number" && Number.isFinite(raw) && raw > 0 ? raw : AUTO_SNAPSHOT_DEFAULT_MINUTES;
107903
+ const clamped = Math.min(AUTO_SNAPSHOT_MAX_MINUTES, Math.max(AUTO_SNAPSHOT_MIN_MINUTES, minutes));
107904
+ return clamped * 60000;
107905
+ }
107906
+ function isGitInternalPath(p10) {
107907
+ return p10.split(/[\\/]+/).some((segment) => segment === ".git");
107908
+ }
107909
+ async function restoreVersionWithBackup(options) {
107910
+ const { projectDir, id: id2, authorName } = options;
107911
+ const source = await detectProjectSource(projectDir);
107912
+ if (source.type !== "local-git-folder") {
107913
+ throw new Error("This project has no version history yet. Enable version history first.");
107914
+ }
107915
+ const provider = new LocalGitSourceProvider(source);
107916
+ return withRepoLock(projectDir, async () => {
107917
+ let backupId;
107918
+ if (await hasPendingChanges(projectDir)) {
107919
+ const backup = await provider.snapshotUnlocked({
107920
+ projectDir,
107921
+ message: RESTORE_BACKUP_MESSAGE,
107922
+ authorName
107923
+ });
107924
+ backupId = backup.id;
107925
+ }
107926
+ try {
107927
+ await provider.restoreUnlocked({ projectDir, id: id2 });
107928
+ } catch (cause) {
107929
+ throw new Error(backupId ? "The restore could not be completed, but your work is safe — it was " + `automatically saved as a backup snapshot (${backupId.slice(0, 7)}) ` + "and appears in your version history." : "The restore could not be completed. Your project files were not changed.", { cause });
107930
+ }
107931
+ return { restoredId: id2, backupId };
107932
+ });
107933
+ }
107934
+ var import_isomorphic_git, DEFAULT_AUTHOR = "print-md", DEFAULT_EMAIL = "noreply@print-md.local", DEFAULT_BRANCH = "main", repoQueues, RESTORE_BACKUP_MESSAGE = "Automatic backup before restoring an earlier version", AUTO_SNAPSHOT_MESSAGE = "Automatic snapshot", AUTO_SNAPSHOT_MIN_MINUTES = 5, AUTO_SNAPSHOT_MAX_MINUTES, AUTO_SNAPSHOT_DEFAULT_MINUTES = 10;
107716
107935
  var init_source_provider = __esm(() => {
107717
107936
  init_project_source();
107718
107937
  import_isomorphic_git = __toESM(require_isomorphic_git(), 1);
107938
+ repoQueues = new Map;
107939
+ AUTO_SNAPSHOT_MAX_MINUTES = 24 * 60;
107719
107940
  });
107720
107941
 
107721
107942
  // ../lib/src/lib/project-scaffold.ts
107722
- import { access as access2, copyFile as copyFile2, mkdir as mkdir6, readFile as readFile21, writeFile as writeFile7 } from "node:fs/promises";
107943
+ import { access as access2, copyFile as copyFile2, mkdir as mkdir6, readFile as readFile22, writeFile as writeFile7 } from "node:fs/promises";
107723
107944
  import { constants as FS } from "node:fs";
107724
- import path10 from "node:path";
107945
+ import path11 from "node:path";
107725
107946
  function slugifyProjectName(name) {
107726
107947
  return name.normalize("NFKD").replace(/[̀-ͯ]/g, "").toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
107727
107948
  }
@@ -107739,7 +107960,7 @@ async function scaffoldProject(options) {
107739
107960
  throw new CreateProjectErrorImpl("invalid-name", `Could not derive a valid folder name from "${name}".`);
107740
107961
  }
107741
107962
  const parentDir = options.parentDir;
107742
- if (!parentDir || !path10.isAbsolute(parentDir)) {
107963
+ if (!parentDir || !path11.isAbsolute(parentDir)) {
107743
107964
  throw new CreateProjectErrorImpl("parent-not-writable", "The save location must be an absolute path.");
107744
107965
  }
107745
107966
  try {
@@ -107747,7 +107968,7 @@ async function scaffoldProject(options) {
107747
107968
  } catch {
107748
107969
  throw new CreateProjectErrorImpl("parent-not-writable", `The chosen save location can't be written to: ${parentDir}`);
107749
107970
  }
107750
- const projectDir = path10.join(parentDir, folderName);
107971
+ const projectDir = path11.join(parentDir, folderName);
107751
107972
  let targetExists = true;
107752
107973
  try {
107753
107974
  await access2(projectDir, FS.F_OK);
@@ -107762,14 +107983,14 @@ async function scaffoldProject(options) {
107762
107983
  const tplManifest = await getAssetPath(`templates/${template}/manifest.yaml`);
107763
107984
  const tplChapter = await getAssetPath(`templates/${template}/chapter-01.md`);
107764
107985
  await mkdir6(projectDir, { recursive: true });
107765
- await mkdir6(path10.join(projectDir, "assets"), { recursive: true });
107766
- await copyFile2(tplManifest, path10.join(projectDir, "manifest.yaml"));
107767
- await copyFile2(tplChapter, path10.join(projectDir, "chapter-01.md"));
107986
+ await mkdir6(path11.join(projectDir, "assets"), { recursive: true });
107987
+ await copyFile2(tplManifest, path11.join(projectDir, "manifest.yaml"));
107988
+ await copyFile2(tplChapter, path11.join(projectDir, "chapter-01.md"));
107768
107989
  } catch (e) {
107769
107990
  throw new CreateProjectErrorImpl("scaffold-io", `Could not create the project files: ${e instanceof Error ? e.message : String(e)}`);
107770
107991
  }
107771
- const manifestPath = path10.join(projectDir, "manifest.yaml");
107772
- const openFile = path10.join(projectDir, "chapter-01.md");
107992
+ const manifestPath = path11.join(projectDir, "manifest.yaml");
107993
+ const openFile = path11.join(projectDir, "chapter-01.md");
107773
107994
  const author = (options.author ?? "").trim() || DEFAULT_AUTHOR2;
107774
107995
  const outputPdf = `${slug}.pdf`;
107775
107996
  const substitutions = {
@@ -107813,7 +108034,7 @@ async function scaffoldProject(options) {
107813
108034
  return result;
107814
108035
  }
107815
108036
  async function fillTemplateFile(filePath2, substitutions) {
107816
- let text4 = await readFile21(filePath2, "utf8");
108037
+ let text4 = await readFile22(filePath2, "utf8");
107817
108038
  for (const [token, value] of Object.entries(substitutions)) {
107818
108039
  text4 = text4.split(token).join(value);
107819
108040
  }
@@ -107832,6 +108053,117 @@ var init_project_scaffold = __esm(() => {
107832
108053
  };
107833
108054
  });
107834
108055
 
108056
+ // ../lib/src/lib/remote-auth/token-store.ts
108057
+ import { chmod, mkdir as mkdir7, readFile as readFile23, writeFile as writeFile8 } from "node:fs/promises";
108058
+ import os4 from "node:os";
108059
+ import path12 from "node:path";
108060
+ function defaultConfigDir() {
108061
+ const override = process.env.PRINT_MD_CONFIG_DIR?.trim();
108062
+ if (override)
108063
+ return override;
108064
+ if (process.platform === "win32" && process.env.APPDATA) {
108065
+ return path12.join(process.env.APPDATA, "print-md");
108066
+ }
108067
+ const xdg = process.env.XDG_CONFIG_HOME?.trim();
108068
+ return path12.join(xdg || path12.join(os4.homedir(), ".config"), "print-md");
108069
+ }
108070
+
108071
+ class FileTokenStore {
108072
+ filePath;
108073
+ queue = Promise.resolve();
108074
+ constructor(filePath2) {
108075
+ this.filePath = filePath2 ?? path12.join(defaultConfigDir(), "credentials.json");
108076
+ }
108077
+ async read() {
108078
+ try {
108079
+ const raw = await readFile23(this.filePath, "utf8");
108080
+ const parsed = JSON.parse(raw);
108081
+ if (parsed && typeof parsed === "object" && parsed.credentials)
108082
+ return parsed;
108083
+ } catch {}
108084
+ return { version: 1, credentials: {} };
108085
+ }
108086
+ async write(data) {
108087
+ await mkdir7(path12.dirname(this.filePath), { recursive: true });
108088
+ await writeFile8(this.filePath, JSON.stringify(data, null, 2), {
108089
+ encoding: "utf8",
108090
+ mode: 384
108091
+ });
108092
+ await chmod(this.filePath, 384);
108093
+ }
108094
+ enqueue(fn2) {
108095
+ const run2 = this.queue.then(fn2, fn2);
108096
+ this.queue = run2.catch(() => {
108097
+ return;
108098
+ });
108099
+ return run2;
108100
+ }
108101
+ get(host) {
108102
+ return this.enqueue(async () => {
108103
+ const data = await this.read();
108104
+ return data.credentials[normalizeHost(host)] ?? null;
108105
+ });
108106
+ }
108107
+ set(host, credential) {
108108
+ return this.enqueue(async () => {
108109
+ const data = await this.read();
108110
+ data.credentials[normalizeHost(host)] = credential;
108111
+ await this.write(data);
108112
+ });
108113
+ }
108114
+ delete(host) {
108115
+ return this.enqueue(async () => {
108116
+ const data = await this.read();
108117
+ delete data.credentials[normalizeHost(host)];
108118
+ await this.write(data);
108119
+ });
108120
+ }
108121
+ list() {
108122
+ return this.enqueue(async () => {
108123
+ const data = await this.read();
108124
+ return Object.values(data.credentials);
108125
+ });
108126
+ }
108127
+ }
108128
+ function normalizeHost(host) {
108129
+ return host.trim().toLowerCase();
108130
+ }
108131
+ var init_token_store = () => {};
108132
+ // ../lib/src/lib/remote-auth/github-repos.ts
108133
+ var init_github_repos = () => {};
108134
+
108135
+ // ../lib/src/lib/remote-auth/clone.ts
108136
+ var init_clone = __esm(() => {
108137
+ init_source_provider();
108138
+ init_token_store();
108139
+ });
108140
+
108141
+ // ../lib/src/lib/remote-auth/test-access.ts
108142
+ var init_test_access = __esm(() => {
108143
+ init_token_store();
108144
+ });
108145
+
108146
+ // ../lib/src/lib/remote-auth/generic-auth.ts
108147
+ var init_generic_auth = __esm(() => {
108148
+ init_test_access();
108149
+ });
108150
+
108151
+ // ../lib/src/lib/remote-auth/diagnose.ts
108152
+ var init_diagnose = __esm(() => {
108153
+ init_project_source();
108154
+ init_generic_auth();
108155
+ init_test_access();
108156
+ init_token_store();
108157
+ });
108158
+
108159
+ // ../lib/src/lib/remote-auth/publish.ts
108160
+ var import_diff3;
108161
+ var init_publish = __esm(() => {
108162
+ init_source_provider();
108163
+ init_token_store();
108164
+ import_diff3 = __toESM(require_diff3(), 1);
108165
+ });
108166
+
107835
108167
  // ../lib/src/api/index.ts
107836
108168
  var init_api = __esm(() => {
107837
108169
  init_build_runner();
@@ -107841,6 +108173,13 @@ var init_api = __esm(() => {
107841
108173
  init_project_source();
107842
108174
  init_project_scaffold();
107843
108175
  init_source_provider();
108176
+ init_token_store();
108177
+ init_github_repos();
108178
+ init_clone();
108179
+ init_test_access();
108180
+ init_generic_auth();
108181
+ init_diagnose();
108182
+ init_publish();
107844
108183
  });
107845
108184
 
107846
108185
  // ../lib/src/index.ts
@@ -107936,7 +108275,7 @@ __export(exports_preview, {
107936
108275
  default: () => preview_default
107937
108276
  });
107938
108277
  import { defineCommand as defineCommand2 } from "citty";
107939
- import path11 from "node:path";
108278
+ import path13 from "node:path";
107940
108279
  import fs6 from "node:fs";
107941
108280
  function resolvePort(raw) {
107942
108281
  if (raw === undefined || raw === "")
@@ -107992,7 +108331,7 @@ var init_preview = __esm(() => {
107992
108331
  "skip-post-validate": { type: "boolean", description: "Skip post-build PDF/X validation (pdfx only)" }
107993
108332
  },
107994
108333
  async run({ args }) {
107995
- const inputPath = args.input ? path11.resolve(args.input) : undefined;
108334
+ const inputPath = args.input ? path13.resolve(args.input) : undefined;
107996
108335
  if (inputPath !== undefined) {
107997
108336
  if (!fs6.existsSync(inputPath) || !fs6.statSync(inputPath).isDirectory()) {
107998
108337
  log.error(`Input directory does not exist: ${inputPath}`);
@@ -108055,7 +108394,7 @@ __export(exports_build, {
108055
108394
  default: () => build_default
108056
108395
  });
108057
108396
  import { defineCommand as defineCommand3 } from "citty";
108058
- import path12 from "node:path";
108397
+ import path14 from "node:path";
108059
108398
  function parseFormat2(raw) {
108060
108399
  if (raw === undefined || raw === "")
108061
108400
  return "pdf";
@@ -108103,7 +108442,7 @@ var init_build = __esm(() => {
108103
108442
  const { outDir, pdfFileOverride } = splitOutPath(typeof args.out === "string" ? args.out : undefined, format);
108104
108443
  try {
108105
108444
  await runBuild({
108106
- inputDir: path12.resolve(args.input ?? "."),
108445
+ inputDir: path14.resolve(args.input ?? "."),
108107
108446
  format,
108108
108447
  outDir,
108109
108448
  pdfFileOverride,
@@ -108300,7 +108639,7 @@ __export(exports_preflight, {
108300
108639
  buildPreflightPayload: () => buildPreflightPayload
108301
108640
  });
108302
108641
  import { defineCommand as defineCommand7 } from "citty";
108303
- import { mkdir as mkdir7, writeFile as writeFile8 } from "node:fs/promises";
108642
+ import { mkdir as mkdir8, writeFile as writeFile9 } from "node:fs/promises";
108304
108643
  import { basename as basename3, dirname as dirname6, extname, join as join10, resolve as resolve15 } from "node:path";
108305
108644
  function computeStatus(errors, warnings, missingTools, skippedRequired) {
108306
108645
  if (errors > 0 || skippedRequired)
@@ -108476,10 +108815,10 @@ var init_preflight = __esm(() => {
108476
108815
  const baseName = typeof args.name === "string" && args.name.trim().length > 0 ? args.name.trim() : defaultReportName(pdfPath);
108477
108816
  const jsonPath = join10(reportDir, `${baseName}.json`);
108478
108817
  const markdownPath = join10(reportDir, `${baseName}.md`);
108479
- await mkdir7(reportDir, { recursive: true });
108480
- await writeFile8(jsonPath, `${JSON.stringify(payload, null, 2)}
108818
+ await mkdir8(reportDir, { recursive: true });
108819
+ await writeFile9(jsonPath, `${JSON.stringify(payload, null, 2)}
108481
108820
  `, "utf8");
108482
- await writeFile8(markdownPath, toPreflightMarkdown(payload), "utf8");
108821
+ await writeFile9(markdownPath, toPreflightMarkdown(payload), "utf8");
108483
108822
  log.info(`Preflight status: ${payload.status}`);
108484
108823
  log.info(`JSON report: ${jsonPath}`);
108485
108824
  log.info(`Markdown report: ${markdownPath}`);
@@ -108501,7 +108840,7 @@ var SUBCOMMANDS = {
108501
108840
  audit: () => Promise.resolve().then(() => (init_audit(), exports_audit)).then((m) => m.default),
108502
108841
  preflight: () => Promise.resolve().then(() => (init_preflight(), exports_preflight)).then((m) => m.default)
108503
108842
  };
108504
- var VERSION = "0.4.1";
108843
+ var VERSION = "0.5.0-rc.2";
108505
108844
  var main = defineCommand8({
108506
108845
  meta: {
108507
108846
  name: "print-md",