@biffo/cli 0.410.0 → 0.412.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.
Files changed (2) hide show
  1. package/dist/index.js +19 -9
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -13,7 +13,7 @@ import chalk2 from "chalk";
13
13
  import { Command } from "commander";
14
14
 
15
15
  // src/lib/core-manifest.ts
16
- import { existsSync as existsSync2, lstatSync, readFileSync as readFileSync2, readdirSync, readlinkSync } from "fs";
16
+ import { existsSync as existsSync2, readFileSync as readFileSync2, readdirSync, readlinkSync } from "fs";
17
17
  import { tmpdir } from "os";
18
18
  import { dirname as dirname2, join as join2, relative, resolve, sep } from "path";
19
19
  import { fileURLToPath as fileURLToPath2 } from "url";
@@ -437,10 +437,18 @@ function listTemplateOwnedFiles(root, manifest, options = {}) {
437
437
  walk2(root);
438
438
  return out.sort();
439
439
  }
440
+ function readLinkTarget(path) {
441
+ try {
442
+ return readlinkSync(path);
443
+ } catch (err) {
444
+ if (err.code === "EINVAL") return null;
445
+ throw err;
446
+ }
447
+ }
440
448
  function sameFile(a, b) {
441
- const la = lstatSync(a).isSymbolicLink();
442
- const lb = lstatSync(b).isSymbolicLink();
443
- if (la || lb) return la && lb && readlinkSync(a) === readlinkSync(b);
449
+ const ta = readLinkTarget(a);
450
+ const tb = readLinkTarget(b);
451
+ if (ta !== null || tb !== null) return ta === tb;
444
452
  return readFileSync2(a).equals(readFileSync2(b));
445
453
  }
446
454
  function computeCoreDiff(templateRoot, instanceRoot, manifest, baseRoot, options = {}) {
@@ -653,7 +661,7 @@ import { isUtf8 } from "buffer";
653
661
  import {
654
662
  chmodSync,
655
663
  existsSync as existsSync5,
656
- lstatSync as lstatSync2,
664
+ lstatSync,
657
665
  mkdirSync,
658
666
  mkdtempSync,
659
667
  readFileSync as readFileSync4,
@@ -833,8 +841,10 @@ var gitMergeFile = async (base, ours, theirs) => {
833
841
  };
834
842
  function readFile(root, rel) {
835
843
  const abs = join5(root, rel);
836
- if (lstatSync2(abs).isSymbolicLink()) {
844
+ try {
837
845
  return { buffer: Buffer.from(readlinkSync2(abs), "utf8"), text: null, link: true };
846
+ } catch (err) {
847
+ if (err.code !== "EINVAL") throw err;
838
848
  }
839
849
  const buffer = readFileSync4(abs);
840
850
  return { buffer, text: isUtf8(buffer) ? buffer.toString("utf8") : null, link: false };
@@ -1038,7 +1048,7 @@ async function classify(path, base, ours, theirs, opts, mergeFile, isDeclaredDiv
1038
1048
  }
1039
1049
  function isSymlink(abs) {
1040
1050
  try {
1041
- return lstatSync2(abs).isSymbolicLink();
1051
+ return lstatSync(abs).isSymbolicLink();
1042
1052
  } catch {
1043
1053
  return false;
1044
1054
  }
@@ -3365,7 +3375,7 @@ function materializeTemplateAtTag(repo, version, git = defaultGit2) {
3365
3375
  // src/lib/core-upgrade-target-fidelity.ts
3366
3376
  import { execFileSync as execFileSync4 } from "child_process";
3367
3377
  import { createHash as createHash2 } from "crypto";
3368
- import { existsSync as existsSync8, lstatSync as lstatSync3, readFileSync as readFileSync6 } from "fs";
3378
+ import { existsSync as existsSync8, lstatSync as lstatSync2, readFileSync as readFileSync6 } from "fs";
3369
3379
  import { join as join9 } from "path";
3370
3380
  var VERBATIM_STATUSES = /* @__PURE__ */ new Set(["take-theirs", "added", "add-conflict", "restored"]);
3371
3381
  var DERIVED_STATUSES = /* @__PURE__ */ new Set(["merged", "conflict"]);
@@ -3439,7 +3449,7 @@ function assertTargetFidelity(options) {
3439
3449
  if (tagSymlinks.has(entry.path)) {
3440
3450
  const delivered = source === "output" ? entry.symlink === true : (() => {
3441
3451
  try {
3442
- return lstatSync3(join9(options.theirsDir, entry.path)).isSymbolicLink();
3452
+ return lstatSync2(join9(options.theirsDir, entry.path)).isSymbolicLink();
3443
3453
  } catch {
3444
3454
  return false;
3445
3455
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@biffo/cli",
3
- "version": "0.410.0",
3
+ "version": "0.412.0",
4
4
  "description": "Biffo project scaffolding CLI",
5
5
  "license": "MIT",
6
6
  "type": "module",