@nudojs/harvester 0.2.16 → 0.2.19

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.d.ts CHANGED
@@ -98,7 +98,10 @@ declare function autoHarvestModules(source: string, fromDir: string): Record<str
98
98
  * fail-open:未知节点 / 损坏 JSON → undefined(miss,不 throw)。
99
99
  */
100
100
 
101
- /** 签名投影节点(可 JSON 化;足够 mock Abs 的 shape 面) */
101
+ /**
102
+ * 签名投影节点(可 JSON 化;足够 mock Abs 的 shape 面)。
103
+ * lit.value 含 undefined:JSON 往返靠「键缺省」区分 null(显式存)与 undefined(键省略)。
104
+ */
102
105
  type HarvestSig = {
103
106
  k: "prim";
104
107
  type: string;
@@ -110,7 +113,7 @@ type HarvestSig = {
110
113
  k: "never";
111
114
  } | {
112
115
  k: "lit";
113
- value: number | string | boolean | null;
116
+ value: number | string | boolean | null | undefined;
114
117
  } | {
115
118
  k: "arr";
116
119
  element: HarvestSig;
@@ -166,7 +169,7 @@ type HarvestJson = {
166
169
  skipped: number;
167
170
  };
168
171
  };
169
- /** Abs → 签名投影(丢 pred/conf;fn 只留参数名+类型面;保留泛型 α) */
172
+ /** Abs → 签名投影(丢 pred/conf;fn 只留参数名+类型面;保留泛型 α 与 lit term) */
170
173
  declare function absToHarvestSig(a: Abs): HarvestSig;
171
174
  /** 签名投影 → mock Abs(conf 合 mock) */
172
175
  declare function harvestSigToAbs(sig: HarvestSig): Abs;
package/dist/index.js CHANGED
@@ -1521,7 +1521,7 @@ import {
1521
1521
  relationFn as relationFn2,
1522
1522
  getFnImpl as getFnImpl2
1523
1523
  } from "@nudojs/core";
1524
- var HARVEST_DISK_ABI = "nudo-harvest-disk-v7";
1524
+ var HARVEST_DISK_ABI = "nudo-harvest-disk-v8";
1525
1525
  function sha256Hex(data) {
1526
1526
  return createHash("sha256").update(data).digest("hex");
1527
1527
  }
@@ -1529,6 +1529,13 @@ function absToHarvestSig(a) {
1529
1529
  if (a.term?.op === "var") {
1530
1530
  return { k: "tvar", name: a.term.id };
1531
1531
  }
1532
+ if (a.term?.op === "lit") {
1533
+ const v = a.term.value;
1534
+ if (v === null || v === void 0) return { k: "lit", value: v };
1535
+ if (typeof v === "number" || typeof v === "string" || typeof v === "boolean") {
1536
+ return { k: "lit", value: v };
1537
+ }
1538
+ }
1532
1539
  const s = a.shape;
1533
1540
  switch (s.k) {
1534
1541
  case "prim":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nudojs/harvester",
3
- "version": "0.2.16",
3
+ "version": "0.2.19",
4
4
  "engines": {
5
5
  "node": ">=20"
6
6
  },
@@ -29,9 +29,9 @@
29
29
  "registry": "https://registry.npmjs.org"
30
30
  },
31
31
  "dependencies": {
32
- "@nudojs/core": "1.3.0",
33
- "@nudojs/parser": "1.1.8",
34
- "@nudojs/env": "0.4.10",
32
+ "@nudojs/core": "1.5.0",
33
+ "@nudojs/parser": "1.2.1",
34
+ "@nudojs/env": "0.4.13",
35
35
  "@babel/types": "^8.0.6",
36
36
  "typescript": "^6.0.3"
37
37
  },