crispy-recall 0.3.0 → 0.3.1
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/recall.js +56 -3
- package/package.json +1 -1
package/dist/recall.js
CHANGED
|
@@ -16671,7 +16671,8 @@ var install_exports = {};
|
|
|
16671
16671
|
__export(install_exports, {
|
|
16672
16672
|
defaultDistDir: () => defaultDistDir,
|
|
16673
16673
|
probeStagedBinding: () => probeStagedBinding,
|
|
16674
|
-
runInstall: () => runInstall
|
|
16674
|
+
runInstall: () => runInstall,
|
|
16675
|
+
stageFileAtomic: () => stageFileAtomic
|
|
16675
16676
|
});
|
|
16676
16677
|
function defaultDistDir() {
|
|
16677
16678
|
const argv1 = process.argv[1];
|
|
@@ -16716,8 +16717,60 @@ function writeSkill(targetPath, templatePath, runnable) {
|
|
|
16716
16717
|
(0, import_node_fs17.writeFileSync)(targetPath, body);
|
|
16717
16718
|
return true;
|
|
16718
16719
|
}
|
|
16720
|
+
function stageFileAtomic(src, dest) {
|
|
16721
|
+
const bytes = (0, import_node_fs17.readFileSync)(src);
|
|
16722
|
+
try {
|
|
16723
|
+
if ((0, import_node_fs17.existsSync)(dest) && bytes.equals((0, import_node_fs17.readFileSync)(dest)))
|
|
16724
|
+
return;
|
|
16725
|
+
} catch {
|
|
16726
|
+
}
|
|
16727
|
+
const tmp = `${dest}.staging-${process.pid}`;
|
|
16728
|
+
const mode = (0, import_node_fs17.statSync)(src).mode;
|
|
16729
|
+
(0, import_node_fs17.writeFileSync)(tmp, bytes, { mode });
|
|
16730
|
+
(0, import_node_fs17.chmodSync)(tmp, mode);
|
|
16731
|
+
try {
|
|
16732
|
+
(0, import_node_fs17.renameSync)(tmp, dest);
|
|
16733
|
+
} catch (e2) {
|
|
16734
|
+
const setAside = `${dest}.old-${process.pid}-${Date.now()}`;
|
|
16735
|
+
let movedAside = false;
|
|
16736
|
+
try {
|
|
16737
|
+
(0, import_node_fs17.renameSync)(dest, setAside);
|
|
16738
|
+
movedAside = true;
|
|
16739
|
+
(0, import_node_fs17.renameSync)(tmp, dest);
|
|
16740
|
+
} catch {
|
|
16741
|
+
if (movedAside) {
|
|
16742
|
+
try {
|
|
16743
|
+
(0, import_node_fs17.renameSync)(setAside, dest);
|
|
16744
|
+
} catch {
|
|
16745
|
+
}
|
|
16746
|
+
}
|
|
16747
|
+
try {
|
|
16748
|
+
(0, import_node_fs17.unlinkSync)(tmp);
|
|
16749
|
+
} catch {
|
|
16750
|
+
}
|
|
16751
|
+
throw e2;
|
|
16752
|
+
}
|
|
16753
|
+
}
|
|
16754
|
+
}
|
|
16755
|
+
function sweepStaleStagingFiles() {
|
|
16756
|
+
let entries;
|
|
16757
|
+
try {
|
|
16758
|
+
entries = (0, import_node_fs17.readdirSync)(binDir());
|
|
16759
|
+
} catch {
|
|
16760
|
+
return;
|
|
16761
|
+
}
|
|
16762
|
+
for (const f3 of entries) {
|
|
16763
|
+
if (/\.(staging|old)-\d+/.test(f3)) {
|
|
16764
|
+
try {
|
|
16765
|
+
(0, import_node_fs17.unlinkSync)((0, import_node_path14.join)(binDir(), f3));
|
|
16766
|
+
} catch {
|
|
16767
|
+
}
|
|
16768
|
+
}
|
|
16769
|
+
}
|
|
16770
|
+
}
|
|
16719
16771
|
function stageBundles(distDir, written) {
|
|
16720
16772
|
(0, import_node_fs17.mkdirSync)(binDir(), { recursive: true });
|
|
16773
|
+
sweepStaleStagingFiles();
|
|
16721
16774
|
for (const name of STAGED_BUNDLES) {
|
|
16722
16775
|
const src = (0, import_node_path14.join)(distDir, name);
|
|
16723
16776
|
if (!(0, import_node_fs17.existsSync)(src)) {
|
|
@@ -16725,7 +16778,7 @@ function stageBundles(distDir, written) {
|
|
|
16725
16778
|
continue;
|
|
16726
16779
|
}
|
|
16727
16780
|
const dest = (0, import_node_path14.join)(binDir(), name);
|
|
16728
|
-
(
|
|
16781
|
+
stageFileAtomic(src, dest);
|
|
16729
16782
|
written.push(dest);
|
|
16730
16783
|
}
|
|
16731
16784
|
return stageNativeBinding(written);
|
|
@@ -16748,7 +16801,7 @@ function stageNativeBinding(written) {
|
|
|
16748
16801
|
return { ok: true };
|
|
16749
16802
|
}
|
|
16750
16803
|
const dest = (0, import_node_path14.join)(binDir(), "better_sqlite3.node");
|
|
16751
|
-
(
|
|
16804
|
+
stageFileAtomic(binding, dest);
|
|
16752
16805
|
written.push(dest);
|
|
16753
16806
|
const probe = probeStagedBinding(dest);
|
|
16754
16807
|
if (!probe.ok) {
|
package/package.json
CHANGED