zen-fs-config 0.5.17 → 0.5.18
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/index.js +16 -6
- package/dist/index.mjs +16 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -970,18 +970,28 @@ var ConfigRepo = class {
|
|
|
970
970
|
*/
|
|
971
971
|
async safeExists(fs, path) {
|
|
972
972
|
try {
|
|
973
|
-
|
|
974
|
-
|
|
973
|
+
const ctorName = fs?.constructor?.name ?? typeof fs;
|
|
974
|
+
const hasExists = typeof fs?.exists === "function";
|
|
975
|
+
const hasStat = typeof fs?.stat === "function";
|
|
976
|
+
const innerBackend = fs?.inner?.constructor?.name;
|
|
977
|
+
const innerBackendName = fs?.inner?.backendName;
|
|
978
|
+
const directBackendName = fs?.backendName;
|
|
979
|
+
const backendLabel = innerBackendName ?? directBackendName ?? innerBackend ?? ctorName;
|
|
980
|
+
console.log(`[TOMB-TRACE] safeExists(${path}): fs type=${ctorName} backend=${backendLabel} hasExists=${hasExists} hasStat=${hasStat} inner=${innerBackend ?? "N/A"}`);
|
|
981
|
+
if (hasExists) {
|
|
982
|
+
console.log(`[TOMB-TRACE] safeExists(${path}): \u2192 calling fs.exists() [backend=${backendLabel}]`);
|
|
975
983
|
const result = await fs.exists(path);
|
|
976
|
-
console.log(`[TOMB-TRACE] safeExists: fs.exists(
|
|
984
|
+
console.log(`[TOMB-TRACE] safeExists(${path}): \u2190 fs.exists() [backend=${backendLabel}] \u2192 ${result}`);
|
|
977
985
|
return result;
|
|
978
986
|
}
|
|
979
|
-
console.log(`[TOMB-TRACE] safeExists: no exists(), calling fs.stat(
|
|
987
|
+
console.log(`[TOMB-TRACE] safeExists(${path}): no exists(), calling fs.stat() [backend=${backendLabel}]`);
|
|
980
988
|
await fs.stat(path);
|
|
981
|
-
console.log(`[TOMB-TRACE] safeExists: fs.stat(
|
|
989
|
+
console.log(`[TOMB-TRACE] safeExists(${path}): \u2190 fs.stat() [backend=${backendLabel}] \u2192 OK (exists)`);
|
|
982
990
|
return true;
|
|
983
991
|
} catch (err) {
|
|
984
|
-
|
|
992
|
+
const errCode = err?.code ?? err?.status ?? "";
|
|
993
|
+
const errName = err?.constructor?.name ?? "";
|
|
994
|
+
console.log(`[TOMB-TRACE] safeExists(${path}): \u2190 ERROR ${errName} ${errCode} ${err?.message ?? err}`);
|
|
985
995
|
return false;
|
|
986
996
|
}
|
|
987
997
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -880,18 +880,28 @@ var ConfigRepo = class {
|
|
|
880
880
|
*/
|
|
881
881
|
async safeExists(fs, path) {
|
|
882
882
|
try {
|
|
883
|
-
|
|
884
|
-
|
|
883
|
+
const ctorName = fs?.constructor?.name ?? typeof fs;
|
|
884
|
+
const hasExists = typeof fs?.exists === "function";
|
|
885
|
+
const hasStat = typeof fs?.stat === "function";
|
|
886
|
+
const innerBackend = fs?.inner?.constructor?.name;
|
|
887
|
+
const innerBackendName = fs?.inner?.backendName;
|
|
888
|
+
const directBackendName = fs?.backendName;
|
|
889
|
+
const backendLabel = innerBackendName ?? directBackendName ?? innerBackend ?? ctorName;
|
|
890
|
+
console.log(`[TOMB-TRACE] safeExists(${path}): fs type=${ctorName} backend=${backendLabel} hasExists=${hasExists} hasStat=${hasStat} inner=${innerBackend ?? "N/A"}`);
|
|
891
|
+
if (hasExists) {
|
|
892
|
+
console.log(`[TOMB-TRACE] safeExists(${path}): \u2192 calling fs.exists() [backend=${backendLabel}]`);
|
|
885
893
|
const result = await fs.exists(path);
|
|
886
|
-
console.log(`[TOMB-TRACE] safeExists: fs.exists(
|
|
894
|
+
console.log(`[TOMB-TRACE] safeExists(${path}): \u2190 fs.exists() [backend=${backendLabel}] \u2192 ${result}`);
|
|
887
895
|
return result;
|
|
888
896
|
}
|
|
889
|
-
console.log(`[TOMB-TRACE] safeExists: no exists(), calling fs.stat(
|
|
897
|
+
console.log(`[TOMB-TRACE] safeExists(${path}): no exists(), calling fs.stat() [backend=${backendLabel}]`);
|
|
890
898
|
await fs.stat(path);
|
|
891
|
-
console.log(`[TOMB-TRACE] safeExists: fs.stat(
|
|
899
|
+
console.log(`[TOMB-TRACE] safeExists(${path}): \u2190 fs.stat() [backend=${backendLabel}] \u2192 OK (exists)`);
|
|
892
900
|
return true;
|
|
893
901
|
} catch (err) {
|
|
894
|
-
|
|
902
|
+
const errCode = err?.code ?? err?.status ?? "";
|
|
903
|
+
const errName = err?.constructor?.name ?? "";
|
|
904
|
+
console.log(`[TOMB-TRACE] safeExists(${path}): \u2190 ERROR ${errName} ${errCode} ${err?.message ?? err}`);
|
|
895
905
|
return false;
|
|
896
906
|
}
|
|
897
907
|
}
|