@geonosis/ratchet 0.2.1 → 0.4.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.
- package/dist/{chunk-XYTUTPQI.js → chunk-QVORWCUD.js} +14 -11
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -468,7 +468,8 @@ var counterById = (id) => {
|
|
|
468
468
|
};
|
|
469
469
|
|
|
470
470
|
// src/lock.ts
|
|
471
|
-
import {
|
|
471
|
+
import { randomUUID } from "crypto";
|
|
472
|
+
import { linkSync, mkdirSync as mkdirSync2, readFileSync as readFileSync4, rmSync as rmSync2, writeFileSync as writeFileSync3 } from "fs";
|
|
472
473
|
import { homedir } from "os";
|
|
473
474
|
import { dirname as dirname2, join as join3 } from "path";
|
|
474
475
|
var heavyLockPath = () => process.env.GEONOSIS_HEAVY_LOCK ?? join3(homedir(), ".cache", "geonosis", "heavy.lock");
|
|
@@ -500,19 +501,21 @@ var heldFor = (holder) => {
|
|
|
500
501
|
};
|
|
501
502
|
var write = (path) => {
|
|
502
503
|
mkdirSync2(dirname2(path), { recursive: true });
|
|
504
|
+
const mine = {
|
|
505
|
+
cwd: process.cwd(),
|
|
506
|
+
pid: process.pid,
|
|
507
|
+
startedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
508
|
+
};
|
|
509
|
+
const staging = `${path}.${process.pid}.${randomUUID()}`;
|
|
503
510
|
try {
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
cwd: process.cwd(),
|
|
507
|
-
pid: process.pid,
|
|
508
|
-
startedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
509
|
-
};
|
|
510
|
-
writeSync(handle, JSON.stringify(mine));
|
|
511
|
-
closeSync(handle);
|
|
511
|
+
writeFileSync3(staging, JSON.stringify(mine));
|
|
512
|
+
linkSync(staging, path);
|
|
512
513
|
return true;
|
|
513
514
|
} catch (error) {
|
|
514
515
|
if (error.code === "EEXIST") return false;
|
|
515
516
|
throw error;
|
|
517
|
+
} finally {
|
|
518
|
+
rmSync2(staging, { force: true });
|
|
516
519
|
}
|
|
517
520
|
};
|
|
518
521
|
var acquireExclusive = async ({
|
|
@@ -710,7 +713,7 @@ var formatProve = ({ proofs, proven }) => {
|
|
|
710
713
|
};
|
|
711
714
|
|
|
712
715
|
// src/ratchet.ts
|
|
713
|
-
import { existsSync as existsSync7, readFileSync as readFileSync6, writeFileSync as
|
|
716
|
+
import { existsSync as existsSync7, readFileSync as readFileSync6, writeFileSync as writeFileSync4 } from "fs";
|
|
714
717
|
import { resolve as resolve7 } from "path";
|
|
715
718
|
var EVIDENCE_LINES = 10;
|
|
716
719
|
var recorded = (run) => {
|
|
@@ -779,7 +782,7 @@ var runRatchet = async ({
|
|
|
779
782
|
for (const one of measurements) {
|
|
780
783
|
if (one.verdict !== "skipped") next[one.key] = one.now;
|
|
781
784
|
}
|
|
782
|
-
|
|
785
|
+
writeFileSync4(baselinePath, `${JSON.stringify(next, null, 2)}
|
|
783
786
|
`);
|
|
784
787
|
return { measurements, rewritten: true };
|
|
785
788
|
}
|
package/dist/cli.js
CHANGED
package/dist/index.js
CHANGED