@lmzhen/dsh-evolution-io-node 0.1.0-rc.28 → 0.1.0-rc.29
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/lib/index.js +13 -6
- package/package.json +3 -3
package/lib/index.js
CHANGED
|
@@ -9,13 +9,18 @@ import { randomBytes } from "node:crypto";
|
|
|
9
9
|
const name = "evolution-io-node";
|
|
10
10
|
const inject = ["evolutionIo"];
|
|
11
11
|
function apply(ctx) {
|
|
12
|
+
const isMissing = (error) => {
|
|
13
|
+
const code = error?.code;
|
|
14
|
+
return code === "ENOENT" || code === "ENOTDIR";
|
|
15
|
+
};
|
|
12
16
|
const provider = {
|
|
13
17
|
name: "node",
|
|
14
18
|
async readText(path) {
|
|
15
19
|
try {
|
|
16
20
|
return await readFile(path, "utf8");
|
|
17
|
-
} catch {
|
|
18
|
-
return null;
|
|
21
|
+
} catch (error) {
|
|
22
|
+
if (isMissing(error)) return null;
|
|
23
|
+
throw error;
|
|
19
24
|
}
|
|
20
25
|
},
|
|
21
26
|
async writeText(path, content) {
|
|
@@ -41,8 +46,9 @@ function apply(ctx) {
|
|
|
41
46
|
try {
|
|
42
47
|
await stat(path);
|
|
43
48
|
return true;
|
|
44
|
-
} catch {
|
|
45
|
-
return false;
|
|
49
|
+
} catch (error) {
|
|
50
|
+
if (isMissing(error)) return false;
|
|
51
|
+
throw error;
|
|
46
52
|
}
|
|
47
53
|
},
|
|
48
54
|
async rename(path, destination) {
|
|
@@ -59,8 +65,9 @@ function apply(ctx) {
|
|
|
59
65
|
async size(path) {
|
|
60
66
|
try {
|
|
61
67
|
return (await stat(path)).size;
|
|
62
|
-
} catch {
|
|
63
|
-
return null;
|
|
68
|
+
} catch (error) {
|
|
69
|
+
if (isMissing(error)) return null;
|
|
70
|
+
throw error;
|
|
64
71
|
}
|
|
65
72
|
}
|
|
66
73
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lmzhen/dsh-evolution-io-node",
|
|
3
3
|
"description": "Local atomic node:fs IO provider (community build)",
|
|
4
|
-
"version": "0.1.0-rc.
|
|
4
|
+
"version": "0.1.0-rc.29",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -37,10 +37,10 @@
|
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"@deepseek-ai/dsh-invariants": "^0.1.0-rc.6",
|
|
39
39
|
"@deepseek-ai/cordis": "^4.0.1",
|
|
40
|
-
"@lmzhen/dsh-evolution-io": "^0.1.0-rc.
|
|
40
|
+
"@lmzhen/dsh-evolution-io": "^0.1.0-rc.29"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@deepseek-ai/dsh-invariants": "^0.1.0-rc.6",
|
|
44
|
-
"@lmzhen/dsh-evolution-io": "^0.1.0-rc.
|
|
44
|
+
"@lmzhen/dsh-evolution-io": "^0.1.0-rc.29"
|
|
45
45
|
}
|
|
46
46
|
}
|