@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 @@
1
+ {"version":3,"file":"CjsRedReader.js","sources":["../../../../../src/formats/red/core/CjsRedReader.js"],"sourcesContent":["import { resolveHydrationAdapter } from \"@carbonenginejs/core-types/hydration\";\n\nimport { parseRed, isTypedTable, decodeTypedTable, isStrippedKey } from \"./redGraph.js\";\n\n/**\n * Reads a Red (YAML) object graph.\n *\n * The graph is type-discriminated (`type:` per node) and self-referential\n * (YAML anchors/aliases share object identities). This reader walks it into\n * one of three shapes, sharing repeated nodes and always stripping\n * authoring-tool keys (double-underscore prefixed).\n */\nexport class CjsRedReader\n{\n constructor(input, options = {})\n {\n this.options = { ...options };\n this.root = parseRed(input, options);\n this.adapter = resolveHydrationAdapter(options);\n this.hydrationOptions = {\n ...options,\n markDirty: false,\n skipUpdate: true,\n skipEvents: true\n };\n this.mode = \"payload\";\n this.ResetReadState();\n }\n\n ResetReadState()\n {\n this.refs = new Map(); // source object -> hydrated target\n this.ids = new Map(); // source object -> reference id\n this.nextId = this.options.firstId || 1;\n this.runtimeInstances = [];\n this.reports = [];\n }\n\n Inspect()\n {\n const typeCounts = {};\n const seen = new Set();\n let nodeCount = 0;\n\n const visit = (node) =>\n {\n if (Array.isArray(node)) { node.forEach(visit); return; }\n if (isTypedTable(node)) return;\n if (!node || typeof node !== \"object\") return;\n if (seen.has(node)) return;\n seen.add(node);\n\n if (typeof node.type === \"string\")\n {\n nodeCount++;\n typeCounts[node.type] = (typeCounts[node.type] || 0) + 1;\n }\n\n for (const key of Object.keys(node))\n {\n if (isStrippedKey(key)) continue;\n visit(node[key]);\n }\n };\n\n visit(this.root);\n\n return {\n format: { id: \"red\" },\n root: { type: this.RootType() },\n nodeCount,\n typeCounts\n };\n }\n\n RootType()\n {\n return this.root && typeof this.root === \"object\" && typeof this.root.type === \"string\"\n ? this.root.type\n : null;\n }\n\n Read()\n {\n return this.ReadPayload();\n }\n\n ReadPayload()\n {\n this.mode = \"payload\";\n this.ResetReadState();\n const object = this.Hydrate(this.root);\n return { comments: this.reports, object };\n }\n\n ReadRuntime()\n {\n this.mode = \"runtime\";\n this.ResetReadState();\n const root = this.Hydrate(this.root);\n\n // Phase 3: whole graph built and references resolved - finalize once\n // per instance, children before parents (completion order).\n for (const record of this.runtimeInstances)\n {\n this.adapter.finalize(record.instance, { kind: record.type });\n }\n\n return { root, format: { id: \"red\" }, reports: this.reports };\n }\n\n ReadRaw()\n {\n this.mode = \"raw\";\n this.ResetReadState();\n return this.Hydrate(this.root);\n }\n\n Hydrate(node)\n {\n if (Array.isArray(node)) return node.map(item => this.Hydrate(item));\n if (isTypedTable(node)) return decodeTypedTable(node).map(row => this.Hydrate(row));\n\n if (node && typeof node === \"object\")\n {\n if (this.refs.has(node)) return this.MakeReference(node);\n\n const type = typeof node.type === \"string\" ? node.type : null;\n const target = this.CreateTarget(type);\n this.refs.set(node, target);\n\n const values = {};\n for (const key of Object.keys(node))\n {\n if (isStrippedKey(key)) continue;\n if (key === \"type\" && this.mode !== \"raw\") continue;\n values[key] = this.Hydrate(node[key]);\n }\n\n this.AssignValues(target, values, type);\n return target;\n }\n\n return node;\n }\n\n CreateTarget(type)\n {\n if (this.mode === \"runtime\")\n {\n const built = this.adapter.construct(type, { kind: type, options: this.options });\n if (built !== undefined) return built;\n\n const ClassConstructor = this.ResolveClass(type);\n if (ClassConstructor) return new ClassConstructor();\n\n return { _sourceClassName: type || null };\n }\n\n if (this.mode === \"raw\") return {};\n\n const typeField = this.GetPayloadField(\"payloadTypeField\", \"_type\");\n return typeField && type ? { [typeField]: type } : {};\n }\n\n AssignValues(target, values, type)\n {\n if (this.mode === \"runtime\")\n {\n // Untyped maps are value objects inside a typed Red graph. They do\n // not participate in the runtime class lifecycle.\n if (!type)\n {\n Object.assign(target, values);\n return;\n }\n this.adapter.applyValues(target, values, { kind: type, options: this.hydrationOptions });\n this.runtimeInstances.push({ instance: target, type });\n return;\n }\n\n Object.assign(target, values);\n }\n\n MakeReference(node)\n {\n const target = this.refs.get(node);\n if (this.mode !== \"payload\") return target;\n\n const idField = this.GetPayloadField(\"payloadIdField\", \"_id\");\n const referenceField = this.GetPayloadField(\"payloadReferenceField\", \"_reference\");\n const id = this.IdFor(node);\n\n if (idField && target && typeof target === \"object\" && !Object.prototype.hasOwnProperty.call(target, idField))\n {\n target[idField] = id;\n }\n\n return referenceField ? { [referenceField]: id } : target;\n }\n\n IdFor(node)\n {\n let id = this.ids.get(node);\n if (id === undefined)\n {\n id = this.nextId++;\n this.ids.set(node, id);\n }\n return id;\n }\n\n GetPayloadField(name, fallback)\n {\n const value = this.options[name];\n return value === false ? null : (value || fallback);\n }\n\n ResolveClass(type)\n {\n if (!type) return null;\n\n const classes = this.options.classes || {};\n const Schema = this.options.registry || null;\n return classes[type] || (Schema ? Schema.GetConstructor(type) : null);\n }\n}\n"],"names":["CjsRedReader","constructor","input","options","root","parseRed","adapter","resolveHydrationAdapter","hydrationOptions","markDirty","skipUpdate","skipEvents","mode","ResetReadState","refs","Map","ids","nextId","firstId","runtimeInstances","reports","Inspect","typeCounts","seen","Set","nodeCount","visit","node","Array","isArray","forEach","isTypedTable","has","add","type","key","Object","keys","isStrippedKey","format","id","RootType","Read","ReadPayload","object","Hydrate","comments","ReadRuntime","record","finalize","instance","kind","ReadRaw","map","item","decodeTypedTable","row","MakeReference","target","CreateTarget","set","values","AssignValues","built","construct","undefined","ClassConstructor","ResolveClass","_sourceClassName","typeField","GetPayloadField","assign","applyValues","push","get","idField","referenceField","IdFor","prototype","hasOwnProperty","call","name","fallback","value","classes","Schema","registry","GetConstructor"],"mappings":";;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,YAAY,CACzB;AACIC,EAAAA,WAAWA,CAACC,KAAK,EAAEC,OAAO,GAAG,EAAE,EAC/B;IACI,IAAI,CAACA,OAAO,GAAG;MAAE,GAAGA;KAAS;IAC7B,IAAI,CAACC,IAAI,GAAGC,QAAQ,CAACH,KAAK,EAAEC,OAAO,CAAC;AACpC,IAAA,IAAI,CAACG,OAAO,GAAGC,uBAAuB,CAACJ,OAAO,CAAC;IAC/C,IAAI,CAACK,gBAAgB,GAAG;AACpB,MAAA,GAAGL,OAAO;AACVM,MAAAA,SAAS,EAAE,KAAK;AAChBC,MAAAA,UAAU,EAAE,IAAI;AAChBC,MAAAA,UAAU,EAAE;KACf;IACD,IAAI,CAACC,IAAI,GAAG,SAAS;IACrB,IAAI,CAACC,cAAc,EAAE;AACzB,EAAA;AAEAA,EAAAA,cAAcA,GACd;IACI,IAAI,CAACC,IAAI,GAAG,IAAIC,GAAG,EAAE,CAAC;IACtB,IAAI,CAACC,GAAG,GAAG,IAAID,GAAG,EAAE,CAAC;IACrB,IAAI,CAACE,MAAM,GAAG,IAAI,CAACd,OAAO,CAACe,OAAO,IAAI,CAAC;IACvC,IAAI,CAACC,gBAAgB,GAAG,EAAE;IAC1B,IAAI,CAACC,OAAO,GAAG,EAAE;AACr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a,EAAE,CAAC;AAC1B,IAAA;AACA,IAAA,OAAOA,EAAE;AACb,EAAA;AAEA8B,EAAAA,eAAeA,CAACW,IAAI,EAAEC,QAAQ,EAC9B;AACI,IAAA,MAAMC,KAAK,GAAG,IAAI,CAAChF,OAAO,CAAC8E,IAAI,CAAC;IAChC,OAAOE,KAAK,KAAK,KAAK,GAAG,IAAI,GAAIA,KAAK,IAAID,QAAS;AACvD,EAAA;EAEAf,YAAYA,CAACjC,IAAI,EACjB;AACI,IAAA,IAAI,CAACA,IAAI,EAAE,OAAO,IAAI;IAEtB,MAAMkD,OAAO,GAAG,IAAI,CAACjF,OAAO,CAACiF,OAAO,IAAI,EAAE;IAC1C,MAAMC,MAAM,GAAG,IAAI,CAAClF,OAAO,CAACmF,QAAQ,IAAI,IAAI;AAC5C,IAAA,OAAOF,OAAO,CAAClD,IAAI,CAAC,KAAKmD,MAAM,GAAGA,MAAM,CAACE,cAAc,CAACrD,IAAI,CAAC,GAAG,IAAI,CAAC;AACzE,EAAA;AACJ;;;;"}
@@ -0,0 +1,3 @@
1
+ export { classes, classes as default, enums, generatedAt, schema, version } from '../../black/core/blackDefinitions.js';
2
+ export { default as definitions } from '../../black/core/black-schema-v1-2026-07-11.json.js';
3
+ //# sourceMappingURL=blackDefinitions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"blackDefinitions.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -0,0 +1,136 @@
1
+ const OUTPUT_JSON = "json";
2
+ const OUTPUT_PAYLOAD = "payload";
3
+ const OUTPUT_RUNTIME = "runtime";
4
+ const OUTPUT_RAW = "raw";
5
+ const DEFAULT_VALUES = Object.freeze({
6
+ emit: OUTPUT_JSON,
7
+ schema: null,
8
+ registry: null,
9
+ firstId: 1,
10
+ parse: null,
11
+ adapter: null,
12
+ adapters: null,
13
+ payloadTypeField: "_type",
14
+ payloadIdField: "_id",
15
+ payloadReferenceField: "_reference",
16
+ classes: Object.freeze({})
17
+ });
18
+ const OPTION_KEYS = new Set(Object.keys(DEFAULT_VALUES));
19
+ function hasOwn(value, key) {
20
+ return Object.prototype.hasOwnProperty.call(value, key);
21
+ }
22
+ function normalizeEmit(emit, readerName) {
23
+ if (emit === undefined || emit === OUTPUT_JSON) return OUTPUT_JSON;
24
+ if (emit === OUTPUT_PAYLOAD) return OUTPUT_PAYLOAD;
25
+ if (emit === OUTPUT_RUNTIME) return OUTPUT_RUNTIME;
26
+ if (emit === OUTPUT_RAW) return OUTPUT_RAW;
27
+ throw new Error(`${readerName} unknown emit value "${emit}"`);
28
+ }
29
+ function assertKnownOptions(options, readerName) {
30
+ for (const key of Object.keys(options)) {
31
+ if (!OPTION_KEYS.has(key)) {
32
+ throw new TypeError(`${readerName} unknown option "${key}"`);
33
+ }
34
+ }
35
+ }
36
+ function classMap(values) {
37
+ return values && values.classes ? values.classes : {};
38
+ }
39
+ function cloneValues(values) {
40
+ return {
41
+ emit: values.emit,
42
+ schema: values.schema ?? null,
43
+ registry: values.registry ?? null,
44
+ firstId: values.firstId ?? 1,
45
+ parse: values.parse ?? null,
46
+ adapter: values.adapter ?? null,
47
+ adapters: values.adapters ?? null,
48
+ payloadTypeField: values.payloadTypeField,
49
+ payloadIdField: values.payloadIdField,
50
+ payloadReferenceField: values.payloadReferenceField,
51
+ classes: {
52
+ ...classMap(values)
53
+ }
54
+ };
55
+ }
56
+ function validateClassKey(classKeys, key, readerName) {
57
+ if (typeof key !== "string" || !key) {
58
+ throw new Error(`${readerName} class type must be a non-empty string`);
59
+ }
60
+ }
61
+ function validateClass(classKeys, type, Class, readerName) {
62
+ validateClassKey(classKeys, type, readerName);
63
+ if (typeof Class !== "function") {
64
+ throw new TypeError(`${readerName} class "${type}" must be a constructor`);
65
+ }
66
+ }
67
+ function mergeClasses(values, classes, classKeys, readerName) {
68
+ if (!classes || typeof classes !== "object") {
69
+ throw new TypeError(`${readerName} classes option must be an object`);
70
+ }
71
+ const next = {
72
+ ...values.classes
73
+ };
74
+ for (const [type, Class] of Object.entries(classes)) {
75
+ validateClass(classKeys, type, Class, readerName);
76
+ next[type] = Class;
77
+ }
78
+ values.classes = next;
79
+ }
80
+ function normalizeValues(base, options, classKeys, readerName) {
81
+ if (!options || typeof options !== "object") {
82
+ throw new TypeError(`${readerName} options must be an object`);
83
+ }
84
+ assertKnownOptions(options, readerName);
85
+ const values = cloneValues(base);
86
+ if (hasOwn(options, "emit")) values.emit = normalizeEmit(options.emit, readerName);
87
+ if (hasOwn(options, "schema")) values.schema = options.schema ?? null;
88
+ if (hasOwn(options, "registry")) values.registry = options.registry ?? null;
89
+ if (hasOwn(options, "firstId")) values.firstId = options.firstId ?? 1;
90
+ if (hasOwn(options, "parse")) {
91
+ if (options.parse !== null && options.parse !== undefined && typeof options.parse !== "function") {
92
+ throw new TypeError(`${readerName} parse option must be a function`);
93
+ }
94
+ values.parse = options.parse ?? null;
95
+ }
96
+ if (hasOwn(options, "adapter")) values.adapter = options.adapter ?? null;
97
+ if (hasOwn(options, "adapters")) values.adapters = options.adapters ?? null;
98
+ if (hasOwn(options, "payloadTypeField")) values.payloadTypeField = options.payloadTypeField;
99
+ if (hasOwn(options, "payloadIdField")) values.payloadIdField = options.payloadIdField;
100
+ if (hasOwn(options, "payloadReferenceField")) values.payloadReferenceField = options.payloadReferenceField;
101
+ if (hasOwn(options, "classes")) mergeClasses(values, options.classes, classKeys, readerName);
102
+ return values;
103
+ }
104
+ function copyReaderOptions(values) {
105
+ const {
106
+ emit: _emit,
107
+ schema: _schema,
108
+ classes: _classes,
109
+ ...readerOptions
110
+ } = values;
111
+ return readerOptions;
112
+ }
113
+ function toJsonValue(value, seen = new WeakSet()) {
114
+ if (value === null || typeof value !== "object") return value;
115
+ if (ArrayBuffer.isView(value)) return Array.from(value, item => toJsonValue(item, seen));
116
+ if (Array.isArray(value)) return value.map(item => toJsonValue(item, seen));
117
+ if (seen.has(value)) {
118
+ throw new TypeError("Reader.toJSON cannot convert circular data");
119
+ }
120
+ if (typeof value.toJSON === "function") {
121
+ seen.add(value);
122
+ const json = toJsonValue(value.toJSON(), seen);
123
+ seen.delete(value);
124
+ return json;
125
+ }
126
+ seen.add(value);
127
+ const out = {};
128
+ for (const key of Object.keys(value)) {
129
+ out[key] = toJsonValue(value[key], seen);
130
+ }
131
+ seen.delete(value);
132
+ return out;
133
+ }
134
+
135
+ export { DEFAULT_VALUES, OUTPUT_JSON, OUTPUT_PAYLOAD, OUTPUT_RAW, OUTPUT_RUNTIME, copyReaderOptions, normalizeValues, toJsonValue, validateClass, validateClassKey };
136
+ //# sourceMappingURL=helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.js","sources":["../../../../../src/formats/red/core/helpers.js"],"sourcesContent":["export const OUTPUT_JSON = \"json\";\nexport const OUTPUT_PAYLOAD = \"payload\";\nexport const OUTPUT_RUNTIME = \"runtime\";\nexport const OUTPUT_RAW = \"raw\";\n\nexport const DEFAULT_VALUES = Object.freeze({\n emit: OUTPUT_JSON,\n schema: null,\n registry: null,\n firstId: 1,\n parse: null,\n adapter: null,\n adapters: null,\n payloadTypeField: \"_type\",\n payloadIdField: \"_id\",\n payloadReferenceField: \"_reference\",\n classes: Object.freeze({})\n});\n\nconst OPTION_KEYS = new Set(Object.keys(DEFAULT_VALUES));\n\nfunction hasOwn(value, key)\n{\n return Object.prototype.hasOwnProperty.call(value, key);\n}\n\nfunction normalizeEmit(emit, readerName)\n{\n if (emit === undefined || emit === OUTPUT_JSON) return OUTPUT_JSON;\n if (emit === OUTPUT_PAYLOAD) return OUTPUT_PAYLOAD;\n if (emit === OUTPUT_RUNTIME) return OUTPUT_RUNTIME;\n if (emit === OUTPUT_RAW) return OUTPUT_RAW;\n throw new Error(`${readerName} unknown emit value \"${emit}\"`);\n}\n\nfunction assertKnownOptions(options, readerName)\n{\n for (const key of Object.keys(options))\n {\n if (!OPTION_KEYS.has(key))\n {\n throw new TypeError(`${readerName} unknown option \"${key}\"`);\n }\n }\n}\n\nfunction classMap(values)\n{\n return values && values.classes ? values.classes : {};\n}\n\nfunction cloneValues(values)\n{\n return {\n emit: values.emit,\n schema: values.schema ?? null,\n registry: values.registry ?? null,\n firstId: values.firstId ?? 1,\n parse: values.parse ?? null,\n adapter: values.adapter ?? null,\n adapters: values.adapters ?? null,\n payloadTypeField: values.payloadTypeField,\n payloadIdField: values.payloadIdField,\n payloadReferenceField: values.payloadReferenceField,\n classes: { ...classMap(values) }\n };\n}\n\nexport function validateClassKey(classKeys, key, readerName)\n{\n if (typeof key !== \"string\" || !key)\n {\n throw new Error(`${readerName} class type must be a non-empty string`);\n }\n}\n\nexport function validateClass(classKeys, type, Class, readerName)\n{\n validateClassKey(classKeys, type, readerName);\n if (typeof Class !== \"function\")\n {\n throw new TypeError(`${readerName} class \"${type}\" must be a constructor`);\n }\n}\n\nfunction mergeClasses(values, classes, classKeys, readerName)\n{\n if (!classes || typeof classes !== \"object\")\n {\n throw new TypeError(`${readerName} classes option must be an object`);\n }\n\n const next = { ...values.classes };\n for (const [ type, Class ] of Object.entries(classes))\n {\n validateClass(classKeys, type, Class, readerName);\n next[type] = Class;\n }\n values.classes = next;\n}\n\nexport function normalizeValues(base, options, classKeys, readerName)\n{\n if (!options || typeof options !== \"object\")\n {\n throw new TypeError(`${readerName} options must be an object`);\n }\n\n assertKnownOptions(options, readerName);\n\n const values = cloneValues(base);\n if (hasOwn(options, \"emit\")) values.emit = normalizeEmit(options.emit, readerName);\n if (hasOwn(options, \"schema\")) values.schema = options.schema ?? null;\n if (hasOwn(options, \"registry\")) values.registry = options.registry ?? null;\n if (hasOwn(options, \"firstId\")) values.firstId = options.firstId ?? 1;\n if (hasOwn(options, \"parse\"))\n {\n if (options.parse !== null && options.parse !== undefined && typeof options.parse !== \"function\")\n {\n throw new TypeError(`${readerName} parse option must be a function`);\n }\n values.parse = options.parse ?? null;\n }\n if (hasOwn(options, \"adapter\")) values.adapter = options.adapter ?? null;\n if (hasOwn(options, \"adapters\")) values.adapters = options.adapters ?? null;\n if (hasOwn(options, \"payloadTypeField\")) values.payloadTypeField = options.payloadTypeField;\n if (hasOwn(options, \"payloadIdField\")) values.payloadIdField = options.payloadIdField;\n if (hasOwn(options, \"payloadReferenceField\")) values.payloadReferenceField = options.payloadReferenceField;\n if (hasOwn(options, \"classes\")) mergeClasses(values, options.classes, classKeys, readerName);\n return values;\n}\n\nexport function copyReaderOptions(values)\n{\n const { emit: _emit, schema: _schema, classes: _classes, ...readerOptions } = values;\n return readerOptions;\n}\n\nexport function toJsonValue(value, seen = new WeakSet())\n{\n if (value === null || typeof value !== \"object\") return value;\n if (ArrayBuffer.isView(value)) return Array.from(value, item => toJsonValue(item, seen));\n if (Array.isArray(value)) return value.map(item => toJsonValue(item, seen));\n\n if (seen.has(value))\n {\n throw new TypeError(\"Reader.toJSON cannot convert circular data\");\n }\n\n if (typeof value.toJSON === \"function\")\n {\n seen.add(value);\n const json = toJsonValue(value.toJSON(), seen);\n seen.delete(value);\n return json;\n }\n\n seen.add(value);\n const out = {};\n for (const key of Object.keys(value))\n {\n out[key] = toJsonValue(value[key], seen);\n }\n seen.delete(value);\n return out;\n}\n"],"names":["OUTPUT_JSON","OUTPUT_PAYLOAD","OUTPUT_RUNTIME","OUTPUT_RAW","DEFAULT_VALUES","Object","freeze","emit","schema","registry","firstId","parse","adapter","adapters","payloadTypeField","payloadIdField","payloadReferenceField","classes","OPTION_KEYS","Set","keys","hasOwn","value","key","prototype","hasOwnProperty","call","normalizeEmit","readerName","undefined","Error","assertKnownOptions","options","has","TypeError","classMap","values","cloneValues","validateClassKey","classKeys","validateClass","type","Class","mergeClasses","next","entries","normalizeValues","base","copyReaderOptions","_emit","_schema","_classes","readerOptions","toJsonValue","seen","WeakSet","ArrayBuffer","isView","Array","from","item","isArray","map","toJSON","add","json","delete","out"],"mappings":"AAAO,MAAMA,WAAW,GAAG;AACpB,MAAMC,cAAc,GAAG;AACvB,MAAMC,cAAc,GAAG;AACvB,MAAMC,UAAU,GAAG;MAEbC,cAAc,GAAGC,MAAM,CAACC,M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AACyC,MAAM,KAAK,UAAU,EACtC;AACIT,IAAAA,IAAI,CAACU,GAAG,CAAC1C,KAAK,CAAC;IACf,MAAM2C,IAAI,GAAGZ,WAAW,CAAC/B,KAAK,CAACyC,MAAM,EAAE,EAAET,IAAI,CAAC;AAC9CA,IAAAA,IAAI,CAACY,MAAM,CAAC5C,KAAK,CAAC;AAClB,IAAA,OAAO2C,IAAI;AACf,EAAA;AAEAX,EAAAA,IAAI,CAACU,GAAG,CAAC1C,KAAK,CAAC;EACf,MAAM6C,GAAG,GAAG,EAAE;EACd,KAAK,MAAM5C,GAAG,IAAIlB,MAAM,CAACe,IAAI,CAACE,KAAK,CAAC,EACpC;AACI6C,IAAAA,GAAG,CAAC5C,GAAG,CAAC,GAAG8B,WAAW,CAAC/B,KAAK,CAACC,GAAG,CAAC,EAAE+B,IAAI,CAAC;AAC5C,EAAA;AACAA,EAAAA,IAAI,CAACY,MAAM,CAAC5C,KAAK,CAAC;AAClB,EAAA,OAAO6C,GAAG;AACd;;;;"}
@@ -0,0 +1,68 @@
1
+ import { CjsYamlFormat } from '../../yaml/CjsYamlFormat.js';
2
+
3
+ /**
4
+ * Keys added by authoring tools are prefixed with a double underscore and are
5
+ * not part of the Red data. They can carry environment-specific information, so
6
+ * they are stripped on every read and never emitted.
7
+ * @param {string} key
8
+ * @returns {boolean}
9
+ */
10
+ function isStrippedKey(key) {
11
+ return typeof key === "string" && key.length > 1 && key[0] === "_" && key[1] === "_";
12
+ }
13
+
14
+ /**
15
+ * Parses Red input into a plain object graph.
16
+ *
17
+ * Accepts an already-parsed object (returned as-is) or a YAML string. YAML
18
+ * anchors/aliases resolve to shared object identities, which the reader uses
19
+ * to rebuild the Red reference graph.
20
+ *
21
+ * @param {unknown} input parsed Red object or YAML string
22
+ * @param {object} [options] `options.parse(text)` overrides the built-in parser
23
+ * @param {string} [readerName]
24
+ * @returns {object} parsed Red object graph
25
+ */
26
+ function parseRed(input, options = {}, readerName = "CjsRedFormat") {
27
+ if (input && typeof input === "object") return input;
28
+ if (typeof input === "string") {
29
+ if (typeof options.parse === "function") return options.parse(input);
30
+ return CjsYamlFormat.readRaw(input, {
31
+ tagPolicy: "reject"
32
+ });
33
+ }
34
+ throw new TypeError(`${readerName}: input must be a parsed Red object or a YAML string.`);
35
+ }
36
+
37
+ /**
38
+ * A "typed table" is Red's compact columnar encoding: a `structure` array of
39
+ * `[name, typeCode, byteOffset]` columns plus an `items` array where each row
40
+ * is one record aligned to those columns. Curve `keys`, effect `options`, and
41
+ * `samplerOverrides` all use this shape.
42
+ * @param {*} node
43
+ * @returns {boolean}
44
+ */
45
+ function isTypedTable(node) {
46
+ return Boolean(node && typeof node === "object" && !Array.isArray(node) && Array.isArray(node.structure) && Array.isArray(node.items));
47
+ }
48
+
49
+ /**
50
+ * Decodes a typed table into an array of row objects keyed by column name.
51
+ * @param {object} node typed table (`{ structure, items }`)
52
+ * @returns {Array<object>}
53
+ */
54
+ function decodeTypedTable(node) {
55
+ const columns = node.structure.map(column => Array.isArray(column) ? column[0] : column && column.name);
56
+ return node.items.map(row => {
57
+ const record = {};
58
+ const cells = Array.isArray(row) ? row : [row];
59
+ for (let i = 0; i < columns.length; i++) {
60
+ if (columns[i] === undefined || columns[i] === null) continue;
61
+ record[columns[i]] = cells[i];
62
+ }
63
+ return record;
64
+ });
65
+ }
66
+
67
+ export { decodeTypedTable, isStrippedKey, isTypedTable, parseRed };
68
+ //# sourceMappingURL=redGraph.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"redGraph.js","sources":["../../../../../src/formats/red/core/redGraph.js"],"sourcesContent":["import CjsYamlFormat from \"../../yaml/index.js\";\n\n/**\n * Keys added by authoring tools are prefixed with a double underscore and are\n * not part of the Red data. They can carry environment-specific information, so\n * they are stripped on every read and never emitted.\n * @param {string} key\n * @returns {boolean}\n */\nexport function isStrippedKey(key)\n{\n return typeof key === \"string\" && key.length > 1 && key[0] === \"_\" && key[1] === \"_\";\n}\n\n/**\n * Parses Red input into a plain object graph.\n *\n * Accepts an already-parsed object (returned as-is) or a YAML string. YAML\n * anchors/aliases resolve to shared object identities, which the reader uses\n * to rebuild the Red reference graph.\n *\n * @param {unknown} input parsed Red object or YAML string\n * @param {object} [options] `options.parse(text)` overrides the built-in parser\n * @param {string} [readerName]\n * @returns {object} parsed Red object graph\n */\nexport function parseRed(input, options = {}, readerName = \"CjsRedFormat\")\n{\n if (input && typeof input === \"object\") return input;\n\n if (typeof input === \"string\")\n {\n if (typeof options.parse === \"function\") return options.parse(input);\n return CjsYamlFormat.readRaw(input, { tagPolicy: \"reject\" });\n }\n\n throw new TypeError(`${readerName}: input must be a parsed Red object or a YAML string.`);\n}\n\n/**\n * A \"typed table\" is Red's compact columnar encoding: a `structure` array of\n * `[name, typeCode, byteOffset]` columns plus an `items` array where each row\n * is one record aligned to those columns. Curve `keys`, effect `options`, and\n * `samplerOverrides` all use this shape.\n * @param {*} node\n * @returns {boolean}\n */\nexport function isTypedTable(node)\n{\n return Boolean(\n node &&\n typeof node === \"object\" &&\n !Array.isArray(node) &&\n Array.isArray(node.structure) &&\n Array.isArray(node.items)\n );\n}\n\n/**\n * Decodes a typed table into an array of row objects keyed by column name.\n * @param {object} node typed table (`{ structure, items }`)\n * @returns {Array<object>}\n */\nexport function decodeTypedTable(node)\n{\n const columns = node.structure.map(column => (Array.isArray(column) ? column[0] : column && column.name));\n\n return node.items.map(row =>\n {\n const record = {};\n const cells = Array.isArray(row) ? row : [ row ];\n for (let i = 0; i < columns.length; i++)\n {\n if (columns[i] === undefined || columns[i] === null) continue;\n record[columns[i]] = cells[i];\n }\n return record;\n });\n}\n\n/**\n * Red `structure` type codes (informational). The YAML export already carries\n * decoded JS values, so decoding keys on column names, not these codes.\n */\nexport const RED_TYPE_CODES = Object.freeze({\n 4: \"float32\",\n 5: \"string\",\n 8: \"uint8\",\n 9: \"uint16\",\n 10: \"uint32\"\n});\n"],"names":["isStrippedKey","key","length","parseRed","input","options","readerName","parse","CjsYamlFormat","readRaw","tagPolicy","TypeError","isTypedTable","node","Boolean","Array","isArray","structure","items","decodeTypedTable","columns","map","column","name","row","record","cells","i","undefined"],"mappings":";;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASA,aAAaA,CAACC,GAAG,EACjC;EACI,OAAO,OAAOA,GAAG,KAAK,QAAQ,IAAIA,GAAG,CAACC,MAAM,GAAG,CAAC,IAAID,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,IAAIA,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG;AACxF;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,QAAQA,CAACC,KAAK,EAAEC,OAAO,GAAG,EAAE,EAAEC,UAAU,GAAG,cAAc,EACzE;EACI,IAAIF,KAAK,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE,OAAOA,KAAK;AAEpD,EAAA,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAC7B;AACI,IAAA,IAAI,OAAOC,OAAO,CAACE,KAAK,KAAK,UAAU,EAAE,OAAOF,OAAO,CAACE,KAAK,CAACH,KAAK,CAAC;AACpE,IAAA,OAAOI,aAAa,CAACC,OAAO,CAACL,KAAK,EAAE;AAAEM,MAAAA,SAAS,EAAE;AAAS,KAAC,CAAC;AAChE,EAAA;AAEA,EAAA,MAAM,IAAIC,SAAS,CAAC,CAAA,EAAGL,UAAU,uDAAuD,CAAC;AAC7F;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASM,YAAYA,CAACC,IAAI,EACjC;AACI,EAAA,OAAOC,OAAO,CACVD,IAAI,IACJ,OAAOA,IAAI,KAAK,QAAQ,IACxB,CAACE,KAAK,CAACC,OAAO,CAACH,IAAI,CAAC,IACpBE,KAAK,CAACC,OAAO,CAACH,IAAI,CAACI,SAAS,CAAC,IAC7BF,KAAK,CAACC,OAAO,CAACH,IAAI,CAACK,KAAK,CAC5B,CAAC;AACL;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASC,gBAAgBA,CAACN,IAAI,EACrC;EACI,MAAMO,OAAO,GAAGP,IAAI,CAACI,SAAS,CAACI,GAAG,CAACC,MAAM,IAAKP,KAAK,CAACC,OAAO,CAACM,MAAM,CAAC,GAAGA,MAAM,CAAC,CAAC,CAAC,GAAGA,MAAM,IAAIA,MAAM,CAACC,IAAK,CAAC;AAEzG,EAAA,OAAOV,IAAI,CAACK,KAAK,CAACG,GAAG,CAACG,GAAG,IACzB;IACI,MAAMC,MAAM,GAAG,EAAE;AACjB,IAAA,MAAMC,KAAK,GAAGX,KAAK,CAACC,OAAO,CAACQ,GAAG,CAAC,GAAGA,GAAG,GAAG,CAAEA,GAAG,CAAE;AAChD,IAAA,KAAK,IAAIG,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGP,OAAO,CAAClB,MAAM,EAAEyB,CAAC,EAAE,EACvC;AACI,MAAA,IAAIP,OAAO,CAACO,CAAC,CAAC,KAAKC,SAAS,IAAIR,OAAO,CAACO,CAAC,CAAC,KAAK,IAAI,EAAE;MACrDF,MAAM,CAACL,OAAO,CAACO,CAAC,CAAC,CAAC,GAAGD,KAAK,CAACC,CAAC,CAAC;AACjC,IAAA;AACA,IAAA,OAAOF,MAAM;AACjB,EAAA,CAAC,CAAC;AACN;;;;"}
@@ -0,0 +1,4 @@
1
+ const CLASS_KEYS = Object.freeze(["Root", "Document", "Mapping", "Sequence", "Scalar", "Reference"]);
2
+
3
+ export { CLASS_KEYS };
4
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sources":["../../../../../src/formats/red/core/schema.js"],"sourcesContent":["export const CLASS_KEYS = Object.freeze([\n \"Root\",\n \"Document\",\n \"Mapping\",\n \"Sequence\",\n \"Scalar\",\n \"Reference\"\n]);\n"],"names":["CLASS_KEYS","Object","freeze"],"mappings":"AAAO,MAAMA,UAAU,GAAGC,MAAM,CAACC,MAAM,CAAC,CACpC,MAAM,EACN,UAAU,EACV,SAAS,EACT,UAAU,EACV,QAAQ,EACR,WAAW,CACd;;;;"}
@@ -0,0 +1,2 @@
1
+ export { CjsRedFormat, CjsRedFormat as default } from './CjsRedFormat.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,304 @@
1
+ import { DEFAULT_VALUES, normalizeValues, validateClassKey, validateClass, readWithValues, writeWithValues, inspectWithValues, toJsonValue, importNodeModule, OUTPUT_JSON, OUTPUT_STL_JSON, OUTPUT_SHARED, OUTPUT_GR2, OUTPUT_CMF, CLASS_KEYS } from './core/helpers.js';
2
+ import { isStl, isBinaryStl } from './core/stl.js';
3
+
4
+ /**
5
+ * Exposed CarbonEngineJS-facing STL format class.
6
+ *
7
+ * Keep this file small and reviewable: STL parsing, writing, printability
8
+ * inspection, option normalization, and JSON hydration live under src/core.
9
+ */
10
+
11
+ const FORMAT_NAME = "CjsStlFormat";
12
+
13
+ /**
14
+ * CarbonEngineJS-facing STL format surface.
15
+ *
16
+ * The Cjs prefix marks this as a JavaScript format/construction boundary.
17
+ * STL is a triangle-only import/export format; the JSON contract is the shared
18
+ * CarbonEngineJS mesh schema.
19
+ */
20
+ class CjsStlFormat {
21
+ #emit = DEFAULT_VALUES.emit;
22
+ #source = DEFAULT_VALUES.source;
23
+ #binary = DEFAULT_VALUES.binary;
24
+ #solidName = DEFAULT_VALUES.solidName;
25
+ #scale = DEFAULT_VALUES.scale;
26
+ #recalculateNormals = DEFAULT_VALUES.recalculateNormals;
27
+ #weldVertices = DEFAULT_VALUES.weldVertices;
28
+ #weldTolerance = DEFAULT_VALUES.weldTolerance;
29
+ #skipDegenerate = DEFAULT_VALUES.skipDegenerate;
30
+ #requireWatertight = DEFAULT_VALUES.requireWatertight;
31
+ #classes = DEFAULT_VALUES.classes;
32
+
33
+ /**
34
+ * Create a reusable format profile.
35
+ *
36
+ * @param {object} [options] Default format values.
37
+ */
38
+ constructor(options = {}) {
39
+ this.SetValues(options);
40
+ }
41
+
42
+ /**
43
+ * Set format values for this reusable profile.
44
+ *
45
+ * @param {object} [options] Values to merge into the profile.
46
+ * @returns {CjsStlFormat} This format profile.
47
+ */
48
+ SetValues(options = {}) {
49
+ const values = normalizeValues(this.GetValues(), options, FORMAT_NAME);
50
+ this.#emit = values.emit;
51
+ this.#source = values.source;
52
+ this.#binary = values.binary;
53
+ this.#solidName = values.solidName;
54
+ this.#scale = values.scale;
55
+ this.#recalculateNormals = values.recalculateNormals;
56
+ this.#weldVertices = values.weldVertices;
57
+ this.#weldTolerance = values.weldTolerance;
58
+ this.#skipDegenerate = values.skipDegenerate;
59
+ this.#requireWatertight = values.requireWatertight;
60
+ this.#classes = values.classes;
61
+ return this;
62
+ }
63
+
64
+ /**
65
+ * Get this profile's current values, optionally with per-call overrides.
66
+ *
67
+ * @param {object} [options] Optional values to merge into a copy.
68
+ * @returns {object} A copy of the effective values.
69
+ */
70
+ GetValues(options = {}) {
71
+ return normalizeValues({
72
+ emit: this.#emit,
73
+ source: this.#source,
74
+ binary: this.#binary,
75
+ solidName: this.#solidName,
76
+ scale: this.#scale,
77
+ recalculateNormals: this.#recalculateNormals,
78
+ weldVertices: this.#weldVertices,
79
+ weldTolerance: this.#weldTolerance,
80
+ skipDegenerate: this.#skipDegenerate,
81
+ requireWatertight: this.#requireWatertight,
82
+ classes: this.#classes
83
+ }, options, FORMAT_NAME);
84
+ }
85
+
86
+ /**
87
+ * Set multiple node-class constructors for this profile.
88
+ *
89
+ * @param {object} [classes] Map of node class keys to constructors.
90
+ * @returns {CjsStlFormat} This format profile.
91
+ */
92
+ SetClasses(classes = {}) {
93
+ return this.SetValues({
94
+ classes
95
+ });
96
+ }
97
+
98
+ /**
99
+ * Set one node-class constructor for this profile.
100
+ *
101
+ * @param {string} type Node class key.
102
+ * @param {Function|null|undefined} Class Constructor to use, or nullish to delete.
103
+ * @returns {CjsStlFormat} This format profile.
104
+ */
105
+ SetClass(type, Class) {
106
+ if (Class === null || Class === undefined) {
107
+ validateClassKey(type, FORMAT_NAME);
108
+ const classes = {
109
+ ...this.#classes
110
+ };
111
+ delete classes[type];
112
+ this.#classes = classes;
113
+ return this;
114
+ }
115
+ validateClass(type, Class, FORMAT_NAME);
116
+ return this.SetValues({
117
+ classes: {
118
+ [type]: Class
119
+ }
120
+ });
121
+ }
122
+
123
+ /**
124
+ * Get a configured node-class constructor.
125
+ *
126
+ * @param {string} type Node class key.
127
+ * @returns {Function|undefined} The registered constructor, if any.
128
+ */
129
+ GetClass(type) {
130
+ validateClassKey(type, FORMAT_NAME);
131
+ return this.#classes[type];
132
+ }
133
+
134
+ /**
135
+ * Whether this format profile has a constructor registered for a node class key.
136
+ *
137
+ * @param {string} type Node class key.
138
+ * @returns {boolean} True when a constructor is registered.
139
+ */
140
+ HasClass(type) {
141
+ return !!this.GetClass(type);
142
+ }
143
+
144
+ /**
145
+ * Read STL text/bytes with this profile's values.
146
+ *
147
+ * @param {string|Uint8Array|ArrayBuffer|DataView} input STL text or bytes.
148
+ * @param {object} [options] Per-call value overrides.
149
+ * @returns {object} The shared CarbonEngineJS JSON mesh schema.
150
+ */
151
+ Read(input, options = {}) {
152
+ return readWithValues(this, input, this.GetValues(options));
153
+ }
154
+
155
+ /**
156
+ * Write shared JSON geometry as STL with this profile's values.
157
+ *
158
+ * @param {object} input Shared JSON root or mesh.
159
+ * @param {object} [options] Per-call value overrides.
160
+ * @returns {string|Uint8Array} ASCII STL text or binary STL bytes.
161
+ */
162
+ Write(input, options = {}) {
163
+ return writeWithValues(input, this.GetValues(options));
164
+ }
165
+
166
+ /**
167
+ * Inspect STL text/bytes or shared JSON geometry for printability blockers.
168
+ *
169
+ * @param {any} input STL text/bytes or shared JSON root/mesh.
170
+ * @param {object} [options] Per-call value overrides.
171
+ * @returns {object} Plain printability report.
172
+ */
173
+ Inspect(input, options = {}) {
174
+ return inspectWithValues(input, this.GetValues(options));
175
+ }
176
+
177
+ /**
178
+ * Convert format output to JSON-compatible data.
179
+ *
180
+ * @param {any} value Format output to convert.
181
+ * @returns {any} Plain JSON-compatible data.
182
+ */
183
+ ToJSON(value) {
184
+ return toJsonValue(value);
185
+ }
186
+
187
+ /**
188
+ * Static one-shot read. Static methods use camelCase by convention.
189
+ *
190
+ * @param {string|Uint8Array|ArrayBuffer|DataView} input STL text or bytes.
191
+ * @param {object} [options] Format values.
192
+ * @returns {object} The shared CarbonEngineJS JSON mesh schema.
193
+ */
194
+ static read(input, options = {}) {
195
+ return readWithValues(CjsStlFormat, input, normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME));
196
+ }
197
+
198
+ /**
199
+ * Static one-shot write.
200
+ *
201
+ * @param {object} input Shared JSON root or mesh.
202
+ * @param {object} [options] Format values.
203
+ * @returns {string|Uint8Array} ASCII STL text or binary STL bytes.
204
+ */
205
+ static write(input, options = {}) {
206
+ return writeWithValues(input, normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME));
207
+ }
208
+
209
+ /**
210
+ * Static one-shot inspection.
211
+ *
212
+ * @param {any} input STL text/bytes or shared JSON root/mesh.
213
+ * @param {object} [options] Format values.
214
+ * @returns {object} Plain printability report.
215
+ */
216
+ static inspect(input, options = {}) {
217
+ return inspectWithValues(input, normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME));
218
+ }
219
+
220
+ /**
221
+ * Static JSON-compatible conversion.
222
+ *
223
+ * @param {any} value Format output to convert.
224
+ * @returns {any} Plain JSON-compatible data.
225
+ */
226
+ static toJSON(value) {
227
+ return toJsonValue(value);
228
+ }
229
+
230
+ /**
231
+ * Node-only convenience: reads an STL file from disk.
232
+ *
233
+ * @param {string} path Path to an STL file.
234
+ * @param {object} [options] Format values.
235
+ * @returns {Promise<object>} The shared CarbonEngineJS JSON mesh schema.
236
+ */
237
+ static async readFile(path, options = {}) {
238
+ if (typeof path !== "string" || !path) {
239
+ throw new TypeError(`${FORMAT_NAME}: readFile path must be a non-empty string`);
240
+ }
241
+ const {
242
+ readFile
243
+ } = await importNodeModule("node:fs/promises");
244
+ const input = await readFile(path);
245
+ return CjsStlFormat.read(input, {
246
+ source: path,
247
+ ...options
248
+ });
249
+ }
250
+
251
+ /**
252
+ * Node-only convenience: writes an STL file to disk.
253
+ *
254
+ * @param {string} path Path to write.
255
+ * @param {object} input Shared JSON root or mesh.
256
+ * @param {object} [options] Format values.
257
+ * @returns {Promise<string>} The written path.
258
+ */
259
+ static async writeFile(path, input, options = {}) {
260
+ if (typeof path !== "string" || !path) {
261
+ throw new TypeError(`${FORMAT_NAME}: writeFile path must be a non-empty string`);
262
+ }
263
+ const {
264
+ writeFile
265
+ } = await importNodeModule("node:fs/promises");
266
+ const output = CjsStlFormat.write(input, options);
267
+ await writeFile(path, output);
268
+ return path;
269
+ }
270
+
271
+ /**
272
+ * Cheap sniff for STL-like input.
273
+ *
274
+ * @param {string|Uint8Array|ArrayBuffer|DataView} input Candidate STL input.
275
+ * @returns {boolean} True when input looks like STL.
276
+ */
277
+ static isStl(input) {
278
+ return isStl(input);
279
+ }
280
+
281
+ /**
282
+ * Check whether byte-like input has an exact binary STL layout.
283
+ *
284
+ * @param {string|Uint8Array|ArrayBuffer|DataView} input Candidate STL input.
285
+ * @returns {boolean} True when input is binary STL bytes.
286
+ */
287
+ static isBinaryStl(input) {
288
+ return isBinaryStl(input);
289
+ }
290
+ static OUTPUT_JSON = OUTPUT_JSON;
291
+ static OUTPUT_STL_JSON = OUTPUT_STL_JSON;
292
+ static OUTPUT_SHARED = OUTPUT_SHARED;
293
+ static OUTPUT_GR2 = OUTPUT_GR2;
294
+ static OUTPUT_CMF = OUTPUT_CMF;
295
+ static CLASS_KEYS = CLASS_KEYS;
296
+ static type = Object.freeze(["geometry"]);
297
+ static mediaTypes = Object.freeze(["geometry"]);
298
+ static inputTypes = Object.freeze(["stl"]);
299
+ static outputTypes = Object.freeze([OUTPUT_SHARED, OUTPUT_GR2, OUTPUT_CMF]);
300
+ static debugOutputTypes = Object.freeze([OUTPUT_JSON, OUTPUT_STL_JSON]);
301
+ }
302
+
303
+ export { CjsStlFormat, CjsStlFormat as default };
304
+ //# sourceMappingURL=CjsStlFormat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CjsStlFormat.js","sources":["../../../../src/formats/stl/CjsStlFormat.js"],"sourcesContent":["/**\n * Exposed CarbonEngineJS-facing STL format class.\n *\n * Keep this file small and reviewable: STL parsing, writing, printability\n * inspection, option normalization, and JSON hydration live under src/core.\n */\n\nimport {\n CLASS_KEYS,\n DEFAULT_VALUES,\n OUTPUT_CMF,\n OUTPUT_GR2,\n OUTPUT_JSON,\n OUTPUT_SHARED,\n OUTPUT_STL_JSON,\n importNodeModule,\n inspectWithValues,\n isBinaryStl,\n isStl,\n normalizeValues,\n readWithValues,\n toJsonValue,\n validateClass,\n validateClassKey,\n writeWithValues\n} from \"./core/helpers.js\";\n\nconst FORMAT_NAME = \"CjsStlFormat\";\n\n/**\n * CarbonEngineJS-facing STL format surface.\n *\n * The Cjs prefix marks this as a JavaScript format/construction boundary.\n * STL is a triangle-only import/export format; the JSON contract is the shared\n * CarbonEngineJS mesh schema.\n */\nexport class CjsStlFormat\n{\n\n #emit = DEFAULT_VALUES.emit;\n #source = DEFAULT_VALUES.source;\n #binary = DEFAULT_VALUES.binary;\n #solidName = DEFAULT_VALUES.solidName;\n #scale = DEFAULT_VALUES.scale;\n #recalculateNormals = DEFAULT_VALUES.recalculateNormals;\n #weldVertices = DEFAULT_VALUES.weldVertices;\n #weldTolerance = DEFAULT_VALUES.weldTolerance;\n #skipDegenerate = DEFAULT_VALUES.skipDegenerate;\n #requireWatertight = DEFAULT_VALUES.requireWatertight;\n #classes = DEFAULT_VALUES.classes;\n\n /**\n * Create a reusable format profile.\n *\n * @param {object} [options] Default format values.\n */\n constructor(options = {})\n {\n this.SetValues(options);\n }\n\n /**\n * Set format values for this reusable profile.\n *\n * @param {object} [options] Values to merge into the profile.\n * @returns {CjsStlFormat} This format profile.\n */\n SetValues(options = {})\n {\n const values = normalizeValues(this.GetValues(), options, FORMAT_NAME);\n\n this.#emit = values.emit;\n this.#source = values.source;\n this.#binary = values.binary;\n this.#solidName = values.solidName;\n this.#scale = values.scale;\n this.#recalculateNormals = values.recalculateNormals;\n this.#weldVertices = values.weldVertices;\n this.#weldTolerance = values.weldTolerance;\n this.#skipDegenerate = values.skipDegenerate;\n this.#requireWatertight = values.requireWatertight;\n this.#classes = values.classes;\n\n return this;\n }\n\n /**\n * Get this profile's current values, optionally with per-call overrides.\n *\n * @param {object} [options] Optional values to merge into a copy.\n * @returns {object} A copy of the effective values.\n */\n GetValues(options = {})\n {\n return normalizeValues({\n emit: this.#emit,\n source: this.#source,\n binary: this.#binary,\n solidName: this.#solidName,\n scale: this.#scale,\n recalculateNormals: this.#recalculateNormals,\n weldVertices: this.#weldVertices,\n weldTolerance: this.#weldTolerance,\n skipDegenerate: this.#skipDegenerate,\n requireWatertight: this.#requireWatertight,\n classes: this.#classes\n }, options, FORMAT_NAME);\n }\n\n /**\n * Set multiple node-class constructors for this profile.\n *\n * @param {object} [classes] Map of node class keys to constructors.\n * @returns {CjsStlFormat} This format profile.\n */\n SetClasses(classes = {})\n {\n return this.SetValues({ classes });\n }\n\n /**\n * Set one node-class constructor for this profile.\n *\n * @param {string} type Node class key.\n * @param {Function|null|undefined} Class Constructor to use, or nullish to delete.\n * @returns {CjsStlFormat} This format profile.\n */\n SetClass(type, Class)\n {\n if (Class === null || Class === undefined)\n {\n validateClassKey(type, FORMAT_NAME);\n const classes = { ...this.#classes };\n delete classes[type];\n this.#classes = classes;\n return this;\n }\n\n validateClass(type, Class, FORMAT_NAME);\n return this.SetValues({ classes: { [type]: Class } });\n }\n\n /**\n * Get a configured node-class constructor.\n *\n * @param {string} type Node class key.\n * @returns {Function|undefined} The registered constructor, if any.\n */\n GetClass(type)\n {\n validateClassKey(type, FORMAT_NAME);\n return this.#classes[type];\n }\n\n /**\n * Whether this format profile has a constructor registered for a node class key.\n *\n * @param {string} type Node class key.\n * @returns {boolean} True when a constructor is registered.\n */\n HasClass(type)\n {\n return !!this.GetClass(type);\n }\n\n /**\n * Read STL text/bytes with this profile's values.\n *\n * @param {string|Uint8Array|ArrayBuffer|DataView} input STL text or bytes.\n * @param {object} [options] Per-call value overrides.\n * @returns {object} The shared CarbonEngineJS JSON mesh schema.\n */\n Read(input, options = {})\n {\n return readWithValues(this, input, this.GetValues(options));\n }\n\n /**\n * Write shared JSON geometry as STL with this profile's values.\n *\n * @param {object} input Shared JSON root or mesh.\n * @param {object} [options] Per-call value overrides.\n * @returns {string|Uint8Array} ASCII STL text or binary STL bytes.\n */\n Write(input, options = {})\n {\n return writeWithValues(input, this.GetValues(options));\n }\n\n /**\n * Inspect STL text/bytes or shared JSON geometry for printability blockers.\n *\n * @param {any} input STL text/bytes or shared JSON root/mesh.\n * @param {object} [options] Per-call value overrides.\n * @returns {object} Plain printability report.\n */\n Inspect(input, options = {})\n {\n return inspectWithValues(input, this.GetValues(options));\n }\n\n /**\n * Convert format output to JSON-compatible data.\n *\n * @param {any} value Format output to convert.\n * @returns {any} Plain JSON-compatible data.\n */\n ToJSON(value)\n {\n return toJsonValue(value);\n }\n\n /**\n * Static one-shot read. Static methods use camelCase by convention.\n *\n * @param {string|Uint8Array|ArrayBuffer|DataView} input STL text or bytes.\n * @param {object} [options] Format values.\n * @returns {object} The shared CarbonEngineJS JSON mesh schema.\n */\n static read(input, options = {})\n {\n return readWithValues(CjsStlFormat, input, normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME));\n }\n\n /**\n * Static one-shot write.\n *\n * @param {object} input Shared JSON root or mesh.\n * @param {object} [options] Format values.\n * @returns {string|Uint8Array} ASCII STL text or binary STL bytes.\n */\n static write(input, options = {})\n {\n return writeWithValues(input, normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME));\n }\n\n /**\n * Static one-shot inspection.\n *\n * @param {any} input STL text/bytes or shared JSON root/mesh.\n * @param {object} [options] Format values.\n * @returns {object} Plain printability report.\n */\n static inspect(input, options = {})\n {\n return inspectWithValues(input, normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME));\n }\n\n /**\n * Static JSON-compatible conversion.\n *\n * @param {any} value Format output to convert.\n * @returns {any} Plain JSON-compatible data.\n */\n static toJSON(value)\n {\n return toJsonValue(value);\n }\n\n /**\n * Node-only convenience: reads an STL file from disk.\n *\n * @param {string} path Path to an STL file.\n * @param {object} [options] Format values.\n * @returns {Promise<object>} The shared CarbonEngineJS JSON mesh schema.\n */\n static async readFile(path, options = {})\n {\n if (typeof path !== \"string\" || !path)\n {\n throw new TypeError(`${FORMAT_NAME}: readFile path must be a non-empty string`);\n }\n\n const { readFile } = await importNodeModule(\"node:fs/promises\");\n const input = await readFile(path);\n return CjsStlFormat.read(input, { source: path, ...options });\n }\n\n /**\n * Node-only convenience: writes an STL file to disk.\n *\n * @param {string} path Path to write.\n * @param {object} input Shared JSON root or mesh.\n * @param {object} [options] Format values.\n * @returns {Promise<string>} The written path.\n */\n static async writeFile(path, input, options = {})\n {\n if (typeof path !== \"string\" || !path)\n {\n throw new TypeError(`${FORMAT_NAME}: writeFile path must be a non-empty string`);\n }\n\n const { writeFile } = await importNodeModule(\"node:fs/promises\");\n const output = CjsStlFormat.write(input, options);\n await writeFile(path, output);\n return path;\n }\n\n /**\n * Cheap sniff for STL-like input.\n *\n * @param {string|Uint8Array|ArrayBuffer|DataView} input Candidate STL input.\n * @returns {boolean} True when input looks like STL.\n */\n static isStl(input)\n {\n return isStl(input);\n }\n\n /**\n * Check whether byte-like input has an exact binary STL layout.\n *\n * @param {string|Uint8Array|ArrayBuffer|DataView} input Candidate STL input.\n * @returns {boolean} True when input is binary STL bytes.\n */\n static isBinaryStl(input)\n {\n return isBinaryStl(input);\n }\n\n static OUTPUT_JSON = OUTPUT_JSON;\n static OUTPUT_STL_JSON = OUTPUT_STL_JSON;\n static OUTPUT_SHARED = OUTPUT_SHARED;\n static OUTPUT_GR2 = OUTPUT_GR2;\n static OUTPUT_CMF = OUTPUT_CMF;\n static CLASS_KEYS = CLASS_KEYS;\n static type = Object.freeze([ \"geometry\" ]);\n static mediaTypes = Object.freeze([ \"geometry\" ]);\n static inputTypes = Object.freeze([ \"stl\" ]);\n static outputTypes = Object.freeze([ OUTPUT_SHARED, OUTPUT_GR2, OUTPUT_CMF ]);\n static debugOutputTypes = Object.freeze([ OUTPUT_JSON, OUTPUT_STL_JSON ]);\n\n}\n\nexport default CjsStlFormat;\n"],"names":["FORMAT_NAME","CjsStlFormat","DEFAULT_VALUES","emit","source","binary","solidName","scale","recalculateNormals","weldVertices","weldTolerance","skipDegenerate","requireWatertight","classes","constructor","options","SetValues","values","normalizeValues","GetValues","SetClasses","SetClass","type","Class","undefined","validateClassKey","validateClass","GetClass","HasClass","Read","input","readWithValues","Write","writeWithValues","Inspect","inspectWithValues","ToJSON","value","toJsonValue","read","write","inspect","toJSON","readFile","path","TypeError","importNodeModule","writeFile","output","isStl","isBinaryStl","OUTPUT_JSON","OUTPUT_STL_JSON","OUTPUT_SHARED","OUTPUT_GR2","OUTPUT_CMF","CLASS_KEYS","Object","freeze","mediaTypes","inputTypes","outputTypes","debugOutputTypes"],"mappings":";;;AAAA;AACA;AACA;AACA;AACA;AACA;;AAsBA,MAAMA,WAAW,GAAG,cAAc;;AAElC;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,YAAY,CACzB;AAEI,EAAA,KAAK,GAAGC,cAAc,CAACC,IAAI;AAC3B,EAAA,OAAO,GAAGD,cAAc,CAACE,MAAM;AAC/B,EAAA,OAAO,GAAGF,cAAc,CAACG,MAAM;AAC/B,EAAA,UAAU,GAAGH,cAAc,CAACI,SAAS;AACrC,EAAA,MAAM,GAAGJ,cAAc,CAACK,KAAK;AAC7B,EAAA,mBAAmB,GAAGL,cAAc,CAACM,kBAAkB;AACvD,EAAA,aAAa,GAAGN,cAAc,CAACO,YAAY;AAC3C,EAAA,cAAc,GAAGP,cAAc,CAACQ,aAAa;AAC7C,EAAA,eAAe,GAAGR,cAAc,CAACS,cAAc;AAC/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