nudojs 1.3.14 → 1.3.15
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 +58 -6
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -30568,25 +30568,75 @@ function $removeUndefined(a) {
|
|
|
30568
30568
|
}
|
|
30569
30569
|
function $removeMemberNullish(a, key) {
|
|
30570
30570
|
if (!a || typeof a !== "object" || !("shape" in a)) return a;
|
|
30571
|
+
if (a.shape.k === "sum") {
|
|
30572
|
+
const members = a.shape.members;
|
|
30573
|
+
const kept = [];
|
|
30574
|
+
let changed = false;
|
|
30575
|
+
for (const m of members) {
|
|
30576
|
+
const r2 = memberSlotTruthyRefine(m, key);
|
|
30577
|
+
if (r2.kind === "prune") {
|
|
30578
|
+
changed = true;
|
|
30579
|
+
continue;
|
|
30580
|
+
}
|
|
30581
|
+
if (r2.kind === "keep") {
|
|
30582
|
+
kept.push(m);
|
|
30583
|
+
continue;
|
|
30584
|
+
}
|
|
30585
|
+
changed = true;
|
|
30586
|
+
const sh = m.shape;
|
|
30587
|
+
const next2 = { ...m, shape: { ...sh, slots: { ...sh.slots, [key]: r2.slot } } };
|
|
30588
|
+
migrateAccessors(m, next2);
|
|
30589
|
+
migrateInvariants(m, next2);
|
|
30590
|
+
migrateNullProto(m, next2);
|
|
30591
|
+
kept.push(next2);
|
|
30592
|
+
}
|
|
30593
|
+
if (!changed || kept.length === 0) return a;
|
|
30594
|
+
return kept.length === 1 ? kept[0] : { ...a, shape: { k: "sum", members: kept } };
|
|
30595
|
+
}
|
|
30571
30596
|
if (a.shape.k !== "obj") return a;
|
|
30572
30597
|
const slots = a.shape.slots;
|
|
30573
30598
|
if (!Object.prototype.hasOwnProperty.call(slots, key)) return a;
|
|
30599
|
+
const r = memberSlotTruthyRefine(a, key);
|
|
30600
|
+
if (r.kind !== "refine") return a;
|
|
30601
|
+
const next = { ...a, shape: { ...a.shape, slots: { ...slots, [key]: r.slot } } };
|
|
30602
|
+
migrateAccessors(a, next);
|
|
30603
|
+
migrateInvariants(a, next);
|
|
30604
|
+
migrateNullProto(a, next);
|
|
30605
|
+
return next;
|
|
30606
|
+
}
|
|
30607
|
+
function definitelyNullishAbs(a) {
|
|
30608
|
+
if (isNullishLitAbs(a)) return true;
|
|
30609
|
+
if (a.shape.k === "sum") {
|
|
30610
|
+
const members = a.shape.members;
|
|
30611
|
+
return members.length > 0 && members.every((m) => isNullishLitAbs(m));
|
|
30612
|
+
}
|
|
30613
|
+
return false;
|
|
30614
|
+
}
|
|
30615
|
+
function memberSlotTruthyRefine(m, key) {
|
|
30616
|
+
if (m.shape.k !== "obj") return { kind: "keep" };
|
|
30617
|
+
const slots = m.shape.slots;
|
|
30618
|
+
if (!Object.prototype.hasOwnProperty.call(slots, key)) {
|
|
30619
|
+
const sh = m.shape;
|
|
30620
|
+
if (sh.open || sh.index) return { kind: "keep" };
|
|
30621
|
+
if (OBJECT_PROTO_METHOD_NAMES2.has(key) || key === "constructor") return { kind: "keep" };
|
|
30622
|
+
if (accessorTable.get(m)?.has(key)) return { kind: "keep" };
|
|
30623
|
+
return { kind: "prune" };
|
|
30624
|
+
}
|
|
30625
|
+
if (accessorTable.get(m)?.get(key)?.get) return { kind: "keep" };
|
|
30574
30626
|
const slot = slots[key];
|
|
30627
|
+
if (definitelyNullishAbs(slot.value)) return { kind: "prune" };
|
|
30575
30628
|
let value = slot.value;
|
|
30576
|
-
let changed = false;
|
|
30577
30629
|
if (!definitelyNotNullishShape(value.shape) && value.shape.k === "sum") {
|
|
30578
30630
|
const members = value.shape.members;
|
|
30579
|
-
const kept = members.filter((
|
|
30631
|
+
const kept = members.filter((x) => !isNullishLitAbs(x));
|
|
30580
30632
|
if (kept.length > 0 && kept.length < members.length) {
|
|
30581
30633
|
value = kept.length === 1 ? kept[0] : { ...value, shape: { k: "sum", members: kept } };
|
|
30582
|
-
changed = true;
|
|
30583
30634
|
}
|
|
30584
30635
|
}
|
|
30585
|
-
if (slot.optional)
|
|
30586
|
-
if (!changed) return a;
|
|
30636
|
+
if (value === slot.value && !slot.optional) return { kind: "keep" };
|
|
30587
30637
|
const next = { ...slot, value };
|
|
30588
30638
|
delete next.optional;
|
|
30589
|
-
return {
|
|
30639
|
+
return { kind: "refine", slot: next };
|
|
30590
30640
|
}
|
|
30591
30641
|
function typeofOfMember(m) {
|
|
30592
30642
|
const t = m.term;
|
|
@@ -30695,6 +30745,8 @@ var init_async = __esm({
|
|
|
30695
30745
|
init_term();
|
|
30696
30746
|
init_pred();
|
|
30697
30747
|
init_objects();
|
|
30748
|
+
init_builtins();
|
|
30749
|
+
init_members();
|
|
30698
30750
|
init_leq();
|
|
30699
30751
|
init_abs_fn();
|
|
30700
30752
|
init_surface();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nudojs",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.15",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": ">=20"
|
|
6
6
|
},
|
|
@@ -46,11 +46,11 @@
|
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@babel/generator": "^8.0.6",
|
|
48
48
|
"@babel/types": "^8.0.6",
|
|
49
|
-
"@nudojs/core": "1.9.
|
|
50
|
-
"@nudojs/env": "0.4.
|
|
51
|
-
"@nudojs/harvester": "0.3.
|
|
52
|
-
"@nudojs/parser": "1.4.
|
|
53
|
-
"@nudojs/service": "1.6.
|
|
49
|
+
"@nudojs/core": "1.9.2",
|
|
50
|
+
"@nudojs/env": "0.4.29",
|
|
51
|
+
"@nudojs/harvester": "0.3.15",
|
|
52
|
+
"@nudojs/parser": "1.4.11",
|
|
53
|
+
"@nudojs/service": "1.6.14",
|
|
54
54
|
"commander": "^15.0.0"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|