@wix/himalaya-cli 0.1968.0 → 0.1969.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/cli.mjs +72 -11
  2. package/package.json +2 -2
package/dist/cli.mjs CHANGED
@@ -46436,6 +46436,7 @@ function shouldRevealError(args) {
46436
46436
  var EMAIL_RE, URL_HOST_RE, INTEGER_RE, NUMBER_RE, AUTHORED_PATTERN_LIMIT, authoredPatterns;
46437
46437
  var init_validation = __esm({
46438
46438
  "../../core/ts/src/validation.ts"() {
46439
+ "use strict";
46439
46440
  init_define_HHP_CATALOG();
46440
46441
  EMAIL_RE = /^[A-Za-z0-9._%+-]+@[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*\.[A-Za-z]{2,}$/;
46441
46442
  URL_HOST_RE = /^[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*(:[0-9]+)?$/;
@@ -204698,6 +204699,56 @@ function hashFilesAtOnce(root, paths2) {
204698
204699
  files.forEach((path2, i2) => oids.set(path2, lines2[i2].trim()));
204699
204700
  return oids;
204700
204701
  }
204702
+ function worktreeFromStatus(root) {
204703
+ const out2 = tryCountedGit(["--no-optional-locks", "status", "--porcelain=v2", "-z", "--no-renames", "--untracked-files=all"], root);
204704
+ if (out2 === null) return null;
204705
+ const staged = [];
204706
+ const unstaged = [];
204707
+ const untracked = [];
204708
+ const headEntries = /* @__PURE__ */ new Map();
204709
+ const indexEntries = /* @__PURE__ */ new Map();
204710
+ for (const record7 of out2.split("\0")) {
204711
+ if (record7 === "") continue;
204712
+ if (record7.startsWith("? ")) {
204713
+ untracked.push(record7.slice(2));
204714
+ continue;
204715
+ }
204716
+ if (!record7.startsWith("1 ")) return null;
204717
+ const fields2 = [];
204718
+ let at2 = 0;
204719
+ for (let i2 = 0; i2 < 8; i2++) {
204720
+ const space = record7.indexOf(" ", at2);
204721
+ if (space < 0) return null;
204722
+ fields2.push(record7.slice(at2, space));
204723
+ at2 = space + 1;
204724
+ }
204725
+ const path2 = record7.slice(at2);
204726
+ const [, xy, sub, mH, mI, , hH, hI] = fields2;
204727
+ if (path2 === "" || xy.length !== 2 || sub !== "N...") return null;
204728
+ if (xy[1] === "A" || EMPTY_BLOBS.has(hH) || EMPTY_BLOBS.has(hI)) return null;
204729
+ if (xy[0] !== ".") staged.push(path2);
204730
+ if (xy[1] !== ".") unstaged.push(path2);
204731
+ if (mH !== ABSENT_MODE) headEntries.set(path2, { mode: mH, oid: hH });
204732
+ if (mI !== ABSENT_MODE) indexEntries.set(path2, { mode: mI, oid: hI });
204733
+ }
204734
+ return { staged, unstaged, untracked, headEntries, indexEntries };
204735
+ }
204736
+ function rootHeadAndFormat(cwd) {
204737
+ spawnStats.gitCalls++;
204738
+ let out2;
204739
+ try {
204740
+ out2 = git(["rev-parse", "--show-toplevel", "--show-object-format", "--verify", "--quiet", "HEAD^{commit}"], { cwd });
204741
+ } catch {
204742
+ return null;
204743
+ }
204744
+ const lines2 = out2.replace(/\n$/, "").split("\n");
204745
+ if (lines2.length < 3) return null;
204746
+ const commit = lines2.pop().trim();
204747
+ const format = lines2.pop().trim();
204748
+ const root = lines2.join("\n");
204749
+ if (!root || !/^sha(1|256)$/.test(format) || !/^[0-9a-f]{40,64}$/.test(commit)) return null;
204750
+ return { root, head: commit, objectAlgorithm: format };
204751
+ }
204701
204752
  function sameEntry(left, right) {
204702
204753
  if (!left || !right) return left === right;
204703
204754
  return left.mode === right.mode && left.oid === right.oid;
@@ -204712,12 +204763,18 @@ function blobOid(contents, algorithm2) {
204712
204763
  return createHash42(algorithm2).update(Buffer.from(`blob ${body.byteLength}\0`)).update(body).digest("hex");
204713
204764
  }
204714
204765
  function validationDiffHash(cwd = process.cwd(), { shortcuts = true } = {}) {
204715
- spawnStats.gitCalls++;
204716
- const root = resolveRepoRoot2(cwd);
204766
+ const quick = shortcuts ? rootHeadAndFormat(cwd) : null;
204767
+ let root;
204768
+ if (quick) {
204769
+ root = quick.root;
204770
+ } else {
204771
+ spawnStats.gitCalls++;
204772
+ root = resolveRepoRoot2(cwd);
204773
+ }
204717
204774
  const run4 = (args) => countedGit(args, root);
204718
- let head2 = "";
204719
- let objectAlgorithm = "";
204720
- if (shortcuts) {
204775
+ let head2 = quick?.head ?? "";
204776
+ let objectAlgorithm = quick?.objectAlgorithm ?? "";
204777
+ if (shortcuts && !quick) {
204721
204778
  const [format, commit] = (tryCountedGit(["rev-parse", "--show-object-format", "--verify", "--quiet", "HEAD^{commit}"], root) ?? "").split("\n").map((line) => line.trim());
204722
204779
  if (/^sha(1|256)$/.test(format ?? "") && /^[0-9a-f]{40,64}$/.test(commit ?? "")) {
204723
204780
  head2 = commit;
@@ -204726,11 +204783,13 @@ function validationDiffHash(cwd = process.cwd(), { shortcuts = true } = {}) {
204726
204783
  }
204727
204784
  if (!objectAlgorithm) head2 = tryCountedGit(["rev-parse", "--verify", "--quiet", "HEAD^{commit}"], root)?.trim() ?? "";
204728
204785
  const born = head2 !== "";
204729
- const staged = run4(["diff", "--cached", "--name-only", "--no-renames", "-z", ...born ? ["HEAD"] : []]).split("\0").filter(Boolean);
204730
- const unstaged = run4(["diff", "--name-only", "--no-renames", "-z"]).split("\0").filter(Boolean);
204731
- const untracked = run4(["ls-files", "--others", "--exclude-standard", "-z"]).split("\0").filter(Boolean);
204732
- const headEntries = !born ? /* @__PURE__ */ new Map() : shortcuts ? headTreeEntries(root, head2) : treeEntries(run4(["ls-tree", "-rz", "--full-tree", "HEAD"]));
204733
- const indexEntries = treeEntries(run4(["ls-files", "--stage", "-z"]), true);
204786
+ const status2 = shortcuts && born ? worktreeFromStatus(root) : null;
204787
+ const listed = (args) => run4(args).split("\0").filter(Boolean);
204788
+ const staged = status2?.staged ?? listed(["diff", "--cached", "--name-only", "--no-renames", "-z", ...born ? ["HEAD"] : []]);
204789
+ const unstaged = status2?.unstaged ?? listed(["diff", "--name-only", "--no-renames", "-z"]);
204790
+ const untracked = status2?.untracked ?? listed(["ls-files", "--others", "--exclude-standard", "-z"]);
204791
+ const headEntries = status2?.headEntries ?? (!born ? /* @__PURE__ */ new Map() : shortcuts ? headTreeEntries(root, head2) : treeEntries(run4(["ls-tree", "-rz", "--full-tree", "HEAD"])));
204792
+ const indexEntries = status2?.indexEntries ?? treeEntries(run4(["ls-files", "--stage", "-z"]), true);
204734
204793
  if (!objectAlgorithm) objectAlgorithm = run4(["rev-parse", "--show-object-format"]).trim();
204735
204794
  let trustFilesystemMode = true;
204736
204795
  try {
@@ -204852,7 +204911,7 @@ function runSelfTest() {
204852
204911
  }
204853
204912
  return failed2;
204854
204913
  }
204855
- var VALIDATION_METADATA, spawnStats, COMMITTED_MEMO_ENTRIES, committedMemo, headTreeMemo, SELF_TEST_CASES;
204914
+ var VALIDATION_METADATA, spawnStats, COMMITTED_MEMO_ENTRIES, committedMemo, headTreeMemo, ABSENT_MODE, EMPTY_BLOBS, SELF_TEST_CASES;
204856
204915
  var init_diff_hash = __esm({
204857
204916
  "../verify-gate/diff-hash.mjs"() {
204858
204917
  init_define_HHP_CATALOG();
@@ -204865,6 +204924,8 @@ var init_diff_hash = __esm({
204865
204924
  COMMITTED_MEMO_ENTRIES = 4;
204866
204925
  committedMemo = /* @__PURE__ */ new Map();
204867
204926
  headTreeMemo = null;
204927
+ ABSENT_MODE = "000000";
204928
+ EMPTY_BLOBS = new Set(["sha1", "sha256"].map((algorithm2) => blobOid("", algorithm2)));
204868
204929
  SELF_TEST_CASES = [
204869
204930
  {
204870
204931
  name: "committed diffs are distinguished (the #1831 regression)",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/himalaya-cli",
3
- "version": "0.1968.0",
3
+ "version": "0.1969.0",
4
4
  "type": "module",
5
5
  "description": "himi — the Himalaya authoring CLI. Build a Tier-5 content package on your own machine, push it to the production serve as a draft, preview it on web + Himi Player, and read worker logs back — the remote dev loop. Wraps @himalaya/serve-cli for transport.",
6
6
  "keywords": [
@@ -82,5 +82,5 @@
82
82
  "artifactId": "himalaya-cli"
83
83
  }
84
84
  },
85
- "falconPackageHash": "ef83b81bd94f095f960a7b129cec950b80b97df5a5298ee30496afeb"
85
+ "falconPackageHash": "d6f0534feead913ca7e95597435e552e50fcc8e749e031ad8ec57a1f"
86
86
  }