@fps-games/editor 0.2.1-beta.1 → 0.2.1-beta.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 (245) hide show
  1. package/dist/agent-bridge/capabilities/ui-regions.d.ts.map +1 -1
  2. package/dist/agent-bridge/capabilities/ui-regions.js +16 -0
  3. package/dist/agent-bridge/capabilities/ui-regions.js.map +1 -1
  4. package/dist/build-info.json +43 -43
  5. package/dist/internal/material-preview.d.ts +22 -0
  6. package/dist/internal/material-preview.d.ts.map +1 -0
  7. package/dist/internal/material-preview.js +186 -0
  8. package/dist/internal/material-preview.js.map +1 -0
  9. package/dist/internal/project-model-preview.d.ts +4 -0
  10. package/dist/internal/project-model-preview.d.ts.map +1 -0
  11. package/dist/internal/project-model-preview.js +359 -0
  12. package/dist/internal/project-model-preview.js.map +1 -0
  13. package/dist/local-editor-agent-context.d.ts +12 -1
  14. package/dist/local-editor-agent-context.d.ts.map +1 -1
  15. package/dist/local-editor-agent-context.js +47 -0
  16. package/dist/local-editor-agent-context.js.map +1 -1
  17. package/dist/local-editor-harness.d.ts +15 -2
  18. package/dist/local-editor-harness.d.ts.map +1 -1
  19. package/dist/local-editor-harness.js +310 -21
  20. package/dist/local-editor-harness.js.map +1 -1
  21. package/dist/local-editor-tools.d.ts +1 -0
  22. package/dist/local-editor-tools.d.ts.map +1 -1
  23. package/dist/local-editor-tools.js +3 -0
  24. package/dist/local-editor-tools.js.map +1 -1
  25. package/dist/playable-local-editor-host.d.ts +4 -0
  26. package/dist/playable-local-editor-host.d.ts.map +1 -1
  27. package/dist/playable-local-editor-host.js +27 -0
  28. package/dist/playable-local-editor-host.js.map +1 -1
  29. package/dist/playable-product-scene-capabilities.d.ts.map +1 -1
  30. package/dist/playable-product-scene-capabilities.js +9 -3
  31. package/dist/playable-product-scene-capabilities.js.map +1 -1
  32. package/dist/playable-standard-project.d.ts.map +1 -1
  33. package/dist/playable-standard-project.js +5 -2
  34. package/dist/playable-standard-project.js.map +1 -1
  35. package/node_modules/@fps-games/babylon-renderer/package.json +7 -7
  36. package/node_modules/@fps-games/editor-babylon/dist/marker-overlay.js +24 -0
  37. package/node_modules/@fps-games/editor-babylon/dist/marker-overlay.js.map +1 -1
  38. package/node_modules/@fps-games/editor-babylon/dist/projection.d.ts +10 -1
  39. package/node_modules/@fps-games/editor-babylon/dist/projection.d.ts.map +1 -1
  40. package/node_modules/@fps-games/editor-babylon/dist/projection.js +96 -1
  41. package/node_modules/@fps-games/editor-babylon/dist/projection.js.map +1 -1
  42. package/node_modules/@fps-games/editor-babylon/dist/scene-view-spatial-overlay-controller.d.ts.map +1 -1
  43. package/node_modules/@fps-games/editor-babylon/dist/scene-view-spatial-overlay-controller.js +85 -22
  44. package/node_modules/@fps-games/editor-babylon/dist/scene-view-spatial-overlay-controller.js.map +1 -1
  45. package/node_modules/@fps-games/editor-babylon/dist/selection-presentation-controller.d.ts +2 -0
  46. package/node_modules/@fps-games/editor-babylon/dist/selection-presentation-controller.d.ts.map +1 -1
  47. package/node_modules/@fps-games/editor-babylon/dist/selection-presentation-controller.js +150 -4
  48. package/node_modules/@fps-games/editor-babylon/dist/selection-presentation-controller.js.map +1 -1
  49. package/node_modules/@fps-games/editor-babylon/dist/transform-gizmo-controller.d.ts +1 -0
  50. package/node_modules/@fps-games/editor-babylon/dist/transform-gizmo-controller.d.ts.map +1 -1
  51. package/node_modules/@fps-games/editor-babylon/dist/transform-gizmo-controller.js +249 -15
  52. package/node_modules/@fps-games/editor-babylon/dist/transform-gizmo-controller.js.map +1 -1
  53. package/node_modules/@fps-games/editor-babylon/dist/types.d.ts +1 -1
  54. package/node_modules/@fps-games/editor-babylon/dist/types.d.ts.map +1 -1
  55. package/node_modules/@fps-games/editor-babylon/dist/types.js.map +1 -1
  56. package/node_modules/@fps-games/editor-babylon/package.json +6 -6
  57. package/node_modules/@fps-games/editor-browser/dist/index.d.ts +5 -0
  58. package/node_modules/@fps-games/editor-browser/dist/index.d.ts.map +1 -1
  59. package/node_modules/@fps-games/editor-browser/dist/index.js +3 -0
  60. package/node_modules/@fps-games/editor-browser/dist/index.js.map +1 -1
  61. package/node_modules/@fps-games/editor-browser/dist/local-editor-asset-browser-continuity.d.ts +35 -0
  62. package/node_modules/@fps-games/editor-browser/dist/local-editor-asset-browser-continuity.d.ts.map +1 -0
  63. package/node_modules/@fps-games/editor-browser/dist/local-editor-asset-browser-continuity.js +136 -0
  64. package/node_modules/@fps-games/editor-browser/dist/local-editor-asset-browser-continuity.js.map +1 -0
  65. package/node_modules/@fps-games/editor-browser/dist/local-editor-asset-filesystem.d.ts +46 -0
  66. package/node_modules/@fps-games/editor-browser/dist/local-editor-asset-filesystem.d.ts.map +1 -0
  67. package/node_modules/@fps-games/editor-browser/dist/local-editor-asset-filesystem.js +283 -0
  68. package/node_modules/@fps-games/editor-browser/dist/local-editor-asset-filesystem.js.map +1 -0
  69. package/node_modules/@fps-games/editor-browser/dist/local-editor-preview-cleanup-registry.d.ts +12 -0
  70. package/node_modules/@fps-games/editor-browser/dist/local-editor-preview-cleanup-registry.d.ts.map +1 -0
  71. package/node_modules/@fps-games/editor-browser/dist/local-editor-preview-cleanup-registry.js +67 -0
  72. package/node_modules/@fps-games/editor-browser/dist/local-editor-preview-cleanup-registry.js.map +1 -0
  73. package/node_modules/@fps-games/editor-browser/dist/local-editor-project-file-open.d.ts +6 -0
  74. package/node_modules/@fps-games/editor-browser/dist/local-editor-project-file-open.d.ts.map +1 -0
  75. package/node_modules/@fps-games/editor-browser/dist/local-editor-project-file-open.js +9 -0
  76. package/node_modules/@fps-games/editor-browser/dist/local-editor-project-file-open.js.map +1 -0
  77. package/node_modules/@fps-games/editor-browser/dist/local-editor-project-file-preview.d.ts +7 -0
  78. package/node_modules/@fps-games/editor-browser/dist/local-editor-project-file-preview.d.ts.map +1 -0
  79. package/node_modules/@fps-games/editor-browser/dist/local-editor-project-file-preview.js +20 -0
  80. package/node_modules/@fps-games/editor-browser/dist/local-editor-project-file-preview.js.map +1 -0
  81. package/node_modules/@fps-games/editor-browser/dist/local-editor-project-media-thumbnail-cache.d.ts +9 -0
  82. package/node_modules/@fps-games/editor-browser/dist/local-editor-project-media-thumbnail-cache.d.ts.map +1 -0
  83. package/node_modules/@fps-games/editor-browser/dist/local-editor-project-media-thumbnail-cache.js +219 -0
  84. package/node_modules/@fps-games/editor-browser/dist/local-editor-project-media-thumbnail-cache.js.map +1 -0
  85. package/node_modules/@fps-games/editor-browser/dist/local-editor-tool-presentation.d.ts +14 -0
  86. package/node_modules/@fps-games/editor-browser/dist/local-editor-tool-presentation.d.ts.map +1 -0
  87. package/node_modules/@fps-games/editor-browser/dist/local-editor-tool-presentation.js +42 -0
  88. package/node_modules/@fps-games/editor-browser/dist/local-editor-tool-presentation.js.map +1 -0
  89. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-asset-kind.d.ts.map +1 -1
  90. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-asset-kind.js +2 -0
  91. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-asset-kind.js.map +1 -1
  92. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-console.d.ts +27 -0
  93. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-console.d.ts.map +1 -0
  94. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-console.js +288 -0
  95. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-console.js.map +1 -0
  96. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-icons.d.ts +1 -1
  97. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-icons.d.ts.map +1 -1
  98. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-icons.js +29 -0
  99. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-icons.js.map +1 -1
  100. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-panels.d.ts +20 -1
  101. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-panels.d.ts.map +1 -1
  102. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-panels.js +321 -60
  103. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-panels.js.map +1 -1
  104. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-prefab-stage.d.ts +2 -1
  105. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-prefab-stage.d.ts.map +1 -1
  106. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-prefab-stage.js +4 -2
  107. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-prefab-stage.js.map +1 -1
  108. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-types.d.ts +63 -3
  109. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-types.d.ts.map +1 -1
  110. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-types.js.map +1 -1
  111. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-workbench.d.ts +9 -0
  112. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-workbench.d.ts.map +1 -1
  113. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-workbench.js +88 -16
  114. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui-workbench.js.map +1 -1
  115. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui.d.ts +2 -1
  116. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui.d.ts.map +1 -1
  117. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui.js +1463 -356
  118. package/node_modules/@fps-games/editor-browser/dist/local-editor-ui.js.map +1 -1
  119. package/node_modules/@fps-games/editor-browser/dist/local-editor-viewport-orientation.d.ts +13 -0
  120. package/node_modules/@fps-games/editor-browser/dist/local-editor-viewport-orientation.d.ts.map +1 -0
  121. package/node_modules/@fps-games/editor-browser/dist/local-editor-viewport-orientation.js +15 -0
  122. package/node_modules/@fps-games/editor-browser/dist/local-editor-viewport-orientation.js.map +1 -0
  123. package/node_modules/@fps-games/editor-browser/package.json +7 -7
  124. package/node_modules/@fps-games/editor-core/dist/editor-tools.d.ts +1 -0
  125. package/node_modules/@fps-games/editor-core/dist/editor-tools.d.ts.map +1 -1
  126. package/node_modules/@fps-games/editor-core/dist/editor-tools.js +3 -1
  127. package/node_modules/@fps-games/editor-core/dist/editor-tools.js.map +1 -1
  128. package/node_modules/@fps-games/editor-core/dist/viewport-tools.d.ts +11 -2
  129. package/node_modules/@fps-games/editor-core/dist/viewport-tools.d.ts.map +1 -1
  130. package/node_modules/@fps-games/editor-core/dist/viewport-tools.js +12 -1
  131. package/node_modules/@fps-games/editor-core/dist/viewport-tools.js.map +1 -1
  132. package/node_modules/@fps-games/editor-core/package.json +6 -6
  133. package/node_modules/@fps-games/editor-forge-play/package.json +2 -2
  134. package/node_modules/@fps-games/editor-playable-sdk/dist/asset-library/catalog.d.ts +1 -0
  135. package/node_modules/@fps-games/editor-playable-sdk/dist/asset-library/catalog.d.ts.map +1 -1
  136. package/node_modules/@fps-games/editor-playable-sdk/dist/asset-library/catalog.js +5 -0
  137. package/node_modules/@fps-games/editor-playable-sdk/dist/asset-library/catalog.js.map +1 -1
  138. package/node_modules/@fps-games/editor-playable-sdk/dist/asset-library/index.d.ts +1 -1
  139. package/node_modules/@fps-games/editor-playable-sdk/dist/asset-library/index.d.ts.map +1 -1
  140. package/node_modules/@fps-games/editor-playable-sdk/dist/asset-library/index.js +1 -1
  141. package/node_modules/@fps-games/editor-playable-sdk/dist/asset-library/index.js.map +1 -1
  142. package/node_modules/@fps-games/editor-playable-sdk/dist/authoring-server/handler.d.ts.map +1 -1
  143. package/node_modules/@fps-games/editor-playable-sdk/dist/authoring-server/handler.js +15 -1
  144. package/node_modules/@fps-games/editor-playable-sdk/dist/authoring-server/handler.js.map +1 -1
  145. package/node_modules/@fps-games/editor-playable-sdk/dist/authoring-server/routes.d.ts.map +1 -1
  146. package/node_modules/@fps-games/editor-playable-sdk/dist/authoring-server/routes.js +3 -0
  147. package/node_modules/@fps-games/editor-playable-sdk/dist/authoring-server/routes.js.map +1 -1
  148. package/node_modules/@fps-games/editor-playable-sdk/dist/authoring-server/types.d.ts +6 -1
  149. package/node_modules/@fps-games/editor-playable-sdk/dist/authoring-server/types.d.ts.map +1 -1
  150. package/node_modules/@fps-games/editor-playable-sdk/dist/authoring-server/types.js.map +1 -1
  151. package/node_modules/@fps-games/editor-playable-sdk/dist/index.d.ts +1 -0
  152. package/node_modules/@fps-games/editor-playable-sdk/dist/index.d.ts.map +1 -1
  153. package/node_modules/@fps-games/editor-playable-sdk/dist/index.js +1 -0
  154. package/node_modules/@fps-games/editor-playable-sdk/dist/index.js.map +1 -1
  155. package/node_modules/@fps-games/editor-playable-sdk/dist/product/scene-source.d.ts +4 -0
  156. package/node_modules/@fps-games/editor-playable-sdk/dist/product/scene-source.d.ts.map +1 -1
  157. package/node_modules/@fps-games/editor-playable-sdk/dist/product/scene-source.js +10 -1
  158. package/node_modules/@fps-games/editor-playable-sdk/dist/product/scene-source.js.map +1 -1
  159. package/node_modules/@fps-games/editor-playable-sdk/dist/project-files/index.d.ts +4 -0
  160. package/node_modules/@fps-games/editor-playable-sdk/dist/project-files/index.d.ts.map +1 -0
  161. package/node_modules/@fps-games/editor-playable-sdk/dist/project-files/index.js +4 -0
  162. package/node_modules/@fps-games/editor-playable-sdk/dist/project-files/index.js.map +1 -0
  163. package/node_modules/@fps-games/editor-playable-sdk/dist/project-files/protocol.d.ts +4 -0
  164. package/node_modules/@fps-games/editor-playable-sdk/dist/project-files/protocol.d.ts.map +1 -0
  165. package/node_modules/@fps-games/editor-playable-sdk/dist/project-files/protocol.js +86 -0
  166. package/node_modules/@fps-games/editor-playable-sdk/dist/project-files/protocol.js.map +1 -0
  167. package/node_modules/@fps-games/editor-playable-sdk/dist/project-files/support.d.ts +9 -0
  168. package/node_modules/@fps-games/editor-playable-sdk/dist/project-files/support.d.ts.map +1 -0
  169. package/node_modules/@fps-games/editor-playable-sdk/dist/project-files/support.js +76 -0
  170. package/node_modules/@fps-games/editor-playable-sdk/dist/project-files/support.js.map +1 -0
  171. package/node_modules/@fps-games/editor-playable-sdk/dist/project-files/types.d.ts +34 -0
  172. package/node_modules/@fps-games/editor-playable-sdk/dist/project-files/types.d.ts.map +1 -0
  173. package/node_modules/@fps-games/editor-playable-sdk/dist/project-files/types.js +2 -0
  174. package/node_modules/@fps-games/editor-playable-sdk/dist/project-files/types.js.map +1 -0
  175. package/node_modules/@fps-games/editor-playable-sdk/dist/scene-source/client.d.ts +4 -0
  176. package/node_modules/@fps-games/editor-playable-sdk/dist/scene-source/client.d.ts.map +1 -1
  177. package/node_modules/@fps-games/editor-playable-sdk/dist/scene-source/client.js +40 -0
  178. package/node_modules/@fps-games/editor-playable-sdk/dist/scene-source/client.js.map +1 -1
  179. package/node_modules/@fps-games/editor-playable-sdk/dist/vite/index.d.ts +1 -0
  180. package/node_modules/@fps-games/editor-playable-sdk/dist/vite/index.d.ts.map +1 -1
  181. package/node_modules/@fps-games/editor-playable-sdk/dist/vite/index.js +1 -0
  182. package/node_modules/@fps-games/editor-playable-sdk/dist/vite/index.js.map +1 -1
  183. package/node_modules/@fps-games/editor-playable-sdk/dist/vite/product-authoring-api.d.ts +1 -0
  184. package/node_modules/@fps-games/editor-playable-sdk/dist/vite/product-authoring-api.d.ts.map +1 -1
  185. package/node_modules/@fps-games/editor-playable-sdk/dist/vite/product-authoring-api.js +94 -0
  186. package/node_modules/@fps-games/editor-playable-sdk/dist/vite/product-authoring-api.js.map +1 -1
  187. package/node_modules/@fps-games/editor-playable-sdk/dist/vite/project-file-handle.d.ts +14 -0
  188. package/node_modules/@fps-games/editor-playable-sdk/dist/vite/project-file-handle.d.ts.map +1 -0
  189. package/node_modules/@fps-games/editor-playable-sdk/dist/vite/project-file-handle.js +101 -0
  190. package/node_modules/@fps-games/editor-playable-sdk/dist/vite/project-file-handle.js.map +1 -0
  191. package/node_modules/@fps-games/editor-playable-sdk/dist/vite/project-files.d.ts +23 -0
  192. package/node_modules/@fps-games/editor-playable-sdk/dist/vite/project-files.d.ts.map +1 -0
  193. package/node_modules/@fps-games/editor-playable-sdk/dist/vite/project-files.js +180 -0
  194. package/node_modules/@fps-games/editor-playable-sdk/dist/vite/project-files.js.map +1 -0
  195. package/node_modules/@fps-games/editor-playable-sdk/package.json +6 -6
  196. package/node_modules/@fps-games/editor-protocol/dist/agent.d.ts +23 -3
  197. package/node_modules/@fps-games/editor-protocol/dist/agent.d.ts.map +1 -1
  198. package/node_modules/@fps-games/editor-protocol/dist/agent.js.map +1 -1
  199. package/node_modules/@fps-games/editor-protocol/package.json +2 -2
  200. package/node_modules/@fps-games/editor-tooling/package.json +3 -3
  201. package/node_modules/@fps-games/editor-ui/dist/editor-ui-theme.d.ts.map +1 -1
  202. package/node_modules/@fps-games/editor-ui/dist/editor-ui-theme.js +103 -10
  203. package/node_modules/@fps-games/editor-ui/dist/editor-ui-theme.js.map +1 -1
  204. package/node_modules/@fps-games/editor-ui/package.json +1 -1
  205. package/node_modules/@fps-games/playable-assets/package.json +1 -1
  206. package/node_modules/@fps-games/playable-contracts/package.json +1 -1
  207. package/node_modules/@fps-games/playable-rendering/package.json +2 -2
  208. package/node_modules/@fps-games/playable-runtime/package.json +12 -12
  209. package/node_modules/@fps-games/playable-runtime-data/package.json +4 -4
  210. package/node_modules/@fps-games/playable-scene/package.json +2 -2
  211. package/node_modules/@fps-games/plugin-api/package.json +1 -1
  212. package/node_modules/@fps-games/plugin-assets/dist/version.d.ts +1 -1
  213. package/node_modules/@fps-games/plugin-assets/dist/version.js +1 -1
  214. package/node_modules/@fps-games/plugin-assets/dist/version.js.map +1 -1
  215. package/node_modules/@fps-games/plugin-assets/package.json +5 -5
  216. package/node_modules/@fps-games/plugin-hierarchy/dist/version.d.ts +1 -1
  217. package/node_modules/@fps-games/plugin-hierarchy/dist/version.js +1 -1
  218. package/node_modules/@fps-games/plugin-hierarchy/dist/version.js.map +1 -1
  219. package/node_modules/@fps-games/plugin-hierarchy/package.json +5 -5
  220. package/node_modules/@fps-games/plugin-host/package.json +2 -2
  221. package/node_modules/@fps-games/plugin-markers/dist/version.d.ts +1 -1
  222. package/node_modules/@fps-games/plugin-markers/dist/version.js +1 -1
  223. package/node_modules/@fps-games/plugin-markers/dist/version.js.map +1 -1
  224. package/node_modules/@fps-games/plugin-markers/package.json +5 -5
  225. package/node_modules/@fps-games/plugin-materials/dist/version.d.ts +1 -1
  226. package/node_modules/@fps-games/plugin-materials/dist/version.js +1 -1
  227. package/node_modules/@fps-games/plugin-materials/dist/version.js.map +1 -1
  228. package/node_modules/@fps-games/plugin-materials/package.json +5 -5
  229. package/node_modules/@fps-games/plugin-rendering/dist/version.d.ts +1 -1
  230. package/node_modules/@fps-games/plugin-rendering/dist/version.js +1 -1
  231. package/node_modules/@fps-games/plugin-rendering/dist/version.js.map +1 -1
  232. package/node_modules/@fps-games/plugin-rendering/package.json +5 -5
  233. package/node_modules/@fps-games/plugin-scene/dist/version.d.ts +1 -1
  234. package/node_modules/@fps-games/plugin-scene/dist/version.js +1 -1
  235. package/node_modules/@fps-games/plugin-scene/dist/version.js.map +1 -1
  236. package/node_modules/@fps-games/plugin-scene/package.json +5 -5
  237. package/node_modules/@fps-games/plugin-shadow-map-experiment/dist/version.d.ts +1 -1
  238. package/node_modules/@fps-games/plugin-shadow-map-experiment/dist/version.js +1 -1
  239. package/node_modules/@fps-games/plugin-shadow-map-experiment/dist/version.js.map +1 -1
  240. package/node_modules/@fps-games/plugin-shadow-map-experiment/package.json +5 -5
  241. package/node_modules/@fps-games/plugin-shadows/dist/version.d.ts +1 -1
  242. package/node_modules/@fps-games/plugin-shadows/dist/version.js +1 -1
  243. package/node_modules/@fps-games/plugin-shadows/dist/version.js.map +1 -1
  244. package/node_modules/@fps-games/plugin-shadows/package.json +7 -7
  245. package/package.json +22 -22
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.js","sourceRoot":"","sources":["../../src/project-files/protocol.ts"],"names":[],"mappings":"AAMA,MAAM,UAAU,6BAA6B,CAAC,KAAc;IAC1D,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;IACjC,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I,CAAC,IAAI,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACrH,MAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAClC,IAAI,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,OAAO,IAAI,OAAO,KAAK,GAAG,IAAI,OAAO,KAAK,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IAC3F,OAAO,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC5B,CAAC","sourcesContent":["import type {\n EditorProjectFileContent,\n EditorProjectFileEntry,\n EditorProjectFileSnapshot,\n} from './types';\n\nexport function readEditorProjectFileSnapshot(value: unknown): EditorProjectFileSnapshot {\n const record = readRecord(value);\n const entries = Array.isArray(record?.entries)\n ? record.entries.flatMap(readEditorProjectFileEntry)\n : [];\n return {\n rootName: readNonEmptyString(record?.rootName) ?? 'Project',\n entries,\n truncated: record?.truncated === true,\n };\n}\n\nexport function readEditorProjectFileContent(value: unknown): EditorProjectFileContent {\n const record = readRecord(value);\n const path = readCanonicalProjectRelativePath(record?.path);\n const name = readNonEmptyString(record?.name);\n const extension = typeof record?.extension === 'string' ? record.extension : null;\n const language = readNonEmptyString(record?.language);\n const text = typeof record?.text === 'string' ? record.text : null;\n const size = typeof record?.size === 'number' && Number.isSafeInteger(record.size) && record.size >= 0\n ? record.size\n : null;\n if (!path || !name || extension === null || !language || text === null || size === null) {\n throw new Error('schema.invalidProjectFileContent');\n }\n const pathSegments = path.split('/');\n if (name !== pathSegments[pathSegments.length - 1]) throw new Error('schema.invalidProjectFileContent');\n return {\n path,\n name,\n extension,\n language,\n text,\n size,\n truncated: record?.truncated === true,\n };\n}\n\nfunction readEditorProjectFileEntry(value: unknown): EditorProjectFileEntry[] {\n const record = readRecord(value);\n if (!record) return [];\n const path = readCanonicalProjectRelativePath(record?.path);\n const name = readNonEmptyString(record?.name);\n const kind = record?.kind === 'directory' || record?.kind === 'file'\n ? record.kind\n : null;\n const pathSegments = path?.split('/') ?? [];\n if (!path || !name || !kind || name !== pathSegments[pathSegments.length - 1]) return [];\n if (!Object.prototype.hasOwnProperty.call(record, 'parentPath')) return [];\n const parentPath = record.parentPath === null\n ? null\n : readCanonicalProjectRelativePath(record.parentPath);\n const separatorIndex = path.lastIndexOf('/');\n const expectedParentPath = separatorIndex >= 0 ? path.slice(0, separatorIndex) : null;\n if (parentPath !== expectedParentPath) return [];\n const extension = readNonEmptyString(record?.extension);\n return [{\n path,\n name,\n parentPath,\n kind,\n ...(extension ? { extension } : {}),\n }];\n}\n\nfunction readRecord(value: unknown): Record<string, unknown> | null {\n return value && typeof value === 'object' && !Array.isArray(value)\n ? value as Record<string, unknown>\n : null;\n}\n\nfunction readNonEmptyString(value: unknown): string | null {\n return typeof value === 'string' && value.trim() ? value.trim() : null;\n}\n\nfunction readCanonicalProjectRelativePath(value: unknown): string | null {\n if (typeof value !== 'string' || !value || value !== value.trim()) return null;\n if (value.includes('\\0') || value.includes('\\\\') || value.startsWith('/') || /^[A-Za-z]:\\//.test(value)) return null;\n const segments = value.split('/');\n if (segments.some(segment => !segment || segment === '.' || segment === '..')) return null;\n return segments.join('/');\n}\n"]}
@@ -0,0 +1,9 @@
1
+ export declare function resolveEditorProjectFileExtension(filePath: string): string;
2
+ export declare function resolveEditorProjectFileLanguage(filePath: string): string | null;
3
+ export declare function isEditorProjectFilePreviewable(filePath: string): boolean;
4
+ export declare function resolveEditorProjectMediaSupport(filePath: string): {
5
+ kind: 'image' | 'model' | 'audio';
6
+ mimeType: string;
7
+ } | null;
8
+ export declare function isEditorProjectMediaPreviewable(filePath: string): boolean;
9
+ //# sourceMappingURL=support.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"support.d.ts","sourceRoot":"","sources":["../../src/project-files/support.ts"],"names":[],"mappings":"AAuDA,wBAAgB,iCAAiC,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAK1E;AAED,wBAAgB,gCAAgC,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAMhF;AAED,wBAAgB,8BAA8B,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAExE;AAED,wBAAgB,gCAAgC,CAAC,QAAQ,EAAE,MAAM,GAAG;IAClE,IAAI,EAAE,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;IAClC,QAAQ,EAAE,MAAM,CAAC;CAClB,GAAG,IAAI,CAGP;AAED,wBAAgB,+BAA+B,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAEzE"}
@@ -0,0 +1,76 @@
1
+ const PROJECT_FILE_LANGUAGE_BY_EXTENSION = Object.freeze({
2
+ bash: 'shell',
3
+ cjs: 'javascript',
4
+ conf: 'config',
5
+ config: 'config',
6
+ css: 'css',
7
+ env: 'dotenv',
8
+ htm: 'html',
9
+ html: 'html',
10
+ ini: 'config',
11
+ js: 'javascript',
12
+ json: 'json',
13
+ jsonc: 'jsonc',
14
+ jsx: 'javascript',
15
+ less: 'less',
16
+ md: 'markdown',
17
+ mjs: 'javascript',
18
+ scss: 'scss',
19
+ sh: 'shell',
20
+ toml: 'toml',
21
+ ts: 'typescript',
22
+ tsx: 'typescript',
23
+ txt: 'text',
24
+ xml: 'xml',
25
+ yaml: 'yaml',
26
+ yml: 'yaml',
27
+ zsh: 'shell',
28
+ });
29
+ const PROJECT_FILE_LANGUAGE_BY_NAME = Object.freeze({
30
+ '.env': 'dotenv',
31
+ '.eslintignore': 'config',
32
+ '.gitignore': 'config',
33
+ '.npmrc': 'config',
34
+ '.prettierignore': 'config',
35
+ dockerfile: 'dockerfile',
36
+ makefile: 'makefile',
37
+ });
38
+ const PROJECT_MEDIA_BY_EXTENSION = Object.freeze({
39
+ png: { kind: 'image', mimeType: 'image/png' },
40
+ jpg: { kind: 'image', mimeType: 'image/jpeg' },
41
+ jpeg: { kind: 'image', mimeType: 'image/jpeg' },
42
+ webp: { kind: 'image', mimeType: 'image/webp' },
43
+ gif: { kind: 'image', mimeType: 'image/gif' },
44
+ bmp: { kind: 'image', mimeType: 'image/bmp' },
45
+ glb: { kind: 'model', mimeType: 'model/gltf-binary' },
46
+ mp3: { kind: 'audio', mimeType: 'audio/mpeg' },
47
+ wav: { kind: 'audio', mimeType: 'audio/wav' },
48
+ ogg: { kind: 'audio', mimeType: 'audio/ogg' },
49
+ m4a: { kind: 'audio', mimeType: 'audio/mp4' },
50
+ aac: { kind: 'audio', mimeType: 'audio/aac' },
51
+ flac: { kind: 'audio', mimeType: 'audio/flac' },
52
+ });
53
+ export function resolveEditorProjectFileExtension(filePath) {
54
+ const segments = filePath.replace(/\\/g, '/').split('/');
55
+ const name = segments[segments.length - 1]?.toLowerCase() ?? '';
56
+ const dotIndex = name.lastIndexOf('.');
57
+ return dotIndex > 0 ? name.slice(dotIndex + 1) : '';
58
+ }
59
+ export function resolveEditorProjectFileLanguage(filePath) {
60
+ const segments = filePath.replace(/\\/g, '/').split('/');
61
+ const name = segments[segments.length - 1]?.toLowerCase() ?? '';
62
+ return PROJECT_FILE_LANGUAGE_BY_NAME[name]
63
+ ?? PROJECT_FILE_LANGUAGE_BY_EXTENSION[resolveEditorProjectFileExtension(name)]
64
+ ?? null;
65
+ }
66
+ export function isEditorProjectFilePreviewable(filePath) {
67
+ return resolveEditorProjectFileLanguage(filePath) !== null;
68
+ }
69
+ export function resolveEditorProjectMediaSupport(filePath) {
70
+ return PROJECT_MEDIA_BY_EXTENSION[resolveEditorProjectFileExtension(filePath)]
71
+ ?? null;
72
+ }
73
+ export function isEditorProjectMediaPreviewable(filePath) {
74
+ return resolveEditorProjectMediaSupport(filePath) !== null;
75
+ }
76
+ //# sourceMappingURL=support.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"support.js","sourceRoot":"","sources":["../../src/project-files/support.ts"],"names":[],"mappings":"AAAA,MAAM,kCAAkC,GAAqC,MAAM,CAA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Q,GAAG,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACzD,MAAM,IAAI,GAAG,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;IAChE,OAAO,6BAA6B,CAAC,IAAI,CAAC;WACrC,kCAAkC,CAAC,iCAAiC,CAAC,IAAI,CAAC,CAAC;WAC3E,IAAI,CAAC;AACZ,CAAC;AAED,MAAM,UAAU,8BAA8B,CAAC,QAAgB;IAC7D,OAAO,gCAAgC,CAAC,QAAQ,CAAC,KAAK,IAAI,CAAC;AAC7D,CAAC;AAED,MAAM,UAAU,gCAAgC,CAAC,QAAgB;IAI/D,OAAO,0BAA0B,CAAC,iCAAiC,CAAC,QAAQ,CAA4C,CAAC;WACpH,IAAI,CAAC;AACZ,CAAC;AAED,MAAM,UAAU,+BAA+B,CAAC,QAAgB;IAC9D,OAAO,gCAAgC,CAAC,QAAQ,CAAC,KAAK,IAAI,CAAC;AAC7D,CAAC","sourcesContent":["const PROJECT_FILE_LANGUAGE_BY_EXTENSION: Readonly<Record<string, string>> = Object.freeze({\n bash: 'shell',\n cjs: 'javascript',\n conf: 'config',\n config: 'config',\n css: 'css',\n env: 'dotenv',\n htm: 'html',\n html: 'html',\n ini: 'config',\n js: 'javascript',\n json: 'json',\n jsonc: 'jsonc',\n jsx: 'javascript',\n less: 'less',\n md: 'markdown',\n mjs: 'javascript',\n scss: 'scss',\n sh: 'shell',\n toml: 'toml',\n ts: 'typescript',\n tsx: 'typescript',\n txt: 'text',\n xml: 'xml',\n yaml: 'yaml',\n yml: 'yaml',\n zsh: 'shell',\n});\n\nconst PROJECT_FILE_LANGUAGE_BY_NAME: Readonly<Record<string, string>> = Object.freeze({\n '.env': 'dotenv',\n '.eslintignore': 'config',\n '.gitignore': 'config',\n '.npmrc': 'config',\n '.prettierignore': 'config',\n dockerfile: 'dockerfile',\n makefile: 'makefile',\n});\n\nconst PROJECT_MEDIA_BY_EXTENSION = Object.freeze({\n png: { kind: 'image', mimeType: 'image/png' },\n jpg: { kind: 'image', mimeType: 'image/jpeg' },\n jpeg: { kind: 'image', mimeType: 'image/jpeg' },\n webp: { kind: 'image', mimeType: 'image/webp' },\n gif: { kind: 'image', mimeType: 'image/gif' },\n bmp: { kind: 'image', mimeType: 'image/bmp' },\n glb: { kind: 'model', mimeType: 'model/gltf-binary' },\n mp3: { kind: 'audio', mimeType: 'audio/mpeg' },\n wav: { kind: 'audio', mimeType: 'audio/wav' },\n ogg: { kind: 'audio', mimeType: 'audio/ogg' },\n m4a: { kind: 'audio', mimeType: 'audio/mp4' },\n aac: { kind: 'audio', mimeType: 'audio/aac' },\n flac: { kind: 'audio', mimeType: 'audio/flac' },\n} satisfies Readonly<Record<string, { kind: 'image' | 'model' | 'audio'; mimeType: string }>>);\n\nexport function resolveEditorProjectFileExtension(filePath: string): string {\n const segments = filePath.replace(/\\\\/g, '/').split('/');\n const name = segments[segments.length - 1]?.toLowerCase() ?? '';\n const dotIndex = name.lastIndexOf('.');\n return dotIndex > 0 ? name.slice(dotIndex + 1) : '';\n}\n\nexport function resolveEditorProjectFileLanguage(filePath: string): string | null {\n const segments = filePath.replace(/\\\\/g, '/').split('/');\n const name = segments[segments.length - 1]?.toLowerCase() ?? '';\n return PROJECT_FILE_LANGUAGE_BY_NAME[name]\n ?? PROJECT_FILE_LANGUAGE_BY_EXTENSION[resolveEditorProjectFileExtension(name)]\n ?? null;\n}\n\nexport function isEditorProjectFilePreviewable(filePath: string): boolean {\n return resolveEditorProjectFileLanguage(filePath) !== null;\n}\n\nexport function resolveEditorProjectMediaSupport(filePath: string): {\n kind: 'image' | 'model' | 'audio';\n mimeType: string;\n} | null {\n return PROJECT_MEDIA_BY_EXTENSION[resolveEditorProjectFileExtension(filePath) as keyof typeof PROJECT_MEDIA_BY_EXTENSION]\n ?? null;\n}\n\nexport function isEditorProjectMediaPreviewable(filePath: string): boolean {\n return resolveEditorProjectMediaSupport(filePath) !== null;\n}\n"]}
@@ -0,0 +1,34 @@
1
+ export type EditorProjectFileEntryKind = 'directory' | 'file';
2
+ export interface EditorProjectFileEntry {
3
+ path: string;
4
+ name: string;
5
+ parentPath: string | null;
6
+ kind: EditorProjectFileEntryKind;
7
+ extension?: string;
8
+ }
9
+ export interface EditorProjectFileSnapshot {
10
+ [key: string]: unknown;
11
+ rootName: string;
12
+ entries: EditorProjectFileEntry[];
13
+ truncated: boolean;
14
+ }
15
+ export interface EditorProjectFileContent {
16
+ [key: string]: unknown;
17
+ path: string;
18
+ name: string;
19
+ extension: string;
20
+ language: string;
21
+ text: string;
22
+ size: number;
23
+ truncated: boolean;
24
+ }
25
+ export type EditorProjectMediaKind = 'image' | 'model' | 'audio';
26
+ export interface EditorProjectMediaSource {
27
+ path: string;
28
+ name: string;
29
+ extension: string;
30
+ kind: EditorProjectMediaKind;
31
+ mimeType: string;
32
+ url: string;
33
+ }
34
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/project-files/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,0BAA0B,GAAG,WAAW,GAAG,MAAM,CAAC;AAE9D,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,IAAI,EAAE,0BAA0B,CAAC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,yBAAyB;IACxC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,sBAAsB,EAAE,CAAC;IAClC,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,wBAAwB;IACvC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,MAAM,sBAAsB,GAAG,OAAO,GAAG,OAAO,GAAG,OAAO,CAAC;AAEjE,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,sBAAsB,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;CACb"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/project-files/types.ts"],"names":[],"mappings":"","sourcesContent":["export type EditorProjectFileEntryKind = 'directory' | 'file';\n\nexport interface EditorProjectFileEntry {\n path: string;\n name: string;\n parentPath: string | null;\n kind: EditorProjectFileEntryKind;\n extension?: string;\n}\n\nexport interface EditorProjectFileSnapshot {\n [key: string]: unknown;\n rootName: string;\n entries: EditorProjectFileEntry[];\n truncated: boolean;\n}\n\nexport interface EditorProjectFileContent {\n [key: string]: unknown;\n path: string;\n name: string;\n extension: string;\n language: string;\n text: string;\n size: number;\n truncated: boolean;\n}\n\nexport type EditorProjectMediaKind = 'image' | 'model' | 'audio';\n\nexport interface EditorProjectMediaSource {\n path: string;\n name: string;\n extension: string;\n kind: EditorProjectMediaKind;\n mimeType: string;\n url: string;\n}\n"]}
@@ -1,6 +1,10 @@
1
1
  import type { EditorSceneAssetLibraryItem, EditorSceneDocument } from '../document';
