@carbonenginejs/runtime-resource 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (372) hide show
  1. package/FORMAT-PROVENANCE.md +135 -0
  2. package/LICENSE +21 -0
  3. package/NOTICE +29 -0
  4. package/README.md +241 -0
  5. package/dist/CjsMotherLode.js +56 -0
  6. package/dist/CjsMotherLode.js.map +1 -0
  7. package/dist/CjsResMan.js +740 -0
  8. package/dist/CjsResMan.js.map +1 -0
  9. package/dist/CjsResManQueue.js +214 -0
  10. package/dist/CjsResManQueue.js.map +1 -0
  11. package/dist/CjsResource.js +366 -0
  12. package/dist/CjsResource.js.map +1 -0
  13. package/dist/CjsResourceSource.js +59 -0
  14. package/dist/CjsResourceSource.js.map +1 -0
  15. package/dist/_virtual/_rollupPluginBabelHelpers.js +153 -0
  16. package/dist/_virtual/_rollupPluginBabelHelpers.js.map +1 -0
  17. package/dist/format/CjsFormat.js +178 -0
  18. package/dist/format/CjsFormat.js.map +1 -0
  19. package/dist/format/CjsResourceProbe.js +269 -0
  20. package/dist/format/CjsResourceProbe.js.map +1 -0
  21. package/dist/format/payloadContract.js +173 -0
  22. package/dist/format/payloadContract.js.map +1 -0
  23. package/dist/formats/black/CjsBlackFormat.js +272 -0
  24. package/dist/formats/black/CjsBlackFormat.js.map +1 -0
  25. package/dist/formats/black/core/CjsBlackBinaryReader.js +153 -0
  26. package/dist/formats/black/core/CjsBlackBinaryReader.js.map +1 -0
  27. package/dist/formats/black/core/CjsBlackPropertyReaders.js +382 -0
  28. package/dist/formats/black/core/CjsBlackPropertyReaders.js.map +1 -0
  29. package/dist/formats/black/core/CjsBlackReader.js +760 -0
  30. package/dist/formats/black/core/CjsBlackReader.js.map +1 -0
  31. package/dist/formats/black/core/CjsBlackSchemaRegistry.js +433 -0
  32. package/dist/formats/black/core/CjsBlackSchemaRegistry.js.map +1 -0
  33. package/dist/formats/black/core/black-schema-v1-2026-07-11.json.js +4 -0
  34. package/dist/formats/black/core/black-schema-v1-2026-07-11.json.js.map +1 -0
  35. package/dist/formats/black/core/blackConstants.js +7 -0
  36. package/dist/formats/black/core/blackConstants.js.map +1 -0
  37. package/dist/formats/black/core/blackDefinitions.js +10 -0
  38. package/dist/formats/black/core/blackDefinitions.js.map +1 -0
  39. package/dist/formats/black/core/blackEnums.js +6 -0
  40. package/dist/formats/black/core/blackEnums.js.map +1 -0
  41. package/dist/formats/black/core/blackSchema.js +3 -0
  42. package/dist/formats/black/core/blackSchema.js.map +1 -0
  43. package/dist/formats/black/core/blackVersion.js +22 -0
  44. package/dist/formats/black/core/blackVersion.js.map +1 -0
  45. package/dist/formats/black/core/helpers.js +182 -0
  46. package/dist/formats/black/core/helpers.js.map +1 -0
  47. package/dist/formats/black/core/schema.js +4 -0
  48. package/dist/formats/black/core/schema.js.map +1 -0
  49. package/dist/formats/black/index.js +2 -0
  50. package/dist/formats/black/index.js.map +1 -0
  51. package/dist/formats/bnk/CjsBnkFormat.js +245 -0
  52. package/dist/formats/bnk/CjsBnkFormat.js.map +1 -0
  53. package/dist/formats/bnk/core/helpers.js +354 -0
  54. package/dist/formats/bnk/core/helpers.js.map +1 -0
  55. package/dist/formats/bnk/core/soundbanksInfo.js +246 -0
  56. package/dist/formats/bnk/core/soundbanksInfo.js.map +1 -0
  57. package/dist/formats/bnk/index.js +3 -0
  58. package/dist/formats/bnk/index.js.map +1 -0
  59. package/dist/formats/cmf/CjsCmfFormat.js +491 -0
  60. package/dist/formats/cmf/CjsCmfFormat.js.map +1 -0
  61. package/dist/formats/cmf/core/binary.js +118 -0
  62. package/dist/formats/cmf/core/binary.js.map +1 -0
  63. package/dist/formats/cmf/core/buffers.js +233 -0
  64. package/dist/formats/cmf/core/buffers.js.map +1 -0
  65. package/dist/formats/cmf/core/constants.js +47 -0
  66. package/dist/formats/cmf/core/constants.js.map +1 -0
  67. package/dist/formats/cmf/core/gr2Anim.js +453 -0
  68. package/dist/formats/cmf/core/gr2Anim.js.map +1 -0
  69. package/dist/formats/cmf/core/helpers.js +287 -0
  70. package/dist/formats/cmf/core/helpers.js.map +1 -0
  71. package/dist/formats/cmf/core/pack.js +276 -0
  72. package/dist/formats/cmf/core/pack.js.map +1 -0
  73. package/dist/formats/cmf/core/schema.js +364 -0
  74. package/dist/formats/cmf/core/schema.js.map +1 -0
  75. package/dist/formats/cmf/core/shared.js +268 -0
  76. package/dist/formats/cmf/core/shared.js.map +1 -0
  77. package/dist/formats/cmf/core/writer.js +517 -0
  78. package/dist/formats/cmf/core/writer.js.map +1 -0
  79. package/dist/formats/cmf/index.js +2 -0
  80. package/dist/formats/cmf/index.js.map +1 -0
  81. package/dist/formats/dds/CjsDdsFormat.js +187 -0
  82. package/dist/formats/dds/CjsDdsFormat.js.map +1 -0
  83. package/dist/formats/dds/core/helpers.js +812 -0
  84. package/dist/formats/dds/core/helpers.js.map +1 -0
  85. package/dist/formats/dds/index.js +2 -0
  86. package/dist/formats/dds/index.js.map +1 -0
  87. package/dist/formats/fbx/CjsFbxFormat.js +260 -0
  88. package/dist/formats/fbx/CjsFbxFormat.js.map +1 -0
  89. package/dist/formats/fbx/core/helpers.js +3901 -0
  90. package/dist/formats/fbx/core/helpers.js.map +1 -0
  91. package/dist/formats/fbx/index.js +2 -0
  92. package/dist/formats/fbx/index.js.map +1 -0
  93. package/dist/formats/flac/CjsFlacFormat.js +81 -0
  94. package/dist/formats/flac/CjsFlacFormat.js.map +1 -0
  95. package/dist/formats/flac/core/helpers.js +295 -0
  96. package/dist/formats/flac/core/helpers.js.map +1 -0
  97. package/dist/formats/flac/index.js +2 -0
  98. package/dist/formats/flac/index.js.map +1 -0
  99. package/dist/formats/gif/CjsGifFormat.js +81 -0
  100. package/dist/formats/gif/CjsGifFormat.js.map +1 -0
  101. package/dist/formats/gif/core/helpers.js +360 -0
  102. package/dist/formats/gif/core/helpers.js.map +1 -0
  103. package/dist/formats/gif/index.js +2 -0
  104. package/dist/formats/gif/index.js.map +1 -0
  105. package/dist/formats/gltf/CjsGltfFormat.js +284 -0
  106. package/dist/formats/gltf/CjsGltfFormat.js.map +1 -0
  107. package/dist/formats/gltf/core/helpers.js +292 -0
  108. package/dist/formats/gltf/core/helpers.js.map +1 -0
  109. package/dist/formats/gltf/core/json.js +79 -0
  110. package/dist/formats/gltf/core/json.js.map +1 -0
  111. package/dist/formats/gltf/core/parser.js +666 -0
  112. package/dist/formats/gltf/core/parser.js.map +1 -0
  113. package/dist/formats/gltf/core/targets.js +163 -0
  114. package/dist/formats/gltf/core/targets.js.map +1 -0
  115. package/dist/formats/gltf/index.js +2 -0
  116. package/dist/formats/gltf/index.js.map +1 -0
  117. package/dist/formats/index.js +23 -0
  118. package/dist/formats/index.js.map +1 -0
  119. package/dist/formats/jpeg/CjsJpegFormat.js +200 -0
  120. package/dist/formats/jpeg/CjsJpegFormat.js.map +1 -0
  121. package/dist/formats/jpeg/core/helpers.js +350 -0
  122. package/dist/formats/jpeg/core/helpers.js.map +1 -0
  123. package/dist/formats/jpeg/core/jpeg.js +377 -0
  124. package/dist/formats/jpeg/core/jpeg.js.map +1 -0
  125. package/dist/formats/jpeg/index.js +2 -0
  126. package/dist/formats/jpeg/index.js.map +1 -0
  127. package/dist/formats/mp3/CjsMp3Format.js +186 -0
  128. package/dist/formats/mp3/CjsMp3Format.js.map +1 -0
  129. package/dist/formats/mp3/core/helpers.js +338 -0
  130. package/dist/formats/mp3/core/helpers.js.map +1 -0
  131. package/dist/formats/mp3/index.js +2 -0
  132. package/dist/formats/mp3/index.js.map +1 -0
  133. package/dist/formats/mp4/CjsMp4Format.js +185 -0
  134. package/dist/formats/mp4/CjsMp4Format.js.map +1 -0
  135. package/dist/formats/mp4/core/helpers.js +449 -0
  136. package/dist/formats/mp4/core/helpers.js.map +1 -0
  137. package/dist/formats/mp4/index.js +2 -0
  138. package/dist/formats/mp4/index.js.map +1 -0
  139. package/dist/formats/obj/CjsObjFormat.js +247 -0
  140. package/dist/formats/obj/CjsObjFormat.js.map +1 -0
  141. package/dist/formats/obj/core/helpers.js +573 -0
  142. package/dist/formats/obj/core/helpers.js.map +1 -0
  143. package/dist/formats/obj/core/json.js +64 -0
  144. package/dist/formats/obj/core/json.js.map +1 -0
  145. package/dist/formats/obj/core/parser.js +321 -0
  146. package/dist/formats/obj/core/parser.js.map +1 -0
  147. package/dist/formats/obj/index.js +2 -0
  148. package/dist/formats/obj/index.js.map +1 -0
  149. package/dist/formats/ogg/CjsOggFormat.js +82 -0
  150. package/dist/formats/ogg/CjsOggFormat.js.map +1 -0
  151. package/dist/formats/ogg/core/helpers.js +387 -0
  152. package/dist/formats/ogg/core/helpers.js.map +1 -0
  153. package/dist/formats/ogg/core/imdct.js +178 -0
  154. package/dist/formats/ogg/core/imdct.js.map +1 -0
  155. package/dist/formats/ogg/core/vorbis.js +999 -0
  156. package/dist/formats/ogg/core/vorbis.js.map +1 -0
  157. package/dist/formats/ogg/index.js +2 -0
  158. package/dist/formats/ogg/index.js.map +1 -0
  159. package/dist/formats/png/CjsPngFormat.js +189 -0
  160. package/dist/formats/png/CjsPngFormat.js.map +1 -0
  161. package/dist/formats/png/core/helpers.js +583 -0
  162. package/dist/formats/png/core/helpers.js.map +1 -0
  163. package/dist/formats/png/index.js +2 -0
  164. package/dist/formats/png/index.js.map +1 -0
  165. package/dist/formats/red/CjsRedFormat.js +247 -0
  166. package/dist/formats/red/CjsRedFormat.js.map +1 -0
  167. package/dist/formats/red/core/CjsRedReader.js +201 -0
  168. package/dist/formats/red/core/CjsRedReader.js.map +1 -0
  169. package/dist/formats/red/core/blackDefinitions.js +3 -0
  170. package/dist/formats/red/core/blackDefinitions.js.map +1 -0
  171. package/dist/formats/red/core/helpers.js +136 -0
  172. package/dist/formats/red/core/helpers.js.map +1 -0
  173. package/dist/formats/red/core/redGraph.js +68 -0
  174. package/dist/formats/red/core/redGraph.js.map +1 -0
  175. package/dist/formats/red/core/schema.js +4 -0
  176. package/dist/formats/red/core/schema.js.map +1 -0
  177. package/dist/formats/red/index.js +2 -0
  178. package/dist/formats/red/index.js.map +1 -0
  179. package/dist/formats/stl/CjsStlFormat.js +304 -0
  180. package/dist/formats/stl/CjsStlFormat.js.map +1 -0
  181. package/dist/formats/stl/core/helpers.js +257 -0
  182. package/dist/formats/stl/core/helpers.js.map +1 -0
  183. package/dist/formats/stl/core/json.js +51 -0
  184. package/dist/formats/stl/core/json.js.map +1 -0
  185. package/dist/formats/stl/core/stl.js +544 -0
  186. package/dist/formats/stl/core/stl.js.map +1 -0
  187. package/dist/formats/stl/core/targets.js +163 -0
  188. package/dist/formats/stl/core/targets.js.map +1 -0
  189. package/dist/formats/stl/index.js +2 -0
  190. package/dist/formats/stl/index.js.map +1 -0
  191. package/dist/formats/tga/CjsTgaFormat.js +186 -0
  192. package/dist/formats/tga/CjsTgaFormat.js.map +1 -0
  193. package/dist/formats/tga/core/helpers.js +446 -0
  194. package/dist/formats/tga/core/helpers.js.map +1 -0
  195. package/dist/formats/tga/index.js +2 -0
  196. package/dist/formats/tga/index.js.map +1 -0
  197. package/dist/formats/wav/CjsWavFormat.js +186 -0
  198. package/dist/formats/wav/CjsWavFormat.js.map +1 -0
  199. package/dist/formats/wav/core/helpers.js +328 -0
  200. package/dist/formats/wav/core/helpers.js.map +1 -0
  201. package/dist/formats/wav/index.js +2 -0
  202. package/dist/formats/wav/index.js.map +1 -0
  203. package/dist/formats/webm/CjsWebmFormat.js +185 -0
  204. package/dist/formats/webm/CjsWebmFormat.js.map +1 -0
  205. package/dist/formats/webm/core/helpers.js +537 -0
  206. package/dist/formats/webm/core/helpers.js.map +1 -0
  207. package/dist/formats/webm/index.js +2 -0
  208. package/dist/formats/webm/index.js.map +1 -0
  209. package/dist/formats/webp/CjsWebpFormat.js +80 -0
  210. package/dist/formats/webp/CjsWebpFormat.js.map +1 -0
  211. package/dist/formats/webp/core/helpers.js +214 -0
  212. package/dist/formats/webp/core/helpers.js.map +1 -0
  213. package/dist/formats/webp/index.js +2 -0
  214. package/dist/formats/webp/index.js.map +1 -0
  215. package/dist/formats/wem/CjsWemFormat.js +197 -0
  216. package/dist/formats/wem/CjsWemFormat.js.map +1 -0
  217. package/dist/formats/wem/core/bitStream.js +259 -0
  218. package/dist/formats/wem/core/bitStream.js.map +1 -0
  219. package/dist/formats/wem/core/codebookLibrary.js +164 -0
  220. package/dist/formats/wem/core/codebookLibrary.js.map +1 -0
  221. package/dist/formats/wem/core/helpers.js +336 -0
  222. package/dist/formats/wem/core/helpers.js.map +1 -0
  223. package/dist/formats/wem/core/packedCodebooksAotuv603.js +30 -0
  224. package/dist/formats/wem/core/packedCodebooksAotuv603.js.map +1 -0
  225. package/dist/formats/wem/core/wemToOgg.js +485 -0
  226. package/dist/formats/wem/core/wemToOgg.js.map +1 -0
  227. package/dist/formats/wem/index.js +2 -0
  228. package/dist/formats/wem/index.js.map +1 -0
  229. package/dist/formats/yaml/CjsYamlFormat.js +77 -0
  230. package/dist/formats/yaml/CjsYamlFormat.js.map +1 -0
  231. package/dist/formats/yaml/core/CjsYamlReader.js +304 -0
  232. package/dist/formats/yaml/core/CjsYamlReader.js.map +1 -0
  233. package/dist/formats/yaml/core/helpers.js +160 -0
  234. package/dist/formats/yaml/core/helpers.js.map +1 -0
  235. package/dist/formats/yaml/index.js +2 -0
  236. package/dist/formats/yaml/index.js.map +1 -0
  237. package/dist/generated/resources/AudioGeometryResData.js +47 -0
  238. package/dist/generated/resources/AudioGeometryResData.js.map +1 -0
  239. package/dist/generated/resources/CmfVertexReader.js +46 -0
  240. package/dist/generated/resources/CmfVertexReader.js.map +1 -0
  241. package/dist/generated/resources/GStateBindingCallbackData.js +31 -0
  242. package/dist/generated/resources/GStateBindingCallbackData.js.map +1 -0
  243. package/dist/generated/resources/MeshDecalData.js +37 -0
  244. package/dist/generated/resources/MeshDecalData.js.map +1 -0
  245. package/dist/generated/resources/MeshDecalLodData.js +34 -0
  246. package/dist/generated/resources/MeshDecalLodData.js.map +1 -0
  247. package/dist/generated/resources/Tr2AsyncSave.js +46 -0
  248. package/dist/generated/resources/Tr2AsyncSave.js.map +1 -0
  249. package/dist/generated/resources/Tr2CmfContents.js +37 -0
  250. package/dist/generated/resources/Tr2CmfContents.js.map +1 -0
  251. package/dist/generated/resources/Tr2GrannyIntersectionResult.js +58 -0
  252. package/dist/generated/resources/Tr2GrannyIntersectionResult.js.map +1 -0
  253. package/dist/generated/resources/Tr2LoadPrepareFence.js +37 -0
  254. package/dist/generated/resources/Tr2LoadPrepareFence.js.map +1 -0
  255. package/dist/generated/resources/Tr2MaterialArea.js +34 -0
  256. package/dist/generated/resources/Tr2MaterialArea.js.map +1 -0
  257. package/dist/generated/resources/Tr2MaterialMesh.js +31 -0
  258. package/dist/generated/resources/Tr2MaterialMesh.js.map +1 -0
  259. package/dist/generated/resources/Tr2MaterialRes.js +34 -0
  260. package/dist/generated/resources/Tr2MaterialRes.js.map +1 -0
  261. package/dist/generated/resources/Tr2ShaderPermutation.js +43 -0
  262. package/dist/generated/resources/Tr2ShaderPermutation.js.map +1 -0
  263. package/dist/generated/resources/Tr2TextureLodManager.js +60 -0
  264. package/dist/generated/resources/Tr2TextureLodManager.js.map +1 -0
  265. package/dist/generated/resources/Tr2TextureLodUpdateRequest.js +37 -0
  266. package/dist/generated/resources/Tr2TextureLodUpdateRequest.js.map +1 -0
  267. package/dist/generated/resources/Tr2TexturePackChannel.js +37 -0
  268. package/dist/generated/resources/Tr2TexturePackChannel.js.map +1 -0
  269. package/dist/generated/resources/Tr2TexturePipeline.js +44 -0
  270. package/dist/generated/resources/Tr2TexturePipeline.js.map +1 -0
  271. package/dist/generated/resources/Tr2TexturePipelineParams.js +34 -0
  272. package/dist/generated/resources/Tr2TexturePipelineParams.js.map +1 -0
  273. package/dist/generated/resources/Tr2TexturePipelineStepCompress.js +40 -0
  274. package/dist/generated/resources/Tr2TexturePipelineStepCompress.js.map +1 -0
  275. package/dist/generated/resources/Tr2TexturePipelineStepLimitSize.js +34 -0
  276. package/dist/generated/resources/Tr2TexturePipelineStepLimitSize.js.map +1 -0
  277. package/dist/generated/resources/Tr2TexturePipelineStepLoad.js +31 -0
  278. package/dist/generated/resources/Tr2TexturePipelineStepLoad.js.map +1 -0
  279. package/dist/generated/resources/Tr2TexturePipelineStepPack.js +43 -0
  280. package/dist/generated/resources/Tr2TexturePipelineStepPack.js.map +1 -0
  281. package/dist/generated/resources/TriGeometryResAreaData.js +59 -0
  282. package/dist/generated/resources/TriGeometryResAreaData.js.map +1 -0
  283. package/dist/generated/resources/TriGeometryResJointData.js +38 -0
  284. package/dist/generated/resources/TriGeometryResJointData.js.map +1 -0
  285. package/dist/generated/resources/TriGeometryResLodData.js +88 -0
  286. package/dist/generated/resources/TriGeometryResLodData.js.map +1 -0
  287. package/dist/generated/resources/TriGeometryResMeshData.js +63 -0
  288. package/dist/generated/resources/TriGeometryResMeshData.js.map +1 -0
  289. package/dist/generated/resources/TriGeometryResSkeletonData.js +34 -0
  290. package/dist/generated/resources/TriGeometryResSkeletonData.js.map +1 -0
  291. package/dist/generated/resources/TriJointBinding.js +38 -0
  292. package/dist/generated/resources/TriJointBinding.js.map +1 -0
  293. package/dist/generated/resources/TriMorphTargetGeometryConstants.js +46 -0
  294. package/dist/generated/resources/TriMorphTargetGeometryConstants.js.map +1 -0
  295. package/dist/generated/resources/TriRtGeometryConstants.js +88 -0
  296. package/dist/generated/resources/TriRtGeometryConstants.js.map +1 -0
  297. package/dist/generated/resources/enums.js +18 -0
  298. package/dist/generated/resources/enums.js.map +1 -0
  299. package/dist/generated/resources/index.js +32 -0
  300. package/dist/generated/resources/index.js.map +1 -0
  301. package/dist/index.js +52 -0
  302. package/dist/index.js.map +1 -0
  303. package/dist/resourcePath.js +18 -0
  304. package/dist/resourcePath.js.map +1 -0
  305. package/dist/resourceStates.js +9 -0
  306. package/dist/resourceStates.js.map +1 -0
  307. package/dist/resources/Tr2EffectRes.js +71 -0
  308. package/dist/resources/Tr2EffectRes.js.map +1 -0
  309. package/dist/resources/Tr2GrannyStateRes.js +44 -0
  310. package/dist/resources/Tr2GrannyStateRes.js.map +1 -0
  311. package/dist/resources/Tr2ImageRes.js +114 -0
  312. package/dist/resources/Tr2ImageRes.js.map +1 -0
  313. package/dist/resources/Tr2LightProfileRes.js +40 -0
  314. package/dist/resources/Tr2LightProfileRes.js.map +1 -0
  315. package/dist/resources/TriGeometryRes.js +216 -0
  316. package/dist/resources/TriGeometryRes.js.map +1 -0
  317. package/dist/resources/TriGrannyRes.js +43 -0
  318. package/dist/resources/TriGrannyRes.js.map +1 -0
  319. package/dist/resources/TriTextureRes.js +304 -0
  320. package/dist/resources/TriTextureRes.js.map +1 -0
  321. package/dist/resources/resourceBoundary.js +47 -0
  322. package/dist/resources/resourceBoundary.js.map +1 -0
  323. package/dist/texture/CjsTextureArrayRes.js +406 -0
  324. package/dist/texture/CjsTextureArrayRes.js.map +1 -0
  325. package/dist/texture/CjsTextureParameterProxy.js +133 -0
  326. package/dist/texture/CjsTextureParameterProxy.js.map +1 -0
  327. package/format-notices/black/LICENSE +21 -0
  328. package/format-notices/black/NOTICE +47 -0
  329. package/format-notices/bnk/LICENSE +21 -0
  330. package/format-notices/bnk/NOTICE +17 -0
  331. package/format-notices/cmf/LICENSE +21 -0
  332. package/format-notices/cmf/NOTICE +36 -0
  333. package/format-notices/dds/LICENSE +21 -0
  334. package/format-notices/dds/NOTICE +14 -0
  335. package/format-notices/fbx/LICENSE +21 -0
  336. package/format-notices/fbx/NOTICE +14 -0
  337. package/format-notices/flac/LICENSE +21 -0
  338. package/format-notices/flac/NOTICE +14 -0
  339. package/format-notices/gif/LICENSE +21 -0
  340. package/format-notices/gif/NOTICE +14 -0
  341. package/format-notices/gltf/LICENSE +21 -0
  342. package/format-notices/gltf/NOTICE +27 -0
  343. package/format-notices/jpeg/LICENSE +21 -0
  344. package/format-notices/jpeg/NOTICE +14 -0
  345. package/format-notices/mp3/LICENSE +21 -0
  346. package/format-notices/mp3/NOTICE +14 -0
  347. package/format-notices/mp4/LICENSE +21 -0
  348. package/format-notices/mp4/NOTICE +14 -0
  349. package/format-notices/obj/LICENSE +21 -0
  350. package/format-notices/obj/NOTICE +26 -0
  351. package/format-notices/ogg/LICENSE +21 -0
  352. package/format-notices/ogg/NOTICE +28 -0
  353. package/format-notices/png/LICENSE +21 -0
  354. package/format-notices/png/NOTICE +14 -0
  355. package/format-notices/red/LICENSE +21 -0
  356. package/format-notices/red/NOTICE +31 -0
  357. package/format-notices/stl/LICENSE +21 -0
  358. package/format-notices/stl/NOTICE +21 -0
  359. package/format-notices/tga/LICENSE +21 -0
  360. package/format-notices/tga/NOTICE +14 -0
  361. package/format-notices/wav/LICENSE +21 -0
  362. package/format-notices/wav/NOTICE +14 -0
  363. package/format-notices/webm/LICENSE +21 -0
  364. package/format-notices/webm/NOTICE +14 -0
  365. package/format-notices/webp/LICENSE +21 -0
  366. package/format-notices/webp/NOTICE +14 -0
  367. package/format-notices/wem/LICENSE +57 -0
  368. package/format-notices/wem/NOTICE +33 -0
  369. package/format-notices/yaml/LICENSE +21 -0
  370. package/format-notices/yaml/NOTICE +44 -0
  371. package/package.json +51 -0
  372. package/resource-lifecycle.md +487 -0
