@carbonenginejs/runtime-resource 0.1.0 → 0.8.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 (329) hide show
  1. package/FORMAT-PROVENANCE.md +155 -135
  2. package/LICENSE +21 -21
  3. package/NOTICE +29 -29
  4. package/README.md +548 -241
  5. package/dist/CjsMotherLode.js +1271 -56
  6. package/dist/CjsMotherLode.js.map +1 -1
  7. package/dist/CjsResMan.js +3005 -740
  8. package/dist/CjsResMan.js.map +1 -1
  9. package/dist/CjsResManQueue.js +214 -214
  10. package/dist/CjsResource.js +566 -366
  11. package/dist/CjsResource.js.map +1 -1
  12. package/dist/CjsResourceSource.js +59 -59
  13. package/dist/_virtual/_rollupPluginBabelHelpers.js +153 -153
  14. package/dist/format/CjsBlueReader.js +269 -0
  15. package/dist/format/CjsBlueReader.js.map +1 -0
  16. package/dist/format/CjsFormat.js +192 -178
  17. package/dist/format/CjsFormat.js.map +1 -1
  18. package/dist/format/CjsReader.js +18 -0
  19. package/dist/format/CjsReader.js.map +1 -0
  20. package/dist/format/CjsResourceProbe.js +277 -269
  21. package/dist/format/CjsResourceProbe.js.map +1 -1
  22. package/dist/format/payloadContract.js +173 -173
  23. package/dist/formats/black/CjsBlackFormat.js +278 -272
  24. package/dist/formats/black/CjsBlackFormat.js.map +1 -1
  25. package/dist/formats/black/core/CjsBlackBinaryReader.js +153 -153
  26. package/dist/formats/black/core/CjsBlackPropertyReaders.js +382 -382
  27. package/dist/formats/black/core/CjsBlackReader.js +639 -760
  28. package/dist/formats/black/core/CjsBlackReader.js.map +1 -1
  29. package/dist/formats/black/core/CjsBlackSchemaRegistry.js +433 -433
  30. package/dist/formats/black/core/black-schema-v1-2026-07-11.json.js +4 -4
  31. package/dist/formats/black/core/blackConstants.js +7 -7
  32. package/dist/formats/black/core/blackDefinitions.js +10 -10
  33. package/dist/formats/black/core/blackEnums.js +6 -6
  34. package/dist/formats/black/core/blackSchema.js +3 -3
  35. package/dist/formats/black/core/blackVersion.js +22 -22
  36. package/dist/formats/black/core/helpers.js +182 -182
  37. package/dist/formats/black/core/schema.js +4 -4
  38. package/dist/formats/black/index.js +2 -2
  39. package/dist/formats/bnk/CjsBnkFormat.js +238 -245
  40. package/dist/formats/bnk/CjsBnkFormat.js.map +1 -1
  41. package/dist/formats/bnk/core/graph.js +140 -0
  42. package/dist/formats/bnk/core/graph.js.map +1 -0
  43. package/dist/formats/bnk/core/helpers.js +409 -354
  44. package/dist/formats/bnk/core/helpers.js.map +1 -1
  45. package/dist/formats/bnk/core/musicNodes.js +521 -0
  46. package/dist/formats/bnk/core/musicNodes.js.map +1 -0
  47. package/dist/formats/bnk/core/soundbanksInfo.js +246 -246
  48. package/dist/formats/bnk/index.js +2 -3
  49. package/dist/formats/bnk/index.js.map +1 -1
  50. package/dist/formats/cmf/CjsCmfFormat.js +497 -491
  51. package/dist/formats/cmf/CjsCmfFormat.js.map +1 -1
  52. package/dist/formats/cmf/core/binary.js +118 -118
  53. package/dist/formats/cmf/core/buffers.js +233 -233
  54. package/dist/formats/cmf/core/constants.js +47 -47
  55. package/dist/formats/cmf/core/gr2Anim.js +453 -453
  56. package/dist/formats/cmf/core/helpers.js +287 -287
  57. package/dist/formats/cmf/core/pack.js +276 -276
  58. package/dist/formats/cmf/core/schema.js +364 -364
  59. package/dist/formats/cmf/core/shared.js +268 -268
  60. package/dist/formats/cmf/core/writer.js +517 -517
  61. package/dist/formats/cmf/index.js +2 -2
  62. package/dist/formats/dds/CjsDdsFormat.js +193 -187
  63. package/dist/formats/dds/CjsDdsFormat.js.map +1 -1
  64. package/dist/formats/dds/core/bc6h.js +288 -0
  65. package/dist/formats/dds/core/bc6h.js.map +1 -0
  66. package/dist/formats/dds/core/bc7.js +251 -0
  67. package/dist/formats/dds/core/bc7.js.map +1 -0
  68. package/dist/formats/dds/core/helpers.js +815 -812
  69. package/dist/formats/dds/core/helpers.js.map +1 -1
  70. package/dist/formats/dds/index.js +2 -2
  71. package/dist/formats/fbx/CjsFbxFormat.js +266 -260
  72. package/dist/formats/fbx/CjsFbxFormat.js.map +1 -1
  73. package/dist/formats/fbx/core/helpers.js +3901 -3901
  74. package/dist/formats/fbx/index.js +2 -2
  75. package/dist/formats/flac/CjsFlacFormat.js +87 -81
  76. package/dist/formats/flac/CjsFlacFormat.js.map +1 -1
  77. package/dist/formats/flac/core/helpers.js +295 -295
  78. package/dist/formats/flac/index.js +2 -2
  79. package/dist/formats/gif/CjsGifFormat.js +87 -81
  80. package/dist/formats/gif/CjsGifFormat.js.map +1 -1
  81. package/dist/formats/gif/core/helpers.js +360 -360
  82. package/dist/formats/gif/index.js +2 -2
  83. package/dist/formats/gltf/CjsGltfFormat.js +290 -284
  84. package/dist/formats/gltf/CjsGltfFormat.js.map +1 -1
  85. package/dist/formats/gltf/core/helpers.js +292 -292
  86. package/dist/formats/gltf/core/json.js +79 -79
  87. package/dist/formats/gltf/core/parser.js +666 -666
  88. package/dist/formats/gltf/core/targets.js +163 -163
  89. package/dist/formats/gltf/index.js +2 -2
  90. package/dist/formats/index.js +23 -23
  91. package/dist/formats/jpeg/CjsJpegFormat.js +206 -200
  92. package/dist/formats/jpeg/CjsJpegFormat.js.map +1 -1
  93. package/dist/formats/jpeg/core/helpers.js +350 -350
  94. package/dist/formats/jpeg/core/jpeg.js +377 -377
  95. package/dist/formats/jpeg/index.js +2 -2
  96. package/dist/formats/mp3/CjsMp3Format.js +192 -186
  97. package/dist/formats/mp3/CjsMp3Format.js.map +1 -1
  98. package/dist/formats/mp3/core/helpers.js +338 -338
  99. package/dist/formats/mp3/index.js +2 -2
  100. package/dist/formats/mp4/CjsMp4Format.js +191 -185
  101. package/dist/formats/mp4/CjsMp4Format.js.map +1 -1
  102. package/dist/formats/mp4/core/helpers.js +449 -449
  103. package/dist/formats/mp4/index.js +2 -2
  104. package/dist/formats/obj/CjsObjFormat.js +253 -247
  105. package/dist/formats/obj/CjsObjFormat.js.map +1 -1
  106. package/dist/formats/obj/core/helpers.js +573 -573
  107. package/dist/formats/obj/core/json.js +64 -64
  108. package/dist/formats/obj/core/parser.js +321 -321
  109. package/dist/formats/obj/index.js +2 -2
  110. package/dist/formats/ogg/CjsOggFormat.js +88 -82
  111. package/dist/formats/ogg/CjsOggFormat.js.map +1 -1
  112. package/dist/formats/ogg/core/helpers.js +387 -387
  113. package/dist/formats/ogg/core/imdct.js +178 -178
  114. package/dist/formats/ogg/core/vorbis.js +999 -999
  115. package/dist/formats/ogg/index.js +2 -2
  116. package/dist/formats/png/CjsPngFormat.js +195 -189
  117. package/dist/formats/png/CjsPngFormat.js.map +1 -1
  118. package/dist/formats/png/core/helpers.js +583 -583
  119. package/dist/formats/png/index.js +2 -2
  120. package/dist/formats/red/CjsRedFormat.js +261 -247
  121. package/dist/formats/red/CjsRedFormat.js.map +1 -1
  122. package/dist/formats/red/core/CjsRedReader.js +194 -201
  123. package/dist/formats/red/core/CjsRedReader.js.map +1 -1
  124. package/dist/formats/red/core/blackDefinitions.js +3 -3
  125. package/dist/formats/red/core/helpers.js +139 -136
  126. package/dist/formats/red/core/helpers.js.map +1 -1
  127. package/dist/formats/red/core/redGraph.js +68 -68
  128. package/dist/formats/red/core/schema.js +4 -4
  129. package/dist/formats/red/index.js +2 -2
  130. package/dist/formats/stl/CjsStlFormat.js +365 -304
  131. package/dist/formats/stl/CjsStlFormat.js.map +1 -1
  132. package/dist/formats/stl/core/helpers.js +261 -257
  133. package/dist/formats/stl/core/helpers.js.map +1 -1
  134. package/dist/formats/stl/core/json.js +51 -51
  135. package/dist/formats/stl/core/stl.js +629 -544
  136. package/dist/formats/stl/core/stl.js.map +1 -1
  137. package/dist/formats/stl/core/targets.js +163 -163
  138. package/dist/formats/stl/index.js +2 -2
  139. package/dist/formats/tga/CjsTgaFormat.js +192 -186
  140. package/dist/formats/tga/CjsTgaFormat.js.map +1 -1
  141. package/dist/formats/tga/core/helpers.js +446 -446
  142. package/dist/formats/tga/index.js +2 -2
  143. package/dist/formats/wav/CjsWavFormat.js +192 -186
  144. package/dist/formats/wav/CjsWavFormat.js.map +1 -1
  145. package/dist/formats/wav/core/helpers.js +328 -328
  146. package/dist/formats/wav/index.js +2 -2
  147. package/dist/formats/webm/CjsWebmFormat.js +191 -185
  148. package/dist/formats/webm/CjsWebmFormat.js.map +1 -1
  149. package/dist/formats/webm/core/helpers.js +537 -537
  150. package/dist/formats/webm/index.js +2 -2
  151. package/dist/formats/webp/CjsWebpFormat.js +86 -80
  152. package/dist/formats/webp/CjsWebpFormat.js.map +1 -1
  153. package/dist/formats/webp/core/helpers.js +214 -214
  154. package/dist/formats/webp/index.js +2 -2
  155. package/dist/formats/wem/CjsWemFormat.js +241 -197
  156. package/dist/formats/wem/CjsWemFormat.js.map +1 -1
  157. package/dist/formats/wem/core/bitStream.js +259 -259
  158. package/dist/formats/wem/core/codebookLibrary.js +164 -164
  159. package/dist/formats/wem/core/helpers.js +417 -336
  160. package/dist/formats/wem/core/helpers.js.map +1 -1
  161. package/dist/formats/wem/core/packedCodebooksAotuv603.js +30 -30
  162. package/dist/formats/wem/core/ptadpcm.js +77 -0
  163. package/dist/formats/wem/core/ptadpcm.js.map +1 -0
  164. package/dist/formats/wem/core/resolve.js +121 -0
  165. package/dist/formats/wem/core/resolve.js.map +1 -0
  166. package/dist/formats/wem/core/wemToOgg.js +485 -485
  167. package/dist/formats/wem/index.js +2 -2
  168. package/dist/formats/yaml/CjsYamlFormat.js +83 -77
  169. package/dist/formats/yaml/CjsYamlFormat.js.map +1 -1
  170. package/dist/formats/yaml/core/CjsYamlReader.js +305 -304
  171. package/dist/formats/yaml/core/CjsYamlReader.js.map +1 -1
  172. package/dist/formats/yaml/core/helpers.js +160 -160
  173. package/dist/formats/yaml/index.js +2 -2
  174. package/dist/index.js +48 -52
  175. package/dist/index.js.map +1 -1
  176. package/dist/resourcePath.js +18 -18
  177. package/dist/resourceStates.js +9 -9
  178. package/dist/{generated/resources → resources}/AudioGeometryResData.js +47 -47
  179. package/dist/resources/AudioGeometryResData.js.map +1 -0
  180. package/dist/{generated/resources → resources}/GStateBindingCallbackData.js +31 -31
  181. package/dist/resources/GStateBindingCallbackData.js.map +1 -0
  182. package/dist/{generated/resources → resources}/MeshDecalData.js +37 -37
  183. package/dist/resources/MeshDecalData.js.map +1 -0
  184. package/dist/{generated/resources → resources}/MeshDecalLodData.js +34 -34
  185. package/dist/resources/MeshDecalLodData.js.map +1 -0
  186. package/dist/resources/Tr2EffectRes.js +71 -71
  187. package/dist/resources/Tr2GrannyIntersectionResult.js +60 -0
  188. package/dist/resources/Tr2GrannyIntersectionResult.js.map +1 -0
  189. package/dist/resources/Tr2GrannyStateRes.js +44 -44
  190. package/dist/resources/Tr2ImageRes.js +114 -114
  191. package/dist/resources/Tr2LightProfileRes.js +40 -40
  192. package/dist/{generated/resources → resources}/Tr2MaterialArea.js +34 -34
  193. package/dist/resources/Tr2MaterialArea.js.map +1 -0
  194. package/dist/{generated/resources → resources}/Tr2MaterialMesh.js +31 -31
  195. package/dist/resources/Tr2MaterialMesh.js.map +1 -0
  196. package/dist/{generated/resources → resources}/Tr2MaterialRes.js +34 -34
  197. package/dist/resources/Tr2MaterialRes.js.map +1 -0
  198. package/dist/{generated/resources → resources}/Tr2ShaderPermutation.js +43 -43
  199. package/dist/resources/Tr2ShaderPermutation.js.map +1 -0
  200. package/dist/{generated/resources → resources}/Tr2TextureLodManager.js +100 -60
  201. package/dist/resources/Tr2TextureLodManager.js.map +1 -0
  202. package/dist/{generated/resources → resources}/Tr2TextureLodUpdateRequest.js +37 -37
  203. package/dist/resources/Tr2TextureLodUpdateRequest.js.map +1 -0
  204. package/dist/{generated/resources → resources}/Tr2TexturePackChannel.js +37 -37
  205. package/dist/resources/Tr2TexturePackChannel.js.map +1 -0
  206. package/dist/resources/Tr2TexturePipeline.js +68 -0
  207. package/dist/resources/Tr2TexturePipeline.js.map +1 -0
  208. package/dist/{generated/resources → resources}/Tr2TexturePipelineParams.js +34 -34
  209. package/dist/resources/Tr2TexturePipelineParams.js.map +1 -0
  210. package/dist/{generated/resources → resources}/Tr2TexturePipelineStepCompress.js +40 -40
  211. package/dist/resources/Tr2TexturePipelineStepCompress.js.map +1 -0
  212. package/dist/{generated/resources → resources}/Tr2TexturePipelineStepLimitSize.js +34 -34
  213. package/dist/resources/Tr2TexturePipelineStepLimitSize.js.map +1 -0
  214. package/dist/{generated/resources → resources}/Tr2TexturePipelineStepLoad.js +31 -31
  215. package/dist/resources/Tr2TexturePipelineStepLoad.js.map +1 -0
  216. package/dist/{generated/resources → resources}/Tr2TexturePipelineStepPack.js +43 -43
  217. package/dist/resources/Tr2TexturePipelineStepPack.js.map +1 -0
  218. package/dist/resources/TriGeometryRes.js +239 -216
  219. package/dist/resources/TriGeometryRes.js.map +1 -1
  220. package/dist/{generated/resources → resources}/TriGeometryResAreaData.js +59 -59
  221. package/dist/resources/TriGeometryResAreaData.js.map +1 -0
  222. package/dist/{generated/resources → resources}/TriGeometryResJointData.js +38 -38
  223. package/dist/resources/TriGeometryResJointData.js.map +1 -0
  224. package/dist/{generated/resources → resources}/TriGeometryResLodData.js +88 -88
  225. package/dist/resources/TriGeometryResLodData.js.map +1 -0
  226. package/dist/{generated/resources → resources}/TriGeometryResMeshData.js +63 -63
  227. package/dist/resources/TriGeometryResMeshData.js.map +1 -0
  228. package/dist/{generated/resources → resources}/TriGeometryResSkeletonData.js +34 -34
  229. package/dist/resources/TriGeometryResSkeletonData.js.map +1 -0
  230. package/dist/resources/TriGrannyRes.js +43 -43
  231. package/dist/{generated/resources → resources}/TriJointBinding.js +38 -38
  232. package/dist/resources/TriJointBinding.js.map +1 -0
  233. package/dist/{generated/resources → resources}/TriMorphTargetGeometryConstants.js +46 -46
  234. package/dist/resources/TriMorphTargetGeometryConstants.js.map +1 -0
  235. package/dist/{generated/resources → resources}/TriRtGeometryConstants.js +88 -88
  236. package/dist/resources/TriRtGeometryConstants.js.map +1 -0
  237. package/dist/resources/TriTextureRes.js +304 -304
  238. package/dist/{generated/resources → resources}/enums.js +18 -18
  239. package/dist/resources/enums.js.map +1 -0
  240. package/dist/resources/resourceBoundary.js +47 -47
  241. package/dist/resources/texturePipelineBehavior.js +320 -0
  242. package/dist/resources/texturePipelineBehavior.js.map +1 -0
  243. package/dist/texture/CjsTextureArrayRes.js +406 -406
  244. package/dist/texture/CjsTextureParameterProxy.js +133 -133
  245. package/format-notices/black/LICENSE +21 -21
  246. package/format-notices/black/NOTICE +47 -47
  247. package/format-notices/bnk/LICENSE +21 -21
  248. package/format-notices/bnk/NOTICE +20 -17
  249. package/format-notices/cmf/LICENSE +21 -21
  250. package/format-notices/cmf/NOTICE +36 -36
  251. package/format-notices/dds/LICENSE +21 -21
  252. package/format-notices/dds/NOTICE +14 -14
  253. package/format-notices/fbx/LICENSE +21 -21
  254. package/format-notices/fbx/NOTICE +14 -14
  255. package/format-notices/flac/LICENSE +21 -21
  256. package/format-notices/flac/NOTICE +14 -14
  257. package/format-notices/gif/LICENSE +21 -21
  258. package/format-notices/gif/NOTICE +14 -14
  259. package/format-notices/gltf/LICENSE +21 -21
  260. package/format-notices/gltf/NOTICE +27 -27
  261. package/format-notices/jpeg/LICENSE +21 -21
  262. package/format-notices/jpeg/NOTICE +14 -14
  263. package/format-notices/mp3/LICENSE +21 -21
  264. package/format-notices/mp3/NOTICE +14 -14
  265. package/format-notices/mp4/LICENSE +21 -21
  266. package/format-notices/mp4/NOTICE +14 -14
  267. package/format-notices/obj/LICENSE +21 -21
  268. package/format-notices/obj/NOTICE +26 -26
  269. package/format-notices/ogg/LICENSE +21 -21
  270. package/format-notices/ogg/NOTICE +28 -28
  271. package/format-notices/png/LICENSE +21 -21
  272. package/format-notices/png/NOTICE +14 -14
  273. package/format-notices/red/LICENSE +21 -21
  274. package/format-notices/red/NOTICE +31 -31
  275. package/format-notices/stl/LICENSE +21 -21
  276. package/format-notices/stl/NOTICE +21 -21
  277. package/format-notices/tga/LICENSE +21 -21
  278. package/format-notices/tga/NOTICE +14 -14
  279. package/format-notices/wav/LICENSE +21 -21
  280. package/format-notices/wav/NOTICE +14 -14
  281. package/format-notices/webm/LICENSE +21 -21
  282. package/format-notices/webm/NOTICE +14 -14
  283. package/format-notices/webp/LICENSE +21 -21
  284. package/format-notices/webp/NOTICE +14 -14
  285. package/format-notices/wem/LICENSE +57 -57
  286. package/format-notices/wem/NOTICE +33 -33
  287. package/format-notices/yaml/LICENSE +21 -21
  288. package/format-notices/yaml/NOTICE +44 -44
  289. package/package.json +51 -51
  290. package/resource-lifecycle.md +679 -487
  291. package/dist/generated/resources/AudioGeometryResData.js.map +0 -1
  292. package/dist/generated/resources/CmfVertexReader.js +0 -46
  293. package/dist/generated/resources/CmfVertexReader.js.map +0 -1
  294. package/dist/generated/resources/GStateBindingCallbackData.js.map +0 -1
  295. package/dist/generated/resources/MeshDecalData.js.map +0 -1
  296. package/dist/generated/resources/MeshDecalLodData.js.map +0 -1
  297. package/dist/generated/resources/Tr2AsyncSave.js +0 -46
  298. package/dist/generated/resources/Tr2AsyncSave.js.map +0 -1
  299. package/dist/generated/resources/Tr2CmfContents.js +0 -37
  300. package/dist/generated/resources/Tr2CmfContents.js.map +0 -1
  301. package/dist/generated/resources/Tr2GrannyIntersectionResult.js +0 -58
  302. package/dist/generated/resources/Tr2GrannyIntersectionResult.js.map +0 -1
  303. package/dist/generated/resources/Tr2LoadPrepareFence.js +0 -37
  304. package/dist/generated/resources/Tr2LoadPrepareFence.js.map +0 -1
  305. package/dist/generated/resources/Tr2MaterialArea.js.map +0 -1
  306. package/dist/generated/resources/Tr2MaterialMesh.js.map +0 -1
  307. package/dist/generated/resources/Tr2MaterialRes.js.map +0 -1
  308. package/dist/generated/resources/Tr2ShaderPermutation.js.map +0 -1
  309. package/dist/generated/resources/Tr2TextureLodManager.js.map +0 -1
  310. package/dist/generated/resources/Tr2TextureLodUpdateRequest.js.map +0 -1
  311. package/dist/generated/resources/Tr2TexturePackChannel.js.map +0 -1
  312. package/dist/generated/resources/Tr2TexturePipeline.js +0 -44
  313. package/dist/generated/resources/Tr2TexturePipeline.js.map +0 -1
  314. package/dist/generated/resources/Tr2TexturePipelineParams.js.map +0 -1
  315. package/dist/generated/resources/Tr2TexturePipelineStepCompress.js.map +0 -1
  316. package/dist/generated/resources/Tr2TexturePipelineStepLimitSize.js.map +0 -1
  317. package/dist/generated/resources/Tr2TexturePipelineStepLoad.js.map +0 -1
  318. package/dist/generated/resources/Tr2TexturePipelineStepPack.js.map +0 -1
  319. package/dist/generated/resources/TriGeometryResAreaData.js.map +0 -1
  320. package/dist/generated/resources/TriGeometryResJointData.js.map +0 -1
  321. package/dist/generated/resources/TriGeometryResLodData.js.map +0 -1
  322. package/dist/generated/resources/TriGeometryResMeshData.js.map +0 -1
  323. package/dist/generated/resources/TriGeometryResSkeletonData.js.map +0 -1
  324. package/dist/generated/resources/TriJointBinding.js.map +0 -1
  325. package/dist/generated/resources/TriMorphTargetGeometryConstants.js.map +0 -1
  326. package/dist/generated/resources/TriRtGeometryConstants.js.map +0 -1
  327. package/dist/generated/resources/enums.js.map +0 -1
  328. package/dist/generated/resources/index.js +0 -32
  329. package/dist/generated/resources/index.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"CjsYamlReader.js","sources":["../../../../../src/formats/yaml/core/CjsYamlReader.js"],"sourcesContent":["import {\n LineCounter,\n isAlias,\n isMap,\n isScalar,\n isSeq,\n parseDocument,\n visit\n} from \"yaml\";\n\nimport { TAG_HANDLE, TAG_PRESERVE, TAG_REJECT, toJsonGraph } from \"./helpers.js\";\n\nconst TAG_PREFIX = \"tag:yaml.org,2002:\";\nconst PYTHON_TUPLE = `${TAG_PREFIX}python/tuple`;\nconst PYTHON_UNICODE = `${TAG_PREFIX}python/unicode`;\nconst PYTHON_PROJECTED_DECAL = `${TAG_PREFIX}python/object:paperDoll.ProjectedDecal`;\nconst PYTHON_PART_METADATA = `${TAG_PREFIX}python/object:paperDoll.AvatarPartMetaData`;\n\nconst STANDARD_TAGS = new Set([\n \"binary\", \"bool\", \"float\", \"int\", \"map\", \"merge\", \"null\", \"omap\",\n \"pairs\", \"seq\", \"set\", \"str\", \"timestamp\"\n].map(name => `${TAG_PREFIX}${name}`));\n\nfunction canonicalTag(tag)\n{\n if (typeof tag !== \"string\") return tag;\n if (tag.startsWith(\"!!\")) return `${TAG_PREFIX}${tag.slice(2)}`;\n return tag;\n}\n\nfunction displayMessage(error)\n{\n return String(error && error.message ? error.message : error).trim();\n}\n\nfunction defineMappingValue(target, key, value)\n{\n Object.defineProperty(target, key, {\n value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n}\n\nexport class CjsYamlReader\n{\n constructor(input, options = {})\n {\n if (typeof input !== \"string\")\n {\n throw new TypeError(\"CjsYamlFormat input must be a YAML string\");\n }\n\n this.source = input;\n this.options = options;\n this.lineCounter = new LineCounter();\n this.document = parseDocument(input, {\n keepSourceTokens: true,\n lineCounter: this.lineCounter,\n prettyErrors: true,\n strict: true,\n uniqueKeys: this.options.uniqueKeys\n });\n this.inventory = this.BuildInventory();\n }\n\n Read()\n {\n return this.ReadPayload();\n }\n\n ReadPayload()\n {\n return toJsonGraph(this.ReadRaw(), this.options);\n }\n\n ReadRaw()\n {\n this.AssertSyntax();\n this.AssertAliasLimit();\n return this.Convert(this.document.contents, new Map());\n }\n\n ReadDocument()\n {\n let value = null;\n const errors = this.inventory.errors.slice();\n\n if (!errors.length)\n {\n try\n {\n this.AssertAliasLimit();\n value = this.Convert(this.document.contents, new Map());\n }\n catch (error)\n {\n errors.push(this.DescribeError(error));\n }\n }\n\n return {\n format: { id: \"yaml\" },\n source: { name: this.options.sourceName, length: this.source.length },\n root: { kind: this.RootKind() },\n value,\n tags: this.inventory.tags,\n anchors: this.inventory.anchors,\n aliases: this.inventory.aliases,\n warnings: this.inventory.warnings,\n errors\n };\n }\n\n Inspect()\n {\n return {\n format: { id: \"yaml\" },\n source: { name: this.options.sourceName, length: this.source.length },\n root: { kind: this.RootKind() },\n tags: this.inventory.tags,\n anchors: this.inventory.anchors,\n aliases: this.inventory.aliases,\n warnings: this.inventory.warnings,\n errors: this.inventory.errors\n };\n }\n\n RootKind()\n {\n const node = this.document.contents;\n if (node === null) return \"null\";\n if (isMap(node)) return \"mapping\";\n if (isSeq(node)) return \"sequence\";\n if (isScalar(node)) return \"scalar\";\n if (isAlias(node)) return \"alias\";\n return \"unknown\";\n }\n\n AssertSyntax()\n {\n if (!this.document.errors.length) return;\n const first = this.document.errors[0];\n const source = this.options.sourceName ? ` in ${this.options.sourceName}` : \"\";\n throw new SyntaxError(`CjsYamlFormat${source}: ${displayMessage(first)}`);\n }\n\n AssertAliasLimit()\n {\n if (this.inventory.aliases.length <= this.options.maxAliasCount) return;\n const source = this.options.sourceName ? ` in ${this.options.sourceName}` : \"\";\n throw new RangeError(`CjsYamlFormat${source}: alias count ${this.inventory.aliases.length} exceeds maxAliasCount ${this.options.maxAliasCount}`);\n }\n\n Convert(node, memo)\n {\n if (node === null || node === undefined) return null;\n\n if (isAlias(node))\n {\n const source = node.resolve(this.document);\n if (!source) throw this.NodeError(node, `unresolved alias \"${node.source}\"`);\n return this.Convert(source, memo);\n }\n\n if (memo.has(node)) return memo.get(node);\n\n const tag = this.CustomTag(node);\n if (tag)\n {\n this.AssertTagAllowed(tag, node);\n const handler = this.FindTagHandler(tag);\n\n if (handler)\n {\n const value = this.ConvertBase(node, memo, true);\n const handled = handler(value, this.TagContext(tag, node));\n memo.set(node, handled);\n return handled;\n }\n\n if (tag === PYTHON_TUPLE)\n {\n if (!isSeq(node)) throw this.NodeError(node, `${tag} must decorate a sequence`);\n return this.ConvertBase(node, memo, true);\n }\n\n if (tag === PYTHON_UNICODE)\n {\n if (!isScalar(node) || typeof node.value !== \"string\")\n {\n throw this.NodeError(node, `${tag} must decorate a string scalar`);\n }\n return node.value;\n }\n\n if (this.options.tagPolicy === TAG_REJECT)\n {\n throw this.NodeError(node, `custom tag \"${tag}\" is rejected by tagPolicy`);\n }\n\n if (this.options.tagPolicy === TAG_HANDLE)\n {\n throw this.NodeError(node, `custom tag \"${tag}\" has no explicit handler`);\n }\n\n if (this.options.tagPolicy === TAG_PRESERVE || tag === PYTHON_PROJECTED_DECAL || tag === PYTHON_PART_METADATA)\n {\n const wrapper = { [this.options.tagField]: tag };\n memo.set(node, wrapper);\n wrapper[this.options.valueField] = this.ConvertBase(node, memo, false);\n return wrapper;\n }\n }\n\n return this.ConvertBase(node, memo, true);\n }\n\n ConvertBase(node, memo, memoize)\n {\n if (isScalar(node)) return node.value;\n\n if (isSeq(node))\n {\n const out = [];\n if (memoize) memo.set(node, out);\n for (const item of node.items) out.push(this.Convert(item, memo));\n return out;\n }\n\n if (isMap(node))\n {\n const out = {};\n if (memoize) memo.set(node, out);\n for (const pair of node.items)\n {\n const key = this.MapKey(pair.key);\n if (this.options.uniqueKeys && Object.prototype.hasOwnProperty.call(out, key))\n {\n throw this.NodeError(pair.key, `duplicate mapping key \"${key}\"`);\n }\n // Defining the property prevents keys such as \"__proto__\" from\n // mutating the result object's prototype.\n defineMappingValue(out, key, this.Convert(pair.value, memo));\n }\n return out;\n }\n\n throw this.NodeError(node, \"unsupported YAML node\");\n }\n\n MapKey(node)\n {\n if (!isScalar(node)) throw this.NodeError(node, \"mapping keys must be scalar values\");\n return String(node.value);\n }\n\n CustomTag(node)\n {\n const tag = canonicalTag(node.tag);\n return tag && !STANDARD_TAGS.has(tag) ? tag : null;\n }\n\n AssertTagAllowed(tag, node)\n {\n if (!this.options.allowedTags) return;\n const allowed = new Set(this.options.allowedTags.map(canonicalTag));\n if (!allowed.has(tag)) throw this.NodeError(node, `custom tag \"${tag}\" is not in allowedTags`);\n }\n\n FindTagHandler(tag)\n {\n const handlers = this.options.tagHandlers;\n const short = tag.startsWith(TAG_PREFIX) ? `!!${tag.slice(TAG_PREFIX.length)}` : tag;\n if (handlers instanceof Map) return handlers.get(tag) || handlers.get(short) || null;\n return handlers[tag] || handlers[short] || null;\n }\n\n TagContext(tag, node)\n {\n return {\n tag,\n sourceName: this.options.sourceName,\n location: this.TagLocation(node)\n };\n }\n\n NodeError(node, message)\n {\n const at = node && node.tag ? this.TagLocation(node) : this.Location(node);\n const source = this.options.sourceName ? `${this.options.sourceName}:` : \"\";\n const where = at ? `${source}${at.line}:${at.column}` : (this.options.sourceName || \"YAML input\");\n const error = new Error(`CjsYamlFormat ${where}: ${message}`);\n error.code = \"YAML_TAG_POLICY\";\n error.location = at;\n return error;\n }\n\n Location(node)\n {\n if (!node || !Array.isArray(node.range)) return null;\n const pos = this.lineCounter.linePos(node.range[0]);\n return { offset: node.range[0], line: pos.line, column: pos.col };\n }\n\n TagLocation(node)\n {\n const fallback = this.Location(node);\n if (!fallback || !node.tag) return fallback;\n\n const lineStart = this.source.lastIndexOf(\"\\n\", node.range[0] - 1) + 1;\n const prefix = this.source.slice(lineStart, node.range[0]);\n const tags = [ ...prefix.matchAll(/!<[^>]+>|!!?[^\\s[\\]{},]+/g) ];\n const match = tags[tags.length - 1];\n if (!match) return fallback;\n\n const offset = lineStart + match.index;\n const pos = this.lineCounter.linePos(offset);\n return { offset, line: pos.line, column: pos.col };\n }\n\n DescribeError(error)\n {\n const linePos = error && error.linePos && error.linePos[0];\n return {\n code: error && error.code ? error.code : \"YAML_ERROR\",\n message: displayMessage(error),\n location: error && error.location ? error.location : (linePos ? {\n line: linePos.line,\n column: linePos.col\n } : null)\n };\n }\n\n BuildInventory()\n {\n const tags = [];\n const anchors = [];\n const aliases = [];\n\n visit(this.document, (_key, node) =>\n {\n if (!node || typeof node !== \"object\") return;\n const tag = this.CustomTag(node);\n const location = tag ? this.TagLocation(node) : this.Location(node);\n if (tag) tags.push({ tag, kind: this.NodeKind(node), location });\n if (node.anchor) anchors.push({ name: node.anchor, kind: this.NodeKind(node), location });\n if (isAlias(node)) aliases.push({ name: node.source, location });\n });\n\n return {\n tags,\n anchors,\n aliases,\n warnings: this.document.warnings.map(error => this.DescribeError(error)),\n errors: this.document.errors.map(error => this.DescribeError(error))\n };\n }\n\n NodeKind(node)\n {\n if (isMap(node)) return \"mapping\";\n if (isSeq(node)) return \"sequence\";\n if (isScalar(node)) return \"scalar\";\n if (isAlias(node)) return \"alias\";\n return \"unknown\";\n }\n}\n\nexport default CjsYamlReader;\n"],"names":["TAG_PREFIX","PYTHON_TUPLE","PYTHON_UNICODE","PYTHON_PROJECTED_DECAL","PYTHON_PART_METADATA","STANDARD_TAGS","Set","map","name","canonicalTag","tag","startsWith","slice","displayMessage","error","String","message","trim","defineMappingValue","target","key","value","Object","defineProperty","enumerable","configurable","writable","CjsYamlReader","constructor","input","options","TypeError","source","lineCounter","LineCounter","document","parseDocument","keepSourceTokens","prettyErrors","strict","uniqueKeys","inventory","BuildInventory","Read","ReadPayload","toJsonGraph","ReadRaw","AssertSyntax","AssertAliasLimit","Convert","contents","Map","ReadDocument","errors","length","push","DescribeError","format","id","sourceName","root","kind","RootKind","tags","anchors","aliases","warnings","Inspect","node","isMap","isSeq","isScalar","isAlias","first","SyntaxError","maxAliasCount","RangeError","memo","undefined","resolve","NodeError","has","get","CustomTag","AssertTagAllowed","handler","FindTagHandler","ConvertBase","handled","TagContext","set","tagPolicy","TAG_REJECT","TAG_HANDLE","TAG_PRESERVE","wrapper","tagField","valueField","memoize","out","item","items","pair","MapKey","prototype","hasOwnProperty","call","allowedTags","allowed","handlers","tagHandlers","short","location","TagLocation","at","Location","where","line","column","Error","code","Array","isArray","range","pos","linePos","offset","col","fallback","lineStart","lastIndexOf","prefix","matchAll","match","index","visit","_key","NodeKind","anchor"],"mappings":";;;AAYA,MAAMA,UAAU,GAAG,oBAAoB;AACvC,MAAMC,YAAY,GAAG,CAAA,EAAGD,UAAU,CAAA,YAAA,CAAc;AAChD,MAAME,cAAc,GAAG,CAAA,EAAGF,UAAU,CAAA,cAAA,CAAgB;AACpD,MAAMG,sBAAsB,GAAG,CAAA,EAAGH,UAAU,CAAA,sCAAA,CAAwC;AACpF,MAAMI,oBAAoB,GAAG,CAAA,EAAGJ,UAAU,CAAA,0CAAA,CAA4C;AAEtF,MAAMK,aAAa,GAAG,IAAIC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,IAAI,EACb;AACI,IAAA,IAAIC,KAAK,CAACD,IAAI,CAAC,EAAE,OAAO,SAAS;AACjC,IAAA,IAAIE,KAAK,CAACF,IAAI,CAAC,EAAE,OAAO,UAAU;AAClC,IAAA,IAAIG,QAAQ,CAACH,IAAI,CAAC,EAAE,OAAO,QAAQ;AACnC,IAAA,IAAII,OAAO,CAACJ,IAAI,CAAC,EAAE,OAAO,OAAO;AACjC,IAAA,OAAO,SAAS;AACpB,EAAA;AACJ;;;;"}
