@vgai/engine 0.5.0 → 0.5.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.
Files changed (538) hide show
  1. package/package.json +1 -1
  2. package/schemas/engine-capabilities.json +4 -4
  3. package/schemas/vgai-game.schema.json +2 -2
  4. package/src/adapter/authoring.ts +42 -0
  5. package/src/adapter/index.ts +3 -0
  6. package/src/adapter/ingest/overlay-apply.ts +50 -6
  7. package/src/adapter/ingest/scene-capture.ts +51 -2
  8. package/src/adapter/vgai-scene-game-adapter.ts +24 -0
  9. package/src/manifest/schema.ts +7 -3
  10. package/src/runtime/create-runtime.ts +97 -0
  11. package/src/runtime/game.ts +11 -1
  12. package/src/scene/asset-ref-check.ts +1 -1
  13. package/src/scene/scene-loader.ts +2 -2
  14. package/src/scene/user-data.ts +18 -0
  15. package/src/world3d-react/behavior.tsx +19 -11
  16. package/src/world3d-react/r3f-adapter.tsx +8 -0
  17. package/dist/adapter/adapter-surface.d.ts +0 -30
  18. package/dist/adapter/adapter-surface.d.ts.map +0 -1
  19. package/dist/adapter/adapter-surface.js +0 -18
  20. package/dist/adapter/authoring.d.ts +0 -461
  21. package/dist/adapter/authoring.d.ts.map +0 -1
  22. package/dist/adapter/authoring.js +0 -22
  23. package/dist/adapter/colyseus-networking-adapter.d.ts +0 -43
  24. package/dist/adapter/colyseus-networking-adapter.d.ts.map +0 -1
  25. package/dist/adapter/colyseus-networking-adapter.js +0 -38
  26. package/dist/adapter/first-party-systems.d.ts +0 -38
  27. package/dist/adapter/first-party-systems.d.ts.map +0 -1
  28. package/dist/adapter/first-party-systems.js +0 -77
  29. package/dist/adapter/game-adapter.d.ts +0 -133
  30. package/dist/adapter/game-adapter.d.ts.map +0 -1
  31. package/dist/adapter/game-adapter.js +0 -10
  32. package/dist/adapter/host-context.d.ts +0 -71
  33. package/dist/adapter/host-context.d.ts.map +0 -1
  34. package/dist/adapter/host-context.js +0 -16
  35. package/dist/adapter/index.d.ts +0 -22
  36. package/dist/adapter/index.d.ts.map +0 -1
  37. package/dist/adapter/index.js +0 -15
  38. package/dist/adapter/ingest/game-contract.d.ts +0 -53
  39. package/dist/adapter/ingest/game-contract.d.ts.map +0 -1
  40. package/dist/adapter/ingest/game-contract.js +0 -30
  41. package/dist/adapter/ingest/overlay-applier.d.ts +0 -118
  42. package/dist/adapter/ingest/overlay-applier.d.ts.map +0 -1
  43. package/dist/adapter/ingest/overlay-applier.js +0 -132
  44. package/dist/adapter/ingest/overlay-apply.d.ts +0 -60
  45. package/dist/adapter/ingest/overlay-apply.d.ts.map +0 -1
  46. package/dist/adapter/ingest/overlay-apply.js +0 -101
  47. package/dist/adapter/ingest/overlay-file.d.ts +0 -79
  48. package/dist/adapter/ingest/overlay-file.d.ts.map +0 -1
  49. package/dist/adapter/ingest/overlay-file.js +0 -66
  50. package/dist/adapter/ingest/overlay-report.d.ts +0 -113
  51. package/dist/adapter/ingest/overlay-report.d.ts.map +0 -1
  52. package/dist/adapter/ingest/overlay-report.js +0 -103
  53. package/dist/adapter/ingest/scene-capture.d.ts +0 -97
  54. package/dist/adapter/ingest/scene-capture.d.ts.map +0 -1
  55. package/dist/adapter/ingest/scene-capture.js +0 -248
  56. package/dist/adapter/ingest/upstream-pin.d.ts +0 -47
  57. package/dist/adapter/ingest/upstream-pin.d.ts.map +0 -1
  58. package/dist/adapter/ingest/upstream-pin.js +0 -50
  59. package/dist/adapter/loop-gate-report.d.ts +0 -34
  60. package/dist/adapter/loop-gate-report.d.ts.map +0 -1
  61. package/dist/adapter/loop-gate-report.js +0 -37
  62. package/dist/adapter/rapier-physics-adapter.d.ts +0 -12
  63. package/dist/adapter/rapier-physics-adapter.d.ts.map +0 -1
  64. package/dist/adapter/rapier-physics-adapter.js +0 -46
  65. package/dist/adapter/system-adapter.d.ts +0 -206
  66. package/dist/adapter/system-adapter.d.ts.map +0 -1
  67. package/dist/adapter/system-adapter.js +0 -13
  68. package/dist/adapter/transform.d.ts +0 -18
  69. package/dist/adapter/transform.d.ts.map +0 -1
  70. package/dist/adapter/transform.js +0 -1
  71. package/dist/adapter/vgai-scene-game-adapter.d.ts +0 -108
  72. package/dist/adapter/vgai-scene-game-adapter.d.ts.map +0 -1
  73. package/dist/adapter/vgai-scene-game-adapter.js +0 -762
  74. package/dist/ai/navigation.d.ts +0 -64
  75. package/dist/ai/navigation.d.ts.map +0 -1
  76. package/dist/ai/navigation.js +0 -133
  77. package/dist/animation/anim-graph-types.d.ts +0 -25
  78. package/dist/animation/anim-graph-types.d.ts.map +0 -1
  79. package/dist/animation/anim-graph-types.js +0 -1
  80. package/dist/animation/animation-clock.d.ts +0 -213
  81. package/dist/animation/animation-clock.d.ts.map +0 -1
  82. package/dist/animation/animation-clock.js +0 -301
  83. package/dist/animation/blend-node.d.ts +0 -22
  84. package/dist/animation/blend-node.d.ts.map +0 -1
  85. package/dist/animation/blend-node.js +0 -97
  86. package/dist/animation/camera-ownership.d.ts +0 -250
  87. package/dist/animation/camera-ownership.d.ts.map +0 -1
  88. package/dist/animation/camera-ownership.js +0 -169
  89. package/dist/animation/cinematic-cues.d.ts +0 -200
  90. package/dist/animation/cinematic-cues.d.ts.map +0 -1
  91. package/dist/animation/cinematic-cues.js +0 -213
  92. package/dist/animation/clip-map.d.ts +0 -12
  93. package/dist/animation/clip-map.d.ts.map +0 -1
  94. package/dist/animation/clip-map.js +0 -37
  95. package/dist/animation/gsap-registration.d.ts +0 -119
  96. package/dist/animation/gsap-registration.d.ts.map +0 -1
  97. package/dist/animation/gsap-registration.js +0 -92
  98. package/dist/animation/theatre-clock-binding.d.ts +0 -89
  99. package/dist/animation/theatre-clock-binding.d.ts.map +0 -1
  100. package/dist/animation/theatre-clock-binding.js +0 -29
  101. package/dist/animation/theatre-director.d.ts +0 -242
  102. package/dist/animation/theatre-director.d.ts.map +0 -1
  103. package/dist/animation/theatre-director.js +0 -235
  104. package/dist/animation/theatre-object-binding.d.ts +0 -305
  105. package/dist/animation/theatre-object-binding.d.ts.map +0 -1
  106. package/dist/animation/theatre-object-binding.js +0 -351
  107. package/dist/animation/xstate-animation-binding.d.ts +0 -56
  108. package/dist/animation/xstate-animation-binding.d.ts.map +0 -1
  109. package/dist/animation/xstate-animation-binding.js +0 -331
  110. package/dist/animation/xstate-animation-meta.d.ts +0 -266
  111. package/dist/animation/xstate-animation-meta.d.ts.map +0 -1
  112. package/dist/animation/xstate-animation-meta.js +0 -252
  113. package/dist/assets.d.ts +0 -26
  114. package/dist/assets.d.ts.map +0 -1
  115. package/dist/assets.js +0 -55
  116. package/dist/audio/index.d.ts +0 -4
  117. package/dist/audio/index.d.ts.map +0 -1
  118. package/dist/audio/index.js +0 -24
  119. package/dist/audio/tone-clock-binding.d.ts +0 -75
  120. package/dist/audio/tone-clock-binding.d.ts.map +0 -1
  121. package/dist/audio/tone-clock-binding.js +0 -29
  122. package/dist/audio/tone-context.d.ts +0 -114
  123. package/dist/audio/tone-context.d.ts.map +0 -1
  124. package/dist/audio/tone-context.js +0 -39
  125. package/dist/audio/tone-offline-render.d.ts +0 -90
  126. package/dist/audio/tone-offline-render.d.ts.map +0 -1
  127. package/dist/audio/tone-offline-render.js +0 -56
  128. package/dist/audio/wav-encode.d.ts +0 -38
  129. package/dist/audio/wav-encode.d.ts.map +0 -1
  130. package/dist/audio/wav-encode.js +0 -97
  131. package/dist/character/cloth-sim.d.ts +0 -179
  132. package/dist/character/cloth-sim.d.ts.map +0 -1
  133. package/dist/character/cloth-sim.js +0 -334
  134. package/dist/character/spring-chain.d.ts +0 -135
  135. package/dist/character/spring-chain.d.ts.map +0 -1
  136. package/dist/character/spring-chain.js +0 -165
  137. package/dist/core/game-loop.d.ts +0 -42
  138. package/dist/core/game-loop.d.ts.map +0 -1
  139. package/dist/core/game-loop.js +0 -167
  140. package/dist/core/seeded-random.d.ts +0 -69
  141. package/dist/core/seeded-random.d.ts.map +0 -1
  142. package/dist/core/seeded-random.js +0 -121
  143. package/dist/core/system-runner.d.ts +0 -120
  144. package/dist/core/system-runner.d.ts.map +0 -1
  145. package/dist/core/system-runner.js +0 -297
  146. package/dist/core/types.d.ts +0 -92
  147. package/dist/core/types.d.ts.map +0 -1
  148. package/dist/core/types.js +0 -25
  149. package/dist/data/data-asset.d.ts +0 -101
  150. package/dist/data/data-asset.d.ts.map +0 -1
  151. package/dist/data/data-asset.js +0 -122
  152. package/dist/data/data-check-core.d.ts +0 -110
  153. package/dist/data/data-check-core.d.ts.map +0 -1
  154. package/dist/data/data-check-core.js +0 -178
  155. package/dist/data/data-ref.d.ts +0 -79
  156. package/dist/data/data-ref.d.ts.map +0 -1
  157. package/dist/data/data-ref.js +0 -130
  158. package/dist/data/vite-plugin-data.d.ts +0 -79
  159. package/dist/data/vite-plugin-data.d.ts.map +0 -1
  160. package/dist/data/vite-plugin-data.js +0 -217
  161. package/dist/dev/console-bridge.d.ts +0 -22
  162. package/dist/dev/console-bridge.d.ts.map +0 -1
  163. package/dist/dev/console-bridge.js +0 -71
  164. package/dist/dev/debug-draw.d.ts +0 -24
  165. package/dist/dev/debug-draw.d.ts.map +0 -1
  166. package/dist/dev/debug-draw.js +0 -73
  167. package/dist/dev/logger.d.ts +0 -30
  168. package/dist/dev/logger.d.ts.map +0 -1
  169. package/dist/dev/logger.js +0 -90
  170. package/dist/dev/performance-profiler.d.ts +0 -60
  171. package/dist/dev/performance-profiler.d.ts.map +0 -1
  172. package/dist/dev/performance-profiler.js +0 -181
  173. package/dist/dev/webgl-gpu-timer.d.ts +0 -8
  174. package/dist/dev/webgl-gpu-timer.d.ts.map +0 -1
  175. package/dist/dev/webgl-gpu-timer.js +0 -52
  176. package/dist/ecs/component-manager.d.ts +0 -205
  177. package/dist/ecs/component-manager.d.ts.map +0 -1
  178. package/dist/ecs/component-manager.js +0 -706
  179. package/dist/ecs/game-component.d.ts +0 -146
  180. package/dist/ecs/game-component.d.ts.map +0 -1
  181. package/dist/ecs/game-component.js +0 -141
  182. package/dist/ecs/hmr-swap-report.d.ts +0 -53
  183. package/dist/ecs/hmr-swap-report.d.ts.map +0 -1
  184. package/dist/ecs/hmr-swap-report.js +0 -55
  185. package/dist/humanoid/bake.operation.d.ts +0 -119
  186. package/dist/humanoid/bake.operation.d.ts.map +0 -1
  187. package/dist/humanoid/bake.operation.js +0 -228
  188. package/dist/humanoid/body.d.ts +0 -101
  189. package/dist/humanoid/body.d.ts.map +0 -1
  190. package/dist/humanoid/body.js +0 -530
  191. package/dist/humanoid/clips.d.ts +0 -62
  192. package/dist/humanoid/clips.d.ts.map +0 -1
  193. package/dist/humanoid/clips.js +0 -121
  194. package/dist/humanoid/compose.d.ts +0 -75
  195. package/dist/humanoid/compose.d.ts.map +0 -1
  196. package/dist/humanoid/compose.js +0 -176
  197. package/dist/humanoid/generate.d.ts +0 -92
  198. package/dist/humanoid/generate.d.ts.map +0 -1
  199. package/dist/humanoid/generate.js +0 -124
  200. package/dist/humanoid/index.d.ts +0 -24
  201. package/dist/humanoid/index.d.ts.map +0 -1
  202. package/dist/humanoid/index.js +0 -18
  203. package/dist/humanoid/schema.d.ts +0 -35
  204. package/dist/humanoid/schema.d.ts.map +0 -1
  205. package/dist/humanoid/schema.js +0 -87
  206. package/dist/humanoid/skeleton.d.ts +0 -103
  207. package/dist/humanoid/skeleton.d.ts.map +0 -1
  208. package/dist/humanoid/skeleton.js +0 -289
  209. package/dist/index.d.ts +0 -37
  210. package/dist/index.d.ts.map +0 -1
  211. package/dist/index.js +0 -30
  212. package/dist/input/input-manager.d.ts +0 -945
  213. package/dist/input/input-manager.d.ts.map +0 -1
  214. package/dist/input/input-manager.js +0 -2207
  215. package/dist/input/input-types.d.ts +0 -174
  216. package/dist/input/input-types.d.ts.map +0 -1
  217. package/dist/input/input-types.js +0 -1
  218. package/dist/input/prompt-labels.d.ts +0 -21
  219. package/dist/input/prompt-labels.d.ts.map +0 -1
  220. package/dist/input/prompt-labels.js +0 -121
  221. package/dist/input/rebind-controller.d.ts +0 -59
  222. package/dist/input/rebind-controller.d.ts.map +0 -1
  223. package/dist/input/rebind-controller.js +0 -85
  224. package/dist/input/schema.d.ts +0 -16
  225. package/dist/input/schema.d.ts.map +0 -1
  226. package/dist/input/schema.js +0 -228
  227. package/dist/loader.d.ts +0 -43
  228. package/dist/loader.d.ts.map +0 -1
  229. package/dist/loader.js +0 -59
  230. package/dist/manifest/index.d.ts +0 -5
  231. package/dist/manifest/index.d.ts.map +0 -1
  232. package/dist/manifest/index.js +0 -8
  233. package/dist/manifest/load-file.d.ts +0 -4
  234. package/dist/manifest/load-file.d.ts.map +0 -1
  235. package/dist/manifest/load-file.js +0 -14
  236. package/dist/manifest/load.d.ts +0 -144
  237. package/dist/manifest/load.d.ts.map +0 -1
  238. package/dist/manifest/load.js +0 -273
  239. package/dist/manifest/schema.d.ts +0 -230
  240. package/dist/manifest/schema.d.ts.map +0 -1
  241. package/dist/manifest/schema.js +0 -394
  242. package/dist/physics/collision-system.d.ts +0 -41
  243. package/dist/physics/collision-system.d.ts.map +0 -1
  244. package/dist/physics/collision-system.js +0 -64
  245. package/dist/physics/physics-registry.d.ts +0 -45
  246. package/dist/physics/physics-registry.d.ts.map +0 -1
  247. package/dist/physics/physics-registry.js +0 -65
  248. package/dist/physics/transform-writer.d.ts +0 -16
  249. package/dist/physics/transform-writer.d.ts.map +0 -1
  250. package/dist/physics/transform-writer.js +0 -38
  251. package/dist/physics/trigger-dispatch.d.ts +0 -24
  252. package/dist/physics/trigger-dispatch.d.ts.map +0 -1
  253. package/dist/physics/trigger-dispatch.js +0 -80
  254. package/dist/react/game-state.d.ts +0 -156
  255. package/dist/react/game-state.d.ts.map +0 -1
  256. package/dist/react/game-state.js +0 -222
  257. package/dist/react/root-adapter.d.ts +0 -11
  258. package/dist/react/root-adapter.d.ts.map +0 -1
  259. package/dist/react/root-adapter.js +0 -41
  260. package/dist/react/unmanaged-root-detector.d.ts +0 -12
  261. package/dist/react/unmanaged-root-detector.d.ts.map +0 -1
  262. package/dist/react/unmanaged-root-detector.js +0 -45
  263. package/dist/react/use-data.d.ts +0 -60
  264. package/dist/react/use-data.d.ts.map +0 -1
  265. package/dist/react/use-data.js +0 -101
  266. package/dist/react/use-selection.d.ts +0 -75
  267. package/dist/react/use-selection.d.ts.map +0 -1
  268. package/dist/react/use-selection.js +0 -90
  269. package/dist/render/auto-batcher.d.ts +0 -34
  270. package/dist/render/auto-batcher.d.ts.map +0 -1
  271. package/dist/render/auto-batcher.js +0 -140
  272. package/dist/render/render-batch-system.d.ts +0 -33
  273. package/dist/render/render-batch-system.d.ts.map +0 -1
  274. package/dist/render/render-batch-system.js +0 -230
  275. package/dist/render/render-features.d.ts +0 -47
  276. package/dist/render/render-features.d.ts.map +0 -1
  277. package/dist/render/render-features.js +0 -105
  278. package/dist/render/render-settings.d.ts +0 -36
  279. package/dist/render/render-settings.d.ts.map +0 -1
  280. package/dist/render/render-settings.js +0 -51
  281. package/dist/runtime/create-runtime.d.ts +0 -249
  282. package/dist/runtime/create-runtime.d.ts.map +0 -1
  283. package/dist/runtime/create-runtime.js +0 -641
  284. package/dist/runtime/debug-bridge.d.ts +0 -257
  285. package/dist/runtime/debug-bridge.d.ts.map +0 -1
  286. package/dist/runtime/debug-bridge.js +0 -224
  287. package/dist/runtime/debug-registry.d.ts +0 -288
  288. package/dist/runtime/debug-registry.d.ts.map +0 -1
  289. package/dist/runtime/debug-registry.js +0 -513
  290. package/dist/runtime/frame-selector-cache.d.ts +0 -41
  291. package/dist/runtime/frame-selector-cache.d.ts.map +0 -1
  292. package/dist/runtime/frame-selector-cache.js +0 -65
  293. package/dist/runtime/game.d.ts +0 -496
  294. package/dist/runtime/game.d.ts.map +0 -1
  295. package/dist/runtime/game.js +0 -741
  296. package/dist/runtime/gameplay-rng-trap.d.ts +0 -48
  297. package/dist/runtime/gameplay-rng-trap.d.ts.map +0 -1
  298. package/dist/runtime/gameplay-rng-trap.js +0 -96
  299. package/dist/runtime/input-router.d.ts +0 -78
  300. package/dist/runtime/input-router.d.ts.map +0 -1
  301. package/dist/runtime/input-router.js +0 -171
  302. package/dist/runtime/mount-game.d.ts +0 -129
  303. package/dist/runtime/mount-game.d.ts.map +0 -1
  304. package/dist/runtime/mount-game.js +0 -152
  305. package/dist/runtime/mount-manifest.d.ts +0 -173
  306. package/dist/runtime/mount-manifest.d.ts.map +0 -1
  307. package/dist/runtime/mount-manifest.js +0 -297
  308. package/dist/runtime/render-audio-control.d.ts +0 -110
  309. package/dist/runtime/render-audio-control.d.ts.map +0 -1
  310. package/dist/runtime/render-audio-control.js +0 -111
  311. package/dist/runtime/render-control.d.ts +0 -291
  312. package/dist/runtime/render-control.d.ts.map +0 -1
  313. package/dist/runtime/render-control.js +0 -264
  314. package/dist/runtime/render-seed.d.ts +0 -57
  315. package/dist/runtime/render-seed.d.ts.map +0 -1
  316. package/dist/runtime/render-seed.js +0 -74
  317. package/dist/runtime/state-bridge.d.ts +0 -61
  318. package/dist/runtime/state-bridge.d.ts.map +0 -1
  319. package/dist/runtime/state-bridge.js +0 -63
  320. package/dist/runtime/types.d.ts +0 -253
  321. package/dist/runtime/types.d.ts.map +0 -1
  322. package/dist/runtime/types.js +0 -1
  323. package/dist/scene/asset-loaders.d.ts +0 -79
  324. package/dist/scene/asset-loaders.d.ts.map +0 -1
  325. package/dist/scene/asset-loaders.js +0 -141
  326. package/dist/scene/asset-paths.d.ts +0 -11
  327. package/dist/scene/asset-paths.d.ts.map +0 -1
  328. package/dist/scene/asset-paths.js +0 -108
  329. package/dist/scene/asset-ref-check.d.ts +0 -88
  330. package/dist/scene/asset-ref-check.d.ts.map +0 -1
  331. package/dist/scene/asset-ref-check.js +0 -214
  332. package/dist/scene/asset-registry.d.ts +0 -38
  333. package/dist/scene/asset-registry.d.ts.map +0 -1
  334. package/dist/scene/asset-registry.js +0 -66
  335. package/dist/scene/collider-dimensions.d.ts +0 -63
  336. package/dist/scene/collider-dimensions.d.ts.map +0 -1
  337. package/dist/scene/collider-dimensions.js +0 -98
  338. package/dist/scene/component-registry.d.ts +0 -22
  339. package/dist/scene/component-registry.d.ts.map +0 -1
  340. package/dist/scene/component-registry.js +0 -37
  341. package/dist/scene/defaults.d.ts +0 -252
  342. package/dist/scene/defaults.d.ts.map +0 -1
  343. package/dist/scene/defaults.js +0 -151
  344. package/dist/scene/geometries/index.d.ts +0 -8
  345. package/dist/scene/geometries/index.d.ts.map +0 -1
  346. package/dist/scene/geometries/index.js +0 -7
  347. package/dist/scene/geometries/terrain.d.ts +0 -2
  348. package/dist/scene/geometries/terrain.d.ts.map +0 -1
  349. package/dist/scene/geometries/terrain.js +0 -37
  350. package/dist/scene/geometry-registry.d.ts +0 -24
  351. package/dist/scene/geometry-registry.d.ts.map +0 -1
  352. package/dist/scene/geometry-registry.js +0 -20
  353. package/dist/scene/instance-registry.d.ts +0 -36
  354. package/dist/scene/instance-registry.d.ts.map +0 -1
  355. package/dist/scene/instance-registry.js +0 -55
  356. package/dist/scene/instancers/grid.d.ts +0 -2
  357. package/dist/scene/instancers/grid.d.ts.map +0 -1
  358. package/dist/scene/instancers/grid.js +0 -36
  359. package/dist/scene/instancers/index.d.ts +0 -8
  360. package/dist/scene/instancers/index.d.ts.map +0 -1
  361. package/dist/scene/instancers/index.js +0 -7
  362. package/dist/scene/light-camera-factory.d.ts +0 -23
  363. package/dist/scene/light-camera-factory.d.ts.map +0 -1
  364. package/dist/scene/light-camera-factory.js +0 -68
  365. package/dist/scene/material-factory.d.ts +0 -17
  366. package/dist/scene/material-factory.d.ts.map +0 -1
  367. package/dist/scene/material-factory.js +0 -197
  368. package/dist/scene/material-registry.d.ts +0 -40
  369. package/dist/scene/material-registry.d.ts.map +0 -1
  370. package/dist/scene/material-registry.js +0 -44
  371. package/dist/scene/materials/index.d.ts +0 -8
  372. package/dist/scene/materials/index.d.ts.map +0 -1
  373. package/dist/scene/materials/index.js +0 -7
  374. package/dist/scene/materials/water.d.ts +0 -2
  375. package/dist/scene/materials/water.d.ts.map +0 -1
  376. package/dist/scene/materials/water.js +0 -54
  377. package/dist/scene/parse.d.ts +0 -23
  378. package/dist/scene/parse.d.ts.map +0 -1
  379. package/dist/scene/parse.js +0 -179
  380. package/dist/scene/particles-factory.d.ts +0 -33
  381. package/dist/scene/particles-factory.d.ts.map +0 -1
  382. package/dist/scene/particles-factory.js +0 -282
  383. package/dist/scene/scene-apply.d.ts +0 -109
  384. package/dist/scene/scene-apply.d.ts.map +0 -1
  385. package/dist/scene/scene-apply.js +0 -370
  386. package/dist/scene/scene-diff-schema.d.ts +0 -285
  387. package/dist/scene/scene-diff-schema.d.ts.map +0 -1
  388. package/dist/scene/scene-diff-schema.js +0 -92
  389. package/dist/scene/scene-diff-types.d.ts +0 -40
  390. package/dist/scene/scene-diff-types.d.ts.map +0 -1
  391. package/dist/scene/scene-diff-types.js +0 -14
  392. package/dist/scene/scene-loader.d.ts +0 -167
  393. package/dist/scene/scene-loader.d.ts.map +0 -1
  394. package/dist/scene/scene-loader.js +0 -1211
  395. package/dist/scene/scene-query.d.ts +0 -11
  396. package/dist/scene/scene-query.d.ts.map +0 -1
  397. package/dist/scene/scene-query.js +0 -63
  398. package/dist/scene/scene-types.d.ts +0 -10
  399. package/dist/scene/scene-types.d.ts.map +0 -1
  400. package/dist/scene/scene-types.js +0 -8
  401. package/dist/scene/scene-version.d.ts +0 -26
  402. package/dist/scene/scene-version.d.ts.map +0 -1
  403. package/dist/scene/scene-version.js +0 -34
  404. package/dist/scene/schema/animation.d.ts +0 -8
  405. package/dist/scene/schema/animation.d.ts.map +0 -1
  406. package/dist/scene/schema/animation.js +0 -42
  407. package/dist/scene/schema/audio.d.ts +0 -13
  408. package/dist/scene/schema/audio.d.ts.map +0 -1
  409. package/dist/scene/schema/audio.js +0 -22
  410. package/dist/scene/schema/camera.d.ts +0 -28
  411. package/dist/scene/schema/camera.d.ts.map +0 -1
  412. package/dist/scene/schema/camera.js +0 -17
  413. package/dist/scene/schema/collider.d.ts +0 -40
  414. package/dist/scene/schema/collider.d.ts.map +0 -1
  415. package/dist/scene/schema/collider.js +0 -55
  416. package/dist/scene/schema/entity-ref.d.ts +0 -31
  417. package/dist/scene/schema/entity-ref.d.ts.map +0 -1
  418. package/dist/scene/schema/entity-ref.js +0 -61
  419. package/dist/scene/schema/entity.d.ts +0 -1036
  420. package/dist/scene/schema/entity.d.ts.map +0 -1
  421. package/dist/scene/schema/entity.js +0 -153
  422. package/dist/scene/schema/environment.d.ts +0 -425
  423. package/dist/scene/schema/environment.d.ts.map +0 -1
  424. package/dist/scene/schema/environment.js +0 -357
  425. package/dist/scene/schema/index.d.ts +0 -37
  426. package/dist/scene/schema/index.d.ts.map +0 -1
  427. package/dist/scene/schema/index.js +0 -19
  428. package/dist/scene/schema/instances.d.ts +0 -14
  429. package/dist/scene/schema/instances.d.ts.map +0 -1
  430. package/dist/scene/schema/instances.js +0 -28
  431. package/dist/scene/schema/joint.d.ts +0 -23
  432. package/dist/scene/schema/joint.d.ts.map +0 -1
  433. package/dist/scene/schema/joint.js +0 -23
  434. package/dist/scene/schema/light.d.ts +0 -38
  435. package/dist/scene/schema/light.d.ts.map +0 -1
  436. package/dist/scene/schema/light.js +0 -26
  437. package/dist/scene/schema/material.d.ts +0 -199
  438. package/dist/scene/schema/material.d.ts.map +0 -1
  439. package/dist/scene/schema/material.js +0 -103
  440. package/dist/scene/schema/mesh.d.ts +0 -48
  441. package/dist/scene/schema/mesh.d.ts.map +0 -1
  442. package/dist/scene/schema/mesh.js +0 -82
  443. package/dist/scene/schema/particles.d.ts +0 -2178
  444. package/dist/scene/schema/particles.d.ts.map +0 -1
  445. package/dist/scene/schema/particles.js +0 -321
  446. package/dist/scene/schema/physics.d.ts +0 -56
  447. package/dist/scene/schema/physics.d.ts.map +0 -1
  448. package/dist/scene/schema/physics.js +0 -37
  449. package/dist/scene/schema/scene-file.d.ts +0 -303
  450. package/dist/scene/schema/scene-file.d.ts.map +0 -1
  451. package/dist/scene/schema/scene-file.js +0 -256
  452. package/dist/scene/schema/shadow.d.ts +0 -28
  453. package/dist/scene/schema/shadow.d.ts.map +0 -1
  454. package/dist/scene/schema/shadow.js +0 -20
  455. package/dist/scene/schema/spline.d.ts +0 -25
  456. package/dist/scene/schema/spline.d.ts.map +0 -1
  457. package/dist/scene/schema/spline.js +0 -15
  458. package/dist/scene/schema/tuples.d.ts +0 -12
  459. package/dist/scene/schema/tuples.d.ts.map +0 -1
  460. package/dist/scene/schema/tuples.js +0 -14
  461. package/dist/scene/user-data.d.ts +0 -185
  462. package/dist/scene/user-data.d.ts.map +0 -1
  463. package/dist/scene/user-data.js +0 -144
  464. package/dist/setup/setup-audio.d.ts +0 -20
  465. package/dist/setup/setup-audio.d.ts.map +0 -1
  466. package/dist/setup/setup-audio.js +0 -41
  467. package/dist/setup/setup-particles.d.ts +0 -17
  468. package/dist/setup/setup-particles.d.ts.map +0 -1
  469. package/dist/setup/setup-particles.js +0 -16
  470. package/dist/setup/setup-physics.d.ts +0 -25
  471. package/dist/setup/setup-physics.d.ts.map +0 -1
  472. package/dist/setup/setup-physics.js +0 -51
  473. package/dist/setup/setup-renderer.d.ts +0 -69
  474. package/dist/setup/setup-renderer.d.ts.map +0 -1
  475. package/dist/setup/setup-renderer.js +0 -363
  476. package/dist/tools/define-tool.d.ts +0 -130
  477. package/dist/tools/define-tool.d.ts.map +0 -1
  478. package/dist/tools/define-tool.js +0 -96
  479. package/dist/world2d/authoring-2d.d.ts +0 -80
  480. package/dist/world2d/authoring-2d.d.ts.map +0 -1
  481. package/dist/world2d/authoring-2d.js +0 -195
  482. package/dist/world2d/capture-to-scene2d.d.ts +0 -5
  483. package/dist/world2d/capture-to-scene2d.d.ts.map +0 -1
  484. package/dist/world2d/capture-to-scene2d.js +0 -49
  485. package/dist/world2d/collision-2d.d.ts +0 -52
  486. package/dist/world2d/collision-2d.d.ts.map +0 -1
  487. package/dist/world2d/collision-2d.js +0 -70
  488. package/dist/world2d/components-2d.d.ts +0 -47
  489. package/dist/world2d/components-2d.d.ts.map +0 -1
  490. package/dist/world2d/components-2d.js +0 -77
  491. package/dist/world2d/index.d.ts +0 -34
  492. package/dist/world2d/index.d.ts.map +0 -1
  493. package/dist/world2d/index.js +0 -32
  494. package/dist/world2d/ingest-iframe-2d.d.ts +0 -82
  495. package/dist/world2d/ingest-iframe-2d.d.ts.map +0 -1
  496. package/dist/world2d/ingest-iframe-2d.js +0 -166
  497. package/dist/world2d/ingest2d.d.ts +0 -97
  498. package/dist/world2d/ingest2d.d.ts.map +0 -1
  499. package/dist/world2d/ingest2d.js +0 -40
  500. package/dist/world2d/physics2d-registry.d.ts +0 -24
  501. package/dist/world2d/physics2d-registry.d.ts.map +0 -1
  502. package/dist/world2d/physics2d-registry.js +0 -38
  503. package/dist/world2d/pixi-game-adapter.d.ts +0 -107
  504. package/dist/world2d/pixi-game-adapter.d.ts.map +0 -1
  505. package/dist/world2d/pixi-game-adapter.js +0 -210
  506. package/dist/world2d/pixi-surface.d.ts +0 -39
  507. package/dist/world2d/pixi-surface.d.ts.map +0 -1
  508. package/dist/world2d/pixi-surface.js +0 -47
  509. package/dist/world2d/scene-capture-2d.d.ts +0 -43
  510. package/dist/world2d/scene-capture-2d.d.ts.map +0 -1
  511. package/dist/world2d/scene-capture-2d.js +0 -92
  512. package/dist/world2d/scene2d-loader.d.ts +0 -27
  513. package/dist/world2d/scene2d-loader.d.ts.map +0 -1
  514. package/dist/world2d/scene2d-loader.js +0 -275
  515. package/dist/world2d/schema/entity2d.d.ts +0 -102
  516. package/dist/world2d/schema/entity2d.d.ts.map +0 -1
  517. package/dist/world2d/schema/entity2d.js +0 -119
  518. package/dist/world2d/schema/physics2d.d.ts +0 -46
  519. package/dist/world2d/schema/physics2d.d.ts.map +0 -1
  520. package/dist/world2d/schema/physics2d.js +0 -45
  521. package/dist/world2d/schema/sprite.d.ts +0 -42
  522. package/dist/world2d/schema/sprite.d.ts.map +0 -1
  523. package/dist/world2d/schema/sprite.js +0 -63
  524. package/dist/world2d/schema/tilemap.d.ts +0 -15
  525. package/dist/world2d/schema/tilemap.d.ts.map +0 -1
  526. package/dist/world2d/schema/tilemap.js +0 -19
  527. package/dist/world2d/schema/tuples2d.d.ts +0 -20
  528. package/dist/world2d/schema/tuples2d.d.ts.map +0 -1
  529. package/dist/world2d/schema/tuples2d.js +0 -19
  530. package/dist/world2d/system-adapters-2d.d.ts +0 -16
  531. package/dist/world2d/system-adapters-2d.d.ts.map +0 -1
  532. package/dist/world2d/system-adapters-2d.js +0 -37
  533. package/dist/world2d/transform-writer-2d.d.ts +0 -16
  534. package/dist/world2d/transform-writer-2d.d.ts.map +0 -1
  535. package/dist/world2d/transform-writer-2d.js +0 -22
  536. package/dist/world2d/types.d.ts +0 -59
  537. package/dist/world2d/types.d.ts.map +0 -1
  538. package/dist/world2d/types.js +0 -1