2
+ import { type EditorProjectFileContent, type EditorProjectFileSnapshot, type EditorProjectMediaSource } from '../project-files/index';
2
3
  import type { SceneMainSourceClientOptions, SceneMainSourceDriverLoadResult, SceneMainSourceSaveOptions, SceneMainSourceSaveResult, SceneSourceFetchJson } from './types';
3
4
  export declare function loadSceneMainSource<TDocument extends EditorSceneDocument = EditorSceneDocument>(options?: SceneMainSourceClientOptions | SceneSourceFetchJson): Promise<SceneMainSourceDriverLoadResult<TDocument>>;
4
5
  export declare function saveSceneMainSource<TDocument extends EditorSceneDocument = EditorSceneDocument>(editorScene: TDocument, options?: SceneMainSourceSaveOptions): Promise<SceneMainSourceSaveResult<TDocument>>;
5
6
  export declare function loadEditorAssetLibrary(options?: SceneMainSourceClientOptions | SceneSourceFetchJson): Promise<EditorSceneAssetLibraryItem[]>;
7
+ export declare function loadEditorProjectFiles(options?: SceneMainSourceClientOptions | SceneSourceFetchJson): Promise<EditorProjectFileSnapshot>;
8
+ export declare function loadEditorProjectFile(path: string, options?: SceneMainSourceClientOptions | SceneSourceFetchJson): Promise<EditorProjectFileContent>;
9
+ export declare function resolveEditorProjectMediaSource(path: string, options?: Pick<SceneMainSourceClientOptions, 'endpointBase'>): EditorProjectMediaSource | null;
6
10
  //# sourceMappingURL=client.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/scene-source/client.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,2BAA2B,EAC3B,mBAAmB,EACpB,MAAM,aAAa,CAAC;AA0BrB,OAAO,KAAK,EACV,4BAA4B,EAC5B,+BAA+B,EAC/B,0BAA0B,EAC1B,yBAAyB,EACzB,oBAAoB,EACrB,MAAM,SAAS,CAAC;AAEjB,wBAAsB,mBAAmB,CACvC,SAAS,SAAS,mBAAmB,GAAG,mBAAmB,EAE3D,OAAO,CAAC,EAAE,4BAA4B,GAAG,oBAAoB,GAC5D,OAAO,CAAC,+BAA+B,CAAC,SAAS,CAAC,CAAC,CAuBrD;AAED,wBAAsB,mBAAmB,CACvC,SAAS,SAAS,mBAAmB,GAAG,mBAA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AM,EACZ,OAAO,CAAC,EAAE,4BAA4B,GAAG,oBAAoB,GAC5D,OAAO,CAAC,wBAAwB,CAAC,CAKnC;AAED,wBAAgB,+BAA+B,CAC7C,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,IAAI,CAAC,4BAA4B,EAAE,cAAc,CAAC,GAC3D,wBAAwB,GAAG,IAAI,CAgBjC"}