1
+ {"version":3,"file":"CjsYamlReader.js","sources":["../../../../../src/formats/yaml/core/CjsYamlReader.js"],"sourcesContent":["import {\n LineCounter,\n isAlias,\n isMap,\n isScalar,\n isSeq,\n parseDocument,\n visit\n} from \"yaml\";\n\nimport { CjsReader } from \"../../../format/CjsReader.js\";\nimport { TAG_HANDLE, TAG_PRESERVE, TAG_REJECT, toJsonGraph } from \"./helpers.js\";\n\nconst TAG_PREFIX = \"tag:yaml.org,2002:\";\nconst PYTHON_TUPLE = `${TAG_PREFIX}python/tuple`;\nconst PYTHON_UNICODE = `${TAG_PREFIX}python/unicode`;\nconst PYTHON_PROJECTED_DECAL = `${TAG_PREFIX}python/object:paperDoll.ProjectedDecal`;\nconst PYTHON_PART_METADATA = `${TAG_PREFIX}python/object:paperDoll.AvatarPartMetaData`;\n\nconst STANDARD_TAGS = new Set([\n \"binary\", \"bool\", \"float\", \"int\", \"map\", \"merge\", \"null\", \"omap\",\n \"pairs\", \"seq\", \"set\", \"str\", \"timestamp\"\n].map(name => `${TAG_PREFIX}${name}`));\n\nfunction canonicalTag(tag)\n{\n if (typeof tag !== \"string\") return tag;\n if (tag.startsWith(\"!!\")) return `${TAG_PREFIX}${tag.slice(2)}`;\n return tag;\n}\n\nfunction displayMessage(error)\n{\n return String(error && error.message ? error.message : error).trim();\n}\n\nfunction defineMappingValue(target, key, value)\n{\n Object.defineProperty(target, key, {\n value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n}\n\nexport class CjsYamlReader extends CjsReader\n{\n constructor(input, options = {})\n {\n super(options);\n\n if (typeof input !== \"string\")\n {\n throw new TypeError(\"CjsYamlFormat input must be a YAML string\");\n }\n\n this.source = input;\n this.lineCounter = new LineCounter();\n this.document = parseDocument(input, {\n keepSourceTokens: true,\n lineCounter: this.lineCounter,\n prettyErrors: true,\n strict: true,\n uniqueKeys: this.options.uniqueKeys\n });\n this.inventory = this.BuildInventory();\n }\n\n Read()\n {\n return this.ReadPayload();\n }\n\n ReadPayload()\n {\n return toJsonGraph(this.ReadRaw(), this.options);\n }\n\n ReadRaw()\n {\n this.AssertSyntax();\n this.AssertAliasLimit();\n return this.Convert(this.document.contents, new Map());\n }\n\n ReadDocument()\n {\n let value = null;\n const errors = this.inventory.errors.slice();\n\n if (!errors.length)\n {\n try\n {\n this.AssertAliasLimit();\n value = this.Convert(this.document.contents, new Map());\n }\n catch (error)\n {\n errors.push(this.DescribeError(error));\n }\n }\n\n return {\n format: { id: \"yaml\" },\n source: { name: this.options.sourceName, length: this.source.length },\n root: { kind: this.RootKind() },\n value,\n tags: this.inventory.tags,\n anchors: this.inventory.anchors,\n aliases: this.inventory.aliases,\n warnings: this.inventory.warnings,\n errors\n };\n }\n\n Inspect()\n {\n return {\n format: { id: \"yaml\" },\n source: { name: this.options.sourceName, length: this.source.length },\n root: { kind: this.RootKind() },\n tags: this.inventory.tags,\n anchors: this.inventory.anchors,\n aliases: this.inventory.aliases,\n warnings: this.inventory.warnings,\n errors: this.inventory.errors\n };\n }\n\n RootKind()\n {\n const node = this.document.contents;\n if (node === null) return \"null\";\n if (isMap(node)) return \"mapping\";\n if (isSeq(node)) return \"sequence\";\n if (isScalar(node)) return \"scalar\";\n if (isAlias(node)) return \"alias\";\n return \"unknown\";\n }\n\n AssertSyntax()\n {\n if (!this.document.errors.length) return;\n const first = this.document.errors[0];\n const source = this.options.sourceName ? ` in ${this.options.sourceName}` : \"\";\n throw new SyntaxError(`CjsYamlFormat${source}: ${displayMessage(first)}`);\n }\n\n AssertAliasLimit()\n {\n if (this.inventory.aliases.length <= this.options.maxAliasCount) return;\n const source = this.options.sourceName ? ` in ${this.options.sourceName}` : \"\";\n throw new RangeError(`CjsYamlFormat${source}: alias count ${this.inventory.aliases.length} exceeds maxAliasCount ${this.options.maxAliasCount}`);\n }\n\n Convert(node, memo)\n {\n if (node === null || node === undefined) return null;\n\n if (isAlias(node))\n {\n const source = node.resolve(this.document);\n if (!source) throw this.NodeError(node, `unresolved alias \"${node.source}\"`);\n return this.Convert(source, memo);\n }\n\n if (memo.has(node)) return memo.get(node);\n\n const tag = this.CustomTag(node);\n if (tag)\n {\n this.AssertTagAllowed(tag, node);\n const handler = this.FindTagHandler(tag);\n\n if (handler)\n {\n const value = this.ConvertBase(node, memo, true);\n const handled = handler(value, this.TagContext(tag, node));\n memo.set(node, handled);\n return handled;\n }\n\n if (tag === PYTHON_TUPLE)\n {\n if (!isSeq(node)) throw this.NodeError(node, `${tag} must decorate a sequence`);\n return this.ConvertBase(node, memo, true);\n }\n\n if (tag === PYTHON_UNICODE)\n {\n if (!isScalar(node) || typeof node.value !== \"string\")\n {\n throw this.NodeError(node, `${tag} must decorate a string scalar`);\n }\n return node.value;\n }\n\n if (this.options.tagPolicy === TAG_REJECT)\n {\n throw this.NodeError(node, `custom tag \"${tag}\" is rejected by tagPolicy`);\n }\n\n if (this.options.tagPolicy === TAG_HANDLE)\n {\n throw this.NodeError(node, `custom tag \"${tag}\" has no explicit handler`);\n }\n\n if (this.options.tagPolicy === TAG_PRESERVE || tag === PYTHON_PROJECTED_DECAL || tag === PYTHON_PART_METADATA)\n {\n const wrapper = { [this.options.tagField]: tag };\n memo.set(node, wrapper);\n wrapper[this.options.valueField] = this.ConvertBase(node, memo, false);\n return wrapper;\n }\n }\n\n return this.ConvertBase(node, memo, true);\n }\n\n ConvertBase(node, memo, memoize)\n {\n if (isScalar(node)) return node.value;\n\n if (isSeq(node))\n {\n const out = [];\n if (memoize) memo.set(node, out);\n for (const item of node.items) out.push(this.Convert(item, memo));\n return out;\n }\n\n if (isMap(node))\n {\n const out = {};\n if (memoize) memo.set(node, out);\n for (const pair of node.items)\n {\n const key = this.MapKey(pair.key);\n if (this.options.uniqueKeys && Object.prototype.hasOwnProperty.call(out, key))\n {\n throw this.NodeError(pair.key, `duplicate mapping key \"${key}\"`);\n }\n // Defining the property prevents keys such as \"__proto__\" from\n // mutating the result object's prototype.\n defineMappingValue(out, key, this.Convert(pair.value, memo));\n }\n return out;\n }\n\n throw this.NodeError(node, \"unsupported YAML node\");\n }\n\n MapKey(node)\n {\n if (!isScalar(node)) throw this.NodeError(node, \"mapping keys must be scalar values\");\n return String(node.value);\n }\n\n CustomTag(node)\n {\n const tag = canonicalTag(node.tag);\n return tag && !STANDARD_TAGS.has(tag) ? tag : null;\n }\n\n AssertTagAllowed(tag, node)\n {\n if (!this.options.allowedTags) return;\n const allowed = new Set(this.options.allowedTags.map(canonicalTag));\n if (!allowed.has(tag)) throw this.NodeError(node, `custom tag \"${tag}\" is not in allowedTags`);\n }\n\n FindTagHandler(tag)\n {\n const handlers = this.options.tagHandlers;\n const short = tag.startsWith(TAG_PREFIX) ? `!!${tag.slice(TAG_PREFIX.length)}` : tag;\n if (handlers instanceof Map) return handlers.get(tag) || handlers.get(short) || null;\n return handlers[tag] || handlers[short] || null;\n }\n\n TagContext(tag, node)\n {\n return {\n tag,\n sourceName: this.options.sourceName,\n location: this.TagLocation(node)\n };\n }\n\n NodeError(node, message)\n {\n const at = node && node.tag ? this.TagLocation(node) : this.Location(node);\n const source = this.options.sourceName ? `${this.options.sourceName}:` : \"\";\n const where = at ? `${source}${at.line}:${at.column}` : (this.options.sourceName || \"YAML input\");\n const error = new Error(`CjsYamlFormat ${where}: ${message}`);\n error.code = \"YAML_TAG_POLICY\";\n error.location = at;\n return error;\n }\n\n Location(node)\n {\n if (!node || !Array.isArray(node.range)) return null;\n const pos = this.lineCounter.linePos(node.range[0]);\n return { offset: node.range[0], line: pos.line, column: pos.col };\n }\n\n TagLocation(node)\n {\n const fallback = this.Location(node);\n if (!fallback || !node.tag) return fallback;\n\n const lineStart = this.source.lastIndexOf(\"\\n\", node.range[0] - 1) + 1;\n const prefix = this.source.slice(lineStart, node.range[0]);\n const tags = [ ...prefix.matchAll(/!<[^>]+>|!!?[^\\s[\\]{},]+/g) ];\n const match = tags[tags.length - 1];\n if (!match) return fallback;\n\n const offset = lineStart + match.index;\n const pos = this.lineCounter.linePos(offset);\n return { offset, line: pos.line, column: pos.col };\n }\n\n DescribeError(error)\n {\n const linePos = error && error.linePos && error.linePos[0];\n return {\n code: error && error.code ? error.code : \"YAML_ERROR\",\n message: displayMessage(error),\n location: error && error.location ? error.location : (linePos ? {\n line: linePos.line,\n column: linePos.col\n } : null)\n };\n }\n\n BuildInventory()\n {\n const tags = [];\n const anchors = [];\n const aliases = [];\n\n visit(this.document, (_key, node) =>\n {\n if (!node || typeof node !== \"object\") return;\n const tag = this.CustomTag(node);\n const location = tag ? this.TagLocation(node) : this.Location(node);\n if (tag) tags.push({ tag, kind: this.NodeKind(node), location });\n if (node.anchor) anchors.push({ name: node.anchor, kind: this.NodeKind(node), location });\n if (isAlias(node)) aliases.push({ name: node.source, location });\n });\n\n return {\n tags,\n anchors,\n aliases,\n warnings: this.document.warnings.map(error => this.DescribeError(error)),\n errors: this.document.errors.map(error => this.DescribeError(error))\n };\n }\n\n NodeKind(node)\n {\n if (isMap(node)) return \"mapping\";\n if (isSeq(node)) return \"sequence\";\n if (isScalar(node)) return \"scalar\";\n if (isAlias(node)) return \"alias\";\n return \"unknown\";\n }\n}\n\nexport default CjsYamlReader;\n"],"names":["TAG_PREFIX","PYTHON_TUPLE","PYTHON_UNICODE","PYTHON_PROJECTED_DECAL","PYTHON_PART_METADATA","STANDARD_TAGS","Set","map","name","canonicalTag","tag","startsWith","slice","displayMessage","error","String","message","trim","defineMappingValue","target","key","value","Object","defineProperty","enumerable","configurable","writable","CjsYamlReader","CjsReader","constructor","input","options","TypeError","source","lineCounter","LineCounter","document","parseDocument","keepSourceTokens","prettyErrors","strict","uniqueKeys","inventory","BuildInventory","Read","ReadPayload","toJsonGraph","ReadRaw","AssertSyntax","AssertAliasLimit","Convert","contents","Map","ReadDocument","errors","length","push","DescribeError","format","id","sourceName","root","kind","RootKind","tags","anchors","aliases","warnings","Inspect","node","isMap","isSeq","isScalar","isAlias","first","SyntaxError","maxAliasCount","RangeError","memo","undefined","resolve","NodeError","has","get","CustomTag","AssertTagAllowed","handler","FindTagHandler","ConvertBase","handled","TagContext","set","tagPolicy","TAG_REJECT","TAG_HANDLE","TAG_PRESERVE","wrapper","tagField","valueField","memoize","out","item","items","pair","MapKey","prototype","hasOwnProperty","call","allowedTags","allowed","handlers","tagHandlers","short","location","TagLocation","at","Location","where","line","column","Error","code","Array","isArray","range","pos","linePos","offset","col","fallback","lineStart","lastIndexOf","prefix","matchAll","match","index","visit","_key","NodeKind","anchor"],"mappings":";;;;AAaA,MAAMA,UAAU,GAAG,oBAAoB;AACvC,MAAMC,YAAY,GAAG,CAAA,EAAGD,UAAU,CAAA,YAAA,CAAc;AAChD,MAAME,cAAc,GAAG,CAAA,EAAGF,UAAU,CAAA,cAAA,CAAgB;AACpD,MAAMG,sBAAsB,GAAG,CAAA,EAAGH,UAAU,CAAA,sCAAA,CAAwC;AACpF,MAAMI,oBAAoB,GAAG,CAAA,EAAGJ,UAAU,CAAA,0CAAA,CAA4C;AAEtF,MAAMK,aAAa,GAAG,IAAIC,GAAG,CAAC,CAC1B,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAChE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,CAC5C,CAACC,GAAG,CAACC,IAAI,IAAI,CAAA,EAAGR,UAAU,GAAGQ,IAAI,CAAA,CAAE,CAAC,CAAC;AAEtC,SAASC,YAAYA,CAACC,GAAG,EACzB;AACI,EAAA,IAAI,OAAOA,GAAG,KAAK,QAAQ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_JSON = "json";
2
- const OUTPUT_PAYLOAD = "payload";
3
- const OUTPUT_RAW = "raw";
4
- const OUTPUT_DOCUMENT = "document";
5
- const TAG_PRESERVE = "preserve";
6
- const TAG_REJECT = "reject";
7
- const TAG_HANDLE = "handle";
8
- const DEFAULT_VALUES = Object.freeze({
9
- emit: OUTPUT_PAYLOAD,
10
- tagPolicy: TAG_PRESERVE,
11
- allowedTags: null,
12
- tagHandlers: Object.freeze({}),
13
- sourceName: null,
14
- maxAliasCount: 100,
15
- uniqueKeys: true,
16
- idField: "$yamlId",
17
- refField: "$yamlRef",
18
- valuesField: "$yamlValues",
19
- tagField: "$yamlTag",
20
- valueField: "$yamlValue"
21
- });
22
- const OPTION_KEYS = new Set(Object.keys(DEFAULT_VALUES));
23
- function hasOwn(value, key) {
24
- return Object.prototype.hasOwnProperty.call(value, key);
25
- }
26
- function defineMappingValue(target, key, value) {
27
- Object.defineProperty(target, key, {
28
- value,
29
- enumerable: true,
30
- configurable: true,
31
- writable: true
32
- });
33
- }
34
- function normalizeEmit(value, readerName) {
35
- if (value === OUTPUT_JSON || value === OUTPUT_PAYLOAD) return value;
36
- if (value === OUTPUT_RAW || value === OUTPUT_DOCUMENT) return value;
37
- throw new TypeError(`${readerName} unknown emit value "${value}"`);
38
- }
39
- function normalizeTagPolicy(value, readerName) {
40
- if (value === TAG_PRESERVE || value === TAG_REJECT || value === TAG_HANDLE) return value;
41
- throw new TypeError(`${readerName} unknown tagPolicy value "${value}"`);
42
- }
43
- function normalizeAllowedTags(value, readerName) {
44
- if (value === null || value === undefined) return null;
45
- if (!Array.isArray(value) && !(value instanceof Set)) {
46
- throw new TypeError(`${readerName} allowedTags must be an array, Set, or null`);
47
- }
48
- return [...value];
49
- }
50
- function normalizeTagHandlers(value, readerName) {
51
- if (value instanceof Map) {
52
- for (const [tag, handler] of value) {
53
- if (typeof handler !== "function") {
54
- throw new TypeError(`${readerName} tag handler "${tag}" must be a function`);
55
- }
56
- }
57
- return new Map(value);
58
- }
59
- if (!value || typeof value !== "object" || Array.isArray(value)) {
60
- throw new TypeError(`${readerName} tagHandlers must be an object or Map`);
61
- }
62
- for (const [tag, handler] of Object.entries(value)) {
63
- if (typeof handler !== "function") {
64
- throw new TypeError(`${readerName} tag handler "${tag}" must be a function`);
65
- }
66
- }
67
- return {
68
- ...value
69
- };
70
- }
71
- function normalizeField(value, name, readerName) {
72
- if (typeof value !== "string" || !value) {
73
- throw new TypeError(`${readerName} ${name} must be a non-empty string`);
74
- }
75
- return value;
76
- }
77
- function normalizeBoolean(value, name, readerName) {
78
- if (typeof value !== "boolean") throw new TypeError(`${readerName} ${name} must be a boolean`);
79
- return value;
80
- }
81
- function normalizeValues(base, options = {}, readerName = "CjsYamlFormat") {
82
- if (!options || typeof options !== "object" || Array.isArray(options)) {
83
- throw new TypeError(`${readerName} options must be an object`);
84
- }
85
- for (const key of Object.keys(options)) {
86
- if (!OPTION_KEYS.has(key)) throw new TypeError(`${readerName} unknown option "${key}"`);
87
- }
88
- const values = {
89
- ...base,
90
- allowedTags: base.allowedTags ? [...base.allowedTags] : null,
91
- tagHandlers: base.tagHandlers instanceof Map ? new Map(base.tagHandlers) : {
92
- ...base.tagHandlers
93
- }
94
- };
95
- if (hasOwn(options, "emit")) values.emit = normalizeEmit(options.emit, readerName);
96
- if (hasOwn(options, "tagPolicy")) values.tagPolicy = normalizeTagPolicy(options.tagPolicy, readerName);
97
- if (hasOwn(options, "allowedTags")) values.allowedTags = normalizeAllowedTags(options.allowedTags, readerName);
98
- if (hasOwn(options, "tagHandlers")) values.tagHandlers = normalizeTagHandlers(options.tagHandlers, readerName);
99
- if (hasOwn(options, "sourceName")) values.sourceName = options.sourceName == null ? null : String(options.sourceName);
100
- if (hasOwn(options, "maxAliasCount")) {
101
- if (!Number.isInteger(options.maxAliasCount) || options.maxAliasCount < 0) {
102
- throw new TypeError(`${readerName} maxAliasCount must be a non-negative integer`);
103
- }
104
- values.maxAliasCount = options.maxAliasCount;
105
- }
106
- if (hasOwn(options, "uniqueKeys")) {
107
- values.uniqueKeys = normalizeBoolean(options.uniqueKeys, "uniqueKeys", readerName);
108
- }
109
- for (const name of ["idField", "refField", "valuesField", "tagField", "valueField"]) {
110
- if (hasOwn(options, name)) values[name] = normalizeField(options[name], name, readerName);
111
- }
112
- return values;
113
- }
114
- function toJsonGraph(value, options) {
115
- const counts = new WeakMap();
116
- const traversed = new WeakSet();
117
- const count = node => {
118
- if (!node || typeof node !== "object") return;
119
- counts.set(node, (counts.get(node) || 0) + 1);
120
- if (traversed.has(node)) return;
121
- traversed.add(node);
122
- if (Array.isArray(node)) node.forEach(count);else Object.keys(node).forEach(key => count(node[key]));
123
- };
124
- count(value);
125
- const ids = new WeakMap();
126
- let nextId = 1;
127
- const encode = node => {
128
- if (node === null || typeof node !== "object") return node;
129
- if (ArrayBuffer.isView(node)) return Array.from(node, encode);
130
- if (node instanceof Date) return node.toISOString();
131
- const repeated = (counts.get(node) || 0) > 1;
132
- if (ids.has(node)) return {
133
- [options.refField]: ids.get(node)
134
- };
135
- let id = null;
136
- if (repeated) {
137
- id = nextId++;
138
- ids.set(node, id);
139
- }
140
- if (Array.isArray(node)) {
141
- const values = node.map(encode);
142
- return repeated ? {
143
- [options.idField]: id,
144
- [options.valuesField]: values
145
- } : values;
146
- }
147
- if (repeated && Object.prototype.hasOwnProperty.call(node, options.idField)) {
148
- throw new TypeError(`CjsYamlFormat cannot encode repeated mapping: reserved field "${options.idField}" already exists`);
149
- }
150
- const out = repeated ? {
151
- [options.idField]: id
152
- } : {};
153
- for (const key of Object.keys(node)) defineMappingValue(out, key, encode(node[key]));
154
- return out;
155
- };
156
- return encode(value);
157
- }
158
-
159
- export { DEFAULT_VALUES, OUTPUT_DOCUMENT, OUTPUT_JSON, OUTPUT_PAYLOAD, OUTPUT_RAW, TAG_HANDLE, TAG_PRESERVE, TAG_REJECT, normalizeValues, toJsonGraph };
160
- //# sourceMappingURL=helpers.js.map
1
+ const OUTPUT_JSON = "json";
2
+ const OUTPUT_PAYLOAD = "payload";
3
+ const OUTPUT_RAW = "raw";
4
+ const OUTPUT_DOCUMENT = "document";
5
+ const TAG_PRESERVE = "preserve";
6
+ const TAG_REJECT = "reject";
7
+ const TAG_HANDLE = "handle";
8
+ const DEFAULT_VALUES = Object.freeze({
9
+ emit: OUTPUT_PAYLOAD,
10
+ tagPolicy: TAG_PRESERVE,
11
+ allowedTags: null,
12
+ tagHandlers: Object.freeze({}),
13
+ sourceName: null,
14
+ maxAliasCount: 100,
15
+ uniqueKeys: true,
16
+ idField: "$yamlId",
17
+ refField: "$yamlRef",
18
+ valuesField: "$yamlValues",
19
+ tagField: "$yamlTag",
20
+ valueField: "$yamlValue"
21
+ });
22
+ const OPTION_KEYS = new Set(Object.keys(DEFAULT_VALUES));
23
+ function hasOwn(value, key) {
24
+ return Object.prototype.hasOwnProperty.call(value, key);
25
+ }
26
+ function defineMappingValue(target, key, value) {
27
+ Object.defineProperty(target, key, {
28
+ value,
29
+ enumerable: true,
30
+ configurable: true,
31
+ writable: true
32
+ });
33
+ }
34
+ function normalizeEmit(value, readerName) {
35
+ if (value === OUTPUT_JSON || value === OUTPUT_PAYLOAD) return value;
36
+ if (value === OUTPUT_RAW || value === OUTPUT_DOCUMENT) return value;
37
+ throw new TypeError(`${readerName} unknown emit value "${value}"`);
38
+ }
39
+ function normalizeTagPolicy(value, readerName) {
40
+ if (value === TAG_PRESERVE || value === TAG_REJECT || value === TAG_HANDLE) return value;
41
+ throw new TypeError(`${readerName} unknown tagPolicy value "${value}"`);
42
+ }
43
+ function normalizeAllowedTags(value, readerName) {
44
+ if (value === null || value === undefined) return null;
45
+ if (!Array.isArray(value) && !(value instanceof Set)) {
46
+ throw new TypeError(`${readerName} allowedTags must be an array, Set, or null`);
47
+ }
48
+ return [...value];
49
+ }
50
+ function normalizeTagHandlers(value, readerName) {
51
+ if (value instanceof Map) {
52
+ for (const [tag, handler] of value) {
53
+ if (typeof handler !== "function") {
54
+ throw new TypeError(`${readerName} tag handler "${tag}" must be a function`);
55
+ }
56
+ }
57
+ return new Map(value);
58
+ }
59
+ if (!value || typeof value !== "object" || Array.isArray(value)) {
60
+ throw new TypeError(`${readerName} tagHandlers must be an object or Map`);
61
+ }
62
+ for (const [tag, handler] of Object.entries(value)) {
63
+ if (typeof handler !== "function") {
64
+ throw new TypeError(`${readerName} tag handler "${tag}" must be a function`);
65
+ }
66
+ }
67
+ return {
68
+ ...value
69
+ };
70
+ }
71
+ function normalizeField(value, name, readerName) {
72
+ if (typeof value !== "string" || !value) {
73
+ throw new TypeError(`${readerName} ${name} must be a non-empty string`);
74
+ }
75
+ return value;
76
+ }
77
+ function normalizeBoolean(value, name, readerName) {
78
+ if (typeof value !== "boolean") throw new TypeError(`${readerName} ${name} must be a boolean`);
79
+ return value;
80
+ }
81
+ function normalizeValues(base, options = {}, readerName = "CjsYamlFormat") {
82
+ if (!options || typeof options !== "object" || Array.isArray(options)) {
83
+ throw new TypeError(`${readerName} options must be an object`);
84
+ }
85
+ for (const key of Object.keys(options)) {
86
+ if (!OPTION_KEYS.has(key)) throw new TypeError(`${readerName} unknown option "${key}"`);
87
+ }
88
+ const values = {
89
+ ...base,
90
+ allowedTags: base.allowedTags ? [...base.allowedTags] : null,
91
+ tagHandlers: base.tagHandlers instanceof Map ? new Map(base.tagHandlers) : {
92
+ ...base.tagHandlers
93
+ }
94
+ };
95
+ if (hasOwn(options, "emit")) values.emit = normalizeEmit(options.emit, readerName);
96
+ if (hasOwn(options, "tagPolicy")) values.tagPolicy = normalizeTagPolicy(options.tagPolicy, readerName);
97
+ if (hasOwn(options, "allowedTags")) values.allowedTags = normalizeAllowedTags(options.allowedTags, readerName);
98
+ if (hasOwn(options, "tagHandlers")) values.tagHandlers = normalizeTagHandlers(options.tagHandlers, readerName);
99
+ if (hasOwn(options, "sourceName")) values.sourceName = options.sourceName == null ? null : String(options.sourceName);
100
+ if (hasOwn(options, "maxAliasCount")) {
101
+ if (!Number.isInteger(options.maxAliasCount) || options.maxAliasCount < 0) {
102
+ throw new TypeError(`${readerName} maxAliasCount must be a non-negative integer`);
103
+ }
104
+ values.maxAliasCount = options.maxAliasCount;
105
+ }
106
+ if (hasOwn(options, "uniqueKeys")) {
107
+ values.uniqueKeys = normalizeBoolean(options.uniqueKeys, "uniqueKeys", readerName);
108
+ }
109
+ for (const name of ["idField", "refField", "valuesField", "tagField", "valueField"]) {
110
+ if (hasOwn(options, name)) values[name] = normalizeField(options[name], name, readerName);
111
+ }
112
+ return values;
113
+ }
114
+ function toJsonGraph(value, options) {
115
+ const counts = new WeakMap();
116
+ const traversed = new WeakSet();
117
+ const count = node => {
118
+ if (!node || typeof node !== "object") return;
119
+ counts.set(node, (counts.get(node) || 0) + 1);
120
+ if (traversed.has(node)) return;
121
+ traversed.add(node);
122
+ if (Array.isArray(node)) node.forEach(count);else Object.keys(node).forEach(key => count(node[key]));
123
+ };
124
+ count(value);
125
+ const ids = new WeakMap();
126
+ let nextId = 1;
127
+ const encode = node => {
128
+ if (node === null || typeof node !== "object") return node;
129
+ if (ArrayBuffer.isView(node)) return Array.from(node, encode);
130
+ if (node instanceof Date) return node.toISOString();
131
+ const repeated = (counts.get(node) || 0) > 1;
132
+ if (ids.has(node)) return {
133
+ [options.refField]: ids.get(node)
134
+ };
135
+ let id = null;
136
+ if (repeated) {
137
+ id = nextId++;
138
+ ids.set(node, id);
139
+ }
140
+ if (Array.isArray(node)) {
141
+ const values = node.map(encode);
142
+ return repeated ? {
143
+ [options.idField]: id,
144
+ [options.valuesField]: values
145
+ } : values;
146
+ }
147
+ if (repeated && Object.prototype.hasOwnProperty.call(node, options.idField)) {
148
+ throw new TypeError(`CjsYamlFormat cannot encode repeated mapping: reserved field "${options.idField}" already exists`);
149
+ }
150
+ const out = repeated ? {
151
+ [options.idField]: id
152
+ } : {};
153
+ for (const key of Object.keys(node)) defineMappingValue(out, key, encode(node[key]));
154
+ return out;
155
+ };
156
+ return encode(value);
157
+ }
158
+
159
+ export { DEFAULT_VALUES, OUTPUT_DOCUMENT, OUTPUT_JSON, OUTPUT_PAYLOAD, OUTPUT_RAW, TAG_HANDLE, TAG_PRESERVE, TAG_REJECT, normalizeValues, toJsonGraph };
160
+ //# sourceMappingURL=helpers.js.map
@@ -1,2 +1,2 @@
1
- export { CjsYamlFormat, CjsYamlFormat as default } from './CjsYamlFormat.js';
2
- //# sourceMappingURL=index.js.map
1
+ export { CjsYamlFormat, CjsYamlFormat as default } from './CjsYamlFormat.js';
2
+ //# sourceMappingURL=index.js.map
package/dist/index.js CHANGED
@@ -1,52 +1,48 @@
1
- export { CjsResourceState, isTerminalResourceState } from './resourceStates.js';
2
- export { getResourceExtension, normalizeResourceExtension, normalizeResourcePath } from './resourcePath.js';
3
- export { CjsResource } from './CjsResource.js';
4
- export { TriTextureRes } from './resources/TriTextureRes.js';
5
- export { TriGeometryRes } from './resources/TriGeometryRes.js';
6
- export { Tr2EffectRes } from './resources/Tr2EffectRes.js';
7
- export { Tr2ImageRes } from './resources/Tr2ImageRes.js';
8
- export { TriGrannyRes } from './resources/TriGrannyRes.js';
9
- export { Tr2GrannyStateRes } from './resources/Tr2GrannyStateRes.js';
10
- export { Tr2LightProfileRes } from './resources/Tr2LightProfileRes.js';
11
- export { CjsTextureArrayRes } from './texture/CjsTextureArrayRes.js';
12
- export { CjsTextureParameterProxy } from './texture/CjsTextureParameterProxy.js';
13
- export { AudioGeometryResData } from './generated/resources/AudioGeometryResData.js';
14
- export { CmfVertexReader } from './generated/resources/CmfVertexReader.js';
15
- export { GStateBindingCallbackData } from './generated/resources/GStateBindingCallbackData.js';
16
- export { MeshDecalData } from './generated/resources/MeshDecalData.js';
17
- export { MeshDecalLodData } from './generated/resources/MeshDecalLodData.js';
18
- export { Tr2AsyncSave } from './generated/resources/Tr2AsyncSave.js';
19
- export { Tr2CmfContents } from './generated/resources/Tr2CmfContents.js';
20
- export { Tr2GrannyIntersectionResult } from './generated/resources/Tr2GrannyIntersectionResult.js';
21
- export { Tr2LoadPrepareFence } from './generated/resources/Tr2LoadPrepareFence.js';
22
- export { Tr2MaterialArea } from './generated/resources/Tr2MaterialArea.js';
23
- export { Tr2MaterialMesh } from './generated/resources/Tr2MaterialMesh.js';
24
- export { Tr2MaterialRes } from './generated/resources/Tr2MaterialRes.js';
25
- export { Tr2ShaderPermutation } from './generated/resources/Tr2ShaderPermutation.js';
26
- export { Tr2TextureLodManager } from './generated/resources/Tr2TextureLodManager.js';
27
- export { Tr2TextureLodUpdateRequest } from './generated/resources/Tr2TextureLodUpdateRequest.js';
28
- export { Tr2TexturePackChannel } from './generated/resources/Tr2TexturePackChannel.js';
29
- export { Tr2TexturePipeline } from './generated/resources/Tr2TexturePipeline.js';
30
- export { Tr2TexturePipelineParams } from './generated/resources/Tr2TexturePipelineParams.js';
31
- export { Tr2TexturePipelineStepCompress } from './generated/resources/Tr2TexturePipelineStepCompress.js';
32
- export { Tr2TexturePipelineStepLimitSize } from './generated/resources/Tr2TexturePipelineStepLimitSize.js';
33
- export { Tr2TexturePipelineStepLoad } from './generated/resources/Tr2TexturePipelineStepLoad.js';
34
- export { Tr2TexturePipelineStepPack } from './generated/resources/Tr2TexturePipelineStepPack.js';
35
- export { TriGeometryResAreaData } from './generated/resources/TriGeometryResAreaData.js';
36
- export { TriGeometryResJointData } from './generated/resources/TriGeometryResJointData.js';
37
- export { TriGeometryResLodData } from './generated/resources/TriGeometryResLodData.js';
38
- export { TriGeometryResMeshData } from './generated/resources/TriGeometryResMeshData.js';
39
- export { TriGeometryResSkeletonData } from './generated/resources/TriGeometryResSkeletonData.js';
40
- export { TriJointBinding } from './generated/resources/TriJointBinding.js';
41
- export { TriMorphTargetGeometryConstants } from './generated/resources/TriMorphTargetGeometryConstants.js';
42
- export { TriRtGeometryConstants } from './generated/resources/TriRtGeometryConstants.js';
43
- export { GrannyDeprecationLevel, Tr2Lod } from './generated/resources/enums.js';
44
- export { CjsResourceProbe } from './format/CjsResourceProbe.js';
45
- export { ResourcePayloadType, ResourcePayloadValues, validateAudioPayload, validateRgbaPayload, validateTexturePayload, validateVideoPayload } from './format/payloadContract.js';
46
- export { CjsFormat, ValidateFormatContract } from './format/CjsFormat.js';
47
- export { CjsEventEmitter } from '@carbonenginejs/core-types/model';
48
- export { CjsMotherLode } from './CjsMotherLode.js';
49
- export { CjsFetchResourceSource, CjsMemoryResourceSource } from './CjsResourceSource.js';
50
- export { CjsResManQueue } from './CjsResManQueue.js';
51
- export { CjsResMan } from './CjsResMan.js';
52
- //# sourceMappingURL=index.js.map
1
+ export { CjsResourceState, isTerminalResourceState } from './resourceStates.js';
2
+ export { getResourceExtension, normalizeResourceExtension, normalizeResourcePath } from './resourcePath.js';
3
+ export { CjsResource } from './CjsResource.js';
4
+ export { TriTextureRes } from './resources/TriTextureRes.js';
5
+ export { TriGeometryRes } from './resources/TriGeometryRes.js';
6
+ export { Tr2EffectRes } from './resources/Tr2EffectRes.js';
7
+ export { Tr2ImageRes } from './resources/Tr2ImageRes.js';
8
+ export { TriGrannyRes } from './resources/TriGrannyRes.js';
9
+ export { Tr2GrannyStateRes } from './resources/Tr2GrannyStateRes.js';
10
+ export { Tr2LightProfileRes } from './resources/Tr2LightProfileRes.js';
11
+ export { Tr2TextureLodManager } from './resources/Tr2TextureLodManager.js';
12
+ export { Tr2TexturePipeline } from './resources/Tr2TexturePipeline.js';
13
+ export { AudioGeometryResData } from './resources/AudioGeometryResData.js';
14
+ export { GStateBindingCallbackData } from './resources/GStateBindingCallbackData.js';
15
+ export { MeshDecalData } from './resources/MeshDecalData.js';
16
+ export { MeshDecalLodData } from './resources/MeshDecalLodData.js';
17
+ export { Tr2GrannyIntersectionResult } from './resources/Tr2GrannyIntersectionResult.js';
18
+ export { Tr2MaterialArea } from './resources/Tr2MaterialArea.js';
19
+ export { Tr2MaterialMesh } from './resources/Tr2MaterialMesh.js';
20
+ export { Tr2MaterialRes } from './resources/Tr2MaterialRes.js';
21
+ export { Tr2ShaderPermutation } from './resources/Tr2ShaderPermutation.js';
22
+ export { Tr2TextureLodUpdateRequest } from './resources/Tr2TextureLodUpdateRequest.js';
23
+ export { Tr2TexturePackChannel } from './resources/Tr2TexturePackChannel.js';
24
+ export { Tr2TexturePipelineParams } from './resources/Tr2TexturePipelineParams.js';
25
+ export { Tr2TexturePipelineStepCompress } from './resources/Tr2TexturePipelineStepCompress.js';
26
+ export { Tr2TexturePipelineStepLimitSize } from './resources/Tr2TexturePipelineStepLimitSize.js';
27
+ export { Tr2TexturePipelineStepLoad } from './resources/Tr2TexturePipelineStepLoad.js';
28
+ export { Tr2TexturePipelineStepPack } from './resources/Tr2TexturePipelineStepPack.js';
29
+ export { TriGeometryResAreaData } from './resources/TriGeometryResAreaData.js';
30
+ export { TriGeometryResJointData } from './resources/TriGeometryResJointData.js';
31
+ export { TriGeometryResLodData } from './resources/TriGeometryResLodData.js';
32
+ export { TriGeometryResMeshData } from './resources/TriGeometryResMeshData.js';
33
+ export { TriGeometryResSkeletonData } from './resources/TriGeometryResSkeletonData.js';
34
+ export { TriJointBinding } from './resources/TriJointBinding.js';
35
+ export { TriMorphTargetGeometryConstants } from './resources/TriMorphTargetGeometryConstants.js';
36
+ export { TriRtGeometryConstants } from './resources/TriRtGeometryConstants.js';
37
+ export { GrannyDeprecationLevel, Tr2Lod } from './resources/enums.js';
38
+ export { CjsTextureArrayRes } from './texture/CjsTextureArrayRes.js';
39
+ export { CjsTextureParameterProxy } from './texture/CjsTextureParameterProxy.js';
40
+ export { CjsResourceProbe } from './format/CjsResourceProbe.js';
41
+ export { ResourcePayloadType, ResourcePayloadValues, validateAudioPayload, validateRgbaPayload, validateTexturePayload, validateVideoPayload } from './format/payloadContract.js';
42
+ export { CjsFormat, ValidateFormatContract } from './format/CjsFormat.js';
43
+ export { CjsEventEmitter } from '@carbonenginejs/core-types/model';
44
+ export { CjsMotherLode, getMotherLodeKey } from './CjsMotherLode.js';
45
+ export { CjsFetchResourceSource, CjsMemoryResourceSource } from './CjsResourceSource.js';
46
+ export { CjsResManQueue } from './CjsResManQueue.js';
47
+ export { CjsResMan } from './CjsResMan.js';
48
+ //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,18 +1,18 @@
1
- function normalizeResourcePath(value) {
2
- return String(value ?? "").trim().replace(/\\/g, "/").replace(/\/+/g, "/").toLowerCase();
3
- }
4
- function getResourceExtension(value) {
5
- const path = normalizeResourcePath(value);
6
- const queryIndex = path.search(/[?#]/u);
7
- const cleanPath = queryIndex === -1 ? path : path.slice(0, queryIndex);
8
- const slashIndex = cleanPath.lastIndexOf("/");
9
- const dotIndex = cleanPath.lastIndexOf(".");
10
- if (dotIndex === -1 || dotIndex < slashIndex) return "";
11
- return cleanPath.slice(dotIndex + 1);
12
- }
13
- function normalizeResourceExtension(value) {
14
- return String(value ?? "").trim().replace(/^\./u, "").toLowerCase();
15
- }
16
-
17
- export { getResourceExtension, normalizeResourceExtension, normalizeResourcePath };
18
- //# sourceMappingURL=resourcePath.js.map
1
+ function normalizeResourcePath(value) {
2
+ return String(value ?? "").trim().replace(/\\/g, "/").replace(/\/+/g, "/").toLowerCase();
3
+ }
4
+ function getResourceExtension(value) {
5
+ const path = normalizeResourcePath(value);
6
+ const queryIndex = path.search(/[?#]/u);
7
+ const cleanPath = queryIndex === -1 ? path : path.slice(0, queryIndex);
8
+ const slashIndex = cleanPath.lastIndexOf("/");
9
+ const dotIndex = cleanPath.lastIndexOf(".");
10
+ if (dotIndex === -1 || dotIndex < slashIndex) return "";
11
+ return cleanPath.slice(dotIndex + 1);
12
+ }
13
+ function normalizeResourceExtension(value) {
14
+ return String(value ?? "").trim().replace(/^\./u, "").toLowerCase();
15
+ }
16
+
17
+ export { getResourceExtension, normalizeResourceExtension, normalizeResourcePath };
18
+ //# sourceMappingURL=resourcePath.js.map