@margoengine/ecs 0.1.0 → 1.0.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/dist/objects.d.ts CHANGED
@@ -6,10 +6,23 @@ export interface ObjectField<T = unknown> {
6
6
  }
7
7
  /** Declare a JS value field. Pass a factory for independent mutable defaults. */
8
8
  export declare function objectField<T = unknown>(create?: () => T): ObjectField<T>;
9
+ /**
10
+ * A weak reference field: each row holds a `WeakRef` to its value, so the garbage collector may take the value once
11
+ * nothing else holds it, and the row then reads `undefined`. Values are objects, functions, unregistered symbols or
12
+ * `undefined`.
13
+ */
14
+ export interface WeakObjectField<T extends WeakKey = WeakKey> {
15
+ /** Called for each new row; default is undefined. */
16
+ readonly create: () => T | undefined;
17
+ /** Marks the field as weak. */
18
+ readonly weak: true;
19
+ }
20
+ /** Declare a weak reference field. Pass a factory for a default per row. */
21
+ export declare function weakObjectField<T extends WeakKey = WeakKey>(create?: () => T | undefined): WeakObjectField<T>;
9
22
  /** Mixed reference/numeric component schema. */
10
- export type ObjectSchema = Record<string, ArrayConstructor | ObjectField>;
23
+ export type ObjectSchema = Record<string, ArrayConstructor | ObjectField | WeakObjectField>;
11
24
  /** Value of one field of a mixed schema. */
12
- export type ObjectValue<T> = T extends ObjectField<infer V> ? V : number;
25
+ export type ObjectValue<T> = T extends WeakObjectField<infer W> ? W | undefined : T extends ObjectField<infer V> ? V : number;
13
26
  /** Packed mixed fields, indexed with component.index(entity). */