@@ -1,38 +0,0 @@
1
- import * as THREE from 'three';
2
- const _quat = new THREE.Quaternion();
3
- const _parentInv = new THREE.Matrix4();
4
- const _parentQuat = new THREE.Quaternion();
5
- /**
6
- * Build the single postPhysics transform writer.
7
- *
8
- * Replaces the old three-step path (physicsSyncSystem → ECS Position/Rotation →
9
- * vnode-manager.syncTransforms). Rapier always reports world-space transforms, so
10
- * for objects parented under something other than the scene root we convert the
11
- * body's world position/rotation into the parent's local space (P1.5) — the old
12
- * vnode path wrote world transforms as local and mis-placed parented children.
13
- *
14
- * Scale is left untouched: Rapier carries no scale, so the Object3D keeps its
15
- * authored local scale.
16
- */
17
- export function createTransformWriter(physics, sceneRoot) {
18
- return function writeTransforms() {
19
- for (const [object3D, { body }] of physics.entries()) {
20
- const t = body.translation();
21
- const r = body.rotation();
22
- const parent = object3D.parent;
23
- if (parent && parent !== sceneRoot) {
24
- // World → local: position through the inverse parent world matrix,
25
- // rotation through the inverse parent world quaternion.
26
- parent.updateWorldMatrix(true, false);
27
- _parentInv.copy(parent.matrixWorld).invert();
28
- object3D.position.set(t.x, t.y, t.z).applyMatrix4(_parentInv);
29
- parent.getWorldQuaternion(_parentQuat).invert();
30
- object3D.quaternion.copy(_parentQuat.multiply(_quat.set(r.x, r.y, r.z, r.w)));
31
- }
32
- else {
33
- object3D.position.set(t.x, t.y, t.z);
34
- object3D.quaternion.set(r.x, r.y, r.z, r.w);
35
- }
36
- }
37
- };
38
- }
@@ -1,24 +0,0 @@
1
- import type RAPIER from '@dimforge/rapier3d-compat';
2
- import type { ComponentManager } from '../ecs/component-manager';
3
- import type { GameContext } from '../runtime/types';
4
- import type { CollisionHandler } from './collision-system';
5
- import type { PhysicsRegistry } from './physics-registry';
6
- /**
7
- * Build a {@link CollisionHandler} that turns Rapier sensor overlaps into
8
- * `onTriggerEnter` / `onTriggerExit` callbacks on the GameComponents of the two
9
- * involved Object3Ds.
10
- *
11
- * Rapier collision events report collider *handles*; we resolve each to its
12
- * Object3D via the physics registry's reverse index, then notify each side's
13
- * components with the *other* Object3D. Only sensor-involved collisions dispatch
14
- * triggers (a solid-vs-solid contact is a regular collision, not a trigger).
15
- *
16
- * Tracks currently-active trigger partners so that if one side is unregistered
17
- * (despawned) from the physics registry before Rapier's own exit event is
18
- * drained, the still-live side still gets its `onTriggerExit` (T1.12d) — see
19
- * `physics.onRemove` below.
20
- *
21
- * Register with `collisions.onCollision(createTriggerDispatch(...))`.
22
- */
23
- export declare function createTriggerDispatch(physics: PhysicsRegistry, components: ComponentManager, rapierWorld: RAPIER.World, ctx: GameContext): CollisionHandler;
24
- //# sourceMappingURL=trigger-dispatch.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"trigger-dispatch.d.ts","sourceRoot":"","sources":["../../src/physics/trigger-dispatch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,2BAA2B,CAAC;AAEpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAE1D;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,eAAe,EACxB,UAAU,EAAE,gBAAgB,EAC5B,WAAW,EAAE,MAAM,CAAC,KAAK,EACzB,GAAG,EAAE,WAAW,GACf,gBAAgB,CAsDlB"}
@@ -1,80 +0,0 @@
1
- /**
2
- * Build a {@link CollisionHandler} that turns Rapier sensor overlaps into
3
- * `onTriggerEnter` / `onTriggerExit` callbacks on the GameComponents of the two
4
- * involved Object3Ds.
5
- *
6
- * Rapier collision events report collider *handles*; we resolve each to its
7
- * Object3D via the physics registry's reverse index, then notify each side's
8
- * components with the *other* Object3D. Only sensor-involved collisions dispatch
9
- * triggers (a solid-vs-solid contact is a regular collision, not a trigger).
10
- *
11
- * Tracks currently-active trigger partners so that if one side is unregistered
12
- * (despawned) from the physics registry before Rapier's own exit event is
13
- * drained, the still-live side still gets its `onTriggerExit` (T1.12d) — see
14
- * `physics.onRemove` below.
15
- *
16
- * Register with `collisions.onCollision(createTriggerDispatch(...))`.
17
- */
18
- export function createTriggerDispatch(physics, components, rapierWorld, ctx) {
19
- const activePartners = new Map();
20
- const link = (a, b) => {
21
- let set = activePartners.get(a);
22
- if (!set) {
23
- set = new Set();
24
- activePartners.set(a, set);
25
- }
26
- set.add(b);
27
- };
28
- const unlink = (a, b) => {
29
- const set = activePartners.get(a);
30
- if (!set)
31
- return;
32
- set.delete(b);
33
- if (set.size === 0)
34
- activePartners.delete(a);
35
- };
36
- // Flush pending exits at unregister: an entity removed from the physics
37
- // registry (e.g. despawned) may still have queued Rapier "stopped" events
38
- // that never reach drain(), or may never generate one at all (the collider
39
- // is simply gone). Either way, any object still tracked as its trigger
40
- // partner must get its onTriggerExit now, not silently never.
41
- physics.onRemove((object3D) => {
42
- const partners = activePartners.get(object3D);
43
- if (!partners || partners.size === 0)
44
- return;
45
- for (const other of partners) {
46
- notify(components, other, object3D, false, ctx);
47
- notify(components, object3D, other, false, ctx);
48
- unlink(other, object3D);
49
- }
50
- activePartners.delete(object3D);
51
- });
52
- return (handleA, handleB, started) => {
53
- const colA = rapierWorld.getCollider(handleA);
54
- const colB = rapierWorld.getCollider(handleB);
55
- if (!colA?.isSensor() && !colB?.isSensor())
56
- return;
57
- const objA = physics.getByColliderHandle(handleA);
58
- const objB = physics.getByColliderHandle(handleB);
59
- if (!objA || !objB)
60
- return;
61
- if (started) {
62
- link(objA, objB);
63
- link(objB, objA);
64
- }
65
- else {
66
- unlink(objA, objB);
67
- unlink(objB, objA);
68
- }
69
- notify(components, objA, objB, started, ctx);
70
- notify(components, objB, objA, started, ctx);
71
- };
72
- }
73
- function notify(components, self, other, started, ctx) {
74
- for (const inst of components.getComponents(self)) {
75
- if (started)
76
- inst.onTriggerEnter?.(other, ctx);
77
- else
78
- inst.onTriggerExit?.(other, ctx);
79
- }
80
- }
@@ -1,156 +0,0 @@
1
- /**
2
- * Canonical `GameProvider`/`useGame`/`useGameState`/`useWorldObservation`
3
- * entry for React adapter roots. Also home to `useDebugProvider` and
4
- * `useDebugCommand`/`useDebugEmit`, the React-facing debug seam.
5
- *
6
- * This is a SEPARATE, react-value-importing module under
7
- * `packages/engine/src/react/` — colocated per REACT-STATE-BRIDGE §3's own
8
- * "colocate the react-facing hooks with the HUD seam, not the react-free
9
- * core" rule, just now living IN the engine package rather than only in the
10
- * project template. It is imported by NOTHING in the engine core import
11
- * graph (`packages/engine/src/` outside this `react/` directory) — that
12
- * invariant is proved by `packages/engine/test/react-core-import-ban.test.ts`
13
- * (AC-F1).
14
- *
15
- * Every host and game imports this one module, so provider and hooks share
16
- * one `createContext()` identity. The engine core outside `src/react/`
17
- * remains React-free, enforced by `react-core-import-ban.test.ts`.
18
- */
19
- import { type PropsWithChildren } from 'react';
20
- import type { z } from 'zod';
21
- import type { WorldStateObserver } from '../adapter';
22
- import { type Equals, shallow } from '../runtime/frame-selector-cache';
23
- import type { Game } from '../runtime/game';
24
- import type { DebugCommandArgs } from '../runtime/types';
25
- /** Re-exported for convenience — the opt-in equality for selectors that
26
- * return a fresh object/array/tuple every call (default is `Object.is`). */
27
- export { shallow };
28
- /** Provide the `Game` to `useGameState`/`useGame` for everything mounted
29
- * beneath it. Adapter-root hosts install this provider automatically — see the module doc
30
- * comment above for the context-identity rule this hook family depends on.
31
- *
32
- * Props use `PropsWithChildren` (children optional in the TYPE, not
33
- * runtime-optional in practice — you always want children mounted under
34
- * the provider) rather than a bare `{ children: ReactNode }` field: a
35
- * required `children` in `P` makes TS's `createElement<P>(type, props?:
36
- * Attributes & P, ...children)` overload reject the plain 3-arg call
37
- * `React.createElement(GameProvider, { game }, child)` (no JSX transform,
38
- * e.g. a `.ts` main composing a sibling `.tsx` HUD) with "Property
39
- * 'children' is missing" even though the 3rd arg supplies it — issue #97.
40
- * Making `children` optional in the type lets that overload resolve; the
41
- * rest-arg children are still wired through to `children` at runtime by
42
- * React itself, unchanged. See `test/game-state-create-element-types.test.tsx`. */
43
- export declare function GameProvider({ game, children }: PropsWithChildren<{
44
- game: Game;
45
- }>): import("react").JSX.Element;
46
- /** Read the `Game` provided by the nearest `GameProvider`. Throws
47
- * descriptively when called outside one — matching the repo's loud-failure
48
- * habit rather than silently returning `null`. */
49
- export declare function useGame(): Game;
50
- /**
51
- * Subscribe to a selected slice of game state (`docs/REACT-STATE-BRIDGE.md`
52
- * §3). Re-renders only when the selected value changes: the selector re-runs
53
- * at most once per completed frame (`game.state.frameVersion`), and
54
- * `equals` (default `Object.is`; pass {@link shallow} for tuples/objects)
55
- * gates whether the fresh result actually counts as a change.
56
- *
57
- * `selector` reads the live graph (e.g.
58
- * `g => g.queryByComponent(Hp)[0]?.hp`) at post-frame quiescence — no
59
- * copies. A selector that returns a fresh object every call must pass
60
- * `shallow` (or an equivalent `equals`), or it will re-render every frame.
61
- *
62
- * Note: `equals` is captured once, when this hook first mounts (in the
63
- * per-instance cache created below) — pass a stable function (module-level
64
- * `shallow`/`Object.is`, or a value that doesn't change across renders),
65
- * not a fresh inline arrow every render.
66
- */
67
- export declare function useGameState<T>(selector: (game: Game) => T, equals?: Equals<T>): T;
68
- /**
69
- * Pure, react-free lookup for the `useWorldObservation` hook below — factored
70
- * out so the hook body stays a thin `useSyncExternalStore` wrapper. Throws
71
- * descriptively (loud, not `undefined`-forever) when `worldId` doesn't name a
72
- * registered world, or that world's mount has no `observe`
73
- * (`WorldStateObserver`, `@engine/adapter`) — matching the `Game.registerWorld`
74
- * "no state bridge" report (`runtime/game.ts`) this is the react-side half of.
75
- */
76
- export declare function requireWorldObserver(game: Game, worldId: string): WorldStateObserver;
77
- /**
78
- * Subscribe to a selected slice of a FOREIGN (non-first-party) world's
79
- * observed state (`docs/REACT-STATE-BRIDGE.md` §4) — the ingested-world
80
- * counterpart of `useGameState` above; both are sugar over the same
81
- * subscribe/snapshot shape, so a react HUD reads native and ingested sources
82
- * through one mental model.
83
- *
84
- * `selector` runs over that world's `snapshot()` — NOT the `Game` — since a
85
- * foreign world hosts no `GameComponent`s to query. Re-renders only when the
86
- * selected value changes (`equals`, default `Object.is`; pass {@link shallow}
87
- * for tuples/objects returned fresh every call).
88
- *
89
- * Cadence note: unlike `useGameState`, this does NOT key its cache off
90
- * `game.state.frameVersion` — a foreign/self-driven world may notify on its
91
- * OWN rAF cadence, unrelated to our frame timing (§4's "consumers must not
92
- * assume our frame timing"). Instead this keeps a local version counter,
93
- * bumped once per `onChange` notification from the observer itself.
94
- *
95
- * Throws (loud, not a silently-undefined subscription) if `worldId` isn't
96
- * registered, or its mount has no `observe` — see `requireWorldObserver`.
97
- */
98
- export declare function useWorldObservation<T>(worldId: string, selector: (snapshot: unknown) => T, equals?: Equals<T>): T;
99
- /**
100
- * The debug seam's react-world registration door (Task 1.5,
101
- * `docs/SYNTHETIC-PLAYER-SPEC.md` §3.1): react roots have no `setup()`/
102
- * `ctx.debug` of their own, so this hook registers a named state provider
103
- * into the SAME game-scoped registry every `GameComponent`'s `ctx.debug`
104
- * feeds (`getDebugRegistry(game)`, `runtime/debug-registry.ts`), readable
105
- * through `game.systemAdapters.debug.state(name)` exactly like a
106
- * `ctx.debug.registerStateProvider` call.
107
- *
108
- * Registers ONCE per mount (keyed on `name`) and unregisters on unmount —
109
- * silently, like hot-reload's `strip()`. Re-renders never re-register or
110
- * re-warn: `fn` is kept in a ref updated every render, so the registered
111
- * closure always calls the CURRENT `fn` without touching the registry.
112
- * Outside a `<GameProvider>` (or against a bare test `Game` built without a
113
- * registry) this is an inert no-op — it never throws, matching the "no seam
114
- * without a consumer" degrade every optional `ctx.*` surface follows.
115
- */
116
- export declare function useDebugProvider(name: string, fn: () => unknown, opts?: {
117
- tier?: 'observable' | 'assisted';
118
- }): void;
119
- /**
120
- * The command-side counterpart of {@link useDebugProvider} — registers an
121
- * invokable debug command into the same game-scoped registry, readable
122
- * through `game.systemAdapters.debug.commands()`/`invoke(name, args)`.
123
- *
124
- * Same mount/unmount/ref-latest contract as {@link useDebugProvider}: `spec`
125
- * (description/args/locus) is captured at registration time, `fn` always
126
- * calls through to the latest render's closure via a ref, and the hook is an
127
- * inert no-op with no `<GameProvider>` in scope.
128
- *
129
- * Generic over the declared `args` Zod tuple, same as
130
- * `DebugCtxSurface.registerCommand` ({@link DebugCommandArgs}, dry-run
131
- * finding — `docs/ACCEPTANCE-DRIVER-BUILD-PLAN.md` Wave 6 ledger): declaring
132
- * `args: z.tuple([z.number(), z.string()])` types `fn`'s parameters as
133
- * `(n: number, s: string) => ...` with no `unknown[]` cast; omitting `args`
134
- * keeps `fn` typed `(...args: unknown[]) => ...` as before.
135
- */
136
- export declare function useDebugCommand<T extends z.ZodTuple | undefined = undefined>(name: string, spec: {
137
- description?: string;
138
- args?: T;
139
- locus?: 'client' | 'server';
140
- }, fn: (...args: DebugCommandArgs<T>) => unknown | Promise<unknown>): void;
141
- /**
142
- * The event-side counterpart of {@link useDebugProvider} and
143
- * {@link useDebugCommand}. Returns a stable callback that writes a
144
- * tick-stamped event to the game-scoped debug flight recorder:
145
- *
146
- * ```tsx
147
- * const emit = useDebugEmit();
148
- * emit('score-changed', { score });
149
- * ```
150
- *
151
- * It is an inert no-op outside a `<GameProvider>`, matching the optional
152
- * behavior of the other React debug hooks. Games never need to import the
153
- * debug registry or know its internal React provenance id.
154
- */
155
- export declare function useDebugEmit(): (event: string, detail?: unknown) => void;
156
- //# sourceMappingURL=game-state.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"game-state.d.ts","sourceRoot":"","sources":["../../src/react/game-state.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAEL,KAAK,iBAAiB,EAMvB,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAErD,OAAO,EAA4B,KAAK,MAAM,EAAE,OAAO,EAAE,MAAM,iCAAiC,CAAC;AACjG,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEzD;6EAC6E;AAC7E,OAAO,EAAE,OAAO,EAAE,CAAC;AAInB;;;;;;;;;;;;;;oFAcoF;AACpF,wBAAgB,YAAY,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,iBAAiB,CAAC;IAAE,IAAI,EAAE,IAAI,CAAA;CAAE,CAAC,+BAEjF;AAED;;mDAEmD;AACnD,wBAAgB,OAAO,IAAI,IAAI,CAQ9B;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,CAAC,EAAE,MAAM,GAAE,MAAM,CAAC,CAAC,CAAa,GAAG,CAAC,CAW7F;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,GAAG,kBAAkB,CAiBpF;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EACnC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,CAAC,EAClC,MAAM,GAAE,MAAM,CAAC,CAAC,CAAa,GAC5B,CAAC,CAoBH;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,OAAO,EACjB,IAAI,CAAC,EAAE;IAAE,IAAI,CAAC,EAAE,YAAY,GAAG,UAAU,CAAA;CAAE,GAC1C,IAAI,CAaN;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,eAAe,CAAC,CAAC,SAAS,CAAC,CAAC,QAAQ,GAAG,SAAS,GAAG,SAAS,EAC1E,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE;IAAE,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAAC,KAAK,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAA;CAAE,EACrE,EAAE,EAAE,CAAC,GAAG,IAAI,EAAE,gBAAgB,CAAC,CAAC,CAAC,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,GAC/D,IAAI,CAeN;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,YAAY,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,OAAO,KAAK,IAAI,CASxE"}
@@ -1,222 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- /**
3
- * Canonical `GameProvider`/`useGame`/`useGameState`/`useWorldObservation`
4
- * entry for React adapter roots. Also home to `useDebugProvider` and
5
- * `useDebugCommand`/`useDebugEmit`, the React-facing debug seam.
6
- *
7
- * This is a SEPARATE, react-value-importing module under
8
- * `packages/engine/src/react/` — colocated per REACT-STATE-BRIDGE §3's own
9
- * "colocate the react-facing hooks with the HUD seam, not the react-free
10
- * core" rule, just now living IN the engine package rather than only in the
11
- * project template. It is imported by NOTHING in the engine core import
12
- * graph (`packages/engine/src/` outside this `react/` directory) — that
13
- * invariant is proved by `packages/engine/test/react-core-import-ban.test.ts`
14
- * (AC-F1).
15
- *
16
- * Every host and game imports this one module, so provider and hooks share
17
- * one `createContext()` identity. The engine core outside `src/react/`
18
- * remains React-free, enforced by `react-core-import-ban.test.ts`.
19
- */
20
- import { createContext, useCallback, useContext, useEffect, useRef, useSyncExternalStore, } from 'react';
21
- import { getDebugRegistry } from '../runtime/debug-registry';
22
- import { createFrameSelectorCache, shallow } from '../runtime/frame-selector-cache';
23
- /** Re-exported for convenience — the opt-in equality for selectors that
24
- * return a fresh object/array/tuple every call (default is `Object.is`). */
25
- export { shallow };
26
- const GameContext = createContext(null);
27
- /** Provide the `Game` to `useGameState`/`useGame` for everything mounted
28
- * beneath it. Adapter-root hosts install this provider automatically — see the module doc
29
- * comment above for the context-identity rule this hook family depends on.
30
- *
31
- * Props use `PropsWithChildren` (children optional in the TYPE, not
32
- * runtime-optional in practice — you always want children mounted under
33
- * the provider) rather than a bare `{ children: ReactNode }` field: a
34
- * required `children` in `P` makes TS's `createElement<P>(type, props?:
35
- * Attributes & P, ...children)` overload reject the plain 3-arg call
36
- * `React.createElement(GameProvider, { game }, child)` (no JSX transform,
37
- * e.g. a `.ts` main composing a sibling `.tsx` HUD) with "Property
38
- * 'children' is missing" even though the 3rd arg supplies it — issue #97.
39
- * Making `children` optional in the type lets that overload resolve; the
40
- * rest-arg children are still wired through to `children` at runtime by
41
- * React itself, unchanged. See `test/game-state-create-element-types.test.tsx`. */
42
- export function GameProvider({ game, children }) {
43
- return _jsx(GameContext.Provider, { value: game, children: children });
44
- }
45
- /** Read the `Game` provided by the nearest `GameProvider`. Throws
46
- * descriptively when called outside one — matching the repo's loud-failure
47
- * habit rather than silently returning `null`. */
48
- export function useGame() {
49
- const game = useContext(GameContext);
50
- if (!game) {
51
- throw new Error('useGame: no Game in context — wrap this component in <GameProvider game={ctx.game!}>.');
52
- }
53
- return game;
54
- }
55
- /**
56
- * Subscribe to a selected slice of game state (`docs/REACT-STATE-BRIDGE.md`
57
- * §3). Re-renders only when the selected value changes: the selector re-runs
58
- * at most once per completed frame (`game.state.frameVersion`), and
59
- * `equals` (default `Object.is`; pass {@link shallow} for tuples/objects)
60
- * gates whether the fresh result actually counts as a change.
61
- *
62
- * `selector` reads the live graph (e.g.
63
- * `g => g.queryByComponent(Hp)[0]?.hp`) at post-frame quiescence — no
64
- * copies. A selector that returns a fresh object every call must pass
65
- * `shallow` (or an equivalent `equals`), or it will re-render every frame.
66
- *
67
- * Note: `equals` is captured once, when this hook first mounts (in the
68
- * per-instance cache created below) — pass a stable function (module-level
69
- * `shallow`/`Object.is`, or a value that doesn't change across renders),
70
- * not a fresh inline arrow every render.
71
- */
72
- export function useGameState(selector, equals = Object.is) {
73
- const game = useGame();
74
- const cacheRef = useRef(null);
75
- if (cacheRef.current === null) {
76
- cacheRef.current = createFrameSelectorCache(equals);
77
- }
78
- return useSyncExternalStore((onStoreChange) => game.state.subscribe(onStoreChange), () => cacheRef.current.get(game.state.frameVersion, () => selector(game)));
79
- }
80
- /**
81
- * Pure, react-free lookup for the `useWorldObservation` hook below — factored
82
- * out so the hook body stays a thin `useSyncExternalStore` wrapper. Throws
83
- * descriptively (loud, not `undefined`-forever) when `worldId` doesn't name a
84
- * registered world, or that world's mount has no `observe`
85
- * (`WorldStateObserver`, `@engine/adapter`) — matching the `Game.registerWorld`
86
- * "no state bridge" report (`runtime/game.ts`) this is the react-side half of.
87
- */
88
- export function requireWorldObserver(game, worldId) {
89
- const world = game.world(worldId);
90
- if (!world) {
91
- throw new Error(`useWorldObservation: no world registered with id "${worldId}" — check game.roots for the ` +
92
- 'ids actually registered.');
93
- }
94
- const observer = world.mounted.observe;
95
- if (!observer) {
96
- throw new Error(`useWorldObservation: world "${worldId}" (kind: ${world.kind}, adapter: "${world.adapter.id}") ` +
97
- 'has no state bridge — its mount has no `observe` (WorldStateObserver). This world cannot ' +
98
- 'be observed from React (docs/REACT-STATE-BRIDGE.md §4).');
99
- }
100
- return observer;
101
- }
102
- /**
103
- * Subscribe to a selected slice of a FOREIGN (non-first-party) world's
104
- * observed state (`docs/REACT-STATE-BRIDGE.md` §4) — the ingested-world
105
- * counterpart of `useGameState` above; both are sugar over the same
106
- * subscribe/snapshot shape, so a react HUD reads native and ingested sources
107
- * through one mental model.
108
- *
109
- * `selector` runs over that world's `snapshot()` — NOT the `Game` — since a
110
- * foreign world hosts no `GameComponent`s to query. Re-renders only when the
111
- * selected value changes (`equals`, default `Object.is`; pass {@link shallow}
112
- * for tuples/objects returned fresh every call).
113
- *
114
- * Cadence note: unlike `useGameState`, this does NOT key its cache off
115
- * `game.state.frameVersion` — a foreign/self-driven world may notify on its
116
- * OWN rAF cadence, unrelated to our frame timing (§4's "consumers must not
117
- * assume our frame timing"). Instead this keeps a local version counter,
118
- * bumped once per `onChange` notification from the observer itself.
119
- *
120
- * Throws (loud, not a silently-undefined subscription) if `worldId` isn't
121
- * registered, or its mount has no `observe` — see `requireWorldObserver`.
122
- */
123
- export function useWorldObservation(worldId, selector, equals = Object.is) {
124
- const game = useGame();
125
- const observer = requireWorldObserver(game, worldId);
126
- const cacheRef = useRef(null);
127
- if (cacheRef.current === null) {
128
- cacheRef.current = createFrameSelectorCache(equals);
129
- }
130
- // Local notification-version counter — see the cadence note above. A
131
- // plain mutable ref (not React state): bumping it must not itself trigger
132
- // a render, `useSyncExternalStore`'s `onStoreChange` is what does that.
133
- const versionRef = useRef(0);
134
- return useSyncExternalStore((onStoreChange) => observer.subscribe(() => {
135
- versionRef.current++;
136
- onStoreChange();
137
- }), () => cacheRef.current.get(versionRef.current, () => selector(observer.snapshot())));
138
- }
139
- /**
140
- * The debug seam's react-world registration door (Task 1.5,
141
- * `docs/SYNTHETIC-PLAYER-SPEC.md` §3.1): react roots have no `setup()`/
142
- * `ctx.debug` of their own, so this hook registers a named state provider
143
- * into the SAME game-scoped registry every `GameComponent`'s `ctx.debug`
144
- * feeds (`getDebugRegistry(game)`, `runtime/debug-registry.ts`), readable
145
- * through `game.systemAdapters.debug.state(name)` exactly like a
146
- * `ctx.debug.registerStateProvider` call.
147
- *
148
- * Registers ONCE per mount (keyed on `name`) and unregisters on unmount —
149
- * silently, like hot-reload's `strip()`. Re-renders never re-register or
150
- * re-warn: `fn` is kept in a ref updated every render, so the registered
151
- * closure always calls the CURRENT `fn` without touching the registry.
152
- * Outside a `<GameProvider>` (or against a bare test `Game` built without a
153
- * registry) this is an inert no-op — it never throws, matching the "no seam
154
- * without a consumer" degrade every optional `ctx.*` surface follows.
155
- */
156
- export function useDebugProvider(name, fn, opts) {
157
- const game = useContext(GameContext);
158
- const fnRef = useRef(fn);
159
- fnRef.current = fn;
160
- const tier = opts?.tier;
161
- useEffect(() => {
162
- const registry = game && getDebugRegistry(game);
163
- if (!registry)
164
- return;
165
- return registry.registerReactProvider(name, () => fnRef.current(), { tier });
166
- // `tier` is deliberately NOT a dep (same reasoning as `useDebugCommand`'s
167
- // `spec`) — captured once at mount, so it never forces re-registration.
168
- }, [game, name]);
169
- }
170
- /**
171
- * The command-side counterpart of {@link useDebugProvider} — registers an
172
- * invokable debug command into the same game-scoped registry, readable
173
- * through `game.systemAdapters.debug.commands()`/`invoke(name, args)`.
174
- *
175
- * Same mount/unmount/ref-latest contract as {@link useDebugProvider}: `spec`
176
- * (description/args/locus) is captured at registration time, `fn` always
177
- * calls through to the latest render's closure via a ref, and the hook is an
178
- * inert no-op with no `<GameProvider>` in scope.
179
- *
180
- * Generic over the declared `args` Zod tuple, same as
181
- * `DebugCtxSurface.registerCommand` ({@link DebugCommandArgs}, dry-run
182
- * finding — `docs/ACCEPTANCE-DRIVER-BUILD-PLAN.md` Wave 6 ledger): declaring
183
- * `args: z.tuple([z.number(), z.string()])` types `fn`'s parameters as
184
- * `(n: number, s: string) => ...` with no `unknown[]` cast; omitting `args`
185
- * keeps `fn` typed `(...args: unknown[]) => ...` as before.
186
- */
187
- export function useDebugCommand(name, spec, fn) {
188
- const game = useContext(GameContext);
189
- const fnRef = useRef(fn);
190
- fnRef.current = fn;
191
- useEffect(() => {
192
- const registry = game && getDebugRegistry(game);
193
- if (!registry)
194
- return;
195
- return registry.registerReactCommand(name, spec, (...args) => fnRef.current(...args));
196
- // `spec` is deliberately NOT a dep (like `equals` above) — captured once
197
- // at mount, so a fresh inline object literal every render never forces
198
- // re-registration.
199
- }, [game, name]);
200
- }
201
- /**
202
- * The event-side counterpart of {@link useDebugProvider} and
203
- * {@link useDebugCommand}. Returns a stable callback that writes a
204
- * tick-stamped event to the game-scoped debug flight recorder:
205
- *
206
- * ```tsx
207
- * const emit = useDebugEmit();
208
- * emit('score-changed', { score });
209
- * ```
210
- *
211
- * It is an inert no-op outside a `<GameProvider>`, matching the optional
212
- * behavior of the other React debug hooks. Games never need to import the
213
- * debug registry or know its internal React provenance id.
214
- */
215
- export function useDebugEmit() {
216
- const game = useContext(GameContext);
217
- return useCallback((event, detail) => {
218
- if (!game)
219
- return;
220
- getDebugRegistry(game)?.emitReact(event, detail);
221
- }, [game]);
222
- }
@@ -1,11 +0,0 @@
1
- import { type ComponentType } from 'react';
2
- import type { ReactRootAdapter } from '../runtime/create-runtime';
3
- /** Construct one canonical React root adapter for direct host composition. */
4
- export declare function createReactRootAdapter(id: string, Entry: ComponentType): ReactRootAdapter;
5
- /**
6
- * Register the engine's React adapter-root factory. This module is an
7
- * explicit optional React entry point: engine core never imports it, while a
8
- * React game host imports it once and receives the canonical root lifecycle.
9
- */
10
- export declare function registerReactAdapter(): void;
11
- //# sourceMappingURL=root-adapter.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"root-adapter.d.ts","sourceRoot":"","sources":["../../src/react/root-adapter.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAiB,MAAM,OAAO,CAAC;AAG1D,OAAO,KAAK,EAAoB,gBAAgB,EAAkB,MAAM,2BAA2B,CAAC;AAQpG,8EAA8E;AAC9E,wBAAgB,sBAAsB,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,GAAG,gBAAgB,CAiBzF;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,IAAI,IAAI,CAY3C"}
@@ -1,41 +0,0 @@
1
- import { createElement } from 'react';
2
- import { flushSync } from 'react-dom';
3
- import { createRoot } from 'react-dom/client';
4
- import { isAdapterRegistered, registerAdapter } from '../runtime/mount-game';
5
- import { GameProvider } from './game-state';
6
- /** Construct one canonical React root adapter for direct host composition. */
7
- export function createReactRootAdapter(id, Entry) {
8
- return {
9
- id,
10
- async mount(host) {
11
- if (!host.game)
12
- throw new Error(`React root "${id}" requires a Game host.`);
13
- const reactRoot = createRoot(host.container);
14
- flushSync(() => {
15
- reactRoot.render(createElement(GameProvider, { game: host.game }, createElement(Entry)));
16
- });
17
- return {
18
- kind: 'react',
19
- container: host.container,
20
- drivesOwnLoop: false,
21
- dispose: () => reactRoot.unmount(),
22
- };
23
- },
24
- };
25
- }
26
- /**
27
- * Register the engine's React adapter-root factory. This module is an
28
- * explicit optional React entry point: engine core never imports it, while a
29
- * React game host imports it once and receives the canonical root lifecycle.
30
- */
31
- export function registerReactAdapter() {
32
- if (isAdapterRegistered('react'))
33
- return;
34
- registerAdapter('react', (root, { entryModule }) => {
35
- const Entry = entryModule?.default;
36
- if (!Entry) {
37
- throw new Error(`React root "${root.id}" entry "${root.entry ?? '(missing)'}" must default-export a component.`);
38
- }
39
- return { kind: 'react', adapter: createReactRootAdapter(root.id, Entry) };
40
- });
41
- }
@@ -1,12 +0,0 @@
1
- export interface UnmanagedReactRootFinding {
2
- readonly file: string;
3
- readonly line: number;
4
- readonly api: 'createRoot' | 'hydrateRoot' | 'ReactDOM.render';
5
- }
6
- /**
7
- * Find project-owned React DOM root creation. VGAI hosts React through
8
- * manifest adapter roots, so any of these calls in game source creates an
9
- * unmanaged second lifecycle and is a hard validation error.
10
- */
11
- export declare function detectUnmanagedReactRoots(source: string, file: string): UnmanagedReactRootFinding[];
12
- //# sourceMappingURL=unmanaged-root-detector.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"unmanaged-root-detector.d.ts","sourceRoot":"","sources":["../../src/react/unmanaged-root-detector.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,EAAE,YAAY,GAAG,aAAa,GAAG,iBAAiB,CAAC;CAChE;AAMD;;;;GAIG;AACH,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,GACX,yBAAyB,EAAE,CA+C7B"}
@@ -1,45 +0,0 @@
1
- function lineAt(source, offset) {
2
- return source.slice(0, offset).split('\n').length;
3
- }
4
- /**
5
- * Find project-owned React DOM root creation. VGAI hosts React through
6
- * manifest adapter roots, so any of these calls in game source creates an
7
- * unmanaged second lifecycle and is a hard validation error.
8
- */
9
- export function detectUnmanagedReactRoots(source, file) {
10
- const findings = [];
11
- const aliases = new Map();
12
- for (const match of source.matchAll(/import\s*\{([^}]*)\}\s*from\s*['"]react-dom\/client['"]/g)) {
13
- for (const member of (match[1] ?? '').split(',')) {
14
- const parsed = member.trim().match(/^(createRoot|hydrateRoot)(?:\s+as\s+([\w$]+))?$/);
15
- if (parsed)
16
- aliases.set(parsed[2] ?? parsed[1], parsed[1]);
17
- }
18
- }
19
- for (const [alias, api] of aliases) {
20
- const call = new RegExp(`\\b${alias.replace(/[$]/g, '\\$&')}\\s*\\(`, 'g');
21
- for (const match of source.matchAll(call)) {
22
- findings.push({ file, line: lineAt(source, match.index ?? 0), api });
23
- }
24
- }
25
- const namespaceNames = new Set();
26
- for (const match of source.matchAll(/import\s+(?:\*\s+as\s+|)([\w$]+)\s+from\s*['"]react-dom(?:\/client)?['"]/g)) {
27
- namespaceNames.add(match[1]);
28
- }
29
- namespaceNames.add('ReactDOM');
30
- for (const name of namespaceNames) {
31
- for (const api of ['createRoot', 'hydrateRoot', 'render']) {
32
- const call = new RegExp(`\\b${name}\\.${api}\\s*\\(`, 'g');
33
- for (const match of source.matchAll(call)) {
34
- findings.push({
35
- file,
36
- line: lineAt(source, match.index ?? 0),
37
- api: api === 'render' ? 'ReactDOM.render' : api,
38
- });
39
- }
40
- }
41
- }
42
- return findings.filter((finding, index) => findings.findIndex((candidate) => candidate.file === finding.file &&
43
- candidate.line === finding.line &&
44
- candidate.api === finding.api) === index);
45
- }