@adobe/ecs 0.1.0 → 0.2.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 +58 -0
- package/dist/implementation/compiler/access.js +9 -5
- package/dist/implementation/compiler/access.js.map +1 -1
- package/dist/implementation/compiler/archetypes.d.ts +17 -0
- package/dist/implementation/compiler/archetypes.js +141 -0
- package/dist/implementation/compiler/archetypes.js.map +1 -0
- package/dist/implementation/compiler/assign.js.map +1 -1
- package/dist/implementation/compiler/augmentations.d.ts +25 -0
- package/dist/implementation/compiler/augmentations.js +943 -0
- package/dist/implementation/compiler/augmentations.js.map +1 -0
- package/dist/implementation/compiler/bind.js +5 -4
- package/dist/implementation/compiler/bind.js.map +1 -1
- package/dist/implementation/compiler/body-access.d.ts +20 -3
- package/dist/implementation/compiler/body-access.js +138 -36
- package/dist/implementation/compiler/body-access.js.map +1 -1
- package/dist/implementation/compiler/booleans.js.map +1 -1
- package/dist/implementation/compiler/branches.js.map +1 -1
- package/dist/implementation/compiler/calls.js +14 -3
- package/dist/implementation/compiler/calls.js.map +1 -1
- package/dist/implementation/compiler/columns.d.ts +8 -2
- package/dist/implementation/compiler/columns.js +19 -3
- package/dist/implementation/compiler/columns.js.map +1 -1
- package/dist/implementation/compiler/compile-kernel.d.ts +24 -1
- package/dist/implementation/compiler/compile-kernel.js +66 -22
- package/dist/implementation/compiler/compile-kernel.js.map +1 -1
- package/dist/implementation/compiler/compiler.d.ts +6 -0
- package/dist/implementation/compiler/compiler.js +7 -0
- package/dist/implementation/compiler/compiler.js.map +1 -0
- package/dist/implementation/compiler/data.js.map +1 -1
- package/dist/implementation/compiler/describe.d.ts +41 -0
- package/dist/implementation/compiler/describe.js +510 -0
- package/dist/implementation/compiler/describe.js.map +1 -0
- package/dist/implementation/compiler/estree.js.map +1 -1
- package/dist/implementation/compiler/expression.js +26 -2
- package/dist/implementation/compiler/expression.js.map +1 -1
- package/dist/implementation/compiler/failure.js.map +1 -1
- package/dist/implementation/compiler/identify.d.ts +18 -8
- package/dist/implementation/compiler/identify.js +90 -32
- package/dist/implementation/compiler/identify.js.map +1 -1
- package/dist/implementation/compiler/index.d.ts +5 -1
- package/dist/implementation/compiler/index.js +6 -1
- package/dist/implementation/compiler/index.js.map +1 -1
- package/dist/implementation/compiler/inferred.d.ts +32 -0
- package/dist/implementation/compiler/inferred.js +185 -0
- package/dist/implementation/compiler/inferred.js.map +1 -0
- package/dist/implementation/compiler/inline-kernels.d.ts +7 -0
- package/dist/implementation/compiler/inline-kernels.js +16 -0
- package/dist/implementation/compiler/inline-kernels.js.map +1 -0
- package/dist/implementation/compiler/input-schemas.d.ts +23 -0
- package/dist/implementation/compiler/input-schemas.js +102 -0
- package/dist/implementation/compiler/input-schemas.js.map +1 -0
- package/dist/implementation/compiler/ir.d.ts +13 -1
- package/dist/implementation/compiler/ir.js.map +1 -1
- package/dist/implementation/compiler/kernel-id.js +1 -0
- package/dist/implementation/compiler/kernel-id.js.map +1 -1
- package/dist/implementation/compiler/key.js.map +1 -1
- package/dist/implementation/compiler/link.d.ts +13 -0
- package/dist/implementation/compiler/link.js +17 -0
- package/dist/implementation/compiler/link.js.map +1 -1
- package/dist/implementation/compiler/lists.d.ts +12 -1
- package/dist/implementation/compiler/lists.js +35 -14
- package/dist/implementation/compiler/lists.js.map +1 -1
- package/dist/implementation/compiler/lookups.js.map +1 -1
- package/dist/implementation/compiler/math.js +1 -0
- package/dist/implementation/compiler/math.js.map +1 -1
- package/dist/implementation/compiler/memory-compiler.d.ts +61 -0
- package/dist/implementation/compiler/memory-compiler.js +271 -0
- package/dist/implementation/compiler/memory-compiler.js.map +1 -0
- package/dist/implementation/compiler/module-scope.js.map +1 -1
- package/dist/implementation/compiler/module-value.js +18 -3
- package/dist/implementation/compiler/module-value.js.map +1 -1
- package/dist/implementation/compiler/out.js.map +1 -1
- package/dist/implementation/compiler/oxc.d.ts +41 -0
- package/dist/implementation/compiler/oxc.js +80 -0
- package/dist/implementation/compiler/oxc.js.map +1 -0
- package/dist/implementation/compiler/package-copies.d.ts +60 -0
- package/dist/implementation/compiler/package-copies.js +140 -0
- package/dist/implementation/compiler/package-copies.js.map +1 -0
- package/dist/implementation/compiler/passes.d.ts +25 -0
- package/dist/implementation/compiler/passes.js +24 -0
- package/dist/implementation/compiler/passes.js.map +1 -0
- package/dist/implementation/compiler/paths.d.ts +5 -14
- package/dist/implementation/compiler/paths.js +16 -25
- package/dist/implementation/compiler/paths.js.map +1 -1
- package/dist/implementation/compiler/plugin.d.ts +17 -1
- package/dist/implementation/compiler/plugin.js +207 -35
- package/dist/implementation/compiler/plugin.js.map +1 -1
- package/dist/implementation/compiler/posix.d.ts +8 -0
- package/dist/implementation/compiler/posix.js +205 -0
- package/dist/implementation/compiler/posix.js.map +1 -0
- package/dist/implementation/compiler/predicates.d.ts +11 -0
- package/dist/implementation/compiler/predicates.js +281 -0
- package/dist/implementation/compiler/predicates.js.map +1 -0
- package/dist/implementation/compiler/print.js +27 -7
- package/dist/implementation/compiler/print.js.map +1 -1
- package/dist/implementation/compiler/program.js +3 -0
- package/dist/implementation/compiler/program.js.map +1 -1
- package/dist/implementation/compiler/public.d.ts +1 -0
- package/dist/implementation/compiler/public.js +3 -0
- package/dist/implementation/compiler/public.js.map +1 -0
- package/dist/implementation/compiler/scalar.js.map +1 -1
- package/dist/implementation/compiler/scope.js.map +1 -1
- package/dist/implementation/compiler/serialize.js +1 -0
- package/dist/implementation/compiler/serialize.js.map +1 -1
- package/dist/implementation/compiler/signature.d.ts +18 -3
- package/dist/implementation/compiler/signature.js +68 -30
- package/dist/implementation/compiler/signature.js.map +1 -1
- package/dist/implementation/compiler/snapshot.d.ts +3 -1
- package/dist/implementation/compiler/snapshot.js +1 -1
- package/dist/implementation/compiler/snapshot.js.map +1 -1
- package/dist/implementation/compiler/source-map.js +1 -0
- package/dist/implementation/compiler/source-map.js.map +1 -1
- package/dist/implementation/compiler/spawns.d.ts +13 -1
- package/dist/implementation/compiler/spawns.js +67 -5
- package/dist/implementation/compiler/spawns.js.map +1 -1
- package/dist/implementation/compiler/stamps.d.ts +10 -3
- package/dist/implementation/compiler/stamps.js +28 -9
- package/dist/implementation/compiler/stamps.js.map +1 -1
- package/dist/implementation/compiler/statement.js.map +1 -1
- package/dist/implementation/compiler/terminal.js.map +1 -1
- package/dist/implementation/compiler/transform.d.ts +55 -5
- package/dist/implementation/compiler/transform.js +311 -55
- package/dist/implementation/compiler/transform.js.map +1 -1
- package/dist/implementation/compiler/type-schemas.d.ts +130 -0
- package/dist/implementation/compiler/type-schemas.js +701 -0
- package/dist/implementation/compiler/type-schemas.js.map +1 -0
- package/dist/implementation/compiler/unit.d.ts +20 -3
- package/dist/implementation/compiler/unit.js +2 -2
- package/dist/implementation/compiler/unit.js.map +1 -1
- package/dist/implementation/compiler/value.js.map +1 -1
- package/dist/implementation/compiler/wat.d.ts +12 -0
- package/dist/implementation/compiler/wat.js +379 -0
- package/dist/implementation/compiler/wat.js.map +1 -0
- package/dist/implementation/index.js +1 -0
- package/dist/implementation/index.js.map +1 -1
- package/dist/implementation/world/activate.js +8 -3
- package/dist/implementation/world/activate.js.map +1 -1
- package/dist/implementation/world/archetype.d.ts +64 -9
- package/dist/implementation/world/archetype.js +103 -14
- package/dist/implementation/world/archetype.js.map +1 -1
- package/dist/implementation/world/arrays.d.ts +6 -1
- package/dist/implementation/world/arrays.js +3 -0
- package/dist/implementation/world/arrays.js.map +1 -1
- package/dist/implementation/world/arrivals.d.ts +52 -0
- package/dist/implementation/world/arrivals.js +146 -0
- package/dist/implementation/world/arrivals.js.map +1 -0
- package/dist/implementation/world/attach-kernel.d.ts +3 -2
- package/dist/implementation/world/attach-kernel.js +16 -8
- package/dist/implementation/world/attach-kernel.js.map +1 -1
- package/dist/implementation/world/batches.d.ts +5 -2
- package/dist/implementation/world/batches.js +72 -8
- package/dist/implementation/world/batches.js.map +1 -1
- package/dist/implementation/world/buffer.js +37 -4
- package/dist/implementation/world/buffer.js.map +1 -1
- package/dist/implementation/world/cascade.js +1 -1
- package/dist/implementation/world/cascade.js.map +1 -1
- package/dist/implementation/world/cells.js.map +1 -1
- package/dist/implementation/world/check-kernel.d.ts +7 -5
- package/dist/implementation/world/check-kernel.js +51 -34
- package/dist/implementation/world/check-kernel.js.map +1 -1
- package/dist/implementation/world/claims.js +1 -0
- package/dist/implementation/world/claims.js.map +1 -1
- package/dist/implementation/world/closure.js +1 -0
- package/dist/implementation/world/closure.js.map +1 -1
- package/dist/implementation/world/command-ring.js +2 -1
- package/dist/implementation/world/command-ring.js.map +1 -1
- package/dist/implementation/world/commands.js +26 -4
- package/dist/implementation/world/commands.js.map +1 -1
- package/dist/implementation/world/create.d.ts +40 -0
- package/dist/implementation/world/create.js +479 -257
- package/dist/implementation/world/create.js.map +1 -1
- package/dist/implementation/world/directories.js +2 -1
- package/dist/implementation/world/directories.js.map +1 -1
- package/dist/implementation/world/entities.js.map +1 -1
- package/dist/implementation/world/execute.d.ts +1 -7
- package/dist/implementation/world/execute.js +248 -107
- package/dist/implementation/world/execute.js.map +1 -1
- package/dist/implementation/world/failures.d.ts +48 -5
- package/dist/implementation/world/failures.js +36 -4
- package/dist/implementation/world/failures.js.map +1 -1
- package/dist/implementation/world/finalizers.d.ts +2 -0
- package/dist/implementation/world/finalizers.js +42 -14
- package/dist/implementation/world/finalizers.js.map +1 -1
- package/dist/implementation/world/gpu.d.ts +8 -8
- package/dist/implementation/world/gpu.js +21 -12
- package/dist/implementation/world/gpu.js.map +1 -1
- package/dist/implementation/world/holders.js +1 -0
- package/dist/implementation/world/holders.js.map +1 -1
- package/dist/implementation/world/index-build.js +1 -0
- package/dist/implementation/world/index-build.js.map +1 -1
- package/dist/implementation/world/index-hash.d.ts +52 -13
- package/dist/implementation/world/index-hash.js +440 -71
- package/dist/implementation/world/index-hash.js.map +1 -1
- package/dist/implementation/world/index-keys.js +1 -0
- package/dist/implementation/world/index-keys.js.map +1 -1
- package/dist/implementation/world/index-lookups.d.ts +3 -3
- package/dist/implementation/world/index-lookups.js +22 -17
- package/dist/implementation/world/index-lookups.js.map +1 -1
- package/dist/implementation/world/index-order.js.map +1 -1
- package/dist/implementation/world/index-readers.js.map +1 -1
- package/dist/implementation/world/index-sorted.d.ts +2 -2
- package/dist/implementation/world/index-sorted.js +10 -4
- package/dist/implementation/world/index-sorted.js.map +1 -1
- package/dist/implementation/world/indexes.d.ts +9 -14
- package/dist/implementation/world/indexes.js +57 -115
- package/dist/implementation/world/indexes.js.map +1 -1
- package/dist/implementation/world/input.js +1 -1
- package/dist/implementation/world/input.js.map +1 -1
- package/dist/implementation/world/intrinsics.js.map +1 -1
- package/dist/implementation/world/join.d.ts +10 -7
- package/dist/implementation/world/join.js +116 -59
- package/dist/implementation/world/join.js.map +1 -1
- package/dist/implementation/world/joined-observer.d.ts +31 -2
- package/dist/implementation/world/joined-observer.js +69 -17
- package/dist/implementation/world/joined-observer.js.map +1 -1
- package/dist/implementation/world/joining.d.ts +60 -6
- package/dist/implementation/world/joining.js +47 -3
- package/dist/implementation/world/joining.js.map +1 -1
- package/dist/implementation/world/journal.d.ts +3 -2
- package/dist/implementation/world/journal.js +7 -4
- package/dist/implementation/world/journal.js.map +1 -1
- package/dist/implementation/world/kernel-indexes.d.ts +9 -2
- package/dist/implementation/world/kernel-indexes.js +13 -3
- package/dist/implementation/world/kernel-indexes.js.map +1 -1
- package/dist/implementation/world/kernel.d.ts +39 -5
- package/dist/implementation/world/kernel.js +2 -0
- package/dist/implementation/world/kernel.js.map +1 -1
- package/dist/implementation/world/kernels.d.ts +10 -2
- package/dist/implementation/world/kernels.js +85 -13
- package/dist/implementation/world/kernels.js.map +1 -1
- package/dist/implementation/world/layout-directory.d.ts +28 -12
- package/dist/implementation/world/layout-directory.js +72 -17
- package/dist/implementation/world/layout-directory.js.map +1 -1
- package/dist/implementation/world/lists.d.ts +37 -7
- package/dist/implementation/world/lists.js +169 -29
- package/dist/implementation/world/lists.js.map +1 -1
- package/dist/implementation/world/lookup-keys.d.ts +9 -8
- package/dist/implementation/world/lookup-keys.js.map +1 -1
- package/dist/implementation/world/loop.js +4 -5
- package/dist/implementation/world/loop.js.map +1 -1
- package/dist/implementation/world/memory.js +1 -0
- package/dist/implementation/world/memory.js.map +1 -1
- package/dist/implementation/world/mirror.d.ts +16 -3
- package/dist/implementation/world/mirror.js +37 -9
- package/dist/implementation/world/mirror.js.map +1 -1
- package/dist/implementation/world/move-log.js.map +1 -1
- package/dist/implementation/world/observer.d.ts +1 -1
- package/dist/implementation/world/observer.js +1 -2
- package/dist/implementation/world/observer.js.map +1 -1
- package/dist/implementation/world/order.js +1 -0
- package/dist/implementation/world/order.js.map +1 -1
- package/dist/implementation/world/out-of-band.d.ts +28 -0
- package/dist/implementation/world/out-of-band.js +66 -0
- package/dist/implementation/world/out-of-band.js.map +1 -0
- package/dist/implementation/world/plan.js.map +1 -1
- package/dist/implementation/world/pool.js +1 -0
- package/dist/implementation/world/pool.js.map +1 -1
- package/dist/implementation/world/port.d.ts +4 -3
- package/dist/implementation/world/port.js +14 -9
- package/dist/implementation/world/port.js.map +1 -1
- package/dist/implementation/world/prepared-lookup.js +1 -0
- package/dist/implementation/world/prepared-lookup.js.map +1 -1
- package/dist/implementation/world/prepared-spawn.js +13 -9
- package/dist/implementation/world/prepared-spawn.js.map +1 -1
- package/dist/implementation/world/program.js.map +1 -1
- package/dist/implementation/world/protocol.d.ts +8 -1
- package/dist/implementation/world/protocol.js.map +1 -1
- package/dist/implementation/world/publish.js.map +1 -1
- package/dist/implementation/world/ranges.d.ts +13 -3
- package/dist/implementation/world/ranges.js +118 -35
- package/dist/implementation/world/ranges.js.map +1 -1
- package/dist/implementation/world/reclaim.d.ts +27 -0
- package/dist/implementation/world/reclaim.js +176 -0
- package/dist/implementation/world/reclaim.js.map +1 -0
- package/dist/implementation/world/reductions.d.ts +7 -6
- package/dist/implementation/world/reductions.js +11 -11
- package/dist/implementation/world/reductions.js.map +1 -1
- package/dist/implementation/world/register.js +2 -2
- package/dist/implementation/world/register.js.map +1 -1
- package/dist/implementation/world/remote-systems.d.ts +9 -4
- package/dist/implementation/world/remote-systems.js +33 -28
- package/dist/implementation/world/remote-systems.js.map +1 -1
- package/dist/implementation/world/remote.js +1 -0
- package/dist/implementation/world/remote.js.map +1 -1
- package/dist/implementation/world/render-order.d.ts +19 -0
- package/dist/implementation/world/render-order.js +126 -0
- package/dist/implementation/world/render-order.js.map +1 -0
- package/dist/implementation/world/required.d.ts +3 -0
- package/dist/implementation/world/required.js +9 -0
- package/dist/implementation/world/required.js.map +1 -0
- package/dist/implementation/world/resources.d.ts +4 -1
- package/dist/implementation/world/resources.js +6 -3
- package/dist/implementation/world/resources.js.map +1 -1
- package/dist/implementation/world/rows.d.ts +15 -12
- package/dist/implementation/world/rows.js +90 -20
- package/dist/implementation/world/rows.js.map +1 -1
- package/dist/implementation/world/runner.d.ts +10 -0
- package/dist/implementation/world/runner.js +398 -78
- package/dist/implementation/world/runner.js.map +1 -1
- package/dist/implementation/world/shared.d.ts +55 -0
- package/dist/implementation/world/shared.js +301 -0
- package/dist/implementation/world/shared.js.map +1 -0
- package/dist/implementation/world/sharing.d.ts +7 -6
- package/dist/implementation/world/sharing.js +86 -23
- package/dist/implementation/world/sharing.js.map +1 -1
- package/dist/implementation/world/staging.d.ts +28 -5
- package/dist/implementation/world/staging.js +35 -9
- package/dist/implementation/world/staging.js.map +1 -1
- package/dist/implementation/world/state.d.ts +72 -13
- package/dist/implementation/world/state.js +138 -14
- package/dist/implementation/world/state.js.map +1 -1
- package/dist/implementation/world/stop-lists.d.ts +25 -2
- package/dist/implementation/world/stop-lists.js +63 -8
- package/dist/implementation/world/stop-lists.js.map +1 -1
- package/dist/implementation/world/strings.js +1 -0
- package/dist/implementation/world/strings.js.map +1 -1
- package/dist/implementation/world/structure.d.ts +1 -1
- package/dist/implementation/world/structure.js +4 -1
- package/dist/implementation/world/structure.js.map +1 -1
- package/dist/implementation/world/synchronize.d.ts +1 -1
- package/dist/implementation/world/synchronize.js +59 -17
- package/dist/implementation/world/synchronize.js.map +1 -1
- package/dist/implementation/world/tail-blocks.d.ts +5 -2
- package/dist/implementation/world/tail-blocks.js +9 -4
- package/dist/implementation/world/tail-blocks.js.map +1 -1
- package/dist/implementation/world/tails.d.ts +10 -5
- package/dist/implementation/world/tails.js +25 -18
- package/dist/implementation/world/tails.js.map +1 -1
- package/dist/implementation/world/terminal.js +1 -0
- package/dist/implementation/world/terminal.js.map +1 -1
- package/dist/implementation/world/thread-directory.d.ts +8 -2
- package/dist/implementation/world/thread-directory.js +82 -12
- package/dist/implementation/world/thread-directory.js.map +1 -1
- package/dist/implementation/world/thread-finalizers.d.ts +1 -2
- package/dist/implementation/world/thread-finalizers.js +129 -19
- package/dist/implementation/world/thread-finalizers.js.map +1 -1
- package/dist/implementation/world/thread-indexes.d.ts +3 -1
- package/dist/implementation/world/thread-indexes.js +4 -3
- package/dist/implementation/world/thread-indexes.js.map +1 -1
- package/dist/implementation/world/thread-observer.d.ts +4 -2
- package/dist/implementation/world/thread-observer.js +53 -11
- package/dist/implementation/world/thread-observer.js.map +1 -1
- package/dist/implementation/world/thread-systems.d.ts +10 -2
- package/dist/implementation/world/thread-systems.js +396 -78
- package/dist/implementation/world/thread-systems.js.map +1 -1
- package/dist/implementation/world/thread-tasks.d.ts +8 -4
- package/dist/implementation/world/thread-tasks.js +9 -4
- package/dist/implementation/world/thread-tasks.js.map +1 -1
- package/dist/implementation/world/transfers.js.map +1 -1
- package/dist/implementation/world/up.d.ts +9 -6
- package/dist/implementation/world/up.js +291 -75
- package/dist/implementation/world/up.js.map +1 -1
- package/dist/implementation/world/wasm.d.ts +39 -8
- package/dist/implementation/world/wasm.js +428 -127
- package/dist/implementation/world/wasm.js.map +1 -1
- package/dist/implementation/world/wgsl.d.ts +4 -2
- package/dist/implementation/world/wgsl.js +20 -8
- package/dist/implementation/world/wgsl.js.map +1 -1
- package/dist/implementation/world/where.d.ts +74 -0
- package/dist/implementation/world/where.js +202 -0
- package/dist/implementation/world/where.js.map +1 -0
- package/dist/implementation/world/worker-platform.js.map +1 -1
- package/dist/implementation/world/worker-window.d.ts +7 -0
- package/dist/implementation/world/worker-window.js +47 -0
- package/dist/implementation/world/worker-window.js.map +1 -0
- package/dist/implementation/world/worker.js +47 -61
- package/dist/implementation/world/worker.js.map +1 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/interface/component/component.js +1 -0
- package/dist/interface/component/component.js.map +1 -1
- package/dist/interface/component/index.d.ts +0 -1
- package/dist/interface/component/index.js +1 -1
- package/dist/interface/component/index.js.map +1 -1
- package/dist/interface/component/types.d.ts +2 -2
- package/dist/interface/component/value.d.ts +7 -2
- package/dist/interface/entity/entity.js.map +1 -1
- package/dist/interface/entity/index.d.ts +2 -0
- package/dist/interface/entity/index.js +2 -0
- package/dist/interface/entity/index.js.map +1 -1
- package/dist/interface/finalizer/body.d.ts +14 -11
- package/dist/interface/finalizer/create.d.ts +14 -14
- package/dist/interface/finalizer/create.js +43 -10
- package/dist/interface/finalizer/create.js.map +1 -1
- package/dist/interface/finalizer/created.d.ts +5 -5
- package/dist/interface/finalizer/declaration.d.ts +33 -13
- package/dist/interface/finalizer/finalizer.d.ts +2 -2
- package/dist/interface/finalizer/finalizer.js.map +1 -1
- package/dist/interface/finalizer/index.js +1 -0
- package/dist/interface/finalizer/index.js.map +1 -1
- package/dist/interface/gpu/accessors.d.ts +4 -3
- package/dist/interface/gpu/accessors.js +25 -8
- package/dist/interface/gpu/accessors.js.map +1 -1
- package/dist/interface/gpu/gpu.js.map +1 -1
- package/dist/interface/gpu/index.js +1 -0
- package/dist/interface/gpu/index.js.map +1 -1
- package/dist/interface/gpu/layout.js +1 -0
- package/dist/interface/gpu/layout.js.map +1 -1
- package/dist/interface/gpu/record.js +1 -0
- package/dist/interface/gpu/record.js.map +1 -1
- package/dist/interface/gpu/wgsl.d.ts +2 -1
- package/dist/interface/gpu/wgsl.js +9 -5
- package/dist/interface/gpu/wgsl.js.map +1 -1
- package/dist/interface/index.d.ts +0 -3
- package/dist/interface/index.js +1 -3
- package/dist/interface/index.js.map +1 -1
- package/dist/interface/indexes/create.d.ts +18 -9
- package/dist/interface/indexes/create.js +16 -13
- package/dist/interface/indexes/create.js.map +1 -1
- package/dist/interface/indexes/created.d.ts +2 -2
- package/dist/interface/indexes/declaration.d.ts +8 -3
- package/dist/interface/indexes/index-type.d.ts +3 -3
- package/dist/interface/indexes/index-type.js.map +1 -1
- package/dist/interface/indexes/index.js +1 -0
- package/dist/interface/indexes/index.js.map +1 -1
- package/dist/interface/math/f32/default.d.ts +4 -0
- package/dist/interface/math/f32/default.js +4 -0
- package/dist/interface/math/f32/default.js.map +1 -0
- package/dist/interface/math/f32/index.d.ts +3 -1
- package/dist/interface/math/f32/index.js.map +1 -1
- package/dist/interface/math/f32/public.d.ts +1 -0
- package/dist/interface/math/f32/public.js +2 -0
- package/dist/interface/math/f32/public.js.map +1 -1
- package/dist/interface/math/f32/round-half-even.js +1 -0
- package/dist/interface/math/f32/round-half-even.js.map +1 -1
- package/dist/interface/math/f32/schema.js.map +1 -1
- package/dist/interface/math/i32/default.d.ts +4 -0
- package/dist/interface/math/i32/default.js +4 -0
- package/dist/interface/math/i32/default.js.map +1 -0
- package/dist/interface/math/i32/index.d.ts +3 -1
- package/dist/interface/math/i32/index.js.map +1 -1
- package/dist/interface/math/i32/public.d.ts +1 -0
- package/dist/interface/math/i32/public.js +2 -0
- package/dist/interface/math/i32/public.js.map +1 -1
- package/dist/interface/math/i32/schema.js.map +1 -1
- package/dist/interface/math/i32/shift-right.js.map +1 -1
- package/dist/interface/math/index.js +1 -0
- package/dist/interface/math/index.js.map +1 -1
- package/dist/interface/math/intrinsic.js.map +1 -1
- package/dist/interface/math/mat4x4/add.js.map +1 -1
- package/dist/interface/math/mat4x4/determinant.js.map +1 -1
- package/dist/interface/math/mat4x4/identity.js.map +1 -1
- package/dist/interface/math/mat4x4/index.d.ts +3 -1
- package/dist/interface/math/mat4x4/index.js.map +1 -1
- package/dist/interface/math/mat4x4/inverse.js.map +1 -1
- package/dist/interface/math/mat4x4/look-at.js.map +1 -1
- package/dist/interface/math/mat4x4/multiply-vec3.js.map +1 -1
- package/dist/interface/math/mat4x4/multiply-vec4.js.map +1 -1
- package/dist/interface/math/mat4x4/multiply.js.map +1 -1
- package/dist/interface/math/mat4x4/orthographic.js.map +1 -1
- package/dist/interface/math/mat4x4/perspective.js.map +1 -1
- package/dist/interface/math/mat4x4/public.d.ts +1 -0
- package/dist/interface/math/mat4x4/public.js +2 -0
- package/dist/interface/math/mat4x4/public.js.map +1 -1
- package/dist/interface/math/mat4x4/rotation-x.js.map +1 -1
- package/dist/interface/math/mat4x4/rotation-y.js.map +1 -1
- package/dist/interface/math/mat4x4/rotation-z.js.map +1 -1
- package/dist/interface/math/mat4x4/scale.js.map +1 -1
- package/dist/interface/math/mat4x4/scaling.js.map +1 -1
- package/dist/interface/math/mat4x4/schema.js.map +1 -1
- package/dist/interface/math/mat4x4/subtract.js.map +1 -1
- package/dist/interface/math/mat4x4/translation.js.map +1 -1
- package/dist/interface/math/mat4x4/transpose.js.map +1 -1
- package/dist/interface/math/mat4x4/zero.js.map +1 -1
- package/dist/interface/math/quat/add.js.map +1 -1
- package/dist/interface/math/quat/align-to.js.map +1 -1
- package/dist/interface/math/quat/conjugate.js.map +1 -1
- package/dist/interface/math/quat/distance.js.map +1 -1
- package/dist/interface/math/quat/dot.js.map +1 -1
- package/dist/interface/math/quat/from-axis-angle.js.map +1 -1
- package/dist/interface/math/quat/from-euler.js.map +1 -1
- package/dist/interface/math/quat/identity.js.map +1 -1
- package/dist/interface/math/quat/index.d.ts +3 -1
- package/dist/interface/math/quat/index.js.map +1 -1
- package/dist/interface/math/quat/inverse.js.map +1 -1
- package/dist/interface/math/quat/length-squared.js.map +1 -1
- package/dist/interface/math/quat/length.js.map +1 -1
- package/dist/interface/math/quat/lerp.js.map +1 -1
- package/dist/interface/math/quat/look-at.js.map +1 -1
- package/dist/interface/math/quat/multiply.js.map +1 -1
- package/dist/interface/math/quat/negate.js.map +1 -1
- package/dist/interface/math/quat/normalize.js.map +1 -1
- package/dist/interface/math/quat/public.d.ts +1 -0
- package/dist/interface/math/quat/public.js +2 -0
- package/dist/interface/math/quat/public.js.map +1 -1
- package/dist/interface/math/quat/rotate-vec3.js.map +1 -1
- package/dist/interface/math/quat/scale.js.map +1 -1
- package/dist/interface/math/quat/schema.js.map +1 -1
- package/dist/interface/math/quat/slerp.js.map +1 -1
- package/dist/interface/math/quat/subtract.js.map +1 -1
- package/dist/interface/math/quat/to-axis-angle.js.map +1 -1
- package/dist/interface/math/quat/to-euler.js.map +1 -1
- package/dist/interface/math/quat/to-mat4.js.map +1 -1
- package/dist/interface/math/u32/count-leading-zeros.js.map +1 -1
- package/dist/interface/math/u32/count-one-bits.js.map +1 -1
- package/dist/interface/math/u32/count-trailing-zeros.js.map +1 -1
- package/dist/interface/math/u32/default.d.ts +4 -0
- package/dist/interface/math/u32/default.js +4 -0
- package/dist/interface/math/u32/default.js.map +1 -0
- package/dist/interface/math/u32/index.d.ts +3 -1
- package/dist/interface/math/u32/index.js.map +1 -1
- package/dist/interface/math/u32/public.d.ts +1 -0
- package/dist/interface/math/u32/public.js +2 -0
- package/dist/interface/math/u32/public.js.map +1 -1
- package/dist/interface/math/u32/reverse-bits.js.map +1 -1
- package/dist/interface/math/u32/schema.js.map +1 -1
- package/dist/interface/math/u32/shift-right.js.map +1 -1
- package/dist/interface/math/vec2/f32/abs.js.map +1 -1
- package/dist/interface/math/vec2/f32/acos.js.map +1 -1
- package/dist/interface/math/vec2/f32/acosh.js.map +1 -1
- package/dist/interface/math/vec2/f32/add.js.map +1 -1
- package/dist/interface/math/vec2/f32/asin.js.map +1 -1
- package/dist/interface/math/vec2/f32/asinh.js.map +1 -1
- package/dist/interface/math/vec2/f32/atan.js.map +1 -1
- package/dist/interface/math/vec2/f32/atanh.js.map +1 -1
- package/dist/interface/math/vec2/f32/ceil.js.map +1 -1
- package/dist/interface/math/vec2/f32/clamp.js.map +1 -1
- package/dist/interface/math/vec2/f32/cos.js.map +1 -1
- package/dist/interface/math/vec2/f32/cosh.js.map +1 -1
- package/dist/interface/math/vec2/f32/distance.js.map +1 -1
- package/dist/interface/math/vec2/f32/dot.js.map +1 -1
- package/dist/interface/math/vec2/f32/equals.js.map +1 -1
- package/dist/interface/math/vec2/f32/exp.js.map +1 -1
- package/dist/interface/math/vec2/f32/exp2.js.map +1 -1
- package/dist/interface/math/vec2/f32/f32.d.ts +3 -1
- package/dist/interface/math/vec2/f32/f32.js.map +1 -1
- package/dist/interface/math/vec2/f32/faceforward.js.map +1 -1
- package/dist/interface/math/vec2/f32/floor.js.map +1 -1
- package/dist/interface/math/vec2/f32/fract.js.map +1 -1
- package/dist/interface/math/vec2/f32/length.js.map +1 -1
- package/dist/interface/math/vec2/f32/log.js.map +1 -1
- package/dist/interface/math/vec2/f32/log2.js.map +1 -1
- package/dist/interface/math/vec2/f32/max.js.map +1 -1
- package/dist/interface/math/vec2/f32/min.js.map +1 -1
- package/dist/interface/math/vec2/f32/mix.js.map +1 -1
- package/dist/interface/math/vec2/f32/mod.js.map +1 -1
- package/dist/interface/math/vec2/f32/modf.js.map +1 -1
- package/dist/interface/math/vec2/f32/negate.js.map +1 -1
- package/dist/interface/math/vec2/f32/normalize.js.map +1 -1
- package/dist/interface/math/vec2/f32/pow.js.map +1 -1
- package/dist/interface/math/vec2/f32/public.d.ts +1 -0
- package/dist/interface/math/vec2/f32/public.js +2 -0
- package/dist/interface/math/vec2/f32/public.js.map +1 -1
- package/dist/interface/math/vec2/f32/reflect.js.map +1 -1
- package/dist/interface/math/vec2/f32/refract.js.map +1 -1
- package/dist/interface/math/vec2/f32/round.js.map +1 -1
- package/dist/interface/math/vec2/f32/scale.js.map +1 -1
- package/dist/interface/math/vec2/f32/schema.js.map +1 -1
- package/dist/interface/math/vec2/f32/sign.js.map +1 -1
- package/dist/interface/math/vec2/f32/sin.js.map +1 -1
- package/dist/interface/math/vec2/f32/sinh.js.map +1 -1
- package/dist/interface/math/vec2/f32/smoothstep.js.map +1 -1
- package/dist/interface/math/vec2/f32/sqrt.js.map +1 -1
- package/dist/interface/math/vec2/f32/step.js.map +1 -1
- package/dist/interface/math/vec2/f32/subtract.js.map +1 -1
- package/dist/interface/math/vec2/f32/tan.js.map +1 -1
- package/dist/interface/math/vec2/f32/tanh.js.map +1 -1
- package/dist/interface/math/vec2/f32/trunc.js.map +1 -1
- package/dist/interface/math/vec2/f32/zero.js.map +1 -1
- package/dist/interface/math/vec2/i32/abs.js.map +1 -1
- package/dist/interface/math/vec2/i32/add.js.map +1 -1
- package/dist/interface/math/vec2/i32/bitwise-and.js.map +1 -1
- package/dist/interface/math/vec2/i32/bitwise-not.js.map +1 -1
- package/dist/interface/math/vec2/i32/bitwise-or.js.map +1 -1
- package/dist/interface/math/vec2/i32/bitwise-xor.js.map +1 -1
- package/dist/interface/math/vec2/i32/clamp.js.map +1 -1
- package/dist/interface/math/vec2/i32/count-leading-zeros.js.map +1 -1
- package/dist/interface/math/vec2/i32/count-one-bits.js.map +1 -1
- package/dist/interface/math/vec2/i32/count-trailing-zeros.js.map +1 -1
- package/dist/interface/math/vec2/i32/equals.js.map +1 -1
- package/dist/interface/math/vec2/i32/i32.d.ts +3 -1
- package/dist/interface/math/vec2/i32/i32.js.map +1 -1
- package/dist/interface/math/vec2/i32/max.js.map +1 -1
- package/dist/interface/math/vec2/i32/min.js.map +1 -1
- package/dist/interface/math/vec2/i32/negate.js.map +1 -1
- package/dist/interface/math/vec2/i32/public.d.ts +1 -0
- package/dist/interface/math/vec2/i32/public.js +2 -0
- package/dist/interface/math/vec2/i32/public.js.map +1 -1
- package/dist/interface/math/vec2/i32/reverse-bits.js.map +1 -1
- package/dist/interface/math/vec2/i32/scale.js.map +1 -1
- package/dist/interface/math/vec2/i32/schema.js.map +1 -1
- package/dist/interface/math/vec2/i32/shift-left.js.map +1 -1
- package/dist/interface/math/vec2/i32/shift-right.js.map +1 -1
- package/dist/interface/math/vec2/i32/subtract.js.map +1 -1
- package/dist/interface/math/vec2/i32/zero.js.map +1 -1
- package/dist/interface/math/vec2/index.js.map +1 -1
- package/dist/interface/math/vec2/public.d.ts +1 -0
- package/dist/interface/math/vec2/public.js +2 -0
- package/dist/interface/math/vec2/public.js.map +1 -1
- package/dist/interface/math/vec2/u32/add.js.map +1 -1
- package/dist/interface/math/vec2/u32/bitwise-and.js.map +1 -1
- package/dist/interface/math/vec2/u32/bitwise-not.js.map +1 -1
- package/dist/interface/math/vec2/u32/bitwise-or.js.map +1 -1
- package/dist/interface/math/vec2/u32/bitwise-xor.js.map +1 -1
- package/dist/interface/math/vec2/u32/clamp.js.map +1 -1
- package/dist/interface/math/vec2/u32/count-leading-zeros.js.map +1 -1
- package/dist/interface/math/vec2/u32/count-one-bits.js.map +1 -1
- package/dist/interface/math/vec2/u32/count-trailing-zeros.js.map +1 -1
- package/dist/interface/math/vec2/u32/equals.js.map +1 -1
- package/dist/interface/math/vec2/u32/max.js.map +1 -1
- package/dist/interface/math/vec2/u32/min.js.map +1 -1
- package/dist/interface/math/vec2/u32/negate.js.map +1 -1
- package/dist/interface/math/vec2/u32/public.d.ts +1 -0
- package/dist/interface/math/vec2/u32/public.js +2 -0
- package/dist/interface/math/vec2/u32/public.js.map +1 -1
- package/dist/interface/math/vec2/u32/reverse-bits.js.map +1 -1
- package/dist/interface/math/vec2/u32/scale.js.map +1 -1
- package/dist/interface/math/vec2/u32/schema.js.map +1 -1
- package/dist/interface/math/vec2/u32/shift-left.js.map +1 -1
- package/dist/interface/math/vec2/u32/shift-right.js.map +1 -1
- package/dist/interface/math/vec2/u32/subtract.js.map +1 -1
- package/dist/interface/math/vec2/u32/u32.d.ts +3 -1
- package/dist/interface/math/vec2/u32/u32.js.map +1 -1
- package/dist/interface/math/vec2/u32/zero.js.map +1 -1
- package/dist/interface/math/vec3/f32/abs.js.map +1 -1
- package/dist/interface/math/vec3/f32/acos.js.map +1 -1
- package/dist/interface/math/vec3/f32/acosh.js.map +1 -1
- package/dist/interface/math/vec3/f32/add.js.map +1 -1
- package/dist/interface/math/vec3/f32/asin.js.map +1 -1
- package/dist/interface/math/vec3/f32/asinh.js.map +1 -1
- package/dist/interface/math/vec3/f32/atan.js.map +1 -1
- package/dist/interface/math/vec3/f32/atanh.js.map +1 -1
- package/dist/interface/math/vec3/f32/ceil.js.map +1 -1
- package/dist/interface/math/vec3/f32/clamp.js.map +1 -1
- package/dist/interface/math/vec3/f32/cos.js.map +1 -1
- package/dist/interface/math/vec3/f32/cosh.js.map +1 -1
- package/dist/interface/math/vec3/f32/cross.js.map +1 -1
- package/dist/interface/math/vec3/f32/distance-squared.js.map +1 -1
- package/dist/interface/math/vec3/f32/distance.js.map +1 -1
- package/dist/interface/math/vec3/f32/dot.js.map +1 -1
- package/dist/interface/math/vec3/f32/equals.js.map +1 -1
- package/dist/interface/math/vec3/f32/exp.js.map +1 -1
- package/dist/interface/math/vec3/f32/exp2.js.map +1 -1
- package/dist/interface/math/vec3/f32/f32.d.ts +3 -1
- package/dist/interface/math/vec3/f32/f32.js.map +1 -1
- package/dist/interface/math/vec3/f32/faceforward.js.map +1 -1
- package/dist/interface/math/vec3/f32/floor.js.map +1 -1
- package/dist/interface/math/vec3/f32/fract.js.map +1 -1
- package/dist/interface/math/vec3/f32/length-squared.js.map +1 -1
- package/dist/interface/math/vec3/f32/length.js.map +1 -1
- package/dist/interface/math/vec3/f32/log.js.map +1 -1
- package/dist/interface/math/vec3/f32/log2.js.map +1 -1
- package/dist/interface/math/vec3/f32/max.js.map +1 -1
- package/dist/interface/math/vec3/f32/min.js.map +1 -1
- package/dist/interface/math/vec3/f32/mix.js.map +1 -1
- package/dist/interface/math/vec3/f32/mod.js.map +1 -1
- package/dist/interface/math/vec3/f32/modf.js.map +1 -1
- package/dist/interface/math/vec3/f32/multiply.js.map +1 -1
- package/dist/interface/math/vec3/f32/negate.js.map +1 -1
- package/dist/interface/math/vec3/f32/normalize.js.map +1 -1
- package/dist/interface/math/vec3/f32/one.js.map +1 -1
- package/dist/interface/math/vec3/f32/pow.js.map +1 -1
- package/dist/interface/math/vec3/f32/public.d.ts +1 -0
- package/dist/interface/math/vec3/f32/public.js +2 -0
- package/dist/interface/math/vec3/f32/public.js.map +1 -1
- package/dist/interface/math/vec3/f32/random.js.map +1 -1
- package/dist/interface/math/vec3/f32/reflect.js.map +1 -1
- package/dist/interface/math/vec3/f32/refract.js.map +1 -1
- package/dist/interface/math/vec3/f32/round.js.map +1 -1
- package/dist/interface/math/vec3/f32/scale.js.map +1 -1
- package/dist/interface/math/vec3/f32/schema.js.map +1 -1
- package/dist/interface/math/vec3/f32/sign.js.map +1 -1
- package/dist/interface/math/vec3/f32/sin.js.map +1 -1
- package/dist/interface/math/vec3/f32/sinh.js.map +1 -1
- package/dist/interface/math/vec3/f32/smoothstep.js.map +1 -1
- package/dist/interface/math/vec3/f32/sqrt.js.map +1 -1
- package/dist/interface/math/vec3/f32/step.js.map +1 -1
- package/dist/interface/math/vec3/f32/subtract.js.map +1 -1
- package/dist/interface/math/vec3/f32/tan.js.map +1 -1
- package/dist/interface/math/vec3/f32/tanh.js.map +1 -1
- package/dist/interface/math/vec3/f32/trunc.js.map +1 -1
- package/dist/interface/math/vec3/f32/zero.js.map +1 -1
- package/dist/interface/math/vec3/i32/abs.js.map +1 -1
- package/dist/interface/math/vec3/i32/add.js.map +1 -1
- package/dist/interface/math/vec3/i32/bitwise-and.js.map +1 -1
- package/dist/interface/math/vec3/i32/bitwise-not.js.map +1 -1
- package/dist/interface/math/vec3/i32/bitwise-or.js.map +1 -1
- package/dist/interface/math/vec3/i32/bitwise-xor.js.map +1 -1
- package/dist/interface/math/vec3/i32/clamp.js.map +1 -1
- package/dist/interface/math/vec3/i32/count-leading-zeros.js.map +1 -1
- package/dist/interface/math/vec3/i32/count-one-bits.js.map +1 -1
- package/dist/interface/math/vec3/i32/count-trailing-zeros.js.map +1 -1
- package/dist/interface/math/vec3/i32/equals.js.map +1 -1
- package/dist/interface/math/vec3/i32/i32.d.ts +3 -1
- package/dist/interface/math/vec3/i32/i32.js.map +1 -1
- package/dist/interface/math/vec3/i32/max.js.map +1 -1
- package/dist/interface/math/vec3/i32/min.js.map +1 -1
- package/dist/interface/math/vec3/i32/multiply.js.map +1 -1
- package/dist/interface/math/vec3/i32/negate.js.map +1 -1
- package/dist/interface/math/vec3/i32/one.js.map +1 -1
- package/dist/interface/math/vec3/i32/public.d.ts +1 -0
- package/dist/interface/math/vec3/i32/public.js +2 -0
- package/dist/interface/math/vec3/i32/public.js.map +1 -1
- package/dist/interface/math/vec3/i32/reverse-bits.js.map +1 -1
- package/dist/interface/math/vec3/i32/scale.js.map +1 -1
- package/dist/interface/math/vec3/i32/schema.js.map +1 -1
- package/dist/interface/math/vec3/i32/shift-left.js.map +1 -1
- package/dist/interface/math/vec3/i32/shift-right.js.map +1 -1
- package/dist/interface/math/vec3/i32/subtract.js.map +1 -1
- package/dist/interface/math/vec3/i32/zero.js.map +1 -1
- package/dist/interface/math/vec3/index.js.map +1 -1
- package/dist/interface/math/vec3/public.d.ts +1 -0
- package/dist/interface/math/vec3/public.js +2 -0
- package/dist/interface/math/vec3/public.js.map +1 -1
- package/dist/interface/math/vec3/u32/add.js.map +1 -1
- package/dist/interface/math/vec3/u32/bitwise-and.js.map +1 -1
- package/dist/interface/math/vec3/u32/bitwise-not.js.map +1 -1
- package/dist/interface/math/vec3/u32/bitwise-or.js.map +1 -1
- package/dist/interface/math/vec3/u32/bitwise-xor.js.map +1 -1
- package/dist/interface/math/vec3/u32/clamp.js.map +1 -1
- package/dist/interface/math/vec3/u32/count-leading-zeros.js.map +1 -1
- package/dist/interface/math/vec3/u32/count-one-bits.js.map +1 -1
- package/dist/interface/math/vec3/u32/count-trailing-zeros.js.map +1 -1
- package/dist/interface/math/vec3/u32/equals.js.map +1 -1
- package/dist/interface/math/vec3/u32/max.js.map +1 -1
- package/dist/interface/math/vec3/u32/min.js.map +1 -1
- package/dist/interface/math/vec3/u32/multiply.js.map +1 -1
- package/dist/interface/math/vec3/u32/negate.js.map +1 -1
- package/dist/interface/math/vec3/u32/one.js.map +1 -1
- package/dist/interface/math/vec3/u32/public.d.ts +1 -0
- package/dist/interface/math/vec3/u32/public.js +2 -0
- package/dist/interface/math/vec3/u32/public.js.map +1 -1
- package/dist/interface/math/vec3/u32/reverse-bits.js.map +1 -1
- package/dist/interface/math/vec3/u32/scale.js.map +1 -1
- package/dist/interface/math/vec3/u32/schema.js.map +1 -1
- package/dist/interface/math/vec3/u32/shift-left.js.map +1 -1
- package/dist/interface/math/vec3/u32/shift-right.js.map +1 -1
- package/dist/interface/math/vec3/u32/subtract.js.map +1 -1
- package/dist/interface/math/vec3/u32/u32.d.ts +3 -1
- package/dist/interface/math/vec3/u32/u32.js.map +1 -1
- package/dist/interface/math/vec3/u32/volume.js.map +1 -1
- package/dist/interface/math/vec3/u32/zero.js.map +1 -1
- package/dist/interface/math/vec4/f32/abs.js.map +1 -1
- package/dist/interface/math/vec4/f32/acos.js.map +1 -1
- package/dist/interface/math/vec4/f32/acosh.js.map +1 -1
- package/dist/interface/math/vec4/f32/add.js.map +1 -1
- package/dist/interface/math/vec4/f32/asin.js.map +1 -1
- package/dist/interface/math/vec4/f32/asinh.js.map +1 -1
- package/dist/interface/math/vec4/f32/atan.js.map +1 -1
- package/dist/interface/math/vec4/f32/atanh.js.map +1 -1
- package/dist/interface/math/vec4/f32/ceil.js.map +1 -1
- package/dist/interface/math/vec4/f32/clamp.js.map +1 -1
- package/dist/interface/math/vec4/f32/cos.js.map +1 -1
- package/dist/interface/math/vec4/f32/cosh.js.map +1 -1
- package/dist/interface/math/vec4/f32/default.d.ts +4 -0
- package/dist/interface/math/vec4/f32/default.js +4 -0
- package/dist/interface/math/vec4/f32/default.js.map +1 -0
- package/dist/interface/math/vec4/f32/distance.js.map +1 -1
- package/dist/interface/math/vec4/f32/dot.js.map +1 -1
- package/dist/interface/math/vec4/f32/exp.js.map +1 -1
- package/dist/interface/math/vec4/f32/exp2.js.map +1 -1
- package/dist/interface/math/vec4/f32/f32.d.ts +3 -1
- package/dist/interface/math/vec4/f32/f32.js.map +1 -1
- package/dist/interface/math/vec4/f32/faceforward.js.map +1 -1
- package/dist/interface/math/vec4/f32/floor.js.map +1 -1
- package/dist/interface/math/vec4/f32/fract.js.map +1 -1
- package/dist/interface/math/vec4/f32/length.js.map +1 -1
- package/dist/interface/math/vec4/f32/log.js.map +1 -1
- package/dist/interface/math/vec4/f32/log2.js.map +1 -1
- package/dist/interface/math/vec4/f32/max.js.map +1 -1
- package/dist/interface/math/vec4/f32/min.js.map +1 -1
- package/dist/interface/math/vec4/f32/mix.js.map +1 -1
- package/dist/interface/math/vec4/f32/mod.js.map +1 -1
- package/dist/interface/math/vec4/f32/modf.js.map +1 -1
- package/dist/interface/math/vec4/f32/multiply.js.map +1 -1
- package/dist/interface/math/vec4/f32/negate.js.map +1 -1
- package/dist/interface/math/vec4/f32/normalize.js.map +1 -1
- package/dist/interface/math/vec4/f32/pow.js.map +1 -1
- package/dist/interface/math/vec4/f32/public.d.ts +1 -0
- package/dist/interface/math/vec4/f32/public.js +2 -0
- package/dist/interface/math/vec4/f32/public.js.map +1 -1
- package/dist/interface/math/vec4/f32/reflect.js.map +1 -1
- package/dist/interface/math/vec4/f32/refract.js.map +1 -1
- package/dist/interface/math/vec4/f32/round.js.map +1 -1
- package/dist/interface/math/vec4/f32/scale.js.map +1 -1
- package/dist/interface/math/vec4/f32/schema.js.map +1 -1
- package/dist/interface/math/vec4/f32/sign.js.map +1 -1
- package/dist/interface/math/vec4/f32/sin.js.map +1 -1
- package/dist/interface/math/vec4/f32/sinh.js.map +1 -1
- package/dist/interface/math/vec4/f32/smoothstep.js.map +1 -1
- package/dist/interface/math/vec4/f32/sqrt.js.map +1 -1
- package/dist/interface/math/vec4/f32/step.js.map +1 -1
- package/dist/interface/math/vec4/f32/subtract.js.map +1 -1
- package/dist/interface/math/vec4/f32/tan.js.map +1 -1
- package/dist/interface/math/vec4/f32/tanh.js.map +1 -1
- package/dist/interface/math/vec4/f32/trunc.js.map +1 -1
- package/dist/interface/math/vec4/i32/abs.js.map +1 -1
- package/dist/interface/math/vec4/i32/add.js.map +1 -1
- package/dist/interface/math/vec4/i32/bitwise-and.js.map +1 -1
- package/dist/interface/math/vec4/i32/bitwise-not.js.map +1 -1
- package/dist/interface/math/vec4/i32/bitwise-or.js.map +1 -1
- package/dist/interface/math/vec4/i32/bitwise-xor.js.map +1 -1
- package/dist/interface/math/vec4/i32/clamp.js.map +1 -1
- package/dist/interface/math/vec4/i32/count-leading-zeros.js.map +1 -1
- package/dist/interface/math/vec4/i32/count-one-bits.js.map +1 -1
- package/dist/interface/math/vec4/i32/count-trailing-zeros.js.map +1 -1
- package/dist/interface/math/vec4/i32/equals.js.map +1 -1
- package/dist/interface/math/vec4/i32/i32.d.ts +3 -1
- package/dist/interface/math/vec4/i32/i32.js.map +1 -1
- package/dist/interface/math/vec4/i32/max.js.map +1 -1
- package/dist/interface/math/vec4/i32/min.js.map +1 -1
- package/dist/interface/math/vec4/i32/multiply.js.map +1 -1
- package/dist/interface/math/vec4/i32/negate.js.map +1 -1
- package/dist/interface/math/vec4/i32/one.js.map +1 -1
- package/dist/interface/math/vec4/i32/public.d.ts +1 -0
- package/dist/interface/math/vec4/i32/public.js +2 -0
- package/dist/interface/math/vec4/i32/public.js.map +1 -1
- package/dist/interface/math/vec4/i32/reverse-bits.js.map +1 -1
- package/dist/interface/math/vec4/i32/scale.js.map +1 -1
- package/dist/interface/math/vec4/i32/schema.js.map +1 -1
- package/dist/interface/math/vec4/i32/shift-left.js.map +1 -1
- package/dist/interface/math/vec4/i32/shift-right.js.map +1 -1
- package/dist/interface/math/vec4/i32/subtract.js.map +1 -1
- package/dist/interface/math/vec4/i32/zero.js.map +1 -1
- package/dist/interface/math/vec4/index.js.map +1 -1
- package/dist/interface/math/vec4/public.d.ts +1 -0
- package/dist/interface/math/vec4/public.js +2 -0
- package/dist/interface/math/vec4/public.js.map +1 -1
- package/dist/interface/math/vec4/u32/add.js.map +1 -1
- package/dist/interface/math/vec4/u32/bitwise-and.js.map +1 -1
- package/dist/interface/math/vec4/u32/bitwise-not.js.map +1 -1
- package/dist/interface/math/vec4/u32/bitwise-or.js.map +1 -1
- package/dist/interface/math/vec4/u32/bitwise-xor.js.map +1 -1
- package/dist/interface/math/vec4/u32/clamp.js.map +1 -1
- package/dist/interface/math/vec4/u32/count-leading-zeros.js.map +1 -1
- package/dist/interface/math/vec4/u32/count-one-bits.js.map +1 -1
- package/dist/interface/math/vec4/u32/count-trailing-zeros.js.map +1 -1
- package/dist/interface/math/vec4/u32/equals.js.map +1 -1
- package/dist/interface/math/vec4/u32/max.js.map +1 -1
- package/dist/interface/math/vec4/u32/min.js.map +1 -1
- package/dist/interface/math/vec4/u32/multiply.js.map +1 -1
- package/dist/interface/math/vec4/u32/negate.js.map +1 -1
- package/dist/interface/math/vec4/u32/one.js.map +1 -1
- package/dist/interface/math/vec4/u32/public.d.ts +1 -0
- package/dist/interface/math/vec4/u32/public.js +2 -0
- package/dist/interface/math/vec4/u32/public.js.map +1 -1
- package/dist/interface/math/vec4/u32/reverse-bits.js.map +1 -1
- package/dist/interface/math/vec4/u32/scale.js.map +1 -1
- package/dist/interface/math/vec4/u32/schema.js.map +1 -1
- package/dist/interface/math/vec4/u32/shift-left.js.map +1 -1
- package/dist/interface/math/vec4/u32/shift-right.js.map +1 -1
- package/dist/interface/math/vec4/u32/subtract.js.map +1 -1
- package/dist/interface/math/vec4/u32/u32.d.ts +3 -1
- package/dist/interface/math/vec4/u32/u32.js.map +1 -1
- package/dist/interface/math/vec4/u32/zero.js.map +1 -1
- package/dist/interface/registry/archetypes.d.ts +25 -3
- package/dist/interface/registry/archetypes.js +40 -10
- package/dist/interface/registry/archetypes.js.map +1 -1
- package/dist/interface/registry/declarations.d.ts +7 -7
- package/dist/interface/registry/declarations.js +120 -10
- package/dist/interface/registry/declarations.js.map +1 -1
- package/dist/interface/registry/finalizer-order.js +3 -3
- package/dist/interface/registry/finalizer-order.js.map +1 -1
- package/dist/interface/registry/ids.d.ts +23 -0
- package/dist/interface/registry/ids.js +42 -0
- package/dist/interface/registry/ids.js.map +1 -1
- package/dist/interface/registry/index.d.ts +3 -3
- package/dist/interface/registry/index.js +3 -3
- package/dist/interface/registry/index.js.map +1 -1
- package/dist/interface/registry/indexes.js +2 -2
- package/dist/interface/registry/indexes.js.map +1 -1
- package/dist/interface/registry/items.d.ts +6 -11
- package/dist/interface/registry/items.js +14 -43
- package/dist/interface/registry/items.js.map +1 -1
- package/dist/interface/registry/layout.d.ts +3 -1
- package/dist/interface/registry/layout.js +7 -1
- package/dist/interface/registry/layout.js.map +1 -1
- package/dist/interface/registry/names.d.ts +13 -5
- package/dist/interface/registry/names.js +55 -38
- package/dist/interface/registry/names.js.map +1 -1
- package/dist/interface/registry/program.js.map +1 -1
- package/dist/interface/registry/reduction.js.map +1 -1
- package/dist/interface/registry/schedule.d.ts +5 -1
- package/dist/interface/registry/schedule.js +8 -13
- package/dist/interface/registry/schedule.js.map +1 -1
- package/dist/interface/registry/schemas.d.ts +9 -0
- package/dist/interface/registry/schemas.js +65 -0
- package/dist/interface/registry/schemas.js.map +1 -1
- package/dist/interface/registry/strata.js +1 -0
- package/dist/interface/registry/strata.js.map +1 -1
- package/dist/interface/registry/threads.js +3 -2
- package/dist/interface/registry/threads.js.map +1 -1
- package/dist/interface/registry/traits.js +2 -1
- package/dist/interface/registry/traits.js.map +1 -1
- package/dist/interface/registry/written.js +1 -0
- package/dist/interface/registry/written.js.map +1 -1
- package/dist/interface/resource/index.d.ts +0 -1
- package/dist/interface/resource/index.js +1 -1
- package/dist/interface/resource/index.js.map +1 -1
- package/dist/interface/resource/resource.js +1 -0
- package/dist/interface/resource/resource.js.map +1 -1
- package/dist/interface/resource/types.d.ts +4 -1
- package/dist/interface/resources/always.js +3 -2
- package/dist/interface/resources/always.js.map +1 -1
- package/dist/interface/resources/cadence.js +4 -3
- package/dist/interface/resources/cadence.js.map +1 -1
- package/dist/interface/resources/clock.js +5 -3
- package/dist/interface/resources/clock.js.map +1 -1
- package/dist/interface/resources/gpu-device.js +3 -2
- package/dist/interface/resources/gpu-device.js.map +1 -1
- package/dist/interface/resources/index.js +1 -0
- package/dist/interface/resources/index.js.map +1 -1
- package/dist/interface/resources/wake.js +3 -2
- package/dist/interface/resources/wake.js.map +1 -1
- package/dist/interface/resources/workers.js +3 -2
- package/dist/interface/resources/workers.js.map +1 -1
- package/dist/interface/rule/create.d.ts +6 -2
- package/dist/interface/rule/create.js +8 -6
- package/dist/interface/rule/create.js.map +1 -1
- package/dist/interface/rule/created.d.ts +3 -3
- package/dist/interface/rule/declaration.d.ts +8 -3
- package/dist/interface/rule/index.js +1 -0
- package/dist/interface/rule/index.js.map +1 -1
- package/dist/interface/rule/rule.js.map +1 -1
- package/dist/interface/schema/is-struct.d.ts +15 -0
- package/dist/interface/schema/schema.d.ts +21 -1
- package/dist/interface/system/access.d.ts +87 -26
- package/dist/interface/system/body.d.ts +53 -26
- package/dist/interface/system/check.d.ts +13 -3
- package/dist/interface/system/check.js +87 -47
- package/dist/interface/system/check.js.map +1 -1
- package/dist/interface/system/commands.d.ts +54 -5
- package/dist/interface/system/composite-declaration.d.ts +0 -2
- package/dist/interface/system/create-resolved.d.ts +9 -0
- package/dist/interface/system/create-resolved.js +18 -0
- package/dist/interface/system/create-resolved.js.map +1 -0
- package/dist/interface/system/create.d.ts +116 -110
- package/dist/interface/system/create.js +34 -8
- package/dist/interface/system/create.js.map +1 -1
- package/dist/interface/system/declaration.d.ts +33 -29
- package/dist/interface/system/index.js.map +1 -1
- package/dist/interface/system/input.d.ts +37 -6
- package/dist/interface/system/leaf.d.ts +10 -3
- package/dist/interface/system/name.d.ts +3 -3
- package/dist/interface/system/property.js +1 -0
- package/dist/interface/system/property.js.map +1 -1
- package/dist/interface/system/render.d.ts +35 -16
- package/dist/interface/system/render.js +19 -5
- package/dist/interface/system/render.js.map +1 -1
- package/dist/interface/system/resolve.d.ts +68 -0
- package/dist/interface/system/resolve.js +138 -0
- package/dist/interface/system/resolve.js.map +1 -0
- package/dist/interface/system/system.d.ts +5 -3
- package/dist/interface/system/system.js.map +1 -1
- package/dist/interface/system/threads.d.ts +8 -7
- package/dist/interface/system/values-of.d.ts +17 -0
- package/dist/interface/system/values-of.js.map +1 -0
- package/dist/interface/system/values.d.ts +12 -12
- package/dist/interface/thread/of.d.ts +4 -2
- package/dist/interface/trait/key.d.ts +1 -1
- package/dist/interface/trait/types.d.ts +23 -5
- package/dist/interface/world/create.d.ts +8 -2
- package/dist/interface/world/declarations.d.ts +37 -0
- package/dist/interface/world/declarations.js +2 -0
- package/dist/interface/world/declarations.js.map +1 -0
- package/dist/interface/world/filter.js +1 -0
- package/dist/interface/world/filter.js.map +1 -1
- package/dist/interface/world/join.d.ts +10 -4
- package/dist/interface/world/world.d.ts +31 -17
- package/package.json +18 -5
- package/src/exports.test.ts +149 -44
- package/src/guide/00-keys.md +34 -0
- package/src/guide/00-keys.out +1 -0
- package/src/guide/00-keys.ts +35 -0
- package/src/guide/00-setup.md +24 -0
- package/src/guide/01-resources.md +22 -0
- package/src/guide/01-resources.out +2 -0
- package/src/guide/01-resources.ts +33 -0
- package/src/guide/02-entities.md +19 -0
- package/src/guide/02-entities.out +2 -0
- package/src/guide/02-entities.ts +43 -0
- package/src/guide/03-systems.md +22 -0
- package/src/guide/03-systems.out +5 -0
- package/src/guide/03-systems.ts +68 -0
- package/src/guide/04-ticks.md +18 -0
- package/src/guide/04-ticks.out +3 -0
- package/src/guide/04-ticks.ts +53 -0
- package/src/guide/05-scheduling.md +14 -0
- package/src/guide/05-scheduling.out +2 -0
- package/src/guide/05-scheduling.ts +46 -0
- package/src/guide/06-sync-points.md +14 -0
- package/src/guide/06-sync-points.out +3 -0
- package/src/guide/06-sync-points.ts +42 -0
- package/src/guide/07-change-filters.md +14 -0
- package/src/guide/07-change-filters.out +6 -0
- package/src/guide/07-change-filters.ts +70 -0
- package/src/guide/08-input.md +12 -0
- package/src/guide/08-input.out +1 -0
- package/src/guide/08-input.ts +45 -0
- package/src/guide/09-rules.md +12 -0
- package/src/guide/09-rules.out +2 -0
- package/src/guide/09-rules.ts +50 -0
- package/src/guide/10-finalizers.md +13 -0
- package/src/guide/10-finalizers.out +4 -0
- package/src/guide/10-finalizers.ts +48 -0
- package/src/guide/11-traits.md +16 -0
- package/src/guide/11-traits.out +2 -0
- package/src/guide/11-traits.ts +51 -0
- package/src/guide/11-traits.type-test.ts +11 -13
- package/src/guide/12-lookups.md +14 -0
- package/src/guide/12-lookups.out +3 -0
- package/src/guide/12-lookups.ts +59 -0
- package/src/guide/13-indexes.md +21 -0
- package/src/guide/13-indexes.out +8 -0
- package/src/guide/13-indexes.ts +73 -0
- package/src/guide/14-kernels.md +15 -0
- package/src/guide/14-kernels.out +1 -0
- package/src/guide/14-kernels.ts +48 -0
- package/src/guide/15-reductions.md +12 -0
- package/src/guide/15-reductions.out +1 -0
- package/src/guide/15-reductions.ts +38 -0
- package/src/guide/16-gpu.md +18 -0
- package/src/guide/16-gpu.out +3 -0
- package/src/guide/16-gpu.ts +51 -0
- package/src/guide/17-hierarchies.md +11 -0
- package/src/guide/17-hierarchies.out +1 -0
- package/src/guide/17-hierarchies.ts +40 -0
- package/src/guide/18-identity.md +10 -0
- package/src/guide/18-identity.out +1 -0
- package/src/guide/18-identity.ts +11 -0
- package/src/guide/19-threads.md +16 -0
- package/src/guide/19-threads.out +2 -0
- package/src/guide/19-threads.ts +65 -0
- package/src/guide/20-shared.md +29 -0
- package/src/guide/20-shared.out +4 -0
- package/src/guide/20-shared.ts +118 -0
- package/src/guide/21-dom.md +22 -0
- package/src/guide/21-dom.out +5 -0
- package/src/guide/21-dom.ts +117 -0
- package/src/guide/22-canvas.md +15 -0
- package/src/guide/22-canvas.out +3 -0
- package/src/guide/22-canvas.ts +119 -0
- package/src/guide/CLAUDE.md +40 -25
- package/src/guide/README.md +42 -0
- package/src/guide/guide.test.ts +215 -0
- package/src/implementation/compiler/access.ts +10 -4
- package/src/implementation/compiler/archetypes.test.ts +64 -0
- package/src/implementation/compiler/archetypes.ts +134 -0
- package/src/implementation/compiler/assign.ts +1 -0
- package/src/implementation/compiler/augmentations.test.ts +418 -0
- package/src/implementation/compiler/augmentations.ts +871 -0
- package/src/implementation/compiler/bind.ts +6 -4
- package/src/implementation/compiler/body-access.ts +135 -33
- package/src/implementation/compiler/booleans.ts +1 -0
- package/src/implementation/compiler/branches.ts +1 -0
- package/src/implementation/compiler/calls.ts +14 -3
- package/src/implementation/compiler/columns.ts +21 -5
- package/src/implementation/compiler/compile-kernel.ts +88 -23
- package/src/implementation/compiler/compiler.ts +9 -0
- package/src/implementation/compiler/data.ts +1 -0
- package/src/implementation/compiler/describe.test-helper.ts +97 -0
- package/src/implementation/compiler/describe.test.ts +168 -0
- package/src/implementation/compiler/describe.ts +489 -0
- package/src/implementation/compiler/estree.ts +1 -0
- package/src/implementation/compiler/expression.ts +24 -2
- package/src/implementation/compiler/failure.ts +1 -0
- package/src/implementation/compiler/hygiene.test.ts +4 -11
- package/src/implementation/compiler/identify.test.ts +100 -46
- package/src/implementation/compiler/identify.ts +89 -32
- package/src/implementation/compiler/index.ts +6 -1
- package/src/implementation/compiler/inferred.test.ts +32 -0
- package/src/implementation/compiler/inferred.ts +197 -0
- package/src/implementation/compiler/inline-kernels.test.ts +10 -0
- package/src/implementation/compiler/inline-kernels.ts +21 -0
- package/src/implementation/compiler/input-schemas.test.ts +182 -0
- package/src/implementation/compiler/input-schemas.ts +107 -0
- package/src/implementation/compiler/ir.ts +7 -2
- package/src/implementation/compiler/kernel-id.ts +1 -0
- package/src/implementation/compiler/key.ts +1 -0
- package/src/implementation/compiler/link.test.ts +3 -0
- package/src/implementation/compiler/link.ts +29 -0
- package/src/implementation/compiler/lists.ts +41 -13
- package/src/implementation/compiler/lookups.ts +1 -0
- package/src/implementation/compiler/math.ts +1 -0
- package/src/implementation/compiler/memory-compiler.browser.test.ts +85 -0
- package/src/implementation/compiler/memory-compiler.test.ts +147 -0
- package/src/implementation/compiler/memory-compiler.ts +307 -0
- package/src/implementation/compiler/module-scope.ts +1 -0
- package/src/implementation/compiler/module-value.ts +18 -3
- package/src/implementation/compiler/out.ts +1 -0
- package/src/implementation/compiler/oxc.test-helper.ts +20 -0
- package/src/implementation/compiler/oxc.test.ts +69 -0
- package/src/implementation/compiler/oxc.ts +90 -0
- package/src/implementation/compiler/package-copies.ts +208 -0
- package/src/implementation/compiler/passes.ts +34 -0
- package/src/implementation/compiler/paths.ts +19 -38
- package/src/implementation/compiler/plugin.test.ts +373 -62
- package/src/implementation/compiler/plugin.ts +199 -38
- package/src/implementation/compiler/posix.test.ts +34 -0
- package/src/implementation/compiler/posix.ts +183 -0
- package/src/implementation/compiler/predicates.test.ts +90 -0
- package/src/implementation/compiler/predicates.ts +250 -0
- package/src/implementation/compiler/print.ts +26 -6
- package/src/implementation/compiler/program.ts +4 -1
- package/src/implementation/compiler/public.ts +2 -0
- package/src/implementation/compiler/scalar.ts +1 -0
- package/src/implementation/compiler/scope.ts +1 -0
- package/src/implementation/compiler/serialize.ts +1 -0
- package/src/implementation/compiler/shared-kernels.test.ts +57 -0
- package/src/implementation/compiler/signature.ts +70 -30
- package/src/implementation/compiler/snapshot.ts +5 -2
- package/src/implementation/compiler/source-map.test.ts +1 -0
- package/src/implementation/compiler/source-map.ts +1 -0
- package/src/implementation/compiler/spawns.ts +62 -5
- package/src/implementation/compiler/stamps.ts +30 -8
- package/src/implementation/compiler/statement.ts +1 -0
- package/src/implementation/compiler/subset.md +4 -3
- package/src/implementation/compiler/terminal.ts +1 -0
- package/src/implementation/compiler/transform.test.ts +371 -258
- package/src/implementation/compiler/transform.ts +321 -62
- package/src/implementation/compiler/type-host.test-helper.ts +27 -0
- package/src/implementation/compiler/type-schemas.ts +714 -0
- package/src/implementation/compiler/unit.ts +22 -4
- package/src/implementation/compiler/value.ts +1 -0
- package/src/implementation/compiler/wat.test.ts +135 -0
- package/src/implementation/compiler/wat.ts +365 -0
- package/src/implementation/index.ts +1 -0
- package/src/implementation/world/activate.ts +10 -3
- package/src/implementation/world/archetype.ts +133 -19
- package/src/implementation/world/arrays.test.ts +1 -0
- package/src/implementation/world/arrays.ts +6 -1
- package/src/implementation/world/arrivals.test.ts +89 -0
- package/src/implementation/world/arrivals.ts +165 -0
- package/src/implementation/world/async-loading.test.ts +13 -28
- package/src/implementation/world/attach-kernel.test.ts +10 -2
- package/src/implementation/world/attach-kernel.ts +14 -7
- package/src/implementation/world/batches.test.ts +14 -17
- package/src/implementation/world/batches.ts +67 -8
- package/src/implementation/world/buffer.ts +35 -4
- package/src/implementation/world/builtins.test.ts +5 -10
- package/src/implementation/world/cascade.ts +2 -1
- package/src/implementation/world/cells.ts +1 -0
- package/src/implementation/world/change-blocks.browser.test.ts +76 -0
- package/src/implementation/world/change-blocks.cases.ts +14 -0
- package/src/implementation/world/change-blocks.fixture.ts +70 -0
- package/src/implementation/world/change-blocks.test.ts +264 -0
- package/src/implementation/world/changes-finalizers.test.ts +6 -8
- package/src/implementation/world/check-kernel.ts +46 -32
- package/src/implementation/world/claims.test.ts +1 -0
- package/src/implementation/world/claims.ts +1 -0
- package/src/implementation/world/closure.test.ts +1 -0
- package/src/implementation/world/closure.ts +1 -0
- package/src/implementation/world/command-ring.ts +2 -1
- package/src/implementation/world/command-rings.cases.ts +5 -2
- package/src/implementation/world/command-rings.fixture.ts +27 -36
- package/src/implementation/world/commands.test.ts +84 -43
- package/src/implementation/world/commands.ts +26 -4
- package/src/implementation/world/composite-input.test.ts +17 -15
- package/src/implementation/world/conditions.test.ts +17 -28
- package/src/implementation/world/constant-unions.test.ts +43 -0
- package/src/implementation/world/create.test.ts +50 -71
- package/src/implementation/world/create.ts +486 -250
- package/src/implementation/world/defaults.test.ts +86 -0
- package/src/implementation/world/directories.ts +2 -1
- package/src/implementation/world/directory.test.ts +2 -3
- package/src/implementation/world/dispatch.cases.ts +1 -0
- package/src/implementation/world/dispatch.fixture.ts +16 -25
- package/src/implementation/world/entities.ts +1 -0
- package/src/implementation/world/entity-lookup-workers.cases.ts +1 -0
- package/src/implementation/world/entity-lookup-workers.fixture.ts +9 -16
- package/src/implementation/world/entity-lookups.browser.test.ts +8 -14
- package/src/implementation/world/entity-lookups.test-helper.ts +28 -34
- package/src/implementation/world/entity-lookups.test.ts +9 -16
- package/src/implementation/world/execute.ts +232 -96
- package/src/implementation/world/failing-worker.fixture.ts +3 -0
- package/src/implementation/world/failures.ts +64 -7
- package/src/implementation/world/finalizers.test.ts +33 -49
- package/src/implementation/world/finalizers.ts +46 -14
- package/src/implementation/world/fixtures.test-helper.ts +1 -0
- package/src/implementation/world/generated-code.md +10 -6
- package/src/implementation/world/gpu.browser.test.ts +100 -92
- package/src/implementation/world/gpu.test-helper.ts +12 -0
- package/src/implementation/world/gpu.ts +26 -14
- package/src/implementation/world/holders.ts +1 -0
- package/src/implementation/world/ids-changes.test-helper.ts +4 -0
- package/src/implementation/world/ids-keys.test-helper.ts +21 -0
- package/src/implementation/world/ids.test.ts +12 -49
- package/src/implementation/world/imported-lists.test-helper.ts +2 -6
- package/src/implementation/world/imported-lists.test.ts +4 -5
- package/src/implementation/world/index-buckets.test.ts +276 -0
- package/src/implementation/world/index-build-csp.test.ts +8 -9
- package/src/implementation/world/index-build.cases.ts +1 -0
- package/src/implementation/world/index-build.fixture.ts +12 -15
- package/src/implementation/world/index-build.ts +1 -0
- package/src/implementation/world/index-changed.test.ts +27 -34
- package/src/implementation/world/index-hash.test.ts +34 -0
- package/src/implementation/world/index-hash.ts +454 -74
- package/src/implementation/world/index-joined.test.ts +232 -74
- package/src/implementation/world/index-kernels.test.ts +26 -35
- package/src/implementation/world/index-keyless.test.ts +21 -28
- package/src/implementation/world/index-keys.ts +1 -0
- package/src/implementation/world/index-lookups-csp.test.ts +5 -6
- package/src/implementation/world/index-lookups.ts +28 -22
- package/src/implementation/world/index-order.test.ts +13 -17
- package/src/implementation/world/index-order.ts +1 -0
- package/src/implementation/world/index-readers.ts +1 -0
- package/src/implementation/world/index-sorted.test.ts +1 -0
- package/src/implementation/world/index-sorted.ts +10 -5
- package/src/implementation/world/index-workers.cases.ts +10 -0
- package/src/implementation/world/index-workers.fixture.ts +98 -39
- package/src/implementation/world/indexes.test.ts +62 -74
- package/src/implementation/world/indexes.ts +62 -108
- package/src/implementation/world/input.ts +2 -1
- package/src/implementation/world/intrinsics-coverage.test.ts +1 -0
- package/src/implementation/world/intrinsics.browser.test.ts +22 -62
- package/src/implementation/world/intrinsics.ts +1 -0
- package/src/implementation/world/join.test.ts +182 -43
- package/src/implementation/world/join.ts +112 -59
- package/src/implementation/world/join.type-test.ts +7 -5
- package/src/implementation/world/joined-observer.test.ts +58 -0
- package/src/implementation/world/joined-observer.ts +85 -19
- package/src/implementation/world/joining-worker.fixture.ts +51 -11
- package/src/implementation/world/joining.cases.ts +43 -7
- package/src/implementation/world/joining.fixture.ts +114 -14
- package/src/implementation/world/joining.test-helper.ts +25 -27
- package/src/implementation/world/joining.ts +85 -7
- package/src/implementation/world/journal.ts +8 -4
- package/src/implementation/world/kernel-imports-sparks.test-helper.ts +3 -4
- package/src/implementation/world/kernel-imports-steer.test-helper.ts +1 -0
- package/src/implementation/world/kernel-imports.test.ts +10 -12
- package/src/implementation/world/kernel-indexes.ts +12 -3
- package/src/implementation/world/kernel-lookup.test-helper.ts +6 -10
- package/src/implementation/world/kernel-path.test-helper.ts +2 -4
- package/src/implementation/world/kernel-spawns.test.ts +17 -28
- package/src/implementation/world/kernel-tried.test-helper.ts +31 -0
- package/src/implementation/world/kernel.ts +30 -6
- package/src/implementation/world/kernels-csp.test.ts +5 -5
- package/src/implementation/world/kernels.test.ts +18 -14
- package/src/implementation/world/kernels.ts +82 -13
- package/src/implementation/world/layout-directory.browser.test.ts +18 -28
- package/src/implementation/world/layout-directory.cases.ts +1 -0
- package/src/implementation/world/layout-directory.fixture.ts +18 -28
- package/src/implementation/world/layout-directory.ts +69 -17
- package/src/implementation/world/lifetime.cases.ts +2 -1
- package/src/implementation/world/lifetime.fixture.ts +12 -21
- package/src/implementation/world/lifetime.test-helper.ts +2 -1
- package/src/implementation/world/lifetime.test.ts +7 -14
- package/src/implementation/world/lists.ts +179 -28
- package/src/implementation/world/lookup-keys.ts +10 -9
- package/src/implementation/world/loop.test.ts +19 -8
- package/src/implementation/world/loop.ts +4 -4
- package/src/implementation/world/memory.test.ts +1 -0
- package/src/implementation/world/memory.ts +1 -0
- package/src/implementation/world/mirror.ts +45 -10
- package/src/implementation/world/move-log.test.ts +114 -11
- package/src/implementation/world/move-log.ts +1 -0
- package/src/implementation/world/names.test.ts +31 -31
- package/src/implementation/world/observe-cases.browser.test.ts +11 -11
- package/src/implementation/world/observe-cases.test.ts +49 -95
- package/src/implementation/world/observe-factories.test.ts +17 -19
- package/src/implementation/world/observe-joined-cases.test.ts +34 -45
- package/src/implementation/world/observe-ticks-cases.test.ts +33 -35
- package/src/implementation/world/observe.test-helper.ts +2 -1
- package/src/implementation/world/observed-workers.cases.ts +1 -0
- package/src/implementation/world/observed-workers.fixture.ts +7 -8
- package/src/implementation/world/observer-contained-worker.fixture.ts +4 -3
- package/src/implementation/world/observer-contained.browser.test.ts +1 -0
- package/src/implementation/world/observer-contained.cases.ts +1 -0
- package/src/implementation/world/observer-contained.fixture.ts +3 -7
- package/src/implementation/world/observer-contained.test-helper.ts +7 -8
- package/src/implementation/world/observer-contained.test.ts +11 -19
- package/src/implementation/world/observer-joined-worker.fixture.ts +2 -1
- package/src/implementation/world/observer-joined.cases.ts +1 -0
- package/src/implementation/world/observer-joined.fixture.ts +8 -6
- package/src/implementation/world/observer-joined.test-helper.ts +25 -34
- package/src/implementation/world/observer-joined.test.ts +78 -62
- package/src/implementation/world/observer.browser.test.ts +13 -13
- package/src/implementation/world/observer.test.ts +34 -44
- package/src/implementation/world/observer.ts +3 -3
- package/src/implementation/world/optional-workers.cases.ts +19 -0
- package/src/implementation/world/optional-workers.fixture.ts +55 -0
- package/src/implementation/world/optional.test.ts +351 -0
- package/src/implementation/world/order.ts +1 -0
- package/src/implementation/world/out-of-band.ts +61 -0
- package/src/implementation/world/outcomes.test-helper.ts +138 -0
- package/src/implementation/world/package-id.test-helper.ts +9 -0
- package/src/implementation/world/perf.md +124 -4
- package/src/implementation/world/plan.ts +1 -0
- package/src/implementation/world/platforms.test-helper.ts +1 -0
- package/src/implementation/world/pool-size.cases.ts +18 -0
- package/src/implementation/world/pool-size.fixture.ts +98 -6
- package/src/implementation/world/pool.cases.ts +1 -0
- package/src/implementation/world/pool.fixture.ts +1 -0
- package/src/implementation/world/pool.ts +1 -0
- package/src/implementation/world/port.test.ts +45 -0
- package/src/implementation/world/port.ts +18 -11
- package/src/implementation/world/ports.cases.ts +2 -2
- package/src/implementation/world/ports.fixture.ts +4 -5
- package/src/implementation/world/ports.type-test.ts +1 -0
- package/src/implementation/world/precision.test.ts +174 -0
- package/src/implementation/world/prepared-lookup.ts +1 -0
- package/src/implementation/world/prepared-spawn.ts +14 -10
- package/src/implementation/world/program.ts +1 -0
- package/src/implementation/world/protocol.ts +9 -2
- package/src/implementation/world/publish.ts +1 -0
- package/src/implementation/world/ranges.test.ts +66 -0
- package/src/implementation/world/ranges.ts +98 -32
- package/src/implementation/world/reads.test-helper.ts +1 -0
- package/src/implementation/world/reclaim.test.ts +214 -0
- package/src/implementation/world/reclaim.ts +170 -0
- package/src/implementation/world/reductions.cases.ts +1 -0
- package/src/implementation/world/reductions.fixture.ts +5 -10
- package/src/implementation/world/reductions.test.ts +36 -49
- package/src/implementation/world/reductions.ts +14 -12
- package/src/implementation/world/reevaluation.test-helper.ts +3 -3
- package/src/implementation/world/reevaluation.test.ts +9 -8
- package/src/implementation/world/register.ts +3 -2
- package/src/implementation/world/remote-finalizers-worker.fixture.ts +25 -10
- package/src/implementation/world/remote-finalizers.cases.ts +19 -1
- package/src/implementation/world/remote-finalizers.fixture.ts +86 -11
- package/src/implementation/world/remote-finalizers.test-helper.ts +119 -27
- package/src/implementation/world/remote-finalizers.test.ts +86 -20
- package/src/implementation/world/remote-objects-worker.fixture.ts +2 -1
- package/src/implementation/world/remote-objects.cases.ts +1 -0
- package/src/implementation/world/remote-objects.fixture.ts +3 -1
- package/src/implementation/world/remote-objects.test-helper.ts +9 -10
- package/src/implementation/world/remote-systems.ts +42 -28
- package/src/implementation/world/remote.test.ts +46 -48
- package/src/implementation/world/remote.ts +1 -0
- package/src/implementation/world/removal-worker.fixture.ts +3 -2
- package/src/implementation/world/removal.cases.ts +1 -0
- package/src/implementation/world/removal.fixture.ts +3 -2
- package/src/implementation/world/remove-joined.test.ts +4 -3
- package/src/implementation/world/remove.test-helper.ts +11 -13
- package/src/implementation/world/remove.test.ts +14 -17
- package/src/implementation/world/render-order.browser.test.ts +209 -0
- package/src/implementation/world/render-order.ts +150 -0
- package/src/implementation/world/required.ts +10 -0
- package/src/implementation/world/resources.ts +7 -3
- package/src/implementation/world/rows.test.ts +8 -11
- package/src/implementation/world/rows.ts +99 -30
- package/src/implementation/world/rules.test.ts +38 -39
- package/src/implementation/world/run-results.test.ts +374 -0
- package/src/implementation/world/runner.ts +379 -73
- package/src/implementation/world/schedule.test.ts +65 -67
- package/src/implementation/world/semantics.test.ts +11 -16
- package/src/implementation/world/share.test.ts +4 -3
- package/src/implementation/world/shared-gpu.browser.test.ts +109 -0
- package/src/implementation/world/shared-kernels.test.ts +117 -0
- package/src/implementation/world/shared-workers.cases.ts +20 -0
- package/src/implementation/world/shared-workers.fixture.ts +74 -0
- package/src/implementation/world/shared.test.ts +348 -0
- package/src/implementation/world/shared.ts +316 -0
- package/src/implementation/world/sharing.ts +96 -32
- package/src/implementation/world/staging.ts +53 -10
- package/src/implementation/world/state.ts +180 -23
- package/src/implementation/world/stop-lists.ts +78 -9
- package/src/implementation/world/strings.test.ts +23 -34
- package/src/implementation/world/strings.ts +1 -0
- package/src/implementation/world/structure.ts +6 -2
- package/src/implementation/world/synchronize.test.ts +1 -0
- package/src/implementation/world/synchronize.ts +60 -17
- package/src/implementation/world/tail-blocks.ts +9 -4
- package/src/implementation/world/tails-worker.fixture.ts +9 -13
- package/src/implementation/world/tails.cases.ts +3 -2
- package/src/implementation/world/tails.fixture.ts +5 -2
- package/src/implementation/world/tails.test-helper.ts +48 -41
- package/src/implementation/world/tails.test.ts +24 -29
- package/src/implementation/world/tails.ts +35 -22
- package/src/implementation/world/target.test.ts +10 -13
- package/src/implementation/world/terminal.ts +1 -0
- package/src/implementation/world/thread-directory.ts +85 -16
- package/src/implementation/world/thread-finalizers.ts +128 -22
- package/src/implementation/world/thread-indexes.ts +5 -3
- package/src/implementation/world/thread-observer.ts +60 -13
- package/src/implementation/world/thread-systems-worker.fixture.ts +5 -6
- package/src/implementation/world/thread-systems.cases.ts +15 -2
- package/src/implementation/world/thread-systems.fixture.ts +41 -12
- package/src/implementation/world/thread-systems.test-helper.ts +57 -52
- package/src/implementation/world/thread-systems.test.ts +51 -26
- package/src/implementation/world/thread-systems.ts +398 -84
- package/src/implementation/world/thread-tasks.ts +9 -4
- package/src/implementation/world/threads.browser.test.ts +5 -0
- package/src/implementation/world/threads.test.ts +10 -0
- package/src/implementation/world/ticks.browser.test.ts +3 -4
- package/src/implementation/world/ticks.test.ts +5 -5
- package/src/implementation/world/traits.test.ts +4 -8
- package/src/implementation/world/transfers-worker.fixture.ts +17 -12
- package/src/implementation/world/transfers.cases.ts +1 -0
- package/src/implementation/world/transfers.fixture.ts +18 -25
- package/src/implementation/world/transfers.test-helper.ts +18 -28
- package/src/implementation/world/transfers.test.ts +19 -23
- package/src/implementation/world/transfers.ts +1 -0
- package/src/implementation/world/unidentified-finalizers.test.ts +58 -0
- package/src/implementation/world/up-tree.test.ts +181 -21
- package/src/implementation/world/up-workers.cases.ts +1 -0
- package/src/implementation/world/up-workers.fixture.ts +6 -10
- package/src/implementation/world/up.browser.test.ts +9 -12
- package/src/implementation/world/up.test.ts +56 -42
- package/src/implementation/world/up.ts +299 -71
- package/src/implementation/world/wasm-kernels.test.ts +55 -49
- package/src/implementation/world/wasm.test.ts +200 -22
- package/src/implementation/world/wasm.ts +399 -127
- package/src/implementation/world/wgsl.test.ts +1 -0
- package/src/implementation/world/wgsl.ts +22 -5
- package/src/implementation/world/where.test.ts +342 -0
- package/src/implementation/world/where.ts +236 -0
- package/src/implementation/world/worker-platform.ts +1 -0
- package/src/implementation/world/worker-window.test.ts +43 -0
- package/src/implementation/world/worker-window.ts +43 -0
- package/src/implementation/world/worker.ts +47 -59
- package/src/implementation/world/workers-follow.test.ts +51 -0
- package/src/implementation/world/workers.cases.ts +1 -0
- package/src/implementation/world/workers.fixture.ts +31 -54
- package/src/implementation/world/world-host.fixture.ts +1 -0
- package/src/index.ts +5 -0
- package/src/interface/CLAUDE.md +1 -1
- package/src/interface/component/component.ts +1 -0
- package/src/interface/component/index.ts +1 -1
- package/src/interface/component/key.ts +1 -0
- package/src/interface/component/key.type-test.ts +1 -2
- package/src/interface/component/register.test.ts +27 -34
- package/src/interface/component/types.ts +3 -2
- package/src/interface/component/value.ts +9 -2
- package/src/interface/component/values.ts +1 -0
- package/src/interface/entity/entity.ts +1 -0
- package/src/interface/entity/index.ts +4 -0
- package/src/interface/finalizer/body.ts +12 -11
- package/src/interface/finalizer/create.test.ts +67 -72
- package/src/interface/finalizer/create.ts +52 -22
- package/src/interface/finalizer/created.ts +6 -5
- package/src/interface/finalizer/declaration.ts +28 -9
- package/src/interface/finalizer/finalizer.ts +3 -2
- package/src/interface/finalizer/index.ts +1 -0
- package/src/interface/gpu/accessors.ts +26 -8
- package/src/interface/gpu/gpu.ts +1 -0
- package/src/interface/gpu/gpu.type-test.ts +2 -2
- package/src/interface/gpu/index.ts +1 -0
- package/src/interface/gpu/layout.ts +1 -0
- package/src/interface/gpu/record.ts +1 -0
- package/src/interface/gpu/wgsl.ts +9 -6
- package/src/interface/index.ts +1 -3
- package/src/interface/index.type-test.ts +11 -14
- package/src/interface/indexes/create.test.ts +44 -43
- package/src/interface/indexes/create.ts +24 -16
- package/src/interface/indexes/created.ts +3 -2
- package/src/interface/indexes/declaration.ts +7 -3
- package/src/interface/indexes/index-type.ts +4 -3
- package/src/interface/indexes/index.ts +1 -0
- package/src/interface/indexes/index.type-test.ts +45 -94
- package/src/interface/math/f32/default.ts +6 -0
- package/src/interface/math/f32/index.ts +5 -1
- package/src/interface/math/f32/public.ts +2 -0
- package/src/interface/math/f32/round-half-even.ts +1 -0
- package/src/interface/math/f32/schema.ts +1 -0
- package/src/interface/math/i32/default.ts +6 -0
- package/src/interface/math/i32/index.ts +5 -1
- package/src/interface/math/i32/public.ts +2 -0
- package/src/interface/math/i32/schema.ts +1 -0
- package/src/interface/math/i32/shift-right.ts +1 -0
- package/src/interface/math/index.ts +1 -0
- package/src/interface/math/intrinsic.ts +1 -0
- package/src/interface/math/mat4x4/add.ts +1 -0
- package/src/interface/math/mat4x4/determinant.ts +1 -0
- package/src/interface/math/mat4x4/identity.ts +1 -0
- package/src/interface/math/mat4x4/index.ts +4 -1
- package/src/interface/math/mat4x4/inverse.ts +1 -0
- package/src/interface/math/mat4x4/look-at.test.ts +1 -0
- package/src/interface/math/mat4x4/look-at.ts +1 -0
- package/src/interface/math/mat4x4/multiply-vec3.ts +1 -0
- package/src/interface/math/mat4x4/multiply-vec4.ts +1 -0
- package/src/interface/math/mat4x4/multiply.ts +1 -0
- package/src/interface/math/mat4x4/orthographic.ts +1 -0
- package/src/interface/math/mat4x4/perspective.ts +1 -0
- package/src/interface/math/mat4x4/public.ts +2 -0
- package/src/interface/math/mat4x4/rotation-x.ts +1 -0
- package/src/interface/math/mat4x4/rotation-y.ts +1 -0
- package/src/interface/math/mat4x4/rotation-z.ts +1 -0
- package/src/interface/math/mat4x4/rotation.test.ts +1 -0
- package/src/interface/math/mat4x4/scale.ts +1 -0
- package/src/interface/math/mat4x4/scaling.ts +1 -0
- package/src/interface/math/mat4x4/schema.ts +1 -0
- package/src/interface/math/mat4x4/subtract.ts +1 -0
- package/src/interface/math/mat4x4/translation.ts +1 -0
- package/src/interface/math/mat4x4/transpose.ts +1 -0
- package/src/interface/math/mat4x4/zero.ts +1 -0
- package/src/interface/math/math.type-test.ts +24 -1
- package/src/interface/math/quat/add.ts +1 -0
- package/src/interface/math/quat/align-to.ts +1 -0
- package/src/interface/math/quat/conjugate.ts +1 -0
- package/src/interface/math/quat/distance.ts +1 -0
- package/src/interface/math/quat/dot.ts +1 -0
- package/src/interface/math/quat/from-axis-angle.ts +1 -0
- package/src/interface/math/quat/from-euler.ts +1 -0
- package/src/interface/math/quat/identity.ts +1 -0
- package/src/interface/math/quat/index.ts +5 -1
- package/src/interface/math/quat/inverse.ts +1 -0
- package/src/interface/math/quat/length-squared.ts +1 -0
- package/src/interface/math/quat/length.ts +1 -0
- package/src/interface/math/quat/lerp.ts +1 -0
- package/src/interface/math/quat/look-at.ts +1 -0
- package/src/interface/math/quat/multiply.ts +1 -0
- package/src/interface/math/quat/negate.ts +1 -0
- package/src/interface/math/quat/normalize.ts +1 -0
- package/src/interface/math/quat/public.ts +2 -0
- package/src/interface/math/quat/rotate-vec3.ts +1 -0
- package/src/interface/math/quat/scale.ts +1 -0
- package/src/interface/math/quat/schema.ts +1 -0
- package/src/interface/math/quat/slerp.ts +1 -0
- package/src/interface/math/quat/subtract.ts +1 -0
- package/src/interface/math/quat/to-axis-angle.ts +1 -0
- package/src/interface/math/quat/to-euler.ts +1 -0
- package/src/interface/math/quat/to-mat4.ts +1 -0
- package/src/interface/math/semantics.test.ts +1 -0
- package/src/interface/math/u32/count-leading-zeros.ts +1 -0
- package/src/interface/math/u32/count-one-bits.ts +1 -0
- package/src/interface/math/u32/count-trailing-zeros.ts +1 -0
- package/src/interface/math/u32/default.ts +6 -0
- package/src/interface/math/u32/index.ts +5 -1
- package/src/interface/math/u32/public.ts +2 -0
- package/src/interface/math/u32/reverse-bits.ts +1 -0
- package/src/interface/math/u32/schema.ts +1 -0
- package/src/interface/math/u32/shift-right.ts +1 -0
- package/src/interface/math/vec2/f32/abs.ts +1 -0
- package/src/interface/math/vec2/f32/acos.ts +1 -0
- package/src/interface/math/vec2/f32/acosh.ts +1 -0
- package/src/interface/math/vec2/f32/add.ts +1 -0
- package/src/interface/math/vec2/f32/asin.ts +1 -0
- package/src/interface/math/vec2/f32/asinh.ts +1 -0
- package/src/interface/math/vec2/f32/atan.ts +1 -0
- package/src/interface/math/vec2/f32/atanh.ts +1 -0
- package/src/interface/math/vec2/f32/ceil.ts +1 -0
- package/src/interface/math/vec2/f32/clamp.ts +1 -0
- package/src/interface/math/vec2/f32/cos.ts +1 -0
- package/src/interface/math/vec2/f32/cosh.ts +1 -0
- package/src/interface/math/vec2/f32/distance.ts +1 -0
- package/src/interface/math/vec2/f32/dot.ts +1 -0
- package/src/interface/math/vec2/f32/equals.ts +1 -0
- package/src/interface/math/vec2/f32/exp.ts +1 -0
- package/src/interface/math/vec2/f32/exp2.ts +1 -0
- package/src/interface/math/vec2/f32/f32.ts +5 -1
- package/src/interface/math/vec2/f32/faceforward.ts +1 -0
- package/src/interface/math/vec2/f32/floor.ts +1 -0
- package/src/interface/math/vec2/f32/fract.ts +1 -0
- package/src/interface/math/vec2/f32/length.ts +1 -0
- package/src/interface/math/vec2/f32/log.ts +1 -0
- package/src/interface/math/vec2/f32/log2.ts +1 -0
- package/src/interface/math/vec2/f32/max.ts +1 -0
- package/src/interface/math/vec2/f32/min.ts +1 -0
- package/src/interface/math/vec2/f32/mix.ts +1 -0
- package/src/interface/math/vec2/f32/mod.ts +1 -0
- package/src/interface/math/vec2/f32/modf.ts +1 -0
- package/src/interface/math/vec2/f32/negate.ts +1 -0
- package/src/interface/math/vec2/f32/normalize.ts +1 -0
- package/src/interface/math/vec2/f32/pow.ts +1 -0
- package/src/interface/math/vec2/f32/public.ts +2 -0
- package/src/interface/math/vec2/f32/reflect.ts +1 -0
- package/src/interface/math/vec2/f32/refract.ts +1 -0
- package/src/interface/math/vec2/f32/round.ts +1 -0
- package/src/interface/math/vec2/f32/scale.ts +1 -0
- package/src/interface/math/vec2/f32/schema.ts +1 -0
- package/src/interface/math/vec2/f32/sign.ts +1 -0
- package/src/interface/math/vec2/f32/sin.ts +1 -0
- package/src/interface/math/vec2/f32/sinh.ts +1 -0
- package/src/interface/math/vec2/f32/smoothstep.ts +1 -0
- package/src/interface/math/vec2/f32/sqrt.ts +1 -0
- package/src/interface/math/vec2/f32/step.ts +1 -0
- package/src/interface/math/vec2/f32/subtract.ts +1 -0
- package/src/interface/math/vec2/f32/tan.ts +1 -0
- package/src/interface/math/vec2/f32/tanh.ts +1 -0
- package/src/interface/math/vec2/f32/trunc.ts +1 -0
- package/src/interface/math/vec2/f32/zero.ts +1 -0
- package/src/interface/math/vec2/i32/abs.ts +1 -0
- package/src/interface/math/vec2/i32/add.ts +1 -0
- package/src/interface/math/vec2/i32/bitwise-and.ts +1 -0
- package/src/interface/math/vec2/i32/bitwise-not.ts +1 -0
- package/src/interface/math/vec2/i32/bitwise-or.ts +1 -0
- package/src/interface/math/vec2/i32/bitwise-xor.ts +1 -0
- package/src/interface/math/vec2/i32/clamp.ts +1 -0
- package/src/interface/math/vec2/i32/count-leading-zeros.ts +1 -0
- package/src/interface/math/vec2/i32/count-one-bits.ts +1 -0
- package/src/interface/math/vec2/i32/count-trailing-zeros.ts +1 -0
- package/src/interface/math/vec2/i32/equals.ts +1 -0
- package/src/interface/math/vec2/i32/i32.ts +5 -1
- package/src/interface/math/vec2/i32/max.ts +1 -0
- package/src/interface/math/vec2/i32/min.ts +1 -0
- package/src/interface/math/vec2/i32/negate.ts +1 -0
- package/src/interface/math/vec2/i32/public.ts +2 -0
- package/src/interface/math/vec2/i32/reverse-bits.ts +1 -0
- package/src/interface/math/vec2/i32/scale.ts +1 -0
- package/src/interface/math/vec2/i32/schema.ts +1 -0
- package/src/interface/math/vec2/i32/shift-left.ts +1 -0
- package/src/interface/math/vec2/i32/shift-right.ts +1 -0
- package/src/interface/math/vec2/i32/subtract.ts +1 -0
- package/src/interface/math/vec2/i32/zero.ts +1 -0
- package/src/interface/math/vec2/index.ts +1 -0
- package/src/interface/math/vec2/public.ts +2 -0
- package/src/interface/math/vec2/u32/add.ts +1 -0
- package/src/interface/math/vec2/u32/bitwise-and.ts +1 -0
- package/src/interface/math/vec2/u32/bitwise-not.ts +1 -0
- package/src/interface/math/vec2/u32/bitwise-or.ts +1 -0
- package/src/interface/math/vec2/u32/bitwise-xor.ts +1 -0
- package/src/interface/math/vec2/u32/clamp.ts +1 -0
- package/src/interface/math/vec2/u32/count-leading-zeros.ts +1 -0
- package/src/interface/math/vec2/u32/count-one-bits.ts +1 -0
- package/src/interface/math/vec2/u32/count-trailing-zeros.ts +1 -0
- package/src/interface/math/vec2/u32/equals.ts +1 -0
- package/src/interface/math/vec2/u32/max.ts +1 -0
- package/src/interface/math/vec2/u32/min.ts +1 -0
- package/src/interface/math/vec2/u32/negate.ts +1 -0
- package/src/interface/math/vec2/u32/public.ts +2 -0
- package/src/interface/math/vec2/u32/reverse-bits.ts +1 -0
- package/src/interface/math/vec2/u32/scale.ts +1 -0
- package/src/interface/math/vec2/u32/schema.ts +1 -0
- package/src/interface/math/vec2/u32/shift-left.ts +1 -0
- package/src/interface/math/vec2/u32/shift-right.ts +1 -0
- package/src/interface/math/vec2/u32/subtract.ts +1 -0
- package/src/interface/math/vec2/u32/u32.ts +5 -1
- package/src/interface/math/vec2/u32/zero.ts +1 -0
- package/src/interface/math/vec3/f32/abs.ts +1 -0
- package/src/interface/math/vec3/f32/acos.ts +1 -0
- package/src/interface/math/vec3/f32/acosh.ts +1 -0
- package/src/interface/math/vec3/f32/add.ts +1 -0
- package/src/interface/math/vec3/f32/asin.ts +1 -0
- package/src/interface/math/vec3/f32/asinh.ts +1 -0
- package/src/interface/math/vec3/f32/atan.ts +1 -0
- package/src/interface/math/vec3/f32/atanh.ts +1 -0
- package/src/interface/math/vec3/f32/ceil.ts +1 -0
- package/src/interface/math/vec3/f32/clamp.ts +1 -0
- package/src/interface/math/vec3/f32/cos.ts +1 -0
- package/src/interface/math/vec3/f32/cosh.ts +1 -0
- package/src/interface/math/vec3/f32/cross.ts +1 -0
- package/src/interface/math/vec3/f32/distance-squared.ts +1 -0
- package/src/interface/math/vec3/f32/distance.ts +1 -0
- package/src/interface/math/vec3/f32/dot.ts +1 -0
- package/src/interface/math/vec3/f32/equals.ts +1 -0
- package/src/interface/math/vec3/f32/exp.ts +1 -0
- package/src/interface/math/vec3/f32/exp2.ts +1 -0
- package/src/interface/math/vec3/f32/f32.ts +5 -1
- package/src/interface/math/vec3/f32/faceforward.ts +1 -0
- package/src/interface/math/vec3/f32/floor.ts +1 -0
- package/src/interface/math/vec3/f32/fract.ts +1 -0
- package/src/interface/math/vec3/f32/length-squared.ts +1 -0
- package/src/interface/math/vec3/f32/length.ts +1 -0
- package/src/interface/math/vec3/f32/log.ts +1 -0
- package/src/interface/math/vec3/f32/log2.ts +1 -0
- package/src/interface/math/vec3/f32/max.ts +1 -0
- package/src/interface/math/vec3/f32/min.ts +1 -0
- package/src/interface/math/vec3/f32/mix.ts +1 -0
- package/src/interface/math/vec3/f32/mod.ts +1 -0
- package/src/interface/math/vec3/f32/modf.ts +1 -0
- package/src/interface/math/vec3/f32/multiply.ts +1 -0
- package/src/interface/math/vec3/f32/negate.ts +1 -0
- package/src/interface/math/vec3/f32/normalize.ts +1 -0
- package/src/interface/math/vec3/f32/one.ts +1 -0
- package/src/interface/math/vec3/f32/pow.ts +1 -0
- package/src/interface/math/vec3/f32/public.ts +2 -0
- package/src/interface/math/vec3/f32/random.ts +1 -0
- package/src/interface/math/vec3/f32/reflect.ts +1 -0
- package/src/interface/math/vec3/f32/refract.ts +1 -0
- package/src/interface/math/vec3/f32/round.ts +1 -0
- package/src/interface/math/vec3/f32/scale.ts +1 -0
- package/src/interface/math/vec3/f32/schema.ts +1 -0
- package/src/interface/math/vec3/f32/sign.ts +1 -0
- package/src/interface/math/vec3/f32/sin.ts +1 -0
- package/src/interface/math/vec3/f32/sinh.ts +1 -0
- package/src/interface/math/vec3/f32/smoothstep.ts +1 -0
- package/src/interface/math/vec3/f32/sqrt.ts +1 -0
- package/src/interface/math/vec3/f32/step.ts +1 -0
- package/src/interface/math/vec3/f32/subtract.ts +1 -0
- package/src/interface/math/vec3/f32/tan.ts +1 -0
- package/src/interface/math/vec3/f32/tanh.ts +1 -0
- package/src/interface/math/vec3/f32/trunc.ts +1 -0
- package/src/interface/math/vec3/f32/zero.ts +1 -0
- package/src/interface/math/vec3/i32/abs.ts +1 -0
- package/src/interface/math/vec3/i32/add.ts +1 -0
- package/src/interface/math/vec3/i32/bitwise-and.ts +1 -0
- package/src/interface/math/vec3/i32/bitwise-not.ts +1 -0
- package/src/interface/math/vec3/i32/bitwise-or.ts +1 -0
- package/src/interface/math/vec3/i32/bitwise-xor.ts +1 -0
- package/src/interface/math/vec3/i32/clamp.ts +1 -0
- package/src/interface/math/vec3/i32/count-leading-zeros.ts +1 -0
- package/src/interface/math/vec3/i32/count-one-bits.ts +1 -0
- package/src/interface/math/vec3/i32/count-trailing-zeros.ts +1 -0
- package/src/interface/math/vec3/i32/equals.ts +1 -0
- package/src/interface/math/vec3/i32/i32.ts +5 -1
- package/src/interface/math/vec3/i32/max.ts +1 -0
- package/src/interface/math/vec3/i32/min.ts +1 -0
- package/src/interface/math/vec3/i32/multiply.ts +1 -0
- package/src/interface/math/vec3/i32/negate.ts +1 -0
- package/src/interface/math/vec3/i32/one.ts +1 -0
- package/src/interface/math/vec3/i32/public.ts +2 -0
- package/src/interface/math/vec3/i32/reverse-bits.ts +1 -0
- package/src/interface/math/vec3/i32/scale.ts +1 -0
- package/src/interface/math/vec3/i32/schema.ts +1 -0
- package/src/interface/math/vec3/i32/shift-left.ts +1 -0
- package/src/interface/math/vec3/i32/shift-right.ts +1 -0
- package/src/interface/math/vec3/i32/subtract.ts +1 -0
- package/src/interface/math/vec3/i32/zero.ts +1 -0
- package/src/interface/math/vec3/index.ts +1 -0
- package/src/interface/math/vec3/public.ts +2 -0
- package/src/interface/math/vec3/u32/add.ts +1 -0
- package/src/interface/math/vec3/u32/bitwise-and.ts +1 -0
- package/src/interface/math/vec3/u32/bitwise-not.ts +1 -0
- package/src/interface/math/vec3/u32/bitwise-or.ts +1 -0
- package/src/interface/math/vec3/u32/bitwise-xor.ts +1 -0
- package/src/interface/math/vec3/u32/clamp.ts +1 -0
- package/src/interface/math/vec3/u32/count-leading-zeros.ts +1 -0
- package/src/interface/math/vec3/u32/count-one-bits.ts +1 -0
- package/src/interface/math/vec3/u32/count-trailing-zeros.ts +1 -0
- package/src/interface/math/vec3/u32/equals.ts +1 -0
- package/src/interface/math/vec3/u32/max.ts +1 -0
- package/src/interface/math/vec3/u32/min.ts +1 -0
- package/src/interface/math/vec3/u32/multiply.ts +1 -0
- package/src/interface/math/vec3/u32/negate.ts +1 -0
- package/src/interface/math/vec3/u32/one.ts +1 -0
- package/src/interface/math/vec3/u32/public.ts +2 -0
- package/src/interface/math/vec3/u32/reverse-bits.ts +1 -0
- package/src/interface/math/vec3/u32/scale.ts +1 -0
- package/src/interface/math/vec3/u32/schema.ts +1 -0
- package/src/interface/math/vec3/u32/shift-left.ts +1 -0
- package/src/interface/math/vec3/u32/shift-right.ts +1 -0
- package/src/interface/math/vec3/u32/subtract.ts +1 -0
- package/src/interface/math/vec3/u32/u32.ts +5 -1
- package/src/interface/math/vec3/u32/volume.ts +1 -0
- package/src/interface/math/vec3/u32/zero.ts +1 -0
- package/src/interface/math/vec4/f32/abs.ts +1 -0
- package/src/interface/math/vec4/f32/acos.ts +1 -0
- package/src/interface/math/vec4/f32/acosh.ts +1 -0
- package/src/interface/math/vec4/f32/add.ts +1 -0
- package/src/interface/math/vec4/f32/asin.ts +1 -0
- package/src/interface/math/vec4/f32/asinh.ts +1 -0
- package/src/interface/math/vec4/f32/atan.ts +1 -0
- package/src/interface/math/vec4/f32/atanh.ts +1 -0
- package/src/interface/math/vec4/f32/ceil.ts +1 -0
- package/src/interface/math/vec4/f32/clamp.ts +1 -0
- package/src/interface/math/vec4/f32/cos.ts +1 -0
- package/src/interface/math/vec4/f32/cosh.ts +1 -0
- package/src/interface/math/vec4/f32/default.ts +6 -0
- package/src/interface/math/vec4/f32/distance.ts +1 -0
- package/src/interface/math/vec4/f32/dot.ts +1 -0
- package/src/interface/math/vec4/f32/exp.ts +1 -0
- package/src/interface/math/vec4/f32/exp2.ts +1 -0
- package/src/interface/math/vec4/f32/f32.ts +5 -1
- package/src/interface/math/vec4/f32/faceforward.ts +1 -0
- package/src/interface/math/vec4/f32/floor.ts +1 -0
- package/src/interface/math/vec4/f32/fract.ts +1 -0
- package/src/interface/math/vec4/f32/length.ts +1 -0
- package/src/interface/math/vec4/f32/log.ts +1 -0
- package/src/interface/math/vec4/f32/log2.ts +1 -0
- package/src/interface/math/vec4/f32/max.ts +1 -0
- package/src/interface/math/vec4/f32/min.ts +1 -0
- package/src/interface/math/vec4/f32/mix.ts +1 -0
- package/src/interface/math/vec4/f32/mod.ts +1 -0
- package/src/interface/math/vec4/f32/modf.ts +1 -0
- package/src/interface/math/vec4/f32/multiply.ts +1 -0
- package/src/interface/math/vec4/f32/negate.ts +1 -0
- package/src/interface/math/vec4/f32/normalize.ts +1 -0
- package/src/interface/math/vec4/f32/pow.ts +1 -0
- package/src/interface/math/vec4/f32/public.ts +2 -0
- package/src/interface/math/vec4/f32/reflect.ts +1 -0
- package/src/interface/math/vec4/f32/refract.ts +1 -0
- package/src/interface/math/vec4/f32/round.ts +1 -0
- package/src/interface/math/vec4/f32/scale.ts +1 -0
- package/src/interface/math/vec4/f32/schema.ts +1 -0
- package/src/interface/math/vec4/f32/sign.ts +1 -0
- package/src/interface/math/vec4/f32/sin.ts +1 -0
- package/src/interface/math/vec4/f32/sinh.ts +1 -0
- package/src/interface/math/vec4/f32/smoothstep.ts +1 -0
- package/src/interface/math/vec4/f32/sqrt.ts +1 -0
- package/src/interface/math/vec4/f32/step.ts +1 -0
- package/src/interface/math/vec4/f32/subtract.ts +1 -0
- package/src/interface/math/vec4/f32/tan.ts +1 -0
- package/src/interface/math/vec4/f32/tanh.ts +1 -0
- package/src/interface/math/vec4/f32/trunc.ts +1 -0
- package/src/interface/math/vec4/i32/abs.ts +1 -0
- package/src/interface/math/vec4/i32/add.ts +1 -0
- package/src/interface/math/vec4/i32/bitwise-and.ts +1 -0
- package/src/interface/math/vec4/i32/bitwise-not.ts +1 -0
- package/src/interface/math/vec4/i32/bitwise-or.ts +1 -0
- package/src/interface/math/vec4/i32/bitwise-xor.ts +1 -0
- package/src/interface/math/vec4/i32/clamp.ts +1 -0
- package/src/interface/math/vec4/i32/count-leading-zeros.ts +1 -0
- package/src/interface/math/vec4/i32/count-one-bits.ts +1 -0
- package/src/interface/math/vec4/i32/count-trailing-zeros.ts +1 -0
- package/src/interface/math/vec4/i32/equals.ts +1 -0
- package/src/interface/math/vec4/i32/i32.ts +5 -1
- package/src/interface/math/vec4/i32/max.ts +1 -0
- package/src/interface/math/vec4/i32/min.ts +1 -0
- package/src/interface/math/vec4/i32/multiply.ts +1 -0
- package/src/interface/math/vec4/i32/negate.ts +1 -0
- package/src/interface/math/vec4/i32/one.ts +1 -0
- package/src/interface/math/vec4/i32/public.ts +2 -0
- package/src/interface/math/vec4/i32/reverse-bits.ts +1 -0
- package/src/interface/math/vec4/i32/scale.ts +1 -0
- package/src/interface/math/vec4/i32/schema.ts +1 -0
- package/src/interface/math/vec4/i32/shift-left.ts +1 -0
- package/src/interface/math/vec4/i32/shift-right.ts +1 -0
- package/src/interface/math/vec4/i32/subtract.ts +1 -0
- package/src/interface/math/vec4/i32/zero.ts +1 -0
- package/src/interface/math/vec4/index.ts +1 -0
- package/src/interface/math/vec4/public.ts +2 -0
- package/src/interface/math/vec4/u32/add.ts +1 -0
- package/src/interface/math/vec4/u32/bitwise-and.ts +1 -0
- package/src/interface/math/vec4/u32/bitwise-not.ts +1 -0
- package/src/interface/math/vec4/u32/bitwise-or.ts +1 -0
- package/src/interface/math/vec4/u32/bitwise-xor.ts +1 -0
- package/src/interface/math/vec4/u32/clamp.ts +1 -0
- package/src/interface/math/vec4/u32/count-leading-zeros.ts +1 -0
- package/src/interface/math/vec4/u32/count-one-bits.ts +1 -0
- package/src/interface/math/vec4/u32/count-trailing-zeros.ts +1 -0
- package/src/interface/math/vec4/u32/equals.ts +1 -0
- package/src/interface/math/vec4/u32/max.ts +1 -0
- package/src/interface/math/vec4/u32/min.ts +1 -0
- package/src/interface/math/vec4/u32/multiply.ts +1 -0
- package/src/interface/math/vec4/u32/negate.ts +1 -0
- package/src/interface/math/vec4/u32/one.ts +1 -0
- package/src/interface/math/vec4/u32/public.ts +2 -0
- package/src/interface/math/vec4/u32/reverse-bits.ts +1 -0
- package/src/interface/math/vec4/u32/scale.ts +1 -0
- package/src/interface/math/vec4/u32/schema.ts +1 -0
- package/src/interface/math/vec4/u32/shift-left.ts +1 -0
- package/src/interface/math/vec4/u32/shift-right.ts +1 -0
- package/src/interface/math/vec4/u32/subtract.ts +1 -0
- package/src/interface/math/vec4/u32/u32.ts +5 -1
- package/src/interface/math/vec4/u32/zero.ts +1 -0
- package/src/interface/platform/platform.ts +1 -0
- package/src/interface/registry/archetypes.test.ts +50 -0
- package/src/interface/registry/archetypes.ts +45 -9
- package/src/interface/registry/declarations.ts +107 -13
- package/src/interface/registry/declared.test.ts +40 -0
- package/src/interface/registry/finalizer-order.ts +4 -3
- package/src/interface/registry/ids.test-helper.ts +35 -1
- package/src/interface/registry/ids.test.ts +43 -56
- package/src/interface/registry/ids.ts +46 -0
- package/src/interface/registry/index.ts +4 -3
- package/src/interface/registry/indexes.ts +3 -2
- package/src/interface/registry/items.ts +17 -47
- package/src/interface/registry/layout.test.ts +20 -0
- package/src/interface/registry/layout.ts +11 -3
- package/src/interface/registry/names.test.ts +16 -18
- package/src/interface/registry/names.ts +62 -42
- package/src/interface/registry/program.ts +1 -0
- package/src/interface/registry/reduction.ts +1 -0
- package/src/interface/registry/schedule.ts +10 -14
- package/src/interface/registry/schemas.ts +58 -0
- package/src/interface/registry/strata.ts +1 -0
- package/src/interface/registry/threads.ts +3 -2
- package/src/interface/registry/traits.ts +2 -1
- package/src/interface/registry/written.ts +1 -0
- package/src/interface/resource/condition.ts +1 -0
- package/src/interface/resource/index.ts +1 -1
- package/src/interface/resource/key.ts +1 -0
- package/src/interface/resource/reduction.ts +1 -0
- package/src/interface/resource/register.test.ts +42 -56
- package/src/interface/resource/resource.ts +1 -0
- package/src/interface/resource/types.ts +5 -1
- package/src/interface/resource/value.ts +1 -0
- package/src/interface/resource/written.ts +1 -0
- package/src/interface/resources/always.ts +3 -2
- package/src/interface/resources/cadence.ts +4 -3
- package/src/interface/resources/clock.ts +5 -3
- package/src/interface/resources/gpu-device.ts +3 -2
- package/src/interface/resources/index.ts +1 -0
- package/src/interface/resources/wake.ts +3 -2
- package/src/interface/resources/workers.ts +3 -2
- package/src/interface/rule/create.ts +9 -7
- package/src/interface/rule/created.ts +3 -2
- package/src/interface/rule/declaration.ts +7 -3
- package/src/interface/rule/index.ts +1 -0
- package/src/interface/rule/rule.ts +1 -0
- package/src/interface/rule/rule.type-test.ts +17 -27
- package/src/interface/schema/is-struct.ts +12 -0
- package/src/interface/schema/schema.ts +23 -1
- package/src/interface/schema/schema.type-test.ts +18 -16
- package/src/interface/schema/schemas.type-test.ts +1 -0
- package/src/interface/system/access.ts +68 -28
- package/src/interface/system/body.ts +53 -23
- package/src/interface/system/check.ts +82 -44
- package/src/interface/system/commands.ts +50 -5
- package/src/interface/system/commands.type-test.ts +2 -8
- package/src/interface/system/composite-declaration.ts +1 -2
- package/src/interface/system/composite-input.type-test.ts +13 -29
- package/src/interface/system/composite.ts +1 -0
- package/src/interface/system/conditions.type-test.ts +11 -22
- package/src/interface/system/create-resolved.ts +21 -0
- package/src/interface/system/create.test.ts +96 -116
- package/src/interface/system/create.ts +121 -94
- package/src/interface/system/declaration.ts +33 -25
- package/src/interface/system/definition.ts +1 -0
- package/src/interface/system/index.ts +1 -0
- package/src/interface/system/input.ts +35 -4
- package/src/interface/system/leaf.ts +10 -3
- package/src/interface/system/lists.type-test.ts +53 -0
- package/src/interface/system/name.ts +4 -3
- package/src/interface/system/optional.type-test.ts +51 -0
- package/src/interface/system/property.ts +1 -0
- package/src/interface/system/render.ts +45 -20
- package/src/interface/system/resolve.test.ts +49 -0
- package/src/interface/system/resolve.ts +165 -0
- package/src/interface/system/shared.type-test.ts +205 -0
- package/src/interface/system/struct.ts +1 -0
- package/src/interface/system/system.ts +5 -3
- package/src/interface/system/system.type-test.ts +160 -197
- package/src/interface/system/threads.ts +9 -8
- package/src/interface/system/threads.type-test.ts +29 -60
- package/src/interface/system/up.type-test.ts +15 -28
- package/src/interface/system/values-of.ts +17 -0
- package/src/interface/system/values.ts +15 -12
- package/src/interface/thread/of.ts +4 -3
- package/src/interface/thread/thread.ts +1 -0
- package/src/interface/thread/thread.type-test.ts +3 -68
- package/src/interface/trait/key.ts +2 -1
- package/src/interface/trait/trait.type-test.ts +4 -77
- package/src/interface/trait/types.ts +19 -6
- package/src/interface/tsconfig.json +1 -1
- package/src/interface/world/create.ts +9 -2
- package/src/interface/world/declarations.ts +34 -0
- package/src/interface/world/filter.ts +1 -0
- package/src/interface/world/index.ts +1 -0
- package/src/interface/world/join.ts +11 -4
- package/src/interface/world/loop.type-test.ts +15 -10
- package/src/interface/world/run.type-test.ts +87 -0
- package/src/interface/world/share.type-test.ts +8 -2
- package/src/interface/world/world.ts +32 -17
- package/src/interface/world/world.type-test.ts +6 -10
- package/src/observe/compare.ts +1 -0
- package/src/observe/entity.ts +21 -13
- package/src/observe/index.ts +1 -0
- package/src/observe/members.ts +1 -0
- package/src/observe/observe.ts +1 -0
- package/src/observe/observe.type-test.ts +1 -4
- package/src/observe/plans.ts +1 -0
- package/src/observe/query.ts +1 -0
- package/src/observe/resource.ts +5 -4
- package/src/observe/select.ts +13 -12
- package/src/observe/to-promise.ts +1 -0
- package/src/observe/tsconfig.json +1 -1
- package/src/observe/values.ts +1 -0
- package/src/observe/world-state.ts +41 -34
- package/src/observe-imports.test.ts +1 -0
- package/src/perftest/benchmark.ts +1 -0
- package/src/perftest/benchmarks.ts +24 -8
- package/src/perftest/editor.ts +126 -0
- package/src/perftest/filters.ts +124 -0
- package/src/perftest/finalized.ts +72 -24
- package/src/perftest/flat.ts +16 -26
- package/src/perftest/growth.ts +7 -15
- package/src/perftest/handoff.ts +30 -37
- package/src/perftest/hierarchy.ts +23 -40
- package/src/perftest/indexes.ts +132 -64
- package/src/perftest/invariants.ts +63 -0
- package/src/perftest/joined.ts +13 -5
- package/src/perftest/journal.ts +55 -0
- package/src/perftest/keys.ts +1 -0
- package/src/perftest/log.ts +6 -6
- package/src/perftest/loop.ts +2 -1
- package/src/perftest/observed-gpu.ts +6 -7
- package/src/perftest/observed.ts +6 -12
- package/src/perftest/observer.ts +5 -4
- package/src/perftest/optional.ts +102 -0
- package/src/perftest/particles.ts +13 -20
- package/src/perftest/placed.ts +1 -0
- package/src/perftest/reads.ts +13 -18
- package/src/perftest/remote.ts +26 -28
- package/src/perftest/render-order.ts +86 -0
- package/src/perftest/run.ts +1 -0
- package/src/perftest/shared.ts +416 -0
- package/src/perftest/strings.ts +14 -12
- package/src/perftest/structural.ts +32 -46
- package/src/perftest/suite.perf-browser-test.ts +3 -0
- package/src/perftest/suite.perf-test.ts +1 -0
- package/src/perftest/suite.ts +41 -59
- package/src/perftest/systems.ts +4 -6
- package/src/perftest/tails.ts +40 -48
- package/src/perftest/transfers.ts +25 -20
- package/src/perftest/uploads.ts +11 -13
- package/src/perftest/values.ts +8 -12
- package/src/perftest/wake.ts +1 -0
- package/src/world.test.ts +10 -10
- package/dist/implementation/compiler/exact.d.ts +0 -24
- package/dist/implementation/compiler/exact.js +0 -64
- package/dist/implementation/compiler/exact.js.map +0 -1
- package/dist/implementation/world/reports.d.ts +0 -63
- package/dist/implementation/world/reports.js +0 -180
- package/dist/implementation/world/reports.js.map +0 -1
- package/dist/interface/archetype/archetype.d.ts +0 -2
- package/dist/interface/archetype/archetype.js +0 -2
- package/dist/interface/archetype/archetype.js.map +0 -1
- package/dist/interface/archetype/create.d.ts +0 -7
- package/dist/interface/archetype/create.js +0 -11
- package/dist/interface/archetype/create.js.map +0 -1
- package/dist/interface/archetype/index.d.ts +0 -1
- package/dist/interface/archetype/index.js +0 -2
- package/dist/interface/archetype/index.js.map +0 -1
- package/dist/interface/archetype/values-of.d.ts +0 -17
- package/dist/interface/archetype/values-of.js.map +0 -1
- package/dist/interface/component/declaration.d.ts +0 -74
- package/dist/interface/component/declaration.js +0 -2
- package/dist/interface/component/declaration.js.map +0 -1
- package/dist/interface/component/register.d.ts +0 -23
- package/dist/interface/component/register.js +0 -6
- package/dist/interface/component/register.js.map +0 -1
- package/dist/interface/finalizer/name.d.ts +0 -6
- package/dist/interface/finalizer/name.js +0 -2
- package/dist/interface/finalizer/name.js.map +0 -1
- package/dist/interface/indexes/name.d.ts +0 -5
- package/dist/interface/indexes/name.js +0 -2
- package/dist/interface/indexes/name.js.map +0 -1
- package/dist/interface/report/components.d.ts +0 -38
- package/dist/interface/report/components.js +0 -48
- package/dist/interface/report/components.js.map +0 -1
- package/dist/interface/report/failure.d.ts +0 -29
- package/dist/interface/report/failure.js +0 -2
- package/dist/interface/report/failure.js.map +0 -1
- package/dist/interface/report/index.d.ts +0 -5
- package/dist/interface/report/index.js +0 -6
- package/dist/interface/report/index.js.map +0 -1
- package/dist/interface/report/report.d.ts +0 -12
- package/dist/interface/report/report.js +0 -2
- package/dist/interface/report/report.js.map +0 -1
- package/dist/interface/resource/declaration.d.ts +0 -31
- package/dist/interface/resource/declaration.js +0 -2
- package/dist/interface/resource/declaration.js.map +0 -1
- package/dist/interface/resource/register.d.ts +0 -13
- package/dist/interface/resource/register.js +0 -6
- package/dist/interface/resource/register.js.map +0 -1
- package/dist/interface/rule/name.d.ts +0 -6
- package/dist/interface/rule/name.js +0 -2
- package/dist/interface/rule/name.js.map +0 -1
- package/dist/interface/schema/is-data.d.ts +0 -19
- package/dist/interface/schema/is-data.js +0 -2
- package/dist/interface/schema/is-data.js.map +0 -1
- package/dist/interface/trait/index.d.ts +0 -1
- package/dist/interface/trait/index.js +0 -2
- package/dist/interface/trait/index.js.map +0 -1
- package/dist/interface/trait/register.d.ts +0 -7
- package/dist/interface/trait/register.js +0 -8
- package/dist/interface/trait/register.js.map +0 -1
- package/dist/interface/trait/required.d.ts +0 -10
- package/dist/interface/trait/required.js +0 -2
- package/dist/interface/trait/required.js.map +0 -1
- package/dist/interface/trait/symbol-keys.d.ts +0 -16
- package/dist/interface/trait/symbol-keys.js +0 -2
- package/dist/interface/trait/symbol-keys.js.map +0 -1
- package/dist/interface/trait/trait.d.ts +0 -2
- package/dist/interface/trait/trait.js +0 -2
- package/dist/interface/trait/trait.js.map +0 -1
- package/src/guide/01-resources.test.ts +0 -44
- package/src/guide/02-entities.test.ts +0 -57
- package/src/guide/03-systems.test.ts +0 -87
- package/src/guide/04-ticks.test.ts +0 -73
- package/src/guide/05-scheduling.test.ts +0 -60
- package/src/guide/06-sync-points.test.ts +0 -59
- package/src/guide/07-change-filters.test.ts +0 -87
- package/src/guide/08-input.test.ts +0 -47
- package/src/guide/09-rules.test.ts +0 -57
- package/src/guide/10-finalizers.test.ts +0 -64
- package/src/guide/11-traits.test.ts +0 -58
- package/src/guide/13-indexes.test.ts +0 -95
- package/src/guide/guide.md +0 -551
- package/src/implementation/compiler/exact.ts +0 -77
- package/src/implementation/world/reports.test-helper.ts +0 -117
- package/src/implementation/world/reports.test.ts +0 -167
- package/src/implementation/world/reports.ts +0 -203
- package/src/interface/archetype/archetype.ts +0 -3
- package/src/interface/archetype/archetype.type-test.ts +0 -37
- package/src/interface/archetype/create.test.ts +0 -40
- package/src/interface/archetype/create.ts +0 -12
- package/src/interface/archetype/index.ts +0 -1
- package/src/interface/archetype/values-of.ts +0 -16
- package/src/interface/component/declaration.ts +0 -67
- package/src/interface/component/declaration.type-test.ts +0 -87
- package/src/interface/component/register.ts +0 -28
- package/src/interface/finalizer/name.ts +0 -6
- package/src/interface/indexes/name.ts +0 -5
- package/src/interface/report/components.ts +0 -69
- package/src/interface/report/failure.ts +0 -26
- package/src/interface/report/index.ts +0 -8
- package/src/interface/report/report.ts +0 -11
- package/src/interface/report/report.type-test.ts +0 -63
- package/src/interface/resource/declaration.ts +0 -29
- package/src/interface/resource/declaration.type-test.ts +0 -89
- package/src/interface/resource/register.ts +0 -18
- package/src/interface/rule/name.ts +0 -6
- package/src/interface/schema/is-data.ts +0 -25
- package/src/interface/trait/index.ts +0 -1
- package/src/interface/trait/register.ts +0 -9
- package/src/interface/trait/required.ts +0 -7
- package/src/interface/trait/symbol-keys.ts +0 -19
- package/src/interface/trait/symbol-keys.type-test.ts +0 -14
- package/src/interface/trait/trait.ts +0 -3
- package/src/samples/particles/build.test.ts +0 -23
- package/src/samples/particles/gpu/main.ts +0 -96
- package/src/samples/particles/gpu/particles.ts +0 -138
- package/src/samples/particles/index.html +0 -22
- package/src/samples/particles/particles.test.ts +0 -31
- package/src/samples/particles/particles.ts +0 -85
- package/src/samples/particles/particles.type-test.ts +0 -7
- package/src/samples/todo/README.md +0 -174
- package/src/samples/todo/app/app.browser.test.ts +0 -215
- package/src/samples/todo/app/app.ts +0 -30
- package/src/samples/todo/app/log-failures.test.ts +0 -28
- package/src/samples/todo/app/log-failures.ts +0 -7
- package/src/samples/todo/app/main.ts +0 -4
- package/src/samples/todo/app/profile.perf-browser-test.ts +0 -100
- package/src/samples/todo/app/proportional.browser.test.ts +0 -157
- package/src/samples/todo/app/todo.perf-browser-test.ts +0 -207
- package/src/samples/todo/build.test.ts +0 -23
- package/src/samples/todo/features/completion/data.ts +0 -5
- package/src/samples/todo/features/completion/dom.browser.test.ts +0 -53
- package/src/samples/todo/features/completion/dom.ts +0 -39
- package/src/samples/todo/features/completion/elements/elements.browser.test.ts +0 -68
- package/src/samples/todo/features/completion/elements/todo-summary.ts +0 -82
- package/src/samples/todo/features/completion/elements/todo-toggle-all.ts +0 -69
- package/src/samples/todo/features/completion/events.ts +0 -7
- package/src/samples/todo/features/completion/feature.ts +0 -13
- package/src/samples/todo/features/completion/model.test.ts +0 -40
- package/src/samples/todo/features/completion/model.ts +0 -21
- package/src/samples/todo/features/filter/data.ts +0 -16
- package/src/samples/todo/features/filter/dom.browser.test.ts +0 -84
- package/src/samples/todo/features/filter/dom.ts +0 -63
- package/src/samples/todo/features/filter/elements/elements.browser.test.ts +0 -43
- package/src/samples/todo/features/filter/elements/todo-filters.ts +0 -70
- package/src/samples/todo/features/filter/events.ts +0 -4
- package/src/samples/todo/features/filter/feature.ts +0 -12
- package/src/samples/todo/features/filter/model.test.ts +0 -18
- package/src/samples/todo/features/filter/model.ts +0 -10
- package/src/samples/todo/features/generate/elements/elements.browser.test.ts +0 -18
- package/src/samples/todo/features/generate/elements/todo-generate.ts +0 -36
- package/src/samples/todo/features/generate/events.ts +0 -4
- package/src/samples/todo/features/generate/feature.ts +0 -11
- package/src/samples/todo/features/generate/model.test.ts +0 -13
- package/src/samples/todo/features/generate/model.ts +0 -19
- package/src/samples/todo/features/index.ts +0 -4
- package/src/samples/todo/features/todos/data.ts +0 -31
- package/src/samples/todo/features/todos/dom.browser.test.ts +0 -205
- package/src/samples/todo/features/todos/dom.ts +0 -90
- package/src/samples/todo/features/todos/elements/elements.browser.test.ts +0 -211
- package/src/samples/todo/features/todos/elements/todo-entry.ts +0 -45
- package/src/samples/todo/features/todos/elements/todo-list.ts +0 -93
- package/src/samples/todo/features/todos/elements/todo-row.ts +0 -138
- package/src/samples/todo/features/todos/events.ts +0 -11
- package/src/samples/todo/features/todos/feature.ts +0 -14
- package/src/samples/todo/features/todos/model.test.ts +0 -77
- package/src/samples/todo/features/todos/model.ts +0 -80
- package/src/samples/todo/features/todos/todos.test-helper.ts +0 -34
- package/src/samples/todo/imports.test.ts +0 -113
- package/src/samples/todo/index.html +0 -51
- package/src/samples/todo/shared/attach.browser.test.ts +0 -73
- package/src/samples/todo/shared/attach.ts +0 -32
- package/src/samples/todo/shared/connect.ts +0 -21
- package/src/samples/todo/shared/elements/define.ts +0 -7
- package/src/samples/todo/shared/elements/elements.test-helper.ts +0 -28
- package/src/samples/todo/shared/feature.ts +0 -20
- package/src/samples/todo/shared/ticks.test-helper.ts +0 -25
- package/src/samples/transfers/build.test.ts +0 -22
- package/src/samples/transfers/index.html +0 -18
- package/src/samples/transfers/loader.ts +0 -42
- package/src/samples/transfers/main.ts +0 -46
- package/src/samples/transfers/sprites.ts +0 -96
- package/src/samples/transfers/world.ts +0 -11
- /package/dist/interface/{archetype → system}/values-of.js +0 -0
|
@@ -1,13 +1,14 @@
|
|
|
1
|
+
// © 2026 Adobe. MIT License. See /LICENSE for details.
|
|
1
2
|
/// <reference types="node" />
|
|
2
3
|
import { existsSync } from 'node:fs';
|
|
3
4
|
import { readFile } from 'node:fs/promises';
|
|
4
5
|
import { dirname, resolve } from 'node:path';
|
|
5
6
|
import { describe, expect, test } from 'vitest';
|
|
6
7
|
import { parseAst } from 'vite';
|
|
7
|
-
import { chunkShift, type KernelDescription, type KernelModule, type Program } from '../world/kernel.js';
|
|
8
|
+
import { blockShift, chunkShift, type KernelDescription, type KernelModule, type Program } from '../world/kernel.js';
|
|
8
9
|
import { transformKernels } from './transform.js';
|
|
9
10
|
import { createLinker, type LinkHost } from './link.js';
|
|
10
|
-
import {
|
|
11
|
+
import { nodeCopies, ownCopy } from './paths.js';
|
|
11
12
|
import { locateThroughMap } from './source-map.js';
|
|
12
13
|
import { estreeOf } from './estree.js';
|
|
13
14
|
import { Mat4x4, Quat, Vec3 } from '../../interface/math/index.js';
|
|
@@ -27,10 +28,19 @@ const delta = "delta";
|
|
|
27
28
|
const target = "target";
|
|
28
29
|
`;
|
|
29
30
|
|
|
30
|
-
/**
|
|
31
|
-
|
|
31
|
+
/** The operators the test module's resources declare in their `reduce` traits, by binding. */
|
|
32
|
+
type Reductions = { readonly [binding: string]: string };
|
|
33
|
+
const reductions: Reductions = { total: "+", low: "min", bits: "|" };
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Modules by absolute path, for tests of imports: real files for anything not in `files`, and "ecs" for the package;
|
|
37
|
+
* the test module's resources reduce with `reduced`.
|
|
38
|
+
*/
|
|
39
|
+
const host = (files: { readonly [file: string]: string }, reduced: Reductions = reductions): LinkHost => ({
|
|
40
|
+
packages: nodeCopies,
|
|
41
|
+
reductions: file => new Map(file === "/test.js" ? Object.entries(reduced) : []),
|
|
32
42
|
resolve: async (specifier, importer) => {
|
|
33
|
-
if (specifier === "ecs") return
|
|
43
|
+
if (specifier === "ecs") return ownCopy.index;
|
|
34
44
|
if (specifier === "external") return { error: "external is external to the build", unreadable: true };
|
|
35
45
|
if (!specifier.startsWith(".")) return { error: `${specifier} can't be resolved from ${importer}` };
|
|
36
46
|
const path = resolve(dirname(importer), specifier);
|
|
@@ -46,8 +56,8 @@ const host = (files: { readonly [file: string]: string }): LinkHost => ({
|
|
|
46
56
|
},
|
|
47
57
|
});
|
|
48
58
|
|
|
49
|
-
const transform = (source: string, files: { readonly [file: string]: string } = {}) => transformKernels(`${header}${source}`, "/test.js", parse,
|
|
50
|
-
async specifier => specifier === "ecs", index => JSON.stringify(`kernel:${index}`), createLinker(host(files), parse));
|
|
59
|
+
const transform = (source: string, files: { readonly [file: string]: string } = {}, reduced: Reductions = reductions, automatic = true) => transformKernels(`${header}${source}`, "/test.js", parse,
|
|
60
|
+
async specifier => specifier === "ecs" ? ownCopy : null, index => JSON.stringify(`kernel:${index}`), createLinker(host(files, reduced), parse), automatic);
|
|
51
61
|
|
|
52
62
|
type Compiled = KernelDescription & KernelModule;
|
|
53
63
|
|
|
@@ -55,8 +65,8 @@ type Compiled = KernelDescription & KernelModule;
|
|
|
55
65
|
* Compiles `source`, which assigns its kernel system to `kernel`: the attached description plus its kernel module's
|
|
56
66
|
* `create`. `imported` gives the values of the bindings `source` imports, since its imports aren't evaluated.
|
|
57
67
|
*/
|
|
58
|
-
const compile = async (source: string, files: { readonly [file: string]: string } = {}, imported: { readonly [name: string]: unknown } = {}): Promise<Compiled> => {
|
|
59
|
-
const result = await transform(source, files);
|
|
68
|
+
const compile = async (source: string, files: { readonly [file: string]: string } = {}, imported: { readonly [name: string]: unknown } = {}, reduced: Reductions = reductions): Promise<Compiled> => {
|
|
69
|
+
const result = await transform(source, files, reduced);
|
|
60
70
|
if (result === null || "failure" in result) throw new Error(result === null ? "no kernel" : result.failure.message);
|
|
61
71
|
const module = result.code.split("\n").filter(line => !line.startsWith("import ")).join("\n");
|
|
62
72
|
const evaluate = new Function("System", "attachKernel$", "Archetype", ...Object.keys(imported), `${module}\nreturn kernel;`);
|
|
@@ -67,8 +77,8 @@ const compile = async (source: string, files: { readonly [file: string]: string
|
|
|
67
77
|
return { ...description, ...kernelModule };
|
|
68
78
|
};
|
|
69
79
|
|
|
70
|
-
const failure = async (source: string, files: { readonly [file: string]: string } = {}): Promise<string> => {
|
|
71
|
-
const result = await transform(source, files);
|
|
80
|
+
const failure = async (source: string, files: { readonly [file: string]: string } = {}, reduced: Reductions = reductions): Promise<string> => {
|
|
81
|
+
const result = await transform(source, files, reduced);
|
|
72
82
|
return result !== null && "failure" in result ? result.failure.message : "compiled";
|
|
73
83
|
};
|
|
74
84
|
|
|
@@ -97,7 +107,7 @@ type Layout = { readonly strides: readonly number[]; readonly offsets: readonly
|
|
|
97
107
|
|
|
98
108
|
/** A reference interpreter for `Program`, indexing columns by the layout as the WASM generator does. */
|
|
99
109
|
const interpret = (program: Program, columns: readonly (Float64Array | Uint32Array)[], booleans: readonly boolean[], layout: Layout, start: number, end: number, resources: readonly unknown[], args: unknown,
|
|
100
|
-
lookups: readonly ((entity: number) => readonly unknown[] | null)[], partials: Float64Array): void => {
|
|
110
|
+
lookups: readonly ((entity: number) => readonly unknown[] | null)[], partials: Float64Array, shared: readonly unknown[] = []): void => {
|
|
101
111
|
const accumulators = program.reductions ?? [];
|
|
102
112
|
/** Accumulators carry from row to row, from their partials and back. */
|
|
103
113
|
const carried = accumulators.map((_, k) => partials[k] ?? NaN);
|
|
@@ -119,6 +129,7 @@ const interpret = (program: Program, columns: readonly (Float64Array | Uint32Arr
|
|
|
119
129
|
}
|
|
120
130
|
case "resource": return scalarAt(resources[node.index], node.path);
|
|
121
131
|
case "args": return scalarAt(args, node.path);
|
|
132
|
+
case "shared": return scalarAt(shared[node.index], node.path);
|
|
122
133
|
case "local": return locals[node.local] ?? NaN;
|
|
123
134
|
case "unary": {
|
|
124
135
|
const operand = evaluate(node.operand);
|
|
@@ -195,8 +206,10 @@ const interpret = (program: Program, columns: readonly (Float64Array | Uint32Arr
|
|
|
195
206
|
case "stamp": {
|
|
196
207
|
const column = columns[statement.column];
|
|
197
208
|
const chunks = columns[statement.chunks];
|
|
209
|
+
const blocks = columns[statement.blocks];
|
|
198
210
|
if (column) column[at(statement.column, row)] = tick;
|
|
199
211
|
if (chunks) chunks[row >> chunkShift] = tick;
|
|
212
|
+
if (blocks) blocks[row >> blockShift] = tick;
|
|
200
213
|
return normal;
|
|
201
214
|
}
|
|
202
215
|
case "if": return execute(evaluate(statement.test) ? statement.consequent : statement.alternate);
|
|
@@ -247,6 +260,8 @@ const run = (description: Compiled, rows: number, fields: Fields, options: Optio
|
|
|
247
260
|
if (column.kind === "entity") return Float64Array.from({ length: rows }, (_, row) => 100 + row);
|
|
248
261
|
if (column.kind === "changed") return new Uint32Array(rows);
|
|
249
262
|
if (column.kind === "chunks") return new Float64Array(Math.ceil(rows / 2 ** chunkShift));
|
|
263
|
+
if (column.kind === "blocks") return new Float64Array(Math.ceil(rows / 2 ** blockShift));
|
|
264
|
+
if (column.kind === "present") return new Float64Array(rows);
|
|
250
265
|
const component = String(column.component);
|
|
251
266
|
const values = fields[component]?.[JSON.stringify(column.path)] ?? new Array<number>(rows).fill(0);
|
|
252
267
|
const stride = interleaved[component]?.stride;
|
|
@@ -307,11 +322,63 @@ const run = (description: Compiled, rows: number, fields: Fields, options: Optio
|
|
|
307
322
|
|
|
308
323
|
const vec3 = (x: readonly number[], y: readonly number[], z: readonly number[]) => ({ "[0]": x, "[1]": y, "[2]": z });
|
|
309
324
|
|
|
325
|
+
describe("kernels by default", () => {
|
|
326
|
+
/** Whether the transform attached a kernel to the module's system, and the failure if it failed. */
|
|
327
|
+
const attached = async (source: string, automatic = true): Promise<boolean | string> => {
|
|
328
|
+
const result = await transform(source, {}, reductions, automatic);
|
|
329
|
+
if (result === null) return false;
|
|
330
|
+
return "failure" in result ? result.failure.message : result.code.includes("attachKernel$(");
|
|
331
|
+
};
|
|
332
|
+
test("compiles a system with components whose body is in the subset, unflagged", async () => {
|
|
333
|
+
expect(await attached(`const kernel = System.create({ components: { with: [mass, score] } }, row => { row[score] = row[mass] * 2; });`)).toBe(true);
|
|
334
|
+
});
|
|
335
|
+
test("runs as written, without failing, a body that leaves the subset or a declaration a kernel can't have", async () => {
|
|
336
|
+
expect(await attached(`const log = []; const kernel = System.create({ components: { with: [mass] } }, row => { log.push(row[mass]); });`)).toBe(false);
|
|
337
|
+
expect(await attached(`const kernel = System.create({ components: { with: [mass] } }, (row, { resources }) => { resources[delta] = row[mass]; });`)).toBe(false);
|
|
338
|
+
expect(await attached(`const kernel = System.create({ observer: true, components: { with: [mass] } }, row => { void row[mass]; });`)).toBe(false);
|
|
339
|
+
expect(await attached(`const kernel = System.create({ target: "entity", components: { with: [score] } }, row => { row[score] = 1; });`)).toBe(false);
|
|
340
|
+
expect(await attached(`const make = () => System.create({ components: { with: [score] } }, row => { row[score] = 1; });`)).toBe(false);
|
|
341
|
+
});
|
|
342
|
+
test("runs as written a body reading data of a module object or array, which may change, and compiles one reading constants and functions", async () => {
|
|
343
|
+
expect(await attached(`export const scene = { subject: 0 }; const kernel = System.create({ components: { with: [score] } }, row => { row[score] = scene.subject; });`)).toBe(false);
|
|
344
|
+
expect(await attached(`const values = [1, 2]; const kernel = System.create({ components: { with: [score] } }, row => { row[score] = values[0]; });`)).toBe(false);
|
|
345
|
+
expect(await attached(`const make = () => ({ speed: 2 }); export const settings = make(); const kernel = System.create({ components: { with: [score] } }, row => { row[score] = settings.speed; });`)).toBe(false);
|
|
346
|
+
expect(await attached(`const pair = (a, b) => [a, b]; export const range = pair(1, 2); const kernel = System.create({ components: { with: [score] } }, row => { row[score] = range[1]; });`)).toBe(false);
|
|
347
|
+
expect(await attached(`const wide = true; export const shape = wide ? { size: 2 } : { size: 1 }; const kernel = System.create({ components: { with: [score] } }, row => { row[score] = shape.size; });`)).toBe(false);
|
|
348
|
+
expect(await attached(`const make = () => 3; const three = make(); const kernel = System.create({ components: { with: [score] } }, row => { row[score] = three; });`)).toBe(true);
|
|
349
|
+
expect(await attached(`const half = 0.5; const twice = x => x * 2; const kernel = System.create({ components: { with: [mass, score] } }, row => { row[score] = twice(row[mass]) * half; });`)).toBe(true);
|
|
350
|
+
expect(await failure(`export const scene = { subject: 0 }; const kernel = System.create({ kernel: true, components: { with: [score] } }, row => { row[score] = scene.subject; });`)).toBe("compiled");
|
|
351
|
+
});
|
|
352
|
+
test("tries none unflagged when automatic compilation is off, as the suites of bodies as written turn it", async () => {
|
|
353
|
+
expect(await attached(`const kernel = System.create({ components: { with: [mass, score] } }, row => { row[score] = row[mass] * 2; });`, false)).toBe(false);
|
|
354
|
+
expect(await attached(`const kernel = System.create({ kernel: true, components: { with: [mass, score] } }, row => { row[score] = row[mass] * 2; });`, false)).toBe(true);
|
|
355
|
+
});
|
|
356
|
+
test("never compiles a system without components or with kernel: false", async () => {
|
|
357
|
+
expect(await attached(`const kernel = System.create({ resources: {} }, ({ resources }) => { void resources[delta]; });`)).toBe(false);
|
|
358
|
+
expect(await attached(`const kernel = System.create({ kernel: false, components: { with: [mass, score] } }, row => { row[score] = row[mass]; });`)).toBe(false);
|
|
359
|
+
});
|
|
360
|
+
test("compiles a system with optional components, testing their presence once per call, and fails a GPU kernel with them", async () => {
|
|
361
|
+
expect(await attached(`const kernel = System.create({ components: { with: [score], optional: [mass] } }, row => { const found = row[mass]; if (found !== undefined) row[score] = found; });`)).toBe(true);
|
|
362
|
+
expect(await attached(`const kernel = System.create({ kernel: true, components: { with: [score], optional: [mass] } }, row => { if (row[mass] !== undefined) row[mass] = row[score]; });`)).toBe(true);
|
|
363
|
+
expect(await failure(`const kernel = System.create({ kernel: "gpu", components: { with: [score], optional: [mass] } }, row => { row[score] = 1; });`))
|
|
364
|
+
.toBe("a GPU kernel can't have optional components: WGSL has no undefined to read where an archetype lacks one, and a GPU kernel can't fail its system for one row; list them in with, or use kernel: true to run it on the CPU");
|
|
365
|
+
expect(await failure(`const kernel = System.create({ components: { with: [score] } }, row => { row[score] = row[mass]; });`))
|
|
366
|
+
.toBe("mass isn't in components with or optional, so the system doesn't require it: add it there to use it");
|
|
367
|
+
});
|
|
368
|
+
test("fails, saying why, a system with kernel: true that can't compile", async () => {
|
|
369
|
+
expect(await attached(`const kernel = System.create({ kernel: true }, ({ resources }) => { void resources[delta]; });`))
|
|
370
|
+
.toBe("a system without components runs once, so there's nothing to compile");
|
|
371
|
+
expect(await attached(`const log = []; const kernel = System.create({ kernel: true, components: { with: [mass] } }, row => { log.push(row[mass]); });`)).not.toBe(true);
|
|
372
|
+
expect(await attached(`const make = () => System.create({ kernel: true, components: { with: [score] } }, row => { row[score] = 1; });`))
|
|
373
|
+
.toBe("kernel systems must be declared at module scope");
|
|
374
|
+
});
|
|
375
|
+
});
|
|
376
|
+
|
|
310
377
|
describe("particles", () => {
|
|
311
378
|
test("gravity and integrate", async () => {
|
|
312
379
|
const gravity = await compile(`const kernel = System.create({
|
|
313
|
-
|
|
314
|
-
components: {
|
|
380
|
+
kernel: true,
|
|
381
|
+
components: { with: [velocity] },
|
|
315
382
|
}, (row, { resources }) => {
|
|
316
383
|
const [x, y, z] = row[velocity];
|
|
317
384
|
row[velocity] = [x, y - 9.8 * resources[delta], z];
|
|
@@ -323,8 +390,8 @@ describe("particles", () => {
|
|
|
323
390
|
expect(gravity.resources).toEqual(["delta"]);
|
|
324
391
|
|
|
325
392
|
const integrate = await compile(`const kernel = System.create({
|
|
326
|
-
|
|
327
|
-
components: {
|
|
393
|
+
kernel: true,
|
|
394
|
+
components: { with: [velocity, position] }, after: [{}],
|
|
328
395
|
}, (row, { resources }) => {
|
|
329
396
|
const [px, py, pz] = row[position];
|
|
330
397
|
const [vx, vy, vz] = row[velocity];
|
|
@@ -342,7 +409,7 @@ describe("particles", () => {
|
|
|
342
409
|
|
|
343
410
|
describe("layout", () => {
|
|
344
411
|
test("interleaved components are read and written at row * stride + offset, leaving padding untouched", async () => {
|
|
345
|
-
const kernel = await compile(`const kernel = System.create({
|
|
412
|
+
const kernel = await compile(`const kernel = System.create({ kernel: true, components: { with: [alive, velocity] } }, (row) => {
|
|
346
413
|
const [x, y, z] = row[velocity];
|
|
347
414
|
row[velocity] = [z, row[alive] === true ? y * 10 : y, x];
|
|
348
415
|
});`);
|
|
@@ -355,7 +422,7 @@ describe("layout", () => {
|
|
|
355
422
|
});
|
|
356
423
|
|
|
357
424
|
test("stamps set the changed row and its chunk; each changed column is followed by its chunk column", async () => {
|
|
358
|
-
const kernel = await compile(`const kernel = System.create({
|
|
425
|
+
const kernel = await compile(`const kernel = System.create({ kernel: true, components: { with: [mass, score] } }, (row) => {
|
|
359
426
|
if (row[mass] > 0) row[score] = 1;
|
|
360
427
|
});`);
|
|
361
428
|
const rows = 2 * 2 ** chunkShift + 5;
|
|
@@ -369,12 +436,12 @@ describe("layout", () => {
|
|
|
369
436
|
});
|
|
370
437
|
|
|
371
438
|
test("an unconditional stamp stamps the call's chunks once; a stamp after return stays per row", async () => {
|
|
372
|
-
const always = await compile(`const kernel = System.create({
|
|
439
|
+
const always = await compile(`const kernel = System.create({ kernel: true, components: { with: [mass, score] } }, (row) => {
|
|
373
440
|
row[score] = row[mass];
|
|
374
441
|
});`);
|
|
375
442
|
expect(String(always.create)).not.toContain(">> 10] = tick");
|
|
376
443
|
expect(run(always, 3200, {}, { range: [1000, 2100] }).chunks("score")).toEqual([tick, tick, tick, 0]);
|
|
377
|
-
const after = await compile(`const kernel = System.create({
|
|
444
|
+
const after = await compile(`const kernel = System.create({ kernel: true, components: { with: [mass, score] } }, (row) => {
|
|
378
445
|
if (row[mass] > 0) return;
|
|
379
446
|
row[score] = 1;
|
|
380
447
|
});`);
|
|
@@ -384,7 +451,7 @@ describe("layout", () => {
|
|
|
384
451
|
});
|
|
385
452
|
|
|
386
453
|
test("indices stay in step when return skips the rest of a row", async () => {
|
|
387
|
-
const kernel = await compile(`const kernel = System.create({
|
|
454
|
+
const kernel = await compile(`const kernel = System.create({ kernel: true, components: { with: [velocity] } }, (row) => {
|
|
388
455
|
const [x, y, z] = row[velocity];
|
|
389
456
|
if (x > 1 && x < 5) return;
|
|
390
457
|
row[velocity] = [z, y, x];
|
|
@@ -396,14 +463,14 @@ describe("layout", () => {
|
|
|
396
463
|
});
|
|
397
464
|
|
|
398
465
|
describe("reductions", () => {
|
|
399
|
-
const reducing = (
|
|
466
|
+
const reducing = (body: string, read = "[position, mass]") => `const total = "total";
|
|
400
467
|
const low = "low";
|
|
401
468
|
const bits = "bits";
|
|
402
|
-
const kernel = System.create({
|
|
469
|
+
const kernel = System.create({ kernel: true, components: { with: ${read} } }, (row, { reduce, resources }) => { ${body} });`;
|
|
403
470
|
const fields = { position: vec3([1, -4, 2], [5, 0, -1], [3, 9, 6]), mass: { "[]": [2, 3, 12] } };
|
|
404
471
|
|
|
405
472
|
test("fold each contribution into its resource, leaf by leaf, from the partial", async () => {
|
|
406
|
-
const kernel = await compile(reducing(`
|
|
473
|
+
const kernel = await compile(reducing(`
|
|
407
474
|
const [x, y, z] = row[position];
|
|
408
475
|
reduce[total](row[mass]);
|
|
409
476
|
reduce[total](1);
|
|
@@ -418,23 +485,22 @@ const kernel = System.create({ name: "a", kernel: "cpu", components: { read: ${r
|
|
|
418
485
|
});
|
|
419
486
|
|
|
420
487
|
test("fold the values of inlined functions", async () => {
|
|
421
|
-
const kernel = await compile(`import { Vec3 } from "ecs";\n${reducing(
|
|
488
|
+
const kernel = await compile(`import { Vec3 } from "ecs";\n${reducing("reduce[low](Vec3.scale(row[position], 2));", "[position]")}`, {}, {}, { low: "max" });
|
|
422
489
|
expect([0, 1, 2].map(k => run(kernel, 3, fields).reduced("low", [k]))).toEqual([4, 10, 18]);
|
|
423
490
|
});
|
|
424
491
|
|
|
425
492
|
test("that can't be compiled fail with the reason", async () => {
|
|
426
|
-
expect(await failure(reducing(
|
|
427
|
-
expect(await failure(reducing(
|
|
428
|
-
expect(await failure(reducing(
|
|
429
|
-
expect(await failure(reducing(
|
|
430
|
-
expect(await failure(reducing(
|
|
431
|
-
expect(await failure(reducing(`[total]: "+", [total]: "max"`, "reduce[total](1);"))).toBe("total is reduced twice");
|
|
493
|
+
expect(await failure(reducing("reduce[total](1, 2);"))).toBe("total takes the one value it reduces");
|
|
494
|
+
expect(await failure(reducing("reduce[total](1);"), {}, { total: "avg" })).toBe(`total is reduced, so the build reads its operator from its declaration's reduce trait, "avg", which isn't one of "+", "*", "min", "max", "&", "|", "^"`);
|
|
495
|
+
expect(await failure(reducing("reduce[total](1);"), {}, {})).toBe(`total is reduced, so the build reads its operator from its declaration's reduce trait, ${"which its module's JavaScript doesn't register: declare it in TypeScript, and build a library declaring it with Compiler.plugin({ library: true })"}`);
|
|
496
|
+
expect(await failure(reducing("reduce[total](1);").replace(`kernel: true`, `kernel: "gpu"`))).toBe("a GPU kernel can't use reductions yet");
|
|
497
|
+
expect(await failure(reducing("reduce[total](resources[total]);"))).toBe("total is reduced, so it can't also be read or filtered on");
|
|
432
498
|
});
|
|
433
499
|
});
|
|
434
500
|
|
|
435
501
|
describe("let locals of component values", () => {
|
|
436
502
|
test("written back whole after a tuple assignment have the tuple's shape", async () => {
|
|
437
|
-
const kernel = await compile(`const kernel = System.create({
|
|
503
|
+
const kernel = await compile(`const kernel = System.create({ kernel: true, components: { with: [alive, position] } }, (row) => {
|
|
438
504
|
let v = row[position];
|
|
439
505
|
if (row[alive]) v = [7, 8, 9];
|
|
440
506
|
row[position] = v;
|
|
@@ -447,22 +513,22 @@ describe("let locals of component values", () => {
|
|
|
447
513
|
|
|
448
514
|
describe("binding identity", () => {
|
|
449
515
|
test("a local shadowing a component key is not that component", async () => {
|
|
450
|
-
expect(await failure(`const kernel = System.create({
|
|
516
|
+
expect(await failure(`const kernel = System.create({ kernel: true, components: { with: [velocity, position] } }, (row) => {
|
|
451
517
|
const velocity = 1;
|
|
452
518
|
row[position] = row[velocity];
|
|
453
|
-
});`)).toBe("row
|
|
519
|
+
});`)).toBe("a kernel's body indexes its row and context by key directly, or destructures them by key, so the build sees what it reads and writes; it can't pass them on, alias or spread them");
|
|
454
520
|
});
|
|
455
521
|
|
|
456
522
|
test("another binding with the same key string is not the declared component", async () => {
|
|
457
523
|
expect(await failure(`const speed = "velocity";
|
|
458
|
-
const kernel = System.create({
|
|
524
|
+
const kernel = System.create({ kernel: true, components: { with: [velocity, position] } }, (row) => {
|
|
459
525
|
row[position] = row[speed];
|
|
460
|
-
});`)).toBe("speed
|
|
526
|
+
});`)).toBe("speed isn't in components with or optional, so the system doesn't require it: add it there to use it");
|
|
461
527
|
});
|
|
462
528
|
|
|
463
529
|
test("a helper parameter shadows a module binding only inside the helper", async () => {
|
|
464
530
|
const kernel = await compile(`const twice = (velocity) => velocity * 2;
|
|
465
|
-
const kernel = System.create({
|
|
531
|
+
const kernel = System.create({ kernel: true, components: { with: [velocity, position] } }, (row) => {
|
|
466
532
|
row[position] = twice(row[velocity]) + row[velocity];
|
|
467
533
|
});`);
|
|
468
534
|
expect(run(kernel, 1, { velocity: { "[]": [3] } }).field("position")).toEqual([9]);
|
|
@@ -471,7 +537,7 @@ describe("binding identity", () => {
|
|
|
471
537
|
|
|
472
538
|
describe("value semantics", () => {
|
|
473
539
|
test("tuple locals are copies, and snapshots read before later writes", async () => {
|
|
474
|
-
const kernel = await compile(`const kernel = System.create({
|
|
540
|
+
const kernel = await compile(`const kernel = System.create({ kernel: true, components: { with: [position, score] } }, (row) => {
|
|
475
541
|
const before = row[position];
|
|
476
542
|
let v = [before[0], before[1]];
|
|
477
543
|
const w = v;
|
|
@@ -485,7 +551,7 @@ describe("value semantics", () => {
|
|
|
485
551
|
});
|
|
486
552
|
|
|
487
553
|
test("whole-value writes evaluate every leaf before storing", async () => {
|
|
488
|
-
const kernel = await compile(`const kernel = System.create({
|
|
554
|
+
const kernel = await compile(`const kernel = System.create({ kernel: true, components: { with: [position, score] } }, (row) => {
|
|
489
555
|
row[position] = [row[position][1], row[position][0]];
|
|
490
556
|
let a = 1;
|
|
491
557
|
let b = 2;
|
|
@@ -498,7 +564,7 @@ describe("value semantics", () => {
|
|
|
498
564
|
});
|
|
499
565
|
|
|
500
566
|
test("struct values and conditional tuples", async () => {
|
|
501
|
-
const kernel = await compile(`const kernel = System.create({
|
|
567
|
+
const kernel = await compile(`const kernel = System.create({ kernel: true, components: { with: [mass, position] } }, (row) => {
|
|
502
568
|
const p = row[mass] > 1 ? { x: 1, y: [2, 3] } : { x: 4, y: [5, 6] };
|
|
503
569
|
row[position] = p;
|
|
504
570
|
});`);
|
|
@@ -516,7 +582,7 @@ describe("helpers", () => {
|
|
|
516
582
|
return [x * k, y * k];
|
|
517
583
|
};
|
|
518
584
|
const length = ([x, y]) => Math.sqrt(x * x + y * y);
|
|
519
|
-
const kernel = System.create({
|
|
585
|
+
const kernel = System.create({ kernel: true, components: { with: [position, score] } }, (row) => {
|
|
520
586
|
const k = 100;
|
|
521
587
|
const x = 1;
|
|
522
588
|
row[position] = scale(row[position], 0.5);
|
|
@@ -529,14 +595,14 @@ describe("helpers", () => {
|
|
|
529
595
|
|
|
530
596
|
test("recursive helpers are rejected", async () => {
|
|
531
597
|
expect(await failure(`const f = (x) => f(x);
|
|
532
|
-
const kernel = System.create({
|
|
598
|
+
const kernel = System.create({ kernel: true, components: { with: [score] } }, (row) => { row[score] = f(1); });`))
|
|
533
599
|
.toBe("f is recursive");
|
|
534
600
|
});
|
|
535
601
|
});
|
|
536
602
|
|
|
537
603
|
describe("control flow", () => {
|
|
538
604
|
test("return ends the row, also from inside a loop", async () => {
|
|
539
|
-
const kernel = await compile(`const kernel = System.create({
|
|
605
|
+
const kernel = await compile(`const kernel = System.create({ kernel: true, components: { with: [mass, score] } }, (row) => {
|
|
540
606
|
if (row[mass] < 0) return;
|
|
541
607
|
let total = 0;
|
|
542
608
|
for (let i = 0; i < 10; i++) {
|
|
@@ -551,7 +617,7 @@ describe("control flow", () => {
|
|
|
551
617
|
|
|
552
618
|
test("a loop test that inlines a helper is re-evaluated each iteration", async () => {
|
|
553
619
|
const kernel = await compile(`const below = (a, b) => { const limit = b * 2; return a < limit; };
|
|
554
|
-
const kernel = System.create({
|
|
620
|
+
const kernel = System.create({ kernel: true, components: { with: [mass, score] } }, (row) => {
|
|
555
621
|
let n = 0;
|
|
556
622
|
while (below(n, row[mass])) { n++; }
|
|
557
623
|
let m = 0;
|
|
@@ -565,7 +631,7 @@ describe("control flow", () => {
|
|
|
565
631
|
describe("context", () => {
|
|
566
632
|
test("lookups map components to their read index, with null guards", async () => {
|
|
567
633
|
const kernel = await compile(`const half = (value) => { const h = value / 2; return h; };
|
|
568
|
-
const kernel = System.create({
|
|
634
|
+
const kernel = System.create({ kernel: true, components: { with: [target, position, score] }, lookup: { targets: { with: [mass, position] } } }, (row, { lookup: { targets } }) => {
|
|
569
635
|
const other = targets(row[target]);
|
|
570
636
|
if (other !== null) { row[position] = other[position] - other[mass]; }
|
|
571
637
|
row[score] = (other !== null && half(other[position])) || -1;
|
|
@@ -578,7 +644,7 @@ describe("context", () => {
|
|
|
578
644
|
});
|
|
579
645
|
|
|
580
646
|
test("optional lookup access, destructured context groups and input", async () => {
|
|
581
|
-
const kernel = await compile(`const kernel = System.create({
|
|
647
|
+
const kernel = await compile(`const kernel = System.create({ kernel: true, components: { with: [target, score] }, lookup: { targets: { with: [mass] } } }, (row, { resources: { [delta]: d }, lookup: { targets } }, input) => {
|
|
582
648
|
row[score] = (targets(row[target])?.[mass] ?? 0) + d + input;
|
|
583
649
|
});`);
|
|
584
650
|
const found = (entity: number) => entity === 1 ? [3] : null;
|
|
@@ -586,16 +652,16 @@ describe("context", () => {
|
|
|
586
652
|
});
|
|
587
653
|
|
|
588
654
|
test("context groups reached through the context parameter", async () => {
|
|
589
|
-
const kernel = await compile(`const kernel = System.create({
|
|
655
|
+
const kernel = await compile(`const kernel = System.create({ kernel: true, components: { with: [target, score] }, lookup: { targets: { with: [mass] } } }, (row, context, input) => {
|
|
590
656
|
const { resources } = context;
|
|
591
|
-
row[score] = (context.lookup.targets(row[target])?.[mass] ?? 0) + resources[delta] +
|
|
657
|
+
row[score] = (context.lookup.targets(row[target])?.[mass] ?? 0) + resources[delta] + input;
|
|
592
658
|
});`);
|
|
593
659
|
const found = (entity: number) => entity === 1 ? [3] : null;
|
|
594
660
|
expect(run(kernel, 2, { target: { "[]": [1, 2] } }, { lookups: [found], resources: [10], args: 100, program: false }).field("score")).toEqual([113, 110]);
|
|
595
661
|
});
|
|
596
662
|
|
|
597
663
|
test("boolean columns read as booleans", async () => {
|
|
598
|
-
const kernel = await compile(`const kernel = System.create({
|
|
664
|
+
const kernel = await compile(`const kernel = System.create({ kernel: true, components: { with: [alive, score] } }, (row) => {
|
|
599
665
|
row[score] = row[alive] === true ? 1 : 2;
|
|
600
666
|
});`);
|
|
601
667
|
expect(run(kernel, 2, { alive: { "[]": [1, 0] } }, { booleans: ["alive"] }).field("score")).toEqual([1, 2]);
|
|
@@ -603,7 +669,7 @@ describe("context", () => {
|
|
|
603
669
|
});
|
|
604
670
|
|
|
605
671
|
test("boolean reads convert only where observable, including through locals", async () => {
|
|
606
|
-
const kernel = await compile(`const kernel = System.create({
|
|
672
|
+
const kernel = await compile(`const kernel = System.create({ kernel: true, components: { with: [alive, mass, score] } }, (row, { commands }) => {
|
|
607
673
|
const flag = row[alive];
|
|
608
674
|
const copy = flag;
|
|
609
675
|
row[score] = (copy === true ? 10 : 20) + row[mass] * 2 + (flag ? 1 : 0);
|
|
@@ -622,7 +688,7 @@ describe("context", () => {
|
|
|
622
688
|
});
|
|
623
689
|
|
|
624
690
|
test("a spawn nested in an add's value is issued before the add begins", async () => {
|
|
625
|
-
const kernel = await compile(`const kernel = System.create({
|
|
691
|
+
const kernel = await compile(`const kernel = System.create({ kernel: true, components: { with: [mass] } }, (row, { commands }) => {
|
|
626
692
|
commands.add(row.entity, [target, score], { [target]: commands.spawn([mass])({ [mass]: row[mass] }), [score]: 1 });
|
|
627
693
|
commands.despawn(row.entity);
|
|
628
694
|
});`);
|
|
@@ -636,7 +702,7 @@ describe("context", () => {
|
|
|
636
702
|
});
|
|
637
703
|
|
|
638
704
|
test("commands name components through keys", async () => {
|
|
639
|
-
const kernel = await compile(`const kernel = System.create({
|
|
705
|
+
const kernel = await compile(`const kernel = System.create({ kernel: true, components: { with: [position] } }, (row, context) => {
|
|
640
706
|
const { commands } = context;
|
|
641
707
|
const spawned = commands.spawn([position, alive])({ [position]: [row[position][0], 1] });
|
|
642
708
|
commands.add(spawned, score, row.entity);
|
|
@@ -657,11 +723,11 @@ describe("context", () => {
|
|
|
657
723
|
]);
|
|
658
724
|
});
|
|
659
725
|
|
|
660
|
-
test("commands name lists through module constants: array literals and
|
|
661
|
-
const kernel = await compile(`
|
|
662
|
-
const unit =
|
|
726
|
+
test("commands name lists through module constants: array literals, and lists the build gave an index", async () => {
|
|
727
|
+
const kernel = await compile(`function archetype$(list) { return list; }
|
|
728
|
+
const unit = archetype$([position, alive, score]);
|
|
663
729
|
const pair = [mass, score];
|
|
664
|
-
const kernel = System.create({
|
|
730
|
+
const kernel = System.create({ kernel: true, components: { with: [position] } }, (row, { commands }) => {
|
|
665
731
|
const spawned = commands.spawn(unit)({ [score]: 2, [position]: [row[position][0], 1] });
|
|
666
732
|
commands.add(spawned, pair, { [mass]: 3 });
|
|
667
733
|
commands.remove(row.entity, unit);
|
|
@@ -676,9 +742,9 @@ describe("context", () => {
|
|
|
676
742
|
});
|
|
677
743
|
|
|
678
744
|
test("kernel declarations list components through module constants", async () => {
|
|
679
|
-
const kernel = await compile(`
|
|
680
|
-
const moving =
|
|
681
|
-
const kernel = System.create({
|
|
745
|
+
const kernel = await compile(`
|
|
746
|
+
const moving = [position, velocity];
|
|
747
|
+
const kernel = System.create({ kernel: true, components: { with: [score, ...moving] } }, row => {
|
|
682
748
|
row[score] = row[position] + row[velocity];
|
|
683
749
|
});`);
|
|
684
750
|
expect(run(kernel, 2, { position: { "[]": [1, 2] }, velocity: { "[]": [10, 20] } }).field("score")).toEqual([11, 22]);
|
|
@@ -687,19 +753,19 @@ describe("context", () => {
|
|
|
687
753
|
test.each([
|
|
688
754
|
["a value for a component the list doesn't name", "commands.spawn([mass])({ [mass]: 1, [score]: 2 });", "score isn't one of the command's components"],
|
|
689
755
|
["a spawner kept rather than called", "const spawn = commands.spawn([mass]); spawn({ [mass]: 1 });", "a kernel calls the spawner where it gets it, as commands.spawn(components)(values)"],
|
|
690
|
-
["a list holding a spread", "commands.spawn([...
|
|
756
|
+
["a list holding a spread of what isn't a list", "commands.spawn([...mass])({});", "commands.spawn: mass is a key, not a list of components; list it as [mass]"],
|
|
691
757
|
["a list that isn't a module constant", "const list = 1; commands.add(row.entity, list, {});", "commands name components by identifiers bound at module scope"],
|
|
692
758
|
["a component listed twice", "commands.remove(row.entity, [mass, mass]);", "mass is listed twice"],
|
|
693
759
|
["an add with too many arguments", "commands.add(row.entity, mass, 1, 2);", "an add is commands.add(entity, component, value) or commands.add(entity, components, values)"],
|
|
694
760
|
["a remove with rest components", "commands.remove(row.entity, mass, score);", "a remove is commands.remove(entity, component) or commands.remove(entity, components)"],
|
|
695
761
|
])("fail the build for %s", async (_, body, message) => {
|
|
696
|
-
expect(await failure(`const pair = [mass, score];\nconst kernel = System.create({
|
|
762
|
+
expect(await failure(`const pair = [mass, score];\nconst kernel = System.create({ kernel: true, components: { with: [mass] } }, (row, { commands }) => { const m = row[mass]; ${body} });`)).toBe(message);
|
|
697
763
|
});
|
|
698
764
|
});
|
|
699
765
|
|
|
700
766
|
describe("program", () => {
|
|
701
767
|
test("input and resource paths are scalars in the program", async () => {
|
|
702
|
-
const kernel = await compile(`const kernel = System.create({
|
|
768
|
+
const kernel = await compile(`const kernel = System.create({ kernel: true, components: { with: [score] } }, (row, { resources: { [delta]: d } }, input) => {
|
|
703
769
|
const [, y] = d;
|
|
704
770
|
row[score] = y * input.scale + Math.max(input.scale, Math.PI) + (input.flag ? 1 : 0);
|
|
705
771
|
});`);
|
|
@@ -710,7 +776,7 @@ describe("program", () => {
|
|
|
710
776
|
});
|
|
711
777
|
|
|
712
778
|
test("runtime indexing into a resource has no program", async () => {
|
|
713
|
-
const kernel = await compile(`const kernel = System.create({
|
|
779
|
+
const kernel = await compile(`const kernel = System.create({ kernel: true, components: { with: [mass, score] } }, (row, { resources: { [delta]: d } }) => {
|
|
714
780
|
row[score] = d[row[mass]];
|
|
715
781
|
});`);
|
|
716
782
|
expect(run(kernel, 1, { mass: { "[]": [1] } }, { resources: [[5, 6]], program: false }).field("score")).toEqual([6]);
|
|
@@ -719,17 +785,17 @@ describe("program", () => {
|
|
|
719
785
|
|
|
720
786
|
describe("composites", () => {
|
|
721
787
|
test("one argument to System.create that isn't a body is a composite, never a kernel", async () => {
|
|
722
|
-
const result = await transform(`const a = System.create({
|
|
788
|
+
const result = await transform(`const a = System.create({}, () => {});
|
|
723
789
|
const listed = System.create([a]);
|
|
724
|
-
const declared = System.create({ kernel:
|
|
790
|
+
const declared = System.create({ kernel: true, systems: [a], components: { with: [score] } });`);
|
|
725
791
|
expect(result !== null && "failure" in result ? result.failure.message : result?.kernels ?? []).toEqual([]);
|
|
726
792
|
});
|
|
727
793
|
});
|
|
728
794
|
|
|
729
795
|
describe("lookups in the program", () => {
|
|
730
796
|
const targets = (entity: number) => entity === 1 ? [3, [10, 20, 30]] : entity === 2 ? [4, [40, 50, 60]] : null;
|
|
731
|
-
const declaration = (body: string, read = "[target]", lookup = "targets: {
|
|
732
|
-
components: {
|
|
797
|
+
const declaration = (body: string, read = "[target]", lookup = "targets: { with: [mass, position] }") => `const kernel = System.create({ kernel: true,
|
|
798
|
+
components: { with: ${read.replace("]", ", score]")} }, lookup: { ${lookup} } },
|
|
733
799
|
(row, { lookup: { ${lookup.includes("others") ? "targets, others" : "targets"} } }) => { ${body} });`;
|
|
734
800
|
|
|
735
801
|
test("guarded leaf access, early return and a second lookup in its own handle", async () => {
|
|
@@ -740,7 +806,7 @@ describe("lookups in the program", () => {
|
|
|
740
806
|
const second = others(row[mass]);
|
|
741
807
|
const extra = second !== null ? second[position][2] : 0;
|
|
742
808
|
row[score] = tx - other[mass] + ty * 0 + extra;
|
|
743
|
-
`, "[target, mass]", "targets: {
|
|
809
|
+
`, "[target, mass]", "targets: { with: [mass, position] }, others: { with: [position] }"));
|
|
744
810
|
expect(kernel.program?.handles).toBe(2);
|
|
745
811
|
const others = (entity: number) => entity === 2 ? [[0, 0, 7]] : null;
|
|
746
812
|
expect(run(kernel, 3, { target: { "[]": [1, 2, 3] }, mass: { "[]": [2, 0, 0] }, score: { "[]": [-1, -1, -1] } }, { lookups: [targets, others] }).field("score"))
|
|
@@ -748,7 +814,7 @@ describe("lookups in the program", () => {
|
|
|
748
814
|
});
|
|
749
815
|
|
|
750
816
|
test("optional chains read NaN when nothing was found, anywhere", async () => {
|
|
751
|
-
const kernel = await compile(declaration(`row[score] = targets(row[target])?.[position]?.[1] * 2;`, "[target]", "targets: {
|
|
817
|
+
const kernel = await compile(declaration(`row[score] = targets(row[target])?.[position]?.[1] * 2;`, "[target]", "targets: { with: [position] }"));
|
|
752
818
|
expect(kernel.program).not.toBeNull();
|
|
753
819
|
expect(run(kernel, 2, { target: { "[]": [1, 5] } }, { lookups: [entity => targets(entity)?.slice(1) ?? null] }).field("score")).toEqual([40, NaN]);
|
|
754
820
|
});
|
|
@@ -763,9 +829,9 @@ describe("lookups in the program", () => {
|
|
|
763
829
|
});
|
|
764
830
|
|
|
765
831
|
test.each([
|
|
766
|
-
["an unguarded leaf access", `const other = targets(row[target]); row[score] = other[mass];`, "targets: {
|
|
767
|
-
["a lookup result used whole", `const other = targets(row[target]); row[score] = other;`, "targets: {
|
|
768
|
-
["a leaf access after the guard's scope", `const other = targets(row[target]); if (other !== null) { row[score] = 1; } row[score] = other[mass];`, "targets: {
|
|
832
|
+
["an unguarded leaf access", `const other = targets(row[target]); row[score] = other[mass];`, "targets: { with: [mass] }"],
|
|
833
|
+
["a lookup result used whole", `const other = targets(row[target]); row[score] = other;`, "targets: { with: [mass] }"],
|
|
834
|
+
["a leaf access after the guard's scope", `const other = targets(row[target]); if (other !== null) { row[score] = 1; } row[score] = other[mass];`, "targets: { with: [mass] }"],
|
|
769
835
|
])("no program for %s", async (_, body, lookup) => {
|
|
770
836
|
const kernel = await compile(declaration(body, "[target]", lookup));
|
|
771
837
|
expect(kernel.program).toBeNull();
|
|
@@ -773,11 +839,11 @@ describe("lookups in the program", () => {
|
|
|
773
839
|
});
|
|
774
840
|
|
|
775
841
|
describe("subset", () => {
|
|
776
|
-
const kernel = (body: string, components = "{
|
|
777
|
-
`const kernel = System.create({
|
|
842
|
+
const kernel = (body: string, components = "{ with: [mass, score] }") =>
|
|
843
|
+
`const kernel = System.create({ kernel: true, components: ${components} }, (row, { commands }) => { ${body} });`;
|
|
778
844
|
|
|
779
845
|
test.each([
|
|
780
|
-
["row[mass] = 1;", "
|
|
846
|
+
["row[mass] = 1;", "compiled"],
|
|
781
847
|
["row[score] = row[score] + row[mass];", "compiled"],
|
|
782
848
|
["const f = () => 1;", "functions can't be created in a kernel; define helpers at module scope"],
|
|
783
849
|
["row[score] = \"a\";", "only number, boolean and null literals are in the kernel subset"],
|
|
@@ -793,64 +859,76 @@ describe("subset", () => {
|
|
|
793
859
|
});
|
|
794
860
|
|
|
795
861
|
test("component values are written whole", async () => {
|
|
796
|
-
expect(await failure(kernel("row[position][0] = 1;", "{
|
|
862
|
+
expect(await failure(kernel("row[position][0] = 1;", "{ with: [position] }"))).toBe("component values are immutable; write the whole value");
|
|
797
863
|
});
|
|
798
864
|
|
|
799
865
|
test("GPU kernels", async () => {
|
|
800
866
|
const gpu = (declaration: string, body: string) =>
|
|
801
|
-
`const kernel = System.create({
|
|
802
|
-
expect(await failure(gpu("components: {
|
|
803
|
-
expect(await failure(gpu("components: {
|
|
867
|
+
`const kernel = System.create({ kernel: "gpu", ${declaration} }, (row, context) => { ${body} });`;
|
|
868
|
+
expect(await failure(gpu("components: { with: [mass, score] }", "row[score] = row[mass] * 2;"))).toBe("compiled");
|
|
869
|
+
expect(await failure(gpu("components: { with: [target, score] }, lookup: { targets: { with: [mass] } }", "row[score] = 1;")))
|
|
804
870
|
.toBe("a GPU kernel can't use lookups yet");
|
|
805
|
-
expect(await failure(gpu("components: {
|
|
806
|
-
expect(await failure(gpu("components: {
|
|
871
|
+
expect(await failure(gpu("components: { with: [score], changed: [mass] }", "row[score] = 1;"))).toBe("a GPU kernel can't use change filters yet");
|
|
872
|
+
expect(await failure(gpu("components: { with: [mass, score] }", "context.commands.despawn(row.entity);")))
|
|
807
873
|
.toBe("a GPU kernel can't issue commands or use values that aren't numbers or booleans");
|
|
808
|
-
expect(await failure(gpu("components: {
|
|
874
|
+
expect(await failure(gpu("components: { with: [mass, score] }", "let s = 0; for (let i = 0; i < 3; i++) s += i; row[score] = s;")))
|
|
809
875
|
.toBe("a GPU kernel can't use loops or labeled blocks yet");
|
|
810
|
-
expect(await failure(`const kernel = System.create({
|
|
811
|
-
.toBe(`kernel must be the literal
|
|
876
|
+
expect(await failure(`const kernel = System.create({ kernel: "cpu", components: { with: [score] } }, (row) => {});`))
|
|
877
|
+
.toBe(`kernel must be the literal true, false or "gpu"`);
|
|
812
878
|
});
|
|
813
879
|
|
|
814
880
|
test("GPU programs carry their locals' names", async () => {
|
|
815
881
|
const body = "(row) => { const doubled = row[mass] * 2; row[score] = doubled; }";
|
|
816
|
-
const gpu = await compile(`const kernel = System.create({
|
|
817
|
-
const cpu = await compile(`const kernel = System.create({
|
|
882
|
+
const gpu = await compile(`const kernel = System.create({ kernel: "gpu", components: { with: [mass, score] } }, ${body});`);
|
|
883
|
+
const cpu = await compile(`const kernel = System.create({ kernel: true, components: { with: [mass, score] } }, ${body});`);
|
|
818
884
|
expect(gpu.program?.names).toEqual([expect.stringMatching(/^doubled_\d+$/)]);
|
|
819
885
|
expect(cpu.program?.names).toBeUndefined();
|
|
820
886
|
});
|
|
821
887
|
|
|
822
888
|
test("kernels inside functions", async () => {
|
|
823
|
-
expect(await failure(`const make = () => System.create({
|
|
889
|
+
expect(await failure(`const make = () => System.create({ kernel: true, components: { with: [score] } }, (row) => {});`))
|
|
824
890
|
.toBe("kernel systems must be declared at module scope");
|
|
825
891
|
});
|
|
826
892
|
|
|
827
893
|
test("failures carry the offending position", async () => {
|
|
828
|
-
const source = kernel("
|
|
894
|
+
const source = kernel("var x = 1;");
|
|
829
895
|
const result = await transform(source);
|
|
830
|
-
const position = `${header}${source}`.indexOf("
|
|
896
|
+
const position = `${header}${source}`.indexOf("var x = 1");
|
|
831
897
|
expect(result !== null && "failure" in result ? result.failure.position : -1).toBe(position);
|
|
832
898
|
});
|
|
833
899
|
|
|
834
900
|
test("non-kernel systems that may reach their commands and other modules are left untouched", async () => {
|
|
835
|
-
|
|
836
|
-
expect(
|
|
901
|
+
const reaching = await transform(`const s = System.create({ components: { with: [mass] } }, (row, context) => { const f = () => [row, context]; });`);
|
|
902
|
+
expect(reaching !== null && "code" in reaching ? reaching.code : "").not.toContain("terminal$(");
|
|
903
|
+
expect(await transformKernels(`import { System } from "other";\nSystem.create({ kernel: true }, () => {});`, "/x.js", parse, async () => null, () => "")).toBeNull();
|
|
904
|
+
});
|
|
905
|
+
});
|
|
906
|
+
|
|
907
|
+
describe("without a linker", () => {
|
|
908
|
+
test("a kernel tried in the package's interface inlines that module's data, which the interface keeps fixed", async () => {
|
|
909
|
+
const file = ownCopy.index.replace(/\/index\.[jt]s$/, "/interface/fixed.js");
|
|
910
|
+
const source = `import { System } from "ecs";\nconst position = "position";\nconst weights = [1, 2];\nexport const scaled = System.create({ components: { with: [position] } }, (row) => { row[position] = weights[0]; });\n`;
|
|
911
|
+
const result = await transformKernels(source, file, parse, async () => ownCopy, index => JSON.stringify(`kernel:${index}`), undefined, true, undefined, nodeCopies);
|
|
912
|
+
expect(result !== null && "kernels" in result ? result.kernels.length : 0).toBe(1);
|
|
913
|
+
const elsewhere = await transformKernels(source, "/app/fixed.js", parse, async () => ownCopy, index => JSON.stringify(`kernel:${index}`), undefined, true, undefined, nodeCopies);
|
|
914
|
+
expect(elsewhere !== null && "kernels" in elsewhere ? elsewhere.kernels.length : 0).toBe(0);
|
|
837
915
|
});
|
|
838
916
|
});
|
|
839
917
|
|
|
840
918
|
describe("terminal bodies", () => {
|
|
841
919
|
/** Whether the transform marks a main-thread system's body as one that never reaches its commands. */
|
|
842
|
-
const marked = async (parameters: string, body: string, declaration = `{
|
|
920
|
+
const marked = async (parameters: string, body: string, declaration = `{}`): Promise<boolean> => {
|
|
843
921
|
const result = await transform(`const system = System.create(${declaration}, ${parameters} => { ${body} });`);
|
|
844
922
|
if (result !== null && "failure" in result) throw new Error(result.failure.message);
|
|
845
923
|
const code = result?.code ?? "";
|
|
846
924
|
return code.includes("terminal$((") && code.includes("function terminal$(body)");
|
|
847
925
|
};
|
|
848
926
|
test.each([
|
|
849
|
-
["no context", "(row)", "console.log(row);", `{
|
|
850
|
-
["a context destructured without commands", "({ resources })", "console.log(resources);", `{
|
|
851
|
-
["a context used only through its other properties", "(context)", "console.log(context.
|
|
852
|
-
["a context reaching resources and lookups", "(row, context)", "console.log(context.resources, context.lookup, row);", `{
|
|
853
|
-
["nested destructuring", "({ resources: { [delta]: d } })", "console.log(d);", `{
|
|
927
|
+
["no context", "(row)", "console.log(row);", `{ components: { with: [mass] } }`],
|
|
928
|
+
["a context destructured without commands", "({ resources })", "console.log(resources);", `{}`],
|
|
929
|
+
["a context used only through its other properties", "(context)", "console.log(context.resources);", `{ resources: {} }`],
|
|
930
|
+
["a context reaching resources and lookups", "(row, context)", "console.log(context.resources, context.lookup, row);", `{ components: { with: [mass] } }`],
|
|
931
|
+
["nested destructuring", "({ resources: { [delta]: d } })", "console.log(d);", `{ resources: {} }`],
|
|
854
932
|
])("mark a body with %s", async (_, parameters, body, declaration) => {
|
|
855
933
|
expect(await marked(parameters, body, declaration)).toBe(true);
|
|
856
934
|
});
|
|
@@ -870,23 +948,23 @@ describe("terminal bodies", () => {
|
|
|
870
948
|
expect(await marked(parameters, body)).toBe(false);
|
|
871
949
|
});
|
|
872
950
|
test("leave a function body unmarked that uses arguments", async () => {
|
|
873
|
-
const result = await transform(`const system = System.create({
|
|
874
|
-
expect(result).
|
|
951
|
+
const result = await transform(`const system = System.create({}, function () { console.log(arguments); });`);
|
|
952
|
+
expect(result !== null && "code" in result ? result.code : "").not.toContain("terminal$(");
|
|
875
953
|
});
|
|
876
954
|
test("mark a system made from its body alone, and no kernel or finalizer", async () => {
|
|
877
955
|
const alone = await transform("const system = System.create(() => { console.log(1); });");
|
|
878
|
-
expect(alone !== null && "code" in alone ? alone.code : "").toContain("System.create(terminal$(() =>");
|
|
879
|
-
const kernel = await transform(`const kernel = System.create({
|
|
956
|
+
expect(alone !== null && "code" in alone ? alone.code : "").toContain("System.create(access$(terminal$(() =>");
|
|
957
|
+
const kernel = await transform(`const kernel = System.create({ kernel: true, components: { with: [score] } }, (row) => { row[score] = 1; });`);
|
|
880
958
|
expect(kernel !== null && "code" in kernel ? kernel.code : "").not.toContain("terminal$");
|
|
881
|
-
const finalizer = await transformKernels(`import { Finalizer } from "ecs";\nconst f = Finalizer.create({ components: {
|
|
882
|
-
expect(finalizer).
|
|
959
|
+
const finalizer = await transformKernels(`import { Finalizer } from "ecs";\nconst f = Finalizer.create({ components: { with: [] } }, () => {});`, "/x.js", parse, async () => ownCopy, () => "");
|
|
960
|
+
expect(finalizer !== null && "code" in finalizer ? finalizer.code : "").not.toContain("terminal$(");
|
|
883
961
|
});
|
|
884
962
|
});
|
|
885
963
|
|
|
886
964
|
describe("index lookups in main-thread systems", () => {
|
|
887
965
|
/** Runs the transformed body once, recording each lookup as the runtime hook receives it. */
|
|
888
966
|
const looked = async (body: string, parameters = "({ lookup })", lookup = "near: { index: grid }"): Promise<{ readonly code: string; readonly calls: readonly unknown[] }> => {
|
|
889
|
-
const source = `const grid = "grid";\nconst system = System.create({
|
|
967
|
+
const source = `const grid = "grid";\nconst system = System.create({ lookup: { ${lookup} } }, ${parameters} => { ${body} });`;
|
|
890
968
|
const result = await transform(source);
|
|
891
969
|
if (result !== null && "failure" in result) return { code: result.failure.message, calls: [] };
|
|
892
970
|
const module = (result?.code ?? `${header}${source}`).split("\n").filter(line => !line.startsWith("import ")).join("\n");
|
|
@@ -925,7 +1003,7 @@ describe("index lookups in main-thread systems", () => {
|
|
|
925
1003
|
|
|
926
1004
|
describe("commands in main-thread systems", () => {
|
|
927
1005
|
/** Runs the transformed system's body once, recording each spawn's and add's keys and values as the runtime hooks receive them. */
|
|
928
|
-
const spawned = async (body: string, parameters = "({ commands })", declaration = `{
|
|
1006
|
+
const spawned = async (body: string, parameters = "({ commands })", declaration = `{}`): Promise<{ readonly code: string; readonly calls: readonly unknown[] }> => {
|
|
929
1007
|
const source = `const system = System.create(${declaration}, ${parameters} => { ${body} });`;
|
|
930
1008
|
const result = await transform(source);
|
|
931
1009
|
if (result !== null && "failure" in result) return { code: result.failure.message, calls: [] };
|
|
@@ -969,10 +1047,10 @@ describe("commands in main-thread systems", () => {
|
|
|
969
1047
|
});
|
|
970
1048
|
|
|
971
1049
|
test.each([
|
|
972
|
-
["the context's commands", "context.commands.spawn([score])({ [score]: 1 });", "(context)", `{
|
|
973
|
-
["renamed commands", "issue.spawn([score])({ [score]: 1 });", "({ commands: issue })", `{
|
|
974
|
-
["a system with components", "commands.spawn([score])({ [score]: 1 });", "(row, { commands })", `{
|
|
975
|
-
["the context of a system with components", "context.commands.spawn([score])({ [score]: 1 });", "(row, context)", `{
|
|
1050
|
+
["the context's commands", "context.commands.spawn([score])({ [score]: 1 });", "(context)", `{}`],
|
|
1051
|
+
["renamed commands", "issue.spawn([score])({ [score]: 1 });", "({ commands: issue })", `{}`],
|
|
1052
|
+
["a system with components", "commands.spawn([score])({ [score]: 1 });", "(row, { commands })", `{ kernel: false, components: { with: [mass] } }`],
|
|
1053
|
+
["the context of a system with components", "context.commands.spawn([score])({ [score]: 1 });", "(row, context)", `{ kernel: false, components: { with: [mass] } }`],
|
|
976
1054
|
])("pass values positionally through %s", async (_, body, parameters, declaration) => {
|
|
977
1055
|
const { calls } = await spawned(body, parameters, declaration);
|
|
978
1056
|
expect(calls).toEqual([["prepared", ["score"], ["score"], [1]]]);
|
|
@@ -995,6 +1073,35 @@ describe("commands in main-thread systems", () => {
|
|
|
995
1073
|
expect(calls.every(call => Array.isArray(call) && call[0] === "spawn")).toBe(true);
|
|
996
1074
|
expect(calls.length).toBe(1);
|
|
997
1075
|
});
|
|
1076
|
+
describe("lists of keys", () => {
|
|
1077
|
+
const keys = "const a = Symbol(); const b = Symbol();\n";
|
|
1078
|
+
test("are made once, with an index, for spawns, adds and removes", async () => {
|
|
1079
|
+
const result = await transform(`${keys}const system = System.create(({ commands }) => { commands.spawn([a, b])({ [a]: 1, [b]: 2 }); commands.add(1, [b], { [b]: 3 }); commands.remove(1, [a, b]); commands.spawn([a]); });`);
|
|
1080
|
+
const transformed = result !== null && "code" in result ? result.code : "";
|
|
1081
|
+
expect(transformed.match(/\(list\$\d+ \?\?= archetype\$\(\[[ab, ]+\]\)\)/g)).toEqual([
|
|
1082
|
+
"(list$0 ??= archetype$([a, b]))", "(list$1 ??= archetype$([b]))", "(list$2 ??= archetype$([a, b]))", "(list$3 ??= archetype$([a]))",
|
|
1083
|
+
]);
|
|
1084
|
+
expect(transformed).toContain("function archetype$(list)");
|
|
1085
|
+
});
|
|
1086
|
+
test("leave a list naming anything but module keys as written", async () => {
|
|
1087
|
+
const result = await transform(`${keys}const system = System.create(({ commands }) => { const c = a; commands.spawn([a, c]); commands.remove(1, [a, 2]); });`);
|
|
1088
|
+
const transformed = result !== null && "code" in result ? result.code : "";
|
|
1089
|
+
expect(transformed).toContain("commands.spawn([a, c]); commands.remove(1, [a, 2]);");
|
|
1090
|
+
expect(transformed).not.toContain("archetype$");
|
|
1091
|
+
});
|
|
1092
|
+
test("leave a list naming a key shadowed around the body, or by its parameters, as written", async () => {
|
|
1093
|
+
const result = await transform(`${keys}const make = (a) => System.create(({ commands }) => { commands.spawn([a]); });
|
|
1094
|
+
const remove = System.create(({ commands }, b) => { commands.remove(1, [a, b]); });`);
|
|
1095
|
+
const transformed = result !== null && "code" in result ? result.code : "";
|
|
1096
|
+
expect(transformed).toContain("commands.spawn([a]);");
|
|
1097
|
+
expect(transformed).toContain("commands.remove(1, [a, b]);");
|
|
1098
|
+
expect(transformed).not.toContain("archetype$");
|
|
1099
|
+
});
|
|
1100
|
+
test("fail the build for a list naming a key twice", async () => {
|
|
1101
|
+
const result = await transform(`${keys}const system = System.create(({ commands }) => { commands.remove(1, [a, b, a]); });`);
|
|
1102
|
+
expect(result !== null && "failure" in result ? result.failure.message : null).toBe("this list names a twice; a list of components names each once");
|
|
1103
|
+
});
|
|
1104
|
+
});
|
|
998
1105
|
describe("adds", () => {
|
|
999
1106
|
test("pass literal values positionally, after the entity, in source order", async () => {
|
|
1000
1107
|
const { code, calls } = await spawned("let i = 0; commands.add(++i, [score, mass, ++i], { [score]: ++i, [mass]: ++i });");
|
|
@@ -1028,7 +1135,7 @@ describe("helpers that return early", () => {
|
|
|
1028
1135
|
}
|
|
1029
1136
|
return [c, 2];
|
|
1030
1137
|
};
|
|
1031
|
-
const kernel = System.create({
|
|
1138
|
+
const kernel = System.create({ kernel: true, components: { with: [mass, position] } }, (row) => {
|
|
1032
1139
|
const [value, path] = pick(row[mass], 4);
|
|
1033
1140
|
row[position] = [value, path, 0];
|
|
1034
1141
|
});`);
|
|
@@ -1044,7 +1151,7 @@ describe("math builtins", () => {
|
|
|
1044
1151
|
const results = (result: ReturnType<typeof run>) => [0, 1, 2].map(row => [0, 1, 2].map(k => result.field("position", [k])[row]));
|
|
1045
1152
|
|
|
1046
1153
|
test("inline as scalar code, nested namespaces and helpers they call included", async () => {
|
|
1047
|
-
const kernel = await compile(`${math}const kernel = System.create({
|
|
1154
|
+
const kernel = await compile(`${math}const kernel = System.create({ kernel: true, components: { with: [velocity, position, score] } }, (row) => {
|
|
1048
1155
|
const p = row[position];
|
|
1049
1156
|
const v = row[velocity];
|
|
1050
1157
|
row[position] = Vec3.add(Vec3.normalize(Vec3.cross(p, v)), Vec3.F32.scale(Vec3.clamp(v, Vec3.zero, [1, 1, 1]), Vec3.dot(p, v)));
|
|
@@ -1063,7 +1170,7 @@ describe("math builtins", () => {
|
|
|
1063
1170
|
});
|
|
1064
1171
|
|
|
1065
1172
|
test("across namespaces: quaternions rotating vectors, and matrices", async () => {
|
|
1066
|
-
const kernel = await compile(`${math}const kernel = System.create({
|
|
1173
|
+
const kernel = await compile(`${math}const kernel = System.create({ kernel: true, components: { with: [position] } }, (row) => {
|
|
1067
1174
|
const q = Quat.fromAxisAngle([0, 0, 1], Math.PI / 2);
|
|
1068
1175
|
const m = Mat4x4.multiply(Mat4x4.translation(1, 2, 3), Mat4x4.scaling(2, 2, 2));
|
|
1069
1176
|
row[position] = Mat4x4.multiplyVec3(m, Quat.rotateVec3(q, row[position]));
|
|
@@ -1076,9 +1183,9 @@ describe("math builtins", () => {
|
|
|
1076
1183
|
|
|
1077
1184
|
test("in GPU kernels, become regions WGSL emits as builtins, and other backends run as the inlined body", async () => {
|
|
1078
1185
|
const body = `(row) => { row[position] = Vec3.scale(Vec3.normalize(Vec3.cross(row[position], row[velocity])), Vec3.dot(row[position], row[velocity])); }`;
|
|
1079
|
-
const declaration = `components: {
|
|
1080
|
-
const gpu = await compile(`${math}const kernel = System.create({
|
|
1081
|
-
const cpu = await compile(`${math}const kernel = System.create({
|
|
1186
|
+
const declaration = `components: { with: [velocity, position] }`;
|
|
1187
|
+
const gpu = await compile(`${math}const kernel = System.create({ kernel: "gpu", ${declaration} }, ${body});`);
|
|
1188
|
+
const cpu = await compile(`${math}const kernel = System.create({ kernel: true, ${declaration} }, ${body});`);
|
|
1082
1189
|
const regions = (gpu.program?.body ?? []).flatMap(statement => statement.kind === "intrinsic" ? [statement.intrinsic.operation] : []);
|
|
1083
1190
|
expect(regions).toEqual(["cross", "normalize", "dot", "*"]);
|
|
1084
1191
|
expect((cpu.program?.body ?? []).some(statement => statement.kind === "intrinsic")).toBe(false);
|
|
@@ -1092,17 +1199,17 @@ describe("math builtins", () => {
|
|
|
1092
1199
|
});
|
|
1093
1200
|
|
|
1094
1201
|
test("that leave the kernel subset fail with the function's reason", async () => {
|
|
1095
|
-
expect(await failure(`${math}const kernel = System.create({
|
|
1202
|
+
expect(await failure(`${math}const kernel = System.create({ kernel: true, components: { with: [position] } }, (row) => {
|
|
1096
1203
|
row[position] = Vec3.random();
|
|
1097
1204
|
});`)).toBe("Math.random is not in the kernel subset");
|
|
1098
|
-
expect(await failure(`${math}const kernel = System.create({
|
|
1205
|
+
expect(await failure(`${math}const kernel = System.create({ kernel: true, components: { with: [position] } }, (row) => {
|
|
1099
1206
|
row[position] = Vec3.missing([1, 2, 3]);
|
|
1100
1207
|
});`)).toMatch(/^missing isn't exported by .*\/math\/vec3\/public\.ts$/);
|
|
1101
1208
|
});
|
|
1102
1209
|
});
|
|
1103
1210
|
|
|
1104
1211
|
describe("imported functions and constants", () => {
|
|
1105
|
-
const kernel = (imports: string, body: string) => `${imports}\nconst kernel = System.create({
|
|
1212
|
+
const kernel = (imports: string, body: string) => `${imports}\nconst kernel = System.create({ kernel: true, components: { with: [mass, score] } }, (row) => { ${body} });`;
|
|
1106
1213
|
const scores = async (source: string, files: { readonly [file: string]: string }) =>
|
|
1107
1214
|
run(await compile(source, files), 2, { mass: { "[]": [2, 3] } }).field("score");
|
|
1108
1215
|
|
|
@@ -1171,10 +1278,10 @@ describe("imported lists", () => {
|
|
|
1171
1278
|
const files = {
|
|
1172
1279
|
"/components.js": `export const health = "health";\nexport const armor = "armor";\nexport const tagged = "tagged";\n`,
|
|
1173
1280
|
"/archetypes.js": [
|
|
1174
|
-
`import { Archetype } from "ecs";`,
|
|
1175
1281
|
`import { health, armor, tagged } from "./components.js";`,
|
|
1176
1282
|
`export const shield = "shield";`,
|
|
1177
|
-
`export const Unit =
|
|
1283
|
+
`export const Unit = archetype$([health, armor, tagged]);`,
|
|
1284
|
+
`function archetype$(list) { return list; }`,
|
|
1178
1285
|
`export const Guard = [shield, armor];`,
|
|
1179
1286
|
`export const Alias = Unit;`,
|
|
1180
1287
|
`export const Computed = [health].concat([armor]);`,
|
|
@@ -1187,7 +1294,7 @@ describe("imported lists", () => {
|
|
|
1187
1294
|
const Unit = ["health", "armor", "tagged"];
|
|
1188
1295
|
const Guard = ["shield", "armor"];
|
|
1189
1296
|
const commanding = (imports: string, body: string) =>
|
|
1190
|
-
`${imports}\nconst kernel = System.create({
|
|
1297
|
+
`${imports}\nconst kernel = System.create({ kernel: true, components: { with: [mass] } }, (row, { commands }) => { ${body} });`;
|
|
1191
1298
|
|
|
1192
1299
|
test("name the keys of a list imported from another module, by the kernel's bindings or else through the list", async () => {
|
|
1193
1300
|
const source = commanding(`import { health, armor } from "./components.js";\nimport { Unit, Guard } from "./archetypes.js";`, `
|
|
@@ -1226,16 +1333,16 @@ describe("imported lists", () => {
|
|
|
1226
1333
|
|
|
1227
1334
|
test("in a declaration, bind keys the list's module defines to the kernel's imports of them, under any name", async () => {
|
|
1228
1335
|
const source = `import { shield, Guard } from "./archetypes.js";\nimport { armor as plate } from "./components.js";
|
|
1229
|
-
const kernel = System.create({
|
|
1336
|
+
const kernel = System.create({ kernel: true, components: { with: [score, ...Guard] } }, (row) => { row[score] = row[shield] * 10 + row[plate]; });`;
|
|
1230
1337
|
const kernel = await compile(source, files, { shield: "shield", Guard, plate: "armor" });
|
|
1231
1338
|
expect(run(kernel, 2, { shield: { "[]": [1, 2] }, armor: { "[]": [3, 4] } }).field("score")).toEqual([13, 24]);
|
|
1339
|
+
// What it requires but doesn't use, it only requires.
|
|
1232
1340
|
expect(await failure(`import { shield, Guard } from "./archetypes.js";
|
|
1233
|
-
const kernel = System.create({
|
|
1234
|
-
.toBe("Guard[1] is in components read but never read; remove it, or move it to components has to keep requiring it");
|
|
1341
|
+
const kernel = System.create({ kernel: true, components: { with: [score, ...Guard] } }, (row) => { row[score] = row[shield]; });`, files)).toBe("compiled");
|
|
1235
1342
|
});
|
|
1236
1343
|
|
|
1237
1344
|
test.each([
|
|
1238
|
-
["computed when its module runs", "commands.spawn(Computed)({});", "commands.spawn: Computed is computed when /archetypes.js runs, so the compiler can't read its components; declare it as an array literal,
|
|
1345
|
+
["computed when its module runs", "commands.spawn(Computed)({});", "commands.spawn: Computed is computed when /archetypes.js runs, so the compiler can't read its components; declare it as an array literal, `as const`"],
|
|
1239
1346
|
["not a const", "commands.spawn(Changing)({});", "commands.spawn: Changing isn't a module-scope const, so the compiler can't read its components"],
|
|
1240
1347
|
["holding a spread", "commands.spawn(Spread)({});", "commands.spawn: Spread names a key by something other than an identifier bound at the scope of /archetypes.js"],
|
|
1241
1348
|
["not exported", "commands.spawn(Missing)({});", "commands.spawn: Missing isn't exported by /archetypes.js"],
|
|
@@ -1266,7 +1373,7 @@ const kernel = System.create({ name: "a", kernel: "cpu", components: { read: Gua
|
|
|
1266
1373
|
});
|
|
1267
1374
|
|
|
1268
1375
|
test.each([
|
|
1269
|
-
["computed when its module runs", "commands.add(row.entity, Computed, {});", "commands.add: Computed is computed when /archetypes.js runs, so the compiler can't tell whether it's a key or a list; declare a key as Symbol(...), or a list as an array literal
|
|
1376
|
+
["computed when its module runs", "commands.add(row.entity, Computed, {});", "commands.add: Computed is computed when /archetypes.js runs, so the compiler can't tell whether it's a key or a list; declare a key as Symbol(...), or a list as an array literal, `as const`"],
|
|
1270
1377
|
["not a const", "commands.remove(row.entity, Changing);", "commands.remove: Changing isn't a module-scope const, so the compiler can't tell whether it's a key or a list"],
|
|
1271
1378
|
["not exported", "commands.remove(row.entity, Missing);", "commands.remove: Missing isn't exported by /archetypes.js"],
|
|
1272
1379
|
["a namespace", "commands.add(row.entity, Archetypes, 1);", "commands.add: Archetypes is a module namespace, not a key or a list of components"],
|
|
@@ -1282,140 +1389,146 @@ const kernel = System.create({ name: "a", kernel: "cpu", components: { read: Gua
|
|
|
1282
1389
|
|
|
1283
1390
|
test("fail the build for a declaration's list computed when its module runs", async () => {
|
|
1284
1391
|
expect(await failure(`import { Computed } from "./archetypes.js";
|
|
1285
|
-
const kernel = System.create({
|
|
1286
|
-
.toBe("components.
|
|
1392
|
+
const kernel = System.create({ kernel: true, components: { with: Computed } }, (row) => { void row.entity; });`, files))
|
|
1393
|
+
.toBe("components.with: Computed is computed when /archetypes.js runs, so the compiler can't read its components; declare it as an array literal, `as const`");
|
|
1287
1394
|
});
|
|
1288
1395
|
});
|
|
1289
1396
|
|
|
1290
|
-
describe("
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
const
|
|
1315
|
-
expect(
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
expect(
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
expect(await
|
|
1338
|
-
|
|
1339
|
-
expect(await
|
|
1340
|
-
"
|
|
1341
|
-
expect(await
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
expect(await
|
|
1349
|
-
|
|
1350
|
-
expect(await
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
expect(await
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
expect(await
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
expect(
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
expect(await
|
|
1380
|
-
|
|
1381
|
-
expect(await
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
const
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
expect(await
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
expect(await
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
expect(await
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
expect(await
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
expect(await
|
|
1397
|
+
describe("inferred access", () => {
|
|
1398
|
+
/** What the build inferred the first system's body uses, as the source it gives its declaration, or why it failed. */
|
|
1399
|
+
const inferred = async (source: string): Promise<string> => {
|
|
1400
|
+
const result = await transform(source);
|
|
1401
|
+
if (result === null) return "none";
|
|
1402
|
+
if ("failure" in result) return result.failure.message;
|
|
1403
|
+
return /\{ components: .*?, at: "[^"]*" \}/.exec(result.code)?.[0] ?? "none";
|
|
1404
|
+
};
|
|
1405
|
+
const system = (declaration: string, body: string) => `const system = System.create({ ${declaration} }, ${body});`;
|
|
1406
|
+
|
|
1407
|
+
test("a row's reads and writes, its members in with's order", async () => {
|
|
1408
|
+
expect(await inferred(system("components: { with: [position, velocity, mass] }", "(row) => { row[velocity] = row[mass] + row[position]; }")))
|
|
1409
|
+
.toContain("components: { read: [position, mass], write: [velocity] }");
|
|
1410
|
+
expect(await inferred(system("components: { with: [score] }", "(row) => { row[score] += 1; }"))).toContain("components: { read: [], write: [score] }");
|
|
1411
|
+
expect(await inferred(system("components: { with: [position, mass] }", "({ [position]: p, entity }) => { console.log(p, entity); }")))
|
|
1412
|
+
.toContain("components: { read: [position], write: [] }");
|
|
1413
|
+
});
|
|
1414
|
+
|
|
1415
|
+
test("a row it can't follow as unknown, which the world takes as every member written, with a warning", async () => {
|
|
1416
|
+
const result = await transform(system("components: { with: [position] }", "(row) => { helper(row); }"));
|
|
1417
|
+
expect(result !== null && "code" in result ? [result.code.includes("components: null"), result.warnings.length] : null).toEqual([true, 1]);
|
|
1418
|
+
});
|
|
1419
|
+
|
|
1420
|
+
test("an observer's row it can't follow as unknown without a warning, since the world takes an observer's as read", async () => {
|
|
1421
|
+
const result = await transform(system("observer: true, components: { with: [position] }", "(row) => { helper(row); }"));
|
|
1422
|
+
expect(result !== null && "code" in result ? [result.code.includes("components: null"), result.warnings] : null).toEqual([true, []]);
|
|
1423
|
+
});
|
|
1424
|
+
|
|
1425
|
+
test("a row it can't follow with a warning unless the declaration says observer: true, as the world reads it", async () => {
|
|
1426
|
+
for (const observer of ["observer: false, ", "observer: watching, "]) {
|
|
1427
|
+
const result = await transform(`const watching = true;\n${system(`${observer}components: { with: [position] }`, "(row) => { helper(row); }")}`);
|
|
1428
|
+
expect(result !== null && "code" in result ? result.warnings.length : null).toBe(1);
|
|
1429
|
+
}
|
|
1430
|
+
});
|
|
1431
|
+
|
|
1432
|
+
test("a lookup's rows it can't follow without a warning, since what they hold is what the declaration says", async () => {
|
|
1433
|
+
const result = await transform(system("components: { with: [target] }, lookup: { targets: { with: [mass] } }", "(row, { lookup }) => { helper(lookup.targets(row[target])); }"));
|
|
1434
|
+
expect(result !== null && "code" in result ? [result.code.includes(`"targets": null`), result.warnings] : null).toEqual([true, []]);
|
|
1435
|
+
});
|
|
1436
|
+
|
|
1437
|
+
test("warnings name the module by the label given, with line and column", async () => {
|
|
1438
|
+
const result = await transformKernels(`${header}${system("components: { with: [position] }", "(row) => { helper(row); }")}`, "/repo/app/src/features/a/model.ts", parse,
|
|
1439
|
+
async specifier => specifier === "ecs" ? ownCopy : null, () => "", createLinker(host({}, reductions), parse), true, "src/features/a/model.ts");
|
|
1440
|
+
expect(result !== null && "code" in result ? result.warnings.map(warning => /^[^ ]*:/.exec(warning)?.[0]) : null).toEqual([`src/features/a/model.ts:${header.split("\n").length}:${"const system = System.create({ components: { with: [position] } }, ".length + 1}:`]);
|
|
1441
|
+
});
|
|
1442
|
+
|
|
1443
|
+
test("resources read, written and reduced, however its context reaches them", async () => {
|
|
1444
|
+
expect(await inferred(system("", "(context) => { context.resources[score] = context.resources[delta]; }")))
|
|
1445
|
+
.toContain("resources: { read: [delta], write: [score], reduce: [] }");
|
|
1446
|
+
expect(await inferred(system("", "(context) => { const { resources } = context; resources[score] += 1; }")))
|
|
1447
|
+
.toContain("resources: { read: [score], write: [score], reduce: [] }");
|
|
1448
|
+
expect(await inferred(system("", "({ resources: { [delta]: d } }) => { console.log(d); }"))).toContain("resources: { read: [delta], write: [], reduce: [] }");
|
|
1449
|
+
expect(await inferred(`const total = "total";\n${system("components: { with: [mass] }", "(row, { reduce }) => { reduce[total](row[mass]); }")}`))
|
|
1450
|
+
.toContain("resources: { read: [], write: [], reduce: [total] }");
|
|
1451
|
+
expect(await inferred(system("", "(context) => { helper(context); }"))).toContain("resources: null");
|
|
1452
|
+
});
|
|
1453
|
+
|
|
1454
|
+
test("what a lookup's rows are read for, by entity and through an index, or unknown", async () => {
|
|
1455
|
+
expect(await inferred(system("components: { with: [target] }, lookup: { targets: { with: [mass, position] } }",
|
|
1456
|
+
"(row, { lookup }) => { console.log(lookup.targets(row[target])?.[mass]); }"))).toContain(`lookup: { "targets": [mass] }`);
|
|
1457
|
+
expect(await inferred(system("components: { with: [target] }, lookup: { near: { index: grid } }",
|
|
1458
|
+
"(row, { lookup }) => { const near = lookup.near(row[target]); console.log(near.at(0)[mass], near.length); }"))).toContain(`lookup: { "near": [mass] }`);
|
|
1459
|
+
expect(await inferred(system("components: { with: [target] }, lookup: { targets: { with: [mass] } }",
|
|
1460
|
+
"(row, { lookup }) => { helper(lookup.targets(row[target])); }"))).toContain(`lookup: { "targets": null }`);
|
|
1461
|
+
});
|
|
1462
|
+
|
|
1463
|
+
test("what its body reads of its parent", async () => {
|
|
1464
|
+
expect(await inferred(system("components: { with: [mass, score] }, up: { through: target }", "(row, { up }) => { row[score] = (up === null ? 0 : up[score]) + row[mass]; }")))
|
|
1465
|
+
.toContain("up: [score]");
|
|
1466
|
+
});
|
|
1467
|
+
|
|
1468
|
+
test("fail the build for a key a body uses that its declaration doesn't require", async () => {
|
|
1469
|
+
expect(await inferred(system("components: { with: [position] }", "(row) => { console.log(row[mass]); }")))
|
|
1470
|
+
.toBe("mass isn't in components with or optional, so the system doesn't require it: add it there to use it");
|
|
1471
|
+
expect(await inferred(system("components: { with: [target] }, lookup: { targets: { with: [mass] } }", "(row, { lookup }) => { console.log(lookup.targets(row[target])?.[position]); }")))
|
|
1472
|
+
.toBe("position isn't in lookup.targets.with or optional, so the system doesn't require it: add it there to use it");
|
|
1473
|
+
});
|
|
1474
|
+
|
|
1475
|
+
test("finalizers, in files that import only Finalizer", async () => {
|
|
1476
|
+
const result = await transformKernels(`import { Finalizer } from "ecs";\nconst handle = "handle";\nconst count = "count";\nconst f = Finalizer.create({ components: { with: [handle, count] } }, (row, { resources }) => { console.log(row[handle], resources[count]); });`,
|
|
1477
|
+
"/finalizer.js", parse, async specifier => specifier === "ecs" ? ownCopy : null, index => JSON.stringify(`kernel:${index}`));
|
|
1478
|
+
expect(result !== null && "code" in result ? result.code : "").toContain("{ components: { read: [handle], write: [] }, resources: { read: [count], write: [], reduce: [] }");
|
|
1479
|
+
});
|
|
1480
|
+
|
|
1481
|
+
test("a destructuring target, or a for…of target, written", async () => {
|
|
1482
|
+
expect(await inferred(system("components: { with: [position] }", "(row) => { ({ x: row[position] } = source); }")))
|
|
1483
|
+
.toContain("components: { read: [], write: [position] }");
|
|
1484
|
+
expect(await inferred(system("components: { with: [position] }", "(row) => { for ({ x: row[position] } of sources); }")))
|
|
1485
|
+
.toContain("components: { read: [], write: [position] }");
|
|
1486
|
+
expect(await inferred(system("components: { with: [position] }", "(row) => { [row[position]] = pair; }")))
|
|
1487
|
+
.toContain("components: { read: [], write: [position] }");
|
|
1488
|
+
expect(await inferred(system("", "(context) => { ({ x: context.resources[score] } = source); }")))
|
|
1489
|
+
.toContain("resources: { read: [], write: [score], reduce: [] }");
|
|
1490
|
+
});
|
|
1491
|
+
|
|
1492
|
+
test("defaults and computed keys of declared patterns, and of parameters, as uses", async () => {
|
|
1493
|
+
expect(await inferred(system("components: { with: [position] }", "(row) => { const { a = (row[position] = 5) } = {}; }")))
|
|
1494
|
+
.toContain("components: { read: [], write: [position] }");
|
|
1495
|
+
expect(await inferred(system("components: { with: [position, velocity] }", "(row) => { const { [row[velocity]]: v } = table; console.log(v); }")))
|
|
1496
|
+
.toContain("components: { read: [velocity], write: [] }");
|
|
1497
|
+
expect(await inferred(system("", "(context) => { const { a = context.resources[delta] } = {}; console.log(a); }")))
|
|
1498
|
+
.toContain("resources: { read: [delta], write: [], reduce: [] }");
|
|
1499
|
+
expect(await inferred(system("components: { with: [position, velocity] }", "(row, context, step = row[velocity]) => { console.log(step); }")))
|
|
1500
|
+
.toContain("components: { read: [velocity], write: [] }");
|
|
1501
|
+
});
|
|
1502
|
+
|
|
1503
|
+
test("what a for…of or for…in loop goes over, as a read", async () => {
|
|
1504
|
+
expect(await inferred(system("", "({ resources }) => { for (const name of resources[delta]) console.log(name); }")))
|
|
1505
|
+
.toContain("resources: { read: [delta], write: [], reduce: [] }");
|
|
1506
|
+
expect(await inferred(system("components: { with: [position] }", "(row) => { for (const x of row[position]) console.log(x); }")))
|
|
1507
|
+
.toContain("components: { read: [position], write: [] }");
|
|
1508
|
+
});
|
|
1509
|
+
|
|
1510
|
+
test("a change inside a value, at any depth, as a change in place, for registration to judge by its kind", async () => {
|
|
1511
|
+
expect(await inferred(system("components: { with: [position] }", "(row) => { row[position].a.b = 1; }")))
|
|
1512
|
+
.toContain("components: { read: [position], write: [], mutate: [position] }");
|
|
1513
|
+
expect(await inferred(system("components: { with: [position] }", "(row) => { delete row[position].a; }")))
|
|
1514
|
+
.toContain("components: { read: [position], write: [], mutate: [position] }");
|
|
1515
|
+
expect(await inferred(system("components: { with: [position] }", "(row) => { [row[position][0]] = pair; }")))
|
|
1516
|
+
.toContain("components: { read: [position], write: [], mutate: [position] }");
|
|
1517
|
+
expect(await inferred(system("", "(context) => { context.resources[score].a = 1; }")))
|
|
1518
|
+
.toContain("resources: { read: [score], write: [], reduce: [], mutate: [score] }");
|
|
1519
|
+
});
|
|
1520
|
+
|
|
1521
|
+
test("a body mentioning eval as one it can't follow", async () => {
|
|
1522
|
+
expect(await inferred(system("components: { with: [position] }", "(row) => { eval(\"row[position] = 1\"); }"))).toContain("components: null");
|
|
1523
|
+
});
|
|
1524
|
+
|
|
1525
|
+
test("fail the build for an async or generator body", async () => {
|
|
1526
|
+
expect(await inferred(system("components: { with: [position] }", "async (row) => { row[position] = 1; }"))).toContain("a body can't be async");
|
|
1527
|
+
expect(await inferred(system("components: { with: [position] }", "function* (row) { row[position] = 1; }"))).toContain("a body can't be a generator");
|
|
1528
|
+
});
|
|
1529
|
+
|
|
1530
|
+
test("a body given by name, read where it's bound", async () => {
|
|
1531
|
+
expect(await inferred(`const move = (row) => { row[position] = row[velocity]; };\n${system("components: { with: [position, velocity] }", "move")}`))
|
|
1532
|
+
.toContain("components: { read: [velocity], write: [position] }");
|
|
1420
1533
|
});
|
|
1421
1534
|
});
|