@oasys/oecs 0.3.0 → 0.4.0
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/README.md +196 -267
- package/dist/array-CxbPyiHO.cjs +1 -0
- package/dist/array-uFR7Q8fU.js +132 -0
- package/dist/core/ecs/access_check.d.ts +77 -0
- package/dist/core/ecs/access_check.d.ts.map +1 -0
- package/dist/core/ecs/archetype.d.ts +474 -0
- package/dist/core/ecs/archetype.d.ts.map +1 -0
- package/dist/core/ecs/builtin_relations.d.ts +43 -0
- package/dist/core/ecs/builtin_relations.d.ts.map +1 -0
- package/dist/core/ecs/command_log.d.ts +113 -0
- package/dist/core/ecs/command_log.d.ts.map +1 -0
- package/dist/core/ecs/component.d.ts +106 -0
- package/dist/core/ecs/component.d.ts.map +1 -0
- package/dist/core/ecs/compute_backend.d.ts +37 -0
- package/dist/core/ecs/compute_backend.d.ts.map +1 -0
- package/dist/core/ecs/dispatch_trace.d.ts +93 -0
- package/dist/core/ecs/dispatch_trace.d.ts.map +1 -0
- package/dist/core/ecs/ecs.d.ts +533 -0
- package/dist/core/ecs/ecs.d.ts.map +1 -0
- package/dist/core/ecs/ecs_memory.d.ts +179 -0
- package/dist/core/ecs/ecs_memory.d.ts.map +1 -0
- package/dist/core/ecs/entity.d.ts +28 -0
- package/dist/core/ecs/entity.d.ts.map +1 -0
- package/dist/core/ecs/event.d.ts +54 -0
- package/dist/core/ecs/event.d.ts.map +1 -0
- package/dist/core/ecs/frame_trace.d.ts +133 -0
- package/dist/core/ecs/frame_trace.d.ts.map +1 -0
- package/dist/core/ecs/host_commands.d.ts +252 -0
- package/dist/core/ecs/host_commands.d.ts.map +1 -0
- package/dist/core/ecs/index.d.ts +41 -0
- package/dist/core/ecs/index.d.ts.map +1 -0
- package/dist/core/ecs/observer.d.ts +142 -0
- package/dist/core/ecs/observer.d.ts.map +1 -0
- package/dist/core/ecs/query.d.ts +557 -0
- package/dist/core/ecs/query.d.ts.map +1 -0
- package/dist/core/ecs/ref.d.ts +31 -0
- package/dist/core/ecs/ref.d.ts.map +1 -0
- package/dist/core/ecs/relation.d.ts +231 -0
- package/dist/core/ecs/relation.d.ts.map +1 -0
- package/dist/core/ecs/resource.d.ts +33 -0
- package/dist/core/ecs/resource.d.ts.map +1 -0
- package/dist/core/ecs/resume.d.ts +85 -0
- package/dist/core/ecs/resume.d.ts.map +1 -0
- package/dist/core/ecs/run_condition.d.ts +75 -0
- package/dist/core/ecs/run_condition.d.ts.map +1 -0
- package/dist/core/ecs/schedule.d.ts +133 -0
- package/dist/core/ecs/schedule.d.ts.map +1 -0
- package/dist/core/ecs/sparse_store.d.ts +107 -0
- package/dist/core/ecs/sparse_store.d.ts.map +1 -0
- package/dist/core/ecs/store.d.ts +1149 -0
- package/dist/core/ecs/store.d.ts.map +1 -0
- package/dist/core/ecs/store_layout_listener.d.ts +23 -0
- package/dist/core/ecs/store_layout_listener.d.ts.map +1 -0
- package/dist/core/ecs/system.d.ts +134 -0
- package/dist/core/ecs/system.d.ts.map +1 -0
- package/dist/core/ecs/utils/arrays.d.ts +7 -0
- package/dist/core/ecs/utils/arrays.d.ts.map +1 -0
- package/dist/core/ecs/utils/constants.d.ts +12 -0
- package/dist/core/ecs/utils/constants.d.ts.map +1 -0
- package/dist/core/ecs/utils/error.d.ts +51 -0
- package/dist/core/ecs/utils/error.d.ts.map +1 -0
- package/dist/core/reactive/array.d.ts +24 -0
- package/dist/core/reactive/array.d.ts.map +1 -0
- package/dist/core/reactive/index.cjs +1 -0
- package/dist/core/reactive/index.d.ts +10 -0
- package/dist/core/reactive/index.d.ts.map +1 -0
- package/dist/core/reactive/index.js +17 -0
- package/dist/core/reactive/interop.d.ts +19 -0
- package/dist/core/reactive/interop.d.ts.map +1 -0
- package/dist/core/reactive/kernel.d.ts +71 -0
- package/dist/core/reactive/kernel.d.ts.map +1 -0
- package/dist/core/reactive/map.d.ts +16 -0
- package/dist/core/reactive/map.d.ts.map +1 -0
- package/dist/core/reactive/struct.d.ts +10 -0
- package/dist/core/reactive/struct.d.ts.map +1 -0
- package/dist/core/store/__generated__/abi.d.ts +43 -0
- package/dist/core/store/__generated__/abi.d.ts.map +1 -0
- package/dist/core/store/action_ring.d.ts +136 -0
- package/dist/core/store/action_ring.d.ts.map +1 -0
- package/dist/core/store/allocator.d.ts +238 -0
- package/dist/core/store/allocator.d.ts.map +1 -0
- package/dist/core/store/buffer_backed_column.d.ts +69 -0
- package/dist/core/store/buffer_backed_column.d.ts.map +1 -0
- package/dist/core/store/column_store.d.ts +265 -0
- package/dist/core/store/column_store.d.ts.map +1 -0
- package/dist/core/store/command_dispatch.d.ts +52 -0
- package/dist/core/store/command_dispatch.d.ts.map +1 -0
- package/dist/core/store/command_ring.d.ts +107 -0
- package/dist/core/store/command_ring.d.ts.map +1 -0
- package/dist/core/store/descriptor.d.ts +80 -0
- package/dist/core/store/descriptor.d.ts.map +1 -0
- package/dist/core/store/entity_index.d.ts +108 -0
- package/dist/core/store/entity_index.d.ts.map +1 -0
- package/dist/core/store/event_ring.d.ts +95 -0
- package/dist/core/store/event_ring.d.ts.map +1 -0
- package/dist/core/store/extend.d.ts +109 -0
- package/dist/core/store/extend.d.ts.map +1 -0
- package/dist/core/store/grow.d.ts +39 -0
- package/dist/core/store/grow.d.ts.map +1 -0
- package/dist/core/store/header.d.ts +64 -0
- package/dist/core/store/header.d.ts.map +1 -0
- package/dist/core/store/index.d.ts +16 -0
- package/dist/core/store/index.d.ts.map +1 -0
- package/dist/core/store/region_table.d.ts +74 -0
- package/dist/core/store/region_table.d.ts.map +1 -0
- package/dist/core/store/snapshot.d.ts +43 -0
- package/dist/core/store/snapshot.d.ts.map +1 -0
- package/dist/core/store/state_hash.d.ts +38 -0
- package/dist/core/store/state_hash.d.ts.map +1 -0
- package/dist/core/store/store_regions.d.ts +38 -0
- package/dist/core/store/store_regions.d.ts.map +1 -0
- package/dist/extensions/editor/editor.d.ts +149 -0
- package/dist/extensions/editor/editor.d.ts.map +1 -0
- package/dist/extensions/editor/field_handle.d.ts +35 -0
- package/dist/extensions/editor/field_handle.d.ts.map +1 -0
- package/dist/extensions/editor/index.cjs +1 -0
- package/dist/extensions/editor/index.d.ts +21 -0
- package/dist/extensions/editor/index.d.ts.map +1 -0
- package/dist/extensions/editor/index.js +209 -0
- package/dist/extensions/reactive/ecs_sync.d.ts +210 -0
- package/dist/extensions/reactive/ecs_sync.d.ts.map +1 -0
- package/dist/extensions/reactive/index.cjs +1 -0
- package/dist/extensions/reactive/index.d.ts +23 -0
- package/dist/extensions/reactive/index.d.ts.map +1 -0
- package/dist/extensions/reactive/index.js +225 -0
- package/dist/extensions/solid/index.cjs +1 -0
- package/dist/extensions/solid/index.d.ts +6 -0
- package/dist/extensions/solid/index.d.ts.map +1 -0
- package/dist/extensions/solid/index.js +32 -0
- package/dist/extensions/solid/kernel_solid.d.ts +42 -0
- package/dist/extensions/solid/kernel_solid.d.ts.map +1 -0
- package/dist/index.cjs +2 -1
- package/dist/index.d.ts +16 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8563 -1233
- package/dist/interop-CT-REx0W.cjs +1 -0
- package/dist/interop-CcY6ASQc.js +18 -0
- package/dist/kernel-DgyrLFjW.js +227 -0
- package/dist/kernel-yWV3XnAb.cjs +1 -0
- package/dist/log/console_sink.d.ts +4 -0
- package/dist/log/console_sink.d.ts.map +1 -0
- package/dist/log/index.d.ts +3 -0
- package/dist/log/index.d.ts.map +1 -0
- package/dist/log/logger.d.ts +27 -0
- package/dist/log/logger.d.ts.map +1 -0
- package/dist/primitives.cjs +1 -0
- package/dist/primitives.d.ts +18 -0
- package/dist/primitives.d.ts.map +1 -0
- package/dist/primitives.js +44 -0
- package/dist/shared-BXSZnxx4.cjs +1 -0
- package/dist/shared-C678TAPY.js +99 -0
- package/dist/shared.cjs +1 -0
- package/dist/shared.d.ts +22 -0
- package/dist/shared.d.ts.map +1 -0
- package/dist/shared.js +7 -0
- package/dist/topological_sort-DlRpSrxu.js +391 -0
- package/dist/topological_sort-WAT-VHb-.cjs +1 -0
- package/dist/type_primitives/assertions.d.ts +12 -8
- package/dist/type_primitives/assertions.d.ts.map +1 -1
- package/dist/type_primitives/binary_heap/binary_heap.d.ts +6 -2
- package/dist/type_primitives/binary_heap/binary_heap.d.ts.map +1 -1
- package/dist/type_primitives/bitset/bitset.d.ts +16 -4
- package/dist/type_primitives/bitset/bitset.d.ts.map +1 -1
- package/dist/type_primitives/brand.d.ts +6 -1
- package/dist/type_primitives/brand.d.ts.map +1 -1
- package/dist/type_primitives/error.d.ts +4 -0
- package/dist/type_primitives/error.d.ts.map +1 -1
- package/dist/type_primitives/index.d.ts +3 -0
- package/dist/type_primitives/index.d.ts.map +1 -1
- package/dist/type_primitives/sparse_map/sparse_map.d.ts +7 -3
- package/dist/type_primitives/sparse_map/sparse_map.d.ts.map +1 -1
- package/dist/type_primitives/sparse_set/sparse_set.d.ts +4 -0
- package/dist/type_primitives/sparse_set/sparse_set.d.ts.map +1 -1
- package/dist/type_primitives/topological_sort/topological_sort.d.ts +7 -3
- package/dist/type_primitives/topological_sort/topological_sort.d.ts.map +1 -1
- package/dist/type_primitives/typed_arrays/typed_arrays.d.ts +53 -16
- package/dist/type_primitives/typed_arrays/typed_arrays.d.ts.map +1 -1
- package/dist/utils/arrays.d.ts +1 -1
- package/dist/utils/arrays.d.ts.map +1 -1
- package/dist/utils/error.d.ts +2 -20
- package/dist/utils/error.d.ts.map +1 -1
- package/package.json +36 -9
- package/dist/archetype.d.ts +0 -101
- package/dist/archetype.d.ts.map +0 -1
- package/dist/component.d.ts +0 -45
- package/dist/component.d.ts.map +0 -1
- package/dist/ecs.d.ts +0 -104
- package/dist/ecs.d.ts.map +0 -1
- package/dist/entity.d.ts +0 -11
- package/dist/entity.d.ts.map +0 -1
- package/dist/event.d.ts +0 -30
- package/dist/event.d.ts.map +0 -1
- package/dist/query.d.ts +0 -90
- package/dist/query.d.ts.map +0 -1
- package/dist/ref.d.ts +0 -23
- package/dist/ref.d.ts.map +0 -1
- package/dist/resource.d.ts +0 -23
- package/dist/resource.d.ts.map +0 -1
- package/dist/schedule.d.ts +0 -45
- package/dist/schedule.d.ts.map +0 -1
- package/dist/store.d.ts +0 -118
- package/dist/store.d.ts.map +0 -1
- package/dist/system.d.ts +0 -16
- package/dist/system.d.ts.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const n=require("./kernel-yWV3XnAb.cjs");function u(e,t){let r=!1;return n.effect(()=>{const s=e();r?n.untrack(()=>t(s)):r=!0})}function i(e){return{subscribe:t=>u(e,()=>t()),getSnapshot:e}}exports.subscribe=u;exports.toExternalStore=i;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { e as n, u } from "./kernel-DgyrLFjW.js";
|
|
2
|
+
function a(e, t) {
|
|
3
|
+
let r = !1;
|
|
4
|
+
return n(() => {
|
|
5
|
+
const s = e();
|
|
6
|
+
r ? u(() => t(s)) : r = !0;
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
function f(e) {
|
|
10
|
+
return {
|
|
11
|
+
subscribe: (t) => a(e, () => t()),
|
|
12
|
+
getSnapshot: e
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export {
|
|
16
|
+
a as s,
|
|
17
|
+
f as t
|
|
18
|
+
};
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
let l = null, v = 0, c = !1, I = 0;
|
|
2
|
+
const a = [];
|
|
3
|
+
let h, r = null;
|
|
4
|
+
function f(s) {
|
|
5
|
+
const e = s.owned;
|
|
6
|
+
if (e !== null) {
|
|
7
|
+
s.owned = null;
|
|
8
|
+
for (let t = e.length - 1; t >= 0; t--) e[t].dispose();
|
|
9
|
+
}
|
|
10
|
+
const i = s.cleanups;
|
|
11
|
+
if (i !== null) {
|
|
12
|
+
s.cleanups = null;
|
|
13
|
+
for (let t = i.length - 1; t >= 0; t--) i[t]();
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function d(s) {
|
|
17
|
+
r !== null && (r.owned ??= []).push(s);
|
|
18
|
+
}
|
|
19
|
+
function D(s, e) {
|
|
20
|
+
const i = e.depsTail;
|
|
21
|
+
if (i !== void 0 && i.source === s) {
|
|
22
|
+
i.version = s.version;
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const t = i !== void 0 ? i.nextDep : e.deps;
|
|
26
|
+
if (t !== void 0 && t.source === s) {
|
|
27
|
+
t.version = s.version, e.depsTail = t;
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const n = O(s, e, i, t);
|
|
31
|
+
n.version = s.version, i !== void 0 ? i.nextDep = n : e.deps = n, t !== void 0 && (t.prevDep = n), e.depsTail = n, n.prevSub = s.subsTail, s.subsTail !== void 0 ? s.subsTail.nextSub = n : s.subs = n, s.subsTail = n;
|
|
32
|
+
}
|
|
33
|
+
function O(s, e, i, t) {
|
|
34
|
+
const n = h;
|
|
35
|
+
return n !== void 0 ? (h = n.nextDep, n.source = s, n.target = e, n.version = 0, n.prevDep = i, n.nextDep = t, n.prevSub = void 0, n.nextSub = void 0, n) : { source: s, target: e, version: 0, prevSub: void 0, nextSub: void 0, prevDep: i, nextDep: t };
|
|
36
|
+
}
|
|
37
|
+
function p(s) {
|
|
38
|
+
const { source: e, target: i, prevDep: t, nextDep: n, prevSub: o, nextSub: u } = s;
|
|
39
|
+
return t !== void 0 ? t.nextDep = n : i.deps = n, n !== void 0 && (n.prevDep = t), o !== void 0 ? o.nextSub = u : e.subs = u, u !== void 0 ? u.prevSub = o : e.subsTail = o, s.prevDep = void 0, s.prevSub = void 0, s.nextSub = void 0, s.nextDep = h, h = s, n;
|
|
40
|
+
}
|
|
41
|
+
function T(s) {
|
|
42
|
+
s.depsTail = void 0;
|
|
43
|
+
}
|
|
44
|
+
function g(s) {
|
|
45
|
+
const e = s.depsTail;
|
|
46
|
+
let i = e !== void 0 ? e.nextDep : s.deps;
|
|
47
|
+
for (; i !== void 0; ) i = p(i);
|
|
48
|
+
}
|
|
49
|
+
function S(s) {
|
|
50
|
+
for (let e = s.deps; e !== void 0; e = e.nextDep)
|
|
51
|
+
if (e.source.refresh(), e.version !== e.source.version) return !0;
|
|
52
|
+
return !1;
|
|
53
|
+
}
|
|
54
|
+
function b(s) {
|
|
55
|
+
for (let e = s.subs; e !== void 0; e = e.nextSub)
|
|
56
|
+
e.target.notify();
|
|
57
|
+
}
|
|
58
|
+
class w {
|
|
59
|
+
value;
|
|
60
|
+
eq;
|
|
61
|
+
version = 0;
|
|
62
|
+
subs = void 0;
|
|
63
|
+
subsTail = void 0;
|
|
64
|
+
constructor(e, i) {
|
|
65
|
+
this.value = e, this.eq = i;
|
|
66
|
+
}
|
|
67
|
+
refresh() {
|
|
68
|
+
}
|
|
69
|
+
get() {
|
|
70
|
+
return l !== null && D(this, l), this.value;
|
|
71
|
+
}
|
|
72
|
+
set(e) {
|
|
73
|
+
this.eq(this.value, e) || (this.value = e, this.version++, this.subs !== void 0 && (b(this), v === 0 && E()));
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
class N {
|
|
77
|
+
value;
|
|
78
|
+
// assigned by the first refresh, which always runs before any read
|
|
79
|
+
fn;
|
|
80
|
+
eq;
|
|
81
|
+
version = 0;
|
|
82
|
+
subs = void 0;
|
|
83
|
+
subsTail = void 0;
|
|
84
|
+
deps = void 0;
|
|
85
|
+
depsTail = void 0;
|
|
86
|
+
flags = 4;
|
|
87
|
+
cleanups = null;
|
|
88
|
+
owned = null;
|
|
89
|
+
constructor(e, i) {
|
|
90
|
+
this.fn = e, this.eq = i;
|
|
91
|
+
}
|
|
92
|
+
refresh() {
|
|
93
|
+
if (this.flags & 9 || (this.flags &= -3, !(this.flags & 4) && this.version !== 0) || (this.flags &= -5, this.version !== 0 && !S(this))) return;
|
|
94
|
+
this.flags |= 1, f(this), T(this);
|
|
95
|
+
const e = l, i = r;
|
|
96
|
+
l = this, r = this;
|
|
97
|
+
try {
|
|
98
|
+
const t = this.fn();
|
|
99
|
+
(this.version === 0 || !this.eq(this.value, t)) && (this.value = t, this.version++);
|
|
100
|
+
} finally {
|
|
101
|
+
l = e, r = i, g(this), this.flags &= -2;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
get() {
|
|
105
|
+
return this.flags & 1 ? this.value : (this.refresh(), l !== null && D(this, l), this.value);
|
|
106
|
+
}
|
|
107
|
+
notify() {
|
|
108
|
+
this.flags & 2 || (this.flags |= 6, b(this));
|
|
109
|
+
}
|
|
110
|
+
dispose() {
|
|
111
|
+
if (this.flags & 8) return;
|
|
112
|
+
this.flags |= 8;
|
|
113
|
+
let e = this.deps;
|
|
114
|
+
for (; e !== void 0; ) e = p(e);
|
|
115
|
+
this.depsTail = void 0, f(this);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
class y {
|
|
119
|
+
fn;
|
|
120
|
+
deps = void 0;
|
|
121
|
+
depsTail = void 0;
|
|
122
|
+
flags = 0;
|
|
123
|
+
lastFlush = 0;
|
|
124
|
+
// the flush generation this effect last ran in (cycle backstop)
|
|
125
|
+
cleanups = null;
|
|
126
|
+
owned = null;
|
|
127
|
+
constructor(e) {
|
|
128
|
+
this.fn = e;
|
|
129
|
+
}
|
|
130
|
+
notify() {
|
|
131
|
+
this.flags & 2 || (this.flags |= 18, a.push(this));
|
|
132
|
+
}
|
|
133
|
+
run() {
|
|
134
|
+
if (this.flags & 8) return;
|
|
135
|
+
f(this), T(this);
|
|
136
|
+
const e = l, i = r;
|
|
137
|
+
l = this, r = this;
|
|
138
|
+
try {
|
|
139
|
+
this.fn();
|
|
140
|
+
} finally {
|
|
141
|
+
l = e, r = i, g(this);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
dispose() {
|
|
145
|
+
if (this.flags & 8) return;
|
|
146
|
+
this.flags |= 8;
|
|
147
|
+
let e = this.deps;
|
|
148
|
+
for (; e !== void 0; ) e = p(e);
|
|
149
|
+
this.depsTail = void 0, f(this);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
function E() {
|
|
153
|
+
if (c) return;
|
|
154
|
+
c = !0;
|
|
155
|
+
const s = ++I;
|
|
156
|
+
let e = 0, i, t = !1;
|
|
157
|
+
try {
|
|
158
|
+
for (let n = 0; n < a.length; n++) {
|
|
159
|
+
const o = a[n];
|
|
160
|
+
if (o.flags &= -19, !(o.flags & 8) && S(o)) {
|
|
161
|
+
if (o.lastFlush === s && ++e > 1e5)
|
|
162
|
+
throw new Error(
|
|
163
|
+
"reactive flush did not settle after 100000 cascading re-runs (an effect likely writes a signal it depends on — a cycle)"
|
|
164
|
+
);
|
|
165
|
+
o.lastFlush = s;
|
|
166
|
+
try {
|
|
167
|
+
o.run();
|
|
168
|
+
} catch (u) {
|
|
169
|
+
t || (i = u, t = !0);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
} finally {
|
|
174
|
+
a.length = 0, c = !1;
|
|
175
|
+
}
|
|
176
|
+
if (t) throw i;
|
|
177
|
+
}
|
|
178
|
+
function x(s, e = Object.is) {
|
|
179
|
+
const i = new w(s, e);
|
|
180
|
+
return [() => i.get(), (t) => i.set(t)];
|
|
181
|
+
}
|
|
182
|
+
function A(s, e = Object.is) {
|
|
183
|
+
const i = new N(s, e);
|
|
184
|
+
return d(i), () => i.get();
|
|
185
|
+
}
|
|
186
|
+
function U(s) {
|
|
187
|
+
const e = new y(s);
|
|
188
|
+
return d(e), e.run(), () => e.dispose();
|
|
189
|
+
}
|
|
190
|
+
function F(s) {
|
|
191
|
+
v++;
|
|
192
|
+
try {
|
|
193
|
+
s();
|
|
194
|
+
} finally {
|
|
195
|
+
--v === 0 && E();
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
function k(s) {
|
|
199
|
+
const e = l;
|
|
200
|
+
l = null;
|
|
201
|
+
try {
|
|
202
|
+
return s();
|
|
203
|
+
} finally {
|
|
204
|
+
l = e;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
function P(s) {
|
|
208
|
+
const e = { cleanups: null, owned: null }, i = r;
|
|
209
|
+
r = e;
|
|
210
|
+
try {
|
|
211
|
+
return s(() => f(e));
|
|
212
|
+
} finally {
|
|
213
|
+
r = i;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
function C(s) {
|
|
217
|
+
r !== null && (r.cleanups ??= []).push(s);
|
|
218
|
+
}
|
|
219
|
+
export {
|
|
220
|
+
F as b,
|
|
221
|
+
A as c,
|
|
222
|
+
U as e,
|
|
223
|
+
C as o,
|
|
224
|
+
P as r,
|
|
225
|
+
x as s,
|
|
226
|
+
k as u
|
|
227
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";let l=null,v=0,c=!1,I=0;const a=[];let h,r=null;function f(s){const e=s.owned;if(e!==null){s.owned=null;for(let i=e.length-1;i>=0;i--)e[i].dispose()}const t=s.cleanups;if(t!==null){s.cleanups=null;for(let i=t.length-1;i>=0;i--)t[i]()}}function d(s){r!==null&&(r.owned??=[]).push(s)}function D(s,e){const t=e.depsTail;if(t!==void 0&&t.source===s){t.version=s.version;return}const i=t!==void 0?t.nextDep:e.deps;if(i!==void 0&&i.source===s){i.version=s.version,e.depsTail=i;return}const n=O(s,e,t,i);n.version=s.version,t!==void 0?t.nextDep=n:e.deps=n,i!==void 0&&(i.prevDep=n),e.depsTail=n,n.prevSub=s.subsTail,s.subsTail!==void 0?s.subsTail.nextSub=n:s.subs=n,s.subsTail=n}function O(s,e,t,i){const n=h;return n!==void 0?(h=n.nextDep,n.source=s,n.target=e,n.version=0,n.prevDep=t,n.nextDep=i,n.prevSub=void 0,n.nextSub=void 0,n):{source:s,target:e,version:0,prevSub:void 0,nextSub:void 0,prevDep:t,nextDep:i}}function p(s){const{source:e,target:t,prevDep:i,nextDep:n,prevSub:o,nextSub:u}=s;return i!==void 0?i.nextDep=n:t.deps=n,n!==void 0&&(n.prevDep=i),o!==void 0?o.nextSub=u:e.subs=u,u!==void 0?u.prevSub=o:e.subsTail=o,s.prevDep=void 0,s.prevSub=void 0,s.nextSub=void 0,s.nextDep=h,h=s,n}function T(s){s.depsTail=void 0}function g(s){const e=s.depsTail;let t=e!==void 0?e.nextDep:s.deps;for(;t!==void 0;)t=p(t)}function S(s){for(let e=s.deps;e!==void 0;e=e.nextDep)if(e.source.refresh(),e.version!==e.source.version)return!0;return!1}function b(s){for(let e=s.subs;e!==void 0;e=e.nextSub)e.target.notify()}class w{value;eq;version=0;subs=void 0;subsTail=void 0;constructor(e,t){this.value=e,this.eq=t}refresh(){}get(){return l!==null&&D(this,l),this.value}set(e){this.eq(this.value,e)||(this.value=e,this.version++,this.subs!==void 0&&(b(this),v===0&&E()))}}class N{value;fn;eq;version=0;subs=void 0;subsTail=void 0;deps=void 0;depsTail=void 0;flags=4;cleanups=null;owned=null;constructor(e,t){this.fn=e,this.eq=t}refresh(){if(this.flags&9||(this.flags&=-3,!(this.flags&4)&&this.version!==0)||(this.flags&=-5,this.version!==0&&!S(this)))return;this.flags|=1,f(this),T(this);const e=l,t=r;l=this,r=this;try{const i=this.fn();(this.version===0||!this.eq(this.value,i))&&(this.value=i,this.version++)}finally{l=e,r=t,g(this),this.flags&=-2}}get(){return this.flags&1?this.value:(this.refresh(),l!==null&&D(this,l),this.value)}notify(){this.flags&2||(this.flags|=6,b(this))}dispose(){if(this.flags&8)return;this.flags|=8;let e=this.deps;for(;e!==void 0;)e=p(e);this.depsTail=void 0,f(this)}}class y{fn;deps=void 0;depsTail=void 0;flags=0;lastFlush=0;cleanups=null;owned=null;constructor(e){this.fn=e}notify(){this.flags&2||(this.flags|=18,a.push(this))}run(){if(this.flags&8)return;f(this),T(this);const e=l,t=r;l=this,r=this;try{this.fn()}finally{l=e,r=t,g(this)}}dispose(){if(this.flags&8)return;this.flags|=8;let e=this.deps;for(;e!==void 0;)e=p(e);this.depsTail=void 0,f(this)}}function E(){if(c)return;c=!0;const s=++I;let e=0,t,i=!1;try{for(let n=0;n<a.length;n++){const o=a[n];if(o.flags&=-19,!(o.flags&8)&&S(o)){if(o.lastFlush===s&&++e>1e5)throw new Error("reactive flush did not settle after 100000 cascading re-runs (an effect likely writes a signal it depends on — a cycle)");o.lastFlush=s;try{o.run()}catch(u){i||(t=u,i=!0)}}}}finally{a.length=0,c=!1}if(i)throw t}function x(s,e=Object.is){const t=new w(s,e);return[()=>t.get(),i=>t.set(i)]}function A(s,e=Object.is){const t=new N(s,e);return d(t),()=>t.get()}function U(s){const e=new y(s);return d(e),e.run(),()=>e.dispose()}function k(s){v++;try{s()}finally{--v===0&&E()}}function F(s){const e=l;l=null;try{return s()}finally{l=e}}function C(s){const e={cleanups:null,owned:null},t=r;r=e;try{return s(()=>f(e))}finally{r=t}}function P(s){r!==null&&(r.cleanups??=[]).push(s)}exports.batch=k;exports.computed=A;exports.effect=U;exports.onCleanup=P;exports.root=C;exports.signal=x;exports.untrack=F;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"console_sink.d.ts","sourceRoot":"","sources":["../../src/log/console_sink.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAY,OAAO,EAAE,MAAM,UAAU,CAAC;AAElD,yFAAyF;AACzF,eAAO,MAAM,WAAW,EAAE,OAEzB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/log/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,KAAK,QAAQ,EAAE,KAAK,OAAO,EAAE,MAAM,UAAU,CAAC;AAC7E,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare enum LOG_CATEGORY {
|
|
2
|
+
ECS = "ECS"
|
|
3
|
+
}
|
|
4
|
+
export interface LogEntry {
|
|
5
|
+
readonly timestamp: number;
|
|
6
|
+
readonly wallTime: number;
|
|
7
|
+
readonly category: LOG_CATEGORY;
|
|
8
|
+
readonly message: string;
|
|
9
|
+
}
|
|
10
|
+
/** Notified with each new entry as it is logged. */
|
|
11
|
+
export type LogSink = (entry: LogEntry) => void;
|
|
12
|
+
declare class Logger {
|
|
13
|
+
private _entries;
|
|
14
|
+
private _capacity;
|
|
15
|
+
private readonly _sinks;
|
|
16
|
+
constructor(capacity?: number);
|
|
17
|
+
get capacity(): number;
|
|
18
|
+
setCapacity(value: number): void;
|
|
19
|
+
get entries(): readonly LogEntry[];
|
|
20
|
+
log(category: LOG_CATEGORY, message: string): void;
|
|
21
|
+
clear(): void;
|
|
22
|
+
/** Register a sink notified on every subsequent `log()`. Returns an unsubscribe fn. */
|
|
23
|
+
subscribe(sink: LogSink): () => void;
|
|
24
|
+
}
|
|
25
|
+
export declare const logger: Logger;
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/log/logger.ts"],"names":[],"mappings":"AAQA,oBAAY,YAAY;IACvB,GAAG,QAAQ;CACX;AAED,MAAM,WAAW,QAAQ;IACxB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAAC;IAChC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CACzB;AAED,oDAAoD;AACpD,MAAM,MAAM,OAAO,GAAG,CAAC,KAAK,EAAE,QAAQ,KAAK,IAAI,CAAC;AAIhD,cAAM,MAAM;IACX,OAAO,CAAC,QAAQ,CAAkB;IAClC,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA2B;gBAE/B,QAAQ,GAAE,MAAqB;IAIlD,IAAW,QAAQ,IAAI,MAAM,CAE5B;IAEM,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAOvC,IAAW,OAAO,IAAI,SAAS,QAAQ,EAAE,CAExC;IAEM,GAAG,CAAC,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAkBlD,KAAK,IAAI,IAAI;IAIpB,uFAAuF;IAChF,SAAS,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,IAAI;CAM3C;AAID,eAAO,MAAM,MAAM,QAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./topological_sort-WAT-VHb-.cjs");class s{_dense=[];_sparse=[];get size(){return this._dense.length}get values(){return this._dense}has(e){return this._dense[this._sparse[e]]===e}add(e){this.has(e)||(this._sparse[e]=this._dense.length,this._dense.push(e))}delete(e){if(!this.has(e))return!1;const t=this._sparse[e],a=this._dense[this._dense.length-1];return this._dense[t]=a,this._sparse[a]=t,this._dense.pop(),!0}clear(){this._dense.length=0,this._sparse.length=0}[Symbol.iterator](){return this._dense[Symbol.iterator]()}}exports.BinaryHeap=r.BinaryHeap;exports.BitSet=r.BitSet;exports.GrowableFloat32Array=r.GrowableFloat32Array;exports.GrowableFloat64Array=r.GrowableFloat64Array;exports.GrowableInt16Array=r.GrowableInt16Array;exports.GrowableInt32Array=r.GrowableInt32Array;exports.GrowableInt8Array=r.GrowableInt8Array;exports.GrowableTypedArray=r.GrowableTypedArray;exports.GrowableUint16Array=r.GrowableUint16Array;exports.GrowableUint32Array=r.GrowableUint32Array;exports.GrowableUint8Array=r.GrowableUint8Array;exports.SparseMap=r.SparseMap;exports.topologicalSort=r.topologicalSort;exports.SparseSet=s;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@oasys/oecs/primitives` — the general-purpose data-structure primitives the
|
|
3
|
+
* ECS is built on, surfaced for direct consumer use: a bit set, sparse set/map,
|
|
4
|
+
* growable typed arrays, a binary heap, and a topological sort.
|
|
5
|
+
*
|
|
6
|
+
* These are the low-level building blocks only; the ECS itself is the default
|
|
7
|
+
* `@oasys/oecs` entry. The internal assertion, brand, and error helpers under
|
|
8
|
+
* `src/type_primitives/` are intentionally NOT re-exported here.
|
|
9
|
+
*
|
|
10
|
+
* @module
|
|
11
|
+
*/
|
|
12
|
+
export { BitSet } from './type_primitives/bitset/bitset';
|
|
13
|
+
export { SparseSet } from './type_primitives/sparse_set/sparse_set';
|
|
14
|
+
export { SparseMap } from './type_primitives/sparse_map/sparse_map';
|
|
15
|
+
export { GrowableTypedArray, GrowableFloat32Array, GrowableFloat64Array, GrowableInt8Array, GrowableInt16Array, GrowableInt32Array, GrowableUint8Array, GrowableUint16Array, GrowableUint32Array, type TypedArrayTag, type AnyTypedArray } from './type_primitives/typed_arrays/typed_arrays';
|
|
16
|
+
export { BinaryHeap, type CompareFn } from './type_primitives/binary_heap/binary_heap';
|
|
17
|
+
export { topologicalSort } from './type_primitives/topological_sort/topological_sort';
|
|
18
|
+
//# sourceMappingURL=primitives.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"primitives.d.ts","sourceRoot":"","sources":["../src/primitives.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EACN,kBAAkB,EAClB,oBAAoB,EACpB,oBAAoB,EACpB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,mBAAmB,EACnB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,KAAK,SAAS,EAAE,MAAM,2CAA2C,CAAC;AACvF,OAAO,EAAE,eAAe,EAAE,MAAM,qDAAqD,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { i as h, B as l, a as o, b as _, d, e as p, c as b, G as u, g as w, h as G, f as g, S as y, t as A } from "./topological_sort-DlRpSrxu.js";
|
|
2
|
+
class t {
|
|
3
|
+
_dense = [];
|
|
4
|
+
_sparse = [];
|
|
5
|
+
get size() {
|
|
6
|
+
return this._dense.length;
|
|
7
|
+
}
|
|
8
|
+
get values() {
|
|
9
|
+
return this._dense;
|
|
10
|
+
}
|
|
11
|
+
has(s) {
|
|
12
|
+
return this._dense[this._sparse[s]] === s;
|
|
13
|
+
}
|
|
14
|
+
add(s) {
|
|
15
|
+
this.has(s) || (this._sparse[s] = this._dense.length, this._dense.push(s));
|
|
16
|
+
}
|
|
17
|
+
delete(s) {
|
|
18
|
+
if (!this.has(s)) return !1;
|
|
19
|
+
const e = this._sparse[s], r = this._dense[this._dense.length - 1];
|
|
20
|
+
return this._dense[e] = r, this._sparse[r] = e, this._dense.pop(), !0;
|
|
21
|
+
}
|
|
22
|
+
clear() {
|
|
23
|
+
this._dense.length = 0, this._sparse.length = 0;
|
|
24
|
+
}
|
|
25
|
+
[Symbol.iterator]() {
|
|
26
|
+
return this._dense[Symbol.iterator]();
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export {
|
|
30
|
+
h as BinaryHeap,
|
|
31
|
+
l as BitSet,
|
|
32
|
+
o as GrowableFloat32Array,
|
|
33
|
+
_ as GrowableFloat64Array,
|
|
34
|
+
d as GrowableInt16Array,
|
|
35
|
+
p as GrowableInt32Array,
|
|
36
|
+
b as GrowableInt8Array,
|
|
37
|
+
u as GrowableTypedArray,
|
|
38
|
+
w as GrowableUint16Array,
|
|
39
|
+
G as GrowableUint32Array,
|
|
40
|
+
g as GrowableUint8Array,
|
|
41
|
+
y as SparseMap,
|
|
42
|
+
t as SparseSet,
|
|
43
|
+
A as topologicalSort
|
|
44
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";class n extends Error{constructor(a,t,r,o){super(a,o),this.requestedBytes=t,this.capBytes=r,this.name="StoreCapExceededError"}}class l extends Error{constructor(){super("SharedArrayBuffer is not available in this runtime. The chosen world backing is SAB-based and cannot start without it. In browsers this requires cross-origin isolation: serve the page with `Cross-Origin-Opener-Policy: same-origin` and `Cross-Origin-Embedder-Policy: require-corp` (or `credentialless`). Alternatively choose the pure-TS heap profile (`memory: { heap: {} }`), which is backed by a plain ArrayBuffer and needs no SAB / no COOP+COEP. In Bun/Node SAB is available unconditionally — if you see this there, the runtime is older than expected or the global was shadowed."),this.name="SabUnavailableError"}}const h=e=>{if(typeof SharedArrayBuffer>"u")throw new l;return new SharedArrayBuffer(e)},f=64*1024;function d(e=256*1024*1024){if(e<=0||!Number.isInteger(e))throw new Error(`growable_sab_allocator: max_bytes must be a positive integer (got ${e})`);if(typeof SharedArrayBuffer>"u")throw new l;let a=null;const t=r=>{if(r>e)throw new n(`growable_sab_allocator: requested ${r} bytes exceeds the by-design max_bytes cap of ${e}. This is a hard ceiling with no grow-beyond-cap fallback (#380); a real workload stays ~16 MiB. Reaching it signals runaway entity/column growth upstream — diagnose that rather than raising the cap blindly.`,r,e);if(a===null){const o=SharedArrayBuffer;return a=new o(r,{maxByteLength:e}),a}return r>a.byteLength&&a.grow(r),a};return Object.defineProperty(t,"isInPlace",{value:!0,enumerable:!0}),t}function b(e=256*1024*1024){if(e<=0||!Number.isInteger(e))throw new Error(`heap_arraybuffer_allocator: max_bytes must be a positive integer (got ${e})`);let a=null;const t=r=>{if(r>e)throw new n(`heap_arraybuffer_allocator: requested ${r} bytes exceeds the by-design max_bytes cap of ${e}. This is a hard ceiling with no grow-beyond-cap fallback (#380); reaching it signals runaway entity/column growth upstream — diagnose that rather than raising the cap.`,r,e);if(a===null){const o=ArrayBuffer;return a=new o(r,{maxByteLength:e}),a}return r>a.byteLength&&a.resize(r),a};return Object.defineProperty(t,"isInPlace",{value:!0,enumerable:!0}),t}function w(e){if(!(e.buffer instanceof SharedArrayBuffer))throw new Error("wasm_memory_allocator: WebAssembly.Memory must be constructed with `shared: true` so its buffer is a SharedArrayBuffer");const a=()=>e.buffer,t=r=>{const o=e.buffer.byteLength;if(r<=o)return a();const s=Math.ceil((r-o)/f),u=i=>new n(`wasm_memory_allocator: memory.grow(${s}) failed (current=${o} bytes, requested=${r} bytes, maximum may be reached)`,r,null,{cause:i});let c;try{c=e.grow(s)}catch(i){throw u(i)}if(c===-1)throw u();return a()};return Object.defineProperty(t,"isInPlace",{value:!0,enumerable:!0}),t}exports.DEFAULT_SAB_ALLOCATOR=h;exports.SabUnavailableError=l;exports.StoreCapExceededError=n;exports.growableSabAllocator=d;exports.heapArraybufferAllocator=b;exports.wasmMemoryAllocator=w;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
class i extends Error {
|
|
2
|
+
constructor(a, t, r, n) {
|
|
3
|
+
super(a, n), this.requestedBytes = t, this.capBytes = r, this.name = "StoreCapExceededError";
|
|
4
|
+
}
|
|
5
|
+
}
|
|
6
|
+
class c extends Error {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(
|
|
9
|
+
"SharedArrayBuffer is not available in this runtime. The chosen world backing is SAB-based and cannot start without it. In browsers this requires cross-origin isolation: serve the page with `Cross-Origin-Opener-Policy: same-origin` and `Cross-Origin-Embedder-Policy: require-corp` (or `credentialless`). Alternatively choose the pure-TS heap profile (`memory: { heap: {} }`), which is backed by a plain ArrayBuffer and needs no SAB / no COOP+COEP. In Bun/Node SAB is available unconditionally — if you see this there, the runtime is older than expected or the global was shadowed."
|
|
10
|
+
), this.name = "SabUnavailableError";
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
const f = (e) => {
|
|
14
|
+
if (typeof SharedArrayBuffer > "u") throw new c();
|
|
15
|
+
return new SharedArrayBuffer(e);
|
|
16
|
+
}, h = 64 * 1024;
|
|
17
|
+
function d(e = 256 * 1024 * 1024) {
|
|
18
|
+
if (e <= 0 || !Number.isInteger(e))
|
|
19
|
+
throw new Error(
|
|
20
|
+
`growable_sab_allocator: max_bytes must be a positive integer (got ${e})`
|
|
21
|
+
);
|
|
22
|
+
if (typeof SharedArrayBuffer > "u") throw new c();
|
|
23
|
+
let a = null;
|
|
24
|
+
const t = (r) => {
|
|
25
|
+
if (r > e)
|
|
26
|
+
throw new i(
|
|
27
|
+
`growable_sab_allocator: requested ${r} bytes exceeds the by-design max_bytes cap of ${e}. This is a hard ceiling with no grow-beyond-cap fallback (#380); a real workload stays ~16 MiB. Reaching it signals runaway entity/column growth upstream — diagnose that rather than raising the cap blindly.`,
|
|
28
|
+
r,
|
|
29
|
+
e
|
|
30
|
+
);
|
|
31
|
+
if (a === null) {
|
|
32
|
+
const n = SharedArrayBuffer;
|
|
33
|
+
return a = new n(r, { maxByteLength: e }), a;
|
|
34
|
+
}
|
|
35
|
+
return r > a.byteLength && a.grow(r), a;
|
|
36
|
+
};
|
|
37
|
+
return Object.defineProperty(t, "isInPlace", { value: !0, enumerable: !0 }), t;
|
|
38
|
+
}
|
|
39
|
+
function b(e = 256 * 1024 * 1024) {
|
|
40
|
+
if (e <= 0 || !Number.isInteger(e))
|
|
41
|
+
throw new Error(
|
|
42
|
+
`heap_arraybuffer_allocator: max_bytes must be a positive integer (got ${e})`
|
|
43
|
+
);
|
|
44
|
+
let a = null;
|
|
45
|
+
const t = (r) => {
|
|
46
|
+
if (r > e)
|
|
47
|
+
throw new i(
|
|
48
|
+
`heap_arraybuffer_allocator: requested ${r} bytes exceeds the by-design max_bytes cap of ${e}. This is a hard ceiling with no grow-beyond-cap fallback (#380); reaching it signals runaway entity/column growth upstream — diagnose that rather than raising the cap.`,
|
|
49
|
+
r,
|
|
50
|
+
e
|
|
51
|
+
);
|
|
52
|
+
if (a === null) {
|
|
53
|
+
const n = ArrayBuffer;
|
|
54
|
+
return a = new n(r, { maxByteLength: e }), a;
|
|
55
|
+
}
|
|
56
|
+
return r > a.byteLength && a.resize(r), a;
|
|
57
|
+
};
|
|
58
|
+
return Object.defineProperty(t, "isInPlace", { value: !0, enumerable: !0 }), t;
|
|
59
|
+
}
|
|
60
|
+
function w(e) {
|
|
61
|
+
if (!(e.buffer instanceof SharedArrayBuffer))
|
|
62
|
+
throw new Error(
|
|
63
|
+
"wasm_memory_allocator: WebAssembly.Memory must be constructed with `shared: true` so its buffer is a SharedArrayBuffer"
|
|
64
|
+
);
|
|
65
|
+
const a = () => e.buffer, t = (r) => {
|
|
66
|
+
const n = e.buffer.byteLength;
|
|
67
|
+
if (r <= n)
|
|
68
|
+
return a();
|
|
69
|
+
const s = Math.ceil((r - n) / h), l = (o) => (
|
|
70
|
+
// The JS API doesn't expose the Memory's `maximum`, so the cap is
|
|
71
|
+
// reported as unknowable (`null`) — the caller declared it at
|
|
72
|
+
// `new WebAssembly.Memory({ maximum })` time.
|
|
73
|
+
new i(
|
|
74
|
+
`wasm_memory_allocator: memory.grow(${s}) failed (current=${n} bytes, requested=${r} bytes, maximum may be reached)`,
|
|
75
|
+
r,
|
|
76
|
+
null,
|
|
77
|
+
{ cause: o }
|
|
78
|
+
)
|
|
79
|
+
);
|
|
80
|
+
let u;
|
|
81
|
+
try {
|
|
82
|
+
u = e.grow(s);
|
|
83
|
+
} catch (o) {
|
|
84
|
+
throw l(o);
|
|
85
|
+
}
|
|
86
|
+
if (u === -1)
|
|
87
|
+
throw l();
|
|
88
|
+
return a();
|
|
89
|
+
};
|
|
90
|
+
return Object.defineProperty(t, "isInPlace", { value: !0, enumerable: !0 }), t;
|
|
91
|
+
}
|
|
92
|
+
export {
|
|
93
|
+
f as D,
|
|
94
|
+
i as S,
|
|
95
|
+
c as a,
|
|
96
|
+
d as g,
|
|
97
|
+
b as h,
|
|
98
|
+
w
|
|
99
|
+
};
|
package/dist/shared.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./shared-BXSZnxx4.cjs");exports.DEFAULT_SAB_ALLOCATOR=a.DEFAULT_SAB_ALLOCATOR;exports.SabUnavailableError=a.SabUnavailableError;exports.growableSabAllocator=a.growableSabAllocator;exports.wasmMemoryAllocator=a.wasmMemoryAllocator;
|
package/dist/shared.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `@oasys/oecs/shared` — the opt-in SharedArrayBuffer / WASM profile.
|
|
3
|
+
*
|
|
4
|
+
* The default `@oasys/oecs` profile runs the column store over a plain
|
|
5
|
+
* resizable `ArrayBuffer` (no cross-origin isolation). This entry surfaces the
|
|
6
|
+
* `SharedArrayBuffer`-backed allocators for worlds that opt into worker offload
|
|
7
|
+
* or a WASM compute backend — construct with `new ECS({ memory: { shared: {} } })`,
|
|
8
|
+
* or pass one of these allocators through `memory: { allocator }`.
|
|
9
|
+
*
|
|
10
|
+
* **Requires cross-origin isolation (COOP/COEP) in browsers** — that's the
|
|
11
|
+
* whole reason it's a separate, opt-in profile.
|
|
12
|
+
*
|
|
13
|
+
* The WASM compute backend itself is NOT bundled here: oecs ships the
|
|
14
|
+
* `ComputeBackend` *seam* (`@oasys/oecs` → `attachBackend`) plus the
|
|
15
|
+
* cross-thread ring transport (`HostCommandDispatcher`). The worker entrypoint
|
|
16
|
+
* and the compiled WASM module are the consumer's to provide.
|
|
17
|
+
*
|
|
18
|
+
* @module
|
|
19
|
+
*/
|
|
20
|
+
export { growableSabAllocator, wasmMemoryAllocator, DEFAULT_SAB_ALLOCATOR, SabUnavailableError } from './core/store';
|
|
21
|
+
export type { SharedMemoryArm } from './core/ecs/ecs_memory';
|
|
22
|
+
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../src/shared.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EACN,oBAAoB,EACpB,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,EACnB,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC"}
|