@lmzhen/dsh-evolution-io-node 0.1.0-rc.29 → 0.1.0-rc.30

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 CHANGED
@@ -1,75 +1,21 @@
1
- import { cp, mkdir, readFile, readdir, rename, rm, stat, writeFile } from "node:fs/promises";
2
- import { dirname } from "node:path";
3
- import { randomBytes } from "node:crypto";
1
+ import { nodeEvolutionIo } from "@lmzhen/dsh-evolution-core";
4
2
  //#region lib/types/index.js
5
3
  /**
6
4
  * Local atomic node:fs IO provider.
5
+ *
6
+ * The implementation is the single `nodeEvolutionIo()` from
7
+ * `dsh-evolution-core` (no duplicate copy: the old fork once diverged in
8
+ * exists(), made directories report absent and let re-archives overwrite
9
+ * older archive folders). Only the provider's `name` is added here.
10
+ *
7
11
  * @module @lmzhen/dsh-evolution-io-node
8
12
  */
9
13
  const name = "evolution-io-node";
10
14
  const inject = ["evolutionIo"];
11
15
  function apply(ctx) {
12
- const isMissing = (error) => {
13
- const code = error?.code;
14
- return code === "ENOENT" || code === "ENOTDIR";
15
- };
16
16
  const provider = {
17
17
  name: "node",
18
- async readText(path) {
19
- try {
20
- return await readFile(path, "utf8");
21
- } catch (error) {
22
- if (isMissing(error)) return null;
23
- throw error;
24
- }
25
- },
26
- async writeText(path, content) {
27
- await mkdir(dirname(path), { recursive: true });
28
- const tmp = `${path}.${process.pid}.${randomBytes(6).toString("hex")}.tmp`;
29
- await writeFile(tmp, content, "utf8");
30
- await rename(tmp, path);
31
- },
32
- async remove(path) {
33
- await rm(path, {
34
- recursive: true,
35
- force: true
36
- });
37
- },
38
- async list(path) {
39
- try {
40
- return await readdir(path);
41
- } catch {
42
- return [];
43
- }
44
- },
45
- async exists(path) {
46
- try {
47
- await stat(path);
48
- return true;
49
- } catch (error) {
50
- if (isMissing(error)) return false;
51
- throw error;
52
- }
53
- },
54
- async rename(path, destination) {
55
- await mkdir(dirname(destination), { recursive: true });
56
- await rename(path, destination);
57
- },
58
- async copy(path, destination) {
59
- await mkdir(dirname(destination), { recursive: true });
60
- await cp(path, destination, {
61
- recursive: true,
62
- force: true
63
- });
64
- },
65
- async size(path) {
66
- try {
67
- return (await stat(path)).size;
68
- } catch (error) {
69
- if (isMissing(error)) return null;
70
- throw error;
71
- }
72
- }
18
+ ...nodeEvolutionIo()
73
19
  };
74
20
  ctx.effect(() => ctx.evolutionIo.registerProvider(provider), "evolution-io-node.provider");
75
21
  }
@@ -1,5 +1,11 @@
1
1
  /**
2
2
  * Local atomic node:fs IO provider.
3
+ *
4
+ * The implementation is the single `nodeEvolutionIo()` from
5
+ * `dsh-evolution-core` (no duplicate copy: the old fork once diverged in
6
+ * exists(), made directories report absent and let re-archives overwrite
7
+ * older archive folders). Only the provider's `name` is added here.
8
+ *
3
9
  * @module @deepseek-ai/dsh-evolution-io-node
4
10
  */
5
11
  import type { Context } from '@deepseek-ai/cordis';
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.29",
4
+ "version": "0.1.0-rc.30",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -32,15 +32,16 @@
32
32
  ],
33
33
  "license": "MIT",
34
34
  "dependencies": {
35
- "@deepseek-ai/schemastery": "^3.18.1"
35
+ "@deepseek-ai/schemastery": "^3.18.1",
36
+ "@lmzhen/dsh-evolution-core": "^0.1.0-rc.30"
36
37
  },
37
38
  "peerDependencies": {
38
39
  "@deepseek-ai/dsh-invariants": "^0.1.0-rc.6",
39
40
  "@deepseek-ai/cordis": "^4.0.1",
40
- "@lmzhen/dsh-evolution-io": "^0.1.0-rc.29"
41
+ "@lmzhen/dsh-evolution-io": "^0.1.0-rc.30"
41
42
  },
42
43
  "devDependencies": {
43
44
  "@deepseek-ai/dsh-invariants": "^0.1.0-rc.6",
44
- "@lmzhen/dsh-evolution-io": "^0.1.0-rc.29"
45
+ "@lmzhen/dsh-evolution-io": "^0.1.0-rc.30"
45
46
  }
46
47
  }