@@ -0,0 +1,135 @@
1
+ # Format ownership and fork provenance
2
+
3
+ On 2026-07-13, the non-shader runtime format implementations below were copied
4
+ once into `runtime-resource`. Their standalone repositories remain frozen with
5
+ their existing APIs and names; they are not upstreams for the runtime copies.
6
+
7
+ Copied paths were `src/` and the behavioral `test/` corpus. Package publishing
8
+ scripts and CLIs were not copied. Exact donor license and notice files are kept
9
+ under `format-notices/<format>/`.
10
+
11
+ | Legacy package | Source revision/state | Runtime class | Runtime import |
12
+ |---|---|---|---|
13
+ | `format-black` | `9fcaaff9e5f28c90b628d8a10b7c79aff7913a90` | `CjsBlackFormat` | `@carbonenginejs/runtime-resource/formats/black` |
14
+ | `format-cmf` | unborn working-tree snapshot | `CjsCmfFormat` | `@carbonenginejs/runtime-resource/formats/cmf` |
15
+ | `format-dds` | `66fa149cd826e1114ad0be84479f89dee753ed76` | `CjsDdsFormat` | `@carbonenginejs/runtime-resource/formats/dds` |
16
+ | `format-fbx` | `8d0fcc2fe44c8096b35e360a903bff30b49eb592` | `CjsFbxFormat` | `@carbonenginejs/runtime-resource/formats/fbx` |
17
+ | `format-flac` | unborn working-tree snapshot | `CjsFlacFormat` | `@carbonenginejs/runtime-resource/formats/flac` |
18
+ | `format-gif` | `5d831c5c0533a9579682f776274574289a520899` | `CjsGifFormat` | `@carbonenginejs/runtime-resource/formats/gif` |
19
+ | `format-gltf` | `d0dadf920828bceec987c2a5fa1f161f81db28aa` | `CjsGltfFormat` | `@carbonenginejs/runtime-resource/formats/gltf` |
20
+ | `format-jpeg` | `bed2253ea979bba27812420fa897987d82a91793` | `CjsJpegFormat` | `@carbonenginejs/runtime-resource/formats/jpeg` |
21
+ | `format-mp3` | unborn working-tree snapshot | `CjsMp3Format` | `@carbonenginejs/runtime-resource/formats/mp3` |
22
+ | `format-mp4` | `cffc5a57b115a99ed9e0947a6b9d3390ffc3581c` | `CjsMp4Format` | `@carbonenginejs/runtime-resource/formats/mp4` |
23
+ | `format-obj` | `e5d3f9a1520c7855bd5b6edc1e2304a7b4e18176` | `CjsObjFormat` | `@carbonenginejs/runtime-resource/formats/obj` |
24
+ | `format-ogg` | unborn working-tree snapshot | `CjsOggFormat` | `@carbonenginejs/runtime-resource/formats/ogg` |
25
+ | `format-png` | `04dbb7c0f289043c3c32d9141ec3ef74aeeb1c43` | `CjsPngFormat` | `@carbonenginejs/runtime-resource/formats/png` |
26
+ | `format-red` | `98beab6988111418d6e09827b92d27e08da4c05b` | `CjsRedFormat` | `@carbonenginejs/runtime-resource/formats/red` |
27
+ | `format-stl` | `4858f9a37bf140a3c544fa30a13a6fcce015247b` | `CjsStlFormat` | `@carbonenginejs/runtime-resource/formats/stl` |
28
+ | `format-tga` | `b0f9df263727057537b2279322e8cd088f366179` | `CjsTgaFormat` | `@carbonenginejs/runtime-resource/formats/tga` |
29
+ | `format-wav` | unborn working-tree snapshot | `CjsWavFormat` | `@carbonenginejs/runtime-resource/formats/wav` |
30
+ | `format-webm` | `459203ac293d0d53fff0e43494b7e47d8d4c92bd` | `CjsWebmFormat` | `@carbonenginejs/runtime-resource/formats/webm` |
31
+ | `format-webp` | `19155e9cc7ae05845c23a3c259d3a586569eba40` | `CjsWebpFormat` | `@carbonenginejs/runtime-resource/formats/webp` |
32
+ | `format-yaml` | `3d7e1d1cf9b7a936283d6050efe43a0a9fadb6a4` | `CjsYamlFormat` | `@carbonenginejs/runtime-resource/formats/yaml` |
33
+
34
+ The unborn donors had no commit-addressable `HEAD`; this document deliberately
35
+ records them as working-tree snapshots rather than inventing a revision. Their
36
+ copied runtime files are the deterministic retained snapshot.
37
+
38
+ ## Black definition snapshot
39
+
40
+ The Black and Red readers use the package-owned generated definition snapshot
41
+ at `src/formats/black/core/black-schema-v1-2026-07-11.json`. It was copied from
42
+ `format-carbon` revision `d2a3c67cf3d46e8ba78ca19e66558d868178ec24`
43
+ with SHA-256
44
+ `008ECB29E670EFC678B471A6EFF099600A29C2907912FC42B854995904604691`.
45
+
46
+ This retained generated artifact keeps the published readers deterministic and
47
+ browser-safe without a runtime dependency on a sibling checkout or an
48
+ unpublished `format-carbon` export. `format-carbon` remains the build-time
49
+ authority for future schema regeneration; an updated snapshot must record its
50
+ new source revision and digest here.
51
+
52
+ ## Native additions
53
+
54
+ Formats below were authored directly in `runtime-resource` and have no legacy
55
+ donor package. Their `format-notices/<format>/` entries record third-party
56
+ format attribution rather than fork provenance.
57
+
58
+ | Format | Runtime class | Runtime import | Notes |
59
+ |---|---|---|---|
60
+ | Wwise soundbank (`.bnk`) | `CjsBnkFormat` | `@carbonenginejs/runtime-resource/formats/bnk` | Original code; chunk layout from public community documentation (ww2ogg, vgmstream, wwiser), no code copied. Also carries the SoundbanksInfo JSON helpers (`parseSoundbanksInfo`, `buildSoundbanksCatalog`, `joinSoundbanksInfo`) and `wwiseIdFromName` (FNV-1 32 of the lowercased name, verified against EVE bank/language ids). |
61
+ | Wwise media (`.wem`) | `CjsWemFormat` | `@carbonenginejs/runtime-resource/formats/wem` | Original code; container/codec-tag behavior from public community documentation (ww2ogg, vgmstream, wwiser), no code copied. Includes a Wwise-Vorbis→Ogg repacker (`emit: "ogg"`), an original reimplementation of the ww2ogg algorithm with inline granule computation (no revorb pass needed). |
62
+
63
+ ## Post-fork additions inside copied formats
64
+
65
+ - `formats/cmf` gained a **binary CMF v1 writer** (2026-07-15,
66
+ `src/formats/cmf/core/writer.js`, `CjsCmfFormat.write`/`writeAsync` and
67
+ `Write`/`WriteAsync`): original code implementing CarbonEngine's
68
+ `cmf::BuildFile` behavior — tagged self-relative span flattening with leaf
69
+ chunk dedup, BufferView→section remapping in first-encounter order,
70
+ meshoptimizer vertex/index compression (index compression canonicalizes
71
+ triangle rotation, matching the engine's own writer test expectations), and
72
+ the post-crc32 file checksum. Verified by write→read roundtrips against the
73
+ runtime reader; `E:\carbonengine\mesh\{include,src}\cmf` was the behavioral
74
+ reference, no code copied. `writeShared`/`writeSharedAsync` plus
75
+ `core/pack.js` (channel interleaving, index packing, unique buffer-index
76
+ assignment) serialize shared geometry directly, enabling GR2/OBJ/glTF→CMF —
77
+ verified against real EVE `.gr2` models fetched via
78
+ `@carbonenginejs/tool-index` (positions exact, triangles equivalent).
79
+ - `formats/cmf` also gained the **GR2 skeleton/animation converter**
80
+ (2026-07-15, `src/formats/cmf/core/gr2Anim.js`, applied automatically by
81
+ `writeShared`): GR2-shaped skeletons (root list or `models[].skeleton`)
82
+ convert to CMF bones/parents/rest transforms with inverse binds rebuilt
83
+ from the rest hierarchy; decoded Granny curves convert to CMF Step/Linear
84
+ channels — degree ≤ 1 exactly, degree 2 via adaptive de Boor resampling
85
+ with discontinuities snapped to one float32 ULP. Consumes only decoded
86
+ `{knots, controls}` data so the MIT runtime stays independent of the GR2
87
+ package. Validated on EVE ships (cde3_t3, gde3_t3, cfaux1_t1, mfaux1_t1:
88
+ 3,377 channels ≤ 8.3e-4 positional / ≤ 0.14° rotational vs the GR2 runtime
89
+ sampler; 9 Granny curve formats) and characters (basicfemale: 132-bone
90
+ skeleton, exact skin weights).
91
+ - `formats/ogg` gained a pure-JS **Ogg Vorbis PCM decoder** (2026-07-15,
92
+ `src/formats/ogg/core/{vorbis.js,imdct.js}`, `emit: "pcm"`/`"audio"`):
93
+ original code implementing the Vorbis I specification (floor 1, residues
94
+ 0/1/2, square-polar coupling, FFT-based IMDCT, windowed overlap-add).
95
+ stb_vorbis (public domain) was consulted as a behavioral reference and is
96
+ the source of the spec's floor1 `inverse_db_table` constants; no licensed
97
+ code was copied. Validated bit-comparable to ffmpeg (max diff ~3e-8) and
98
+ vgmstream (±1 int16 LSB) across the EVE Vorbis corpus.
99
+
100
+ ## Wem packed-codebook snapshot
101
+
102
+ The wem Ogg repacker ships a package-owned copy of the aoTuV 6.03 packed
103
+ Vorbis codebook library at
104
+ `src/formats/wem/core/packedCodebooksAotuv603.js` (base64 module). It was
105
+ copied byte-identically from `packed_codebooks_aoTuV_603.bin` in the ww2ogg
106
+ distribution (`github.com/hcs64/ww2ogg`), 74,387 bytes, SHA-256
107
+ `00a93eab267d281401b1efd54e888a2e183299b9e6c446c48d09f701a89d9d27`, retrieved
108
+ 2026-07-15. The data is BSD-licensed (Xiph.org Foundation, Adam Gashlin);
109
+ attribution and the full license terms are recorded in
110
+ `format-notices/wem/NOTICE` and `format-notices/wem/LICENSE`. An updated
111
+ snapshot must record its new source and digest here.
112
+
113
+ ## Deliberately not copied
114
+
115
+ - `format-gr2` is the intended runtime-resource owner target, but its current
116
+ BitKnit-derived implementation is EUPL-1.2. It remains separate and active
117
+ until that code is replaced or an explicit distribution-license decision is
118
+ made. It has not been deprecated or relabeled as MIT.
119
+ - `format-carbon` remains the schema emitter/generator and build-time schema
120
+ authority. Black and Red consume its published Black definitions.
121
+ - `format-dxbc`, `format-hlsl`, `format-webgl`, and `format-webgpu` are active
122
+ shader work and were not copied, annotated, or otherwise modified by this
123
+ migration.
124
+
125
+ ## Typed-array ownership adjustments
126
+
127
+ The runtime copies preserve caller byte objects by reference. During the fork,
128
+ three avoidable source-buffer copies were changed to views:
129
+
130
+ - CMF compressed sections use `Uint8Array.subarray`.
131
+ - glTF GLB chunks use `Uint8Array.subarray`.
132
+ - FBX raw binary property payloads use `Uint8Array.subarray`.
133
+
134
+ Decoder output buffers and GIF per-frame snapshots still allocate because those
135
+ values have independent semantic identity.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 CarbonEngineJS contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/NOTICE ADDED
@@ -0,0 +1,29 @@
1
+ carbonenginejs/runtime-resource
2
+ ================================
3
+
4
+ Copyright (c) 2026 CarbonEngineJS contributors.
5
+
6
+ This package owns CarbonEngineJS resource lifecycle, format selection, and the
7
+ non-shader format implementations listed under `format-notices/`.
8
+
9
+ CarbonEngine source material, format names, class names, and schema semantics
10
+ remain copyright their original CarbonEngine authors. Fenris Creations
11
+ (CCP Games) source material, tools, assets, shader behavior, and EVE-related
12
+ data remain copyright their original holders. These names are used for
13
+ interoperability and provenance context. This project is not affiliated with
14
+ or endorsed by CCP Games.
15
+
16
+ The copied format implementations retain their original MIT license and NOTICE
17
+ files under `format-notices/<format>/`. Those notices include third-party
18
+ dependency and behavioral-reference attribution, including meshoptimizer,
19
+ yaml, and black-reader-js.
20
+
21
+ The bundled Black definition JSON is a generated CarbonEngineJS schema artifact
22
+ copied from `format-carbon` revision
23
+ `d2a3c67cf3d46e8ba78ca19e66558d868178ec24`. Its exact digest and retention
24
+ purpose are recorded in `FORMAT-PROVENANCE.md`; no CarbonEngine source file or
25
+ game asset is embedded in that generated definition snapshot.
26
+
27
+ The EUPL-1.2 `format-gr2` implementation is deliberately not included. GR2
28
+ ownership migration remains deferred until its EUPL-derived BitKnit boundary
29
+ is replaced or an explicit distribution-license decision is made.
package/README.md ADDED
@@ -0,0 +1,241 @@
1
+ # @carbonenginejs/runtime-resource
2
+
3
+ CarbonEngineJS resource lifecycle, cache, format selection, source, and object
4
+ loading contracts.
5
+
6
+ This package owns the GPU-free resource layer:
7
+
8
+ - `CjsResource` state and Carbon-style resource methods.
9
+ - `CjsTextureArrayRes` and `CjsTextureParameterProxy` for material-facing,
10
+ frame-coalesced texture-array inputs without changing ordinary texture
11
+ parameter behavior.
12
+ - `CjsMotherLode` cache lookup/insert/delete/stats.
13
+ - `CjsResMan` semantic resource construction, registered-format selection,
14
+ concurrency-limited source loading, staged prepare queues, layered
15
+ source/read/resource deduplication, object loader dispatch, and prefetch.
16
+ - Raw `CjsEventEmitter` from `core-types/model` for manager/runtime events
17
+ without requiring `CjsModel` inheritance. External listeners unregister
18
+ directly with `OffEvent`; listener scopes, owner-side `ListenTo` helpers,
19
+ and a separate resource notification layer are not part of the contract.
20
+ - Path normalization and extension helpers.
21
+ - Source adapters for memory and `fetch`.
22
+ - Plain reader/converter payload objects with focused shared validators.
23
+ - Canonical Carbon resource classes that validate and hold CPU payloads
24
+ privately:
25
+ `TriTextureRes`, `TriGeometryRes`, `Tr2EffectRes`, `Tr2ImageRes`,
26
+ `TriGrannyRes`, `Tr2GrannyStateRes`, and `Tr2LightProfileRes`.
27
+ - Opaque engine-owned subobject slots for backend adapters.
28
+ - Format policy, format class contracts, and load/prepare state mapping stay
29
+ inside this package's implementation and public API rather than external
30
+ workspace notes.
31
+ - Non-shader format implementations are owned as explicit tree-shakeable
32
+ subpaths under `@carbonenginejs/runtime-resource/formats/<name>`.
33
+
34
+ It intentionally does not own WebGL/WebGPU realization. Engine packages should adapt prepared resources into backend objects.
35
+
36
+ Authoring source is decorated JavaScript. Published/consumer output is built ESM in `npm/dist`.
37
+
38
+ ## Package relationships
39
+
40
+ - `runtime-core` may configure and expose a `CjsResMan`, but does not own its
41
+ implementation.
42
+ - `runtime-trinity` and `runtime-sof` may request GPU-free objects and resources
43
+ without selecting an engine.
44
+ - `engine-webgpu` and future WebGL engines consume loaded resources and own all
45
+ backend allocations, preparation, replacement, and destruction.
46
+
47
+ Concrete formats are not imported or registered by the package root:
48
+
49
+ ```js
50
+ import { CjsResMan } from "@carbonenginejs/runtime-resource";
51
+ import { CjsMp4Format } from "@carbonenginejs/runtime-resource/formats/mp4";
52
+
53
+ const resMan = new CjsResMan().Register({
54
+ source,
55
+ formats: [ CjsMp4Format ]
56
+ });
57
+
58
+ const resource = resMan.GetResource("res:/video/intro.mp4");
59
+ const video = await resource.Ready();
60
+ ```
61
+
62
+ Formats return plain payload objects. Semantic resource classes apply them
63
+ through `SetPayload()`, validate their own required fields, and throw
64
+ `CJS_RESOURCE_PAYLOAD_INVALID` before replacing a previously valid payload.
65
+ `GetPayload()`, `HasPayload()`, and `ReleasePayload()` manage transient CPU
66
+ retention without introducing a parallel DTO class hierarchy.
67
+
68
+ ## Queued load and staged prepare
69
+
70
+ `GetObject()`, `LoadObject()`, and resource `Ready()` use two manager-owned
71
+ queues:
72
+
73
+ ```text
74
+ BACKGROUND: deduplicated source load, limited by maxConcurrentLoads
75
+ MAIN: read -> configured prepare stages -> resource publication
76
+ ```
77
+
78
+ Each main-queue stage is a separate item. `maxPrepareTime` is a per-pump budget
79
+ in seconds, and `maxPrepareItemsPerTick` can add an item-count limit. The
80
+ default scheduler keeps promise-based calls working; a `CjsLibrary` or direct
81
+ caller can provide its frame scheduler and default build behavior:
82
+
83
+ ```js
84
+ const resMan = new CjsResMan({
85
+ source,
86
+ maxConcurrentLoads: 8,
87
+ maxPrepareTime: 0.005,
88
+ queueScheduler: callback => requestAnimationFrame(callback),
89
+ preparePipelines: {
90
+ cmf_test: {
91
+ default: true,
92
+ stages: [
93
+ {
94
+ name: "convert",
95
+ prepare: (payload, context) => convertToCmf(payload, context)
96
+ }
97
+ ]
98
+ }
99
+ }
100
+ });
101
+
102
+ await resMan.FetchResource("res:/model/ship.gr2", {
103
+ requirement: "geometry",
104
+ preparePipeline: "cmf_test"
105
+ });
106
+ ```
107
+
108
+ The library chooses the named pipeline from registered behavior and detected
109
+ capabilities. `CjsResMan` executes that request; it does not inspect WebGL,
110
+ WebGPU, texture, geometry, or codec support to select one. A request may
111
+ override the default with `preparePipeline` or append direct `prepareStages`.
112
+
113
+ Blue-compatible queue controls are exposed directly on `CjsResMan`:
114
+ `AddToQueue`, `CancelFromQueue`, `GetNextIdForQueue`,
115
+ `PumpMainThreadQueue`, `PauseQueue`, `ResumeQueue`, `GetPendingLoads`, and
116
+ `GetPendingPrepares`. `Update()`/`Tick()` pump work, while `Wait()` is the
117
+ method-level queue fence; no separate fence object is required.
118
+
119
+ Format classes own input extensions. Resource classes are registered by a
120
+ semantic requirement, never by file extension:
121
+
122
+ ```js
123
+ const resMan = new CjsResMan().Register({
124
+ source,
125
+ formats: [ CjsDdsFormat, CjsPngFormat ],
126
+ resourceTypes: [ TriTextureRes, Tr2ImageRes ]
127
+ });
128
+
129
+ const texture = resMan.GetResource("res:/image/ship.png", {
130
+ requirement: "texture",
131
+ emit: "image"
132
+ });
133
+ const image = resMan.GetResource("res:/image/ship.png", {
134
+ requirement: "image",
135
+ emit: "image"
136
+ });
137
+ ```
138
+
139
+ Those are distinct resource identities but share the normalized source-byte
140
+ operation. The manager does not expose an extension-to-resource compatibility
141
+ registry.
142
+
143
+ Texture-array resources expose one ordinary-looking proxy per ordered layer:
144
+
145
+ ```js
146
+ const textureArray = new CjsTextureArrayRes({
147
+ paths: [
148
+ "res:/detail1.dds",
149
+ "res:/detail2.dds",
150
+ "res:/detail3.dds"
151
+ ],
152
+ layerNames: [ "Detail1Map", "Detail2Map", "Detail3Map" ],
153
+ updateScheduler: resource => frameQueue.add(resource)
154
+ });
155
+
156
+ const detail2 = textureArray.GetLayerParameter(1);
157
+ detail2.SetValue("res:/replacement.dds");
158
+
159
+ detail2.textureRes === textureArray; // true
160
+ ```
161
+
162
+ Proxy setters only update their source path and invalidate the parent. The
163
+ parent is scheduled once even if several proxies change in the same frame.
164
+ The next-frame consumer calls `Update()` or `ConsumeUpdateRequest()` to obtain
165
+ one immutable ordered snapshot. Runtime-resource does not know which shader
166
+ metadata caused the aggregate request; shader packages and engine adapters map
167
+ public parameter names to layer indices.
168
+
169
+ Public effect parameters remain separate from these internal proxies. Their
170
+ authored paths and individual 2D source resources are not replaced by the
171
+ aggregate. An engine-owned, non-persisted bridge mirrors public changes into
172
+ the fixed internal layers.
173
+
174
+ Consumed snapshots are explicit in-flight generations. An adapter either
175
+ publishes the current candidate atomically, requeues retryable work, or records
176
+ failure:
177
+
178
+ ```js
179
+ const request = textureArray.ConsumeUpdateRequest();
180
+
181
+ try {
182
+ const candidate = await adapter.PrepareTextureArray(request);
183
+ const result = textureArray.CommitPreparedAdapterRevision(
184
+ request.revision,
185
+ "webgpu",
186
+ candidate
187
+ );
188
+
189
+ // A rejected/stale candidate is destroyed by the commit method by default.
190
+ // The adapter owns disposal of a successfully displaced allocation.
191
+ result.displaced?.destroy();
192
+ } catch (error) {
193
+ textureArray.FailUpdateRequest(request.revision, error, { retry: true });
194
+ }
195
+
196
+ await textureArray.Ready(); // the generation requested at call time
197
+ ```
198
+
199
+ `SetLayerResource()` attaches a resolved source without rewriting the logical
200
+ requested path. `TouchLayer()` invalidates an in-place source revision.
201
+ `RetryUpdateRequest()` restores consumed work, and `HandleAdapterLoss()` drops
202
+ an unusable adapter allocation and schedules a complete topology rebuild.
203
+ Topology-changing snapshots set `topologyChanged: true` and report only valid
204
+ current layer indices in `dirtyLayers`.
205
+
206
+ ## Development
207
+
208
+ Install dependencies and run the non-interactive baseline checks from the
209
+ repository root:
210
+
211
+ ```sh
212
+ npm install
213
+ npm run lint
214
+ npm run check
215
+ npm test
216
+ ```
217
+
218
+ `npm run check` builds the consumer package and proves that decorator metadata
219
+ matches between authoring source and built output. `npm test` additionally runs
220
+ the complete GPU-free unit suite; it requires no private assets, credentials,
221
+ network access, browser, or GPU after dependencies are installed.
222
+
223
+ See [Runtime Resource Lifecycle](resource-lifecycle.md) for state, retention,
224
+ and texture-array generation contracts. See
225
+ [Format ownership and fork provenance](FORMAT-PROVENANCE.md) for copied-reader
226
+ ownership, licenses, exclusions, and the deferred GR2 migration. Both documents
227
+ ship with the published package.
228
+
229
+ ## Provenance
230
+
231
+ CarbonEngine and Fenris Creations (CCP Games) are named for interoperability
232
+ and provenance context. This package contains CarbonEngineJS original resource
233
+ infrastructure, CarbonEngine-shaped resource ports, and maintained copies of
234
+ the non-shader readers identified in `FORMAT-PROVENANCE.md`. It does not copy
235
+ Fenris Creations game assets, proprietary documentation, or shader source.
236
+ CarbonEngine and historical JavaScript implementations were used as the
237
+ behavioral references described in the package notices.
238
+
239
+ This project is not affiliated with, endorsed by, or sponsored by CCP Games or
240
+ CCP ehf. EVE Online and related marks remain the property of their respective
241
+ owners.
@@ -0,0 +1,56 @@
1
+ import { normalizeResourcePath } from './resourcePath.js';
2
+
3
+ class CjsMotherLode {
4
+ #resources = new Map();
5
+ Lookup(path, variant = "") {
6
+ return this.#resources.get(GetCacheKey(path, variant)) || null;
7
+ }
8
+ Insert(resource, path = resource?.GetPath?.() ?? resource?.path, variant = "") {
9
+ const key = GetCacheKey(path, variant);
10
+ this.#resources.set(key, resource);
11
+ return resource;
12
+ }
13
+ Delete(path, variant = "") {
14
+ return this.#resources.delete(GetCacheKey(path, variant));
15
+ }
16
+ DeleteAll(path) {
17
+ const normalizedPath = normalizeResourcePath(path);
18
+ if (!normalizedPath) throw new TypeError("CjsMotherLode requires a resource path.");
19
+ const prefix = `${normalizedPath}\u0000`;
20
+ let deleted = false;
21
+ for (const key of this.#resources.keys()) {
22
+ if (key === normalizedPath || key.startsWith(prefix)) {
23
+ deleted = this.#resources.delete(key) || deleted;
24
+ }
25
+ }
26
+ return deleted;
27
+ }
28
+ Clear() {
29
+ this.#resources.clear();
30
+ return this;
31
+ }
32
+ Has(path, variant = "") {
33
+ return this.#resources.has(GetCacheKey(path, variant));
34
+ }
35
+ GetCount() {
36
+ return this.#resources.size;
37
+ }
38
+ GetStats() {
39
+ return Object.freeze({
40
+ count: this.#resources.size,
41
+ paths: Object.freeze([...new Set([...this.#resources.values()].map(resource => resource?.GetPath?.() ?? resource?.path ?? ""))].filter(Boolean))
42
+ });
43
+ }
44
+ Entries() {
45
+ return this.#resources.entries();
46
+ }
47
+ }
48
+ function GetCacheKey(path, variant = "") {
49
+ const normalizedPath = normalizeResourcePath(path);
50
+ if (!normalizedPath) throw new TypeError("CjsMotherLode requires a resource path.");
51
+ const normalizedVariant = variant === null || variant === undefined ? "" : String(variant);
52
+ return normalizedVariant ? `${normalizedPath}\u0000${normalizedVariant}` : normalizedPath;
53
+ }
54
+
55
+ export { CjsMotherLode };
56
+ //# sourceMappingURL=CjsMotherLode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CjsMotherLode.js","sources":["../../src/CjsMotherLode.js"],"sourcesContent":["import { normalizeResourcePath } from \"./resourcePath.js\";\n\nexport class CjsMotherLode\n{\n #resources = new Map();\n\n Lookup(path, variant = \"\") {\n return this.#resources.get(GetCacheKey(path, variant)) || null;\n }\n\n Insert(resource, path = resource?.GetPath?.() ?? resource?.path, variant = \"\") {\n const key = GetCacheKey(path, variant);\n this.#resources.set(key, resource);\n return resource;\n }\n\n Delete(path, variant = \"\") {\n return this.#resources.delete(GetCacheKey(path, variant));\n }\n\n DeleteAll(path) {\n const normalizedPath = normalizeResourcePath(path);\n if (!normalizedPath) throw new TypeError(\"CjsMotherLode requires a resource path.\");\n const prefix = `${normalizedPath}\\u0000`;\n let deleted = false;\n for (const key of this.#resources.keys())\n {\n if (key === normalizedPath || key.startsWith(prefix))\n {\n deleted = this.#resources.delete(key) || deleted;\n }\n }\n return deleted;\n }\n\n Clear() {\n this.#resources.clear();\n return this;\n }\n\n Has(path, variant = \"\") {\n return this.#resources.has(GetCacheKey(path, variant));\n }\n\n GetCount() {\n return this.#resources.size;\n }\n\n GetStats() {\n return Object.freeze({\n count: this.#resources.size,\n paths: Object.freeze([ ...new Set(\n [ ...this.#resources.values() ].map(resource => resource?.GetPath?.() ?? resource?.path ?? \"\")\n ) ].filter(Boolean))\n });\n }\n\n Entries() {\n return this.#resources.entries();\n }\n}\n\nfunction GetCacheKey(path, variant = \"\")\n{\n const normalizedPath = normalizeResourcePath(path);\n if (!normalizedPath) throw new TypeError(\"CjsMotherLode requires a resource path.\");\n const normalizedVariant = variant === null || variant === undefined ? \"\" : String(variant);\n return normalizedVariant ? `${normalizedPath}\\u0000${normalizedVariant}` : normalizedPath;\n}\n"],"names":["CjsMotherLode","Map","Lookup","path","variant","get","GetCacheKey","Insert","resource","GetPath","key","set","Delete","delete","DeleteAll","normalizedPath","normalizeResourcePath","TypeError","prefix","deleted","keys","startsWith","Clear","clear","Has","has","GetCount","size","GetStats","Object","freeze","count","paths","Set","values","map","filter","Boolean","Entries","entries","normalizedVariant","undefined","String"],"mappings":"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"}