@adobe/ecs 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +58 -0
- package/dist/implementation/compiler/access.js +9 -5
- package/dist/implementation/compiler/access.js.map +1 -1
- package/dist/implementation/compiler/archetypes.d.ts +17 -0
- package/dist/implementation/compiler/archetypes.js +141 -0
- package/dist/implementation/compiler/archetypes.js.map +1 -0
- package/dist/implementation/compiler/assign.js.map +1 -1
- package/dist/implementation/compiler/augmentations.d.ts +25 -0
- package/dist/implementation/compiler/augmentations.js +943 -0
- package/dist/implementation/compiler/augmentations.js.map +1 -0
- package/dist/implementation/compiler/bind.js +5 -4
- package/dist/implementation/compiler/bind.js.map +1 -1
- package/dist/implementation/compiler/body-access.d.ts +20 -3
- package/dist/implementation/compiler/body-access.js +138 -36
- package/dist/implementation/compiler/body-access.js.map +1 -1
- package/dist/implementation/compiler/booleans.js.map +1 -1
- package/dist/implementation/compiler/branches.js.map +1 -1
- package/dist/implementation/compiler/calls.js +14 -3
- package/dist/implementation/compiler/calls.js.map +1 -1
- package/dist/implementation/compiler/columns.d.ts +8 -2
- package/dist/implementation/compiler/columns.js +19 -3
- package/dist/implementation/compiler/columns.js.map +1 -1
- package/dist/implementation/compiler/compile-kernel.d.ts +24 -1
- package/dist/implementation/compiler/compile-kernel.js +66 -22
- package/dist/implementation/compiler/compile-kernel.js.map +1 -1
- package/dist/implementation/compiler/compiler.d.ts +6 -0
- package/dist/implementation/compiler/compiler.js +7 -0
- package/dist/implementation/compiler/compiler.js.map +1 -0
- package/dist/implementation/compiler/data.js.map +1 -1
- package/dist/implementation/compiler/describe.d.ts +41 -0
- package/dist/implementation/compiler/describe.js +510 -0
- package/dist/implementation/compiler/describe.js.map +1 -0
- package/dist/implementation/compiler/estree.js.map +1 -1
- package/dist/implementation/compiler/expression.js +26 -2
- package/dist/implementation/compiler/expression.js.map +1 -1
- package/dist/implementation/compiler/failure.js.map +1 -1
- package/dist/implementation/compiler/identify.d.ts +18 -8
- package/dist/implementation/compiler/identify.js +90 -32
- package/dist/implementation/compiler/identify.js.map +1 -1
- package/dist/implementation/compiler/index.d.ts +5 -1
- package/dist/implementation/compiler/index.js +6 -1
- package/dist/implementation/compiler/index.js.map +1 -1
- package/dist/implementation/compiler/inferred.d.ts +32 -0
- package/dist/implementation/compiler/inferred.js +185 -0
- package/dist/implementation/compiler/inferred.js.map +1 -0
- package/dist/implementation/compiler/inline-kernels.d.ts +7 -0
- package/dist/implementation/compiler/inline-kernels.js +16 -0
- package/dist/implementation/compiler/inline-kernels.js.map +1 -0
- package/dist/implementation/compiler/input-schemas.d.ts +23 -0
- package/dist/implementation/compiler/input-schemas.js +102 -0
- package/dist/implementation/compiler/input-schemas.js.map +1 -0
- package/dist/implementation/compiler/ir.d.ts +13 -1
- package/dist/implementation/compiler/ir.js.map +1 -1
- package/dist/implementation/compiler/kernel-id.js +1 -0
- package/dist/implementation/compiler/kernel-id.js.map +1 -1
- package/dist/implementation/compiler/key.js.map +1 -1
- package/dist/implementation/compiler/link.d.ts +13 -0
- package/dist/implementation/compiler/link.js +17 -0
- package/dist/implementation/compiler/link.js.map +1 -1
- package/dist/implementation/compiler/lists.d.ts +12 -1
- package/dist/implementation/compiler/lists.js +35 -14
- package/dist/implementation/compiler/lists.js.map +1 -1
- package/dist/implementation/compiler/lookups.js.map +1 -1
- package/dist/implementation/compiler/math.js +1 -0
- package/dist/implementation/compiler/math.js.map +1 -1
- package/dist/implementation/compiler/memory-compiler.d.ts +61 -0
- package/dist/implementation/compiler/memory-compiler.js +271 -0
- package/dist/implementation/compiler/memory-compiler.js.map +1 -0
- package/dist/implementation/compiler/module-scope.js.map +1 -1
- package/dist/implementation/compiler/module-value.js +18 -3
- package/dist/implementation/compiler/module-value.js.map +1 -1
- package/dist/implementation/compiler/out.js.map +1 -1
- package/dist/implementation/compiler/oxc.d.ts +41 -0
- package/dist/implementation/compiler/oxc.js +80 -0
- package/dist/implementation/compiler/oxc.js.map +1 -0
- package/dist/implementation/compiler/package-copies.d.ts +60 -0
- package/dist/implementation/compiler/package-copies.js +140 -0
- package/dist/implementation/compiler/package-copies.js.map +1 -0
- package/dist/implementation/compiler/passes.d.ts +25 -0
- package/dist/implementation/compiler/passes.js +24 -0
- package/dist/implementation/compiler/passes.js.map +1 -0
- package/dist/implementation/compiler/paths.d.ts +5 -14
- package/dist/implementation/compiler/paths.js +16 -25
- package/dist/implementation/compiler/paths.js.map +1 -1
- package/dist/implementation/compiler/plugin.d.ts +17 -1
- package/dist/implementation/compiler/plugin.js +207 -35
- package/dist/implementation/compiler/plugin.js.map +1 -1
- package/dist/implementation/compiler/posix.d.ts +8 -0
- package/dist/implementation/compiler/posix.js +205 -0
- package/dist/implementation/compiler/posix.js.map +1 -0
- package/dist/implementation/compiler/predicates.d.ts +11 -0
- package/dist/implementation/compiler/predicates.js +281 -0
- package/dist/implementation/compiler/predicates.js.map +1 -0
- package/dist/implementation/compiler/print.js +27 -7
- package/dist/implementation/compiler/print.js.map +1 -1
- package/dist/implementation/compiler/program.js +3 -0
- package/dist/implementation/compiler/program.js.map +1 -1
- package/dist/implementation/compiler/public.d.ts +1 -0
- package/dist/implementation/compiler/public.js +3 -0
- package/dist/implementation/compiler/public.js.map +1 -0
- package/dist/implementation/compiler/scalar.js.map +1 -1
- package/dist/implementation/compiler/scope.js.map +1 -1
- package/dist/implementation/compiler/serialize.js +1 -0
- package/dist/implementation/compiler/serialize.js.map +1 -1
- package/dist/implementation/compiler/signature.d.ts +18 -3
- package/dist/implementation/compiler/signature.js +68 -30
- package/dist/implementation/compiler/signature.js.map +1 -1
- package/dist/implementation/compiler/snapshot.d.ts +3 -1
- package/dist/implementation/compiler/snapshot.js +1 -1
- package/dist/implementation/compiler/snapshot.js.map +1 -1
- package/dist/implementation/compiler/source-map.js +1 -0
- package/dist/implementation/compiler/source-map.js.map +1 -1
- package/dist/implementation/compiler/spawns.d.ts +13 -1
- package/dist/implementation/compiler/spawns.js +67 -5
- package/dist/implementation/compiler/spawns.js.map +1 -1
- package/dist/implementation/compiler/stamps.d.ts +10 -3
- package/dist/implementation/compiler/stamps.js +28 -9
- package/dist/implementation/compiler/stamps.js.map +1 -1
- package/dist/implementation/compiler/statement.js.map +1 -1
- package/dist/implementation/compiler/terminal.js.map +1 -1
- package/dist/implementation/compiler/transform.d.ts +55 -5
- package/dist/implementation/compiler/transform.js +311 -55
- package/dist/implementation/compiler/transform.js.map +1 -1
- package/dist/implementation/compiler/type-schemas.d.ts +130 -0
- package/dist/implementation/compiler/type-schemas.js +701 -0
- package/dist/implementation/compiler/type-schemas.js.map +1 -0
- package/dist/implementation/compiler/unit.d.ts +20 -3
- package/dist/implementation/compiler/unit.js +2 -2
- package/dist/implementation/compiler/unit.js.map +1 -1
- package/dist/implementation/compiler/value.js.map +1 -1
- package/dist/implementation/compiler/wat.d.ts +12 -0
- package/dist/implementation/compiler/wat.js +379 -0
- package/dist/implementation/compiler/wat.js.map +1 -0
- package/dist/implementation/index.js +1 -0
- package/dist/implementation/index.js.map +1 -1
- package/dist/implementation/world/activate.js +8 -3
- package/dist/implementation/world/activate.js.map +1 -1
- package/dist/implementation/world/archetype.d.ts +64 -9
- package/dist/implementation/world/archetype.js +103 -14
- package/dist/implementation/world/archetype.js.map +1 -1
- package/dist/implementation/world/arrays.d.ts +6 -1
- package/dist/implementation/world/arrays.js +3 -0
- package/dist/implementation/world/arrays.js.map +1 -1
- package/dist/implementation/world/arrivals.d.ts +52 -0
- package/dist/implementation/world/arrivals.js +146 -0
- package/dist/implementation/world/arrivals.js.map +1 -0
- package/dist/implementation/world/attach-kernel.d.ts +3 -2
- package/dist/implementation/world/attach-kernel.js +16 -8
- package/dist/implementation/world/attach-kernel.js.map +1 -1
- package/dist/implementation/world/batches.d.ts +5 -2
- package/dist/implementation/world/batches.js +72 -8
- package/dist/implementation/world/batches.js.map +1 -1
- package/dist/implementation/world/buffer.js +37 -4
- package/dist/implementation/world/buffer.js.map +1 -1
- package/dist/implementation/world/cascade.js +1 -1
- package/dist/implementation/world/cascade.js.map +1 -1
- package/dist/implementation/world/cells.js.map +1 -1
- package/dist/implementation/world/check-kernel.d.ts +7 -5
- package/dist/implementation/world/check-kernel.js +51 -34
- package/dist/implementation/world/check-kernel.js.map +1 -1
- package/dist/implementation/world/claims.js +1 -0
- package/dist/implementation/world/claims.js.map +1 -1
- package/dist/implementation/world/closure.js +1 -0
- package/dist/implementation/world/closure.js.map +1 -1
- package/dist/implementation/world/command-ring.js +2 -1
- package/dist/implementation/world/command-ring.js.map +1 -1
- package/dist/implementation/world/commands.js +26 -4
- package/dist/implementation/world/commands.js.map +1 -1
- package/dist/implementation/world/create.d.ts +40 -0
- package/dist/implementation/world/create.js +479 -257
- package/dist/implementation/world/create.js.map +1 -1
- package/dist/implementation/world/directories.js +2 -1
- package/dist/implementation/world/directories.js.map +1 -1
- package/dist/implementation/world/entities.js.map +1 -1
- package/dist/implementation/world/execute.d.ts +1 -7
- package/dist/implementation/world/execute.js +248 -107
- package/dist/implementation/world/execute.js.map +1 -1
- package/dist/implementation/world/failures.d.ts +48 -5
- package/dist/implementation/world/failures.js +36 -4
- package/dist/implementation/world/failures.js.map +1 -1
- package/dist/implementation/world/finalizers.d.ts +2 -0
- package/dist/implementation/world/finalizers.js +42 -14
- package/dist/implementation/world/finalizers.js.map +1 -1
- package/dist/implementation/world/gpu.d.ts +8 -8
- package/dist/implementation/world/gpu.js +21 -12
- package/dist/implementation/world/gpu.js.map +1 -1
- package/dist/implementation/world/holders.js +1 -0
- package/dist/implementation/world/holders.js.map +1 -1
- package/dist/implementation/world/index-build.js +1 -0
- package/dist/implementation/world/index-build.js.map +1 -1
- package/dist/implementation/world/index-hash.d.ts +52 -13
- package/dist/implementation/world/index-hash.js +440 -71
- package/dist/implementation/world/index-hash.js.map +1 -1
- package/dist/implementation/world/index-keys.js +1 -0
- package/dist/implementation/world/index-keys.js.map +1 -1
- package/dist/implementation/world/index-lookups.d.ts +3 -3
- package/dist/implementation/world/index-lookups.js +22 -17
- package/dist/implementation/world/index-lookups.js.map +1 -1
- package/dist/implementation/world/index-order.js.map +1 -1
- package/dist/implementation/world/index-readers.js.map +1 -1
- package/dist/implementation/world/index-sorted.d.ts +2 -2
- package/dist/implementation/world/index-sorted.js +10 -4
- package/dist/implementation/world/index-sorted.js.map +1 -1
- package/dist/implementation/world/indexes.d.ts +9 -14
- package/dist/implementation/world/indexes.js +57 -115
- package/dist/implementation/world/indexes.js.map +1 -1
- package/dist/implementation/world/input.js +1 -1
- package/dist/implementation/world/input.js.map +1 -1
- package/dist/implementation/world/intrinsics.js.map +1 -1
- package/dist/implementation/world/join.d.ts +10 -7
- package/dist/implementation/world/join.js +116 -59
- package/dist/implementation/world/join.js.map +1 -1
- package/dist/implementation/world/joined-observer.d.ts +31 -2
- package/dist/implementation/world/joined-observer.js +69 -17
- package/dist/implementation/world/joined-observer.js.map +1 -1
- package/dist/implementation/world/joining.d.ts +60 -6
- package/dist/implementation/world/joining.js +47 -3
- package/dist/implementation/world/joining.js.map +1 -1
- package/dist/implementation/world/journal.d.ts +3 -2
- package/dist/implementation/world/journal.js +7 -4
- package/dist/implementation/world/journal.js.map +1 -1
- package/dist/implementation/world/kernel-indexes.d.ts +9 -2
- package/dist/implementation/world/kernel-indexes.js +13 -3
- package/dist/implementation/world/kernel-indexes.js.map +1 -1
- package/dist/implementation/world/kernel.d.ts +39 -5
- package/dist/implementation/world/kernel.js +2 -0
- package/dist/implementation/world/kernel.js.map +1 -1
- package/dist/implementation/world/kernels.d.ts +10 -2
- package/dist/implementation/world/kernels.js +85 -13
- package/dist/implementation/world/kernels.js.map +1 -1
- package/dist/implementation/world/layout-directory.d.ts +28 -12
- package/dist/implementation/world/layout-directory.js +72 -17
- package/dist/implementation/world/layout-directory.js.map +1 -1
- package/dist/implementation/world/lists.d.ts +37 -7
- package/dist/implementation/world/lists.js +169 -29
- package/dist/implementation/world/lists.js.map +1 -1
- package/dist/implementation/world/lookup-keys.d.ts +9 -8
- package/dist/implementation/world/lookup-keys.js.map +1 -1
- package/dist/implementation/world/loop.js +4 -5
- package/dist/implementation/world/loop.js.map +1 -1
- package/dist/implementation/world/memory.js +1 -0
- package/dist/implementation/world/memory.js.map +1 -1
- package/dist/implementation/world/mirror.d.ts +16 -3
- package/dist/implementation/world/mirror.js +37 -9
- package/dist/implementation/world/mirror.js.map +1 -1
- package/dist/implementation/world/move-log.js.map +1 -1
- package/dist/implementation/world/observer.d.ts +1 -1
- package/dist/implementation/world/observer.js +1 -2
- package/dist/implementation/world/observer.js.map +1 -1
- package/dist/implementation/world/order.js +1 -0
- package/dist/implementation/world/order.js.map +1 -1
- package/dist/implementation/world/out-of-band.d.ts +28 -0
- package/dist/implementation/world/out-of-band.js +66 -0
- package/dist/implementation/world/out-of-band.js.map +1 -0
- package/dist/implementation/world/plan.js.map +1 -1
- package/dist/implementation/world/pool.js +1 -0
- package/dist/implementation/world/pool.js.map +1 -1
- package/dist/implementation/world/port.d.ts +4 -3
- package/dist/implementation/world/port.js +14 -9
- package/dist/implementation/world/port.js.map +1 -1
- package/dist/implementation/world/prepared-lookup.js +1 -0
- package/dist/implementation/world/prepared-lookup.js.map +1 -1
- package/dist/implementation/world/prepared-spawn.js +13 -9
- package/dist/implementation/world/prepared-spawn.js.map +1 -1
- package/dist/implementation/world/program.js.map +1 -1
- package/dist/implementation/world/protocol.d.ts +8 -1
- package/dist/implementation/world/protocol.js.map +1 -1
- package/dist/implementation/world/publish.js.map +1 -1
- package/dist/implementation/world/ranges.d.ts +13 -3
- package/dist/implementation/world/ranges.js +118 -35
- package/dist/implementation/world/ranges.js.map +1 -1
- package/dist/implementation/world/reclaim.d.ts +27 -0
- package/dist/implementation/world/reclaim.js +176 -0
- package/dist/implementation/world/reclaim.js.map +1 -0
- package/dist/implementation/world/reductions.d.ts +7 -6
- package/dist/implementation/world/reductions.js +11 -11
- package/dist/implementation/world/reductions.js.map +1 -1
- package/dist/implementation/world/register.js +2 -2
- package/dist/implementation/world/register.js.map +1 -1
- package/dist/implementation/world/remote-systems.d.ts +9 -4
- package/dist/implementation/world/remote-systems.js +33 -28
- package/dist/implementation/world/remote-systems.js.map +1 -1
- package/dist/implementation/world/remote.js +1 -0
- package/dist/implementation/world/remote.js.map +1 -1
- package/dist/implementation/world/render-order.d.ts +19 -0
- package/dist/implementation/world/render-order.js +126 -0
- package/dist/implementation/world/render-order.js.map +1 -0
- package/dist/implementation/world/required.d.ts +3 -0
- package/dist/implementation/world/required.js +9 -0
- package/dist/implementation/world/required.js.map +1 -0
- package/dist/implementation/world/resources.d.ts +4 -1
- package/dist/implementation/world/resources.js +6 -3
- package/dist/implementation/world/resources.js.map +1 -1
- package/dist/implementation/world/rows.d.ts +15 -12
- package/dist/implementation/world/rows.js +90 -20
- package/dist/implementation/world/rows.js.map +1 -1
- package/dist/implementation/world/runner.d.ts +10 -0
- package/dist/implementation/world/runner.js +398 -78
- package/dist/implementation/world/runner.js.map +1 -1
- package/dist/implementation/world/shared.d.ts +55 -0
- package/dist/implementation/world/shared.js +301 -0
- package/dist/implementation/world/shared.js.map +1 -0
- package/dist/implementation/world/sharing.d.ts +7 -6
- package/dist/implementation/world/sharing.js +86 -23
- package/dist/implementation/world/sharing.js.map +1 -1
- package/dist/implementation/world/staging.d.ts +28 -5
- package/dist/implementation/world/staging.js +35 -9
- package/dist/implementation/world/staging.js.map +1 -1
- package/dist/implementation/world/state.d.ts +72 -13
- package/dist/implementation/world/state.js +138 -14
- package/dist/implementation/world/state.js.map +1 -1
- package/dist/implementation/world/stop-lists.d.ts +25 -2
- package/dist/implementation/world/stop-lists.js +63 -8
- package/dist/implementation/world/stop-lists.js.map +1 -1
- package/dist/implementation/world/strings.js +1 -0
- package/dist/implementation/world/strings.js.map +1 -1
- package/dist/implementation/world/structure.d.ts +1 -1
- package/dist/implementation/world/structure.js +4 -1
- package/dist/implementation/world/structure.js.map +1 -1
- package/dist/implementation/world/synchronize.d.ts +1 -1
- package/dist/implementation/world/synchronize.js +59 -17
- package/dist/implementation/world/synchronize.js.map +1 -1
- package/dist/implementation/world/tail-blocks.d.ts +5 -2
- package/dist/implementation/world/tail-blocks.js +9 -4
- package/dist/implementation/world/tail-blocks.js.map +1 -1
- package/dist/implementation/world/tails.d.ts +10 -5
- package/dist/implementation/world/tails.js +25 -18
- package/dist/implementation/world/tails.js.map +1 -1
- package/dist/implementation/world/terminal.js +1 -0
- package/dist/implementation/world/terminal.js.map +1 -1
- package/dist/implementation/world/thread-directory.d.ts +8 -2
- package/dist/implementation/world/thread-directory.js +82 -12
- package/dist/implementation/world/thread-directory.js.map +1 -1
- package/dist/implementation/world/thread-finalizers.d.ts +1 -2
- package/dist/implementation/world/thread-finalizers.js +129 -19
- package/dist/implementation/world/thread-finalizers.js.map +1 -1
- package/dist/implementation/world/thread-indexes.d.ts +3 -1
- package/dist/implementation/world/thread-indexes.js +4 -3
- package/dist/implementation/world/thread-indexes.js.map +1 -1
- package/dist/implementation/world/thread-observer.d.ts +4 -2
- package/dist/implementation/world/thread-observer.js +53 -11
- package/dist/implementation/world/thread-observer.js.map +1 -1
- package/dist/implementation/world/thread-systems.d.ts +10 -2
- package/dist/implementation/world/thread-systems.js +396 -78
- package/dist/implementation/world/thread-systems.js.map +1 -1
- package/dist/implementation/world/thread-tasks.d.ts +8 -4
- package/dist/implementation/world/thread-tasks.js +9 -4
- package/dist/implementation/world/thread-tasks.js.map +1 -1
- package/dist/implementation/world/transfers.js.map +1 -1
- package/dist/implementation/world/up.d.ts +9 -6
- package/dist/implementation/world/up.js +291 -75
- package/dist/implementation/world/up.js.map +1 -1
- package/dist/implementation/world/wasm.d.ts +39 -8
- package/dist/implementation/world/wasm.js +428 -127
- package/dist/implementation/world/wasm.js.map +1 -1
- package/dist/implementation/world/wgsl.d.ts +4 -2
- package/dist/implementation/world/wgsl.js +20 -8
- package/dist/implementation/world/wgsl.js.map +1 -1
- package/dist/implementation/world/where.d.ts +74 -0
- package/dist/implementation/world/where.js +202 -0
- package/dist/implementation/world/where.js.map +1 -0
- package/dist/implementation/world/worker-platform.js.map +1 -1
- package/dist/implementation/world/worker-window.d.ts +7 -0
- package/dist/implementation/world/worker-window.js +47 -0
- package/dist/implementation/world/worker-window.js.map +1 -0
- package/dist/implementation/world/worker.js +47 -61
- package/dist/implementation/world/worker.js.map +1 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/interface/component/component.js +1 -0
- package/dist/interface/component/component.js.map +1 -1
- package/dist/interface/component/index.d.ts +0 -1
- package/dist/interface/component/index.js +1 -1
- package/dist/interface/component/index.js.map +1 -1
- package/dist/interface/component/types.d.ts +2 -2
- package/dist/interface/component/value.d.ts +7 -2
- package/dist/interface/entity/entity.js.map +1 -1
- package/dist/interface/entity/index.d.ts +2 -0
- package/dist/interface/entity/index.js +2 -0
- package/dist/interface/entity/index.js.map +1 -1
- package/dist/interface/finalizer/body.d.ts +14 -11
- package/dist/interface/finalizer/create.d.ts +14 -14
- package/dist/interface/finalizer/create.js +43 -10
- package/dist/interface/finalizer/create.js.map +1 -1
- package/dist/interface/finalizer/created.d.ts +5 -5
- package/dist/interface/finalizer/declaration.d.ts +33 -13
- package/dist/interface/finalizer/finalizer.d.ts +2 -2
- package/dist/interface/finalizer/finalizer.js.map +1 -1
- package/dist/interface/finalizer/index.js +1 -0
- package/dist/interface/finalizer/index.js.map +1 -1
- package/dist/interface/gpu/accessors.d.ts +4 -3
- package/dist/interface/gpu/accessors.js +25 -8
- package/dist/interface/gpu/accessors.js.map +1 -1
- package/dist/interface/gpu/gpu.js.map +1 -1
- package/dist/interface/gpu/index.js +1 -0
- package/dist/interface/gpu/index.js.map +1 -1
- package/dist/interface/gpu/layout.js +1 -0
- package/dist/interface/gpu/layout.js.map +1 -1
- package/dist/interface/gpu/record.js +1 -0
- package/dist/interface/gpu/record.js.map +1 -1
- package/dist/interface/gpu/wgsl.d.ts +2 -1
- package/dist/interface/gpu/wgsl.js +9 -5
- package/dist/interface/gpu/wgsl.js.map +1 -1
- package/dist/interface/index.d.ts +0 -3
- package/dist/interface/index.js +1 -3
- package/dist/interface/index.js.map +1 -1
- package/dist/interface/indexes/create.d.ts +18 -9
- package/dist/interface/indexes/create.js +16 -13
- package/dist/interface/indexes/create.js.map +1 -1
- package/dist/interface/indexes/created.d.ts +2 -2
- package/dist/interface/indexes/declaration.d.ts +8 -3
- package/dist/interface/indexes/index-type.d.ts +3 -3
- package/dist/interface/indexes/index-type.js.map +1 -1
- package/dist/interface/indexes/index.js +1 -0
- package/dist/interface/indexes/index.js.map +1 -1
- package/dist/interface/math/f32/default.d.ts +4 -0
- package/dist/interface/math/f32/default.js +4 -0
- package/dist/interface/math/f32/default.js.map +1 -0
- package/dist/interface/math/f32/index.d.ts +3 -1
- package/dist/interface/math/f32/index.js.map +1 -1
- package/dist/interface/math/f32/public.d.ts +1 -0
- package/dist/interface/math/f32/public.js +2 -0
- package/dist/interface/math/f32/public.js.map +1 -1
- package/dist/interface/math/f32/round-half-even.js +1 -0
- package/dist/interface/math/f32/round-half-even.js.map +1 -1
- package/dist/interface/math/f32/schema.js.map +1 -1
- package/dist/interface/math/i32/default.d.ts +4 -0
- package/dist/interface/math/i32/default.js +4 -0
- package/dist/interface/math/i32/default.js.map +1 -0
- package/dist/interface/math/i32/index.d.ts +3 -1
- package/dist/interface/math/i32/index.js.map +1 -1
- package/dist/interface/math/i32/public.d.ts +1 -0
- package/dist/interface/math/i32/public.js +2 -0
- package/dist/interface/math/i32/public.js.map +1 -1
- package/dist/interface/math/i32/schema.js.map +1 -1
- package/dist/interface/math/i32/shift-right.js.map +1 -1
- package/dist/interface/math/index.js +1 -0
- package/dist/interface/math/index.js.map +1 -1
- package/dist/interface/math/intrinsic.js.map +1 -1
- package/dist/interface/math/mat4x4/add.js.map +1 -1
- package/dist/interface/math/mat4x4/determinant.js.map +1 -1
- package/dist/interface/math/mat4x4/identity.js.map +1 -1
- package/dist/interface/math/mat4x4/index.d.ts +3 -1
- package/dist/interface/math/mat4x4/index.js.map +1 -1
- package/dist/interface/math/mat4x4/inverse.js.map +1 -1
- package/dist/interface/math/mat4x4/look-at.js.map +1 -1
- package/dist/interface/math/mat4x4/multiply-vec3.js.map +1 -1
- package/dist/interface/math/mat4x4/multiply-vec4.js.map +1 -1
- package/dist/interface/math/mat4x4/multiply.js.map +1 -1
- package/dist/interface/math/mat4x4/orthographic.js.map +1 -1
- package/dist/interface/math/mat4x4/perspective.js.map +1 -1
- package/dist/interface/math/mat4x4/public.d.ts +1 -0
- package/dist/interface/math/mat4x4/public.js +2 -0
- package/dist/interface/math/mat4x4/public.js.map +1 -1
- package/dist/interface/math/mat4x4/rotation-x.js.map +1 -1
- package/dist/interface/math/mat4x4/rotation-y.js.map +1 -1
- package/dist/interface/math/mat4x4/rotation-z.js.map +1 -1
- package/dist/interface/math/mat4x4/scale.js.map +1 -1
- package/dist/interface/math/mat4x4/scaling.js.map +1 -1
- package/dist/interface/math/mat4x4/schema.js.map +1 -1
- package/dist/interface/math/mat4x4/subtract.js.map +1 -1
- package/dist/interface/math/mat4x4/translation.js.map +1 -1
- package/dist/interface/math/mat4x4/transpose.js.map +1 -1
- package/dist/interface/math/mat4x4/zero.js.map +1 -1
- package/dist/interface/math/quat/add.js.map +1 -1
- package/dist/interface/math/quat/align-to.js.map +1 -1
- package/dist/interface/math/quat/conjugate.js.map +1 -1
- package/dist/interface/math/quat/distance.js.map +1 -1
- package/dist/interface/math/quat/dot.js.map +1 -1
- package/dist/interface/math/quat/from-axis-angle.js.map +1 -1
- package/dist/interface/math/quat/from-euler.js.map +1 -1
- package/dist/interface/math/quat/identity.js.map +1 -1
- package/dist/interface/math/quat/index.d.ts +3 -1
- package/dist/interface/math/quat/index.js.map +1 -1
- package/dist/interface/math/quat/inverse.js.map +1 -1
- package/dist/interface/math/quat/length-squared.js.map +1 -1
- package/dist/interface/math/quat/length.js.map +1 -1
- package/dist/interface/math/quat/lerp.js.map +1 -1
- package/dist/interface/math/quat/look-at.js.map +1 -1
- package/dist/interface/math/quat/multiply.js.map +1 -1
- package/dist/interface/math/quat/negate.js.map +1 -1
- package/dist/interface/math/quat/normalize.js.map +1 -1
- package/dist/interface/math/quat/public.d.ts +1 -0
- package/dist/interface/math/quat/public.js +2 -0
- package/dist/interface/math/quat/public.js.map +1 -1
- package/dist/interface/math/quat/rotate-vec3.js.map +1 -1
- package/dist/interface/math/quat/scale.js.map +1 -1
- package/dist/interface/math/quat/schema.js.map +1 -1
- package/dist/interface/math/quat/slerp.js.map +1 -1
- package/dist/interface/math/quat/subtract.js.map +1 -1
- package/dist/interface/math/quat/to-axis-angle.js.map +1 -1
- package/dist/interface/math/quat/to-euler.js.map +1 -1
- package/dist/interface/math/quat/to-mat4.js.map +1 -1
- package/dist/interface/math/u32/count-leading-zeros.js.map +1 -1
- package/dist/interface/math/u32/count-one-bits.js.map +1 -1
- package/dist/interface/math/u32/count-trailing-zeros.js.map +1 -1
- package/dist/interface/math/u32/default.d.ts +4 -0
- package/dist/interface/math/u32/default.js +4 -0
- package/dist/interface/math/u32/default.js.map +1 -0
- package/dist/interface/math/u32/index.d.ts +3 -1
- package/dist/interface/math/u32/index.js.map +1 -1
- package/dist/interface/math/u32/public.d.ts +1 -0
- package/dist/interface/math/u32/public.js +2 -0
- package/dist/interface/math/u32/public.js.map +1 -1
- package/dist/interface/math/u32/reverse-bits.js.map +1 -1
- package/dist/interface/math/u32/schema.js.map +1 -1
- package/dist/interface/math/u32/shift-right.js.map +1 -1
- package/dist/interface/math/vec2/f32/abs.js.map +1 -1
- package/dist/interface/math/vec2/f32/acos.js.map +1 -1
- package/dist/interface/math/vec2/f32/acosh.js.map +1 -1
- package/dist/interface/math/vec2/f32/add.js.map +1 -1
- package/dist/interface/math/vec2/f32/asin.js.map +1 -1
- package/dist/interface/math/vec2/f32/asinh.js.map +1 -1
- package/dist/interface/math/vec2/f32/atan.js.map +1 -1
- package/dist/interface/math/vec2/f32/atanh.js.map +1 -1
- package/dist/interface/math/vec2/f32/ceil.js.map +1 -1
- package/dist/interface/math/vec2/f32/clamp.js.map +1 -1
- package/dist/interface/math/vec2/f32/cos.js.map +1 -1
- package/dist/interface/math/vec2/f32/cosh.js.map +1 -1
- package/dist/interface/math/vec2/f32/distance.js.map +1 -1
- package/dist/interface/math/vec2/f32/dot.js.map +1 -1
- package/dist/interface/math/vec2/f32/equals.js.map +1 -1
- package/dist/interface/math/vec2/f32/exp.js.map +1 -1
- package/dist/interface/math/vec2/f32/exp2.js.map +1 -1
- package/dist/interface/math/vec2/f32/f32.d.ts +3 -1
- package/dist/interface/math/vec2/f32/f32.js.map +1 -1
- package/dist/interface/math/vec2/f32/faceforward.js.map +1 -1
- package/dist/interface/math/vec2/f32/floor.js.map +1 -1
- package/dist/interface/math/vec2/f32/fract.js.map +1 -1
- package/dist/interface/math/vec2/f32/length.js.map +1 -1
- package/dist/interface/math/vec2/f32/log.js.map +1 -1
- package/dist/interface/math/vec2/f32/log2.js.map +1 -1
- package/dist/interface/math/vec2/f32/max.js.map +1 -1
- package/dist/interface/math/vec2/f32/min.js.map +1 -1
- package/dist/interface/math/vec2/f32/mix.js.map +1 -1
- package/dist/interface/math/vec2/f32/mod.js.map +1 -1
- package/dist/interface/math/vec2/f32/modf.js.map +1 -1
- package/dist/interface/math/vec2/f32/negate.js.map +1 -1
- package/dist/interface/math/vec2/f32/normalize.js.map +1 -1
- package/dist/interface/math/vec2/f32/pow.js.map +1 -1
- package/dist/interface/math/vec2/f32/public.d.ts +1 -0
- package/dist/interface/math/vec2/f32/public.js +2 -0
- package/dist/interface/math/vec2/f32/public.js.map +1 -1
- package/dist/interface/math/vec2/f32/reflect.js.map +1 -1
- package/dist/interface/math/vec2/f32/refract.js.map +1 -1
- package/dist/interface/math/vec2/f32/round.js.map +1 -1
- package/dist/interface/math/vec2/f32/scale.js.map +1 -1
- package/dist/interface/math/vec2/f32/schema.js.map +1 -1
- package/dist/interface/math/vec2/f32/sign.js.map +1 -1
- package/dist/interface/math/vec2/f32/sin.js.map +1 -1
- package/dist/interface/math/vec2/f32/sinh.js.map +1 -1
- package/dist/interface/math/vec2/f32/smoothstep.js.map +1 -1
- package/dist/interface/math/vec2/f32/sqrt.js.map +1 -1
- package/dist/interface/math/vec2/f32/step.js.map +1 -1
- package/dist/interface/math/vec2/f32/subtract.js.map +1 -1
- package/dist/interface/math/vec2/f32/tan.js.map +1 -1
- package/dist/interface/math/vec2/f32/tanh.js.map +1 -1
- package/dist/interface/math/vec2/f32/trunc.js.map +1 -1
- package/dist/interface/math/vec2/f32/zero.js.map +1 -1
- package/dist/interface/math/vec2/i32/abs.js.map +1 -1
- package/dist/interface/math/vec2/i32/add.js.map +1 -1
- package/dist/interface/math/vec2/i32/bitwise-and.js.map +1 -1
- package/dist/interface/math/vec2/i32/bitwise-not.js.map +1 -1
- package/dist/interface/math/vec2/i32/bitwise-or.js.map +1 -1
- package/dist/interface/math/vec2/i32/bitwise-xor.js.map +1 -1
- package/dist/interface/math/vec2/i32/clamp.js.map +1 -1
- package/dist/interface/math/vec2/i32/count-leading-zeros.js.map +1 -1
- package/dist/interface/math/vec2/i32/count-one-bits.js.map +1 -1
- package/dist/interface/math/vec2/i32/count-trailing-zeros.js.map +1 -1
- package/dist/interface/math/vec2/i32/equals.js.map +1 -1
- package/dist/interface/math/vec2/i32/i32.d.ts +3 -1
- package/dist/interface/math/vec2/i32/i32.js.map +1 -1
- package/dist/interface/math/vec2/i32/max.js.map +1 -1
- package/dist/interface/math/vec2/i32/min.js.map +1 -1
- package/dist/interface/math/vec2/i32/negate.js.map +1 -1
- package/dist/interface/math/vec2/i32/public.d.ts +1 -0
- package/dist/interface/math/vec2/i32/public.js +2 -0
- package/dist/interface/math/vec2/i32/public.js.map +1 -1
- package/dist/interface/math/vec2/i32/reverse-bits.js.map +1 -1
- package/dist/interface/math/vec2/i32/scale.js.map +1 -1
- package/dist/interface/math/vec2/i32/schema.js.map +1 -1
- package/dist/interface/math/vec2/i32/shift-left.js.map +1 -1
- package/dist/interface/math/vec2/i32/shift-right.js.map +1 -1
- package/dist/interface/math/vec2/i32/subtract.js.map +1 -1
- package/dist/interface/math/vec2/i32/zero.js.map +1 -1
- package/dist/interface/math/vec2/index.js.map +1 -1
- package/dist/interface/math/vec2/public.d.ts +1 -0
- package/dist/interface/math/vec2/public.js +2 -0
- package/dist/interface/math/vec2/public.js.map +1 -1
- package/dist/interface/math/vec2/u32/add.js.map +1 -1
- package/dist/interface/math/vec2/u32/bitwise-and.js.map +1 -1
- package/dist/interface/math/vec2/u32/bitwise-not.js.map +1 -1
- package/dist/interface/math/vec2/u32/bitwise-or.js.map +1 -1
- package/dist/interface/math/vec2/u32/bitwise-xor.js.map +1 -1
- package/dist/interface/math/vec2/u32/clamp.js.map +1 -1
- package/dist/interface/math/vec2/u32/count-leading-zeros.js.map +1 -1
- package/dist/interface/math/vec2/u32/count-one-bits.js.map +1 -1
- package/dist/interface/math/vec2/u32/count-trailing-zeros.js.map +1 -1
- package/dist/interface/math/vec2/u32/equals.js.map +1 -1
- package/dist/interface/math/vec2/u32/max.js.map +1 -1
- package/dist/interface/math/vec2/u32/min.js.map +1 -1
- package/dist/interface/math/vec2/u32/negate.js.map +1 -1
- package/dist/interface/math/vec2/u32/public.d.ts +1 -0
- package/dist/interface/math/vec2/u32/public.js +2 -0
- package/dist/interface/math/vec2/u32/public.js.map +1 -1
- package/dist/interface/math/vec2/u32/reverse-bits.js.map +1 -1
- package/dist/interface/math/vec2/u32/scale.js.map +1 -1
- package/dist/interface/math/vec2/u32/schema.js.map +1 -1
- package/dist/interface/math/vec2/u32/shift-left.js.map +1 -1
- package/dist/interface/math/vec2/u32/shift-right.js.map +1 -1
- package/dist/interface/math/vec2/u32/subtract.js.map +1 -1
- package/dist/interface/math/vec2/u32/u32.d.ts +3 -1
- package/dist/interface/math/vec2/u32/u32.js.map +1 -1
- package/dist/interface/math/vec2/u32/zero.js.map +1 -1
- package/dist/interface/math/vec3/f32/abs.js.map +1 -1
- package/dist/interface/math/vec3/f32/acos.js.map +1 -1
- package/dist/interface/math/vec3/f32/acosh.js.map +1 -1
- package/dist/interface/math/vec3/f32/add.js.map +1 -1
- package/dist/interface/math/vec3/f32/asin.js.map +1 -1
- package/dist/interface/math/vec3/f32/asinh.js.map +1 -1
- package/dist/interface/math/vec3/f32/atan.js.map +1 -1
- package/dist/interface/math/vec3/f32/atanh.js.map +1 -1
- package/dist/interface/math/vec3/f32/ceil.js.map +1 -1
- package/dist/interface/math/vec3/f32/clamp.js.map +1 -1
- package/dist/interface/math/vec3/f32/cos.js.map +1 -1
- package/dist/interface/math/vec3/f32/cosh.js.map +1 -1
- package/dist/interface/math/vec3/f32/cross.js.map +1 -1
- package/dist/interface/math/vec3/f32/distance-squared.js.map +1 -1
- package/dist/interface/math/vec3/f32/distance.js.map +1 -1
- package/dist/interface/math/vec3/f32/dot.js.map +1 -1
- package/dist/interface/math/vec3/f32/equals.js.map +1 -1
- package/dist/interface/math/vec3/f32/exp.js.map +1 -1
- package/dist/interface/math/vec3/f32/exp2.js.map +1 -1
- package/dist/interface/math/vec3/f32/f32.d.ts +3 -1
- package/dist/interface/math/vec3/f32/f32.js.map +1 -1
- package/dist/interface/math/vec3/f32/faceforward.js.map +1 -1
- package/dist/interface/math/vec3/f32/floor.js.map +1 -1
- package/dist/interface/math/vec3/f32/fract.js.map +1 -1
- package/dist/interface/math/vec3/f32/length-squared.js.map +1 -1
- package/dist/interface/math/vec3/f32/length.js.map +1 -1
- package/dist/interface/math/vec3/f32/log.js.map +1 -1
- package/dist/interface/math/vec3/f32/log2.js.map +1 -1
- package/dist/interface/math/vec3/f32/max.js.map +1 -1
- package/dist/interface/math/vec3/f32/min.js.map +1 -1
- package/dist/interface/math/vec3/f32/mix.js.map +1 -1
- package/dist/interface/math/vec3/f32/mod.js.map +1 -1
- package/dist/interface/math/vec3/f32/modf.js.map +1 -1
- package/dist/interface/math/vec3/f32/multiply.js.map +1 -1
- package/dist/interface/math/vec3/f32/negate.js.map +1 -1
- package/dist/interface/math/vec3/f32/normalize.js.map +1 -1
- package/dist/interface/math/vec3/f32/one.js.map +1 -1
- package/dist/interface/math/vec3/f32/pow.js.map +1 -1
- package/dist/interface/math/vec3/f32/public.d.ts +1 -0
- package/dist/interface/math/vec3/f32/public.js +2 -0
- package/dist/interface/math/vec3/f32/public.js.map +1 -1
- package/dist/interface/math/vec3/f32/random.js.map +1 -1
- package/dist/interface/math/vec3/f32/reflect.js.map +1 -1
- package/dist/interface/math/vec3/f32/refract.js.map +1 -1
- package/dist/interface/math/vec3/f32/round.js.map +1 -1
- package/dist/interface/math/vec3/f32/scale.js.map +1 -1
- package/dist/interface/math/vec3/f32/schema.js.map +1 -1
- package/dist/interface/math/vec3/f32/sign.js.map +1 -1
- package/dist/interface/math/vec3/f32/sin.js.map +1 -1
- package/dist/interface/math/vec3/f32/sinh.js.map +1 -1
- package/dist/interface/math/vec3/f32/smoothstep.js.map +1 -1
- package/dist/interface/math/vec3/f32/sqrt.js.map +1 -1
- package/dist/interface/math/vec3/f32/step.js.map +1 -1
- package/dist/interface/math/vec3/f32/subtract.js.map +1 -1
- package/dist/interface/math/vec3/f32/tan.js.map +1 -1
- package/dist/interface/math/vec3/f32/tanh.js.map +1 -1
- package/dist/interface/math/vec3/f32/trunc.js.map +1 -1
- package/dist/interface/math/vec3/f32/zero.js.map +1 -1
- package/dist/interface/math/vec3/i32/abs.js.map +1 -1
- package/dist/interface/math/vec3/i32/add.js.map +1 -1
- package/dist/interface/math/vec3/i32/bitwise-and.js.map +1 -1
- package/dist/interface/math/vec3/i32/bitwise-not.js.map +1 -1
- package/dist/interface/math/vec3/i32/bitwise-or.js.map +1 -1
- package/dist/interface/math/vec3/i32/bitwise-xor.js.map +1 -1
- package/dist/interface/math/vec3/i32/clamp.js.map +1 -1
- package/dist/interface/math/vec3/i32/count-leading-zeros.js.map +1 -1
- package/dist/interface/math/vec3/i32/count-one-bits.js.map +1 -1
- package/dist/interface/math/vec3/i32/count-trailing-zeros.js.map +1 -1
- package/dist/interface/math/vec3/i32/equals.js.map +1 -1
- package/dist/interface/math/vec3/i32/i32.d.ts +3 -1
- package/dist/interface/math/vec3/i32/i32.js.map +1 -1
- package/dist/interface/math/vec3/i32/max.js.map +1 -1
- package/dist/interface/math/vec3/i32/min.js.map +1 -1
- package/dist/interface/math/vec3/i32/multiply.js.map +1 -1
- package/dist/interface/math/vec3/i32/negate.js.map +1 -1
- package/dist/interface/math/vec3/i32/one.js.map +1 -1
- package/dist/interface/math/vec3/i32/public.d.ts +1 -0
- package/dist/interface/math/vec3/i32/public.js +2 -0
- package/dist/interface/math/vec3/i32/public.js.map +1 -1
- package/dist/interface/math/vec3/i32/reverse-bits.js.map +1 -1
- package/dist/interface/math/vec3/i32/scale.js.map +1 -1
- package/dist/interface/math/vec3/i32/schema.js.map +1 -1
- package/dist/interface/math/vec3/i32/shift-left.js.map +1 -1
- package/dist/interface/math/vec3/i32/shift-right.js.map +1 -1
- package/dist/interface/math/vec3/i32/subtract.js.map +1 -1
- package/dist/interface/math/vec3/i32/zero.js.map +1 -1
- package/dist/interface/math/vec3/index.js.map +1 -1
- package/dist/interface/math/vec3/public.d.ts +1 -0
- package/dist/interface/math/vec3/public.js +2 -0
- package/dist/interface/math/vec3/public.js.map +1 -1
- package/dist/interface/math/vec3/u32/add.js.map +1 -1
- package/dist/interface/math/vec3/u32/bitwise-and.js.map +1 -1
- package/dist/interface/math/vec3/u32/bitwise-not.js.map +1 -1
- package/dist/interface/math/vec3/u32/bitwise-or.js.map +1 -1
- package/dist/interface/math/vec3/u32/bitwise-xor.js.map +1 -1
- package/dist/interface/math/vec3/u32/clamp.js.map +1 -1
- package/dist/interface/math/vec3/u32/count-leading-zeros.js.map +1 -1
- package/dist/interface/math/vec3/u32/count-one-bits.js.map +1 -1
- package/dist/interface/math/vec3/u32/count-trailing-zeros.js.map +1 -1
- package/dist/interface/math/vec3/u32/equals.js.map +1 -1
- package/dist/interface/math/vec3/u32/max.js.map +1 -1
- package/dist/interface/math/vec3/u32/min.js.map +1 -1
- package/dist/interface/math/vec3/u32/multiply.js.map +1 -1
- package/dist/interface/math/vec3/u32/negate.js.map +1 -1
- package/dist/interface/math/vec3/u32/one.js.map +1 -1
- package/dist/interface/math/vec3/u32/public.d.ts +1 -0
- package/dist/interface/math/vec3/u32/public.js +2 -0
- package/dist/interface/math/vec3/u32/public.js.map +1 -1
- package/dist/interface/math/vec3/u32/reverse-bits.js.map +1 -1
- package/dist/interface/math/vec3/u32/scale.js.map +1 -1
- package/dist/interface/math/vec3/u32/schema.js.map +1 -1
- package/dist/interface/math/vec3/u32/shift-left.js.map +1 -1
- package/dist/interface/math/vec3/u32/shift-right.js.map +1 -1
- package/dist/interface/math/vec3/u32/subtract.js.map +1 -1
- package/dist/interface/math/vec3/u32/u32.d.ts +3 -1
- package/dist/interface/math/vec3/u32/u32.js.map +1 -1
- package/dist/interface/math/vec3/u32/volume.js.map +1 -1
- package/dist/interface/math/vec3/u32/zero.js.map +1 -1
- package/dist/interface/math/vec4/f32/abs.js.map +1 -1
- package/dist/interface/math/vec4/f32/acos.js.map +1 -1
- package/dist/interface/math/vec4/f32/acosh.js.map +1 -1
- package/dist/interface/math/vec4/f32/add.js.map +1 -1
- package/dist/interface/math/vec4/f32/asin.js.map +1 -1
- package/dist/interface/math/vec4/f32/asinh.js.map +1 -1
- package/dist/interface/math/vec4/f32/atan.js.map +1 -1
- package/dist/interface/math/vec4/f32/atanh.js.map +1 -1
- package/dist/interface/math/vec4/f32/ceil.js.map +1 -1
- package/dist/interface/math/vec4/f32/clamp.js.map +1 -1
- package/dist/interface/math/vec4/f32/cos.js.map +1 -1
- package/dist/interface/math/vec4/f32/cosh.js.map +1 -1
- package/dist/interface/math/vec4/f32/default.d.ts +4 -0
- package/dist/interface/math/vec4/f32/default.js +4 -0
- package/dist/interface/math/vec4/f32/default.js.map +1 -0
- package/dist/interface/math/vec4/f32/distance.js.map +1 -1
- package/dist/interface/math/vec4/f32/dot.js.map +1 -1
- package/dist/interface/math/vec4/f32/exp.js.map +1 -1
- package/dist/interface/math/vec4/f32/exp2.js.map +1 -1
- package/dist/interface/math/vec4/f32/f32.d.ts +3 -1
- package/dist/interface/math/vec4/f32/f32.js.map +1 -1
- package/dist/interface/math/vec4/f32/faceforward.js.map +1 -1
- package/dist/interface/math/vec4/f32/floor.js.map +1 -1
- package/dist/interface/math/vec4/f32/fract.js.map +1 -1
- package/dist/interface/math/vec4/f32/length.js.map +1 -1
- package/dist/interface/math/vec4/f32/log.js.map +1 -1
- package/dist/interface/math/vec4/f32/log2.js.map +1 -1
- package/dist/interface/math/vec4/f32/max.js.map +1 -1
- package/dist/interface/math/vec4/f32/min.js.map +1 -1
- package/dist/interface/math/vec4/f32/mix.js.map +1 -1
- package/dist/interface/math/vec4/f32/mod.js.map +1 -1
- package/dist/interface/math/vec4/f32/modf.js.map +1 -1
- package/dist/interface/math/vec4/f32/multiply.js.map +1 -1
- package/dist/interface/math/vec4/f32/negate.js.map +1 -1
- package/dist/interface/math/vec4/f32/normalize.js.map +1 -1
- package/dist/interface/math/vec4/f32/pow.js.map +1 -1
- package/dist/interface/math/vec4/f32/public.d.ts +1 -0
- package/dist/interface/math/vec4/f32/public.js +2 -0
- package/dist/interface/math/vec4/f32/public.js.map +1 -1
- package/dist/interface/math/vec4/f32/reflect.js.map +1 -1
- package/dist/interface/math/vec4/f32/refract.js.map +1 -1
- package/dist/interface/math/vec4/f32/round.js.map +1 -1
- package/dist/interface/math/vec4/f32/scale.js.map +1 -1
- package/dist/interface/math/vec4/f32/schema.js.map +1 -1
- package/dist/interface/math/vec4/f32/sign.js.map +1 -1
- package/dist/interface/math/vec4/f32/sin.js.map +1 -1
- package/dist/interface/math/vec4/f32/sinh.js.map +1 -1
- package/dist/interface/math/vec4/f32/smoothstep.js.map +1 -1
- package/dist/interface/math/vec4/f32/sqrt.js.map +1 -1
- package/dist/interface/math/vec4/f32/step.js.map +1 -1
- package/dist/interface/math/vec4/f32/subtract.js.map +1 -1
- package/dist/interface/math/vec4/f32/tan.js.map +1 -1
- package/dist/interface/math/vec4/f32/tanh.js.map +1 -1
- package/dist/interface/math/vec4/f32/trunc.js.map +1 -1
- package/dist/interface/math/vec4/i32/abs.js.map +1 -1
- package/dist/interface/math/vec4/i32/add.js.map +1 -1
- package/dist/interface/math/vec4/i32/bitwise-and.js.map +1 -1
- package/dist/interface/math/vec4/i32/bitwise-not.js.map +1 -1
- package/dist/interface/math/vec4/i32/bitwise-or.js.map +1 -1
- package/dist/interface/math/vec4/i32/bitwise-xor.js.map +1 -1
- package/dist/interface/math/vec4/i32/clamp.js.map +1 -1
- package/dist/interface/math/vec4/i32/count-leading-zeros.js.map +1 -1
- package/dist/interface/math/vec4/i32/count-one-bits.js.map +1 -1
- package/dist/interface/math/vec4/i32/count-trailing-zeros.js.map +1 -1
- package/dist/interface/math/vec4/i32/equals.js.map +1 -1
- package/dist/interface/math/vec4/i32/i32.d.ts +3 -1
- package/dist/interface/math/vec4/i32/i32.js.map +1 -1
- package/dist/interface/math/vec4/i32/max.js.map +1 -1
- package/dist/interface/math/vec4/i32/min.js.map +1 -1
- package/dist/interface/math/vec4/i32/multiply.js.map +1 -1
- package/dist/interface/math/vec4/i32/negate.js.map +1 -1
- package/dist/interface/math/vec4/i32/one.js.map +1 -1
- package/dist/interface/math/vec4/i32/public.d.ts +1 -0
- package/dist/interface/math/vec4/i32/public.js +2 -0
- package/dist/interface/math/vec4/i32/public.js.map +1 -1
- package/dist/interface/math/vec4/i32/reverse-bits.js.map +1 -1
- package/dist/interface/math/vec4/i32/scale.js.map +1 -1
- package/dist/interface/math/vec4/i32/schema.js.map +1 -1
- package/dist/interface/math/vec4/i32/shift-left.js.map +1 -1
- package/dist/interface/math/vec4/i32/shift-right.js.map +1 -1
- package/dist/interface/math/vec4/i32/subtract.js.map +1 -1
- package/dist/interface/math/vec4/i32/zero.js.map +1 -1
- package/dist/interface/math/vec4/index.js.map +1 -1
- package/dist/interface/math/vec4/public.d.ts +1 -0
- package/dist/interface/math/vec4/public.js +2 -0
- package/dist/interface/math/vec4/public.js.map +1 -1
- package/dist/interface/math/vec4/u32/add.js.map +1 -1
- package/dist/interface/math/vec4/u32/bitwise-and.js.map +1 -1
- package/dist/interface/math/vec4/u32/bitwise-not.js.map +1 -1
- package/dist/interface/math/vec4/u32/bitwise-or.js.map +1 -1
- package/dist/interface/math/vec4/u32/bitwise-xor.js.map +1 -1
- package/dist/interface/math/vec4/u32/clamp.js.map +1 -1
- package/dist/interface/math/vec4/u32/count-leading-zeros.js.map +1 -1
- package/dist/interface/math/vec4/u32/count-one-bits.js.map +1 -1
- package/dist/interface/math/vec4/u32/count-trailing-zeros.js.map +1 -1
- package/dist/interface/math/vec4/u32/equals.js.map +1 -1
- package/dist/interface/math/vec4/u32/max.js.map +1 -1
- package/dist/interface/math/vec4/u32/min.js.map +1 -1
- package/dist/interface/math/vec4/u32/multiply.js.map +1 -1
- package/dist/interface/math/vec4/u32/negate.js.map +1 -1
- package/dist/interface/math/vec4/u32/one.js.map +1 -1
- package/dist/interface/math/vec4/u32/public.d.ts +1 -0
- package/dist/interface/math/vec4/u32/public.js +2 -0
- package/dist/interface/math/vec4/u32/public.js.map +1 -1
- package/dist/interface/math/vec4/u32/reverse-bits.js.map +1 -1
- package/dist/interface/math/vec4/u32/scale.js.map +1 -1
- package/dist/interface/math/vec4/u32/schema.js.map +1 -1
- package/dist/interface/math/vec4/u32/shift-left.js.map +1 -1
- package/dist/interface/math/vec4/u32/shift-right.js.map +1 -1
- package/dist/interface/math/vec4/u32/subtract.js.map +1 -1
- package/dist/interface/math/vec4/u32/u32.d.ts +3 -1
- package/dist/interface/math/vec4/u32/u32.js.map +1 -1
- package/dist/interface/math/vec4/u32/zero.js.map +1 -1
- package/dist/interface/registry/archetypes.d.ts +25 -3
- package/dist/interface/registry/archetypes.js +40 -10
- package/dist/interface/registry/archetypes.js.map +1 -1
- package/dist/interface/registry/declarations.d.ts +7 -7
- package/dist/interface/registry/declarations.js +120 -10
- package/dist/interface/registry/declarations.js.map +1 -1
- package/dist/interface/registry/finalizer-order.js +3 -3
- package/dist/interface/registry/finalizer-order.js.map +1 -1
- package/dist/interface/registry/ids.d.ts +23 -0
- package/dist/interface/registry/ids.js +42 -0
- package/dist/interface/registry/ids.js.map +1 -1
- package/dist/interface/registry/index.d.ts +3 -3
- package/dist/interface/registry/index.js +3 -3
- package/dist/interface/registry/index.js.map +1 -1
- package/dist/interface/registry/indexes.js +2 -2
- package/dist/interface/registry/indexes.js.map +1 -1
- package/dist/interface/registry/items.d.ts +6 -11
- package/dist/interface/registry/items.js +14 -43
- package/dist/interface/registry/items.js.map +1 -1
- package/dist/interface/registry/layout.d.ts +3 -1
- package/dist/interface/registry/layout.js +7 -1
- package/dist/interface/registry/layout.js.map +1 -1
- package/dist/interface/registry/names.d.ts +13 -5
- package/dist/interface/registry/names.js +55 -38
- package/dist/interface/registry/names.js.map +1 -1
- package/dist/interface/registry/program.js.map +1 -1
- package/dist/interface/registry/reduction.js.map +1 -1
- package/dist/interface/registry/schedule.d.ts +5 -1
- package/dist/interface/registry/schedule.js +8 -13
- package/dist/interface/registry/schedule.js.map +1 -1
- package/dist/interface/registry/schemas.d.ts +9 -0
- package/dist/interface/registry/schemas.js +65 -0
- package/dist/interface/registry/schemas.js.map +1 -1
- package/dist/interface/registry/strata.js +1 -0
- package/dist/interface/registry/strata.js.map +1 -1
- package/dist/interface/registry/threads.js +3 -2
- package/dist/interface/registry/threads.js.map +1 -1
- package/dist/interface/registry/traits.js +2 -1
- package/dist/interface/registry/traits.js.map +1 -1
- package/dist/interface/registry/written.js +1 -0
- package/dist/interface/registry/written.js.map +1 -1
- package/dist/interface/resource/index.d.ts +0 -1
- package/dist/interface/resource/index.js +1 -1
- package/dist/interface/resource/index.js.map +1 -1
- package/dist/interface/resource/resource.js +1 -0
- package/dist/interface/resource/resource.js.map +1 -1
- package/dist/interface/resource/types.d.ts +4 -1
- package/dist/interface/resources/always.js +3 -2
- package/dist/interface/resources/always.js.map +1 -1
- package/dist/interface/resources/cadence.js +4 -3
- package/dist/interface/resources/cadence.js.map +1 -1
- package/dist/interface/resources/clock.js +5 -3
- package/dist/interface/resources/clock.js.map +1 -1
- package/dist/interface/resources/gpu-device.js +3 -2
- package/dist/interface/resources/gpu-device.js.map +1 -1
- package/dist/interface/resources/index.js +1 -0
- package/dist/interface/resources/index.js.map +1 -1
- package/dist/interface/resources/wake.js +3 -2
- package/dist/interface/resources/wake.js.map +1 -1
- package/dist/interface/resources/workers.js +3 -2
- package/dist/interface/resources/workers.js.map +1 -1
- package/dist/interface/rule/create.d.ts +6 -2
- package/dist/interface/rule/create.js +8 -6
- package/dist/interface/rule/create.js.map +1 -1
- package/dist/interface/rule/created.d.ts +3 -3
- package/dist/interface/rule/declaration.d.ts +8 -3
- package/dist/interface/rule/index.js +1 -0
- package/dist/interface/rule/index.js.map +1 -1
- package/dist/interface/rule/rule.js.map +1 -1
- package/dist/interface/schema/is-struct.d.ts +15 -0
- package/dist/interface/schema/schema.d.ts +21 -1
- package/dist/interface/system/access.d.ts +87 -26
- package/dist/interface/system/body.d.ts +53 -26
- package/dist/interface/system/check.d.ts +13 -3
- package/dist/interface/system/check.js +87 -47
- package/dist/interface/system/check.js.map +1 -1
- package/dist/interface/system/commands.d.ts +54 -5
- package/dist/interface/system/composite-declaration.d.ts +0 -2
- package/dist/interface/system/create-resolved.d.ts +9 -0
- package/dist/interface/system/create-resolved.js +18 -0
- package/dist/interface/system/create-resolved.js.map +1 -0
- package/dist/interface/system/create.d.ts +116 -110
- package/dist/interface/system/create.js +34 -8
- package/dist/interface/system/create.js.map +1 -1
- package/dist/interface/system/declaration.d.ts +33 -29
- package/dist/interface/system/index.js.map +1 -1
- package/dist/interface/system/input.d.ts +37 -6
- package/dist/interface/system/leaf.d.ts +10 -3
- package/dist/interface/system/name.d.ts +3 -3
- package/dist/interface/system/property.js +1 -0
- package/dist/interface/system/property.js.map +1 -1
- package/dist/interface/system/render.d.ts +35 -16
- package/dist/interface/system/render.js +19 -5
- package/dist/interface/system/render.js.map +1 -1
- package/dist/interface/system/resolve.d.ts +68 -0
- package/dist/interface/system/resolve.js +138 -0
- package/dist/interface/system/resolve.js.map +1 -0
- package/dist/interface/system/system.d.ts +5 -3
- package/dist/interface/system/system.js.map +1 -1
- package/dist/interface/system/threads.d.ts +8 -7
- package/dist/interface/system/values-of.d.ts +17 -0
- package/dist/interface/system/values-of.js.map +1 -0
- package/dist/interface/system/values.d.ts +12 -12
- package/dist/interface/thread/of.d.ts +4 -2
- package/dist/interface/trait/key.d.ts +1 -1
- package/dist/interface/trait/types.d.ts +23 -5
- package/dist/interface/world/create.d.ts +8 -2
- package/dist/interface/world/declarations.d.ts +37 -0
- package/dist/interface/world/declarations.js +2 -0
- package/dist/interface/world/declarations.js.map +1 -0
- package/dist/interface/world/filter.js +1 -0
- package/dist/interface/world/filter.js.map +1 -1
- package/dist/interface/world/join.d.ts +10 -4
- package/dist/interface/world/world.d.ts +31 -17
- package/package.json +18 -5
- package/src/exports.test.ts +149 -44
- package/src/guide/00-keys.md +34 -0
- package/src/guide/00-keys.out +1 -0
- package/src/guide/00-keys.ts +35 -0
- package/src/guide/00-setup.md +24 -0
- package/src/guide/01-resources.md +22 -0
- package/src/guide/01-resources.out +2 -0
- package/src/guide/01-resources.ts +33 -0
- package/src/guide/02-entities.md +19 -0
- package/src/guide/02-entities.out +2 -0
- package/src/guide/02-entities.ts +43 -0
- package/src/guide/03-systems.md +22 -0
- package/src/guide/03-systems.out +5 -0
- package/src/guide/03-systems.ts +68 -0
- package/src/guide/04-ticks.md +18 -0
- package/src/guide/04-ticks.out +3 -0
- package/src/guide/04-ticks.ts +53 -0
- package/src/guide/05-scheduling.md +14 -0
- package/src/guide/05-scheduling.out +2 -0
- package/src/guide/05-scheduling.ts +46 -0
- package/src/guide/06-sync-points.md +14 -0
- package/src/guide/06-sync-points.out +3 -0
- package/src/guide/06-sync-points.ts +42 -0
- package/src/guide/07-change-filters.md +14 -0
- package/src/guide/07-change-filters.out +6 -0
- package/src/guide/07-change-filters.ts +70 -0
- package/src/guide/08-input.md +12 -0
- package/src/guide/08-input.out +1 -0
- package/src/guide/08-input.ts +45 -0
- package/src/guide/09-rules.md +12 -0
- package/src/guide/09-rules.out +2 -0
- package/src/guide/09-rules.ts +50 -0
- package/src/guide/10-finalizers.md +13 -0
- package/src/guide/10-finalizers.out +4 -0
- package/src/guide/10-finalizers.ts +48 -0
- package/src/guide/11-traits.md +16 -0
- package/src/guide/11-traits.out +2 -0
- package/src/guide/11-traits.ts +51 -0
- package/src/guide/11-traits.type-test.ts +11 -13
- package/src/guide/12-lookups.md +14 -0
- package/src/guide/12-lookups.out +3 -0
- package/src/guide/12-lookups.ts +59 -0
- package/src/guide/13-indexes.md +21 -0
- package/src/guide/13-indexes.out +8 -0
- package/src/guide/13-indexes.ts +73 -0
- package/src/guide/14-kernels.md +15 -0
- package/src/guide/14-kernels.out +1 -0
- package/src/guide/14-kernels.ts +48 -0
- package/src/guide/15-reductions.md +12 -0
- package/src/guide/15-reductions.out +1 -0
- package/src/guide/15-reductions.ts +38 -0
- package/src/guide/16-gpu.md +18 -0
- package/src/guide/16-gpu.out +3 -0
- package/src/guide/16-gpu.ts +51 -0
- package/src/guide/17-hierarchies.md +11 -0
- package/src/guide/17-hierarchies.out +1 -0
- package/src/guide/17-hierarchies.ts +40 -0
- package/src/guide/18-identity.md +10 -0
- package/src/guide/18-identity.out +1 -0
- package/src/guide/18-identity.ts +11 -0
- package/src/guide/19-threads.md +16 -0
- package/src/guide/19-threads.out +2 -0
- package/src/guide/19-threads.ts +65 -0
- package/src/guide/20-shared.md +29 -0
- package/src/guide/20-shared.out +4 -0
- package/src/guide/20-shared.ts +118 -0
- package/src/guide/21-dom.md +22 -0
- package/src/guide/21-dom.out +5 -0
- package/src/guide/21-dom.ts +117 -0
- package/src/guide/22-canvas.md +15 -0
- package/src/guide/22-canvas.out +3 -0
- package/src/guide/22-canvas.ts +119 -0
- package/src/guide/CLAUDE.md +40 -25
- package/src/guide/README.md +42 -0
- package/src/guide/guide.test.ts +215 -0
- package/src/implementation/compiler/access.ts +10 -4
- package/src/implementation/compiler/archetypes.test.ts +64 -0
- package/src/implementation/compiler/archetypes.ts +134 -0
- package/src/implementation/compiler/assign.ts +1 -0
- package/src/implementation/compiler/augmentations.test.ts +418 -0
- package/src/implementation/compiler/augmentations.ts +871 -0
- package/src/implementation/compiler/bind.ts +6 -4
- package/src/implementation/compiler/body-access.ts +135 -33
- package/src/implementation/compiler/booleans.ts +1 -0
- package/src/implementation/compiler/branches.ts +1 -0
- package/src/implementation/compiler/calls.ts +14 -3
- package/src/implementation/compiler/columns.ts +21 -5
- package/src/implementation/compiler/compile-kernel.ts +88 -23
- package/src/implementation/compiler/compiler.ts +9 -0
- package/src/implementation/compiler/data.ts +1 -0
- package/src/implementation/compiler/describe.test-helper.ts +97 -0
- package/src/implementation/compiler/describe.test.ts +168 -0
- package/src/implementation/compiler/describe.ts +489 -0
- package/src/implementation/compiler/estree.ts +1 -0
- package/src/implementation/compiler/expression.ts +24 -2
- package/src/implementation/compiler/failure.ts +1 -0
- package/src/implementation/compiler/hygiene.test.ts +4 -11
- package/src/implementation/compiler/identify.test.ts +100 -46
- package/src/implementation/compiler/identify.ts +89 -32
- package/src/implementation/compiler/index.ts +6 -1
- package/src/implementation/compiler/inferred.test.ts +32 -0
- package/src/implementation/compiler/inferred.ts +197 -0
- package/src/implementation/compiler/inline-kernels.test.ts +10 -0
- package/src/implementation/compiler/inline-kernels.ts +21 -0
- package/src/implementation/compiler/input-schemas.test.ts +182 -0
- package/src/implementation/compiler/input-schemas.ts +107 -0
- package/src/implementation/compiler/ir.ts +7 -2
- package/src/implementation/compiler/kernel-id.ts +1 -0
- package/src/implementation/compiler/key.ts +1 -0
- package/src/implementation/compiler/link.test.ts +3 -0
- package/src/implementation/compiler/link.ts +29 -0
- package/src/implementation/compiler/lists.ts +41 -13
- package/src/implementation/compiler/lookups.ts +1 -0
- package/src/implementation/compiler/math.ts +1 -0
- package/src/implementation/compiler/memory-compiler.browser.test.ts +85 -0
- package/src/implementation/compiler/memory-compiler.test.ts +147 -0
- package/src/implementation/compiler/memory-compiler.ts +307 -0
- package/src/implementation/compiler/module-scope.ts +1 -0
- package/src/implementation/compiler/module-value.ts +18 -3
- package/src/implementation/compiler/out.ts +1 -0
- package/src/implementation/compiler/oxc.test-helper.ts +20 -0
- package/src/implementation/compiler/oxc.test.ts +69 -0
- package/src/implementation/compiler/oxc.ts +90 -0
- package/src/implementation/compiler/package-copies.ts +208 -0
- package/src/implementation/compiler/passes.ts +34 -0
- package/src/implementation/compiler/paths.ts +19 -38
- package/src/implementation/compiler/plugin.test.ts +373 -62
- package/src/implementation/compiler/plugin.ts +199 -38
- package/src/implementation/compiler/posix.test.ts +34 -0
- package/src/implementation/compiler/posix.ts +183 -0
- package/src/implementation/compiler/predicates.test.ts +90 -0
- package/src/implementation/compiler/predicates.ts +250 -0
- package/src/implementation/compiler/print.ts +26 -6
- package/src/implementation/compiler/program.ts +4 -1
- package/src/implementation/compiler/public.ts +2 -0
- package/src/implementation/compiler/scalar.ts +1 -0
- package/src/implementation/compiler/scope.ts +1 -0
- package/src/implementation/compiler/serialize.ts +1 -0
- package/src/implementation/compiler/shared-kernels.test.ts +57 -0
- package/src/implementation/compiler/signature.ts +70 -30
- package/src/implementation/compiler/snapshot.ts +5 -2
- package/src/implementation/compiler/source-map.test.ts +1 -0
- package/src/implementation/compiler/source-map.ts +1 -0
- package/src/implementation/compiler/spawns.ts +62 -5
- package/src/implementation/compiler/stamps.ts +30 -8
- package/src/implementation/compiler/statement.ts +1 -0
- package/src/implementation/compiler/subset.md +4 -3
- package/src/implementation/compiler/terminal.ts +1 -0
- package/src/implementation/compiler/transform.test.ts +371 -258
- package/src/implementation/compiler/transform.ts +321 -62
- package/src/implementation/compiler/type-host.test-helper.ts +27 -0
- package/src/implementation/compiler/type-schemas.ts +714 -0
- package/src/implementation/compiler/unit.ts +22 -4
- package/src/implementation/compiler/value.ts +1 -0
- package/src/implementation/compiler/wat.test.ts +135 -0
- package/src/implementation/compiler/wat.ts +365 -0
- package/src/implementation/index.ts +1 -0
- package/src/implementation/world/activate.ts +10 -3
- package/src/implementation/world/archetype.ts +133 -19
- package/src/implementation/world/arrays.test.ts +1 -0
- package/src/implementation/world/arrays.ts +6 -1
- package/src/implementation/world/arrivals.test.ts +89 -0
- package/src/implementation/world/arrivals.ts +165 -0
- package/src/implementation/world/async-loading.test.ts +13 -28
- package/src/implementation/world/attach-kernel.test.ts +10 -2
- package/src/implementation/world/attach-kernel.ts +14 -7
- package/src/implementation/world/batches.test.ts +14 -17
- package/src/implementation/world/batches.ts +67 -8
- package/src/implementation/world/buffer.ts +35 -4
- package/src/implementation/world/builtins.test.ts +5 -10
- package/src/implementation/world/cascade.ts +2 -1
- package/src/implementation/world/cells.ts +1 -0
- package/src/implementation/world/change-blocks.browser.test.ts +76 -0
- package/src/implementation/world/change-blocks.cases.ts +14 -0
- package/src/implementation/world/change-blocks.fixture.ts +70 -0
- package/src/implementation/world/change-blocks.test.ts +264 -0
- package/src/implementation/world/changes-finalizers.test.ts +6 -8
- package/src/implementation/world/check-kernel.ts +46 -32
- package/src/implementation/world/claims.test.ts +1 -0
- package/src/implementation/world/claims.ts +1 -0
- package/src/implementation/world/closure.test.ts +1 -0
- package/src/implementation/world/closure.ts +1 -0
- package/src/implementation/world/command-ring.ts +2 -1
- package/src/implementation/world/command-rings.cases.ts +5 -2
- package/src/implementation/world/command-rings.fixture.ts +27 -36
- package/src/implementation/world/commands.test.ts +84 -43
- package/src/implementation/world/commands.ts +26 -4
- package/src/implementation/world/composite-input.test.ts +17 -15
- package/src/implementation/world/conditions.test.ts +17 -28
- package/src/implementation/world/constant-unions.test.ts +43 -0
- package/src/implementation/world/create.test.ts +50 -71
- package/src/implementation/world/create.ts +486 -250
- package/src/implementation/world/defaults.test.ts +86 -0
- package/src/implementation/world/directories.ts +2 -1
- package/src/implementation/world/directory.test.ts +2 -3
- package/src/implementation/world/dispatch.cases.ts +1 -0
- package/src/implementation/world/dispatch.fixture.ts +16 -25
- package/src/implementation/world/entities.ts +1 -0
- package/src/implementation/world/entity-lookup-workers.cases.ts +1 -0
- package/src/implementation/world/entity-lookup-workers.fixture.ts +9 -16
- package/src/implementation/world/entity-lookups.browser.test.ts +8 -14
- package/src/implementation/world/entity-lookups.test-helper.ts +28 -34
- package/src/implementation/world/entity-lookups.test.ts +9 -16
- package/src/implementation/world/execute.ts +232 -96
- package/src/implementation/world/failing-worker.fixture.ts +3 -0
- package/src/implementation/world/failures.ts +64 -7
- package/src/implementation/world/finalizers.test.ts +33 -49
- package/src/implementation/world/finalizers.ts +46 -14
- package/src/implementation/world/fixtures.test-helper.ts +1 -0
- package/src/implementation/world/generated-code.md +10 -6
- package/src/implementation/world/gpu.browser.test.ts +100 -92
- package/src/implementation/world/gpu.test-helper.ts +12 -0
- package/src/implementation/world/gpu.ts +26 -14
- package/src/implementation/world/holders.ts +1 -0
- package/src/implementation/world/ids-changes.test-helper.ts +4 -0
- package/src/implementation/world/ids-keys.test-helper.ts +21 -0
- package/src/implementation/world/ids.test.ts +12 -49
- package/src/implementation/world/imported-lists.test-helper.ts +2 -6
- package/src/implementation/world/imported-lists.test.ts +4 -5
- package/src/implementation/world/index-buckets.test.ts +276 -0
- package/src/implementation/world/index-build-csp.test.ts +8 -9
- package/src/implementation/world/index-build.cases.ts +1 -0
- package/src/implementation/world/index-build.fixture.ts +12 -15
- package/src/implementation/world/index-build.ts +1 -0
- package/src/implementation/world/index-changed.test.ts +27 -34
- package/src/implementation/world/index-hash.test.ts +34 -0
- package/src/implementation/world/index-hash.ts +454 -74
- package/src/implementation/world/index-joined.test.ts +232 -74
- package/src/implementation/world/index-kernels.test.ts +26 -35
- package/src/implementation/world/index-keyless.test.ts +21 -28
- package/src/implementation/world/index-keys.ts +1 -0
- package/src/implementation/world/index-lookups-csp.test.ts +5 -6
- package/src/implementation/world/index-lookups.ts +28 -22
- package/src/implementation/world/index-order.test.ts +13 -17
- package/src/implementation/world/index-order.ts +1 -0
- package/src/implementation/world/index-readers.ts +1 -0
- package/src/implementation/world/index-sorted.test.ts +1 -0
- package/src/implementation/world/index-sorted.ts +10 -5
- package/src/implementation/world/index-workers.cases.ts +10 -0
- package/src/implementation/world/index-workers.fixture.ts +98 -39
- package/src/implementation/world/indexes.test.ts +62 -74
- package/src/implementation/world/indexes.ts +62 -108
- package/src/implementation/world/input.ts +2 -1
- package/src/implementation/world/intrinsics-coverage.test.ts +1 -0
- package/src/implementation/world/intrinsics.browser.test.ts +22 -62
- package/src/implementation/world/intrinsics.ts +1 -0
- package/src/implementation/world/join.test.ts +182 -43
- package/src/implementation/world/join.ts +112 -59
- package/src/implementation/world/join.type-test.ts +7 -5
- package/src/implementation/world/joined-observer.test.ts +58 -0
- package/src/implementation/world/joined-observer.ts +85 -19
- package/src/implementation/world/joining-worker.fixture.ts +51 -11
- package/src/implementation/world/joining.cases.ts +43 -7
- package/src/implementation/world/joining.fixture.ts +114 -14
- package/src/implementation/world/joining.test-helper.ts +25 -27
- package/src/implementation/world/joining.ts +85 -7
- package/src/implementation/world/journal.ts +8 -4
- package/src/implementation/world/kernel-imports-sparks.test-helper.ts +3 -4
- package/src/implementation/world/kernel-imports-steer.test-helper.ts +1 -0
- package/src/implementation/world/kernel-imports.test.ts +10 -12
- package/src/implementation/world/kernel-indexes.ts +12 -3
- package/src/implementation/world/kernel-lookup.test-helper.ts +6 -10
- package/src/implementation/world/kernel-path.test-helper.ts +2 -4
- package/src/implementation/world/kernel-spawns.test.ts +17 -28
- package/src/implementation/world/kernel-tried.test-helper.ts +31 -0
- package/src/implementation/world/kernel.ts +30 -6
- package/src/implementation/world/kernels-csp.test.ts +5 -5
- package/src/implementation/world/kernels.test.ts +18 -14
- package/src/implementation/world/kernels.ts +82 -13
- package/src/implementation/world/layout-directory.browser.test.ts +18 -28
- package/src/implementation/world/layout-directory.cases.ts +1 -0
- package/src/implementation/world/layout-directory.fixture.ts +18 -28
- package/src/implementation/world/layout-directory.ts +69 -17
- package/src/implementation/world/lifetime.cases.ts +2 -1
- package/src/implementation/world/lifetime.fixture.ts +12 -21
- package/src/implementation/world/lifetime.test-helper.ts +2 -1
- package/src/implementation/world/lifetime.test.ts +7 -14
- package/src/implementation/world/lists.ts +179 -28
- package/src/implementation/world/lookup-keys.ts +10 -9
- package/src/implementation/world/loop.test.ts +19 -8
- package/src/implementation/world/loop.ts +4 -4
- package/src/implementation/world/memory.test.ts +1 -0
- package/src/implementation/world/memory.ts +1 -0
- package/src/implementation/world/mirror.ts +45 -10
- package/src/implementation/world/move-log.test.ts +114 -11
- package/src/implementation/world/move-log.ts +1 -0
- package/src/implementation/world/names.test.ts +31 -31
- package/src/implementation/world/observe-cases.browser.test.ts +11 -11
- package/src/implementation/world/observe-cases.test.ts +49 -95
- package/src/implementation/world/observe-factories.test.ts +17 -19
- package/src/implementation/world/observe-joined-cases.test.ts +34 -45
- package/src/implementation/world/observe-ticks-cases.test.ts +33 -35
- package/src/implementation/world/observe.test-helper.ts +2 -1
- package/src/implementation/world/observed-workers.cases.ts +1 -0
- package/src/implementation/world/observed-workers.fixture.ts +7 -8
- package/src/implementation/world/observer-contained-worker.fixture.ts +4 -3
- package/src/implementation/world/observer-contained.browser.test.ts +1 -0
- package/src/implementation/world/observer-contained.cases.ts +1 -0
- package/src/implementation/world/observer-contained.fixture.ts +3 -7
- package/src/implementation/world/observer-contained.test-helper.ts +7 -8
- package/src/implementation/world/observer-contained.test.ts +11 -19
- package/src/implementation/world/observer-joined-worker.fixture.ts +2 -1
- package/src/implementation/world/observer-joined.cases.ts +1 -0
- package/src/implementation/world/observer-joined.fixture.ts +8 -6
- package/src/implementation/world/observer-joined.test-helper.ts +25 -34
- package/src/implementation/world/observer-joined.test.ts +78 -62
- package/src/implementation/world/observer.browser.test.ts +13 -13
- package/src/implementation/world/observer.test.ts +34 -44
- package/src/implementation/world/observer.ts +3 -3
- package/src/implementation/world/optional-workers.cases.ts +19 -0
- package/src/implementation/world/optional-workers.fixture.ts +55 -0
- package/src/implementation/world/optional.test.ts +351 -0
- package/src/implementation/world/order.ts +1 -0
- package/src/implementation/world/out-of-band.ts +61 -0
- package/src/implementation/world/outcomes.test-helper.ts +138 -0
- package/src/implementation/world/package-id.test-helper.ts +9 -0
- package/src/implementation/world/perf.md +124 -4
- package/src/implementation/world/plan.ts +1 -0
- package/src/implementation/world/platforms.test-helper.ts +1 -0
- package/src/implementation/world/pool-size.cases.ts +18 -0
- package/src/implementation/world/pool-size.fixture.ts +98 -6
- package/src/implementation/world/pool.cases.ts +1 -0
- package/src/implementation/world/pool.fixture.ts +1 -0
- package/src/implementation/world/pool.ts +1 -0
- package/src/implementation/world/port.test.ts +45 -0
- package/src/implementation/world/port.ts +18 -11
- package/src/implementation/world/ports.cases.ts +2 -2
- package/src/implementation/world/ports.fixture.ts +4 -5
- package/src/implementation/world/ports.type-test.ts +1 -0
- package/src/implementation/world/precision.test.ts +174 -0
- package/src/implementation/world/prepared-lookup.ts +1 -0
- package/src/implementation/world/prepared-spawn.ts +14 -10
- package/src/implementation/world/program.ts +1 -0
- package/src/implementation/world/protocol.ts +9 -2
- package/src/implementation/world/publish.ts +1 -0
- package/src/implementation/world/ranges.test.ts +66 -0
- package/src/implementation/world/ranges.ts +98 -32
- package/src/implementation/world/reads.test-helper.ts +1 -0
- package/src/implementation/world/reclaim.test.ts +214 -0
- package/src/implementation/world/reclaim.ts +170 -0
- package/src/implementation/world/reductions.cases.ts +1 -0
- package/src/implementation/world/reductions.fixture.ts +5 -10
- package/src/implementation/world/reductions.test.ts +36 -49
- package/src/implementation/world/reductions.ts +14 -12
- package/src/implementation/world/reevaluation.test-helper.ts +3 -3
- package/src/implementation/world/reevaluation.test.ts +9 -8
- package/src/implementation/world/register.ts +3 -2
- package/src/implementation/world/remote-finalizers-worker.fixture.ts +25 -10
- package/src/implementation/world/remote-finalizers.cases.ts +19 -1
- package/src/implementation/world/remote-finalizers.fixture.ts +86 -11
- package/src/implementation/world/remote-finalizers.test-helper.ts +119 -27
- package/src/implementation/world/remote-finalizers.test.ts +86 -20
- package/src/implementation/world/remote-objects-worker.fixture.ts +2 -1
- package/src/implementation/world/remote-objects.cases.ts +1 -0
- package/src/implementation/world/remote-objects.fixture.ts +3 -1
- package/src/implementation/world/remote-objects.test-helper.ts +9 -10
- package/src/implementation/world/remote-systems.ts +42 -28
- package/src/implementation/world/remote.test.ts +46 -48
- package/src/implementation/world/remote.ts +1 -0
- package/src/implementation/world/removal-worker.fixture.ts +3 -2
- package/src/implementation/world/removal.cases.ts +1 -0
- package/src/implementation/world/removal.fixture.ts +3 -2
- package/src/implementation/world/remove-joined.test.ts +4 -3
- package/src/implementation/world/remove.test-helper.ts +11 -13
- package/src/implementation/world/remove.test.ts +14 -17
- package/src/implementation/world/render-order.browser.test.ts +209 -0
- package/src/implementation/world/render-order.ts +150 -0
- package/src/implementation/world/required.ts +10 -0
- package/src/implementation/world/resources.ts +7 -3
- package/src/implementation/world/rows.test.ts +8 -11
- package/src/implementation/world/rows.ts +99 -30
- package/src/implementation/world/rules.test.ts +38 -39
- package/src/implementation/world/run-results.test.ts +374 -0
- package/src/implementation/world/runner.ts +379 -73
- package/src/implementation/world/schedule.test.ts +65 -67
- package/src/implementation/world/semantics.test.ts +11 -16
- package/src/implementation/world/share.test.ts +4 -3
- package/src/implementation/world/shared-gpu.browser.test.ts +109 -0
- package/src/implementation/world/shared-kernels.test.ts +117 -0
- package/src/implementation/world/shared-workers.cases.ts +20 -0
- package/src/implementation/world/shared-workers.fixture.ts +74 -0
- package/src/implementation/world/shared.test.ts +348 -0
- package/src/implementation/world/shared.ts +316 -0
- package/src/implementation/world/sharing.ts +96 -32
- package/src/implementation/world/staging.ts +53 -10
- package/src/implementation/world/state.ts +180 -23
- package/src/implementation/world/stop-lists.ts +78 -9
- package/src/implementation/world/strings.test.ts +23 -34
- package/src/implementation/world/strings.ts +1 -0
- package/src/implementation/world/structure.ts +6 -2
- package/src/implementation/world/synchronize.test.ts +1 -0
- package/src/implementation/world/synchronize.ts +60 -17
- package/src/implementation/world/tail-blocks.ts +9 -4
- package/src/implementation/world/tails-worker.fixture.ts +9 -13
- package/src/implementation/world/tails.cases.ts +3 -2
- package/src/implementation/world/tails.fixture.ts +5 -2
- package/src/implementation/world/tails.test-helper.ts +48 -41
- package/src/implementation/world/tails.test.ts +24 -29
- package/src/implementation/world/tails.ts +35 -22
- package/src/implementation/world/target.test.ts +10 -13
- package/src/implementation/world/terminal.ts +1 -0
- package/src/implementation/world/thread-directory.ts +85 -16
- package/src/implementation/world/thread-finalizers.ts +128 -22
- package/src/implementation/world/thread-indexes.ts +5 -3
- package/src/implementation/world/thread-observer.ts +60 -13
- package/src/implementation/world/thread-systems-worker.fixture.ts +5 -6
- package/src/implementation/world/thread-systems.cases.ts +15 -2
- package/src/implementation/world/thread-systems.fixture.ts +41 -12
- package/src/implementation/world/thread-systems.test-helper.ts +57 -52
- package/src/implementation/world/thread-systems.test.ts +51 -26
- package/src/implementation/world/thread-systems.ts +398 -84
- package/src/implementation/world/thread-tasks.ts +9 -4
- package/src/implementation/world/threads.browser.test.ts +5 -0
- package/src/implementation/world/threads.test.ts +10 -0
- package/src/implementation/world/ticks.browser.test.ts +3 -4
- package/src/implementation/world/ticks.test.ts +5 -5
- package/src/implementation/world/traits.test.ts +4 -8
- package/src/implementation/world/transfers-worker.fixture.ts +17 -12
- package/src/implementation/world/transfers.cases.ts +1 -0
- package/src/implementation/world/transfers.fixture.ts +18 -25
- package/src/implementation/world/transfers.test-helper.ts +18 -28
- package/src/implementation/world/transfers.test.ts +19 -23
- package/src/implementation/world/transfers.ts +1 -0
- package/src/implementation/world/unidentified-finalizers.test.ts +58 -0
- package/src/implementation/world/up-tree.test.ts +181 -21
- package/src/implementation/world/up-workers.cases.ts +1 -0
- package/src/implementation/world/up-workers.fixture.ts +6 -10
- package/src/implementation/world/up.browser.test.ts +9 -12
- package/src/implementation/world/up.test.ts +56 -42
- package/src/implementation/world/up.ts +299 -71
- package/src/implementation/world/wasm-kernels.test.ts +55 -49
- package/src/implementation/world/wasm.test.ts +200 -22
- package/src/implementation/world/wasm.ts +399 -127
- package/src/implementation/world/wgsl.test.ts +1 -0
- package/src/implementation/world/wgsl.ts +22 -5
- package/src/implementation/world/where.test.ts +342 -0
- package/src/implementation/world/where.ts +236 -0
- package/src/implementation/world/worker-platform.ts +1 -0
- package/src/implementation/world/worker-window.test.ts +43 -0
- package/src/implementation/world/worker-window.ts +43 -0
- package/src/implementation/world/worker.ts +47 -59
- package/src/implementation/world/workers-follow.test.ts +51 -0
- package/src/implementation/world/workers.cases.ts +1 -0
- package/src/implementation/world/workers.fixture.ts +31 -54
- package/src/implementation/world/world-host.fixture.ts +1 -0
- package/src/index.ts +5 -0
- package/src/interface/CLAUDE.md +1 -1
- package/src/interface/component/component.ts +1 -0
- package/src/interface/component/index.ts +1 -1
- package/src/interface/component/key.ts +1 -0
- package/src/interface/component/key.type-test.ts +1 -2
- package/src/interface/component/register.test.ts +27 -34
- package/src/interface/component/types.ts +3 -2
- package/src/interface/component/value.ts +9 -2
- package/src/interface/component/values.ts +1 -0
- package/src/interface/entity/entity.ts +1 -0
- package/src/interface/entity/index.ts +4 -0
- package/src/interface/finalizer/body.ts +12 -11
- package/src/interface/finalizer/create.test.ts +67 -72
- package/src/interface/finalizer/create.ts +52 -22
- package/src/interface/finalizer/created.ts +6 -5
- package/src/interface/finalizer/declaration.ts +28 -9
- package/src/interface/finalizer/finalizer.ts +3 -2
- package/src/interface/finalizer/index.ts +1 -0
- package/src/interface/gpu/accessors.ts +26 -8
- package/src/interface/gpu/gpu.ts +1 -0
- package/src/interface/gpu/gpu.type-test.ts +2 -2
- package/src/interface/gpu/index.ts +1 -0
- package/src/interface/gpu/layout.ts +1 -0
- package/src/interface/gpu/record.ts +1 -0
- package/src/interface/gpu/wgsl.ts +9 -6
- package/src/interface/index.ts +1 -3
- package/src/interface/index.type-test.ts +11 -14
- package/src/interface/indexes/create.test.ts +44 -43
- package/src/interface/indexes/create.ts +24 -16
- package/src/interface/indexes/created.ts +3 -2
- package/src/interface/indexes/declaration.ts +7 -3
- package/src/interface/indexes/index-type.ts +4 -3
- package/src/interface/indexes/index.ts +1 -0
- package/src/interface/indexes/index.type-test.ts +45 -94
- package/src/interface/math/f32/default.ts +6 -0
- package/src/interface/math/f32/index.ts +5 -1
- package/src/interface/math/f32/public.ts +2 -0
- package/src/interface/math/f32/round-half-even.ts +1 -0
- package/src/interface/math/f32/schema.ts +1 -0
- package/src/interface/math/i32/default.ts +6 -0
- package/src/interface/math/i32/index.ts +5 -1
- package/src/interface/math/i32/public.ts +2 -0
- package/src/interface/math/i32/schema.ts +1 -0
- package/src/interface/math/i32/shift-right.ts +1 -0
- package/src/interface/math/index.ts +1 -0
- package/src/interface/math/intrinsic.ts +1 -0
- package/src/interface/math/mat4x4/add.ts +1 -0
- package/src/interface/math/mat4x4/determinant.ts +1 -0
- package/src/interface/math/mat4x4/identity.ts +1 -0
- package/src/interface/math/mat4x4/index.ts +4 -1
- package/src/interface/math/mat4x4/inverse.ts +1 -0
- package/src/interface/math/mat4x4/look-at.test.ts +1 -0
- package/src/interface/math/mat4x4/look-at.ts +1 -0
- package/src/interface/math/mat4x4/multiply-vec3.ts +1 -0
- package/src/interface/math/mat4x4/multiply-vec4.ts +1 -0
- package/src/interface/math/mat4x4/multiply.ts +1 -0
- package/src/interface/math/mat4x4/orthographic.ts +1 -0
- package/src/interface/math/mat4x4/perspective.ts +1 -0
- package/src/interface/math/mat4x4/public.ts +2 -0
- package/src/interface/math/mat4x4/rotation-x.ts +1 -0
- package/src/interface/math/mat4x4/rotation-y.ts +1 -0
- package/src/interface/math/mat4x4/rotation-z.ts +1 -0
- package/src/interface/math/mat4x4/rotation.test.ts +1 -0
- package/src/interface/math/mat4x4/scale.ts +1 -0
- package/src/interface/math/mat4x4/scaling.ts +1 -0
- package/src/interface/math/mat4x4/schema.ts +1 -0
- package/src/interface/math/mat4x4/subtract.ts +1 -0
- package/src/interface/math/mat4x4/translation.ts +1 -0
- package/src/interface/math/mat4x4/transpose.ts +1 -0
- package/src/interface/math/mat4x4/zero.ts +1 -0
- package/src/interface/math/math.type-test.ts +24 -1
- package/src/interface/math/quat/add.ts +1 -0
- package/src/interface/math/quat/align-to.ts +1 -0
- package/src/interface/math/quat/conjugate.ts +1 -0
- package/src/interface/math/quat/distance.ts +1 -0
- package/src/interface/math/quat/dot.ts +1 -0
- package/src/interface/math/quat/from-axis-angle.ts +1 -0
- package/src/interface/math/quat/from-euler.ts +1 -0
- package/src/interface/math/quat/identity.ts +1 -0
- package/src/interface/math/quat/index.ts +5 -1
- package/src/interface/math/quat/inverse.ts +1 -0
- package/src/interface/math/quat/length-squared.ts +1 -0
- package/src/interface/math/quat/length.ts +1 -0
- package/src/interface/math/quat/lerp.ts +1 -0
- package/src/interface/math/quat/look-at.ts +1 -0
- package/src/interface/math/quat/multiply.ts +1 -0
- package/src/interface/math/quat/negate.ts +1 -0
- package/src/interface/math/quat/normalize.ts +1 -0
- package/src/interface/math/quat/public.ts +2 -0
- package/src/interface/math/quat/rotate-vec3.ts +1 -0
- package/src/interface/math/quat/scale.ts +1 -0
- package/src/interface/math/quat/schema.ts +1 -0
- package/src/interface/math/quat/slerp.ts +1 -0
- package/src/interface/math/quat/subtract.ts +1 -0
- package/src/interface/math/quat/to-axis-angle.ts +1 -0
- package/src/interface/math/quat/to-euler.ts +1 -0
- package/src/interface/math/quat/to-mat4.ts +1 -0
- package/src/interface/math/semantics.test.ts +1 -0
- package/src/interface/math/u32/count-leading-zeros.ts +1 -0
- package/src/interface/math/u32/count-one-bits.ts +1 -0
- package/src/interface/math/u32/count-trailing-zeros.ts +1 -0
- package/src/interface/math/u32/default.ts +6 -0
- package/src/interface/math/u32/index.ts +5 -1
- package/src/interface/math/u32/public.ts +2 -0
- package/src/interface/math/u32/reverse-bits.ts +1 -0
- package/src/interface/math/u32/schema.ts +1 -0
- package/src/interface/math/u32/shift-right.ts +1 -0
- package/src/interface/math/vec2/f32/abs.ts +1 -0
- package/src/interface/math/vec2/f32/acos.ts +1 -0
- package/src/interface/math/vec2/f32/acosh.ts +1 -0
- package/src/interface/math/vec2/f32/add.ts +1 -0
- package/src/interface/math/vec2/f32/asin.ts +1 -0
- package/src/interface/math/vec2/f32/asinh.ts +1 -0
- package/src/interface/math/vec2/f32/atan.ts +1 -0
- package/src/interface/math/vec2/f32/atanh.ts +1 -0
- package/src/interface/math/vec2/f32/ceil.ts +1 -0
- package/src/interface/math/vec2/f32/clamp.ts +1 -0
- package/src/interface/math/vec2/f32/cos.ts +1 -0
- package/src/interface/math/vec2/f32/cosh.ts +1 -0
- package/src/interface/math/vec2/f32/distance.ts +1 -0
- package/src/interface/math/vec2/f32/dot.ts +1 -0
- package/src/interface/math/vec2/f32/equals.ts +1 -0
- package/src/interface/math/vec2/f32/exp.ts +1 -0
- package/src/interface/math/vec2/f32/exp2.ts +1 -0
- package/src/interface/math/vec2/f32/f32.ts +5 -1
- package/src/interface/math/vec2/f32/faceforward.ts +1 -0
- package/src/interface/math/vec2/f32/floor.ts +1 -0
- package/src/interface/math/vec2/f32/fract.ts +1 -0
- package/src/interface/math/vec2/f32/length.ts +1 -0
- package/src/interface/math/vec2/f32/log.ts +1 -0
- package/src/interface/math/vec2/f32/log2.ts +1 -0
- package/src/interface/math/vec2/f32/max.ts +1 -0
- package/src/interface/math/vec2/f32/min.ts +1 -0
- package/src/interface/math/vec2/f32/mix.ts +1 -0
- package/src/interface/math/vec2/f32/mod.ts +1 -0
- package/src/interface/math/vec2/f32/modf.ts +1 -0
- package/src/interface/math/vec2/f32/negate.ts +1 -0
- package/src/interface/math/vec2/f32/normalize.ts +1 -0
- package/src/interface/math/vec2/f32/pow.ts +1 -0
- package/src/interface/math/vec2/f32/public.ts +2 -0
- package/src/interface/math/vec2/f32/reflect.ts +1 -0
- package/src/interface/math/vec2/f32/refract.ts +1 -0
- package/src/interface/math/vec2/f32/round.ts +1 -0
- package/src/interface/math/vec2/f32/scale.ts +1 -0
- package/src/interface/math/vec2/f32/schema.ts +1 -0
- package/src/interface/math/vec2/f32/sign.ts +1 -0
- package/src/interface/math/vec2/f32/sin.ts +1 -0
- package/src/interface/math/vec2/f32/sinh.ts +1 -0
- package/src/interface/math/vec2/f32/smoothstep.ts +1 -0
- package/src/interface/math/vec2/f32/sqrt.ts +1 -0
- package/src/interface/math/vec2/f32/step.ts +1 -0
- package/src/interface/math/vec2/f32/subtract.ts +1 -0
- package/src/interface/math/vec2/f32/tan.ts +1 -0
- package/src/interface/math/vec2/f32/tanh.ts +1 -0
- package/src/interface/math/vec2/f32/trunc.ts +1 -0
- package/src/interface/math/vec2/f32/zero.ts +1 -0
- package/src/interface/math/vec2/i32/abs.ts +1 -0
- package/src/interface/math/vec2/i32/add.ts +1 -0
- package/src/interface/math/vec2/i32/bitwise-and.ts +1 -0
- package/src/interface/math/vec2/i32/bitwise-not.ts +1 -0
- package/src/interface/math/vec2/i32/bitwise-or.ts +1 -0
- package/src/interface/math/vec2/i32/bitwise-xor.ts +1 -0
- package/src/interface/math/vec2/i32/clamp.ts +1 -0
- package/src/interface/math/vec2/i32/count-leading-zeros.ts +1 -0
- package/src/interface/math/vec2/i32/count-one-bits.ts +1 -0
- package/src/interface/math/vec2/i32/count-trailing-zeros.ts +1 -0
- package/src/interface/math/vec2/i32/equals.ts +1 -0
- package/src/interface/math/vec2/i32/i32.ts +5 -1
- package/src/interface/math/vec2/i32/max.ts +1 -0
- package/src/interface/math/vec2/i32/min.ts +1 -0
- package/src/interface/math/vec2/i32/negate.ts +1 -0
- package/src/interface/math/vec2/i32/public.ts +2 -0
- package/src/interface/math/vec2/i32/reverse-bits.ts +1 -0
- package/src/interface/math/vec2/i32/scale.ts +1 -0
- package/src/interface/math/vec2/i32/schema.ts +1 -0
- package/src/interface/math/vec2/i32/shift-left.ts +1 -0
- package/src/interface/math/vec2/i32/shift-right.ts +1 -0
- package/src/interface/math/vec2/i32/subtract.ts +1 -0
- package/src/interface/math/vec2/i32/zero.ts +1 -0
- package/src/interface/math/vec2/index.ts +1 -0
- package/src/interface/math/vec2/public.ts +2 -0
- package/src/interface/math/vec2/u32/add.ts +1 -0
- package/src/interface/math/vec2/u32/bitwise-and.ts +1 -0
- package/src/interface/math/vec2/u32/bitwise-not.ts +1 -0
- package/src/interface/math/vec2/u32/bitwise-or.ts +1 -0
- package/src/interface/math/vec2/u32/bitwise-xor.ts +1 -0
- package/src/interface/math/vec2/u32/clamp.ts +1 -0
- package/src/interface/math/vec2/u32/count-leading-zeros.ts +1 -0
- package/src/interface/math/vec2/u32/count-one-bits.ts +1 -0
- package/src/interface/math/vec2/u32/count-trailing-zeros.ts +1 -0
- package/src/interface/math/vec2/u32/equals.ts +1 -0
- package/src/interface/math/vec2/u32/max.ts +1 -0
- package/src/interface/math/vec2/u32/min.ts +1 -0
- package/src/interface/math/vec2/u32/negate.ts +1 -0
- package/src/interface/math/vec2/u32/public.ts +2 -0
- package/src/interface/math/vec2/u32/reverse-bits.ts +1 -0
- package/src/interface/math/vec2/u32/scale.ts +1 -0
- package/src/interface/math/vec2/u32/schema.ts +1 -0
- package/src/interface/math/vec2/u32/shift-left.ts +1 -0
- package/src/interface/math/vec2/u32/shift-right.ts +1 -0
- package/src/interface/math/vec2/u32/subtract.ts +1 -0
- package/src/interface/math/vec2/u32/u32.ts +5 -1
- package/src/interface/math/vec2/u32/zero.ts +1 -0
- package/src/interface/math/vec3/f32/abs.ts +1 -0
- package/src/interface/math/vec3/f32/acos.ts +1 -0
- package/src/interface/math/vec3/f32/acosh.ts +1 -0
- package/src/interface/math/vec3/f32/add.ts +1 -0
- package/src/interface/math/vec3/f32/asin.ts +1 -0
- package/src/interface/math/vec3/f32/asinh.ts +1 -0
- package/src/interface/math/vec3/f32/atan.ts +1 -0
- package/src/interface/math/vec3/f32/atanh.ts +1 -0
- package/src/interface/math/vec3/f32/ceil.ts +1 -0
- package/src/interface/math/vec3/f32/clamp.ts +1 -0
- package/src/interface/math/vec3/f32/cos.ts +1 -0
- package/src/interface/math/vec3/f32/cosh.ts +1 -0
- package/src/interface/math/vec3/f32/cross.ts +1 -0
- package/src/interface/math/vec3/f32/distance-squared.ts +1 -0
- package/src/interface/math/vec3/f32/distance.ts +1 -0
- package/src/interface/math/vec3/f32/dot.ts +1 -0
- package/src/interface/math/vec3/f32/equals.ts +1 -0
- package/src/interface/math/vec3/f32/exp.ts +1 -0
- package/src/interface/math/vec3/f32/exp2.ts +1 -0
- package/src/interface/math/vec3/f32/f32.ts +5 -1
- package/src/interface/math/vec3/f32/faceforward.ts +1 -0
- package/src/interface/math/vec3/f32/floor.ts +1 -0
- package/src/interface/math/vec3/f32/fract.ts +1 -0
- package/src/interface/math/vec3/f32/length-squared.ts +1 -0
- package/src/interface/math/vec3/f32/length.ts +1 -0
- package/src/interface/math/vec3/f32/log.ts +1 -0
- package/src/interface/math/vec3/f32/log2.ts +1 -0
- package/src/interface/math/vec3/f32/max.ts +1 -0
- package/src/interface/math/vec3/f32/min.ts +1 -0
- package/src/interface/math/vec3/f32/mix.ts +1 -0
- package/src/interface/math/vec3/f32/mod.ts +1 -0
- package/src/interface/math/vec3/f32/modf.ts +1 -0
- package/src/interface/math/vec3/f32/multiply.ts +1 -0
- package/src/interface/math/vec3/f32/negate.ts +1 -0
- package/src/interface/math/vec3/f32/normalize.ts +1 -0
- package/src/interface/math/vec3/f32/one.ts +1 -0
- package/src/interface/math/vec3/f32/pow.ts +1 -0
- package/src/interface/math/vec3/f32/public.ts +2 -0
- package/src/interface/math/vec3/f32/random.ts +1 -0
- package/src/interface/math/vec3/f32/reflect.ts +1 -0
- package/src/interface/math/vec3/f32/refract.ts +1 -0
- package/src/interface/math/vec3/f32/round.ts +1 -0
- package/src/interface/math/vec3/f32/scale.ts +1 -0
- package/src/interface/math/vec3/f32/schema.ts +1 -0
- package/src/interface/math/vec3/f32/sign.ts +1 -0
- package/src/interface/math/vec3/f32/sin.ts +1 -0
- package/src/interface/math/vec3/f32/sinh.ts +1 -0
- package/src/interface/math/vec3/f32/smoothstep.ts +1 -0
- package/src/interface/math/vec3/f32/sqrt.ts +1 -0
- package/src/interface/math/vec3/f32/step.ts +1 -0
- package/src/interface/math/vec3/f32/subtract.ts +1 -0
- package/src/interface/math/vec3/f32/tan.ts +1 -0
- package/src/interface/math/vec3/f32/tanh.ts +1 -0
- package/src/interface/math/vec3/f32/trunc.ts +1 -0
- package/src/interface/math/vec3/f32/zero.ts +1 -0
- package/src/interface/math/vec3/i32/abs.ts +1 -0
- package/src/interface/math/vec3/i32/add.ts +1 -0
- package/src/interface/math/vec3/i32/bitwise-and.ts +1 -0
- package/src/interface/math/vec3/i32/bitwise-not.ts +1 -0
- package/src/interface/math/vec3/i32/bitwise-or.ts +1 -0
- package/src/interface/math/vec3/i32/bitwise-xor.ts +1 -0
- package/src/interface/math/vec3/i32/clamp.ts +1 -0
- package/src/interface/math/vec3/i32/count-leading-zeros.ts +1 -0
- package/src/interface/math/vec3/i32/count-one-bits.ts +1 -0
- package/src/interface/math/vec3/i32/count-trailing-zeros.ts +1 -0
- package/src/interface/math/vec3/i32/equals.ts +1 -0
- package/src/interface/math/vec3/i32/i32.ts +5 -1
- package/src/interface/math/vec3/i32/max.ts +1 -0
- package/src/interface/math/vec3/i32/min.ts +1 -0
- package/src/interface/math/vec3/i32/multiply.ts +1 -0
- package/src/interface/math/vec3/i32/negate.ts +1 -0
- package/src/interface/math/vec3/i32/one.ts +1 -0
- package/src/interface/math/vec3/i32/public.ts +2 -0
- package/src/interface/math/vec3/i32/reverse-bits.ts +1 -0
- package/src/interface/math/vec3/i32/scale.ts +1 -0
- package/src/interface/math/vec3/i32/schema.ts +1 -0
- package/src/interface/math/vec3/i32/shift-left.ts +1 -0
- package/src/interface/math/vec3/i32/shift-right.ts +1 -0
- package/src/interface/math/vec3/i32/subtract.ts +1 -0
- package/src/interface/math/vec3/i32/zero.ts +1 -0
- package/src/interface/math/vec3/index.ts +1 -0
- package/src/interface/math/vec3/public.ts +2 -0
- package/src/interface/math/vec3/u32/add.ts +1 -0
- package/src/interface/math/vec3/u32/bitwise-and.ts +1 -0
- package/src/interface/math/vec3/u32/bitwise-not.ts +1 -0
- package/src/interface/math/vec3/u32/bitwise-or.ts +1 -0
- package/src/interface/math/vec3/u32/bitwise-xor.ts +1 -0
- package/src/interface/math/vec3/u32/clamp.ts +1 -0
- package/src/interface/math/vec3/u32/count-leading-zeros.ts +1 -0
- package/src/interface/math/vec3/u32/count-one-bits.ts +1 -0
- package/src/interface/math/vec3/u32/count-trailing-zeros.ts +1 -0
- package/src/interface/math/vec3/u32/equals.ts +1 -0
- package/src/interface/math/vec3/u32/max.ts +1 -0
- package/src/interface/math/vec3/u32/min.ts +1 -0
- package/src/interface/math/vec3/u32/multiply.ts +1 -0
- package/src/interface/math/vec3/u32/negate.ts +1 -0
- package/src/interface/math/vec3/u32/one.ts +1 -0
- package/src/interface/math/vec3/u32/public.ts +2 -0
- package/src/interface/math/vec3/u32/reverse-bits.ts +1 -0
- package/src/interface/math/vec3/u32/scale.ts +1 -0
- package/src/interface/math/vec3/u32/schema.ts +1 -0
- package/src/interface/math/vec3/u32/shift-left.ts +1 -0
- package/src/interface/math/vec3/u32/shift-right.ts +1 -0
- package/src/interface/math/vec3/u32/subtract.ts +1 -0
- package/src/interface/math/vec3/u32/u32.ts +5 -1
- package/src/interface/math/vec3/u32/volume.ts +1 -0
- package/src/interface/math/vec3/u32/zero.ts +1 -0
- package/src/interface/math/vec4/f32/abs.ts +1 -0
- package/src/interface/math/vec4/f32/acos.ts +1 -0
- package/src/interface/math/vec4/f32/acosh.ts +1 -0
- package/src/interface/math/vec4/f32/add.ts +1 -0
- package/src/interface/math/vec4/f32/asin.ts +1 -0
- package/src/interface/math/vec4/f32/asinh.ts +1 -0
- package/src/interface/math/vec4/f32/atan.ts +1 -0
- package/src/interface/math/vec4/f32/atanh.ts +1 -0
- package/src/interface/math/vec4/f32/ceil.ts +1 -0
- package/src/interface/math/vec4/f32/clamp.ts +1 -0
- package/src/interface/math/vec4/f32/cos.ts +1 -0
- package/src/interface/math/vec4/f32/cosh.ts +1 -0
- package/src/interface/math/vec4/f32/default.ts +6 -0
- package/src/interface/math/vec4/f32/distance.ts +1 -0
- package/src/interface/math/vec4/f32/dot.ts +1 -0
- package/src/interface/math/vec4/f32/exp.ts +1 -0
- package/src/interface/math/vec4/f32/exp2.ts +1 -0
- package/src/interface/math/vec4/f32/f32.ts +5 -1
- package/src/interface/math/vec4/f32/faceforward.ts +1 -0
- package/src/interface/math/vec4/f32/floor.ts +1 -0
- package/src/interface/math/vec4/f32/fract.ts +1 -0
- package/src/interface/math/vec4/f32/length.ts +1 -0
- package/src/interface/math/vec4/f32/log.ts +1 -0
- package/src/interface/math/vec4/f32/log2.ts +1 -0
- package/src/interface/math/vec4/f32/max.ts +1 -0
- package/src/interface/math/vec4/f32/min.ts +1 -0
- package/src/interface/math/vec4/f32/mix.ts +1 -0
- package/src/interface/math/vec4/f32/mod.ts +1 -0
- package/src/interface/math/vec4/f32/modf.ts +1 -0
- package/src/interface/math/vec4/f32/multiply.ts +1 -0
- package/src/interface/math/vec4/f32/negate.ts +1 -0
- package/src/interface/math/vec4/f32/normalize.ts +1 -0
- package/src/interface/math/vec4/f32/pow.ts +1 -0
- package/src/interface/math/vec4/f32/public.ts +2 -0
- package/src/interface/math/vec4/f32/reflect.ts +1 -0
- package/src/interface/math/vec4/f32/refract.ts +1 -0
- package/src/interface/math/vec4/f32/round.ts +1 -0
- package/src/interface/math/vec4/f32/scale.ts +1 -0
- package/src/interface/math/vec4/f32/schema.ts +1 -0
- package/src/interface/math/vec4/f32/sign.ts +1 -0
- package/src/interface/math/vec4/f32/sin.ts +1 -0
- package/src/interface/math/vec4/f32/sinh.ts +1 -0
- package/src/interface/math/vec4/f32/smoothstep.ts +1 -0
- package/src/interface/math/vec4/f32/sqrt.ts +1 -0
- package/src/interface/math/vec4/f32/step.ts +1 -0
- package/src/interface/math/vec4/f32/subtract.ts +1 -0
- package/src/interface/math/vec4/f32/tan.ts +1 -0
- package/src/interface/math/vec4/f32/tanh.ts +1 -0
- package/src/interface/math/vec4/f32/trunc.ts +1 -0
- package/src/interface/math/vec4/i32/abs.ts +1 -0
- package/src/interface/math/vec4/i32/add.ts +1 -0
- package/src/interface/math/vec4/i32/bitwise-and.ts +1 -0
- package/src/interface/math/vec4/i32/bitwise-not.ts +1 -0
- package/src/interface/math/vec4/i32/bitwise-or.ts +1 -0
- package/src/interface/math/vec4/i32/bitwise-xor.ts +1 -0
- package/src/interface/math/vec4/i32/clamp.ts +1 -0
- package/src/interface/math/vec4/i32/count-leading-zeros.ts +1 -0
- package/src/interface/math/vec4/i32/count-one-bits.ts +1 -0
- package/src/interface/math/vec4/i32/count-trailing-zeros.ts +1 -0
- package/src/interface/math/vec4/i32/equals.ts +1 -0
- package/src/interface/math/vec4/i32/i32.ts +5 -1
- package/src/interface/math/vec4/i32/max.ts +1 -0
- package/src/interface/math/vec4/i32/min.ts +1 -0
- package/src/interface/math/vec4/i32/multiply.ts +1 -0
- package/src/interface/math/vec4/i32/negate.ts +1 -0
- package/src/interface/math/vec4/i32/one.ts +1 -0
- package/src/interface/math/vec4/i32/public.ts +2 -0
- package/src/interface/math/vec4/i32/reverse-bits.ts +1 -0
- package/src/interface/math/vec4/i32/scale.ts +1 -0
- package/src/interface/math/vec4/i32/schema.ts +1 -0
- package/src/interface/math/vec4/i32/shift-left.ts +1 -0
- package/src/interface/math/vec4/i32/shift-right.ts +1 -0
- package/src/interface/math/vec4/i32/subtract.ts +1 -0
- package/src/interface/math/vec4/i32/zero.ts +1 -0
- package/src/interface/math/vec4/index.ts +1 -0
- package/src/interface/math/vec4/public.ts +2 -0
- package/src/interface/math/vec4/u32/add.ts +1 -0
- package/src/interface/math/vec4/u32/bitwise-and.ts +1 -0
- package/src/interface/math/vec4/u32/bitwise-not.ts +1 -0
- package/src/interface/math/vec4/u32/bitwise-or.ts +1 -0
- package/src/interface/math/vec4/u32/bitwise-xor.ts +1 -0
- package/src/interface/math/vec4/u32/clamp.ts +1 -0
- package/src/interface/math/vec4/u32/count-leading-zeros.ts +1 -0
- package/src/interface/math/vec4/u32/count-one-bits.ts +1 -0
- package/src/interface/math/vec4/u32/count-trailing-zeros.ts +1 -0
- package/src/interface/math/vec4/u32/equals.ts +1 -0
- package/src/interface/math/vec4/u32/max.ts +1 -0
- package/src/interface/math/vec4/u32/min.ts +1 -0
- package/src/interface/math/vec4/u32/multiply.ts +1 -0
- package/src/interface/math/vec4/u32/negate.ts +1 -0
- package/src/interface/math/vec4/u32/one.ts +1 -0
- package/src/interface/math/vec4/u32/public.ts +2 -0
- package/src/interface/math/vec4/u32/reverse-bits.ts +1 -0
- package/src/interface/math/vec4/u32/scale.ts +1 -0
- package/src/interface/math/vec4/u32/schema.ts +1 -0
- package/src/interface/math/vec4/u32/shift-left.ts +1 -0
- package/src/interface/math/vec4/u32/shift-right.ts +1 -0
- package/src/interface/math/vec4/u32/subtract.ts +1 -0
- package/src/interface/math/vec4/u32/u32.ts +5 -1
- package/src/interface/math/vec4/u32/zero.ts +1 -0
- package/src/interface/platform/platform.ts +1 -0
- package/src/interface/registry/archetypes.test.ts +50 -0
- package/src/interface/registry/archetypes.ts +45 -9
- package/src/interface/registry/declarations.ts +107 -13
- package/src/interface/registry/declared.test.ts +40 -0
- package/src/interface/registry/finalizer-order.ts +4 -3
- package/src/interface/registry/ids.test-helper.ts +35 -1
- package/src/interface/registry/ids.test.ts +43 -56
- package/src/interface/registry/ids.ts +46 -0
- package/src/interface/registry/index.ts +4 -3
- package/src/interface/registry/indexes.ts +3 -2
- package/src/interface/registry/items.ts +17 -47
- package/src/interface/registry/layout.test.ts +20 -0
- package/src/interface/registry/layout.ts +11 -3
- package/src/interface/registry/names.test.ts +16 -18
- package/src/interface/registry/names.ts +62 -42
- package/src/interface/registry/program.ts +1 -0
- package/src/interface/registry/reduction.ts +1 -0
- package/src/interface/registry/schedule.ts +10 -14
- package/src/interface/registry/schemas.ts +58 -0
- package/src/interface/registry/strata.ts +1 -0
- package/src/interface/registry/threads.ts +3 -2
- package/src/interface/registry/traits.ts +2 -1
- package/src/interface/registry/written.ts +1 -0
- package/src/interface/resource/condition.ts +1 -0
- package/src/interface/resource/index.ts +1 -1
- package/src/interface/resource/key.ts +1 -0
- package/src/interface/resource/reduction.ts +1 -0
- package/src/interface/resource/register.test.ts +42 -56
- package/src/interface/resource/resource.ts +1 -0
- package/src/interface/resource/types.ts +5 -1
- package/src/interface/resource/value.ts +1 -0
- package/src/interface/resource/written.ts +1 -0
- package/src/interface/resources/always.ts +3 -2
- package/src/interface/resources/cadence.ts +4 -3
- package/src/interface/resources/clock.ts +5 -3
- package/src/interface/resources/gpu-device.ts +3 -2
- package/src/interface/resources/index.ts +1 -0
- package/src/interface/resources/wake.ts +3 -2
- package/src/interface/resources/workers.ts +3 -2
- package/src/interface/rule/create.ts +9 -7
- package/src/interface/rule/created.ts +3 -2
- package/src/interface/rule/declaration.ts +7 -3
- package/src/interface/rule/index.ts +1 -0
- package/src/interface/rule/rule.ts +1 -0
- package/src/interface/rule/rule.type-test.ts +17 -27
- package/src/interface/schema/is-struct.ts +12 -0
- package/src/interface/schema/schema.ts +23 -1
- package/src/interface/schema/schema.type-test.ts +18 -16
- package/src/interface/schema/schemas.type-test.ts +1 -0
- package/src/interface/system/access.ts +68 -28
- package/src/interface/system/body.ts +53 -23
- package/src/interface/system/check.ts +82 -44
- package/src/interface/system/commands.ts +50 -5
- package/src/interface/system/commands.type-test.ts +2 -8
- package/src/interface/system/composite-declaration.ts +1 -2
- package/src/interface/system/composite-input.type-test.ts +13 -29
- package/src/interface/system/composite.ts +1 -0
- package/src/interface/system/conditions.type-test.ts +11 -22
- package/src/interface/system/create-resolved.ts +21 -0
- package/src/interface/system/create.test.ts +96 -116
- package/src/interface/system/create.ts +121 -94
- package/src/interface/system/declaration.ts +33 -25
- package/src/interface/system/definition.ts +1 -0
- package/src/interface/system/index.ts +1 -0
- package/src/interface/system/input.ts +35 -4
- package/src/interface/system/leaf.ts +10 -3
- package/src/interface/system/lists.type-test.ts +53 -0
- package/src/interface/system/name.ts +4 -3
- package/src/interface/system/optional.type-test.ts +51 -0
- package/src/interface/system/property.ts +1 -0
- package/src/interface/system/render.ts +45 -20
- package/src/interface/system/resolve.test.ts +49 -0
- package/src/interface/system/resolve.ts +165 -0
- package/src/interface/system/shared.type-test.ts +205 -0
- package/src/interface/system/struct.ts +1 -0
- package/src/interface/system/system.ts +5 -3
- package/src/interface/system/system.type-test.ts +160 -197
- package/src/interface/system/threads.ts +9 -8
- package/src/interface/system/threads.type-test.ts +29 -60
- package/src/interface/system/up.type-test.ts +15 -28
- package/src/interface/system/values-of.ts +17 -0
- package/src/interface/system/values.ts +15 -12
- package/src/interface/thread/of.ts +4 -3
- package/src/interface/thread/thread.ts +1 -0
- package/src/interface/thread/thread.type-test.ts +3 -68
- package/src/interface/trait/key.ts +2 -1
- package/src/interface/trait/trait.type-test.ts +4 -77
- package/src/interface/trait/types.ts +19 -6
- package/src/interface/tsconfig.json +1 -1
- package/src/interface/world/create.ts +9 -2
- package/src/interface/world/declarations.ts +34 -0
- package/src/interface/world/filter.ts +1 -0
- package/src/interface/world/index.ts +1 -0
- package/src/interface/world/join.ts +11 -4
- package/src/interface/world/loop.type-test.ts +15 -10
- package/src/interface/world/run.type-test.ts +87 -0
- package/src/interface/world/share.type-test.ts +8 -2
- package/src/interface/world/world.ts +32 -17
- package/src/interface/world/world.type-test.ts +6 -10
- package/src/observe/compare.ts +1 -0
- package/src/observe/entity.ts +21 -13
- package/src/observe/index.ts +1 -0
- package/src/observe/members.ts +1 -0
- package/src/observe/observe.ts +1 -0
- package/src/observe/observe.type-test.ts +1 -4
- package/src/observe/plans.ts +1 -0
- package/src/observe/query.ts +1 -0
- package/src/observe/resource.ts +5 -4
- package/src/observe/select.ts +13 -12
- package/src/observe/to-promise.ts +1 -0
- package/src/observe/tsconfig.json +1 -1
- package/src/observe/values.ts +1 -0
- package/src/observe/world-state.ts +41 -34
- package/src/observe-imports.test.ts +1 -0
- package/src/perftest/benchmark.ts +1 -0
- package/src/perftest/benchmarks.ts +24 -8
- package/src/perftest/editor.ts +126 -0
- package/src/perftest/filters.ts +124 -0
- package/src/perftest/finalized.ts +72 -24
- package/src/perftest/flat.ts +16 -26
- package/src/perftest/growth.ts +7 -15
- package/src/perftest/handoff.ts +30 -37
- package/src/perftest/hierarchy.ts +23 -40
- package/src/perftest/indexes.ts +132 -64
- package/src/perftest/invariants.ts +63 -0
- package/src/perftest/joined.ts +13 -5
- package/src/perftest/journal.ts +55 -0
- package/src/perftest/keys.ts +1 -0
- package/src/perftest/log.ts +6 -6
- package/src/perftest/loop.ts +2 -1
- package/src/perftest/observed-gpu.ts +6 -7
- package/src/perftest/observed.ts +6 -12
- package/src/perftest/observer.ts +5 -4
- package/src/perftest/optional.ts +102 -0
- package/src/perftest/particles.ts +13 -20
- package/src/perftest/placed.ts +1 -0
- package/src/perftest/reads.ts +13 -18
- package/src/perftest/remote.ts +26 -28
- package/src/perftest/render-order.ts +86 -0
- package/src/perftest/run.ts +1 -0
- package/src/perftest/shared.ts +416 -0
- package/src/perftest/strings.ts +14 -12
- package/src/perftest/structural.ts +32 -46
- package/src/perftest/suite.perf-browser-test.ts +3 -0
- package/src/perftest/suite.perf-test.ts +1 -0
- package/src/perftest/suite.ts +41 -59
- package/src/perftest/systems.ts +4 -6
- package/src/perftest/tails.ts +40 -48
- package/src/perftest/transfers.ts +25 -20
- package/src/perftest/uploads.ts +11 -13
- package/src/perftest/values.ts +8 -12
- package/src/perftest/wake.ts +1 -0
- package/src/world.test.ts +10 -10
- package/dist/implementation/compiler/exact.d.ts +0 -24
- package/dist/implementation/compiler/exact.js +0 -64
- package/dist/implementation/compiler/exact.js.map +0 -1
- package/dist/implementation/world/reports.d.ts +0 -63
- package/dist/implementation/world/reports.js +0 -180
- package/dist/implementation/world/reports.js.map +0 -1
- package/dist/interface/archetype/archetype.d.ts +0 -2
- package/dist/interface/archetype/archetype.js +0 -2
- package/dist/interface/archetype/archetype.js.map +0 -1
- package/dist/interface/archetype/create.d.ts +0 -7
- package/dist/interface/archetype/create.js +0 -11
- package/dist/interface/archetype/create.js.map +0 -1
- package/dist/interface/archetype/index.d.ts +0 -1
- package/dist/interface/archetype/index.js +0 -2
- package/dist/interface/archetype/index.js.map +0 -1
- package/dist/interface/archetype/values-of.d.ts +0 -17
- package/dist/interface/archetype/values-of.js.map +0 -1
- package/dist/interface/component/declaration.d.ts +0 -74
- package/dist/interface/component/declaration.js +0 -2
- package/dist/interface/component/declaration.js.map +0 -1
- package/dist/interface/component/register.d.ts +0 -23
- package/dist/interface/component/register.js +0 -6
- package/dist/interface/component/register.js.map +0 -1
- package/dist/interface/finalizer/name.d.ts +0 -6
- package/dist/interface/finalizer/name.js +0 -2
- package/dist/interface/finalizer/name.js.map +0 -1
- package/dist/interface/indexes/name.d.ts +0 -5
- package/dist/interface/indexes/name.js +0 -2
- package/dist/interface/indexes/name.js.map +0 -1
- package/dist/interface/report/components.d.ts +0 -38
- package/dist/interface/report/components.js +0 -48
- package/dist/interface/report/components.js.map +0 -1
- package/dist/interface/report/failure.d.ts +0 -29
- package/dist/interface/report/failure.js +0 -2
- package/dist/interface/report/failure.js.map +0 -1
- package/dist/interface/report/index.d.ts +0 -5
- package/dist/interface/report/index.js +0 -6
- package/dist/interface/report/index.js.map +0 -1
- package/dist/interface/report/report.d.ts +0 -12
- package/dist/interface/report/report.js +0 -2
- package/dist/interface/report/report.js.map +0 -1
- package/dist/interface/resource/declaration.d.ts +0 -31
- package/dist/interface/resource/declaration.js +0 -2
- package/dist/interface/resource/declaration.js.map +0 -1
- package/dist/interface/resource/register.d.ts +0 -13
- package/dist/interface/resource/register.js +0 -6
- package/dist/interface/resource/register.js.map +0 -1
- package/dist/interface/rule/name.d.ts +0 -6
- package/dist/interface/rule/name.js +0 -2
- package/dist/interface/rule/name.js.map +0 -1
- package/dist/interface/schema/is-data.d.ts +0 -19
- package/dist/interface/schema/is-data.js +0 -2
- package/dist/interface/schema/is-data.js.map +0 -1
- package/dist/interface/trait/index.d.ts +0 -1
- package/dist/interface/trait/index.js +0 -2
- package/dist/interface/trait/index.js.map +0 -1
- package/dist/interface/trait/register.d.ts +0 -7
- package/dist/interface/trait/register.js +0 -8
- package/dist/interface/trait/register.js.map +0 -1
- package/dist/interface/trait/required.d.ts +0 -10
- package/dist/interface/trait/required.js +0 -2
- package/dist/interface/trait/required.js.map +0 -1
- package/dist/interface/trait/symbol-keys.d.ts +0 -16
- package/dist/interface/trait/symbol-keys.js +0 -2
- package/dist/interface/trait/symbol-keys.js.map +0 -1
- package/dist/interface/trait/trait.d.ts +0 -2
- package/dist/interface/trait/trait.js +0 -2
- package/dist/interface/trait/trait.js.map +0 -1
- package/src/guide/01-resources.test.ts +0 -44
- package/src/guide/02-entities.test.ts +0 -57
- package/src/guide/03-systems.test.ts +0 -87
- package/src/guide/04-ticks.test.ts +0 -73
- package/src/guide/05-scheduling.test.ts +0 -60
- package/src/guide/06-sync-points.test.ts +0 -59
- package/src/guide/07-change-filters.test.ts +0 -87
- package/src/guide/08-input.test.ts +0 -47
- package/src/guide/09-rules.test.ts +0 -57
- package/src/guide/10-finalizers.test.ts +0 -64
- package/src/guide/11-traits.test.ts +0 -58
- package/src/guide/13-indexes.test.ts +0 -95
- package/src/guide/guide.md +0 -551
- package/src/implementation/compiler/exact.ts +0 -77
- package/src/implementation/world/reports.test-helper.ts +0 -117
- package/src/implementation/world/reports.test.ts +0 -167
- package/src/implementation/world/reports.ts +0 -203
- package/src/interface/archetype/archetype.ts +0 -3
- package/src/interface/archetype/archetype.type-test.ts +0 -37
- package/src/interface/archetype/create.test.ts +0 -40
- package/src/interface/archetype/create.ts +0 -12
- package/src/interface/archetype/index.ts +0 -1
- package/src/interface/archetype/values-of.ts +0 -16
- package/src/interface/component/declaration.ts +0 -67
- package/src/interface/component/declaration.type-test.ts +0 -87
- package/src/interface/component/register.ts +0 -28
- package/src/interface/finalizer/name.ts +0 -6
- package/src/interface/indexes/name.ts +0 -5
- package/src/interface/report/components.ts +0 -69
- package/src/interface/report/failure.ts +0 -26
- package/src/interface/report/index.ts +0 -8
- package/src/interface/report/report.ts +0 -11
- package/src/interface/report/report.type-test.ts +0 -63
- package/src/interface/resource/declaration.ts +0 -29
- package/src/interface/resource/declaration.type-test.ts +0 -89
- package/src/interface/resource/register.ts +0 -18
- package/src/interface/rule/name.ts +0 -6
- package/src/interface/schema/is-data.ts +0 -25
- package/src/interface/trait/index.ts +0 -1
- package/src/interface/trait/register.ts +0 -9
- package/src/interface/trait/required.ts +0 -7
- package/src/interface/trait/symbol-keys.ts +0 -19
- package/src/interface/trait/symbol-keys.type-test.ts +0 -14
- package/src/interface/trait/trait.ts +0 -3
- package/src/samples/particles/build.test.ts +0 -23
- package/src/samples/particles/gpu/main.ts +0 -96
- package/src/samples/particles/gpu/particles.ts +0 -138
- package/src/samples/particles/index.html +0 -22
- package/src/samples/particles/particles.test.ts +0 -31
- package/src/samples/particles/particles.ts +0 -85
- package/src/samples/particles/particles.type-test.ts +0 -7
- package/src/samples/todo/README.md +0 -174
- package/src/samples/todo/app/app.browser.test.ts +0 -215
- package/src/samples/todo/app/app.ts +0 -30
- package/src/samples/todo/app/log-failures.test.ts +0 -28
- package/src/samples/todo/app/log-failures.ts +0 -7
- package/src/samples/todo/app/main.ts +0 -4
- package/src/samples/todo/app/profile.perf-browser-test.ts +0 -100
- package/src/samples/todo/app/proportional.browser.test.ts +0 -157
- package/src/samples/todo/app/todo.perf-browser-test.ts +0 -207
- package/src/samples/todo/build.test.ts +0 -23
- package/src/samples/todo/features/completion/data.ts +0 -5
- package/src/samples/todo/features/completion/dom.browser.test.ts +0 -53
- package/src/samples/todo/features/completion/dom.ts +0 -39
- package/src/samples/todo/features/completion/elements/elements.browser.test.ts +0 -68
- package/src/samples/todo/features/completion/elements/todo-summary.ts +0 -82
- package/src/samples/todo/features/completion/elements/todo-toggle-all.ts +0 -69
- package/src/samples/todo/features/completion/events.ts +0 -7
- package/src/samples/todo/features/completion/feature.ts +0 -13
- package/src/samples/todo/features/completion/model.test.ts +0 -40
- package/src/samples/todo/features/completion/model.ts +0 -21
- package/src/samples/todo/features/filter/data.ts +0 -16
- package/src/samples/todo/features/filter/dom.browser.test.ts +0 -84
- package/src/samples/todo/features/filter/dom.ts +0 -63
- package/src/samples/todo/features/filter/elements/elements.browser.test.ts +0 -43
- package/src/samples/todo/features/filter/elements/todo-filters.ts +0 -70
- package/src/samples/todo/features/filter/events.ts +0 -4
- package/src/samples/todo/features/filter/feature.ts +0 -12
- package/src/samples/todo/features/filter/model.test.ts +0 -18
- package/src/samples/todo/features/filter/model.ts +0 -10
- package/src/samples/todo/features/generate/elements/elements.browser.test.ts +0 -18
- package/src/samples/todo/features/generate/elements/todo-generate.ts +0 -36
- package/src/samples/todo/features/generate/events.ts +0 -4
- package/src/samples/todo/features/generate/feature.ts +0 -11
- package/src/samples/todo/features/generate/model.test.ts +0 -13
- package/src/samples/todo/features/generate/model.ts +0 -19
- package/src/samples/todo/features/index.ts +0 -4
- package/src/samples/todo/features/todos/data.ts +0 -31
- package/src/samples/todo/features/todos/dom.browser.test.ts +0 -205
- package/src/samples/todo/features/todos/dom.ts +0 -90
- package/src/samples/todo/features/todos/elements/elements.browser.test.ts +0 -211
- package/src/samples/todo/features/todos/elements/todo-entry.ts +0 -45
- package/src/samples/todo/features/todos/elements/todo-list.ts +0 -93
- package/src/samples/todo/features/todos/elements/todo-row.ts +0 -138
- package/src/samples/todo/features/todos/events.ts +0 -11
- package/src/samples/todo/features/todos/feature.ts +0 -14
- package/src/samples/todo/features/todos/model.test.ts +0 -77
- package/src/samples/todo/features/todos/model.ts +0 -80
- package/src/samples/todo/features/todos/todos.test-helper.ts +0 -34
- package/src/samples/todo/imports.test.ts +0 -113
- package/src/samples/todo/index.html +0 -51
- package/src/samples/todo/shared/attach.browser.test.ts +0 -73
- package/src/samples/todo/shared/attach.ts +0 -32
- package/src/samples/todo/shared/connect.ts +0 -21
- package/src/samples/todo/shared/elements/define.ts +0 -7
- package/src/samples/todo/shared/elements/elements.test-helper.ts +0 -28
- package/src/samples/todo/shared/feature.ts +0 -20
- package/src/samples/todo/shared/ticks.test-helper.ts +0 -25
- package/src/samples/transfers/build.test.ts +0 -22
- package/src/samples/transfers/index.html +0 -18
- package/src/samples/transfers/loader.ts +0 -42
- package/src/samples/transfers/main.ts +0 -46
- package/src/samples/transfers/sprites.ts +0 -96
- package/src/samples/transfers/world.ts +0 -11
- /package/dist/interface/{archetype → system}/values-of.js +0 -0
|
@@ -0,0 +1,943 @@
|
|
|
1
|
+
// © 2026 Adobe. MIT License. See /LICENSE for details.
|
|
2
|
+
import { reductionOperators } from '../../interface/registry/reduction.js';
|
|
3
|
+
import { isComparable, isEntity, isString, isStruct, matchesSchema } from '../../interface/registry/schemas.js';
|
|
4
|
+
import { declarationsName } from '../../interface/registry/ids.js';
|
|
5
|
+
import { createConverter, isNotData, isThrown } from './type-schemas.js';
|
|
6
|
+
const kinds = { Components: "component", Resources: "resource", Traits: "trait" };
|
|
7
|
+
const isKind = (name) => name in kinds;
|
|
8
|
+
/** The interfaces of each top-level `declare module "@adobe/ecs"` block, with the block. */
|
|
9
|
+
const augmentationsOf = (module) => module.program.body.flatMap(statement => {
|
|
10
|
+
if (statement.type !== "TSModuleDeclaration" || statement.global !== false || statement.id.type !== "Literal" || statement.id.value !== "@adobe/ecs")
|
|
11
|
+
return [];
|
|
12
|
+
const body = statement.body?.type === "TSModuleBlock" ? statement.body.body : [];
|
|
13
|
+
const interfaces = body.flatMap(inner => {
|
|
14
|
+
const declared = inner.type === "ExportNamedDeclaration" ? inner.declaration : inner;
|
|
15
|
+
return declared?.type === "TSInterfaceDeclaration" && isKind(declared.id.name) ? [declared] : [];
|
|
16
|
+
});
|
|
17
|
+
return [{ block: statement, interfaces }];
|
|
18
|
+
});
|
|
19
|
+
/**
|
|
20
|
+
* The literal value of `trait` each key of `kind` a module's `declare module "@adobe/ecs"` blocks declare it on has, by
|
|
21
|
+
* its key's binding.
|
|
22
|
+
*/
|
|
23
|
+
const declaredTraitsIn = (program, kind, trait) => {
|
|
24
|
+
const found = new Map();
|
|
25
|
+
for (const { interfaces } of augmentationsOf({ program })) {
|
|
26
|
+
for (const declared of interfaces) {
|
|
27
|
+
if (declared.id.name !== kind)
|
|
28
|
+
continue;
|
|
29
|
+
for (const member of declared.body.body) {
|
|
30
|
+
if (member.type !== "TSPropertySignature" || !member.computed || member.key.type !== "Identifier")
|
|
31
|
+
continue;
|
|
32
|
+
const declaration = member.typeAnnotation?.typeAnnotation;
|
|
33
|
+
if (declaration?.type !== "TSTypeLiteral")
|
|
34
|
+
continue;
|
|
35
|
+
for (const property of declaration.members) {
|
|
36
|
+
if (property.type !== "TSPropertySignature" || property.computed || property.key.type !== "Identifier" || property.key.name !== trait)
|
|
37
|
+
continue;
|
|
38
|
+
const value = property.typeAnnotation?.typeAnnotation;
|
|
39
|
+
if (value?.type === "TSLiteralType" && value.literal.type === "Literal" && (typeof value.literal.value === "string" || typeof value.literal.value === "number" || typeof value.literal.value === "boolean"))
|
|
40
|
+
found.set(member.key.name, value.literal.value);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return found;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* The operator each resource a module's `declare module "@adobe/ecs"` blocks declare with a `reduce` trait reduces
|
|
49
|
+
* with, by its key's binding: what a kernel reducing into it folds with.
|
|
50
|
+
*/
|
|
51
|
+
export const reductionsIn = (program) => new Map([...declaredTraitsIn(program, "Resources", "reduce")].flatMap(([binding, value]) => typeof value === "string" ? [[binding, value]] : []));
|
|
52
|
+
/** The components a module's `declare module "@adobe/ecs"` blocks declare `shared: true`, by their keys' bindings: what kernels read as parameters. */
|
|
53
|
+
export const sharedIn = (program) => new Set([...declaredTraitsIn(program, "Components", "shared")].flatMap(([binding, value]) => value === true ? [binding] : []));
|
|
54
|
+
/** A call's statement forms as a bundle leaves them: alone, in a sequence, or `void`ed. */
|
|
55
|
+
const callsOf = (expression) => {
|
|
56
|
+
if (expression.type === "CallExpression")
|
|
57
|
+
return [expression];
|
|
58
|
+
if (expression.type === "SequenceExpression")
|
|
59
|
+
return expression.expressions.flatMap(callsOf);
|
|
60
|
+
if (expression.type === "UnaryExpression" && expression.operator === "void")
|
|
61
|
+
return callsOf(expression.argument);
|
|
62
|
+
return [];
|
|
63
|
+
};
|
|
64
|
+
/** An object literal's property named `name`, unless computed. */
|
|
65
|
+
const propertyNamed = (object, name) => {
|
|
66
|
+
for (const property of object.properties) {
|
|
67
|
+
if (property.type === "Property" && !property.computed && property.key.type === "Identifier" && property.key.name === name)
|
|
68
|
+
return property.value;
|
|
69
|
+
}
|
|
70
|
+
return null;
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* The literal value of `trait` each key of `kind` a module's generated declarations give, by its key's binding: what a
|
|
74
|
+
* library's build in library mode leaves of its declarations in its JavaScript. They record `key, kind, { ..., trait }`
|
|
75
|
+
* through the function appended to the module, under any name a bundle gives it, or, inlined, set
|
|
76
|
+
* `{ kind, declaration }` on the declarations map; the key is a top-level `Symbol()` constant.
|
|
77
|
+
*/
|
|
78
|
+
const registeredTraitsIn = (program, kind, trait) => {
|
|
79
|
+
const symbols = new Set();
|
|
80
|
+
for (const statement of program.body) {
|
|
81
|
+
const declaration = statement.type === "ExportNamedDeclaration" ? statement.declaration : statement;
|
|
82
|
+
if (declaration?.type !== "VariableDeclaration" || declaration.kind !== "const")
|
|
83
|
+
continue;
|
|
84
|
+
for (const declarator of declaration.declarations) {
|
|
85
|
+
const init = declarator.init;
|
|
86
|
+
if (declarator.id.type === "Identifier" && init?.type === "CallExpression" && init.callee.type === "Identifier" && init.callee.name === "Symbol")
|
|
87
|
+
symbols.add(declarator.id.name);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
/** The declaration a call records for a key of `kind` keyed by a `Symbol()` constant, by either form, with its key. */
|
|
91
|
+
const recorded = ({ callee, arguments: parameters }) => {
|
|
92
|
+
const [key, second, third] = parameters;
|
|
93
|
+
if (key?.type !== "Identifier" || !symbols.has(key.name))
|
|
94
|
+
return null;
|
|
95
|
+
if (second?.type === "Literal" && second.value === kind && third?.type === "ObjectExpression")
|
|
96
|
+
return { key: key.name, declaration: third };
|
|
97
|
+
const setsEntry = callee.type === "MemberExpression" && !callee.computed && callee.property.type === "Identifier" && callee.property.name === "set";
|
|
98
|
+
if (!setsEntry || second?.type !== "ObjectExpression")
|
|
99
|
+
return null;
|
|
100
|
+
const recordedKind = propertyNamed(second, "kind");
|
|
101
|
+
const declaration = propertyNamed(second, "declaration");
|
|
102
|
+
return recordedKind?.type === "Literal" && recordedKind.value === kind && declaration !== null ? { key: key.name, declaration } : null;
|
|
103
|
+
};
|
|
104
|
+
const found = new Map();
|
|
105
|
+
for (const statement of program.body) {
|
|
106
|
+
if (statement.type !== "ExpressionStatement")
|
|
107
|
+
continue;
|
|
108
|
+
for (const call of callsOf(statement.expression)) {
|
|
109
|
+
const entry = recorded(call);
|
|
110
|
+
if (entry === null || entry.declaration.type !== "ObjectExpression")
|
|
111
|
+
continue;
|
|
112
|
+
const value = propertyNamed(entry.declaration, trait);
|
|
113
|
+
if (value?.type === "Literal")
|
|
114
|
+
found.set(entry.key, value.value);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return found;
|
|
118
|
+
};
|
|
119
|
+
/** The operator each resource a module's generated declarations give it reduces with, by its key's binding (`registeredTraitsIn`). */
|
|
120
|
+
export const registeredReductionsIn = (program) => new Map([...registeredTraitsIn(program, "resource", "reduce")].flatMap(([binding, value]) => typeof value === "string" ? [[binding, value]] : []));
|
|
121
|
+
/** The components a module's generated declarations declare shared, by their keys' bindings (`registeredTraitsIn`). */
|
|
122
|
+
export const registeredSharedIn = (program) => new Set([...registeredTraitsIn(program, "component", "shared")].flatMap(([binding, value]) => value === true ? [binding] : []));
|
|
123
|
+
/** A type reference's name and the namespaces it's read through. */
|
|
124
|
+
const typeNameParts = (name) => name.type === "Identifier" ? [name.name] : name.type === "TSQualifiedName" ? [...typeNameParts(name.left), name.right.name] : [];
|
|
125
|
+
/** A `typeof` query's name and the properties read from it; null for `this`. */
|
|
126
|
+
const qualifiedParts = (name) => {
|
|
127
|
+
if (name.type === "Identifier")
|
|
128
|
+
return [name.name];
|
|
129
|
+
if (name.type !== "TSQualifiedName")
|
|
130
|
+
return null;
|
|
131
|
+
const left = qualifiedParts(name.left);
|
|
132
|
+
return left === null ? null : [...left, name.right.name];
|
|
133
|
+
};
|
|
134
|
+
/** The platform's Transferable classes, which `transfer` takes. */
|
|
135
|
+
const transferables = new Set([
|
|
136
|
+
"ArrayBuffer", "ImageBitmap", "OffscreenCanvas", "MessagePort", "VideoFrame", "AudioData",
|
|
137
|
+
"ReadableStream", "WritableStream", "TransformStream", "RTCDataChannel",
|
|
138
|
+
]);
|
|
139
|
+
/** Tests and their helpers in the package, which declare keys as consumers do. */
|
|
140
|
+
const testModule = /\.(test|type-test|fixture|test-helper|cases)\.tsx?$/;
|
|
141
|
+
/** Whether a file is one of the package's own modules, whose built-in keys register themselves. */
|
|
142
|
+
const isLibraryModule = (path, file) => path !== null && (path.startsWith("interface/") || path.startsWith("implementation/")) && !testModule.test(file);
|
|
143
|
+
/** Whether a module's top level binds `name`: imported, or declared by a variable, function or class. */
|
|
144
|
+
const bindsAtTopLevel = (program, name) => program.body.some(statement => {
|
|
145
|
+
if (statement.type === "ImportDeclaration")
|
|
146
|
+
return statement.specifiers.some(specifier => specifier.local.name === name);
|
|
147
|
+
const declared = statement.type === "ExportNamedDeclaration" || statement.type === "ExportDefaultDeclaration" ? statement.declaration : statement;
|
|
148
|
+
if (declared?.type === "VariableDeclaration")
|
|
149
|
+
return declared.declarations.some(declarator => declarator.id.type === "Identifier" && declarator.id.name === name);
|
|
150
|
+
return (declared?.type === "FunctionDeclaration" || declared?.type === "ClassDeclaration") && declared.id?.name === name;
|
|
151
|
+
});
|
|
152
|
+
/** `base`, or it numbered, so the name appears nowhere in the code. */
|
|
153
|
+
const uniqueName = (code, base) => {
|
|
154
|
+
let name = base;
|
|
155
|
+
for (let n = 1; new RegExp(`${name.replace("$", "\\$")}(?![\\w$])`).test(code); n++)
|
|
156
|
+
name = `${base}${n}`;
|
|
157
|
+
return name;
|
|
158
|
+
};
|
|
159
|
+
const allowsNullSchema = (schema) => ("type" in schema && schema.type === "null") || ("const" in schema && schema.const === null) || ("anyOf" in schema && schema.anyOf.some(allowsNullSchema));
|
|
160
|
+
/** A value as code: JSON, but -0 and the numbers JSON can't write as themselves. */
|
|
161
|
+
const codeOf = (value) => {
|
|
162
|
+
if (Object.is(value, -0))
|
|
163
|
+
return "-0";
|
|
164
|
+
if (typeof value === "number" && !Number.isFinite(value))
|
|
165
|
+
return Number.isNaN(value) ? "NaN" : value > 0 ? "Infinity" : "-Infinity";
|
|
166
|
+
if (Array.isArray(value))
|
|
167
|
+
return `[${value.map(codeOf).join(",")}]`;
|
|
168
|
+
if (typeof value === "object" && value !== null)
|
|
169
|
+
return `{${Object.entries(value).map(([field, item]) => `${JSON.stringify(field)}:${codeOf(item)}`).join(",")}}`;
|
|
170
|
+
return JSON.stringify(value);
|
|
171
|
+
};
|
|
172
|
+
/** Whether a schema's value is one a literal default can be: what the build reads from literal types. */
|
|
173
|
+
const isValue = (value) => value === null || typeof value === "string" || typeof value === "number" || typeof value === "boolean"
|
|
174
|
+
|| (Array.isArray(value) ? value.every(isValue) : typeof value === "object" && Object.values(value).every(isValue));
|
|
175
|
+
/** A schema's zero value: 0, false or "", each item's and field's, a union's literal that is one, or a fresh set or map. */
|
|
176
|
+
const zeroOf = (schema) => {
|
|
177
|
+
if ("const" in schema)
|
|
178
|
+
return { value: schema.const };
|
|
179
|
+
if ("anyOf" in schema) {
|
|
180
|
+
for (const member of schema.anyOf)
|
|
181
|
+
if ("const" in member && (member.const === 0 || member.const === false || member.const === ""))
|
|
182
|
+
return { value: member.const };
|
|
183
|
+
return { none: schema.anyOf.every(member => "const" in member) ? `a union of literals without 0, false or "" starts at none of them: declare \`default:\` one of them` : "a union of types starts at none of them" };
|
|
184
|
+
}
|
|
185
|
+
if ("allOf" in schema)
|
|
186
|
+
return { none: "a value of any type has no zero value" };
|
|
187
|
+
switch (schema.type) {
|
|
188
|
+
case "number":
|
|
189
|
+
case "integer": {
|
|
190
|
+
const minimum = "minimum" in schema ? schema.minimum ?? -Infinity : -Infinity;
|
|
191
|
+
const maximum = "maximum" in schema ? schema.maximum ?? Infinity : Infinity;
|
|
192
|
+
return minimum <= 0 && maximum >= 0 ? { value: 0 } : { none: "0 isn't one of its values" };
|
|
193
|
+
}
|
|
194
|
+
case "boolean": return { value: false };
|
|
195
|
+
case "string": return (schema.minLength ?? 0) === 0 ? { value: "" } : { none: `"" isn't one of its values` };
|
|
196
|
+
case "null": return { value: null };
|
|
197
|
+
case "set": return { fresh: "Set" };
|
|
198
|
+
case "map": return { fresh: "Map" };
|
|
199
|
+
case "array": {
|
|
200
|
+
const count = schema.minItems ?? 0;
|
|
201
|
+
if (count === 0)
|
|
202
|
+
return { value: [] };
|
|
203
|
+
if (schema.maxItems !== count)
|
|
204
|
+
return { none: `an array of ${count} items or more has no zero value` };
|
|
205
|
+
const item = zeroOf(schema.items);
|
|
206
|
+
return "value" in item ? { value: Array.from({ length: count }, () => item.value) } : { none: "fresh" in item ? "an item that's a set or a map has no zero value" : item.none };
|
|
207
|
+
}
|
|
208
|
+
case "object": {
|
|
209
|
+
const value = {};
|
|
210
|
+
for (const field of schema.required ?? Object.keys(schema.properties)) {
|
|
211
|
+
const property = schema.properties[field];
|
|
212
|
+
const zero = property === undefined ? { none: "it isn't a property" } : zeroOf(property);
|
|
213
|
+
if (!("value" in zero))
|
|
214
|
+
return { none: `its field ${field} starts at nothing: ${"fresh" in zero ? "a set or a map in a struct has no zero value" : zero.none}` };
|
|
215
|
+
value[field] = zero.value;
|
|
216
|
+
}
|
|
217
|
+
return { value };
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
/**
|
|
222
|
+
* What a resource reduced with `operator` starts at when it declares no start: the operator's identity, leaf by leaf,
|
|
223
|
+
* as a fold of no contributions leaves it; null for a schema of other leaves. Used only when it's one of the
|
|
224
|
+
* schema's values.
|
|
225
|
+
*/
|
|
226
|
+
const identityOf = (schema, operator) => {
|
|
227
|
+
if ("type" in schema && schema.type === "boolean")
|
|
228
|
+
return operator === "&";
|
|
229
|
+
if ("type" in schema && (schema.type === "number" || schema.type === "integer")) {
|
|
230
|
+
const minimum = "minimum" in schema ? schema.minimum : undefined;
|
|
231
|
+
const maximum = "maximum" in schema ? schema.maximum : undefined;
|
|
232
|
+
switch (operator) {
|
|
233
|
+
case "+":
|
|
234
|
+
case "|":
|
|
235
|
+
case "^": return 0;
|
|
236
|
+
case "*": return 1;
|
|
237
|
+
// Every bit of its column set: u32's all ones, else -1.
|
|
238
|
+
case "&": return minimum !== undefined && minimum >= 0 && maximum !== undefined && maximum <= 0xFFFFFFFF ? 0xFFFFFFFF : -1;
|
|
239
|
+
case "min": return maximum ?? Infinity;
|
|
240
|
+
case "max": return minimum ?? -Infinity;
|
|
241
|
+
default: return null;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
if ("type" in schema && schema.type === "array" && schema.minItems !== undefined && schema.minItems === schema.maxItems) {
|
|
245
|
+
const item = identityOf(schema.items, operator);
|
|
246
|
+
return item === null ? null : Array.from({ length: schema.minItems }, () => item);
|
|
247
|
+
}
|
|
248
|
+
if ("type" in schema && schema.type === "object") {
|
|
249
|
+
const value = {};
|
|
250
|
+
for (const [field, property] of Object.entries(schema.properties)) {
|
|
251
|
+
const leaf = identityOf(property, operator);
|
|
252
|
+
if (leaf === null)
|
|
253
|
+
return null;
|
|
254
|
+
value[field] = leaf;
|
|
255
|
+
}
|
|
256
|
+
return value;
|
|
257
|
+
}
|
|
258
|
+
return null;
|
|
259
|
+
};
|
|
260
|
+
/**
|
|
261
|
+
* Registers what each `declare module "@adobe/ecs"` block declares, so consumers never write registration: each
|
|
262
|
+
* component and resource of `Components` and `Resources`, with the schema of its `type`, its `default` and its other
|
|
263
|
+
* traits as declared, and each trait of `Traits` keyed by a symbol. A key is a top-level `Symbol()` constant of this
|
|
264
|
+
* module, so importing a key registers it: its registration comes right after it, after any binding its declaration
|
|
265
|
+
* names, and after a trait of this module it declares, wherever the block is. A literal default and the built-in
|
|
266
|
+
* traits' values are checked as far as literals and types show. A resource or derived component without a literal
|
|
267
|
+
* default starts at its type's: its namespaced schema's, null, a zero value, or a fresh `Map` or `Set` per world.
|
|
268
|
+
* Returns null when the module declares nothing.
|
|
269
|
+
*/
|
|
270
|
+
export const augmentationInsertions = async (module, host) => {
|
|
271
|
+
const { code, file } = module;
|
|
272
|
+
if (!code.includes("@adobe/ecs") || !code.includes("declare module") || isLibraryModule(host.packagePath(file), file))
|
|
273
|
+
return null;
|
|
274
|
+
const augmentations = augmentationsOf(module);
|
|
275
|
+
if (augmentations.length === 0)
|
|
276
|
+
return null;
|
|
277
|
+
const converter = createConverter(host, file);
|
|
278
|
+
const { fail } = converter;
|
|
279
|
+
const insertions = [];
|
|
280
|
+
// A name the module doesn't use for the function appended to record its declarations.
|
|
281
|
+
const record = uniqueName(code, "declare$");
|
|
282
|
+
/**
|
|
283
|
+
* Where a local binding has its value, which a registration naming it comes after: the end of the top-level
|
|
284
|
+
* statement declaring it, and 0 for a function, hoisted with its value, or anything imported.
|
|
285
|
+
*/
|
|
286
|
+
const endOfLocal = (name) => {
|
|
287
|
+
for (const statement of module.program.body) {
|
|
288
|
+
const declared = statement.type === "ExportNamedDeclaration" || statement.type === "ExportDefaultDeclaration" ? statement.declaration : statement;
|
|
289
|
+
if (declared?.type === "VariableDeclaration" && declared.declarations.some(declarator => declarator.id.type === "Identifier" && declarator.id.name === name))
|
|
290
|
+
return statement.end;
|
|
291
|
+
if ((declared?.type === "ClassDeclaration" || declared?.type === "TSEnumDeclaration") && declared.id?.name === name)
|
|
292
|
+
return statement.end;
|
|
293
|
+
}
|
|
294
|
+
return 0;
|
|
295
|
+
};
|
|
296
|
+
/** Whether an initializer is a call of the global `Symbol`. */
|
|
297
|
+
const isSymbolCall = (init) => {
|
|
298
|
+
let expression = init;
|
|
299
|
+
while (expression !== null && (expression.type === "TSAsExpression" || expression.type === "TSSatisfiesExpression" || expression.type === "ParenthesizedExpression"))
|
|
300
|
+
expression = expression.expression;
|
|
301
|
+
return expression?.type === "CallExpression" && expression.callee.type === "Identifier" && expression.callee.name === "Symbol";
|
|
302
|
+
};
|
|
303
|
+
/**
|
|
304
|
+
* Fails unless a key a block declares is a top-level `Symbol()` constant of this module, so importing the key
|
|
305
|
+
* registers it.
|
|
306
|
+
*/
|
|
307
|
+
const requireOwnKey = (name, at, what) => {
|
|
308
|
+
const imported = module.imports.get(name);
|
|
309
|
+
if (imported !== undefined)
|
|
310
|
+
fail(module, at, `${what} ${name} is imported from "${imported.source}": declare it in the module that declares the key`);
|
|
311
|
+
if (!isSymbolCall(module.constants.get(name)?.init ?? null))
|
|
312
|
+
fail(module, at, `${what} ${name} is a top-level \`Symbol()\` constant of this module`);
|
|
313
|
+
};
|
|
314
|
+
/** Fails unless a trait key a declaration names is a `Symbol()` constant, here or imported as a value. */
|
|
315
|
+
const requireTraitKey = async (name, at) => {
|
|
316
|
+
const imported = module.imports.get(name);
|
|
317
|
+
if (imported !== undefined && !imported.value)
|
|
318
|
+
fail(module, at, `a trait's key names ${name}, imported as a type only: import it as a value, which the registration passes`);
|
|
319
|
+
const found = await converter.constantNamed([name], module);
|
|
320
|
+
if (!isSymbolCall(found?.declaration.init ?? null))
|
|
321
|
+
fail(module, at, `a trait's key ${name} is a top-level \`Symbol()\` constant, of this module or one it imports`);
|
|
322
|
+
};
|
|
323
|
+
/** Whether a type, as written, allows `null`, through the aliases it names. */
|
|
324
|
+
const allowsNullType = async (type, at, seen) => {
|
|
325
|
+
if (type.type === "TSNullKeyword")
|
|
326
|
+
return true;
|
|
327
|
+
if (type.type === "TSParenthesizedType")
|
|
328
|
+
return await allowsNullType(type.typeAnnotation, at, seen);
|
|
329
|
+
if (type.type === "TSUnionType") {
|
|
330
|
+
for (const member of type.types)
|
|
331
|
+
if (await allowsNullType(member, at, seen))
|
|
332
|
+
return true;
|
|
333
|
+
return false;
|
|
334
|
+
}
|
|
335
|
+
if (type.type !== "TSTypeReference" || type.typeArguments !== null)
|
|
336
|
+
return false;
|
|
337
|
+
const found = await converter.typeNamed(typeNameParts(type.typeName), at);
|
|
338
|
+
if (found === null || typeof found === "string" || found.declaration.type !== "TSTypeAliasDeclaration" || seen.has(found.declaration))
|
|
339
|
+
return false;
|
|
340
|
+
seen.add(found.declaration);
|
|
341
|
+
return await allowsNullType(found.declaration.typeAnnotation, found.module, seen);
|
|
342
|
+
};
|
|
343
|
+
/** Whether a type, as written, is a Transferable class, or one or null, through the aliases it names. */
|
|
344
|
+
const isTransferableType = async (type, at, seen) => {
|
|
345
|
+
if (type.type === "TSParenthesizedType")
|
|
346
|
+
return await isTransferableType(type.typeAnnotation, at, seen);
|
|
347
|
+
if (type.type === "TSUnionType") {
|
|
348
|
+
const members = type.types.filter(member => member.type !== "TSNullKeyword");
|
|
349
|
+
if (members.length === 0)
|
|
350
|
+
return false;
|
|
351
|
+
for (const member of members)
|
|
352
|
+
if (!await isTransferableType(member, at, seen))
|
|
353
|
+
return false;
|
|
354
|
+
return true;
|
|
355
|
+
}
|
|
356
|
+
if (type.type !== "TSTypeReference" || type.typeArguments !== null)
|
|
357
|
+
return false;
|
|
358
|
+
const parts = typeNameParts(type.typeName);
|
|
359
|
+
const found = await converter.typeNamed(parts, at);
|
|
360
|
+
if (found === "global")
|
|
361
|
+
return parts.length === 1 && transferables.has(parts[0] ?? "");
|
|
362
|
+
if (found === null || typeof found === "string" || found.declaration.type !== "TSTypeAliasDeclaration" || seen.has(found.declaration))
|
|
363
|
+
return false;
|
|
364
|
+
seen.add(found.declaration);
|
|
365
|
+
return await isTransferableType(found.declaration.typeAnnotation, found.module, seen);
|
|
366
|
+
};
|
|
367
|
+
/** Fails for a built-in trait whose value, or whose key's type, its literal and type show can't hold. */
|
|
368
|
+
const checkBuiltIns = async (name, kind, type, schema, builtIns) => {
|
|
369
|
+
const derived = builtIns.get("derived");
|
|
370
|
+
if (derived !== undefined && derived.text !== "true")
|
|
371
|
+
fail(module, derived.node, `${name}'s derived is \`true\``);
|
|
372
|
+
if (derived !== undefined && kind !== "component")
|
|
373
|
+
fail(module, derived.node, `${name} is a resource: only a component is derived`);
|
|
374
|
+
const reference = builtIns.get("reference");
|
|
375
|
+
if (reference !== undefined && reference.text !== `"owner"` && reference.text !== `"weak"`)
|
|
376
|
+
fail(module, reference.node, `${name}'s reference is "owner" or "weak"`);
|
|
377
|
+
if (reference !== undefined && (schema === undefined || !isEntity(schema)))
|
|
378
|
+
fail(module, reference.node, `${name} is a reference, so a reference's type is Entity`);
|
|
379
|
+
const within = builtIns.get("within");
|
|
380
|
+
if (within !== undefined) {
|
|
381
|
+
const host = within.node.type === "TSTypeQuery" && within.node.exprName.type === "Identifier" ? within.node.exprName.name : null;
|
|
382
|
+
const found = host === null ? null : await converter.constantNamed([host], module);
|
|
383
|
+
if (found === null || !isSymbolCall(found.declaration.init))
|
|
384
|
+
fail(module, within.node, `${name}'s within is \`typeof\` a component's key, a \`Symbol()\` constant`);
|
|
385
|
+
}
|
|
386
|
+
const transfer = builtIns.get("transfer");
|
|
387
|
+
if (transfer !== undefined && (transfer.text !== "true" || schema !== undefined || !await isTransferableType(type, module, new Set()))) {
|
|
388
|
+
fail(module, transfer.node, `${name}'s transfer takes a Transferable class: ${[...transferables].join(", ")}`);
|
|
389
|
+
}
|
|
390
|
+
const reduce = builtIns.get("reduce");
|
|
391
|
+
if (reduce !== undefined && kind !== "resource")
|
|
392
|
+
fail(module, reduce.node, `${name} is a component: only a resource is reduced`);
|
|
393
|
+
if (reduce !== undefined && !reductionOperators.some(operator => JSON.stringify(operator) === reduce.text))
|
|
394
|
+
fail(module, reduce.node, `${name}'s reduce is one of ${reductionOperators.map(operator => `"${operator}"`).join(", ")}`);
|
|
395
|
+
const placed = builtIns.get("thread");
|
|
396
|
+
if (placed !== undefined && !/^"[^"]+"$/.test(placed.text))
|
|
397
|
+
fail(module, placed.node, `${name}'s thread is a thread's name`);
|
|
398
|
+
if (placed !== undefined && schema !== undefined && isString(schema))
|
|
399
|
+
fail(module, placed.node, `${name} is a string: a string lives in shared memory, so it has no thread`);
|
|
400
|
+
if (placed !== undefined && schema !== undefined && isStruct(schema))
|
|
401
|
+
fail(module, placed.node, `${name} is a struct: a struct lives in shared memory, so it has no thread`);
|
|
402
|
+
const shared = builtIns.get("shared");
|
|
403
|
+
if (shared !== undefined) {
|
|
404
|
+
if (shared.text !== "true")
|
|
405
|
+
fail(module, shared.node, `${name}'s shared is \`true\``);
|
|
406
|
+
if (kind !== "component")
|
|
407
|
+
fail(module, shared.node, `${name} is a resource: only a component is shared`);
|
|
408
|
+
if (schema === undefined || !isComparable(schema))
|
|
409
|
+
fail(module, shared.node, `${name} is shared, so its value is comparable data: numbers, booleans, strings, and arrays and objects of those`);
|
|
410
|
+
if (placed !== undefined)
|
|
411
|
+
fail(module, placed.node, `${name} is shared: a shared value lives in shared memory, so it has no thread`);
|
|
412
|
+
if (derived !== undefined)
|
|
413
|
+
fail(module, derived.node, `${name} is shared, so it isn't derived: its rule would add it with its default`);
|
|
414
|
+
if (reference !== undefined)
|
|
415
|
+
fail(module, reference.node, `${name} is shared, so it isn't a reference: its target despawning acts on each holder`);
|
|
416
|
+
}
|
|
417
|
+
};
|
|
418
|
+
/** An expression without the casts and parentheses around it. */
|
|
419
|
+
const unwrapped = (expression) => {
|
|
420
|
+
let inner = expression;
|
|
421
|
+
while (inner !== null && (inner.type === "TSAsExpression" || inner.type === "TSSatisfiesExpression" || inner.type === "TSNonNullExpression" || inner.type === "ParenthesizedExpression"))
|
|
422
|
+
inner = inner.expression;
|
|
423
|
+
return inner;
|
|
424
|
+
};
|
|
425
|
+
/** The names a name or a chain of non-computed property reads reads; null for any other expression. */
|
|
426
|
+
const pathOf = (expression) => {
|
|
427
|
+
if (expression.type === "Identifier")
|
|
428
|
+
return [expression.name];
|
|
429
|
+
if (expression.type !== "MemberExpression" || expression.computed || expression.property.type !== "Identifier" || expression.object.type === "Super")
|
|
430
|
+
return null;
|
|
431
|
+
const object = pathOf(expression.object);
|
|
432
|
+
return object === null ? null : [...object, expression.property.name];
|
|
433
|
+
};
|
|
434
|
+
/**
|
|
435
|
+
* The outermost assertion on an expression, under parentheses, `satisfies` and `!`: "const" for `as const`, the
|
|
436
|
+
* type of any other `as`, or null without one.
|
|
437
|
+
*/
|
|
438
|
+
const outerAssertion = (expression) => {
|
|
439
|
+
let inner = expression;
|
|
440
|
+
while (inner !== null && (inner.type === "TSSatisfiesExpression" || inner.type === "TSNonNullExpression" || inner.type === "ParenthesizedExpression"))
|
|
441
|
+
inner = inner.expression;
|
|
442
|
+
if (inner?.type !== "TSAsExpression")
|
|
443
|
+
return null;
|
|
444
|
+
const { typeAnnotation } = inner;
|
|
445
|
+
return typeAnnotation.type === "TSTypeReference" && typeAnnotation.typeName.type === "Identifier" && typeAnnotation.typeName.name === "const" ? "const" : typeAnnotation;
|
|
446
|
+
};
|
|
447
|
+
/** Whether an expression's outermost assertion is `as const`. */
|
|
448
|
+
const isConstAssertion = (expression) => outerAssertion(expression) === "const";
|
|
449
|
+
/** The `default` property's value of an object a module writes: in place, or through constants and spreads. */
|
|
450
|
+
const defaultProperty = async (expression, at, constant, seen) => {
|
|
451
|
+
const value = unwrapped(expression);
|
|
452
|
+
if (value === null || seen.has(value))
|
|
453
|
+
return null;
|
|
454
|
+
seen.add(value);
|
|
455
|
+
const inConst = constant || isConstAssertion(expression);
|
|
456
|
+
if (value.type === "Identifier" || value.type === "MemberExpression") {
|
|
457
|
+
const path = pathOf(value);
|
|
458
|
+
const found = path === null ? null : await converter.constantNamed(path, at);
|
|
459
|
+
return found === null ? null : await defaultProperty(found.declaration.init, found.module, false, seen);
|
|
460
|
+
}
|
|
461
|
+
if (value.type !== "ObjectExpression")
|
|
462
|
+
return null;
|
|
463
|
+
for (const property of value.properties) {
|
|
464
|
+
if (property.type === "SpreadElement") {
|
|
465
|
+
const found = await defaultProperty(property.argument, at, inConst, seen);
|
|
466
|
+
if (found !== null)
|
|
467
|
+
return found;
|
|
468
|
+
}
|
|
469
|
+
else if (!property.computed && property.key.type === "Identifier" && property.key.name === "default") {
|
|
470
|
+
return { expression: property.value, module: at, constant: inConst };
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
return null;
|
|
474
|
+
};
|
|
475
|
+
/** The value of a type's namespace's `default`, as `Vec3` names its namespace beside its type: a namespace's export, or a constant object's property. */
|
|
476
|
+
const defaultWritten = async (path) => {
|
|
477
|
+
const member = await converter.constantNamed([...path, "default"], module);
|
|
478
|
+
if (member !== null && member.declaration.init !== null) {
|
|
479
|
+
const annotation = member.declaration.id.type === "Identifier" ? member.declaration.id.typeAnnotation?.typeAnnotation : undefined;
|
|
480
|
+
return { expression: member.declaration.init, module: member.module, constant: false, annotation };
|
|
481
|
+
}
|
|
482
|
+
const holder = await converter.constantNamed(path, module);
|
|
483
|
+
return holder === null ? null : await defaultProperty(holder.declaration.init, holder.module, false, new Set());
|
|
484
|
+
};
|
|
485
|
+
/**
|
|
486
|
+
* Whether a type is deeply readonly as written: no array, field, map or set of it can change in place. `fields`
|
|
487
|
+
* takes an object's fields as readonly, as `Readonly<...>` makes them.
|
|
488
|
+
*/
|
|
489
|
+
const readonlyType = async (type, at, seen, fields = false) => {
|
|
490
|
+
switch (type.type) {
|
|
491
|
+
case "TSNumberKeyword":
|
|
492
|
+
case "TSStringKeyword":
|
|
493
|
+
case "TSBooleanKeyword":
|
|
494
|
+
case "TSBigIntKeyword":
|
|
495
|
+
case "TSNullKeyword":
|
|
496
|
+
case "TSUndefinedKeyword":
|
|
497
|
+
case "TSLiteralType": return true;
|
|
498
|
+
case "TSParenthesizedType": return await readonlyType(type.typeAnnotation, at, seen);
|
|
499
|
+
case "TSUnionType": return (await Promise.all(type.types.map(member => readonlyType(member, at, seen)))).every(Boolean);
|
|
500
|
+
case "TSTypeOperator": {
|
|
501
|
+
if (type.operator !== "readonly")
|
|
502
|
+
return false;
|
|
503
|
+
const inner = type.typeAnnotation.type === "TSParenthesizedType" ? type.typeAnnotation.typeAnnotation : type.typeAnnotation;
|
|
504
|
+
if (inner.type === "TSArrayType")
|
|
505
|
+
return await readonlyType(inner.elementType, at, seen);
|
|
506
|
+
if (inner.type === "TSTupleType") {
|
|
507
|
+
return (await Promise.all(inner.elementTypes.map(element => element.type === "TSOptionalType" || element.type === "TSRestType" || element.type === "TSNamedTupleMember" ? false : readonlyType(element, at, seen)))).every(Boolean);
|
|
508
|
+
}
|
|
509
|
+
return false;
|
|
510
|
+
}
|
|
511
|
+
case "TSTypeLiteral": {
|
|
512
|
+
for (const member of type.members) {
|
|
513
|
+
if (member.type !== "TSPropertySignature" || (member.readonly !== true && !fields) || member.typeAnnotation === null || !await readonlyType(member.typeAnnotation.typeAnnotation, at, seen))
|
|
514
|
+
return false;
|
|
515
|
+
}
|
|
516
|
+
return true;
|
|
517
|
+
}
|
|
518
|
+
case "TSTypeReference": {
|
|
519
|
+
const parts = typeNameParts(type.typeName);
|
|
520
|
+
const parameters = type.typeArguments?.params ?? [];
|
|
521
|
+
const [only] = parts;
|
|
522
|
+
if (parts.length === 1 && only !== undefined && !at.types.has(only) && !at.imports.has(only) && (only === "ReadonlyMap" || only === "ReadonlySet" || only === "ReadonlyArray")) {
|
|
523
|
+
return (await Promise.all(parameters.map(parameter => readonlyType(parameter, at, seen)))).every(Boolean);
|
|
524
|
+
}
|
|
525
|
+
const [argument] = parameters;
|
|
526
|
+
if (parts.length === 1 && only === "Readonly" && !at.types.has(only) && !at.imports.has(only) && argument !== undefined)
|
|
527
|
+
return await readonlyType(argument, at, seen, true);
|
|
528
|
+
const found = await converter.typeNamed(parts, at);
|
|
529
|
+
if (found === null || typeof found === "string" || seen.has(found.declaration))
|
|
530
|
+
return false;
|
|
531
|
+
// A type a schema names, as the package's math types are, is a readonly value.
|
|
532
|
+
if (host.packagePath(found.module.file) === "interface/schema/schema" && found.declaration.id?.name === "Type")
|
|
533
|
+
return true;
|
|
534
|
+
if (host.packagePath(found.module.file) === "interface/entity/entity" && found.declaration.id?.name === "Entity")
|
|
535
|
+
return true;
|
|
536
|
+
seen.add(found.declaration);
|
|
537
|
+
if (found.declaration.type === "TSTypeAliasDeclaration")
|
|
538
|
+
return found.declaration.typeParameters === null && await readonlyType(found.declaration.typeAnnotation, found.module, seen, fields);
|
|
539
|
+
if (found.declaration.type !== "TSInterfaceDeclaration" || found.declaration.extends.length > 0)
|
|
540
|
+
return false;
|
|
541
|
+
for (const member of found.declaration.body.body) {
|
|
542
|
+
if (member.type !== "TSPropertySignature" || (member.readonly !== true && !fields) || member.typeAnnotation === null || !await readonlyType(member.typeAnnotation.typeAnnotation, found.module, seen))
|
|
543
|
+
return false;
|
|
544
|
+
}
|
|
545
|
+
return true;
|
|
546
|
+
}
|
|
547
|
+
default: return false;
|
|
548
|
+
}
|
|
549
|
+
};
|
|
550
|
+
/** The source text of a part of a module, for failures. */
|
|
551
|
+
const textOf = (at, expression) => at.code.slice(expression.start, expression.end);
|
|
552
|
+
/**
|
|
553
|
+
* Where a value a module writes isn't deeply readonly by its type, or null when it is: a literal, `as const` data, a
|
|
554
|
+
* binding typed readonly, or a call of a function whose declared return type is readonly.
|
|
555
|
+
*/
|
|
556
|
+
const unreadonly = async (written, seen) => {
|
|
557
|
+
const { module: at, annotation, expression } = written;
|
|
558
|
+
const failing = (why) => ({ module: at, expression, why: `\`${textOf(at, expression)}\` ${why}` });
|
|
559
|
+
if (annotation !== undefined)
|
|
560
|
+
return await readonlyType(annotation, at, seen) ? null : failing("is typed with a type that isn't readonly");
|
|
561
|
+
// A cast to a type is that type, whatever `as const` around it says.
|
|
562
|
+
const assertion = outerAssertion(expression);
|
|
563
|
+
if (assertion !== null && assertion !== "const")
|
|
564
|
+
return await readonlyType(assertion, at, seen) ? null : failing("is cast to a type that isn't readonly");
|
|
565
|
+
const constant = written.constant || assertion === "const";
|
|
566
|
+
const value = unwrapped(expression);
|
|
567
|
+
if (value === null || seen.has(value))
|
|
568
|
+
return failing("isn't a value the build can read");
|
|
569
|
+
seen.add(value);
|
|
570
|
+
const each = async (items) => {
|
|
571
|
+
for (const item of items) {
|
|
572
|
+
const found = await unreadonly(item, seen);
|
|
573
|
+
if (found !== null)
|
|
574
|
+
return found;
|
|
575
|
+
}
|
|
576
|
+
return null;
|
|
577
|
+
};
|
|
578
|
+
switch (value.type) {
|
|
579
|
+
case "Literal": return null;
|
|
580
|
+
case "TemplateLiteral": return value.expressions.length === 0 ? null : failing("isn't a literal");
|
|
581
|
+
case "UnaryExpression":
|
|
582
|
+
return value.operator === "-" && (value.argument.type === "Literal" || (value.argument.type === "Identifier" && (value.argument.name === "Infinity" || value.argument.name === "NaN"))) ? null : failing("isn't a literal");
|
|
583
|
+
case "ArrayExpression": {
|
|
584
|
+
if (!constant)
|
|
585
|
+
return failing("isn't under `as const`");
|
|
586
|
+
const items = [];
|
|
587
|
+
for (const element of value.elements) {
|
|
588
|
+
if (element === null || element.type === "SpreadElement")
|
|
589
|
+
return failing("spreads or skips items, which the build can't see are readonly");
|
|
590
|
+
items.push({ expression: element, module: at, constant });
|
|
591
|
+
}
|
|
592
|
+
return await each(items);
|
|
593
|
+
}
|
|
594
|
+
case "ObjectExpression": {
|
|
595
|
+
if (!constant)
|
|
596
|
+
return failing("isn't under `as const`");
|
|
597
|
+
const fields = [];
|
|
598
|
+
for (const property of value.properties) {
|
|
599
|
+
if (property.type === "SpreadElement" || property.computed)
|
|
600
|
+
return failing("spreads or computes a field, which the build can't see is readonly");
|
|
601
|
+
fields.push({ expression: property.value, module: at, constant });
|
|
602
|
+
}
|
|
603
|
+
return await each(fields);
|
|
604
|
+
}
|
|
605
|
+
case "CallExpression": {
|
|
606
|
+
const path = value.callee.type === "Super" ? null : pathOf(value.callee);
|
|
607
|
+
const returned = path === null ? null : await converter.returnTypeNamed(path, at);
|
|
608
|
+
if (returned === null)
|
|
609
|
+
return failing("calls a function the build can't find");
|
|
610
|
+
if (returned === undefined)
|
|
611
|
+
return failing("returns a type the build can't see is readonly: annotate its return type");
|
|
612
|
+
return await readonlyType(returned.type, returned.module, seen) ? null : failing("returns a type that isn't readonly");
|
|
613
|
+
}
|
|
614
|
+
case "Identifier":
|
|
615
|
+
case "MemberExpression": {
|
|
616
|
+
if (value.type === "Identifier" && (value.name === "Infinity" || value.name === "NaN" || value.name === "undefined"))
|
|
617
|
+
return null;
|
|
618
|
+
const path = pathOf(value);
|
|
619
|
+
const found = path === null ? null : await converter.constantNamed(path, at);
|
|
620
|
+
if (found === null || found.declaration.init === null)
|
|
621
|
+
return failing("names a value the build can't read");
|
|
622
|
+
const declared = found.declaration.id.type === "Identifier" ? found.declaration.id.typeAnnotation?.typeAnnotation : undefined;
|
|
623
|
+
return await unreadonly({ expression: found.declaration.init, module: found.module, constant: false, annotation: declared }, seen);
|
|
624
|
+
}
|
|
625
|
+
default: return failing("isn't a literal, `as const` data, a constant typed readonly or a call returning a readonly type");
|
|
626
|
+
}
|
|
627
|
+
};
|
|
628
|
+
/** The value a module writes, when it's data the build reads: literals, and arrays and objects of them, through constants; else undefined. */
|
|
629
|
+
const staticValue = async (written, seen) => {
|
|
630
|
+
const value = unwrapped(written.expression);
|
|
631
|
+
if (value === null || seen.has(value))
|
|
632
|
+
return undefined;
|
|
633
|
+
seen.add(value);
|
|
634
|
+
const at = written.module;
|
|
635
|
+
switch (value.type) {
|
|
636
|
+
case "Literal": return typeof value.value === "string" || typeof value.value === "number" || typeof value.value === "boolean" || value.value === null ? value.value : undefined;
|
|
637
|
+
case "UnaryExpression":
|
|
638
|
+
if (value.operator !== "-")
|
|
639
|
+
return undefined;
|
|
640
|
+
if (value.argument.type === "Identifier" && (value.argument.name === "Infinity" || value.argument.name === "NaN"))
|
|
641
|
+
return -(value.argument.name === "Infinity" ? Infinity : NaN);
|
|
642
|
+
return value.argument.type === "Literal" && typeof value.argument.value === "number" ? -value.argument.value : undefined;
|
|
643
|
+
case "ArrayExpression": {
|
|
644
|
+
const items = [];
|
|
645
|
+
for (const element of value.elements) {
|
|
646
|
+
const item = element === null || element.type === "SpreadElement" ? undefined : await staticValue({ expression: element, module: at, constant: written.constant }, seen);
|
|
647
|
+
if (item === undefined)
|
|
648
|
+
return undefined;
|
|
649
|
+
items.push(item);
|
|
650
|
+
}
|
|
651
|
+
return items;
|
|
652
|
+
}
|
|
653
|
+
case "ObjectExpression": {
|
|
654
|
+
const fields = {};
|
|
655
|
+
for (const property of value.properties) {
|
|
656
|
+
if (property.type === "SpreadElement" || property.computed || property.key.type !== "Identifier")
|
|
657
|
+
return undefined;
|
|
658
|
+
const field = await staticValue({ expression: property.value, module: at, constant: written.constant }, seen);
|
|
659
|
+
if (field === undefined)
|
|
660
|
+
return undefined;
|
|
661
|
+
fields[property.key.name] = field;
|
|
662
|
+
}
|
|
663
|
+
return fields;
|
|
664
|
+
}
|
|
665
|
+
case "Identifier":
|
|
666
|
+
case "MemberExpression": {
|
|
667
|
+
if (value.type === "Identifier" && (value.name === "Infinity" || value.name === "NaN"))
|
|
668
|
+
return value.name === "Infinity" ? Infinity : NaN;
|
|
669
|
+
const path = pathOf(value);
|
|
670
|
+
const found = path === null ? null : await converter.constantNamed(path, at);
|
|
671
|
+
return found === null || found.declaration.init === null ? undefined : await staticValue({ expression: found.declaration.init, module: found.module, constant: false }, seen);
|
|
672
|
+
}
|
|
673
|
+
default: return undefined;
|
|
674
|
+
}
|
|
675
|
+
};
|
|
676
|
+
/**
|
|
677
|
+
* A declaration's type's namespace's default, `T.default`, as code reading it, and the local binding it reads; null
|
|
678
|
+
* without one. Checked against `schema` when the build can read it. `oneObject` is for a start a joined thread
|
|
679
|
+
* knows by identity, which is read, never copied.
|
|
680
|
+
*/
|
|
681
|
+
const namespacedDefault = async (type, name, schema, oneObject) => {
|
|
682
|
+
const inner = type.type === "TSParenthesizedType" ? type.typeAnnotation : type;
|
|
683
|
+
if (inner.type !== "TSTypeReference" || inner.typeArguments !== null)
|
|
684
|
+
return null;
|
|
685
|
+
const path = typeNameParts(inner.typeName);
|
|
686
|
+
const [first] = path;
|
|
687
|
+
const written = first === undefined ? null : await defaultWritten(path);
|
|
688
|
+
if (first === undefined || written === null)
|
|
689
|
+
return null;
|
|
690
|
+
// The package's own types' defaults are their zero values and identities, which a reduction's identity outranks.
|
|
691
|
+
const packaged = host.packagePath(written.module.file) !== null;
|
|
692
|
+
const mutable = await unreadonly(written, new Set());
|
|
693
|
+
if (mutable !== null) {
|
|
694
|
+
fail(mutable.module, mutable.expression, `${path.join(".")}.default is shared by every row and world that starts from it, so it's deeply readonly, but ${mutable.why}. Readonly values are \`const ${path.at(-1) ?? "T"} = { default: ... } as const\`, consts typed readonly (ReadonlyMap, ReadonlySet, Readonly<...>, readonly arrays and fields), and calls of functions whose declared return type is readonly`);
|
|
695
|
+
}
|
|
696
|
+
const value = await staticValue(written, new Set());
|
|
697
|
+
if (schema !== undefined && value !== undefined && !matchesSchema(schema, value))
|
|
698
|
+
fail(written.module, written.expression, `${path.join(".")}.default, ${codeOf(value)}, isn't one of its type's values`);
|
|
699
|
+
const imported = module.imports.get(first);
|
|
700
|
+
if (imported !== undefined && !imported.value) {
|
|
701
|
+
// Imported as a type alone, the namespace can't be read here, so a default the build can read is written in.
|
|
702
|
+
if (value === undefined || (oneObject && typeof value === "object" && value !== null)) {
|
|
703
|
+
fail(module, inner, `${name}'s type ${path.join(".")} starts at ${path.join(".")}.default${oneObject ? ", one object a joined thread knows by identity" : ""}: import ${first} as a value, which the registration reads`);
|
|
704
|
+
}
|
|
705
|
+
return { text: codeOf(value ?? null), value: value ?? null, packaged };
|
|
706
|
+
}
|
|
707
|
+
return { text: `${path.join(".")}.default`, local: imported === undefined ? first : undefined, packaged };
|
|
708
|
+
};
|
|
709
|
+
/**
|
|
710
|
+
* What a value of `type`, of `schema`, starts at as code: its namespace's default of yours; else for a reduction by
|
|
711
|
+
* `operator`, its identity when that's one of its values; else the package's namespace's; else each field of a
|
|
712
|
+
* struct and item of a tuple by these rules; else its zero value, as `zeroOf` says.
|
|
713
|
+
*/
|
|
714
|
+
const startOf = async (type, schema, operator, oneObject) => {
|
|
715
|
+
const unwrapped = type.type === "TSParenthesizedType" ? type.typeAnnotation : type;
|
|
716
|
+
const inner = unwrapped.type === "TSTypeOperator" && unwrapped.operator === "readonly" && unwrapped.typeAnnotation !== undefined ? unwrapped.typeAnnotation : unwrapped;
|
|
717
|
+
const namespaced = await namespacedDefault(inner, "it", schema, oneObject);
|
|
718
|
+
const named = namespaced === null ? null : { text: namespaced.text, value: namespaced.value, locals: namespaced.local === undefined ? [] : [namespaced.local], given: true };
|
|
719
|
+
if (named !== null && namespaced !== null && !namespaced.packaged)
|
|
720
|
+
return named;
|
|
721
|
+
const parts = inner.type === "TSTypeLiteral" && "type" in schema && schema.type === "object"
|
|
722
|
+
? inner.members.flatMap(field => field.type === "TSPropertySignature" && !field.computed && field.key.type === "Identifier" && field.typeAnnotation !== null
|
|
723
|
+
? [{ name: field.key.name, type: field.typeAnnotation.typeAnnotation, schema: schema.properties[field.key.name] }] : [])
|
|
724
|
+
: inner.type === "TSTupleType" && "type" in schema && schema.type === "array"
|
|
725
|
+
? inner.elementTypes.flatMap((element, k) => element.type === "TSOptionalType" || element.type === "TSRestType" || element.type === "TSNamedTupleMember" ? [] : [{ name: String(k), type: element, schema: schema.items }])
|
|
726
|
+
: null;
|
|
727
|
+
if (parts === null || parts.length === 0) {
|
|
728
|
+
const identity = operator === null ? null : identityOf(schema, operator);
|
|
729
|
+
if (identity !== null && matchesSchema(schema, identity))
|
|
730
|
+
return { text: codeOf(identity), value: identity, locals: [], given: true };
|
|
731
|
+
if (named !== null)
|
|
732
|
+
return named;
|
|
733
|
+
const zero = zeroOf(schema);
|
|
734
|
+
return "value" in zero ? { text: codeOf(zero.value), value: zero.value, locals: [], given: false } : zero;
|
|
735
|
+
}
|
|
736
|
+
const texts = [];
|
|
737
|
+
const locals = [];
|
|
738
|
+
const values = [];
|
|
739
|
+
const fields = {};
|
|
740
|
+
let given = false;
|
|
741
|
+
let data = true;
|
|
742
|
+
for (const part of parts) {
|
|
743
|
+
const started = part.schema === undefined ? { none: "it isn't a property" } : await startOf(part.type, part.schema, operator, false);
|
|
744
|
+
if (!("text" in started))
|
|
745
|
+
return { none: `its ${inner.type === "TSTupleType" ? "item" : "field"} ${part.name} starts at nothing: ${"fresh" in started ? "a set or a map in a struct has no zero value" : started.none}` };
|
|
746
|
+
texts.push(inner.type === "TSTupleType" ? started.text : `${JSON.stringify(part.name)}: ${started.text}`);
|
|
747
|
+
locals.push(...started.locals);
|
|
748
|
+
given ||= started.given;
|
|
749
|
+
if (started.value === undefined)
|
|
750
|
+
data = false;
|
|
751
|
+
else {
|
|
752
|
+
values.push(started.value);
|
|
753
|
+
fields[part.name] = started.value;
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
// With zero values alone, the schema's zero value says the same, as data.
|
|
757
|
+
if (!given) {
|
|
758
|
+
const zero = zeroOf(schema);
|
|
759
|
+
if ("value" in zero)
|
|
760
|
+
return { text: codeOf(zero.value), value: zero.value, locals, given };
|
|
761
|
+
}
|
|
762
|
+
if (data) {
|
|
763
|
+
const value = inner.type === "TSTupleType" ? values : fields;
|
|
764
|
+
return { text: codeOf(value), value, locals, given };
|
|
765
|
+
}
|
|
766
|
+
return { text: inner.type === "TSTupleType" ? `[${texts.join(", ")}]` : `{ ${texts.join(", ")} }`, locals, given };
|
|
767
|
+
};
|
|
768
|
+
/** A declared default: a literal type, never `typeof` a value. */
|
|
769
|
+
const literalDefault = async (type, name) => {
|
|
770
|
+
if (type.type === "TSTypeQuery")
|
|
771
|
+
fail(module, type, `${name}'s default is a literal type, never \`typeof\` a value: without one, it starts at its type's namespace's \`default\`, its reduction's identity, null, or its type's zero value`);
|
|
772
|
+
return await converter.valueOfType(type, module, new Set());
|
|
773
|
+
};
|
|
774
|
+
/** How to give a type's values a start no zero value gives: a literal, or its type's namespace's `default`. */
|
|
775
|
+
const workaround = (type) => {
|
|
776
|
+
const name = type.type === "TSTypeReference" && type.typeArguments === null ? typeNameParts(type.typeName).join(".") : null;
|
|
777
|
+
return name === null
|
|
778
|
+
? "declare `default:` as a literal, or name its type and give the type a namespace with a `default`: `type Start = ...; const Start = { default: ... }`"
|
|
779
|
+
: `declare \`default:\` as a literal, or give ${name} a namespace with a \`default\`: \`const ${name} = { default: ... }\``;
|
|
780
|
+
};
|
|
781
|
+
/** Where a trait a block of this module declares is registered, which what declares it comes after. */
|
|
782
|
+
const traitPoints = new Map();
|
|
783
|
+
/** A trait's value as code: a literal, or `typeof` a value, which names it; and that value's local binding. */
|
|
784
|
+
const valueText = async (type, what) => {
|
|
785
|
+
if (type.type === "TSTypeQuery") {
|
|
786
|
+
const named = type.exprName.type === "TSImportType" ? null : qualifiedParts(type.exprName);
|
|
787
|
+
const [first] = named ?? [];
|
|
788
|
+
if (named === null || first === undefined || type.typeArguments !== null)
|
|
789
|
+
return fail(module, type, `${what} is a literal type, or \`typeof\` a value`);
|
|
790
|
+
const imported = module.imports.get(first);
|
|
791
|
+
if (imported !== undefined && !imported.value)
|
|
792
|
+
fail(module, type, `${what} names ${first}, imported as a type only: import it as a value, which the registration passes`);
|
|
793
|
+
return { text: named.join("."), local: imported === undefined ? first : undefined };
|
|
794
|
+
}
|
|
795
|
+
const value = await converter.valueOfType(type, module, new Set());
|
|
796
|
+
return { text: codeOf(value), value };
|
|
797
|
+
};
|
|
798
|
+
try {
|
|
799
|
+
const shadowed = ["globalThis", "Symbol", "Map"].find(name => bindsAtTopLevel(module.program, name));
|
|
800
|
+
const first = augmentations[0];
|
|
801
|
+
if (shadowed !== undefined && first !== undefined)
|
|
802
|
+
fail(module, first.block, `the module binds ${shadowed}, which the code recording its declarations uses`);
|
|
803
|
+
// Traits first, so a component declaring one registers after it.
|
|
804
|
+
const ordered = augmentations.flatMap(({ block, interfaces }) => interfaces.map(declared => ({ block, declared })))
|
|
805
|
+
.sort((a, b) => Number(b.declared.id.name === "Traits") - Number(a.declared.id.name === "Traits"));
|
|
806
|
+
for (const { declared } of ordered) {
|
|
807
|
+
const interfaceName = declared.id.name;
|
|
808
|
+
if (!isKind(interfaceName))
|
|
809
|
+
continue;
|
|
810
|
+
const kind = kinds[interfaceName];
|
|
811
|
+
for (const member of declared.body.body) {
|
|
812
|
+
if (member.type !== "TSPropertySignature") {
|
|
813
|
+
if (member.type === "TSIndexSignature" || member.type === "TSMethodSignature")
|
|
814
|
+
fail(module, member, `${interfaceName}'s members are keys and their declarations`);
|
|
815
|
+
continue;
|
|
816
|
+
}
|
|
817
|
+
const { key } = member;
|
|
818
|
+
if (kind === "trait") {
|
|
819
|
+
// String-named traits are the package's own.
|
|
820
|
+
if (!member.computed || key.type !== "Identifier")
|
|
821
|
+
return fail(module, member, "a trait of your own is keyed by a `Symbol()` constant: `[layer]: ...`");
|
|
822
|
+
requireOwnKey(key.name, member, "a trait's key");
|
|
823
|
+
const point = endOfLocal(key.name);
|
|
824
|
+
traitPoints.set(key.name, point);
|
|
825
|
+
insertions.push({ at: point, text: `\n${record}(${key.name}, "trait");` });
|
|
826
|
+
continue;
|
|
827
|
+
}
|
|
828
|
+
if (!member.computed || key.type !== "Identifier")
|
|
829
|
+
return fail(module, member, `a ${kind}'s key is a \`Symbol()\` constant, declared as \`[key]: { type: ... }\``);
|
|
830
|
+
requireOwnKey(key.name, member, `a ${kind}'s key`);
|
|
831
|
+
const declaration = member.typeAnnotation?.typeAnnotation;
|
|
832
|
+
if (declaration?.type !== "TSTypeLiteral")
|
|
833
|
+
return fail(module, member, `${key.name}'s declaration is a type literal of its traits: \`{ type: ... }\``);
|
|
834
|
+
converter.site.at = member.start;
|
|
835
|
+
let at = endOfLocal(key.name);
|
|
836
|
+
let typeNode;
|
|
837
|
+
let defaultNode;
|
|
838
|
+
const traits = [];
|
|
839
|
+
let thread = false;
|
|
840
|
+
/** The built-in traits declared, by name: their values' types and code. */
|
|
841
|
+
const builtIns = new Map();
|
|
842
|
+
for (const trait of declaration.members) {
|
|
843
|
+
if (trait.type !== "TSPropertySignature" || trait.typeAnnotation === null)
|
|
844
|
+
return fail(module, trait, `${key.name}'s traits are properties with values`);
|
|
845
|
+
const property = trait;
|
|
846
|
+
const value = trait.typeAnnotation.typeAnnotation;
|
|
847
|
+
const name = !property.computed && property.key.type === "Identifier" ? property.key.name
|
|
848
|
+
: property.computed && property.key.type === "Identifier" ? null
|
|
849
|
+
: fail(module, trait, `${key.name}'s traits are named, or keyed by a trait's \`Symbol()\` constant`);
|
|
850
|
+
if (name === "type")
|
|
851
|
+
typeNode = value;
|
|
852
|
+
else if (name === "default")
|
|
853
|
+
defaultNode = value;
|
|
854
|
+
else {
|
|
855
|
+
const text = await valueText(value, `${key.name}'s trait`);
|
|
856
|
+
if (text.local !== undefined)
|
|
857
|
+
at = Math.max(at, endOfLocal(text.local));
|
|
858
|
+
if (name === "thread")
|
|
859
|
+
thread = true;
|
|
860
|
+
if (name !== null)
|
|
861
|
+
builtIns.set(name, { node: value, text: text.text });
|
|
862
|
+
if (name === null && property.key.type === "Identifier") {
|
|
863
|
+
await requireTraitKey(property.key.name, trait);
|
|
864
|
+
at = Math.max(at, endOfLocal(property.key.name), traitPoints.get(property.key.name) ?? 0);
|
|
865
|
+
}
|
|
866
|
+
traits.push(name === null ? `[${property.key.type === "Identifier" ? property.key.name : ""}]: ${text.text}` : `${name}: ${text.text}`);
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
if (typeNode === undefined)
|
|
870
|
+
return fail(module, member, `${key.name} declares its type: \`{ type: ... }\``);
|
|
871
|
+
let schema;
|
|
872
|
+
try {
|
|
873
|
+
schema = await converter.convert(typeNode, module, new Set(), "declaration");
|
|
874
|
+
}
|
|
875
|
+
catch (error) {
|
|
876
|
+
if (!isNotData(error))
|
|
877
|
+
throw error;
|
|
878
|
+
if (error.notData.node && !thread)
|
|
879
|
+
fail(module, member, `${key.name} is a DOM Node, which lives on "main": declare \`thread: "main"\``);
|
|
880
|
+
}
|
|
881
|
+
await checkBuiltIns(key.name, kind, typeNode, schema, builtIns);
|
|
882
|
+
const given = defaultNode === undefined ? undefined : await literalDefault(defaultNode, key.name);
|
|
883
|
+
if (schema !== undefined && given !== undefined && !matchesSchema(schema, given))
|
|
884
|
+
fail(module, defaultNode ?? member, `${key.name}'s default isn't of its declared type`);
|
|
885
|
+
let start = given === undefined ? undefined : codeOf(given);
|
|
886
|
+
let fresh = null;
|
|
887
|
+
// Without a literal, only resources and derived components need a start of their own, and a component
|
|
888
|
+
// holding an object, whose start a joined thread knows by identity.
|
|
889
|
+
const needed = kind === "resource" || builtIns.has("derived");
|
|
890
|
+
const oneObject = kind === "component" && (schema === undefined || !isStruct(schema));
|
|
891
|
+
const reduced = builtIns.get("reduce");
|
|
892
|
+
const operator = kind === "resource" && reduced !== undefined ? JSON.parse(reduced.text) : null;
|
|
893
|
+
const read = (found) => {
|
|
894
|
+
start = found.text;
|
|
895
|
+
for (const local of found.locals)
|
|
896
|
+
at = Math.max(at, endOfLocal(local));
|
|
897
|
+
};
|
|
898
|
+
if (given === undefined && (needed || oneObject)) {
|
|
899
|
+
if (schema === undefined) {
|
|
900
|
+
const namespaced = await namespacedDefault(typeNode, key.name, undefined, oneObject);
|
|
901
|
+
if (namespaced !== null)
|
|
902
|
+
read({ text: namespaced.text, locals: namespaced.local === undefined ? [] : [namespaced.local], given: true });
|
|
903
|
+
else if (needed && !await allowsNullType(typeNode, module, new Set())) {
|
|
904
|
+
fail(module, member, `${kind} ${key.name} holds a value that isn't data, so nothing gives it a start: let its type allow null, or give its type a namespace with a deeply readonly \`default\`; a ReadonlyMap or ReadonlySet starts fresh in each world, a Map or Set doesn't`);
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
else {
|
|
908
|
+
const found = await startOf(typeNode, schema, operator, oneObject);
|
|
909
|
+
if ("text" in found && found.given)
|
|
910
|
+
read(found);
|
|
911
|
+
// Else it starts at null, as the world reads a value with neither, when its type allows it.
|
|
912
|
+
else if (needed && !allowsNullSchema(schema)) {
|
|
913
|
+
if ("fresh" in found)
|
|
914
|
+
fresh = found.fresh;
|
|
915
|
+
else if ("none" in found)
|
|
916
|
+
fail(module, member, `${kind} ${key.name} starts at no value its type gives, since ${found.none}; ${workaround(typeNode)}`);
|
|
917
|
+
// A constant is the one value it can start at, which the world reads from its schema.
|
|
918
|
+
else if (!("const" in schema))
|
|
919
|
+
read(found);
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
const parts = schema === undefined ? [] : [`type: ${codeOf(schema)}`];
|
|
924
|
+
if (start !== undefined)
|
|
925
|
+
parts.push(`default: ${start}`);
|
|
926
|
+
parts.push(...traits);
|
|
927
|
+
if (fresh !== null)
|
|
928
|
+
parts.push(`fresh: "${fresh}"`);
|
|
929
|
+
insertions.push({ at, text: `\n${record}(${key.name}, "${kind}", ${parts.length === 0 ? "{}" : `{ ${parts.join(", ")} }`});` });
|
|
930
|
+
}
|
|
931
|
+
}
|
|
932
|
+
}
|
|
933
|
+
catch (error) {
|
|
934
|
+
if (isThrown(error))
|
|
935
|
+
return { failure: error.typeFailure, dependencies: [...converter.read] };
|
|
936
|
+
throw error;
|
|
937
|
+
}
|
|
938
|
+
if (insertions.length === 0)
|
|
939
|
+
return null;
|
|
940
|
+
insertions.push({ at: code.length, text: `\nfunction ${record}(key, kind, declaration) { (globalThis[Symbol.for(${JSON.stringify(declarationsName)})] ??= new Map()).set(key, { kind, declaration }); }\n` });
|
|
941
|
+
return { insertions, dependencies: [...converter.read] };
|
|
942
|
+
};
|
|
943
|
+
//# sourceMappingURL=augmentations.js.map
|