14
27
  export type ObjectFields<S extends ObjectSchema> = {
15
28
  [K in keyof S]: S[K] extends ArrayConstructor ? InstanceType<S[K]> : ObjectValue<S[K]>[];
package/dist/objects.js CHANGED
@@ -4,7 +4,31 @@ function t(e = (() => void 0)) {
4
4
  if (typeof e != "function") throw TypeError("Invalid object field factory; pass a function");
5
5
  return Object.freeze({ create: e });
6
6
  }
7
- var n = class extends e {
7
+ function n(e) {
8
+ return typeof e == "object" && !!e || typeof e == "function" || typeof e == "symbol" && Symbol.keyFor(e) === void 0;
9
+ }
10
+ function r(e) {
11
+ if (e !== void 0 && !n(e)) throw TypeError("Invalid weak object field value; pass an object, a function, an unregistered symbol or undefined");
12
+ }
13
+ function i(e = () => void 0) {
14
+ if (typeof e != "function") throw TypeError("Invalid object field factory; pass a function");
15
+ return Object.freeze({
16
+ create: e,
17
+ weak: !0
18
+ });
19
+ }
20
+ var a = (e) => typeof e == "string" && e !== "" && String(e >>> 0) === e && +e != 4294967295;
21
+ function o() {
22
+ return new Proxy([], {
23
+ get(e, t, n) {
24
+ return a(t) ? e[+t]?.deref() : Reflect.get(e, t, n);
25
+ },
26
+ set(e, t, n, i) {
27
+ return a(t) ? (r(n), e[+t] = n === void 0 ? void 0 : new WeakRef(n), !0) : Reflect.set(e, t, n, i);
28
+ }
29
+ });
30
+ }
31
+ var s = class extends e {
8
32
  constructor(e, t) {
9
33
  let n = [], r = {};
10
34
  for (let [e, i] of Object.entries(t)) typeof i == "object" && i && typeof i.create == "function" ? n.push([e, i]) : Object.defineProperty(r, e, {
@@ -13,8 +37,8 @@ var n = class extends e {
13
37
  });
14
38
  if (!Object.keys(t).length) throw TypeError("Empty object schema; declare at least one field");
15
39
  super(e, r, !0), this.objects = n;
16
- for (let [e] of n) Object.defineProperty(this.fields, e, {
17
- value: [],
40
+ for (let [e, t] of n) Object.defineProperty(this.fields, e, {
41
+ value: "weak" in t ? o() : [],
18
42
  enumerable: !0
19
43
  });
20
44
  e.attach(this);
@@ -24,17 +48,21 @@ var n = class extends e {
24
48
  }
25
49
  validateValues(e) {
26
50
  let t = {};
27
- for (let [n, r] of Object.entries(e)) {
51
+ for (let [n, i] of Object.entries(e)) {
28
52
  if (!Object.hasOwn(this.fields, n)) throw RangeError("Unknown object component field; use a schema field");
29
- Array.isArray(this.fields[n]) || Object.defineProperty(t, n, {
30
- value: r,
53
+ let e = this.objects.find(([e]) => e === n)?.[1];
54
+ e && "weak" in e ? r(i) : e || Object.defineProperty(t, n, {
55
+ value: i,
31
56
  enumerable: !0
32
57
  });
33
58
  }
34
59
  super.validateValues(t);
35
60
  }
36
61
  initializeRow(e, t = {}) {
37
- let n = this.objects.map(([e, n]) => Object.hasOwn(t, e) ? t[e] : n.create());
62
+ let n = this.objects.map(([e, n]) => {
63
+ let i = Object.hasOwn(t, e) ? t[e] : n.create();
64
+ return "weak" in n && r(i), i;
65
+ });
38
66
  super.initializeRow(e);
39
67
  for (let t = 0; t < this.objects.length; t++) this.fields[this.objects[t][0]][e] = n[t];
40
68
  }
@@ -47,4 +75,4 @@ var n = class extends e {
47
75
  }
48
76
  };
49
77
  //#endregion
50
- export { n as ObjectComponent, t as objectField };
78
+ export { s as ObjectComponent, t as objectField, i as weakObjectField };
@@ -1,18 +1,28 @@
1
1
  import type { ComponentStore as Component, Entity, World } from './index.js';
2
- import type { Relation } from './relations.js';
3
- /** A required pair and optional required components on its target. */
2
+ import { type Relation } from './relations.js';
3
+ /** Target written for an optional pair term that has no pair. */
4
+ export declare const NO_TARGET = 4294967295;
5
+ /** A pair term: a relation (or every relation), a target (or every target) and components required on the target. */
4
6
  export interface RelationTerm {
5
- /** Relationship owned by this world. */
6
- relation: Relation;
7
+ /** Relationship owned by this world, or '*' for every relation of the world that is not stopped. */
8
+ relation: Relation | '*';
7
9
  /** Exact target id, or '*' for every target. Default '*'. */
8
10
  target?: Entity | '*';
9
11
  /** Components required on the target, with rows returned in term order. Default none. */
10
12
  with?: readonly Component[];
11
13
  }
12
- /** Source component filters and required relationship pairs. */
14
+ /** Source component filters and relationship pair terms. */
13
15
  export interface RelationQueryTerms {
14
- /** Required pair terms; at least one. Wildcards enumerate every combination. */
15
- relations: readonly RelationTerm[];
16
+ /** Required pair terms. Wildcards enumerate every combination. Default none; needs a term here or in `with`. */
17
+ relations?: readonly RelationTerm[];
18
+ /**
19
+ * Optional pair terms, after the required ones in target columns: every matching pair is enumerated like a
20
+ * required term, and a source with none gets one match with target {@link NO_TARGET} and target rows -1.
21
+ * Default none.
22
+ */
23
+ optionalRelations?: readonly RelationTerm[];
24
+ /** Excluded pair terms: a source with any matching pair is left out. Default none. */
25
+ withoutRelations?: readonly RelationTerm[];
16
26
  /** Required source components. Default none. */
17
27
  with?: readonly Component[];
18
28
  /** Excluded source components. Default none. */
@@ -23,22 +33,45 @@ export interface RelationQueryTerms {
23
33
  /** A relation join query returning source rows, matched targets and target component rows. */
24
34
  export declare class RelationQuery {
25
35
  readonly world: World;
26
- private readonly terms;
36
+ private readonly required;
37
+ private readonly optionalTerms;
38
+ private readonly excludedTerms;
39
+ private readonly with;
40
+ private readonly without;
41
+ private readonly optional;
27
42
  private visiting;
28
- /** @throws TypeError for empty relation terms, invalid targets or foreign-world terms. */
43
+ private scratch;
44
+ /**
45
+ * @throws TypeError with no required pair term and no `with` component, for an invalid relation or target, or for
46
+ * terms of another world.
47
+ */
29
48
  constructor(world: World, terms: RelationQueryTerms);
49
+ /** Target columns: required pair terms, then optional ones. */
50
+ get termCount(): number;
51
+ /** A target buffer that fits every target of one source (`world.capacity`), grown with a growable world. */
52
+ private buffer;
53
+ private relationsOf;
54
+ private targetOk;
55
+ /** Every pair of the term, grouped by source. */
56
+ private pairs;
57
+ /** True when `source` has a pair matching an excluded term now. */
58
+ private excluded;
30
59
  private allowed;
31
60
  private collect;
32
61
  /**
33
- * Write sources (repeated for each matching pair combination) and optional target columns.
62
+ * Write sources (repeated for each matching pair combination) and optional target columns, one per required and
63
+ * then optional pair term; an absent optional pair writes {@link NO_TARGET}.
34
64
  * @throws RangeError when any output is too small, or target column count differs from the term count.
35
65
  */
36
66
  run(output: Uint32Array, targets?: readonly Uint32Array[]): number;
37
67
  /**
38
68
  * Visit snapshot matches, rechecking membership and resolving current rows before each call.
39
- * Source rows are with then optional. Target rows flatten each relation term's with list.
40
- * Callback arrays are reused. Added pairs wait for the next call; removed pairs are passed over.
69
+ * Source rows are with then optional. Target rows flatten each pair term's with list, required terms then optional
70
+ * ones, and are -1 for an absent optional pair. `relations` holds the relation each term matched (useful with a
71
+ * relation wildcard), undefined for an absent optional pair.
72
+ * Callback arrays are reused. Added pairs wait for the next call; removed pairs, and sources that gained an excluded
73
+ * pair, are passed over.
41
74
  * @throws MargoError 'state' for a nested call on this query.
42
75
  */
43
- forEach(visit: (source: Entity, rows: Int32Array, targets: Uint32Array, targetRows: Int32Array) => void): number;
76
+ forEach(visit: (source: Entity, rows: Int32Array, targets: Uint32Array, targetRows: Int32Array, relations: readonly (Relation | undefined)[]) => void): number;
44
77
  }
@@ -1,54 +1,97 @@
1
- import { MargoError as e } from "@margoengine/math/errors";
1
+ import { worldRelations as e } from "./relations.js";
2
+ import { MargoError as t } from "@margoengine/math/errors";
2
3
  //#region src/relation-query.ts
3
- var t = class {
4
+ var n = 4294967295, r = class {
4
5
  constructor(e, t) {
5
- this.world = e, this.visiting = !1;
6
- let n = t.relations.map((e) => ({
7
- ...e,
6
+ this.world = e, this.visiting = !1, this.scratch = /* @__PURE__ */ new Uint32Array();
7
+ let n = (e) => ({
8
+ relation: e.relation,
9
+ target: e.target ?? "*",
8
10
  with: [...e.with ?? []]
9
- })), r = [...t.with ?? []], i = [...t.without ?? []], a = [...t.optional ?? []];
10
- if (!n.length || n.some((t) => t.relation.world !== e || t.target !== void 0 && t.target !== "*" && (!Number.isInteger(t.target) || t.target < 0 || t.target > 4294967295)) || [
11
+ }), r = (t.relations ?? []).map(n), i = (t.optionalRelations ?? []).map(n), a = (t.withoutRelations ?? []).map(n), o = [
11
12
  ...r,
12
13
  ...i,
13
- ...a,
14
- ...n.flatMap((e) => e.with)
15
- ].some((t) => t.world !== e)) throw TypeError("Invalid relation query; use at least one relation and components of this world with Uint32 targets or *");
16
- this.terms = {
17
- relations: n,
18
- with: r,
19
- without: i,
20
- optional: a
21
- };
14
+ ...a
15
+ ];
16
+ if (this.with = [...t.with ?? []], this.without = [...t.without ?? []], this.optional = [...t.optional ?? []], !r.length && !this.with.length || o.some((t) => t.relation !== "*" && (typeof t.relation != "object" || t.relation === null || t.relation.world !== e) || t.target !== "*" && (!Number.isInteger(t.target) || t.target < 0 || t.target > 4294967295)) || [
17
+ ...this.with,
18
+ ...this.without,
19
+ ...this.optional,
20
+ ...o.flatMap((e) => e.with)
21
+ ].some((t) => t.world !== e)) throw TypeError("Invalid relation query; use a pair term or a with component, relations of this world or *, and Uint32 targets or *");
22
+ this.required = r, this.optionalTerms = i, this.excludedTerms = a;
23
+ }
24
+ get termCount() {
25
+ return this.required.length + this.optionalTerms.length;
26
+ }
27
+ buffer() {
28
+ return this.scratch.length < this.world.capacity && (this.scratch = new Uint32Array(this.world.capacity)), this.scratch;
29
+ }
30
+ relationsOf(t) {
31
+ return t.relation === "*" ? e(this.world) : [t.relation];
32
+ }
33
+ targetOk(e, t) {
34
+ return (e.target === "*" || e.target === t) && e.with.every((e) => e.has(t));
35
+ }
36
+ pairs(e) {
37
+ let t = /* @__PURE__ */ new Map();
38
+ for (let n of this.relationsOf(e)) n.forEach((r, i) => {
39
+ if (!this.targetOk(e, i)) return;
40
+ let a = t.get(r);
41
+ a ? a.push({
42
+ relation: n,
43
+ target: i
44
+ }) : t.set(r, [{
45
+ relation: n,
46
+ target: i
47
+ }]);
48
+ });
49
+ return t;
50
+ }
51
+ excluded(e) {
52
+ for (let t of this.excludedTerms) for (let n of this.relationsOf(t)) {
53
+ if (t.target !== "*") {
54
+ if (n.has(e, t.target) && this.targetOk(t, t.target)) return !0;
55
+ continue;
56
+ }
57
+ let r = this.buffer(), i = n.targets(e, r);
58
+ for (let e = 0; e < i; e++) if (this.targetOk(t, r[e])) return !0;
59
+ }
60
+ return !1;
22
61
  }
23
62
  allowed(e, t) {
24
- let n = this.terms;
25
- return this.world.alive(e) && n.with.every((t) => t.has(e)) && n.without.every((t) => !t.has(e)) && (!t || n.relations.every((n, r) => this.world.alive(t[r]) && n.relation.has(e, t[r]) && n.with.every((e) => e.has(t[r]))));
63
+ return !this.world.alive(e) || !this.with.every((t) => t.has(e)) || this.without.some((t) => t.has(e)) || this.excluded(e) ? !1 : !t || [...this.required, ...this.optionalTerms].every((n, r) => {
64
+ let i = t.relations[r], a = t.targets[r];
65
+ return !i || this.world.alive(a) && i.has(e, a) && n.with.every((e) => e.has(a));
66
+ });
26
67
  }
27
68
  collect() {
28
- if (this.visiting) throw new e("state", "Relation query is visiting; use a second query for a nested call");
29
- let t = this.terms.relations.map((e) => {
30
- let t = /* @__PURE__ */ new Map();
31
- return e.relation.forEach((n, r) => {
32
- if ((e.target === void 0 || e.target === "*" || e.target === r) && e.with.every((e) => e.has(r))) {
33
- let e = t.get(n);
34
- e ? e.push(r) : t.set(n, [r]);
35
- }
36
- }), t;
37
- }), n = [];
38
- for (let e of t[0].keys()) {
39
- if (!this.allowed(e) || t.some((t) => !t.has(e))) continue;
40
- let r = [[]];
41
- for (let n of t) r = r.flatMap((t) => n.get(e).map((e) => [...t, e]));
42
- for (let t of r) n.push({
43
- source: e,
44
- targets: t
69
+ if (this.visiting) throw new t("state", "Relation query is visiting; use a second query for a nested call");
70
+ let e = this.required.map((e) => this.pairs(e)), r = this.optionalTerms.map((e) => this.pairs(e)), i;
71
+ if (e.length) i = e[0].keys();
72
+ else {
73
+ let e = new Uint32Array(this.world.capacity);
74
+ i = e.subarray(0, this.world.query(this.with, e));
75
+ }
76
+ let a = [{
77
+ relation: void 0,
78
+ target: n
79
+ }], o = [];
80
+ for (let t of i) {
81
+ if (e.some((e) => !e.has(t)) || !this.allowed(t)) continue;
82
+ let n = [...e.map((e) => e.get(t)), ...r.map((e) => e.get(t) ?? a)], i = [[]];
83
+ for (let e of n) i = i.flatMap((t) => e.map((e) => [...t, e]));
84
+ for (let e of i) o.push({
85
+ source: t,
86
+ targets: e.map((e) => e.target),
87
+ relations: e.map((e) => e.relation)
45
88
  });
46
89
  }
47
- return n;
90
+ return o;
48
91
  }
49
92
  run(e, t) {
50
93
  let n = this.collect();
51
- if (e.length < n.length || t && (t.length !== this.terms.relations.length || t.some((e) => e.length < n.length))) throw RangeError("Relation query output is too small; allocate one row per pair combination and one target column per term");
94
+ if (e.length < n.length || t && (t.length !== this.termCount || t.some((e) => e.length < n.length))) throw RangeError("Relation query output is too small; allocate one row per pair combination and one target column per term");
52
95
  return n.forEach((n, r) => {
53
96
  e[r] = n.source, t?.forEach((e, t) => {
54
97
  e[r] = n.targets[t];
@@ -56,24 +99,25 @@ var t = class {
56
99
  }), n.length;
57
100
  }
58
101
  forEach(e) {
59
- let t = this.collect(), n = [...this.terms.with, ...this.terms.optional], r = new Int32Array(n.length), i = new Uint32Array(this.terms.relations.length), a = new Int32Array(this.terms.relations.reduce((e, t) => e + t.with.length, 0)), o = 0;
102
+ let t = this.collect(), n = [...this.with, ...this.optional], r = [...this.required, ...this.optionalTerms], i = new Int32Array(n.length), a = new Uint32Array(r.length), o = Array(r.length), s = new Int32Array(r.reduce((e, t) => e + t.with.length, 0)), c = 0;
60
103
  this.visiting = !0;
61
104
  try {
62
- for (let s of t) {
63
- if (!this.allowed(s.source, s.targets)) continue;
105
+ for (let l of t) {
106
+ if (!this.allowed(l.source, l)) continue;
64
107
  n.forEach((e, t) => {
65
- r[t] = e.index(s.source);
66
- }), i.set(s.targets);
108
+ i[t] = e.index(l.source);
109
+ }), a.set(l.targets);
67
110
  let t = 0;
68
- this.terms.relations.forEach((e, n) => {
69
- for (let r of e.with) a[t++] = r.index(i[n]);
70
- }), e(s.source, r, i, a), o++;
111
+ r.forEach((e, n) => {
112
+ o[n] = l.relations[n];
113
+ for (let r of e.with) s[t++] = l.relations[n] ? r.index(a[n]) : -1;
114
+ }), e(l.source, i, a, s, o), c++;
71
115
  }
72
116
  } finally {
73
117
  this.visiting = !1;
74
118
  }
75
- return o;
119
+ return c;
76
120
  }
77
121
  };
78
122
  //#endregion
79
- export { t as RelationQuery };
123
+ export { n as NO_TARGET, r as RelationQuery };
@@ -8,6 +8,8 @@ export interface RelationOptions {
8
8
  /** Refuse a pair that would close a loop. Default false. */
9
9
  acyclic?: boolean;
10
10
  }
11
+ /** The relations of `world` that are not stopped, oldest first; a relation wildcard in `RelationQuery` reads these. */
12
+ export declare function worldRelations(world: World): readonly Relation[];
11
13
  /**
12
14
  * Pairs of entities with a meaning you name: `childOf`, `owns`, `targets`. A pair goes from a source to a target, and
13
15
  * both directions can be read directly. Pairs of a destroyed entity end with it.
package/dist/relations.js CHANGED
@@ -5,9 +5,15 @@ var e = (e, t) => {
5
5
  let n = 0;
6
6
  for (let r of e) t[n++] = r;
7
7
  return n;
8
- }, t = class {
9
- constructor(e, { exclusive: t = !1, cascade: n = !1, acyclic: r = !1 } = {}) {
10
- this.world = e, this.size = 0, this.forward = /* @__PURE__ */ new Map(), this.backward = /* @__PURE__ */ new Map(), this.pending = [], this.draining = !1, this.store = { remove: (e) => this.forget(e) }, this.exclusive = t, this.cascade = n, this.acyclic = r, e.attach(this.store);
8
+ }, t = /* @__PURE__ */ new WeakMap();
9
+ function n(e) {
10
+ return [...t.get(e) ?? []];
11
+ }
12
+ var r = class {
13
+ constructor(e, { exclusive: n = !1, cascade: r = !1, acyclic: i = !1 } = {}) {
14
+ this.world = e, this.size = 0, this.forward = /* @__PURE__ */ new Map(), this.backward = /* @__PURE__ */ new Map(), this.pending = [], this.draining = !1, this.store = { remove: (e) => this.forget(e) }, this.exclusive = n, this.cascade = r, this.acyclic = i, e.attach(this.store);
15
+ let a = t.get(e);
16
+ a || t.set(e, a = /* @__PURE__ */ new Set()), a.add(this);
11
17
  }
12
18
  add(e, t) {
13
19
  if (this.world.check(e), this.world.check(t), this.has(e, t)) return !1;
@@ -51,7 +57,7 @@ var e = (e, t) => {
51
57
  for (let [t, n] of this.forward) for (let r of n) e(t, r);
52
58
  }
53
59
  stop() {
54
- this.world.detach(this.store), this.forward.clear(), this.backward.clear(), this.size = 0;
60
+ this.world.detach(this.store), t.get(this.world)?.delete(this), this.forward.clear(), this.backward.clear(), this.size = 0;
55
61
  }
56
62
  [Symbol.dispose ?? Symbol()]() {
57
63
  this.stop();
@@ -90,4 +96,4 @@ var e = (e, t) => {
90
96
  }
91
97
  };
92
98
  //#endregion
93
- export { t as Relation };
99
+ export { r as Relation, n as worldRelations };
package/package.json CHANGED
@@ -1,107 +1,107 @@
1
- {
2
- "name": "@margoengine/ecs",
3
- "version": "0.1.0",
4
- "description": "Typed-array packed sparse-set entity component storage.",
5
- "keywords": [
6
- "margoengine",
7
- "webgpu",
8
- "3d",
9
- "ecs"
10
- ],
11
- "homepage": "https://margoengine.com",
12
- "bugs": {
13
- "url": "https://github.com/scottcampbelldata/margoengine/issues"
14
- },
15
- "repository": {
16
- "type": "git",
17
- "url": "git+https://github.com/scottcampbelldata/margoengine.git",
18
- "directory": "packages/ecs"
19
- },
20
- "license": "Apache-2.0",
21
- "author": "Scott Campbell",
22
- "type": "module",
23
- "sideEffects": false,
24
- "exports": {
25
- ".": {
26
- "types": "./dist/index.d.ts",
27
- "import": "./dist/index.js"
28
- },
29
- "./changes": {
30
- "types": "./dist/changes.d.ts",
31
- "import": "./dist/changes.js"
32
- },
33
- "./engine": {
34
- "types": "./dist/engine.d.ts",
35
- "import": "./dist/engine.js"
36
- },
37
- "./growable": {
38
- "types": "./dist/growable.d.ts",
39
- "import": "./dist/growable.js"
40
- },
41
- "./query": {
42
- "types": "./dist/query.d.ts",
43
- "import": "./dist/query.js"
44
- },
45
- "./relations": {
46
- "types": "./dist/relations.d.ts",
47
- "import": "./dist/relations.js"
48
- },
49
- "./schedule": {
50
- "types": "./dist/schedule.d.ts",
51
- "import": "./dist/schedule.js"
52
- },
53
- "./objects": {
54
- "types": "./dist/objects.d.ts",
55
- "import": "./dist/objects.js"
56
- },
57
- "./coroutines": {
58
- "types": "./dist/coroutines.d.ts",
59
- "import": "./dist/coroutines.js"
60
- },
61
- "./scripts": {
62
- "types": "./dist/scripts.d.ts",
63
- "import": "./dist/scripts.js"
64
- },
65
- "./relation-query": {
66
- "types": "./dist/relation-query.d.ts",
67
- "import": "./dist/relation-query.js"
68
- },
69
- "./reactive": {
70
- "types": "./dist/reactive.d.ts",
71
- "import": "./dist/reactive.js"
72
- },
73
- "./serialize": {
74
- "types": "./dist/serialize.d.ts",
75
- "import": "./dist/serialize.js"
76
- },
77
- "./parallel": {
78
- "types": "./dist/parallel.d.ts",
79
- "import": "./dist/parallel.js"
80
- }
81
- },
82
- "files": [
83
- "dist",
84
- "LICENSE",
85
- "NOTICE"
86
- ],
87
- "publishConfig": {
88
- "access": "public"
89
- },
90
- "peerDependencies": {
91
- "@margoengine/core": "^0.1.0",
92
- "@margoengine/scene": "^0.1.0"
93
- },
94
- "peerDependenciesMeta": {
95
- "@margoengine/scene": {
96
- "optional": true
97
- }
98
- },
99
- "dependencies": {
100
- "@margoengine/math": "^0.1.0"
101
- },
102
- "scripts": {
103
- "build": "node ../../scripts/build-optional.js ecs",
104
- "test": "npm run build && node --test test/*.test.js",
105
- "prepack": "npm run build"
106
- }
107
- }
1
+ {
2
+ "name": "@margoengine/ecs",
3
+ "version": "1.0.0",
4
+ "description": "Typed-array packed sparse-set entity component storage.",
5
+ "keywords": [
6
+ "margoengine",
7
+ "webgpu",
8
+ "3d",
9
+ "ecs"
10
+ ],
11
+ "homepage": "https://margoengine.com",
12
+ "bugs": {
13
+ "url": "https://github.com/scottcampbelldata/margoengine/issues"
14
+ },
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/scottcampbelldata/margoengine.git",
18
+ "directory": "packages/ecs"
19
+ },
20
+ "license": "Apache-2.0",
21
+ "author": "Scott Campbell",
22
+ "type": "module",
23
+ "sideEffects": false,
24
+ "exports": {
25
+ ".": {
26
+ "types": "./dist/index.d.ts",
27
+ "import": "./dist/index.js"
28
+ },
29
+ "./changes": {
30
+ "types": "./dist/changes.d.ts",
31
+ "import": "./dist/changes.js"
32
+ },
33
+ "./engine": {
34
+ "types": "./dist/engine.d.ts",
35
+ "import": "./dist/engine.js"
36
+ },
37
+ "./growable": {
38
+ "types": "./dist/growable.d.ts",
39
+ "import": "./dist/growable.js"
40
+ },
41
+ "./query": {
42
+ "types": "./dist/query.d.ts",
43
+ "import": "./dist/query.js"
44
+ },
45
+ "./relations": {
46
+ "types": "./dist/relations.d.ts",
47
+ "import": "./dist/relations.js"
48
+ },
49
+ "./schedule": {
50
+ "types": "./dist/schedule.d.ts",
51
+ "import": "./dist/schedule.js"
52
+ },
53
+ "./objects": {
54
+ "types": "./dist/objects.d.ts",
55
+ "import": "./dist/objects.js"
56
+ },
57
+ "./coroutines": {
58
+ "types": "./dist/coroutines.d.ts",
59
+ "import": "./dist/coroutines.js"
60
+ },
61
+ "./scripts": {
62
+ "types": "./dist/scripts.d.ts",
63
+ "import": "./dist/scripts.js"
64
+ },
65
+ "./relation-query": {
66
+ "types": "./dist/relation-query.d.ts",
67
+ "import": "./dist/relation-query.js"
68
+ },
69
+ "./reactive": {
70
+ "types": "./dist/reactive.d.ts",
71
+ "import": "./dist/reactive.js"
72
+ },
73
+ "./serialize": {
74
+ "types": "./dist/serialize.d.ts",
75
+ "import": "./dist/serialize.js"
76
+ },
77
+ "./parallel": {
78
+ "types": "./dist/parallel.d.ts",
79
+ "import": "./dist/parallel.js"
80
+ }
81
+ },
82
+ "files": [
83
+ "dist",
84
+ "LICENSE",
85
+ "NOTICE"
86
+ ],
87
+ "publishConfig": {
88
+ "access": "public"
89
+ },
90
+ "peerDependencies": {
91
+ "@margoengine/core": "^1.0.0",
92
+ "@margoengine/scene": "^1.0.0"
93
+ },
94
+ "peerDependenciesMeta": {
95
+ "@margoengine/scene": {
96
+ "optional": true
97
+ }
98
+ },
99
+ "dependencies": {
100
+ "@margoengine/math": "^1.0.0"
101
+ },
102
+ "scripts": {
103
+ "build": "node ../../scripts/build-optional.js ecs",
104
+ "test": "npm run build && node --test test/*.test.js",
105
+ "prepack": "npm run build"
106
+ }
107
+ }