@forgeax/engine-app 0.1.2
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/LICENSE +202 -0
- package/README.md +418 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/__tests__/animation-asset-lookup.unit.test.d.ts +2 -0
- package/dist/__tests__/animation-asset-lookup.unit.test.d.ts.map +1 -0
- package/dist/__tests__/app-rebuild.test.d.ts +2 -0
- package/dist/__tests__/app-rebuild.test.d.ts.map +1 -0
- package/dist/__tests__/asset-registry-types.test-d.d.ts +2 -0
- package/dist/__tests__/asset-registry-types.test-d.d.ts.map +1 -0
- package/dist/__tests__/assets-runtime-assembly.integration.test.d.ts +2 -0
- package/dist/__tests__/assets-runtime-assembly.integration.test.d.ts.map +1 -0
- package/dist/__tests__/callback-deletion.unit.test.d.ts +2 -0
- package/dist/__tests__/callback-deletion.unit.test.d.ts.map +1 -0
- package/dist/__tests__/callback-inference.test-d.d.ts +2 -0
- package/dist/__tests__/callback-inference.test-d.d.ts.map +1 -0
- package/dist/__tests__/component-introspection.unit.test.d.ts +2 -0
- package/dist/__tests__/component-introspection.unit.test.d.ts.map +1 -0
- package/dist/__tests__/consumer-migration.unit.test.d.ts +2 -0
- package/dist/__tests__/consumer-migration.unit.test.d.ts.map +1 -0
- package/dist/__tests__/create-app-features.test.d.ts +2 -0
- package/dist/__tests__/create-app-features.test.d.ts.map +1 -0
- package/dist/__tests__/create-app-listener-sync.test.d.ts +2 -0
- package/dist/__tests__/create-app-listener-sync.test.d.ts.map +1 -0
- package/dist/__tests__/create-app-lock-provider.test.d.ts +2 -0
- package/dist/__tests__/create-app-lock-provider.test.d.ts.map +1 -0
- package/dist/__tests__/create-app-plugin.test.d.ts +2 -0
- package/dist/__tests__/create-app-plugin.test.d.ts.map +1 -0
- package/dist/__tests__/create-app-stop.test.d.ts +2 -0
- package/dist/__tests__/create-app-stop.test.d.ts.map +1 -0
- package/dist/__tests__/create-app-time.unit.test.d.ts +2 -0
- package/dist/__tests__/create-app-time.unit.test.d.ts.map +1 -0
- package/dist/__tests__/create-app.test-d.d.ts +2 -0
- package/dist/__tests__/create-app.test-d.d.ts.map +1 -0
- package/dist/__tests__/create-app.test.d.ts +2 -0
- package/dist/__tests__/create-app.test.d.ts.map +1 -0
- package/dist/__tests__/create-renderer-error.integration.test.d.ts +2 -0
- package/dist/__tests__/create-renderer-error.integration.test.d.ts.map +1 -0
- package/dist/__tests__/create-renderer-lifecycle.integration.test.d.ts +2 -0
- package/dist/__tests__/create-renderer-lifecycle.integration.test.d.ts.map +1 -0
- package/dist/__tests__/docs-gate-green.unit.test.d.ts +2 -0
- package/dist/__tests__/docs-gate-green.unit.test.d.ts.map +1 -0
- package/dist/__tests__/draw-source-headless-full-chain.test.d.ts +2 -0
- package/dist/__tests__/draw-source-headless-full-chain.test.d.ts.map +1 -0
- package/dist/__tests__/draw-source-injected-world-update-visibility.test.d.ts +2 -0
- package/dist/__tests__/draw-source-injected-world-update-visibility.test.d.ts.map +1 -0
- package/dist/__tests__/draw-source-single-world-regression.test.d.ts +2 -0
- package/dist/__tests__/draw-source-single-world-regression.test.d.ts.map +1 -0
- package/dist/__tests__/ecs-import.unit.test.d.ts +2 -0
- package/dist/__tests__/ecs-import.unit.test.d.ts.map +1 -0
- package/dist/__tests__/engine-worker-bootstrap-channel.unit.test.d.ts +2 -0
- package/dist/__tests__/engine-worker-bootstrap-channel.unit.test.d.ts.map +1 -0
- package/dist/__tests__/engine-worker-world-swap.unit.test.d.ts +2 -0
- package/dist/__tests__/engine-worker-world-swap.unit.test.d.ts.map +1 -0
- package/dist/__tests__/errors-pointer-lock-failed.test.d.ts +2 -0
- package/dist/__tests__/errors-pointer-lock-failed.test.d.ts.map +1 -0
- package/dist/__tests__/execution-bootstrap-isolation.unit.test.d.ts +2 -0
- package/dist/__tests__/execution-bootstrap-isolation.unit.test.d.ts.map +1 -0
- package/dist/__tests__/execution-error-detail.test-d.d.ts +2 -0
- package/dist/__tests__/execution-error-detail.test-d.d.ts.map +1 -0
- package/dist/__tests__/execution-error-detail.unit.test.d.ts +2 -0
- package/dist/__tests__/execution-error-detail.unit.test.d.ts.map +1 -0
- package/dist/__tests__/execution-frame-order.unit.test.d.ts +2 -0
- package/dist/__tests__/execution-frame-order.unit.test.d.ts.map +1 -0
- package/dist/__tests__/execution-frame-protocol.unit.test.d.ts +2 -0
- package/dist/__tests__/execution-frame-protocol.unit.test.d.ts.map +1 -0
- package/dist/__tests__/execution-input-sample.contract.test.d.ts +2 -0
- package/dist/__tests__/execution-input-sample.contract.test.d.ts.map +1 -0
- package/dist/__tests__/execution-measurement.unit.test.d.ts +2 -0
- package/dist/__tests__/execution-measurement.unit.test.d.ts.map +1 -0
- package/dist/__tests__/execution-public-api.test-d.d.ts +2 -0
- package/dist/__tests__/execution-public-api.test-d.d.ts.map +1 -0
- package/dist/__tests__/execution-public-api.unit.test.d.ts +2 -0
- package/dist/__tests__/execution-public-api.unit.test.d.ts.map +1 -0
- package/dist/__tests__/execution-rebuild.contract.test.d.ts +2 -0
- package/dist/__tests__/execution-rebuild.contract.test.d.ts.map +1 -0
- package/dist/__tests__/execution-report.contract.test.d.ts +2 -0
- package/dist/__tests__/execution-report.contract.test.d.ts.map +1 -0
- package/dist/__tests__/execution-report.types.test-d.d.ts +2 -0
- package/dist/__tests__/execution-report.types.test-d.d.ts.map +1 -0
- package/dist/__tests__/execution-schema-freshness.unit.test.d.ts +2 -0
- package/dist/__tests__/execution-schema-freshness.unit.test.d.ts.map +1 -0
- package/dist/__tests__/execution-selector.unit.test.d.ts +2 -0
- package/dist/__tests__/execution-selector.unit.test.d.ts.map +1 -0
- package/dist/__tests__/execution-shared-kernel.unit.test.d.ts +2 -0
- package/dist/__tests__/execution-shared-kernel.unit.test.d.ts.map +1 -0
- package/dist/__tests__/execution-world-health-owner.test-d.d.ts +2 -0
- package/dist/__tests__/execution-world-health-owner.test-d.d.ts.map +1 -0
- package/dist/__tests__/fallback-camera.unit.test.d.ts +2 -0
- package/dist/__tests__/fallback-camera.unit.test.d.ts.map +1 -0
- package/dist/__tests__/frame-loop-time-elapsed.test.d.ts +2 -0
- package/dist/__tests__/frame-loop-time-elapsed.test.d.ts.map +1 -0
- package/dist/__tests__/frame-loop-time.unit.test.d.ts +2 -0
- package/dist/__tests__/frame-loop-time.unit.test.d.ts.map +1 -0
- package/dist/__tests__/frame-loop-world-array.test.d.ts +2 -0
- package/dist/__tests__/frame-loop-world-array.test.d.ts.map +1 -0
- package/dist/__tests__/kernel-worker-runtime.unit.test.d.ts +2 -0
- package/dist/__tests__/kernel-worker-runtime.unit.test.d.ts.map +1 -0
- package/dist/__tests__/migration-surface-inventory.unit.test.d.ts +2 -0
- package/dist/__tests__/migration-surface-inventory.unit.test.d.ts.map +1 -0
- package/dist/__tests__/plugin-policy.integration.test.d.ts +2 -0
- package/dist/__tests__/plugin-policy.integration.test.d.ts.map +1 -0
- package/dist/__tests__/plugin-profiles.unit.test.d.ts +2 -0
- package/dist/__tests__/plugin-profiles.unit.test.d.ts.map +1 -0
- package/dist/__tests__/profiler-default-off.test.d.ts +2 -0
- package/dist/__tests__/profiler-default-off.test.d.ts.map +1 -0
- package/dist/__tests__/profiler-frame-token.test.d.ts +2 -0
- package/dist/__tests__/profiler-frame-token.test.d.ts.map +1 -0
- package/dist/__tests__/profiler-phase-catalog.test.d.ts +2 -0
- package/dist/__tests__/profiler-phase-catalog.test.d.ts.map +1 -0
- package/dist/__tests__/profiler-phase-integration.test.d.ts +2 -0
- package/dist/__tests__/profiler-phase-integration.test.d.ts.map +1 -0
- package/dist/__tests__/profiler-remote-bridge.test.d.ts +2 -0
- package/dist/__tests__/profiler-remote-bridge.test.d.ts.map +1 -0
- package/dist/__tests__/remote-integration.test.d.ts +2 -0
- package/dist/__tests__/remote-integration.test.d.ts.map +1 -0
- package/dist/__tests__/remote-serve-flag.test.d.ts +2 -0
- package/dist/__tests__/remote-serve-flag.test.d.ts.map +1 -0
- package/dist/__tests__/rhi-capture-capability.test-d.d.ts +2 -0
- package/dist/__tests__/rhi-capture-capability.test-d.d.ts.map +1 -0
- package/dist/__tests__/rhi-capture-host.integration.test.d.ts +2 -0
- package/dist/__tests__/rhi-capture-host.integration.test.d.ts.map +1 -0
- package/dist/__tests__/rhi-capture.browser.test.d.ts +2 -0
- package/dist/__tests__/rhi-capture.browser.test.d.ts.map +1 -0
- package/dist/__tests__/surface-handoff.test.d.ts +2 -0
- package/dist/__tests__/surface-handoff.test.d.ts.map +1 -0
- package/dist/__tests__/types-m2.test-d.d.ts +2 -0
- package/dist/__tests__/types-m2.test-d.d.ts.map +1 -0
- package/dist/__tests__/visibility-remote.integration.test.d.ts +2 -0
- package/dist/__tests__/visibility-remote.integration.test.d.ts.map +1 -0
- package/dist/__tests__/worker-execution-stop.test.d.ts +2 -0
- package/dist/__tests__/worker-execution-stop.test.d.ts.map +1 -0
- package/dist/animation-asset-lookup.d.ts +8 -0
- package/dist/animation-asset-lookup.d.ts.map +1 -0
- package/dist/assets-runtime-assembly.d.ts +19 -0
- package/dist/assets-runtime-assembly.d.ts.map +1 -0
- package/dist/canvas-policy.d.ts +4 -0
- package/dist/canvas-policy.d.ts.map +1 -0
- package/dist/create-app.d.ts +57 -0
- package/dist/create-app.d.ts.map +1 -0
- package/dist/engine-worker-runtime.mjs +884 -0
- package/dist/engine-worker-runtime.mjs.map +1 -0
- package/dist/errors.d.ts +263 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/execution/attached-world-swap.d.ts +21 -0
- package/dist/execution/attached-world-swap.d.ts.map +1 -0
- package/dist/execution/bootstrap-entry.d.ts +30 -0
- package/dist/execution/bootstrap-entry.d.ts.map +1 -0
- package/dist/execution/capabilities.d.ts +5 -0
- package/dist/execution/capabilities.d.ts.map +1 -0
- package/dist/execution/control.d.ts +14 -0
- package/dist/execution/control.d.ts.map +1 -0
- package/dist/execution/engine-worker-runtime.d.ts +2 -0
- package/dist/execution/engine-worker-runtime.d.ts.map +1 -0
- package/dist/execution/engine-worker.d.ts +23 -0
- package/dist/execution/engine-worker.d.ts.map +1 -0
- package/dist/execution/host-controller.d.ts +16 -0
- package/dist/execution/host-controller.d.ts.map +1 -0
- package/dist/execution/index.d.ts +10 -0
- package/dist/execution/index.d.ts.map +1 -0
- package/dist/execution/kernel-pool.d.ts +14 -0
- package/dist/execution/kernel-pool.d.ts.map +1 -0
- package/dist/execution/kernel-worker-runtime.d.ts +2 -0
- package/dist/execution/kernel-worker-runtime.d.ts.map +1 -0
- package/dist/execution/measurement.d.ts +7 -0
- package/dist/execution/measurement.d.ts.map +1 -0
- package/dist/execution/protocol.d.ts +84 -0
- package/dist/execution/protocol.d.ts.map +1 -0
- package/dist/execution/report.d.ts +5 -0
- package/dist/execution/report.d.ts.map +1 -0
- package/dist/execution/schema.d.ts +4 -0
- package/dist/execution/schema.d.ts.map +1 -0
- package/dist/execution/selector.d.ts +10 -0
- package/dist/execution/selector.d.ts.map +1 -0
- package/dist/execution/types.d.ts +107 -0
- package/dist/execution/types.d.ts.map +1 -0
- package/dist/fallback-camera.d.ts +8 -0
- package/dist/fallback-camera.d.ts.map +1 -0
- package/dist/game-context.d.ts +98 -0
- package/dist/game-context.d.ts.map +1 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.mjs +3985 -0
- package/dist/index.mjs.map +1 -0
- package/dist/input-map-plugin.d.ts +5 -0
- package/dist/input-map-plugin.d.ts.map +1 -0
- package/dist/input-plugin.d.ts +4 -0
- package/dist/input-plugin.d.ts.map +1 -0
- package/dist/internal/assembled-engine-profile.d.ts +5 -0
- package/dist/internal/assembled-engine-profile.d.ts.map +1 -0
- package/dist/internal/assets-world-plugin.d.ts +21 -0
- package/dist/internal/assets-world-plugin.d.ts.map +1 -0
- package/dist/internal/browser-remote-bridge.d.ts +25 -0
- package/dist/internal/browser-remote-bridge.d.ts.map +1 -0
- package/dist/internal/browser-rhi-debug-runtime.d.ts +18 -0
- package/dist/internal/browser-rhi-debug-runtime.d.ts.map +1 -0
- package/dist/internal/component-introspection.d.ts +24 -0
- package/dist/internal/component-introspection.d.ts.map +1 -0
- package/dist/internal/ecs-import.d.ts +6 -0
- package/dist/internal/ecs-import.d.ts.map +1 -0
- package/dist/internal/engine-profile-common.d.ts +9 -0
- package/dist/internal/engine-profile-common.d.ts.map +1 -0
- package/dist/internal/error-fanout.d.ts +66 -0
- package/dist/internal/error-fanout.d.ts.map +1 -0
- package/dist/internal/frame-loop.d.ts +35 -0
- package/dist/internal/frame-loop.d.ts.map +1 -0
- package/dist/internal/input-attach.d.ts +44 -0
- package/dist/internal/input-attach.d.ts.map +1 -0
- package/dist/internal/main-engine-profile.d.ts +15 -0
- package/dist/internal/main-engine-profile.d.ts.map +1 -0
- package/dist/internal/remote-serve-flag.d.ts +23 -0
- package/dist/internal/remote-serve-flag.d.ts.map +1 -0
- package/dist/internal/remote-server-plugin.d.ts +8 -0
- package/dist/internal/remote-server-plugin.d.ts.map +1 -0
- package/dist/internal/rhi-capture.d.ts +19 -0
- package/dist/internal/rhi-capture.d.ts.map +1 -0
- package/dist/internal/rhi-debug-flag.d.ts +18 -0
- package/dist/internal/rhi-debug-flag.d.ts.map +1 -0
- package/dist/internal/worker-engine-profile.d.ts +13 -0
- package/dist/internal/worker-engine-profile.d.ts.map +1 -0
- package/dist/kernel-worker-runtime.mjs +69 -0
- package/dist/kernel-worker-runtime.mjs.map +1 -0
- package/dist/load-game-errors.d.ts +131 -0
- package/dist/load-game-errors.d.ts.map +1 -0
- package/dist/load-game.d.ts +34 -0
- package/dist/load-game.d.ts.map +1 -0
- package/dist/plugin-factories.d.ts +3 -0
- package/dist/plugin-factories.d.ts.map +1 -0
- package/dist/tool-preview/bootstrap.d.ts +113 -0
- package/dist/tool-preview/bootstrap.d.ts.map +1 -0
- package/dist/tool-preview/evidence.d.ts +20 -0
- package/dist/tool-preview/evidence.d.ts.map +1 -0
- package/dist/tool-preview/framing.d.ts +13 -0
- package/dist/tool-preview/framing.d.ts.map +1 -0
- package/dist/tool-preview/recipe.d.ts +54 -0
- package/dist/tool-preview/recipe.d.ts.map +1 -0
- package/dist/types.d.ts +444 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +86 -0
- package/schema/execution-report.schema.json +168 -0
- package/src/__tests__/animation-asset-lookup.unit.test.ts +20 -0
- package/src/__tests__/app-rebuild.test.ts +31 -0
- package/src/__tests__/asset-registry-types.test-d.ts +16 -0
- package/src/__tests__/assets-runtime-assembly.integration.test.ts +68 -0
- package/src/__tests__/callback-deletion.unit.test.ts +14 -0
- package/src/__tests__/callback-inference.test-d.ts +32 -0
- package/src/__tests__/component-introspection.unit.test.ts +56 -0
- package/src/__tests__/consumer-migration.unit.test.ts +21 -0
- package/src/__tests__/create-app-features.test.ts +40 -0
- package/src/__tests__/create-app-listener-sync.test.ts +377 -0
- package/src/__tests__/create-app-lock-provider.test.ts +212 -0
- package/src/__tests__/create-app-plugin.test.ts +217 -0
- package/src/__tests__/create-app-stop.test.ts +617 -0
- package/src/__tests__/create-app-time.unit.test.ts +26 -0
- package/src/__tests__/create-app.test-d.ts +82 -0
- package/src/__tests__/create-app.test.ts +346 -0
- package/src/__tests__/create-renderer-error.integration.test.ts +24 -0
- package/src/__tests__/create-renderer-lifecycle.integration.test.ts +19 -0
- package/src/__tests__/docs-gate-green.unit.test.ts +61 -0
- package/src/__tests__/draw-source-headless-full-chain.test.ts +226 -0
- package/src/__tests__/draw-source-injected-world-update-visibility.test.ts +182 -0
- package/src/__tests__/draw-source-single-world-regression.test.ts +185 -0
- package/src/__tests__/ecs-import.unit.test.ts +40 -0
- package/src/__tests__/engine-worker-bootstrap-channel.unit.test.ts +74 -0
- package/src/__tests__/engine-worker-world-swap.unit.test.ts +76 -0
- package/src/__tests__/errors-pointer-lock-failed.test.ts +268 -0
- package/src/__tests__/execution-bootstrap-isolation.unit.test.ts +80 -0
- package/src/__tests__/execution-error-detail.test-d.ts +13 -0
- package/src/__tests__/execution-error-detail.unit.test.ts +35 -0
- package/src/__tests__/execution-frame-order.unit.test.ts +38 -0
- package/src/__tests__/execution-frame-protocol.unit.test.ts +61 -0
- package/src/__tests__/execution-input-sample.contract.test.ts +23 -0
- package/src/__tests__/execution-measurement.unit.test.ts +20 -0
- package/src/__tests__/execution-public-api.test-d.ts +10 -0
- package/src/__tests__/execution-public-api.unit.test.ts +9 -0
- package/src/__tests__/execution-rebuild.contract.test.ts +36 -0
- package/src/__tests__/execution-report.contract.test.ts +50 -0
- package/src/__tests__/execution-report.types.test-d.ts +16 -0
- package/src/__tests__/execution-schema-freshness.unit.test.ts +20 -0
- package/src/__tests__/execution-selector.unit.test.ts +72 -0
- package/src/__tests__/execution-shared-kernel.unit.test.ts +180 -0
- package/src/__tests__/execution-world-health-owner.test-d.ts +9 -0
- package/src/__tests__/fallback-camera.unit.test.ts +32 -0
- package/src/__tests__/frame-loop-time-elapsed.test.ts +115 -0
- package/src/__tests__/frame-loop-time.unit.test.ts +61 -0
- package/src/__tests__/frame-loop-world-array.test.ts +441 -0
- package/src/__tests__/kernel-worker-runtime.unit.test.ts +50 -0
- package/src/__tests__/migration-surface-inventory.unit.test.ts +13 -0
- package/src/__tests__/plugin-policy.integration.test.ts +15 -0
- package/src/__tests__/plugin-profiles.unit.test.ts +190 -0
- package/src/__tests__/profiler-default-off.test.ts +53 -0
- package/src/__tests__/profiler-frame-token.test.ts +248 -0
- package/src/__tests__/profiler-phase-catalog.test.ts +30 -0
- package/src/__tests__/profiler-phase-integration.test.ts +129 -0
- package/src/__tests__/profiler-remote-bridge.test.ts +31 -0
- package/src/__tests__/remote-integration.test.ts +224 -0
- package/src/__tests__/remote-serve-flag.test.ts +24 -0
- package/src/__tests__/rhi-capture-capability.test-d.ts +22 -0
- package/src/__tests__/rhi-capture-host.integration.test.ts +157 -0
- package/src/__tests__/rhi-capture.browser.test.ts +51 -0
- package/src/__tests__/surface-handoff.test.ts +92 -0
- package/src/__tests__/types-m2.test-d.ts +81 -0
- package/src/__tests__/visibility-remote.integration.test.ts +119 -0
- package/src/__tests__/worker-execution-stop.test.ts +116 -0
- package/src/animation-asset-lookup.ts +13 -0
- package/src/assets-runtime-assembly.ts +70 -0
- package/src/canvas-policy.ts +16 -0
- package/src/create-app.ts +1351 -0
- package/src/errors.ts +454 -0
- package/src/execution/attached-world-swap.ts +67 -0
- package/src/execution/bootstrap-entry.ts +122 -0
- package/src/execution/capabilities.ts +102 -0
- package/src/execution/control.ts +52 -0
- package/src/execution/engine-worker-runtime.ts +400 -0
- package/src/execution/engine-worker.ts +161 -0
- package/src/execution/host-controller.ts +454 -0
- package/src/execution/index.ts +43 -0
- package/src/execution/kernel-pool.ts +236 -0
- package/src/execution/kernel-worker-runtime.ts +103 -0
- package/src/execution/measurement.ts +39 -0
- package/src/execution/protocol.ts +131 -0
- package/src/execution/report.ts +66 -0
- package/src/execution/schema.ts +168 -0
- package/src/execution/selector.ts +98 -0
- package/src/execution/types.ts +146 -0
- package/src/fallback-camera.ts +20 -0
- package/src/game-context.ts +126 -0
- package/src/index.ts +176 -0
- package/src/input-map-plugin.ts +21 -0
- package/src/input-plugin.ts +26 -0
- package/src/internal/assembled-engine-profile.ts +22 -0
- package/src/internal/assets-world-plugin.ts +79 -0
- package/src/internal/browser-remote-bridge.ts +267 -0
- package/src/internal/browser-rhi-debug-runtime.ts +67 -0
- package/src/internal/component-introspection.ts +116 -0
- package/src/internal/ecs-import.ts +41 -0
- package/src/internal/engine-profile-common.ts +10 -0
- package/src/internal/error-fanout.ts +129 -0
- package/src/internal/frame-loop.ts +525 -0
- package/src/internal/input-attach.ts +104 -0
- package/src/internal/main-engine-profile.ts +80 -0
- package/src/internal/remote-serve-flag.ts +50 -0
- package/src/internal/remote-server-plugin.ts +16 -0
- package/src/internal/rhi-capture.ts +211 -0
- package/src/internal/rhi-debug-flag.ts +40 -0
- package/src/internal/worker-engine-profile.ts +47 -0
- package/src/load-game-errors.ts +211 -0
- package/src/load-game.ts +115 -0
- package/src/plugin-factories.ts +2 -0
- package/src/tool-preview/bootstrap.ts +848 -0
- package/src/tool-preview/evidence.ts +59 -0
- package/src/tool-preview/framing.ts +52 -0
- package/src/tool-preview/recipe.ts +137 -0
- package/src/types.ts +505 -0
- package/src/vite-env.d.ts +12 -0
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://forgeax.dev/schema/execution-report.schema.json",
|
|
4
|
+
"title": "ForgeaX ExecutionReport",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": [
|
|
8
|
+
"schemaVersion",
|
|
9
|
+
"requestedTier",
|
|
10
|
+
"actualTier",
|
|
11
|
+
"selectionReason",
|
|
12
|
+
"sharedEvidencePassed",
|
|
13
|
+
"capabilities",
|
|
14
|
+
"engine",
|
|
15
|
+
"world",
|
|
16
|
+
"kernelDispatch",
|
|
17
|
+
"performance",
|
|
18
|
+
"audio",
|
|
19
|
+
"fault"
|
|
20
|
+
],
|
|
21
|
+
"properties": {
|
|
22
|
+
"schemaVersion": { "const": 1 },
|
|
23
|
+
"requestedTier": { "enum": ["auto", "main-serial", "engine-worker", "shared"] },
|
|
24
|
+
"actualTier": { "enum": [null, "main-serial", "engine-worker", "shared"] },
|
|
25
|
+
"selectionReason": {
|
|
26
|
+
"enum": [null, "explicit-request", "auto-shared", "auto-engine-worker", "auto-main-serial"]
|
|
27
|
+
},
|
|
28
|
+
"sharedEvidencePassed": { "type": "boolean" },
|
|
29
|
+
"capabilities": {
|
|
30
|
+
"type": "object",
|
|
31
|
+
"additionalProperties": false,
|
|
32
|
+
"required": [
|
|
33
|
+
"worker",
|
|
34
|
+
"offscreenCanvas",
|
|
35
|
+
"workerAnimationFrame",
|
|
36
|
+
"workerWebGpu",
|
|
37
|
+
"crossOriginIsolated",
|
|
38
|
+
"sharedArrayBuffer",
|
|
39
|
+
"atomicsWait"
|
|
40
|
+
],
|
|
41
|
+
"properties": {
|
|
42
|
+
"worker": { "$ref": "#/$defs/capability" },
|
|
43
|
+
"offscreenCanvas": { "$ref": "#/$defs/capability" },
|
|
44
|
+
"workerAnimationFrame": { "$ref": "#/$defs/capability" },
|
|
45
|
+
"workerWebGpu": { "$ref": "#/$defs/capability" },
|
|
46
|
+
"crossOriginIsolated": { "$ref": "#/$defs/capability" },
|
|
47
|
+
"sharedArrayBuffer": { "$ref": "#/$defs/capability" },
|
|
48
|
+
"atomicsWait": { "$ref": "#/$defs/capability" }
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"engine": {
|
|
52
|
+
"type": "object",
|
|
53
|
+
"additionalProperties": false,
|
|
54
|
+
"required": ["realm", "health"],
|
|
55
|
+
"properties": {
|
|
56
|
+
"realm": { "enum": ["host", "worker"] },
|
|
57
|
+
"health": { "enum": ["idle", "starting", "running", "stopped", "faulted"] }
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
"world": {
|
|
61
|
+
"type": "object",
|
|
62
|
+
"additionalProperties": false,
|
|
63
|
+
"required": ["identity", "health", "partialWrite", "retryable"],
|
|
64
|
+
"properties": {
|
|
65
|
+
"identity": { "type": ["string", "null"] },
|
|
66
|
+
"health": { "enum": ["healthy", "poisoned"] },
|
|
67
|
+
"partialWrite": { "type": "boolean" },
|
|
68
|
+
"retryable": { "type": "boolean" }
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"kernelDispatch": {
|
|
72
|
+
"type": "object",
|
|
73
|
+
"additionalProperties": false,
|
|
74
|
+
"required": ["eligible", "usedShared", "reason", "dispatched", "completed"],
|
|
75
|
+
"properties": {
|
|
76
|
+
"eligible": { "type": "boolean" },
|
|
77
|
+
"usedShared": { "type": "boolean" },
|
|
78
|
+
"reason": {
|
|
79
|
+
"enum": ["no-eligible-kernel", "zero-work", "small-span", "forced-inline", "shared", "poisoned"]
|
|
80
|
+
},
|
|
81
|
+
"dispatched": { "type": "integer", "minimum": 0 },
|
|
82
|
+
"completed": { "type": "integer", "minimum": 0 }
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
"performance": {
|
|
86
|
+
"type": "object",
|
|
87
|
+
"additionalProperties": false,
|
|
88
|
+
"required": ["hostFrameMs", "engineUpdateMs", "kernelWaitMs", "hostAudioMs"],
|
|
89
|
+
"properties": {
|
|
90
|
+
"hostFrameMs": { "$ref": "#/$defs/nullableMeasurement" },
|
|
91
|
+
"engineUpdateMs": { "$ref": "#/$defs/nullableMeasurement" },
|
|
92
|
+
"kernelWaitMs": { "$ref": "#/$defs/nullableMeasurement" },
|
|
93
|
+
"hostAudioMs": { "$ref": "#/$defs/nullableMeasurement" }
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
"audio": {
|
|
97
|
+
"type": "object",
|
|
98
|
+
"additionalProperties": false,
|
|
99
|
+
"required": ["owner", "contextState", "activeSourceCount", "lastError"],
|
|
100
|
+
"properties": {
|
|
101
|
+
"owner": { "const": "host" },
|
|
102
|
+
"contextState": { "enum": ["running", "suspended", "closed"] },
|
|
103
|
+
"activeSourceCount": { "type": "integer", "minimum": 0 },
|
|
104
|
+
"lastError": {
|
|
105
|
+
"oneOf": [
|
|
106
|
+
{ "type": "null" },
|
|
107
|
+
{
|
|
108
|
+
"type": "object",
|
|
109
|
+
"additionalProperties": false,
|
|
110
|
+
"required": ["code", "expected", "hint", "detail"],
|
|
111
|
+
"properties": {
|
|
112
|
+
"code": { "type": "string", "minLength": 1 },
|
|
113
|
+
"expected": { "type": "string", "minLength": 1 },
|
|
114
|
+
"hint": { "type": "string", "minLength": 1 },
|
|
115
|
+
"detail": {}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
]
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
"fault": {
|
|
123
|
+
"oneOf": [
|
|
124
|
+
{ "type": "null" },
|
|
125
|
+
{
|
|
126
|
+
"type": "object",
|
|
127
|
+
"additionalProperties": false,
|
|
128
|
+
"required": ["source", "code", "expected", "hint", "detail", "partialWrite", "retryable"],
|
|
129
|
+
"properties": {
|
|
130
|
+
"source": { "enum": ["bootstrap", "handshake", "runtime", "kernel", "world", "rebuild"] },
|
|
131
|
+
"code": { "type": "string", "minLength": 1 },
|
|
132
|
+
"expected": { "type": "string", "minLength": 1 },
|
|
133
|
+
"hint": { "type": "string", "minLength": 1 },
|
|
134
|
+
"detail": {},
|
|
135
|
+
"partialWrite": { "type": "boolean" },
|
|
136
|
+
"retryable": { "type": "boolean" }
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
]
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
"$defs": {
|
|
143
|
+
"capability": {
|
|
144
|
+
"type": "object",
|
|
145
|
+
"additionalProperties": false,
|
|
146
|
+
"required": ["available", "reason"],
|
|
147
|
+
"properties": {
|
|
148
|
+
"available": { "type": "boolean" },
|
|
149
|
+
"reason": { "type": "string" }
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
"measurement": {
|
|
153
|
+
"type": "object",
|
|
154
|
+
"additionalProperties": false,
|
|
155
|
+
"required": ["samples", "p50", "p95", "p99", "jitter"],
|
|
156
|
+
"properties": {
|
|
157
|
+
"samples": { "type": "integer", "minimum": 1 },
|
|
158
|
+
"p50": { "type": "number", "minimum": 0 },
|
|
159
|
+
"p95": { "type": "number", "minimum": 0 },
|
|
160
|
+
"p99": { "type": "number", "minimum": 0 },
|
|
161
|
+
"jitter": { "type": "number", "minimum": 0 }
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
"nullableMeasurement": {
|
|
165
|
+
"oneOf": [{ "type": "null" }, { "$ref": "#/$defs/measurement" }]
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { createAnimationPayloadLookup } from '../animation-asset-lookup';
|
|
3
|
+
|
|
4
|
+
describe('createAnimationPayloadLookup', () => {
|
|
5
|
+
it('projects the renderer catalogue lookup into the animation callback', () => {
|
|
6
|
+
const clip = { kind: 'animation-clip' as const, duration: 2, channels: [] };
|
|
7
|
+
const lookup = createAnimationPayloadLookup({
|
|
8
|
+
lookup<T>(guid: string): T | undefined {
|
|
9
|
+
return (guid === 'clip-guid' ? clip : undefined) as T | undefined;
|
|
10
|
+
},
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
expect(lookup('clip-guid')).toBe(clip);
|
|
14
|
+
expect(lookup('missing')).toBeUndefined();
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it('fails closed before a renderer catalogue exists', () => {
|
|
18
|
+
expect(createAnimationPayloadLookup(undefined)('clip-guid')).toBeUndefined();
|
|
19
|
+
});
|
|
20
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { disposeWithOrderedDetail, RebuildLifecycleError } from '../execution/attached-world-swap';
|
|
3
|
+
|
|
4
|
+
describe('M4 app rebuild lifecycle', () => {
|
|
5
|
+
it('retains primary failure while recording both cleanup failures in order', async () => {
|
|
6
|
+
const cleanup: { phase: 'candidate' | 'previous'; cause: unknown }[] = [];
|
|
7
|
+
const primary = new Error('system throw');
|
|
8
|
+
await disposeWithOrderedDetail(
|
|
9
|
+
'candidate',
|
|
10
|
+
() => {
|
|
11
|
+
throw new Error('candidate cleanup');
|
|
12
|
+
},
|
|
13
|
+
cleanup,
|
|
14
|
+
);
|
|
15
|
+
await disposeWithOrderedDetail(
|
|
16
|
+
'previous',
|
|
17
|
+
() => {
|
|
18
|
+
throw new Error('previous cleanup');
|
|
19
|
+
},
|
|
20
|
+
cleanup,
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
const failure = new RebuildLifecycleError(primary, cleanup);
|
|
24
|
+
expect(failure.primary).toBe(primary);
|
|
25
|
+
expect(failure.cleanup.map((entry) => entry.phase)).toEqual(['candidate', 'previous']);
|
|
26
|
+
expect(failure.cleanup.map((entry) => (entry.cause as Error).message)).toEqual([
|
|
27
|
+
'candidate cleanup',
|
|
28
|
+
'previous cleanup',
|
|
29
|
+
]);
|
|
30
|
+
});
|
|
31
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { AssetRegistry } from '@forgeax/engine-assets-runtime';
|
|
2
|
+
import type { EngineContextServices } from '@forgeax/engine-plugin';
|
|
3
|
+
import type { RenderAssetPort } from '@forgeax/engine-render';
|
|
4
|
+
import { describe, expectTypeOf, it } from 'vitest';
|
|
5
|
+
import type { App, GameHost } from '../index';
|
|
6
|
+
|
|
7
|
+
describe('app asset ownership types', () => {
|
|
8
|
+
it('keeps the GameHost loader registry distinct from the App render projection', () => {
|
|
9
|
+
expectTypeOf<GameHost['assets']>().toEqualTypeOf<AssetRegistry>();
|
|
10
|
+
expectTypeOf<App['assets']>().toEqualTypeOf<AssetRegistry>();
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it('augments the engine service with the Renderer-owned port', () => {
|
|
14
|
+
expectTypeOf<EngineContextServices['assets']>().toEqualTypeOf<RenderAssetPort | undefined>();
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createAssetRegistry,
|
|
3
|
+
createCatalogSource,
|
|
4
|
+
defineAssetKind,
|
|
5
|
+
} from '@forgeax/engine-assets-runtime';
|
|
6
|
+
import { ok } from '@forgeax/engine-types';
|
|
7
|
+
import { describe, expect, it } from 'vitest';
|
|
8
|
+
import { assembleAssetRuntime } from '../assets-runtime-assembly';
|
|
9
|
+
|
|
10
|
+
const kind = defineAssetKind<unknown, 'host-blob'>('host-blob');
|
|
11
|
+
|
|
12
|
+
describe('App asset runtime assembly', () => {
|
|
13
|
+
it('installs the one default owner contribution for each durable built-in kind', () => {
|
|
14
|
+
const registry = createAssetRegistry({ catalog: createCatalogSource({ entries: [] }) });
|
|
15
|
+
const assembled = assembleAssetRuntime(registry, []);
|
|
16
|
+
|
|
17
|
+
expect(assembled.ok).toBe(true);
|
|
18
|
+
if (!assembled.ok) return;
|
|
19
|
+
expect(assembled.value.leases.map((lease) => lease.kind)).toEqual([
|
|
20
|
+
'mesh',
|
|
21
|
+
'material',
|
|
22
|
+
'scene',
|
|
23
|
+
'texture',
|
|
24
|
+
'equirect',
|
|
25
|
+
'sampler',
|
|
26
|
+
'font',
|
|
27
|
+
'render-pipeline',
|
|
28
|
+
'tileset',
|
|
29
|
+
'video',
|
|
30
|
+
'skeleton',
|
|
31
|
+
'skin',
|
|
32
|
+
'animation-clip',
|
|
33
|
+
'animation-graph',
|
|
34
|
+
'audio',
|
|
35
|
+
'particle-effect',
|
|
36
|
+
]);
|
|
37
|
+
assembled.value.dispose();
|
|
38
|
+
registry.dispose();
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it('installs one owner lease and releases it idempotently', () => {
|
|
42
|
+
const registry = createAssetRegistry({ catalog: createCatalogSource({ entries: [] }) });
|
|
43
|
+
const assembled = assembleAssetRuntime(registry, [
|
|
44
|
+
{ kind, consumer: 'test-owner', decoder: { decode: async () => ok('value') } },
|
|
45
|
+
]);
|
|
46
|
+
|
|
47
|
+
expect(assembled.ok).toBe(true);
|
|
48
|
+
if (!assembled.ok) return;
|
|
49
|
+
expect(assembled.value.leases).toHaveLength(17);
|
|
50
|
+
expect(assembled.value.leases.at(-1)?.kind).toBe('host-blob');
|
|
51
|
+
assembled.value.dispose();
|
|
52
|
+
assembled.value.dispose();
|
|
53
|
+
registry.dispose();
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it('returns a closed assembly error for duplicate owner kinds', () => {
|
|
57
|
+
const registry = createAssetRegistry({ catalog: createCatalogSource({ entries: [] }) });
|
|
58
|
+
const contribution = {
|
|
59
|
+
kind,
|
|
60
|
+
consumer: 'test-owner',
|
|
61
|
+
decoder: { decode: async () => ok('value') },
|
|
62
|
+
};
|
|
63
|
+
const assembled = assembleAssetRuntime(registry, [contribution, contribution]);
|
|
64
|
+
|
|
65
|
+
expect(assembled).toMatchObject({ ok: false, error: { code: 'asset-assembly-failed' } });
|
|
66
|
+
registry.dispose();
|
|
67
|
+
});
|
|
68
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { describe, expectTypeOf, it } from 'vitest';
|
|
2
|
+
import type { GameHost } from '../game-context';
|
|
3
|
+
import type { App, AppAssembleArgs, CreateAppOptions } from '../types';
|
|
4
|
+
|
|
5
|
+
describe('app callback and phantom surface deletion', () => {
|
|
6
|
+
it('omits callbacks and phantom scheduling fields from public app contracts', () => {
|
|
7
|
+
expectTypeOf<App>().not.toHaveProperty('registerUpdate');
|
|
8
|
+
expectTypeOf<GameHost>().not.toHaveProperty('registerUpdate');
|
|
9
|
+
expectTypeOf<AppAssembleArgs>().not.toHaveProperty('schedule');
|
|
10
|
+
expectTypeOf<AppAssembleArgs>().not.toHaveProperty('maxDt');
|
|
11
|
+
expectTypeOf<CreateAppOptions>().not.toHaveProperty('schedule');
|
|
12
|
+
expectTypeOf<CreateAppOptions>().not.toHaveProperty('maxDt');
|
|
13
|
+
});
|
|
14
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { animationPlugin } from '@forgeax/engine-animation';
|
|
2
|
+
import { World } from '@forgeax/engine-ecs';
|
|
3
|
+
import type { Plugin } from '@forgeax/engine-plugin';
|
|
4
|
+
import { Camera, perspective, type Renderer } from '@forgeax/engine-render';
|
|
5
|
+
import { createRenderer } from '@forgeax/engine-runtime';
|
|
6
|
+
import { createApp } from '../create-app';
|
|
7
|
+
|
|
8
|
+
const plugin: Plugin = animationPlugin();
|
|
9
|
+
void plugin;
|
|
10
|
+
|
|
11
|
+
declare const canvas: HTMLCanvasElement;
|
|
12
|
+
declare const renderer: Renderer;
|
|
13
|
+
|
|
14
|
+
const world = new World();
|
|
15
|
+
const cameraEntity = world
|
|
16
|
+
.spawn({ component: Camera, data: perspective({ fov: 1, aspect: 1 }) })
|
|
17
|
+
.unwrap();
|
|
18
|
+
const camera = world.get(cameraEntity, Camera).unwrap();
|
|
19
|
+
camera.projection;
|
|
20
|
+
const appResult = createApp({ renderer, world, plugins: [plugin] });
|
|
21
|
+
appResult.then((result) => {
|
|
22
|
+
if (result.ok) {
|
|
23
|
+
result.value.start();
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
createRenderer(canvas).then((created) => {
|
|
28
|
+
created.ready.then((ready) => {
|
|
29
|
+
if (!ready.ok) return;
|
|
30
|
+
void created.draw([world], { cameraOwner: 0, resourceOwner: 0 });
|
|
31
|
+
});
|
|
32
|
+
});
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { componentDefinition, defineComponent, World } from '@forgeax/engine-ecs';
|
|
2
|
+
import { componentSchema } from '@forgeax/engine-ecs/internal';
|
|
3
|
+
import { Visibility } from '@forgeax/engine-render';
|
|
4
|
+
import { describe, expect, it } from 'vitest';
|
|
5
|
+
import { projectComponentIntrospection } from '../internal/component-introspection';
|
|
6
|
+
|
|
7
|
+
const Probe = defineComponent(
|
|
8
|
+
'ComponentIntrospectionProbe',
|
|
9
|
+
{
|
|
10
|
+
mode: {
|
|
11
|
+
type: 'enum',
|
|
12
|
+
default: 0,
|
|
13
|
+
labels: { first: 0, second: 1 },
|
|
14
|
+
},
|
|
15
|
+
name: {
|
|
16
|
+
type: 'string',
|
|
17
|
+
meta: { purpose: 'reflection-test' },
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
{ meta: { owner: 'app-test' } },
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
describe('component introspection projection', () => {
|
|
24
|
+
it('derives Visibility schema, labels, and metadata from the registered token', () => {
|
|
25
|
+
const world = new World();
|
|
26
|
+
world.components.register(Visibility).unwrap();
|
|
27
|
+
const descriptors = projectComponentIntrospection(world.components.entries());
|
|
28
|
+
const descriptor = descriptors.find((entry) => entry.name === Visibility.name);
|
|
29
|
+
|
|
30
|
+
expect(descriptor).toBeDefined();
|
|
31
|
+
expect(descriptor?.schema).toEqual(componentSchema(Visibility));
|
|
32
|
+
expect(descriptor?.fields.state?.labels).toEqual(Visibility.fields.state?.labels);
|
|
33
|
+
expect(descriptor?.fields.state?.type).toBe('enum');
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it('projects field and component metadata without leaking component tokens', () => {
|
|
37
|
+
const world = new World();
|
|
38
|
+
world.components.register(Probe).unwrap();
|
|
39
|
+
const descriptors = projectComponentIntrospection(world.components.entries());
|
|
40
|
+
const descriptor = descriptors.find((entry) => entry.name === Probe.name);
|
|
41
|
+
|
|
42
|
+
expect(descriptor).toMatchObject({
|
|
43
|
+
name: Probe.name,
|
|
44
|
+
schema: componentSchema(Probe),
|
|
45
|
+
fields: {
|
|
46
|
+
mode: { type: 'enum', labels: Probe.fields.mode?.labels },
|
|
47
|
+
name: { type: 'string' },
|
|
48
|
+
},
|
|
49
|
+
meta: componentDefinition(Probe).policy.meta,
|
|
50
|
+
});
|
|
51
|
+
expect(descriptor).not.toHaveProperty('id');
|
|
52
|
+
expect(descriptor).not.toHaveProperty('validate');
|
|
53
|
+
expect(descriptor).not.toHaveProperty('toSchemaJSON');
|
|
54
|
+
expect(JSON.parse(JSON.stringify(descriptor))).toEqual(descriptor);
|
|
55
|
+
});
|
|
56
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Time, Update, World } from '@forgeax/engine-ecs';
|
|
2
|
+
import { describe, expect, it } from 'vitest';
|
|
3
|
+
|
|
4
|
+
describe('callback consumer migration', () => {
|
|
5
|
+
it('registers character-style per-frame work as an Update system reading Time', () => {
|
|
6
|
+
const world = new World();
|
|
7
|
+
let observed = 0;
|
|
8
|
+
world
|
|
9
|
+
.addSystem(Update, {
|
|
10
|
+
name: 'character-drive',
|
|
11
|
+
queries: [],
|
|
12
|
+
fn: () => {
|
|
13
|
+
observed = world.getResource(Time).delta;
|
|
14
|
+
},
|
|
15
|
+
})
|
|
16
|
+
.unwrap();
|
|
17
|
+
|
|
18
|
+
world.update(1 / 60).unwrap();
|
|
19
|
+
expect(observed).toBeCloseTo(1 / 60);
|
|
20
|
+
});
|
|
21
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { RenderFeature } from '@forgeax/engine-render';
|
|
2
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
3
|
+
|
|
4
|
+
const createRenderer = vi.hoisted(() => vi.fn());
|
|
5
|
+
|
|
6
|
+
vi.mock('@forgeax/engine-runtime', async (importOriginal) => {
|
|
7
|
+
const actual = await importOriginal<typeof import('@forgeax/engine-runtime')>();
|
|
8
|
+
return { ...actual, createRenderer };
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
import { createApp } from '../create-app';
|
|
12
|
+
|
|
13
|
+
function rendererStub() {
|
|
14
|
+
return {
|
|
15
|
+
backend: 'webgpu' as const,
|
|
16
|
+
ready: Promise.resolve({ ok: true as const, value: undefined }),
|
|
17
|
+
draw: () => ({ ok: true as const, value: undefined }),
|
|
18
|
+
onError: () => () => undefined,
|
|
19
|
+
onLost: () => () => undefined,
|
|
20
|
+
onHealthChange: () => () => undefined,
|
|
21
|
+
dispose: () => undefined,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
describe('createApp features passthrough', () => {
|
|
26
|
+
it('forwards the same ordered feature array to createRenderer', async () => {
|
|
27
|
+
const first = { identity: 'test.first' } as unknown as RenderFeature<unknown>;
|
|
28
|
+
const second = { identity: 'test.second' } as unknown as RenderFeature<unknown>;
|
|
29
|
+
const features = [first, second] as const;
|
|
30
|
+
createRenderer.mockResolvedValue(rendererStub());
|
|
31
|
+
|
|
32
|
+
const canvas = { tagName: 'canvas', isConnected: true } as HTMLCanvasElement;
|
|
33
|
+
const result = await createApp(canvas, { features });
|
|
34
|
+
|
|
35
|
+
expect(result.ok).toBe(true);
|
|
36
|
+
expect(createRenderer).toHaveBeenCalledTimes(1);
|
|
37
|
+
expect(createRenderer.mock.calls[0]?.[1]).toMatchObject({ features });
|
|
38
|
+
expect(createRenderer.mock.calls[0]?.[1].features).toBe(features);
|
|
39
|
+
});
|
|
40
|
+
});
|