@adobe/ecs 0.1.0 → 0.2.1
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.d.ts +20 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/interface/component/component.d.ts +7 -1
- package/dist/interface/component/component.js.map +1 -1
- package/dist/interface/component/index.d.ts +1 -2
- 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 +12 -7
- package/dist/interface/component/values.d.ts +2 -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 +17 -14
- 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/condition.d.ts +3 -3
- package/dist/interface/resource/index.d.ts +0 -2
- package/dist/interface/resource/index.js +1 -1
- package/dist/interface/resource/index.js.map +1 -1
- package/dist/interface/resource/resource.d.ts +4 -1
- package/dist/interface/resource/resource.js.map +1 -1
- package/dist/interface/resource/types.d.ts +4 -1
- package/dist/interface/resource/value.d.ts +5 -5
- package/dist/interface/resources/always.js +3 -2
- package/dist/interface/resources/always.js.map +1 -1
- package/dist/interface/resources/cadence.d.ts +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 +55 -6
- 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/struct.d.ts +2 -2
- 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 +15 -15
- 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 +26 -8
- package/dist/interface/world/create.d.ts +9 -7
- 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 +3 -5
- 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 +12 -14
- 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 +489 -253
- 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 +49 -17
- 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 +21 -1
- 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 +7 -6
- 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 +29 -1
- package/src/interface/CLAUDE.md +1 -1
- package/src/interface/component/component.ts +8 -1
- package/src/interface/component/index.ts +2 -2
- 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 +14 -7
- package/src/interface/component/values.ts +3 -2
- package/src/interface/entity/entity.ts +1 -0
- package/src/interface/entity/index.ts +4 -0
- package/src/interface/finalizer/body.ts +15 -14
- 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 +12 -15
- 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 +4 -3
- package/src/interface/resource/index.ts +1 -2
- 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 +5 -1
- package/src/interface/resource/types.ts +5 -1
- package/src/interface/resource/value.ts +6 -5
- package/src/interface/resource/written.ts +1 -0
- package/src/interface/resources/always.ts +3 -2
- package/src/interface/resources/cadence.ts +5 -4
- 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 +51 -6
- 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 +3 -2
- 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 +18 -15
- package/src/interface/thread/of.ts +4 -3
- package/src/interface/thread/thread.ts +1 -0
- package/src/interface/thread/thread.type-test.ts +4 -69
- package/src/interface/trait/key.ts +2 -1
- package/src/interface/trait/trait.type-test.ts +8 -81
- package/src/interface/trait/types.ts +21 -8
- package/src/interface/tsconfig.json +1 -1
- package/src/interface/world/create.ts +10 -7
- 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 +4 -5
- package/src/interface/world/loop.type-test.ts +21 -16
- 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 +4 -3
- 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 +2 -1
- package/src/observe/resource.ts +5 -4
- package/src/observe/select.ts +14 -13
- package/src/observe/to-promise.ts +1 -0
- package/src/observe/tsconfig.json +1 -1
- package/src/observe/values.ts +3 -2
- 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,10 +1,12 @@
|
|
|
1
|
+
// © 2026 Adobe. MIT License. See /LICENSE for details.
|
|
1
2
|
import type { Finalizer } from '../../interface/finalizer/created.js';
|
|
2
3
|
import type { Rule } from '../../interface/rule/created.js';
|
|
3
4
|
import { requireDefinition, type Definition } from '../../interface/registry/index.js';
|
|
4
5
|
import type { World } from '../../interface/world/world.js';
|
|
6
|
+
import type { Input } from '../../interface/system/input.js';
|
|
7
|
+
import type { System } from '../../interface/system/system.js';
|
|
5
8
|
import type { Create, InitialResources } from '../../interface/world/create.js';
|
|
6
9
|
import type { Join } from '../../interface/world/join.js';
|
|
7
|
-
import type { Failure } from '../../interface/report/failure.js';
|
|
8
10
|
import { joinWorld } from './join.js';
|
|
9
11
|
import { createSharing, type ThreadProgress } from './sharing.js';
|
|
10
12
|
import { gpuDevice } from '../../interface/resources/gpu-device.js';
|
|
@@ -14,15 +16,11 @@ import { readCell, writeCell } from './cells.js';
|
|
|
14
16
|
import { finalizeAll, refreshFinalizerIndexes, type Thrown } from './finalizers.js';
|
|
15
17
|
import { startWatches } from './indexes.js';
|
|
16
18
|
import { clean as cleanReport, execute, type ExecuteContext } from './execute.js';
|
|
17
|
-
import type
|
|
18
|
-
import {
|
|
19
|
-
import { synchronizeAlone } from './synchronize.js';
|
|
19
|
+
import { errorOfRun, failureOf, type Failure, type RunReport } from './failures.js';
|
|
20
|
+
import { createOutOfBand } from './out-of-band.js';
|
|
20
21
|
import { startRan } from './state.js';
|
|
21
|
-
import type { CommandBuffer } from './buffer.js';
|
|
22
|
-
import { keysOf } from './remote-systems.js';
|
|
23
|
-
import { Report } from '../../interface/report/report.js';
|
|
24
22
|
import { joinedIn, runObserver } from './observer.js';
|
|
25
|
-
import { joinedRunOf, postObserver, settlePosts, settleObserverKeys } from './joined-observer.js';
|
|
23
|
+
import { awaitPost, joinedRunOf, postObserver, settlePosts, settleObserverKeys, type PostResult } from './joined-observer.js';
|
|
26
24
|
import type { Leaf } from '../../interface/system/leaf.js';
|
|
27
25
|
import { settleKeys, type TailOutcome } from './tails.js';
|
|
28
26
|
import { sharedMemoryAvailable } from './memory.js';
|
|
@@ -36,29 +34,70 @@ import { createRegistrar, type Registration } from './register.js';
|
|
|
36
34
|
import type { Schedule } from '../../interface/registry/schedule.js';
|
|
37
35
|
import { ensureResources, findResource, initialOf, setResource } from './resources.js';
|
|
38
36
|
import { ensureProgramResources, activate, finalizerCrossing, placeFinalizers } from './activate.js';
|
|
39
|
-
import {
|
|
37
|
+
import { isObserver, isWorldWritten, kindOf, programVersion, scheduleOf, type Composite } from '../../interface/registry/index.js';
|
|
40
38
|
import { always } from '../../interface/resources/always.js';
|
|
41
39
|
import { cadence, type Cadence } from '../../interface/resources/cadence.js';
|
|
42
40
|
import { clock } from '../../interface/resources/clock.js';
|
|
43
41
|
import { wake } from '../../interface/resources/wake.js';
|
|
44
42
|
import { stampChanged } from './archetype.js';
|
|
45
|
-
import { failureOf } from './failures.js';
|
|
46
43
|
import { createLoop, platformFrame, platformTimer, type Clock, type LoopPlatform } from './loop.js';
|
|
44
|
+
import { presetLevelsOf } from './lists.js';
|
|
47
45
|
import { createState, defaultOf, idOf, reside, startTicking, type Key } from './state.js';
|
|
48
46
|
import { indexOf } from './entities.js';
|
|
47
|
+
import { touchedHeld } from './up.js';
|
|
49
48
|
import { isHeld } from './transfers.js';
|
|
50
|
-
import type {
|
|
51
|
-
import { labelOf,
|
|
49
|
+
import type { ReadonlyType as ReadonlyResourceType } from '../../interface/resource/value.js';
|
|
50
|
+
import { labelOf, whyUnregistered } from '../../interface/registry/index.js';
|
|
52
51
|
|
|
53
52
|
type Queue = <T>(task: () => T | Promise<T>) => Promise<T>;
|
|
54
53
|
|
|
55
|
-
/**
|
|
54
|
+
/** A task's failure as the queue's own chain carries it, which never rejects: made only when a task fails. */
|
|
55
|
+
type Carried = { readonly thrown: unknown };
|
|
56
|
+
const thrownValues = new WeakSet<object>();
|
|
57
|
+
const thrownOf = (error: unknown): Carried => {
|
|
58
|
+
const wrapped = { thrown: error };
|
|
59
|
+
thrownValues.add(wrapped);
|
|
60
|
+
return wrapped;
|
|
61
|
+
};
|
|
62
|
+
const isThrown = (value: unknown): value is Carried => typeof value === "object" && value !== null && thrownValues.has(value);
|
|
63
|
+
/** What a task's caller gets: its value, or its failure thrown. */
|
|
64
|
+
const unwrap = (value: unknown): unknown => {
|
|
65
|
+
if (isThrown(value)) throw value.thrown;
|
|
66
|
+
return value;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Runs tasks one at a time, in call order; a failed task doesn't block the next. The queue's own chain never rejects,
|
|
71
|
+
* carrying a failure as a value, and the promise a task's caller holds is a second one, which nothing in the queue
|
|
72
|
+
* handles, so a rejection nobody awaits is unhandled, whatever follows it. Tasks wait in order in an array, which one
|
|
73
|
+
* shared step takes from, so queuing one makes no closure.
|
|
74
|
+
*/
|
|
56
75
|
const createQueue = (): Queue => {
|
|
57
76
|
let tail: Promise<unknown> = Promise.resolve();
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
77
|
+
const tasks: ((() => unknown) | undefined)[] = [];
|
|
78
|
+
let count = 0;
|
|
79
|
+
let next = 0;
|
|
80
|
+
const step = (): unknown => {
|
|
81
|
+
const k = next++;
|
|
82
|
+
const task = tasks[k];
|
|
83
|
+
// Let go, so the queue holds a task only until it starts; the slots past the last are reused.
|
|
84
|
+
tasks[k] = undefined;
|
|
85
|
+
if (next === count) next = count = 0;
|
|
86
|
+
if (task === undefined) return undefined;
|
|
87
|
+
try {
|
|
88
|
+
const value = task();
|
|
89
|
+
return value instanceof Promise ? value.then(undefined, thrownOf) : value;
|
|
90
|
+
}
|
|
91
|
+
catch (error) {
|
|
92
|
+
return thrownOf(error);
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
return <T>(task: () => T | Promise<T>): Promise<T> => {
|
|
96
|
+
tasks[count++] = task;
|
|
97
|
+
const settled = tail.then(step);
|
|
98
|
+
tail = settled;
|
|
99
|
+
// What `unwrap` gives is the task's own value, a `T`, or it throws.
|
|
100
|
+
return settled.then(unwrap) as Promise<T>;
|
|
62
101
|
};
|
|
63
102
|
};
|
|
64
103
|
|
|
@@ -91,8 +130,17 @@ export type Tables = {
|
|
|
91
130
|
readonly phasedBuilds: number;
|
|
92
131
|
readonly pooledBuilds: number;
|
|
93
132
|
readonly journalReaders: number;
|
|
133
|
+
/** Entities filtered `up`s were told changed, held until their next run. */
|
|
134
|
+
readonly touched: number;
|
|
94
135
|
/** Bytes the arena holds. */
|
|
95
136
|
readonly arena: number;
|
|
137
|
+
/** Archetypes it made. */
|
|
138
|
+
readonly archetypes: number;
|
|
139
|
+
/**
|
|
140
|
+
* Of shared values (`reclaim.ts`): archetypes reclaimed and waiting for reuse, how many times one was reclaimed or
|
|
141
|
+
* reused, values interned, spawn batches, and levels of spawners with constants.
|
|
142
|
+
*/
|
|
143
|
+
readonly sharing: { readonly pooled: number; readonly membership: number; readonly values: number; readonly batches: number; readonly presets: number };
|
|
96
144
|
/** By joined thread with claims: how many indexes there hold a system, or are held until it drops one. */
|
|
97
145
|
readonly joined: readonly number[];
|
|
98
146
|
/** GPU records and index blocks, 0 without a device. */
|
|
@@ -106,6 +154,58 @@ export type Tables = {
|
|
|
106
154
|
*/
|
|
107
155
|
export type CreatedWorld = World & { readonly threads: (notify: (value: readonly ThreadProgress[]) => void) => () => void; readonly tables: () => Promise<Tables> };
|
|
108
156
|
|
|
157
|
+
/** For tests: what a run or tick went through: what went wrong, and what it ran, where. */
|
|
158
|
+
export type Outcome = RunReport & {
|
|
159
|
+
readonly systems: number;
|
|
160
|
+
readonly workers: number;
|
|
161
|
+
readonly joined: number;
|
|
162
|
+
readonly main: boolean;
|
|
163
|
+
readonly gpu: boolean;
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* For tests: by the promise a run returned, its outcome once its systems ran, null until then and for one that failed
|
|
168
|
+
* before they did; listeners each told every run's, joined threads' included, as it settles; and listeners each told a
|
|
169
|
+
* tick's once its tails are done.
|
|
170
|
+
*/
|
|
171
|
+
export type Recorder = {
|
|
172
|
+
readonly runs: WeakMap<Promise<unknown>, { outcome: Outcome | null }>;
|
|
173
|
+
readonly each: ((outcome: Outcome) => void)[];
|
|
174
|
+
readonly ticks: ((outcome: Outcome) => void)[];
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
const recorders = new WeakMap<World, () => Recorder>();
|
|
178
|
+
|
|
179
|
+
/** For tests: a world's recorder of outcomes, which it keeps from the first call on. */
|
|
180
|
+
export const recorderOf = (world: World): Recorder => {
|
|
181
|
+
const start = recorders.get(world);
|
|
182
|
+
if (start === undefined) throw new Error("Only a world createWorld made records outcomes.");
|
|
183
|
+
return start();
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
/** What a world holds of shared values, for `tables`. */
|
|
187
|
+
const sharingHeld = (state: ReturnType<typeof createState>): Tables["sharing"] => {
|
|
188
|
+
let pooled = 0;
|
|
189
|
+
for (const pool of state.pools.values()) pooled += pool.length;
|
|
190
|
+
let values = 0;
|
|
191
|
+
for (const interned of state.shared) values += interned?.byText.size ?? 0;
|
|
192
|
+
let presets = 0;
|
|
193
|
+
for (const shape of state.shapes) presets += presetLevelsOf(shape);
|
|
194
|
+
return { pooled, membership: state.membership.base + state.membership.log.length, values, batches: state.batches.length, presets };
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
const tickers = new WeakMap<World, (tick: number) => void>();
|
|
198
|
+
|
|
199
|
+
/** For tests: moves a world's tick on to `tick` before it ran anything, as a long-running world's would be. */
|
|
200
|
+
export const startTicksAt = (world: World, tick: number): void => {
|
|
201
|
+
const start = tickers.get(world);
|
|
202
|
+
if (start === undefined) throw new Error("Only a world createWorld made starts its ticks elsewhere.");
|
|
203
|
+
start(tick);
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
/** What fails starting the pool: the workers, always the same subject, so a pool failing again isn't reported again. */
|
|
207
|
+
const poolWorkers = { name: "workers", id: null };
|
|
208
|
+
|
|
109
209
|
/** The loop's state, added to a world when its first tick runs. */
|
|
110
210
|
const loopResources: readonly Key[] = [cadence, always, wake, clock];
|
|
111
211
|
|
|
@@ -134,12 +234,14 @@ const withTails = (report: RunReport, { failures, skipped }: TailOutcome): RunRe
|
|
|
134
234
|
...report, failures: failures === null ? report.failures : [...report.failures, ...failures], skipped: skipped === null ? report.skipped : [...report.skipped, ...skipped],
|
|
135
235
|
};
|
|
136
236
|
|
|
137
|
-
/**
|
|
138
|
-
const
|
|
237
|
+
/** A list, or null for an empty one. */
|
|
238
|
+
const listed = <T>(list: readonly T[]): readonly T[] | null => list.length === 0 ? null : list;
|
|
239
|
+
|
|
240
|
+
/** Whether `subject` is what one of `failures` failed. */
|
|
241
|
+
const failedIn = (failures: readonly Failure[] | null, subject: object): boolean => failures !== null && failures.some(failure => failure.subject === subject);
|
|
139
242
|
|
|
140
|
-
/**
|
|
141
|
-
const
|
|
142
|
-
leaves.some(leaf => [...keysOf(leaf), ...orderKeysOf(leaf.declaration)].some(key => reportKeys.has(firstKeyOf(key))));
|
|
243
|
+
/** What no joined thread gave a run: its value is its runner's. */
|
|
244
|
+
const nothingThere = Symbol("nothing there");
|
|
143
245
|
|
|
144
246
|
/** Creates a world on this thread, as `World.create` does, with options for tests and benchmarks. */
|
|
145
247
|
export const createWorld = (resources: InitialResources = {}, options: WorldOptions = {}): CreatedWorld => {
|
|
@@ -147,13 +249,14 @@ export const createWorld = (resources: InitialResources = {}, options: WorldOpti
|
|
|
147
249
|
const initial = new Map<Key, unknown>();
|
|
148
250
|
// String keys are never a resource's, so they're ignored, as commands ignore them.
|
|
149
251
|
for (const key of Object.getOwnPropertySymbols(resources)) {
|
|
150
|
-
if (kindOf(key) !== "resource") throw new Error(`"${labelOf(key)}" isn't a registered resource.`);
|
|
252
|
+
if (kindOf(key) !== "resource") throw new Error(`"${labelOf(key)}" isn't a registered resource: ${whyUnregistered(key)}.`);
|
|
151
253
|
if (isWorldWritten(key)) throw new Error(`"${labelOf(key)}" is written only by the world.`);
|
|
152
254
|
initial.set(key, Reflect.get(resources, key));
|
|
153
255
|
}
|
|
154
256
|
const device = resources[gpuDevice] ?? null;
|
|
155
257
|
const state = createState(shared, options.wasm ?? true, options.simd ?? true, device !== null, initial);
|
|
156
|
-
|
|
258
|
+
const outOfBand = createOutOfBand();
|
|
259
|
+
if (device !== null) state.gpu = createGpu(device, outOfBand);
|
|
157
260
|
const registrar = createRegistrar(state);
|
|
158
261
|
const enqueue = createQueue();
|
|
159
262
|
/** Where pool workers come from; none without shared memory. */
|
|
@@ -164,7 +267,6 @@ export const createWorld = (resources: InitialResources = {}, options: WorldOpti
|
|
|
164
267
|
let pool: Pool | null = null;
|
|
165
268
|
const context: { -readonly [K in keyof ExecuteContext]: ExecuteContext[K] } = {
|
|
166
269
|
state, runnerOf: registrar.runnerOf, kernelIndexOf: registrar.kernelIndexOf, workers: null, publish: () => {}, tails: null,
|
|
167
|
-
beforeSync: (failures, skipped, warnings, warningCount) => reports.beforeSync(failures, skipped, warnings, warningCount),
|
|
168
270
|
};
|
|
169
271
|
|
|
170
272
|
/** Waits for every joined thread's task in flight, as a tail may be, before what moves rows a tail may still read. */
|
|
@@ -177,6 +279,8 @@ export const createWorld = (resources: InitialResources = {}, options: WorldOpti
|
|
|
177
279
|
let disposed = false;
|
|
178
280
|
const ensured = { version: -1 };
|
|
179
281
|
|
|
282
|
+
const minimumChunk = options.minimumChunk ?? defaultMinimumChunk;
|
|
283
|
+
|
|
180
284
|
/** Starts the pool with as many of the wanted workers as the platform has, or none: then kernels run here. */
|
|
181
285
|
const startPool = (): Pool | null => {
|
|
182
286
|
const ports: WorkerPort[] = [];
|
|
@@ -186,11 +290,15 @@ export const createWorld = (resources: InitialResources = {}, options: WorldOpti
|
|
|
186
290
|
ports.push(port);
|
|
187
291
|
}
|
|
188
292
|
workerCount = state.workers = ports.length;
|
|
189
|
-
if (ports.length === 0)
|
|
293
|
+
if (ports.length === 0) {
|
|
294
|
+
followPoolThreshold();
|
|
295
|
+
return null;
|
|
296
|
+
}
|
|
190
297
|
const started = createPool(ports, state.memory);
|
|
191
298
|
pool = started;
|
|
192
|
-
context.workers = { pool: started, minimumChunk
|
|
299
|
+
context.workers = { pool: started, minimumChunk, next: 0 };
|
|
193
300
|
context.publish = createPublisher(state, started);
|
|
301
|
+
followPoolThreshold();
|
|
194
302
|
return started;
|
|
195
303
|
};
|
|
196
304
|
|
|
@@ -207,9 +315,51 @@ export const createWorld = (resources: InitialResources = {}, options: WorldOpti
|
|
|
207
315
|
return loadAll(runners);
|
|
208
316
|
};
|
|
209
317
|
|
|
210
|
-
/**
|
|
318
|
+
/** Whether kernels failed to load on the workers a run started: then they run here, and no pool starts again. */
|
|
319
|
+
let workersFailed = false;
|
|
320
|
+
|
|
321
|
+
/** Whether an archetype a kernel matches has rows enough for workers, as kernels loading look before the pool starts. */
|
|
322
|
+
const kernelsWarrant = (): boolean => {
|
|
323
|
+
for (const runner of registrar.kernels()) for (const archetype of runner.matched()) if (archetype.count >= state.poolThreshold) return true;
|
|
324
|
+
return false;
|
|
325
|
+
};
|
|
326
|
+
|
|
327
|
+
/** Lets kernels running here want the pool, at half a piece, while one could start; once started, none want it. */
|
|
328
|
+
const followPoolThreshold = (): void => {
|
|
329
|
+
state.poolThreshold = pool === null && workerCount > 0 && !workersFailed ? minimumChunk / 2 : Infinity;
|
|
330
|
+
state.poolWanted = false;
|
|
331
|
+
};
|
|
332
|
+
followPoolThreshold();
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* Starts the pool after a run whose kernel ran here over rows enough for workers. Kernels failing to load on it are
|
|
336
|
+
* reported out of band, and the pool ends, so kernels run here from then on rather than every
|
|
337
|
+
* run trying again.
|
|
338
|
+
*/
|
|
339
|
+
const startWorkers = async (): Promise<void> => {
|
|
340
|
+
try {
|
|
341
|
+
await loadOnWorkers();
|
|
342
|
+
}
|
|
343
|
+
catch (error) {
|
|
344
|
+
workersFailed = true;
|
|
345
|
+
workersBehind = false;
|
|
346
|
+
const failed = pool;
|
|
347
|
+
pool = null;
|
|
348
|
+
context.workers = null;
|
|
349
|
+
context.publish = () => {};
|
|
350
|
+
for (const runner of registrar.kernels()) runner.kernel?.unloadedOnWorkers();
|
|
351
|
+
if (failed !== null) void failed.terminate();
|
|
352
|
+
outOfBand.report(failureOf("workers", poolWorkers, error));
|
|
353
|
+
}
|
|
354
|
+
followPoolThreshold();
|
|
355
|
+
};
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* Gives workers every kernel whose main-thread load is newer than theirs, including ones a failed registration
|
|
359
|
+
* reloaded, starting the pool once a kernel ran here over rows enough for workers.
|
|
360
|
+
*/
|
|
211
361
|
const loadOnWorkers = async (): Promise<void> => {
|
|
212
|
-
if (workerCount === 0 || !workersBehind) return;
|
|
362
|
+
if (workerCount === 0 || !workersBehind || (pool === null && !state.poolWanted && !kernelsWarrant())) return;
|
|
213
363
|
const behind = registrar.kernels().filter(runner => runner.kernel?.staleOnWorkers() === true);
|
|
214
364
|
if (behind.length === 0) {
|
|
215
365
|
workersBehind = false;
|
|
@@ -275,12 +425,12 @@ export const createWorld = (resources: InitialResources = {}, options: WorldOpti
|
|
|
275
425
|
const deviceId = idOf(state, gpuDevice);
|
|
276
426
|
const deviceDefault = defaultOf(gpuDevice);
|
|
277
427
|
/** The `gpuDevice` resource's value, read each run, so without allocating. */
|
|
278
|
-
const readDevice = ():
|
|
428
|
+
const readDevice = (): ReadonlyResourceType<typeof gpuDevice> => {
|
|
279
429
|
const index = state.resourceEntity < 0 ? -1 : indexOf(state.resourceEntity);
|
|
280
430
|
const storage = index < 0 ? undefined : state.archetypes[state.entities.archetype[index]]?.storageById[deviceId];
|
|
281
431
|
const value = storage !== undefined ? readCell(storage, state.entities.row[index]) : state.initial.has(gpuDevice) ? state.initial.get(gpuDevice) : deviceDefault;
|
|
282
432
|
// The resource's value matches its registered schema, `GPUDevice | null`.
|
|
283
|
-
return value as
|
|
433
|
+
return value as ReadonlyResourceType<typeof gpuDevice>;
|
|
284
434
|
};
|
|
285
435
|
|
|
286
436
|
/**
|
|
@@ -305,7 +455,7 @@ export const createWorld = (resources: InitialResources = {}, options: WorldOpti
|
|
|
305
455
|
await current.readback();
|
|
306
456
|
current.destroy();
|
|
307
457
|
}
|
|
308
|
-
state.gpu = device === null ? null : createGpu(device);
|
|
458
|
+
state.gpu = device === null ? null : createGpu(device, outOfBand);
|
|
309
459
|
state.touched = device === null ? null : new Set();
|
|
310
460
|
await load(registrar.placeGpuKernels());
|
|
311
461
|
await loadOnWorkers();
|
|
@@ -332,6 +482,7 @@ export const createWorld = (resources: InitialResources = {}, options: WorldOpti
|
|
|
332
482
|
const wanted = platform === null ? 0 : workersOf(platform, readResource(workers));
|
|
333
483
|
if (wanted === workerCount) return;
|
|
334
484
|
workerCount = wanted;
|
|
485
|
+
workersFailed = false;
|
|
335
486
|
state.workers = wanted;
|
|
336
487
|
const old = pool;
|
|
337
488
|
pool = null;
|
|
@@ -339,6 +490,7 @@ export const createWorld = (resources: InitialResources = {}, options: WorldOpti
|
|
|
339
490
|
context.publish = () => {};
|
|
340
491
|
for (const runner of registrar.kernels()) runner.kernel?.unloadedOnWorkers();
|
|
341
492
|
workersBehind = true;
|
|
493
|
+
followPoolThreshold();
|
|
342
494
|
// The old pool releases its control state once its workers have left their windows; runs don't wait for it.
|
|
343
495
|
if (old !== null) void old.terminate();
|
|
344
496
|
await loadOnWorkers();
|
|
@@ -350,142 +502,228 @@ export const createWorld = (resources: InitialResources = {}, options: WorldOpti
|
|
|
350
502
|
*/
|
|
351
503
|
const skipsSync = (): boolean => state.gpu === null && state.channels.length === 0 && state.tails.length === 0 && state.queued.length === 0 && state.observer.count === 0;
|
|
352
504
|
|
|
353
|
-
/**
|
|
354
|
-
let
|
|
355
|
-
/**
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
if (state.tails.length !== 0) {
|
|
362
|
-
state.queued.push({ buffer, guarded: false });
|
|
363
|
-
return null;
|
|
364
|
-
}
|
|
365
|
-
const settling = state.observer.posts.length === 0 ? null : settlePosts(state, true);
|
|
366
|
-
if (settling === null) {
|
|
367
|
-
synchronizeAlone(state, buffer);
|
|
368
|
-
publishLayouts();
|
|
369
|
-
return null;
|
|
370
|
-
}
|
|
371
|
-
return settling.then(() => {
|
|
372
|
-
if (disposed) return;
|
|
373
|
-
synchronizeAlone(state, buffer);
|
|
374
|
-
publishLayouts();
|
|
375
|
-
});
|
|
505
|
+
/** Records outcomes for tests, from the first `recorderOf` call on; null until then, so runs gather nothing for it. */
|
|
506
|
+
let recorder: Recorder | null = null;
|
|
507
|
+
/** While recording, the records of runs queued, in order, and of the run in progress. */
|
|
508
|
+
const records: { outcome: Outcome | null }[] = [];
|
|
509
|
+
let record: { outcome: Outcome | null } | null = null;
|
|
510
|
+
/** Takes the record of the run starting, the next queued, as each queued run starts in order. */
|
|
511
|
+
const startRecord = (): void => {
|
|
512
|
+
if (recorder !== null) record = records.shift() ?? null;
|
|
376
513
|
};
|
|
377
|
-
|
|
378
|
-
const
|
|
379
|
-
const noIds: readonly number[] = [];
|
|
380
|
-
/** A tick's report, its slot and what it ran, which `perform` leaves without `pass`, with its tails in `tailing`. */
|
|
381
|
-
let performed: RunReport = cleanReport;
|
|
382
|
-
let performedSlot: Slot | null = null;
|
|
383
|
-
let performedValues: RunValues | null = null;
|
|
384
|
-
|
|
385
|
-
/** What the last run ran, for its report, reused run to run: a tick whose report waits for its tails copies it. */
|
|
386
|
-
const ranValues: RunValues = { number: 0, elapsed: 0, systems: 0, workers: 0, joined: 0, main: false, gpu: false, dropped: 0 };
|
|
387
|
-
/** What run `run` ran, gathered by its tiers, once its sync point is done, into `ranValues`. */
|
|
388
|
-
const valuesOf = (run: number, started: number, dropped: number): RunValues => {
|
|
514
|
+
/** What a run or tick went through, for the recorder. */
|
|
515
|
+
const outcomeOf = (report: RunReport): Outcome => {
|
|
389
516
|
const { ran } = state;
|
|
390
|
-
|
|
391
|
-
ranValues.elapsed = performance.now() - started;
|
|
392
|
-
ranValues.systems = ran.systems;
|
|
393
|
-
ranValues.workers = context.workers?.pool.takePosted() ?? 0;
|
|
394
|
-
ranValues.joined = ran.joined.size;
|
|
395
|
-
ranValues.main = ran.main;
|
|
396
|
-
ranValues.gpu = ran.gpu;
|
|
397
|
-
ranValues.dropped = dropped;
|
|
398
|
-
return ranValues;
|
|
517
|
+
return { ...report, systems: ran.systems, workers: context.workers?.pool.takePosted() ?? 0, joined: ran.joined.size, main: ran.main, gpu: ran.gpu };
|
|
399
518
|
};
|
|
400
519
|
|
|
520
|
+
/** A run's or tick's tails, which `execution` leaves here for its caller. */
|
|
521
|
+
let tailing: Promise<TailOutcome> | null = null;
|
|
522
|
+
|
|
401
523
|
/**
|
|
402
|
-
*
|
|
403
|
-
*
|
|
524
|
+
* Runs a registered system or composite, its `schedule`, ending in a sync point, and gives what went wrong; its
|
|
525
|
+
* tails are left in `tailing`. A run with nothing to wait for gives it at once, allocating no async frame; a step
|
|
526
|
+
* that waits goes on, once that's done, in a function of its own.
|
|
404
527
|
*/
|
|
405
|
-
const
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
if (tails === null && posts === null) return reports.finish(slot, values, report, state.tails.length !== 0, defer);
|
|
410
|
-
return Promise.all([tails, posts]).then(() => disposed ? undefined : reports.finish(slot, values, report, state.tails.length !== 0, defer) ?? undefined);
|
|
528
|
+
const execution = (definition: Definition, value: unknown, schedule: Schedule): RunReport | Promise<RunReport> => {
|
|
529
|
+
const preparing = prepareRun();
|
|
530
|
+
if (preparing !== null) return executePrepared(preparing, definition, value, schedule);
|
|
531
|
+
return executeRun(definition, value, schedule);
|
|
411
532
|
};
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
(observerFailures ??= []).push(...failures);
|
|
533
|
+
const executePrepared = async (preparing: Promise<void>, definition: Definition, value: unknown, schedule: Schedule): Promise<RunReport> => {
|
|
534
|
+
await preparing;
|
|
535
|
+
return executeRun(definition, value, schedule);
|
|
416
536
|
};
|
|
417
537
|
|
|
418
|
-
/**
|
|
419
|
-
|
|
420
|
-
* report is written once its tails are done, then observer systems run, their failures added to it; without, its
|
|
421
|
-
* report is left in `performed` and its tails in `tailing`. One async step for all, so a run awaits nothing more.
|
|
422
|
-
* `registered` is its schedule as it was registered, which it runs if a system it holds was removed since,
|
|
423
|
-
* skipping that system.
|
|
424
|
-
*/
|
|
425
|
-
const perform = async (definition: Definition, value: unknown, pass: boolean, registered: Schedule | undefined): Promise<number> => {
|
|
538
|
+
/** Follows what changed since the last run: program resources, change watches, workers and the device; null when nothing did. */
|
|
539
|
+
const prepareRun = (): Promise<void> | null => {
|
|
426
540
|
// Resources added between runs move the resource entity, whose structs a tail may still read.
|
|
427
|
-
if (ensured.version !== programVersion() && (state.channels.length > 0 || state.observer.posts.length > 0))
|
|
541
|
+
if (ensured.version !== programVersion() && (state.channels.length > 0 || state.observer.posts.length > 0)) return drainThenPrepare();
|
|
542
|
+
ensureProgramResources(state, ensured);
|
|
543
|
+
if (startWatches(state)) return followChanges(true, false);
|
|
544
|
+
if (workersChanged()) return followChanges(false, true);
|
|
545
|
+
if (deviceChanged()) return followChanges(false, false);
|
|
546
|
+
return null;
|
|
547
|
+
};
|
|
548
|
+
const drainThenPrepare = async (): Promise<void> => {
|
|
549
|
+
await drainTails();
|
|
428
550
|
ensureProgramResources(state, ensured);
|
|
429
|
-
|
|
430
|
-
|
|
551
|
+
await followChanges(startWatches(state), false);
|
|
552
|
+
};
|
|
553
|
+
/**
|
|
554
|
+
* Reloads kernels for new stamps when `reload`, then follows the workers, when `workers` says a check found they
|
|
555
|
+
* changed or a check now does, and the device.
|
|
556
|
+
*/
|
|
557
|
+
const followChanges = async (reload: boolean, workers: boolean): Promise<void> => {
|
|
558
|
+
if (reload) await reloadStamped();
|
|
559
|
+
if (workers || workersChanged()) await followWorkers();
|
|
431
560
|
if (deviceChanged()) await followDevice();
|
|
432
|
-
|
|
433
|
-
|
|
561
|
+
};
|
|
562
|
+
|
|
563
|
+
/** Runs its tiers and sync point, or for a run of observer systems alone with nothing to sync, only counts what it ran. */
|
|
564
|
+
const executeRun = (definition: Definition, value: unknown, schedule: Schedule): RunReport | Promise<RunReport> => {
|
|
434
565
|
// An input that moved to a joined thread runs only there: that thread went since, its claims with it.
|
|
435
566
|
if (isHeld(value) && (definition.kind === "composite" || registrar.runnerOf(definition).remote?.channel !== value.channel)) {
|
|
436
|
-
throw new Error(`System "${
|
|
567
|
+
throw new Error(`System "${definition.name}": the run's input moved to a joined thread that's gone.`);
|
|
437
568
|
}
|
|
438
|
-
|
|
439
|
-
const started = performance.now();
|
|
440
|
-
// A run of observer systems alone has an empty sync point.
|
|
441
|
-
const empty = schedule.tiers.length === 0 && skipsSync();
|
|
442
|
-
// Its report's entity, spawned or reused by commands its own sync point applies, or for an empty one, applied
|
|
443
|
-
// alone, which leaves other commands for the next.
|
|
444
|
-
let slot: Slot | Promise<Slot> = empty ? reports.beginAlone(run) : reports.begin(run);
|
|
445
|
-
if (slot instanceof Promise) slot = await slot;
|
|
446
|
-
let report: RunReport;
|
|
447
|
-
let tails: Promise<TailOutcome> | null = null;
|
|
569
|
+
let report: RunReport | Promise<RunReport>;
|
|
448
570
|
try {
|
|
449
|
-
if (
|
|
571
|
+
if (schedule.tiers.length === 0 && skipsSync()) {
|
|
450
572
|
startRan(state.ran);
|
|
451
573
|
report = cleanReport;
|
|
452
574
|
}
|
|
453
|
-
else report =
|
|
575
|
+
else report = execute(context, schedule, value, definition);
|
|
576
|
+
}
|
|
577
|
+
catch (error) {
|
|
578
|
+
return executeFailed(error);
|
|
579
|
+
}
|
|
580
|
+
if (report instanceof Promise) return executing(report);
|
|
581
|
+
return executed(report);
|
|
582
|
+
};
|
|
583
|
+
const executing = async (running: Promise<RunReport>): Promise<RunReport> => {
|
|
584
|
+
let report: RunReport;
|
|
585
|
+
try {
|
|
586
|
+
report = await running;
|
|
587
|
+
}
|
|
588
|
+
catch (error) {
|
|
589
|
+
return executeFailed(error);
|
|
590
|
+
}
|
|
591
|
+
return executed(report);
|
|
592
|
+
};
|
|
593
|
+
/** A run whose tiers or sync point threw: it follows the device all the same, then fails. */
|
|
594
|
+
const executeFailed = async (error: unknown): Promise<never> => {
|
|
595
|
+
context.tails = null;
|
|
596
|
+
if (deviceChanged()) await followDevice();
|
|
597
|
+
throw error;
|
|
598
|
+
};
|
|
599
|
+
|
|
600
|
+
/** Takes the run's tails, then follows the device and starts the pool when they changed or were asked for. */
|
|
601
|
+
const executed = (report: RunReport): RunReport | Promise<RunReport> => {
|
|
602
|
+
tailing = context.tails;
|
|
603
|
+
context.tails = null;
|
|
604
|
+
// A kernel that ran here over rows enough for workers asked for the pool, which the next run's kernels use.
|
|
605
|
+
if (deviceChanged() || (state.poolWanted && workersBehind)) return following(report);
|
|
606
|
+
return report;
|
|
607
|
+
};
|
|
608
|
+
const following = async (report: RunReport): Promise<RunReport> => {
|
|
609
|
+
if (deviceChanged()) await followDevice();
|
|
610
|
+
if (state.poolWanted && workersBehind) await startWorkers();
|
|
611
|
+
return report;
|
|
612
|
+
};
|
|
613
|
+
|
|
614
|
+
/**
|
|
615
|
+
* Runs a registered system or composite as `run` does: its tiers and sync point, then once its tails are done its
|
|
616
|
+
* observer systems and those added; then gives what its per-run body returned, or throws naming what failed.
|
|
617
|
+
* `registered` is its schedule as it was registered, which it runs if a system it holds was removed since, skipping
|
|
618
|
+
* that system.
|
|
619
|
+
*/
|
|
620
|
+
const perform = (definition: Definition, value: unknown, registered: Schedule | undefined): unknown => {
|
|
621
|
+
state.wanted = definition.kind === "system" && definition.declaration.components === undefined ? definition : null;
|
|
622
|
+
const schedule = registrar.registered(definition) ?? registered;
|
|
623
|
+
if (schedule === undefined) throw new Error(`System "${definition.name}" didn't register.`);
|
|
624
|
+
const report = execution(definition, value, schedule);
|
|
625
|
+
if (report instanceof Promise) return performing(report, definition, value, schedule);
|
|
626
|
+
return afterExecution(report, definition, value, schedule);
|
|
627
|
+
};
|
|
628
|
+
const performing = async (running: Promise<RunReport>, definition: Definition, value: unknown, schedule: Schedule): Promise<unknown> =>
|
|
629
|
+
afterExecution(await running, definition, value, schedule);
|
|
630
|
+
|
|
631
|
+
/** Waits for the run's tails, as a run ends once they have, then runs observer systems. */
|
|
632
|
+
const afterExecution = (report: RunReport, definition: Definition, value: unknown, schedule: Schedule): unknown => {
|
|
633
|
+
const tails = tailing;
|
|
634
|
+
tailing = null;
|
|
635
|
+
if (tails !== null) return afterTails(tails, report, definition, value, schedule);
|
|
636
|
+
return passRun(report, definition, value, schedule);
|
|
637
|
+
};
|
|
638
|
+
const afterTails = async (tails: Promise<TailOutcome>, report: RunReport, definition: Definition, value: unknown, schedule: Schedule): Promise<unknown> =>
|
|
639
|
+
passRun(withTails(report, await tails), definition, value, schedule);
|
|
640
|
+
|
|
641
|
+
/**
|
|
642
|
+
* Runs the run's observer systems and those added, then settles the run: once its own on joined threads ran there,
|
|
643
|
+
* for a run of the world's, which a joined thread's run of its own doesn't wait for.
|
|
644
|
+
*/
|
|
645
|
+
const passRun = (report: RunReport, definition: Definition, value: unknown, schedule: Schedule): unknown => {
|
|
646
|
+
const run = joinedRunOf(value);
|
|
647
|
+
const waits = run === 0 && state.observer.count !== 0 ? awaitThere(schedule.observer) : null;
|
|
648
|
+
const passed = passObserver(schedule.observer, loop.observer(), run);
|
|
649
|
+
if (waits !== null) return passingThere(passed, waits, report, definition, schedule);
|
|
650
|
+
if (passed instanceof Promise) return passing(passed, report, definition, schedule);
|
|
651
|
+
return settleRun(report, passed, definition, schedule, nothingThere);
|
|
652
|
+
};
|
|
653
|
+
const passing = async (passing: Promise<Failure[] | null>, report: RunReport, definition: Definition, schedule: Schedule): Promise<unknown> =>
|
|
654
|
+
settleRun(report, await passing, definition, schedule, nothingThere);
|
|
655
|
+
|
|
656
|
+
/** A run's own observer systems on joined threads, each with the wait for its post, registered before it's posted. */
|
|
657
|
+
const awaitThere = (own: readonly Leaf[]): Promise<readonly [Leaf, PostResult]>[] | null => {
|
|
658
|
+
let waits: Promise<readonly [Leaf, PostResult]>[] | null = null;
|
|
659
|
+
for (const leaf of own) {
|
|
660
|
+
const { joined } = registrar.runnerOf(leaf);
|
|
661
|
+
if (joined !== null) (waits ??= []).push(awaitPost(state, joined, leaf === state.wanted).then((result): readonly [Leaf, PostResult] => [leaf, result]));
|
|
662
|
+
}
|
|
663
|
+
return waits;
|
|
664
|
+
};
|
|
665
|
+
/** How many runs wait for posts on joined threads, during which a post owed to one is posted again at once. */
|
|
666
|
+
let waitingThere = 0;
|
|
667
|
+
const passingThere = async (passing: Failure[] | null | Promise<Failure[] | null>, waits: readonly Promise<readonly [Leaf, PostResult]>[], report: RunReport, definition: Definition, schedule: Schedule): Promise<unknown> => {
|
|
668
|
+
let passed: Failure[] | null;
|
|
669
|
+
let results: readonly (readonly [Leaf, PostResult])[];
|
|
670
|
+
waitingThere++;
|
|
671
|
+
try {
|
|
672
|
+
passed = passing instanceof Promise ? await passing : passing;
|
|
673
|
+
results = await Promise.all(waits);
|
|
454
674
|
}
|
|
455
675
|
finally {
|
|
456
|
-
|
|
457
|
-
context.tails = null;
|
|
458
|
-
if (deviceChanged()) await followDevice();
|
|
676
|
+
waitingThere--;
|
|
459
677
|
}
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
performedValues = values;
|
|
466
|
-
return run;
|
|
678
|
+
let there: Failure[] | null = null;
|
|
679
|
+
let given: unknown = nothingThere;
|
|
680
|
+
for (const [leaf, result] of results) {
|
|
681
|
+
if (result.error !== undefined) (there ??= []).push(failureOf(result.gone ? "thread" : "system", leaf, result.error));
|
|
682
|
+
else if (leaf === state.wanted) given = result.value;
|
|
467
683
|
}
|
|
468
|
-
|
|
469
|
-
if (tails !== null) report = withTails(report, await tails);
|
|
470
|
-
report = withFailures(report, takeFailures());
|
|
471
|
-
const writing = writeReport(slot, values, report);
|
|
472
|
-
if (writing !== null) await writing;
|
|
473
|
-
const passed = passObserver(schedule.observer, loop.observer(), joinedRunOf(value));
|
|
474
|
-
const failures = passed instanceof Promise ? await passed : passed;
|
|
475
|
-
if (failures !== null) defer(failures);
|
|
476
|
-
return run;
|
|
684
|
+
return settleRun(withFailures(report, there), passed, definition, schedule, given);
|
|
477
685
|
};
|
|
478
686
|
|
|
479
687
|
/**
|
|
480
|
-
*
|
|
481
|
-
*
|
|
688
|
+
* Settles a run once its observer systems ran: what its own threw fails it, as does a unique index's conflict its
|
|
689
|
+
* pass found, and what those added threw is reported out of band. Throws naming its failures, or gives what its
|
|
690
|
+
* per-run body returned: `given` from a joined thread, or else its runner's.
|
|
482
691
|
*/
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
692
|
+
const settleRun = (report: RunReport, passed: Failure[] | null, definition: Definition, schedule: Schedule, given: unknown): unknown => {
|
|
693
|
+
let own: Failure[] | null = null;
|
|
694
|
+
let added: Failure[] | null = null;
|
|
695
|
+
if (passed !== null) {
|
|
696
|
+
for (const failure of passed) {
|
|
697
|
+
if (failure.kind === "index" || schedule.observer.some(leaf => leaf === failure.subject)) (own ??= []).push(failure);
|
|
698
|
+
else (added ??= []).push(failure);
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
endPass(loop.observer(), added);
|
|
702
|
+
const settled = withFailures(report, own);
|
|
703
|
+
if (recorder !== null) {
|
|
704
|
+
const outcome = outcomeOf(settled);
|
|
705
|
+
if (record !== null) record.outcome = outcome;
|
|
706
|
+
for (const listener of recorder.each) listener(outcome);
|
|
707
|
+
}
|
|
708
|
+
const { wanted } = state;
|
|
709
|
+
state.wanted = null;
|
|
710
|
+
const value = wanted === null ? undefined : given !== nothingThere ? given : registrar.runnerOf(wanted).takeResult();
|
|
711
|
+
if (settled.failures.length !== 0) throw errorOfRun(settled);
|
|
712
|
+
return value;
|
|
488
713
|
};
|
|
714
|
+
|
|
715
|
+
/**
|
|
716
|
+
* After a pass: what observer systems added threw is reported out of band, and those reported before that ran
|
|
717
|
+
* their bodies in it without failing recovered.
|
|
718
|
+
*/
|
|
719
|
+
const endPass = (added: readonly Leaf[], failures: readonly Failure[] | null): void => {
|
|
720
|
+
outOfBand.reportAll(failures);
|
|
721
|
+
if (outOfBand.size() === 0) return;
|
|
722
|
+
for (const leaf of added) {
|
|
723
|
+
if (outOfBand.has(leaf) && !failedIn(failures, leaf) && registrar.runnerOf(leaf).didRun()) outOfBand.recovered(leaf);
|
|
724
|
+
}
|
|
725
|
+
};
|
|
726
|
+
|
|
489
727
|
const noLeaves: readonly Leaf[] = [];
|
|
490
728
|
const none: readonly never[] = [];
|
|
491
729
|
|
|
@@ -506,16 +744,23 @@ export const createWorld = (resources: InitialResources = {}, options: WorldOpti
|
|
|
506
744
|
return posting === null ? failures : posting.then(() => failures);
|
|
507
745
|
};
|
|
508
746
|
// A post owed to a run, cancelled outside a sync point, is posted again between runs.
|
|
509
|
-
state.observer.again = () =>
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
747
|
+
state.observer.again = () => {
|
|
748
|
+
// A run waiting for a post holds the queue, so it's posted again at once.
|
|
749
|
+
if (waitingThere > 0) {
|
|
750
|
+
void postObserver(state, [], [], 0, context.workers?.pool ?? null);
|
|
751
|
+
return;
|
|
752
|
+
}
|
|
753
|
+
void enqueue(async () => {
|
|
754
|
+
if (disposed) return;
|
|
755
|
+
const posting = postObserver(state, [], [], 0, context.workers?.pool ?? null);
|
|
756
|
+
if (posting !== null) await posting;
|
|
757
|
+
});
|
|
758
|
+
};
|
|
514
759
|
|
|
515
760
|
/**
|
|
516
761
|
* Registers an observer system `add` was given: at once when it can register again as it was
|
|
517
|
-
* (`Registrar.reregister`), otherwise before the next run, unless it was removed meanwhile; its failure is
|
|
518
|
-
*
|
|
762
|
+
* (`Registrar.reregister`), otherwise before the next run, unless it was removed meanwhile; its failure is reported
|
|
763
|
+
* out of band.
|
|
519
764
|
*/
|
|
520
765
|
const registerObserver = (system: Leaf): void => {
|
|
521
766
|
if (registrar.registered(system) !== undefined || registrar.reregister(system)) return;
|
|
@@ -525,22 +770,11 @@ export const createWorld = (resources: InitialResources = {}, options: WorldOpti
|
|
|
525
770
|
await complete(registrar.register(system));
|
|
526
771
|
}
|
|
527
772
|
catch (error) {
|
|
528
|
-
|
|
773
|
+
outOfBand.report(failureOf("system", system, error));
|
|
529
774
|
}
|
|
530
775
|
});
|
|
531
776
|
};
|
|
532
777
|
|
|
533
|
-
/** Whether observer systems read reports, so a tick waits for its tails before running them. */
|
|
534
|
-
const observerReadReport = new WeakMap<readonly Leaf[], boolean>();
|
|
535
|
-
const readsReportOf = (leaves: readonly Leaf[]): boolean => {
|
|
536
|
-
let reads = observerReadReport.get(leaves);
|
|
537
|
-
if (reads === undefined) observerReadReport.set(leaves, reads = readReports(leaves));
|
|
538
|
-
return reads;
|
|
539
|
-
};
|
|
540
|
-
|
|
541
|
-
/** A tick's tails, which `perform` leaves for its report. */
|
|
542
|
-
let tailing: Promise<TailOutcome> | null = null;
|
|
543
|
-
|
|
544
778
|
/** Writes a resource only the world writes, stamped with a tick of its own so systems see it. */
|
|
545
779
|
const writeOwn = (key: Key, value: unknown): void => {
|
|
546
780
|
const cell = findResource(state, key);
|
|
@@ -550,31 +784,49 @@ export const createWorld = (resources: InitialResources = {}, options: WorldOpti
|
|
|
550
784
|
};
|
|
551
785
|
|
|
552
786
|
/**
|
|
553
|
-
*
|
|
554
|
-
*
|
|
555
|
-
*
|
|
556
|
-
|
|
787
|
+
* Ends a tick once its tails are done: what failed is reported out of band, once per system while it keeps
|
|
788
|
+
* failing; what was reported and ran its body in the tick without failing recovered, as did finalizers that ran
|
|
789
|
+
* and indexes that found no conflict.
|
|
790
|
+
*/
|
|
791
|
+
const endTick = (report: RunReport, schedule: Schedule | undefined, ran: Outcome | null): void => {
|
|
792
|
+
const { failures } = report;
|
|
793
|
+
outOfBand.reportAll(listed(failures));
|
|
794
|
+
if (outOfBand.size() !== 0) {
|
|
795
|
+
// A system a failed tier skipped didn't run, whatever its runner says of its last run.
|
|
796
|
+
if (schedule !== undefined) for (const tier of schedule.tiers) for (const leaf of tier) {
|
|
797
|
+
if (outOfBand.has(leaf) && !failedIn(failures, leaf) && !report.skipped.includes(leaf) && registrar.runnerOf(leaf).didRun()) outOfBand.recovered(leaf);
|
|
798
|
+
}
|
|
799
|
+
if (state.finalized !== null) for (const finalizer of state.finalized) if (!failedIn(failures, finalizer)) outOfBand.recovered(finalizer);
|
|
800
|
+
outOfBand.indexesRecovered(failures);
|
|
801
|
+
}
|
|
802
|
+
// Finalizers' runs are followed only while one is reported.
|
|
803
|
+
if (state.finalized !== null) state.finalized.clear();
|
|
804
|
+
if (outOfBand.size() !== 0 || state.finalized !== null) state.finalized = outOfBand.reports("finalizer") ? state.finalized ?? new Set() : null;
|
|
805
|
+
if (recorder !== null && ran !== null) {
|
|
806
|
+
const outcome: Outcome = { ...ran, failures: report.failures, skipped: report.skipped, dropped: report.dropped, warnings: report.warnings };
|
|
807
|
+
for (const listener of recorder.ticks) listener(outcome);
|
|
808
|
+
}
|
|
809
|
+
};
|
|
810
|
+
|
|
811
|
+
/**
|
|
812
|
+
* One tick: the clock, the added systems as one composite, then observer systems with the tick's values. Its
|
|
813
|
+
* tails may still run while those do; what failed is reported out of band once they're done, and what observer
|
|
814
|
+
* systems threw once they ran.
|
|
557
815
|
*/
|
|
558
816
|
const tick = (_: Composite, clockValue: Clock): Promise<void> => enqueue(async () => {
|
|
559
817
|
// What's added as the tick starts: systems removed since the loop asked for it aren't in it.
|
|
560
818
|
const composite = loop.current();
|
|
561
819
|
if (disposed || composite === null) return;
|
|
820
|
+
state.wanted = null;
|
|
562
821
|
let report: RunReport;
|
|
563
|
-
let
|
|
564
|
-
let slot: Slot;
|
|
565
|
-
let values: RunValues;
|
|
566
|
-
const begun = runs;
|
|
822
|
+
let schedule: Schedule | undefined;
|
|
567
823
|
try {
|
|
568
824
|
if (registrar.registered(composite) === undefined) {
|
|
569
825
|
ensureResources(state, loopResources);
|
|
570
826
|
await complete(registrar.register(composite));
|
|
571
827
|
}
|
|
572
|
-
|
|
573
|
-
if (
|
|
574
|
-
await Promise.all(pending.map(each => each.tails));
|
|
575
|
-
const flushing = flushReports();
|
|
576
|
-
if (flushing !== null) await flushing;
|
|
577
|
-
}
|
|
828
|
+
schedule = registrar.registered(composite);
|
|
829
|
+
if (schedule === undefined) throw new Error(`System "${composite.name}" didn't register.`);
|
|
578
830
|
if (state.tails.length !== 0) {
|
|
579
831
|
const waiting = settleKeys(state, [], [clockId]);
|
|
580
832
|
if (waiting !== null) await waiting;
|
|
@@ -584,84 +836,24 @@ export const createWorld = (resources: InitialResources = {}, options: WorldOpti
|
|
|
584
836
|
if (waiting !== null) await waiting;
|
|
585
837
|
}
|
|
586
838
|
writeOwn(clock, clockValue);
|
|
587
|
-
|
|
588
|
-
report = performed;
|
|
589
|
-
performed = cleanReport;
|
|
590
|
-
slot = performedSlot ?? reports.lastSlot();
|
|
591
|
-
values = performedValues ?? valuesOf(run, performance.now(), 0);
|
|
592
|
-
performedSlot = performedValues = null;
|
|
839
|
+
report = await execution(composite, undefined, schedule);
|
|
593
840
|
}
|
|
594
841
|
catch (error) {
|
|
595
|
-
// A tick that failed before its run took a number takes one now, its report spawned between runs.
|
|
596
|
-
if (runs === begun) {
|
|
597
|
-
run = ++runs;
|
|
598
|
-
slot = await reports.beginAlone(run);
|
|
599
|
-
}
|
|
600
|
-
else {
|
|
601
|
-
run = runs;
|
|
602
|
-
slot = reports.lastSlot();
|
|
603
|
-
}
|
|
604
842
|
startRan(state.ran);
|
|
605
|
-
|
|
606
|
-
report = { failures: [failureOf("system", labelOfItem(composite), error)], skipped: none, dropped: 0, warnings: none };
|
|
843
|
+
report = { failures: [failureOf("system", composite, error)], skipped: none, dropped: 0, warnings: none };
|
|
607
844
|
}
|
|
608
|
-
|
|
845
|
+
const ran = recorder === null ? null : outcomeOf(cleanReport);
|
|
609
846
|
const tails = tailing;
|
|
610
847
|
tailing = null;
|
|
611
|
-
const
|
|
612
|
-
if (tails
|
|
613
|
-
|
|
614
|
-
// Observer systems get the tick's values now; its report is written once its tails, and every earlier
|
|
615
|
-
// tick's, have run.
|
|
616
|
-
const passed = passObserver(noLeaves, observer);
|
|
617
|
-
const entry: PendingReport = { slot, values: { ...values }, report: withFailures(report, passed instanceof Promise ? await passed : passed), tails, done: tails === null };
|
|
618
|
-
pending.push(entry);
|
|
619
|
-
if (tails !== null) void tails.then(outcome => {
|
|
620
|
-
entry.report = withTails(entry.report, outcome);
|
|
621
|
-
entry.done = true;
|
|
622
|
-
void enqueue(async () => flushReports());
|
|
623
|
-
});
|
|
624
|
-
const flushing = flushReports();
|
|
625
|
-
if (flushing !== null) await flushing;
|
|
626
|
-
return;
|
|
627
|
-
}
|
|
628
|
-
await Promise.all(pending.map(each => each.tails));
|
|
629
|
-
const flushing = flushReports();
|
|
630
|
-
if (flushing !== null) await flushing;
|
|
631
|
-
if (tails !== null) report = withTails(report, await tails);
|
|
632
|
-
}
|
|
848
|
+
const ticked = schedule;
|
|
849
|
+
if (tails === null) endTick(report, ticked, ran);
|
|
850
|
+
else void tails.then(outcome => endTick(withTails(report, outcome), ticked, ran));
|
|
633
851
|
if (disposed) return;
|
|
634
|
-
const
|
|
635
|
-
if (writing !== null) await writing;
|
|
852
|
+
const observer = loop.observer();
|
|
636
853
|
const passed = passObserver(noLeaves, observer);
|
|
637
|
-
|
|
638
|
-
if (failures !== null) defer(failures);
|
|
854
|
+
endPass(observer, passed instanceof Promise ? await passed : passed);
|
|
639
855
|
});
|
|
640
|
-
|
|
641
|
-
/** Ticks whose reports wait for their tails, in order. */
|
|
642
|
-
type PendingReport = { readonly slot: Slot; readonly values: RunValues; report: RunReport; readonly tails: Promise<TailOutcome> | null; done: boolean };
|
|
643
|
-
const pending: PendingReport[] = [];
|
|
644
|
-
/**
|
|
645
|
-
* Writes the reports of ticks whose tails, and every earlier tick's, have run: at once, unless one waits for
|
|
646
|
-
* observer systems in progress on joined threads, when the rest follow it.
|
|
647
|
-
*/
|
|
648
|
-
const flushReports = (): Promise<void> | null => {
|
|
649
|
-
while (pending.length > 0 && pending[0].done) {
|
|
650
|
-
const entry = pending.shift();
|
|
651
|
-
if (entry === undefined || disposed) continue;
|
|
652
|
-
const writing = writeReport(entry.slot, entry.values, entry.report);
|
|
653
|
-
if (writing !== null) return writing.then(() => flushReports() ?? undefined);
|
|
654
|
-
}
|
|
655
|
-
return null;
|
|
656
|
-
};
|
|
657
856
|
const clockId = idOf(state, clock);
|
|
658
|
-
/** Whether a tick's systems read reports, so a tick waits for the last one's tails first. */
|
|
659
|
-
const readersOfReport = new WeakMap<Composite, boolean>();
|
|
660
|
-
const readsReport = (composite: Composite): boolean => {
|
|
661
|
-
let reads = readersOfReport.get(composite);
|
|
662
|
-
if (reads === undefined) readersOfReport.set(composite, reads = registrar.registered(composite)?.tiers.some(readReports) ?? false);
|
|
663
|
-
return reads;
|
|
664
|
-
};
|
|
665
857
|
|
|
666
858
|
const loop = createLoop({
|
|
667
859
|
settings: () => {
|
|
@@ -676,7 +868,7 @@ export const createWorld = (resources: InitialResources = {}, options: WorldOpti
|
|
|
676
868
|
});
|
|
677
869
|
|
|
678
870
|
/** Runs a system or composite with its input, as `run` does. */
|
|
679
|
-
const runWith = (system: { readonly name: string }, value: unknown): Promise<
|
|
871
|
+
const runWith = (system: { readonly name: string }, value: unknown): Promise<unknown> => {
|
|
680
872
|
let registration: Registration | null = null;
|
|
681
873
|
let definition: Definition | undefined;
|
|
682
874
|
try {
|
|
@@ -693,16 +885,52 @@ export const createWorld = (resources: InitialResources = {}, options: WorldOpti
|
|
|
693
885
|
const schedule = registrar.registered(ran);
|
|
694
886
|
// A run of observer systems alone doesn't wake the loop.
|
|
695
887
|
if (scheduleOf(ran).tiers.length > 0) loop.arrived();
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
888
|
+
if (registering !== null) return recorded(enqueue(() => registeredThenPerform(registering, ran, value, schedule)));
|
|
889
|
+
// Runs of registered systems wait in order in these arrays, which `performNext` takes from, so queuing one
|
|
890
|
+
// makes no closure.
|
|
891
|
+
waitingDefinitions[waitingCount] = ran;
|
|
892
|
+
waitingValues[waitingCount] = value;
|
|
893
|
+
waitingSchedules[waitingCount] = schedule;
|
|
894
|
+
waitingCount++;
|
|
895
|
+
return recorded(enqueue(performNext));
|
|
896
|
+
};
|
|
897
|
+
/** While recording, queues a record for a run just queued, found by its promise. */
|
|
898
|
+
const recorded = (running: Promise<unknown>): Promise<unknown> => {
|
|
899
|
+
if (recorder === null) return running;
|
|
900
|
+
const queued: { outcome: Outcome | null } = { outcome: null };
|
|
901
|
+
records.push(queued);
|
|
902
|
+
recorder.runs.set(running, queued);
|
|
903
|
+
return running;
|
|
904
|
+
};
|
|
905
|
+
const registeredThenPerform = async (registering: Registration, definition: Definition, value: unknown, schedule: Schedule | undefined): Promise<unknown> => {
|
|
906
|
+
startRecord();
|
|
907
|
+
await complete(registering);
|
|
908
|
+
return perform(definition, value, schedule);
|
|
909
|
+
};
|
|
910
|
+
/** Runs waiting in order, the first `waitingCount`; the slots past them are reused, never truncated. */
|
|
911
|
+
const waitingDefinitions: (Definition | undefined)[] = [];
|
|
912
|
+
const waitingValues: unknown[] = [];
|
|
913
|
+
const waitingSchedules: (Schedule | undefined)[] = [];
|
|
914
|
+
let waitingCount = 0;
|
|
915
|
+
/** The next of them to run: the queue runs tasks in the order queued, so each `performNext` takes the next. */
|
|
916
|
+
let nextWaiting = 0;
|
|
917
|
+
const performNext = (): unknown => {
|
|
918
|
+
startRecord();
|
|
919
|
+
const k = nextWaiting++;
|
|
920
|
+
const definition = waitingDefinitions[k];
|
|
921
|
+
const value = waitingValues[k];
|
|
922
|
+
const schedule = waitingSchedules[k];
|
|
923
|
+
// Let go, so a run holds what it was given only until it starts.
|
|
924
|
+
waitingDefinitions[k] = waitingValues[k] = waitingSchedules[k] = undefined;
|
|
925
|
+
if (nextWaiting === waitingCount) nextWaiting = waitingCount = 0;
|
|
926
|
+
if (definition === undefined) throw new Error("A run was taken that wasn't waiting.");
|
|
927
|
+
return perform(definition, value, schedule);
|
|
700
928
|
};
|
|
701
929
|
|
|
702
930
|
const sharing = createSharing({
|
|
703
931
|
state,
|
|
704
932
|
run: runWith,
|
|
705
|
-
|
|
933
|
+
report: failure => outOfBand.report(failure),
|
|
706
934
|
crossing: (threads, imported) => registrar.crossing(threads, imported) ?? finalizerCrossing(threads, imported),
|
|
707
935
|
placed: () => {
|
|
708
936
|
registrar.place();
|
|
@@ -729,13 +957,11 @@ export const createWorld = (resources: InitialResources = {}, options: WorldOpti
|
|
|
729
957
|
});
|
|
730
958
|
|
|
731
959
|
const world: CreatedWorld = {
|
|
732
|
-
run
|
|
733
|
-
|
|
734
|
-
return runWith(system, value);
|
|
735
|
-
},
|
|
960
|
+
// A run gives what its system's body returned, `R` by the system's type.
|
|
961
|
+
run: <I, R>(system: System<I, R>, ...input: Input<NoInfer<I>>) => runWith(system, input[0]) as Promise<R>,
|
|
736
962
|
share: port => {
|
|
737
|
-
|
|
738
|
-
if (!state.memory.shared)
|
|
963
|
+
if (disposed) return Promise.reject(new Error("The world is disposed."));
|
|
964
|
+
if (!state.memory.shared) return Promise.reject(new Error("Without cross-origin isolation memory can't be shared, so no thread can join."));
|
|
739
965
|
return sharing.share(port);
|
|
740
966
|
},
|
|
741
967
|
add: system => {
|
|
@@ -770,6 +996,8 @@ export const createWorld = (resources: InitialResources = {}, options: WorldOpti
|
|
|
770
996
|
disposed = true;
|
|
771
997
|
loop.stop();
|
|
772
998
|
return enqueue(async () => {
|
|
999
|
+
// Runs queued before have reported what failed in them; nothing is reported from here on.
|
|
1000
|
+
outOfBand.close();
|
|
773
1001
|
// Joined threads' runs reject from here on.
|
|
774
1002
|
sharing.close();
|
|
775
1003
|
// Per-query finalizers release what every live entity they match holds, reading the GPU's writes first.
|
|
@@ -805,13 +1033,21 @@ export const createWorld = (resources: InitialResources = {}, options: WorldOpti
|
|
|
805
1033
|
phasedBuilds: state.phasedBuilds,
|
|
806
1034
|
pooledBuilds: state.pooledBuilds,
|
|
807
1035
|
journalReaders: state.journal.readers,
|
|
1036
|
+
touched: touchedHeld(state),
|
|
808
1037
|
arena: state.memory.held(),
|
|
1038
|
+
archetypes: state.archetypes.length,
|
|
1039
|
+
sharing: sharingHeld(state),
|
|
809
1040
|
joined: state.channels.map(channel => channel.placed()),
|
|
810
1041
|
gpu: state.gpu?.records() ?? 0,
|
|
811
1042
|
workers: workers.map(result => ({ kernels: result.kernels ?? -1 })),
|
|
812
1043
|
};
|
|
813
1044
|
}),
|
|
814
1045
|
};
|
|
1046
|
+
recorders.set(world, () => recorder ??= { runs: new WeakMap(), each: [], ticks: [] });
|
|
1047
|
+
tickers.set(world, tick => {
|
|
1048
|
+
if (state.tick !== 0) throw new Error("A world starts its ticks elsewhere only before it ran anything.");
|
|
1049
|
+
state.tick = tick;
|
|
1050
|
+
});
|
|
815
1051
|
return world;
|
|
816
1052
|
};
|
|
817
1053
|
|