@@ -6,6 +6,7 @@ import { createSceneMainSourceSaveCompanionConfigPayload, readSceneMainSourceSav
6
6
  import { readEditorAssetLibrary, readEditorScene, readRuntimeInputDrift, summarizeEditorSceneSource, } from './protocol.js';
7
7
  import { assertPlayableEditorSceneDocumentContract } from '../scene-compiler/validation.js';
8
8
  import { assertShadowMapExperimentConfig, } from '@fps-games/playable-rendering';
9
+ import { resolveEditorProjectFileExtension, resolveEditorProjectMediaSupport, readEditorProjectFileContent, readEditorProjectFileSnapshot, } from '../project-files/index.js';
9
10
  export async function loadSceneMainSource(options) {
10
11
  const client = resolveClientOptions(options);
11
12
  const json = await client.fetchJson(joinEndpoint(client.endpointBase, '/editor-scene'));
@@ -85,6 +86,45 @@ export async function loadEditorAssetLibrary(options) {
85
86
  const json = await client.fetchJson(joinEndpoint(client.endpointBase, '/editor-asset-library'));
86
87
  return readEditorAssetLibrary(json.assets);
87
88
  }
89
+ export async function loadEditorProjectFiles(options) {
90
+ const client = resolveClientOptions(options);
91
+ const json = await client.fetchJson(joinEndpoint(client.endpointBase, '/project-files'));
92
+ return readEditorProjectFileSnapshot(json);
93
+ }
94
+ export async function loadEditorProjectFile(path, options) {
95
+ const client = resolveClientOptions(options);
96
+ const endpoint = joinEndpoint(client.endpointBase, `/project-file?path=${encodeURIComponent(path)}`);
97
+ const json = await client.fetchJson(endpoint);
98
+ return readEditorProjectFileContent(json);
99
+ }
100
+ export function resolveEditorProjectMediaSource(path, options) {
101
+ const relativePath = normalizeEditorProjectClientPath(path);
102
+ if (!relativePath)
103
+ return null;
104
+ const support = resolveEditorProjectMediaSupport(relativePath);
105
+ if (!support)
106
+ return null;
107
+ const endpointBase = options?.endpointBase ?? PLAYABLE_AUTHORING_API_BASE;
108
+ const pathSegments = relativePath.split('/');
109
+ const name = pathSegments[pathSegments.length - 1] ?? relativePath;
110
+ return {
111
+ path: relativePath,
112
+ name,
113
+ extension: resolveEditorProjectFileExtension(name),
114
+ kind: support.kind,
115
+ mimeType: support.mimeType,
116
+ url: joinEndpoint(endpointBase, `/project-media?path=${encodeURIComponent(relativePath)}`),
117
+ };
118
+ }
119
+ function normalizeEditorProjectClientPath(value) {
120
+ const normalized = value.trim().replace(/\\/g, '/').replace(/^\/+/, '');
121
+ if (!normalized || /^[A-Za-z]:\//.test(normalized))
122
+ return null;
123
+ const segments = normalized.split('/');
124
+ return segments.some(segment => !segment || segment === '.' || segment === '..')
125
+ ? null
126
+ : segments.join('/');
127
+ }
88
128
  function resolveClientOptions(options) {
89
129
  if (typeof options === 'function') {
90
130
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/scene-source/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0CAA0C,EAC1C,gCAAgC,GACjC,MAAM,cAAc,CAAC;AAKtB,OAAO,EACL,SAAS,EACT,YAAY,EACZ,2BAA2B,GAC5B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EACL,gCAAgC,EAChC,mBAAmB,GACpB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,+CAA+C,EAC/C,uCAAuC,GACxC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,sBAAsB,EACtB,eAAe,EACf,qBAAqB,EACrB,0BAA0B,GAC3B,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,yCAAyC,EAAE,MAAM,8BAA8B,CAAC;AACzF,OAAO,EACL,+BAA+B,GAEhC,MAAM,+BAA+B,CAAC;AASvC,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAGvC,OAA6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AC,SAAS,CAAC,YAAY,CAAC,MAAM,CAAC,YAAY,EAAE,uBAAuB,CAAC,CAAC,CAAC;IAChG,OAAO,sBAAsB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAC7C,CAAC;AAED,SAAS,oBAAoB,CAC3B,OAA6D;IAE7D,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE,CAAC;QAClC,OAAO;YACL,YAAY,EAAE,2BAA2B;YACzC,SAAS,EAAE,OAAO;SACnB,CAAC;IACJ,CAAC;IACD,OAAO;QACL,YAAY,EAAE,OAAO,EAAE,YAAY,IAAI,2BAA2B;QAClE,SAAS,EAAE,OAAO,EAAE,SAAS,IAAI,SAAS;KAC3C,CAAC;AACJ,CAAC","sourcesContent":["import {\n createEditorSceneAuthoringSourceDescriptor,\n ensureEditorSceneAuthoringSource,\n} from '../authoring';\nimport type {\n EditorSceneAssetLibraryItem,\n EditorSceneDocument,\n} from '../document';\nimport {\n fetchJson,\n joinEndpoint,\n PLAYABLE_AUTHORING_API_BASE,\n} from '../shared/http';\nimport { readString } from '../shared/json';\nimport {\n readCompiledRuntimeSceneArtifact,\n summarizeSaveResult,\n} from './artifacts';\nimport {\n createSceneMainSourceSaveCompanionConfigPayload,\n readSceneMainSourceSaveCompanionConfigs,\n} from './companion-configs';\nimport {\n readEditorAssetLibrary,\n readEditorScene,\n readRuntimeInputDrift,\n summarizeEditorSceneSource,\n} from './protocol';\nimport { assertPlayableEditorSceneDocumentContract } from '../scene-compiler/validation';\nimport {\n assertShadowMapExperimentConfig,\n type ShadowMapExperimentConfig,\n} from '@fps-games/playable-rendering';\nimport type {\n SceneMainSourceClientOptions,\n SceneMainSourceDriverLoadResult,\n SceneMainSourceSaveOptions,\n SceneMainSourceSaveResult,\n SceneSourceFetchJson,\n} from './types';\n\nexport async function loadSceneMainSource<\n TDocument extends EditorSceneDocument = EditorSceneDocument,\n>(\n options?: SceneMainSourceClientOptions | SceneSourceFetchJson,\n): Promise<SceneMainSourceDriverLoadResult<TDocument>> {\n const client = resolveClientOptions(options);\n const json = await client.fetchJson(joinEndpoint(client.endpointBase, '/editor-scene'));\n const editorScene = readEditorScene<TDocument>(json.editorScene);\n if (!editorScene) throw new Error('project authoring endpoint did not return editorScene');\n const document = ensureEditorSceneAuthoringSource(editorScene);\n const drift = readRuntimeInputDrift(json.drift);\n const companionConfigs = readSceneMainSourceSaveCompanionConfigs(json);\n const renderingConfig = companionConfigs.rendering ?? undefined;\n const shadowMapExperimentConfig = readSceneMainSourceShadowMapExperimentConfig(json);\n const assets = Object.prototype.hasOwnProperty.call(json, 'assets')\n ? readEditorAssetLibrary(json.assets)\n : undefined;\n return {\n source: createEditorSceneAuthoringSourceDescriptor(document, readString(json.editorScenePath)),\n document,\n ...(assets ? { assets } : {}),\n drift,\n companionConfigs,\n ...(renderingConfig ? { renderingConfig } : {}),\n ...(shadowMapExperimentConfig ? { shadowMapExperimentConfig } : {}),\n summary: summarizeEditorSceneSource(document, drift),\n };\n}\n\nexport async function saveSceneMainSource<\n TDocument extends EditorSceneDocument = EditorSceneDocument,\n>(\n editorScene: TDocument,\n options?: SceneMainSourceSaveOptions,\n): Promise<SceneMainSourceSaveResult<TDocument>> {\n const client = resolveClientOptions(options);\n assertPlayableEditorSceneDocumentContract(editorScene);\n const saved = await client.fetchJson(joinEndpoint(client.endpointBase, '/save-editor-scene'), {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n editorScene,\n mode: options?.mode ?? 'local-commit-save',\n ...createSceneMainSourceSaveCompanionConfigPayload(options),\n }),\n });\n const document = Object.prototype.hasOwnProperty.call(saved, 'editorScene')\n ? readRequiredEditorScene<TDocument>(saved.editorScene, '$.editorScene')\n : editorScene;\n const source = createEditorSceneAuthoringSourceDescriptor(document, readString(saved.editorScenePath));\n const compiledArtifact = readCompiledRuntimeSceneArtifact(saved, source);\n const companionConfigs = readSceneMainSourceSaveCompanionConfigs(saved);\n const renderingConfig = companionConfigs.rendering ?? undefined;\n const shadowMapExperimentConfig = readSceneMainSourceShadowMapExperimentConfig(saved);\n return {\n source,\n document,\n summary: summarizeSaveResult(saved),\n compiledArtifact,\n companionConfigs,\n expectedVersion: typeof saved.expectedVersion === 'number' ? saved.expectedVersion : undefined,\n renderingConfig,\n ...(shadowMapExperimentConfig ? { shadowMapExperimentConfig } : {}),\n sceneJsonText: typeof saved.sceneJsonText === 'string' ? saved.sceneJsonText : undefined,\n };\n}\n\nfunction readSceneMainSourceShadowMapExperimentConfig(\n value: Record<string, unknown>,\n): ShadowMapExperimentConfig | undefined {\n if (!Object.prototype.hasOwnProperty.call(value, 'shadowMapExperimentConfig')) return undefined;\n const config = value.shadowMapExperimentConfig;\n if (config == null) return undefined;\n assertShadowMapExperimentConfig(config);\n return structuredClone(config);\n}\n\nfunction readRequiredEditorScene<TDocument extends EditorSceneDocument>(\n value: unknown,\n path: string,\n): TDocument {\n const document = readEditorScene<TDocument>(value);\n if (document) return document;\n const error = new Error(`schema.invalidType: ${path}`);\n Object.assign(error, { code: 'schema.invalidType', path });\n throw error;\n}\n\nexport async function loadEditorAssetLibrary(\n options?: SceneMainSourceClientOptions | SceneSourceFetchJson,\n): Promise<EditorSceneAssetLibraryItem[]> {\n const client = resolveClientOptions(options);\n const json = await client.fetchJson(joinEndpoint(client.endpointBase, '/editor-asset-library'));\n return readEditorAssetLibrary(json.assets);\n}\n\nfunction resolveClientOptions(\n options?: SceneMainSourceClientOptions | SceneSourceFetchJson,\n): Required<SceneMainSourceClientOptions> {\n if (typeof options === 'function') {\n return {\n endpointBase: PLAYABLE_AUTHORING_API_BASE,\n fetchJson: options,\n };\n }\n return {\n endpointBase: options?.endpointBase ?? PLAYABLE_AUTHORING_API_BASE,\n fetchJson: options?.fetchJson ?? fetchJson,\n };\n}\n"]}
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/scene-source/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0CAA0C,EAC1C,gCAAgC,GACjC,MAAM,cAAc,CAAC;A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U,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACvC,OAAO,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,OAAO,IAAI,OAAO,KAAK,GAAG,IAAI,OAAO,KAAK,IAAI,CAAC;QAC9E,CAAC,CAAC,IAAI;QACN,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACzB,CAAC;AAED,SAAS,oBAAoB,CAC3B,OAA6D;IAE7D,IAAI,OAAO,OAAO,KAAK,UAAU,EAAE,CAAC;QAClC,OAAO;YACL,YAAY,EAAE,2BAA2B;YACzC,SAAS,EAAE,OAAO;SACnB,CAAC;IACJ,CAAC;IACD,OAAO;QACL,YAAY,EAAE,OAAO,EAAE,YAAY,IAAI,2BAA2B;QAClE,SAAS,EAAE,OAAO,EAAE,SAAS,IAAI,SAAS;KAC3C,CAAC;AACJ,CAAC","sourcesContent":["import {\n createEditorSceneAuthoringSourceDescriptor,\n ensureEditorSceneAuthoringSource,\n} from '../authoring';\nimport type {\n EditorSceneAssetLibraryItem,\n EditorSceneDocument,\n} from '../document';\nimport {\n fetchJson,\n joinEndpoint,\n PLAYABLE_AUTHORING_API_BASE,\n} from '../shared/http';\nimport { readString } from '../shared/json';\nimport {\n readCompiledRuntimeSceneArtifact,\n summarizeSaveResult,\n} from './artifacts';\nimport {\n createSceneMainSourceSaveCompanionConfigPayload,\n readSceneMainSourceSaveCompanionConfigs,\n} from './companion-configs';\nimport {\n readEditorAssetLibrary,\n readEditorScene,\n readRuntimeInputDrift,\n summarizeEditorSceneSource,\n} from './protocol';\nimport { assertPlayableEditorSceneDocumentContract } from '../scene-compiler/validation';\nimport {\n assertShadowMapExperimentConfig,\n type ShadowMapExperimentConfig,\n} from '@fps-games/playable-rendering';\nimport {\n resolveEditorProjectFileExtension,\n resolveEditorProjectMediaSupport,\n readEditorProjectFileContent,\n readEditorProjectFileSnapshot,\n type EditorProjectFileContent,\n type EditorProjectFileSnapshot,\n type EditorProjectMediaSource,\n} from '../project-files/index';\nimport type {\n SceneMainSourceClientOptions,\n SceneMainSourceDriverLoadResult,\n SceneMainSourceSaveOptions,\n SceneMainSourceSaveResult,\n SceneSourceFetchJson,\n} from './types';\n\nexport async function loadSceneMainSource<\n TDocument extends EditorSceneDocument = EditorSceneDocument,\n>(\n options?: SceneMainSourceClientOptions | SceneSourceFetchJson,\n): Promise<SceneMainSourceDriverLoadResult<TDocument>> {\n const client = resolveClientOptions(options);\n const json = await client.fetchJson(joinEndpoint(client.endpointBase, '/editor-scene'));\n const editorScene = readEditorScene<TDocument>(json.editorScene);\n if (!editorScene) throw new Error('project authoring endpoint did not return editorScene');\n const document = ensureEditorSceneAuthoringSource(editorScene);\n const drift = readRuntimeInputDrift(json.drift);\n const companionConfigs = readSceneMainSourceSaveCompanionConfigs(json);\n const renderingConfig = companionConfigs.rendering ?? undefined;\n const shadowMapExperimentConfig = readSceneMainSourceShadowMapExperimentConfig(json);\n const assets = Object.prototype.hasOwnProperty.call(json, 'assets')\n ? readEditorAssetLibrary(json.assets)\n : undefined;\n return {\n source: createEditorSceneAuthoringSourceDescriptor(document, readString(json.editorScenePath)),\n document,\n ...(assets ? { assets } : {}),\n drift,\n companionConfigs,\n ...(renderingConfig ? { renderingConfig } : {}),\n ...(shadowMapExperimentConfig ? { shadowMapExperimentConfig } : {}),\n summary: summarizeEditorSceneSource(document, drift),\n };\n}\n\nexport async function saveSceneMainSource<\n TDocument extends EditorSceneDocument = EditorSceneDocument,\n>(\n editorScene: TDocument,\n options?: SceneMainSourceSaveOptions,\n): Promise<SceneMainSourceSaveResult<TDocument>> {\n const client = resolveClientOptions(options);\n assertPlayableEditorSceneDocumentContract(editorScene);\n const saved = await client.fetchJson(joinEndpoint(client.endpointBase, '/save-editor-scene'), {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n editorScene,\n mode: options?.mode ?? 'local-commit-save',\n ...createSceneMainSourceSaveCompanionConfigPayload(options),\n }),\n });\n const document = Object.prototype.hasOwnProperty.call(saved, 'editorScene')\n ? readRequiredEditorScene<TDocument>(saved.editorScene, '$.editorScene')\n : editorScene;\n const source = createEditorSceneAuthoringSourceDescriptor(document, readString(saved.editorScenePath));\n const compiledArtifact = readCompiledRuntimeSceneArtifact(saved, source);\n const companionConfigs = readSceneMainSourceSaveCompanionConfigs(saved);\n const renderingConfig = companionConfigs.rendering ?? undefined;\n const shadowMapExperimentConfig = readSceneMainSourceShadowMapExperimentConfig(saved);\n return {\n source,\n document,\n summary: summarizeSaveResult(saved),\n compiledArtifact,\n companionConfigs,\n expectedVersion: typeof saved.expectedVersion === 'number' ? saved.expectedVersion : undefined,\n renderingConfig,\n ...(shadowMapExperimentConfig ? { shadowMapExperimentConfig } : {}),\n sceneJsonText: typeof saved.sceneJsonText === 'string' ? saved.sceneJsonText : undefined,\n };\n}\n\nfunction readSceneMainSourceShadowMapExperimentConfig(\n value: Record<string, unknown>,\n): ShadowMapExperimentConfig | undefined {\n if (!Object.prototype.hasOwnProperty.call(value, 'shadowMapExperimentConfig')) return undefined;\n const config = value.shadowMapExperimentConfig;\n if (config == null) return undefined;\n assertShadowMapExperimentConfig(config);\n return structuredClone(config);\n}\n\nfunction readRequiredEditorScene<TDocument extends EditorSceneDocument>(\n value: unknown,\n path: string,\n): TDocument {\n const document = readEditorScene<TDocument>(value);\n if (document) return document;\n const error = new Error(`schema.invalidType: ${path}`);\n Object.assign(error, { code: 'schema.invalidType', path });\n throw error;\n}\n\nexport async function loadEditorAssetLibrary(\n options?: SceneMainSourceClientOptions | SceneSourceFetchJson,\n): Promise<EditorSceneAssetLibraryItem[]> {\n const client = resolveClientOptions(options);\n const json = await client.fetchJson(joinEndpoint(client.endpointBase, '/editor-asset-library'));\n return readEditorAssetLibrary(json.assets);\n}\n\nexport async function loadEditorProjectFiles(\n options?: SceneMainSourceClientOptions | SceneSourceFetchJson,\n): Promise<EditorProjectFileSnapshot> {\n const client = resolveClientOptions(options);\n const json = await client.fetchJson(joinEndpoint(client.endpointBase, '/project-files'));\n return readEditorProjectFileSnapshot(json);\n}\n\nexport async function loadEditorProjectFile(\n path: string,\n options?: SceneMainSourceClientOptions | SceneSourceFetchJson,\n): Promise<EditorProjectFileContent> {\n const client = resolveClientOptions(options);\n const endpoint = joinEndpoint(client.endpointBase, `/project-file?path=${encodeURIComponent(path)}`);\n const json = await client.fetchJson(endpoint);\n return readEditorProjectFileContent(json);\n}\n\nexport function resolveEditorProjectMediaSource(\n path: string,\n options?: Pick<SceneMainSourceClientOptions, 'endpointBase'>,\n): EditorProjectMediaSource | null {\n const relativePath = normalizeEditorProjectClientPath(path);\n if (!relativePath) return null;\n const support = resolveEditorProjectMediaSupport(relativePath);\n if (!support) return null;\n const endpointBase = options?.endpointBase ?? PLAYABLE_AUTHORING_API_BASE;\n const pathSegments = relativePath.split('/');\n const name = pathSegments[pathSegments.length - 1] ?? relativePath;\n return {\n path: relativePath,\n name,\n extension: resolveEditorProjectFileExtension(name),\n kind: support.kind,\n mimeType: support.mimeType,\n url: joinEndpoint(endpointBase, `/project-media?path=${encodeURIComponent(relativePath)}`),\n };\n}\n\nfunction normalizeEditorProjectClientPath(value: string): string | null {\n const normalized = value.trim().replace(/\\\\/g, '/').replace(/^\\/+/, '');\n if (!normalized || /^[A-Za-z]:\\//.test(normalized)) return null;\n const segments = normalized.split('/');\n return segments.some(segment => !segment || segment === '.' || segment === '..')\n ? null\n : segments.join('/');\n}\n\nfunction resolveClientOptions(\n options?: SceneMainSourceClientOptions | SceneSourceFetchJson,\n): Required<SceneMainSourceClientOptions> {\n if (typeof options === 'function') {\n return {\n endpointBase: PLAYABLE_AUTHORING_API_BASE,\n fetchJson: options,\n };\n }\n return {\n endpointBase: options?.endpointBase ?? PLAYABLE_AUTHORING_API_BASE,\n fetchJson: options?.fetchJson ?? fetchJson,\n };\n}\n"]}
@@ -9,6 +9,7 @@ export * from './product-asset-authoring';
9
9
  export * from './product-adapter';
10
10
  export * from './product-scene-authoring';
11
11
  export * from './product-rendering-authoring';
12
+ export * from './project-files';
12
13
  export * from './module-invalidation';
13
14
  export * from './session-metadata';
14
15
  export * from './types';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/vite/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,UAAU,CAAC;AACzB,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,SAAS,CAAC;AACxB,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/vite/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,UAAU,CAAC;AACzB,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,SAAS,CAAC;AACxB,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC"}
@@ -9,6 +9,7 @@ export * from './product-asset-authoring.js';
9
9
  export * from './product-adapter.js';
10
10
  export * from './product-scene-authoring.js';
11
11
  export * from './product-rendering-authoring.js';
12
+ export * from './project-files.js';
12
13
  export * from './module-invalidation.js';
13
14
  export * from './session-metadata.js';
14
15
  export * from './types.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/vite/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,UAAU,CAAC;AACzB,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,SAAS,CAAC;AACxB,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC","sourcesContent":["export * from './build-info-core';\nexport * from './build-info-node';\nexport * from './asset-authoring';\nexport * from './authoring-http';\nexport * from './editor-scene-workflow';\nexport * from './plugin';\nexport * from './product-authoring-api';\nexport * from './product-asset-authoring';\nexport * from './product-adapter';\nexport * from './product-scene-authoring';\nexport * from './product-rendering-authoring';\nexport * from './module-invalidation';\nexport * from './session-metadata';\nexport * from './types';\nexport * from '../asset-database/index';\nexport * from '../asset-database/node';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/vite/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,yBAAyB,CAAC;AACxC,cAAc,UAAU,CAAC;AACzB,cAAc,yBAAyB,CAAC;AACxC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,SAAS,CAAC;AACxB,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC","sourcesContent":["export * from './build-info-core';\nexport * from './build-info-node';\nexport * from './asset-authoring';\nexport * from './authoring-http';\nexport * from './editor-scene-workflow';\nexport * from './plugin';\nexport * from './product-authoring-api';\nexport * from './product-asset-authoring';\nexport * from './product-adapter';\nexport * from './product-scene-authoring';\nexport * from './product-rendering-authoring';\nexport * from './project-files';\nexport * from './module-invalidation';\nexport * from './session-metadata';\nexport * from './types';\nexport * from '../asset-database/index';\nexport * from '../asset-database/node';\n"]}
@@ -3,6 +3,7 @@ import { type PlayableAuthoringServerHandlers, type PlayableAuthoringServerRespo
3
3
  import { readPlayableAuthoringJsonBody } from './authoring-http';
4
4
  export interface FpsGameEditorProjectAuthoringApiPluginOptions {
5
5
  projectRoot: string;
6
+ projectMediaMaxBytes?: number;
6
7
  name?: string;
7
8
  createAssetAuthoringHandlers(server: ViteDevServer): Promise<Pick<PlayableAuthoringServerHandlers, 'loadManifest' | 'loadEditorAssetLibrary' | 'runCommand'>>;
8
9
  getAuthoringWrittenFiles?: (server: ViteDevServer) => Promise<readonly string[]>;
@@ -1 +1 @@
1
- {"version":3,"file":"product-authoring-api.d.ts","sourceRoot":"","sources":["../../src/vite/product-authoring-api.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAc,MAAM,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;AAC9D,OAAO,EAEL,KAAK,+BAA+B,EACpC,KAAK,+BAA+B,EACrC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAEL,6BAA6B,EAG9B,MAAM,kBAAkB,CAAC;AAG1B,MAAM,WAAW,6CAA6C;IAC5D,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,4BAA4B,CAAC,MAAM,EAAE,aAAa,GAA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AA4C,CAC1D,OAAO,EAAE,6CAA6C,GACrD,MAAM,CA4MR;AAED,wBAAgB,mCAAmC,CACjD,aAAa,EAAE,MAAM,EACrB,qBAAqB,EAAE,SAAS,MAAM,EAAE,GACvC,OAAO,CAQT"}
@@ -1,8 +1,12 @@
1
1
  import path from 'node:path';
2
2
  import { mkdir, writeFile } from 'node:fs/promises';
3
+ import { pipeline } from 'node:stream/promises';
3
4
  import { handlePlayableAuthoringServerRequest, } from '../authoring-server/index.js';
4
5
  import { createPlayableAuthoringTransportPathNormalizer, readPlayableAuthoringJsonBody, sendPlayableAuthoringHttpResponse, setPlayableAuthoringCorsHeaders, } from './authoring-http.js';
6
+ import { resolveEditorProjectMediaSupport } from '../project-files/index.js';
5
7
  import { resolveFpsGameEditorViteFilePath } from './module-invalidation.js';
8
+ import { closeEditorProjectFileHandle, openVerifiedEditorProjectFile, resolveEditorProjectMediaMaxBytes, } from './project-file-handle.js';
9
+ import { readEditorProjectFile, scanEditorProjectFiles } from './project-files.js';
6
10
  export function createFpsGameEditorProjectAuthoringApiPlugin(options) {
7
11
  let authoringWrittenFilesPromise = Promise.resolve([]);
8
12
  return {
@@ -35,6 +39,90 @@ export function createFpsGameEditorProjectAuthoringApiPlugin(options) {
35
39
  ? pathname
36
40
  .replace(/^\/__fps_editor_authoring/, '') || '/'
37
41
  : '/';
42
+ if (isProjectAuthoringRoute && route === '/project-media') {
43
+ setPlayableAuthoringCorsHeaders(res);
44
+ if (req.method === 'OPTIONS') {
45
+ res.statusCode = 204;
46
+ res.end();
47
+ return;
48
+ }
49
+ if (req.method !== 'GET') {
50
+ sendPlayableAuthoringHttpResponse(res, { statusCode: 405, body: { ok: false, error: 'method_not_allowed' } });
51
+ return;
52
+ }
53
+ const requestedPath = requestUrl.searchParams.get('path')?.trim() ?? '';
54
+ if (!requestedPath) {
55
+ sendPlayableAuthoringHttpResponse(res, { statusCode: 400, body: { ok: false, error: 'missing_file_path' } });
56
+ return;
57
+ }
58
+ try {
59
+ const opened = await openVerifiedEditorProjectFile(options.projectRoot, requestedPath);
60
+ let operationError = null;
61
+ let finalByte = null;
62
+ try {
63
+ const support = resolveEditorProjectMediaSupport(opened.relativePath);
64
+ if (!support)
65
+ throw new Error('project_file_media_unsupported');
66
+ if (opened.stat.size > resolveEditorProjectMediaMaxBytes(options.projectMediaMaxBytes)) {
67
+ throw new Error('project_file_media_too_large');
68
+ }
69
+ const name = path.basename(opened.relativePath);
70
+ res.statusCode = 200;
71
+ res.setHeader('Content-Type', support.mimeType);
72
+ res.setHeader('Content-Length', String(opened.stat.size));
73
+ res.setHeader('Content-Disposition', `inline; filename*=UTF-8''${encodeURIComponent(name)}`);
74
+ res.setHeader('X-Content-Type-Options', 'nosniff');
75
+ if (opened.stat.size > 0) {
76
+ finalByte = Buffer.allocUnsafe(1);
77
+ const read = await opened.handle.read(finalByte, 0, 1, opened.stat.size - 1);
78
+ if (read.bytesRead !== 1)
79
+ throw new Error('project_file_changed_during_read');
80
+ }
81
+ if (opened.stat.size > 1) {
82
+ await pipeline(opened.handle.createReadStream({
83
+ autoClose: false,
84
+ start: 0,
85
+ end: opened.stat.size - 2,
86
+ }), res, { end: false });
87
+ }
88
+ }
89
+ catch (error) {
90
+ operationError = error;
91
+ }
92
+ try {
93
+ await closeEditorProjectFileHandle(opened.handle);
94
+ }
95
+ catch (closeError) {
96
+ if (operationError) {
97
+ const aggregate = new Error('project_file_close_failed');
98
+ aggregate.errors = [operationError, closeError];
99
+ operationError = aggregate;
100
+ }
101
+ else {
102
+ operationError = closeError;
103
+ }
104
+ }
105
+ if (operationError)
106
+ throw operationError;
107
+ if (finalByte)
108
+ res.end(finalByte);
109
+ else
110
+ res.end();
111
+ }
112
+ catch (error) {
113
+ if (!res.headersSent) {
114
+ const errorMessage = error instanceof Error ? error.message : String(error);
115
+ sendPlayableAuthoringHttpResponse(res, {
116
+ statusCode: errorMessage === 'project_file_media_too_large' ? 413 : 404,
117
+ body: { ok: false, error: errorMessage },
118
+ });
119
+ }
120
+ else {
121
+ res.destroy(error instanceof Error ? error : undefined);
122
+ }
123
+ }
124
+ return;
125
+ }
38
126
  if (isProjectAuthoringRoute && route.startsWith('/rendering-profile')) {
39
127
  if (!options.handleRenderingProfileRoute) {
40
128
  next();
@@ -86,6 +174,12 @@ export function createFpsGameEditorProjectAuthoringApiPlugin(options) {
86
174
  throw new Error('asset_library_handler_unavailable');
87
175
  return handlers.loadEditorAssetLibrary(routeInput);
88
176
  },
177
+ async loadProjectFiles() {
178
+ return scanEditorProjectFiles(options.projectRoot);
179
+ },
180
+ async loadProjectFile({ path: requestedPath }) {
181
+ return readEditorProjectFile(options.projectRoot, requestedPath);
182
+ },
89
183
  async loadEditorScene() {
90
184
  return options.loadEditorScene(server);
91
185
  },
@@ -1 +1 @@
1
- {"version":3,"file":"product-authoring-api.js","sourceRoot":"","sources":["../../src/vite/product-authoring-api.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,EACL,oCAAoC,GAGrC,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,8CAA8C,EAC9C,6BAA6B,EAC7B,iCAAiC,EACjC,+BAA+B,GAChC,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,gCAAgC,EAAE,MAAM,uBAAuB,CAAC;AA0BzE,MAAM,UAAU,4CAA4C,CAC1D,OAAsD;IAEtD,IAAI,4BAA4B,GAA+B,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IACnF,OAAO;QACL,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,kCAAkC;QACxD,OAAO,EAAE,MAAe;QACxB,KAAK,EAAE,OAAgB;QACvB,KAAK,CAAC,eAAe,CAAC,MAAM;YAC1B,MAAM,6BAA6B,GAAG,OAAO,CAAC,4BAA4B,CAAC,MAAM,CAAC,CAAC;YACnF,IAAI,OAAO,CAAC,wBAAwB,E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AAM,CAAC,CAAC;IAC1C,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;AACxC,CAAC","sourcesContent":["import path from 'node:path';\nimport { mkdir, writeFile } from 'node:fs/promises';\nimport type { HmrContext, Plugin, ViteDevServer } from 'vite';\nimport {\n handlePlayableAuthoringServerRequest,\n type PlayableAuthoringServerHandlers,\n type PlayableAuthoringServerResponse,\n} from '../authoring-server/index';\nimport {\n createPlayableAuthoringTransportPathNormalizer,\n readPlayableAuthoringJsonBody,\n sendPlayableAuthoringHttpResponse,\n setPlayableAuthoringCorsHeaders,\n} from './authoring-http';\nimport { resolveFpsGameEditorViteFilePath } from './module-invalidation';\n\nexport interface FpsGameEditorProjectAuthoringApiPluginOptions {\n projectRoot: string;\n name?: string;\n createAssetAuthoringHandlers(server: ViteDevServer): Promise<Pick<\n PlayableAuthoringServerHandlers,\n 'loadManifest' | 'loadEditorAssetLibrary' | 'runCommand'\n >>;\n getAuthoringWrittenFiles?: (server: ViteDevServer) => Promise<readonly string[]>;\n handleRenderingProfileRoute?: (input: {\n server: ViteDevServer;\n req: unknown;\n readJsonBody: typeof readPlayableAuthoringJsonBody;\n }) => Promise<PlayableAuthoringServerResponse>;\n loadEditorScene(server: ViteDevServer): Promise<Record<string, unknown>>;\n saveEditorScene(input: {\n server: ViteDevServer;\n saveMode: string;\n rawEditorScene: Record<string, unknown>;\n body: Record<string, unknown>;\n }): Promise<Record<string, unknown>>;\n writeFile?: PlayableAuthoringServerHandlers['writeFile'];\n logger?: Pick<Console, 'log' | 'warn'>;\n}\n\nexport function createFpsGameEditorProjectAuthoringApiPlugin(\n options: FpsGameEditorProjectAuthoringApiPluginOptions,\n): Plugin {\n let authoringWrittenFilesPromise: Promise<readonly string[]> = Promise.resolve([]);\n return {\n name: options.name ?? 'fps-editor-project-authoring-api',\n enforce: 'post' as const,\n apply: 'serve' as const,\n async configureServer(server) {\n const assetAuthoringHandlersPromise = options.createAssetAuthoringHandlers(server);\n if (options.getAuthoringWrittenFiles) {\n authoringWrittenFilesPromise = options.getAuthoringWrittenFiles(server)\n .then(paths => paths.map(file => path.resolve(options.projectRoot, file)))\n .then(async (paths) => {\n suppressFpsGameEditorAuthoringFullReloads(server, paths);\n suppressFpsGameEditorAuthoringWatcherAdds(server.watcher, paths);\n await server.watcher?.unwatch?.(paths);\n options.logger?.log?.('[ProjectAuthoring][Vite] watcher and HMR suppressed for authoring-written files', paths);\n return paths;\n })\n .catch((error) => {\n options.logger?.warn?.('[ProjectAuthoring][Vite] failed to resolve authoring files for HMR suppression', error);\n return [];\n });\n await authoringWrittenFilesPromise;\n }\n\n server.middlewares.use(async (req: any, res: any, next: any) => {\n const requestUrl = new URL(req.url ?? '', 'http://localhost');\n const pathname = requestUrl.pathname;\n const isProjectAuthoringRoute = pathname.startsWith('/__fps_editor_authoring');\n const route = isProjectAuthoringRoute\n ? pathname\n .replace(/^\\/__fps_editor_authoring/, '') || '/'\n : '/';\n\n if (isProjectAuthoringRoute && route.startsWith('/rendering-profile')) {\n if (!options.handleRenderingProfileRoute) {\n next();\n return;\n }\n setPlayableAuthoringCorsHeaders(res);\n if (req.method === 'OPTIONS') {\n res.statusCode = 204;\n res.end();\n return;\n }\n\n try {\n const response = await options.handleRenderingProfileRoute({\n server,\n req,\n readJsonBody: readPlayableAuthoringJsonBody,\n });\n sendPlayableAuthoringHttpResponse(res, response);\n } catch (error) {\n sendPlayableAuthoringHttpResponse(res, {\n statusCode: 500,\n body: {\n ok: false,\n error: error instanceof Error ? error.message : String(error),\n details: (error as any)?.details,\n },\n });\n }\n return;\n }\n\n const response = await handlePlayableAuthoringServerRequest({\n url: req.url ?? '',\n method: req.method ?? 'GET',\n }, {\n readBody: () => readPlayableAuthoringJsonBody(req),\n normalizeTransportPath: createPlayableAuthoringTransportPathNormalizer(options.projectRoot, {\n relativeRoot: '.platform-sim',\n }),\n async loadManifest(routeInput) {\n const handlers = await assetAuthoringHandlersPromise;\n if (!handlers.loadManifest) throw new Error('asset_manifest_handler_unavailable');\n return handlers.loadManifest(routeInput);\n },\n async loadEditorAssetLibrary(routeInput) {\n const handlers = await assetAuthoringHandlersPromise;\n if (!handlers.loadEditorAssetLibrary) throw new Error('asset_library_handler_unavailable');\n return handlers.loadEditorAssetLibrary(routeInput);\n },\n async loadEditorScene() {\n return options.loadEditorScene(server);\n },\n writeFile: options.writeFile ?? writePlayableAuthoringFile,\n async runCommand(commandInput) {\n const handlers = await assetAuthoringHandlersPromise;\n if (!handlers.runCommand) throw new Error('asset_command_handler_unavailable');\n return handlers.runCommand(commandInput);\n },\n async saveEditorScene({ mode: saveMode, rawEditorScene, body }) {\n return options.saveEditorScene({\n server,\n saveMode,\n rawEditorScene: rawEditorScene as Record<string, unknown>,\n body: body as Record<string, unknown>,\n });\n },\n });\n\n if (!response) {\n next();\n return;\n }\n sendPlayableAuthoringHttpResponse(res, response);\n });\n },\n async handleHotUpdate(context: HmrContext) {\n if (typeof context.file !== 'string') return;\n const authoringWrittenFiles = await authoringWrittenFilesPromise;\n if (isFpsGameEditorAuthoringWrittenFile(context.file, authoringWrittenFiles)) {\n // Keep the watcher event active until Vite has finished running every\n // hot-update hook. Vite may emit its full-reload message only after\n // this hook resolves; clearing here lets canonical asset replacements\n // reload the whole Editor before the freshness coordinator can rebase\n // the active session.\n return [];\n }\n },\n };\n}\n\nexport function isFpsGameEditorAuthoringWrittenFile(\n candidateFile: string,\n authoringWrittenFiles: readonly string[],\n): boolean {\n const candidate = resolveFpsGameEditorViteFilePath(candidateFile);\n return authoringWrittenFiles.some((configuredFile) => {\n const configured = resolveFpsGameEditorViteFilePath(configuredFile);\n if (candidate === configured) return true;\n const relative = path.relative(configured, candidate);\n return relative.length > 0 && relative !== '..' && !relative.startsWith(`..${path.sep}`) && !path.isAbsolute(relative);\n });\n}\n\nfunction suppressFpsGameEditorAuthoringFullReloads(\n server: {\n watcher?: { prependListener?: (event: string, listener: (file: unknown) => void) => unknown };\n ws?: { send?: (payload: any, ...args: any[]) => unknown };\n },\n authoringWrittenFiles: readonly string[],\n): void {\n if (!server.watcher?.prependListener || !server.ws?.send) return;\n let activeAuthoringFile: string | null = null;\n let clearTimer: ReturnType<typeof setTimeout> | null = null;\n const clearActiveFile = (): void => {\n activeAuthoringFile = null;\n if (clearTimer) clearTimeout(clearTimer);\n clearTimer = null;\n };\n const markFile = (file: unknown): void => {\n clearActiveFile();\n activeAuthoringFile = typeof file === 'string'\n && isFpsGameEditorAuthoringWrittenFile(file, authoringWrittenFiles)\n ? resolveFpsGameEditorViteFilePath(file)\n : null;\n if (activeAuthoringFile) {\n clearTimer = setTimeout(clearActiveFile, 1_000);\n }\n };\n for (const event of ['add', 'change', 'unlink']) {\n server.watcher.prependListener(event, markFile);\n }\n\n const send = server.ws.send.bind(server.ws);\n server.ws.send = (payload: any, ...args: any[]) => {\n const triggeredBy = typeof payload?.triggeredBy === 'string' ? payload.triggeredBy : undefined;\n const isOwnedTriggeredFile = triggeredBy\n ? isFpsGameEditorAuthoringWrittenFile(triggeredBy, authoringWrittenFiles)\n : false;\n if (payload?.type === 'full-reload' && (isOwnedTriggeredFile || (activeAuthoringFile && !triggeredBy))) {\n return;\n }\n return send(payload, ...args);\n };\n}\n\nfunction suppressFpsGameEditorAuthoringWatcherAdds(\n watcher: { add?: (paths: string | readonly string[]) => unknown } | undefined,\n authoringWrittenFiles: readonly string[],\n): void {\n if (!watcher?.add) return;\n const add = watcher.add.bind(watcher);\n watcher.add = (input) => {\n const paths = typeof input === 'string' ? [input] : [...input];\n const filtered = paths.filter(file => !isFpsGameEditorAuthoringWrittenFile(file, authoringWrittenFiles));\n if (filtered.length === 0) return watcher;\n return add(typeof input === 'string' ? filtered[0] : filtered);\n };\n}\n\nasync function writePlayableAuthoringFile({\n path: targetPath,\n text,\n}: Parameters<NonNullable<PlayableAuthoringServerHandlers['writeFile']>>[0]) {\n await mkdir(path.dirname(targetPath), { recursive: true });\n await writeFile(targetPath, text, 'utf8');\n return { ok: true, path: targetPath };\n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C,UAAU,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC3D,MAAM,SAAS,CAAC,UAAU,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;IAC1C,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;AACxC,CAAC","sourcesContent":["import path from 'node:path';\nimport { mkdir, writeFile } from 'node:fs/promises';\nimport { pipeline } from 'node:stream/promises';\nimport type { HmrContext, Plugin, ViteDevServer } from 'vite';\nimport {\n handlePlayableAuthoringServerRequest,\n type PlayableAuthoringServerHandlers,\n type PlayableAuthoringServerResponse,\n} from '../authoring-server/index';\nimport {\n createPlayableAuthoringTransportPathNormalizer,\n readPlayableAuthoringJsonBody,\n sendPlayableAuthoringHttpResponse,\n setPlayableAuthoringCorsHeaders,\n} from './authoring-http';\nimport { resolveEditorProjectMediaSupport } from '../project-files/index';\nimport { resolveFpsGameEditorViteFilePath } from './module-invalidation';\nimport {\n closeEditorProjectFileHandle,\n openVerifiedEditorProjectFile,\n resolveEditorProjectMediaMaxBytes,\n} from './project-file-handle';\nimport { readEditorProjectFile, scanEditorProjectFiles } from './project-files';\n\nexport interface FpsGameEditorProjectAuthoringApiPluginOptions {\n projectRoot: string;\n projectMediaMaxBytes?: number;\n name?: string;\n createAssetAuthoringHandlers(server: ViteDevServer): Promise<Pick<\n PlayableAuthoringServerHandlers,\n 'loadManifest' | 'loadEditorAssetLibrary' | 'runCommand'\n >>;\n getAuthoringWrittenFiles?: (server: ViteDevServer) => Promise<readonly string[]>;\n handleRenderingProfileRoute?: (input: {\n server: ViteDevServer;\n req: unknown;\n readJsonBody: typeof readPlayableAuthoringJsonBody;\n }) => Promise<PlayableAuthoringServerResponse>;\n loadEditorScene(server: ViteDevServer): Promise<Record<string, unknown>>;\n saveEditorScene(input: {\n server: ViteDevServer;\n saveMode: string;\n rawEditorScene: Record<string, unknown>;\n body: Record<string, unknown>;\n }): Promise<Record<string, unknown>>;\n writeFile?: PlayableAuthoringServerHandlers['writeFile'];\n logger?: Pick<Console, 'log' | 'warn'>;\n}\n\nexport function createFpsGameEditorProjectAuthoringApiPlugin(\n options: FpsGameEditorProjectAuthoringApiPluginOptions,\n): Plugin {\n let authoringWrittenFilesPromise: Promise<readonly string[]> = Promise.resolve([]);\n return {\n name: options.name ?? 'fps-editor-project-authoring-api',\n enforce: 'post' as const,\n apply: 'serve' as const,\n async configureServer(server) {\n const assetAuthoringHandlersPromise = options.createAssetAuthoringHandlers(server);\n if (options.getAuthoringWrittenFiles) {\n authoringWrittenFilesPromise = options.getAuthoringWrittenFiles(server)\n .then(paths => paths.map(file => path.resolve(options.projectRoot, file)))\n .then(async (paths) => {\n suppressFpsGameEditorAuthoringFullReloads(server, paths);\n suppressFpsGameEditorAuthoringWatcherAdds(server.watcher, paths);\n await server.watcher?.unwatch?.(paths);\n options.logger?.log?.('[ProjectAuthoring][Vite] watcher and HMR suppressed for authoring-written files', paths);\n return paths;\n })\n .catch((error) => {\n options.logger?.warn?.('[ProjectAuthoring][Vite] failed to resolve authoring files for HMR suppression', error);\n return [];\n });\n await authoringWrittenFilesPromise;\n }\n\n server.middlewares.use(async (req: any, res: any, next: any) => {\n const requestUrl = new URL(req.url ?? '', 'http://localhost');\n const pathname = requestUrl.pathname;\n const isProjectAuthoringRoute = pathname.startsWith('/__fps_editor_authoring');\n const route = isProjectAuthoringRoute\n ? pathname\n .replace(/^\\/__fps_editor_authoring/, '') || '/'\n : '/';\n\n if (isProjectAuthoringRoute && route === '/project-media') {\n setPlayableAuthoringCorsHeaders(res);\n if (req.method === 'OPTIONS') {\n res.statusCode = 204;\n res.end();\n return;\n }\n if (req.method !== 'GET') {\n sendPlayableAuthoringHttpResponse(res, { statusCode: 405, body: { ok: false, error: 'method_not_allowed' } });\n return;\n }\n const requestedPath = requestUrl.searchParams.get('path')?.trim() ?? '';\n if (!requestedPath) {\n sendPlayableAuthoringHttpResponse(res, { statusCode: 400, body: { ok: false, error: 'missing_file_path' } });\n return;\n }\n try {\n const opened = await openVerifiedEditorProjectFile(options.projectRoot, requestedPath);\n let operationError: unknown = null;\n let finalByte: Buffer | null = null;\n try {\n const support = resolveEditorProjectMediaSupport(opened.relativePath);\n if (!support) throw new Error('project_file_media_unsupported');\n if (opened.stat.size > resolveEditorProjectMediaMaxBytes(options.projectMediaMaxBytes)) {\n throw new Error('project_file_media_too_large');\n }\n const name = path.basename(opened.relativePath);\n res.statusCode = 200;\n res.setHeader('Content-Type', support.mimeType);\n res.setHeader('Content-Length', String(opened.stat.size));\n res.setHeader('Content-Disposition', `inline; filename*=UTF-8''${encodeURIComponent(name)}`);\n res.setHeader('X-Content-Type-Options', 'nosniff');\n if (opened.stat.size > 0) {\n finalByte = Buffer.allocUnsafe(1);\n const read = await opened.handle.read(finalByte, 0, 1, opened.stat.size - 1);\n if (read.bytesRead !== 1) throw new Error('project_file_changed_during_read');\n }\n if (opened.stat.size > 1) {\n await pipeline(opened.handle.createReadStream({\n autoClose: false,\n start: 0,\n end: opened.stat.size - 2,\n }), res, { end: false });\n }\n } catch (error) {\n operationError = error;\n }\n try {\n await closeEditorProjectFileHandle(opened.handle);\n } catch (closeError) {\n if (operationError) {\n const aggregate = new Error('project_file_close_failed') as Error & { errors: unknown[] };\n aggregate.errors = [operationError, closeError];\n operationError = aggregate;\n } else {\n operationError = closeError;\n }\n }\n if (operationError) throw operationError;\n if (finalByte) res.end(finalByte);\n else res.end();\n } catch (error) {\n if (!res.headersSent) {\n const errorMessage = error instanceof Error ? error.message : String(error);\n sendPlayableAuthoringHttpResponse(res, {\n statusCode: errorMessage === 'project_file_media_too_large' ? 413 : 404,\n body: { ok: false, error: errorMessage },\n });\n } else {\n res.destroy(error instanceof Error ? error : undefined);\n }\n }\n return;\n }\n\n if (isProjectAuthoringRoute && route.startsWith('/rendering-profile')) {\n if (!options.handleRenderingProfileRoute) {\n next();\n return;\n }\n setPlayableAuthoringCorsHeaders(res);\n if (req.method === 'OPTIONS') {\n res.statusCode = 204;\n res.end();\n return;\n }\n\n try {\n const response = await options.handleRenderingProfileRoute({\n server,\n req,\n readJsonBody: readPlayableAuthoringJsonBody,\n });\n sendPlayableAuthoringHttpResponse(res, response);\n } catch (error) {\n sendPlayableAuthoringHttpResponse(res, {\n statusCode: 500,\n body: {\n ok: false,\n error: error instanceof Error ? error.message : String(error),\n details: (error as any)?.details,\n },\n });\n }\n return;\n }\n\n const response = await handlePlayableAuthoringServerRequest({\n url: req.url ?? '',\n method: req.method ?? 'GET',\n }, {\n readBody: () => readPlayableAuthoringJsonBody(req),\n normalizeTransportPath: createPlayableAuthoringTransportPathNormalizer(options.projectRoot, {\n relativeRoot: '.platform-sim',\n }),\n async loadManifest(routeInput) {\n const handlers = await assetAuthoringHandlersPromise;\n if (!handlers.loadManifest) throw new Error('asset_manifest_handler_unavailable');\n return handlers.loadManifest(routeInput);\n },\n async loadEditorAssetLibrary(routeInput) {\n const handlers = await assetAuthoringHandlersPromise;\n if (!handlers.loadEditorAssetLibrary) throw new Error('asset_library_handler_unavailable');\n return handlers.loadEditorAssetLibrary(routeInput);\n },\n async loadProjectFiles() {\n return scanEditorProjectFiles(options.projectRoot);\n },\n async loadProjectFile({ path: requestedPath }) {\n return readEditorProjectFile(options.projectRoot, requestedPath);\n },\n async loadEditorScene() {\n return options.loadEditorScene(server);\n },\n writeFile: options.writeFile ?? writePlayableAuthoringFile,\n async runCommand(commandInput) {\n const handlers = await assetAuthoringHandlersPromise;\n if (!handlers.runCommand) throw new Error('asset_command_handler_unavailable');\n return handlers.runCommand(commandInput);\n },\n async saveEditorScene({ mode: saveMode, rawEditorScene, body }) {\n return options.saveEditorScene({\n server,\n saveMode,\n rawEditorScene: rawEditorScene as Record<string, unknown>,\n body: body as Record<string, unknown>,\n });\n },\n });\n\n if (!response) {\n next();\n return;\n }\n sendPlayableAuthoringHttpResponse(res, response);\n });\n },\n async handleHotUpdate(context: HmrContext) {\n if (typeof context.file !== 'string') return;\n const authoringWrittenFiles = await authoringWrittenFilesPromise;\n if (isFpsGameEditorAuthoringWrittenFile(context.file, authoringWrittenFiles)) {\n // Keep the watcher event active until Vite has finished running every\n // hot-update hook. Vite may emit its full-reload message only after\n // this hook resolves; clearing here lets canonical asset replacements\n // reload the whole Editor before the freshness coordinator can rebase\n // the active session.\n return [];\n }\n },\n };\n}\n\nexport function isFpsGameEditorAuthoringWrittenFile(\n candidateFile: string,\n authoringWrittenFiles: readonly string[],\n): boolean {\n const candidate = resolveFpsGameEditorViteFilePath(candidateFile);\n return authoringWrittenFiles.some((configuredFile) => {\n const configured = resolveFpsGameEditorViteFilePath(configuredFile);\n if (candidate === configured) return true;\n const relative = path.relative(configured, candidate);\n return relative.length > 0 && relative !== '..' && !relative.startsWith(`..${path.sep}`) && !path.isAbsolute(relative);\n });\n}\n\nfunction suppressFpsGameEditorAuthoringFullReloads(\n server: {\n watcher?: { prependListener?: (event: string, listener: (file: unknown) => void) => unknown };\n ws?: { send?: (payload: any, ...args: any[]) => unknown };\n },\n authoringWrittenFiles: readonly string[],\n): void {\n if (!server.watcher?.prependListener || !server.ws?.send) return;\n let activeAuthoringFile: string | null = null;\n let clearTimer: ReturnType<typeof setTimeout> | null = null;\n const clearActiveFile = (): void => {\n activeAuthoringFile = null;\n if (clearTimer) clearTimeout(clearTimer);\n clearTimer = null;\n };\n const markFile = (file: unknown): void => {\n clearActiveFile();\n activeAuthoringFile = typeof file === 'string'\n && isFpsGameEditorAuthoringWrittenFile(file, authoringWrittenFiles)\n ? resolveFpsGameEditorViteFilePath(file)\n : null;\n if (activeAuthoringFile) {\n clearTimer = setTimeout(clearActiveFile, 1_000);\n }\n };\n for (const event of ['add', 'change', 'unlink']) {\n server.watcher.prependListener(event, markFile);\n }\n\n const send = server.ws.send.bind(server.ws);\n server.ws.send = (payload: any, ...args: any[]) => {\n const triggeredBy = typeof payload?.triggeredBy === 'string' ? payload.triggeredBy : undefined;\n const isOwnedTriggeredFile = triggeredBy\n ? isFpsGameEditorAuthoringWrittenFile(triggeredBy, authoringWrittenFiles)\n : false;\n if (payload?.type === 'full-reload' && (isOwnedTriggeredFile || (activeAuthoringFile && !triggeredBy))) {\n return;\n }\n return send(payload, ...args);\n };\n}\n\nfunction suppressFpsGameEditorAuthoringWatcherAdds(\n watcher: { add?: (paths: string | readonly string[]) => unknown } | undefined,\n authoringWrittenFiles: readonly string[],\n): void {\n if (!watcher?.add) return;\n const add = watcher.add.bind(watcher);\n watcher.add = (input) => {\n const paths = typeof input === 'string' ? [input] : [...input];\n const filtered = paths.filter(file => !isFpsGameEditorAuthoringWrittenFile(file, authoringWrittenFiles));\n if (filtered.length === 0) return watcher;\n return add(typeof input === 'string' ? filtered[0] : filtered);\n };\n}\n\nasync function writePlayableAuthoringFile({\n path: targetPath,\n text,\n}: Parameters<NonNullable<PlayableAuthoringServerHandlers['writeFile']>>[0]) {\n await mkdir(path.dirname(targetPath), { recursive: true });\n await writeFile(targetPath, text, 'utf8');\n return { ok: true, path: targetPath };\n}\n"]}
@@ -0,0 +1,14 @@
1
+ import { type Stats } from 'node:fs';
2
+ import { type FileHandle } from 'node:fs/promises';
3
+ export declare const DEFAULT_EDITOR_PROJECT_MEDIA_MAX_BYTES: number;
4
+ export interface OpenedVerifiedEditorProjectFile {
5
+ absolutePath: string;
6
+ handle: FileHandle;
7
+ relativePath: string;
8
+ stat: Stats;
9
+ }
10
+ export declare function closeEditorProjectFileHandle(handle: Pick<FileHandle, 'close'>): Promise<void>;
11
+ export declare function normalizeEditorProjectFileReadPath(requestedPath: string): string;
12
+ export declare function resolveEditorProjectMediaMaxBytes(value?: number): number;
13
+ export declare function openVerifiedEditorProjectFile(projectRoot: string, requestedPath: string): Promise<OpenedVerifiedEditorProjectFile>;
14
+ //# sourceMappingURL=project-file-handle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project-file-handle.d.ts","sourceRoot":"","sources":["../../src/vite/project-file-handle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,KAAK,EAAE,MAAM,SAAS,CAAC;AAChD,OAAW,EAAE,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAGvD,eAAO,MAAM,sCAAsC,QAAoB,CAAC;AAGxE,MAAM,WAAW,+BAA+B;IAC9C,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,UAAU,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,KAAK,CAAC;CACb;AAED,wBAAsB,4BAA4B,CAChD,MAAM,EAAE,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,GAChC,OAAO,CAAC,IAAI,CAAC,CAaf;AAED,wBAAgB,kCAAkC,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,CAehF;AAED,wBAAgB,iCAAiC,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAIxE;AAED,wBAAsB,6BAA6B,CACjD,WAAW,EAAE,MAAM,EACnB,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,+BAA+B,CAAC,CAwC1C"}