@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.
- package/FORMAT-PROVENANCE.md +135 -0
- package/LICENSE +21 -0
- package/NOTICE +29 -0
- package/README.md +241 -0
- package/dist/CjsMotherLode.js +56 -0
- package/dist/CjsMotherLode.js.map +1 -0
- package/dist/CjsResMan.js +740 -0
- package/dist/CjsResMan.js.map +1 -0
- package/dist/CjsResManQueue.js +214 -0
- package/dist/CjsResManQueue.js.map +1 -0
- package/dist/CjsResource.js +366 -0
- package/dist/CjsResource.js.map +1 -0
- package/dist/CjsResourceSource.js +59 -0
- package/dist/CjsResourceSource.js.map +1 -0
- package/dist/_virtual/_rollupPluginBabelHelpers.js +153 -0
- package/dist/_virtual/_rollupPluginBabelHelpers.js.map +1 -0
- package/dist/format/CjsFormat.js +178 -0
- package/dist/format/CjsFormat.js.map +1 -0
- package/dist/format/CjsResourceProbe.js +269 -0
- package/dist/format/CjsResourceProbe.js.map +1 -0
- package/dist/format/payloadContract.js +173 -0
- package/dist/format/payloadContract.js.map +1 -0
- package/dist/formats/black/CjsBlackFormat.js +272 -0
- package/dist/formats/black/CjsBlackFormat.js.map +1 -0
- package/dist/formats/black/core/CjsBlackBinaryReader.js +153 -0
- package/dist/formats/black/core/CjsBlackBinaryReader.js.map +1 -0
- package/dist/formats/black/core/CjsBlackPropertyReaders.js +382 -0
- package/dist/formats/black/core/CjsBlackPropertyReaders.js.map +1 -0
- package/dist/formats/black/core/CjsBlackReader.js +760 -0
- package/dist/formats/black/core/CjsBlackReader.js.map +1 -0
- package/dist/formats/black/core/CjsBlackSchemaRegistry.js +433 -0
- package/dist/formats/black/core/CjsBlackSchemaRegistry.js.map +1 -0
- package/dist/formats/black/core/black-schema-v1-2026-07-11.json.js +4 -0
- package/dist/formats/black/core/black-schema-v1-2026-07-11.json.js.map +1 -0
- package/dist/formats/black/core/blackConstants.js +7 -0
- package/dist/formats/black/core/blackConstants.js.map +1 -0
- package/dist/formats/black/core/blackDefinitions.js +10 -0
- package/dist/formats/black/core/blackDefinitions.js.map +1 -0
- package/dist/formats/black/core/blackEnums.js +6 -0
- package/dist/formats/black/core/blackEnums.js.map +1 -0
- package/dist/formats/black/core/blackSchema.js +3 -0
- package/dist/formats/black/core/blackSchema.js.map +1 -0
- package/dist/formats/black/core/blackVersion.js +22 -0
- package/dist/formats/black/core/blackVersion.js.map +1 -0
- package/dist/formats/black/core/helpers.js +182 -0
- package/dist/formats/black/core/helpers.js.map +1 -0
- package/dist/formats/black/core/schema.js +4 -0
- package/dist/formats/black/core/schema.js.map +1 -0
- package/dist/formats/black/index.js +2 -0
- package/dist/formats/black/index.js.map +1 -0
- package/dist/formats/bnk/CjsBnkFormat.js +245 -0
- package/dist/formats/bnk/CjsBnkFormat.js.map +1 -0
- package/dist/formats/bnk/core/helpers.js +354 -0
- package/dist/formats/bnk/core/helpers.js.map +1 -0
- package/dist/formats/bnk/core/soundbanksInfo.js +246 -0
- package/dist/formats/bnk/core/soundbanksInfo.js.map +1 -0
- package/dist/formats/bnk/index.js +3 -0
- package/dist/formats/bnk/index.js.map +1 -0
- package/dist/formats/cmf/CjsCmfFormat.js +491 -0
- package/dist/formats/cmf/CjsCmfFormat.js.map +1 -0
- package/dist/formats/cmf/core/binary.js +118 -0
- package/dist/formats/cmf/core/binary.js.map +1 -0
- package/dist/formats/cmf/core/buffers.js +233 -0
- package/dist/formats/cmf/core/buffers.js.map +1 -0
- package/dist/formats/cmf/core/constants.js +47 -0
- package/dist/formats/cmf/core/constants.js.map +1 -0
- package/dist/formats/cmf/core/gr2Anim.js +453 -0
- package/dist/formats/cmf/core/gr2Anim.js.map +1 -0
- package/dist/formats/cmf/core/helpers.js +287 -0
- package/dist/formats/cmf/core/helpers.js.map +1 -0
- package/dist/formats/cmf/core/pack.js +276 -0
- package/dist/formats/cmf/core/pack.js.map +1 -0
- package/dist/formats/cmf/core/schema.js +364 -0
- package/dist/formats/cmf/core/schema.js.map +1 -0
- package/dist/formats/cmf/core/shared.js +268 -0
- package/dist/formats/cmf/core/shared.js.map +1 -0
- package/dist/formats/cmf/core/writer.js +517 -0
- package/dist/formats/cmf/core/writer.js.map +1 -0
- package/dist/formats/cmf/index.js +2 -0
- package/dist/formats/cmf/index.js.map +1 -0
- package/dist/formats/dds/CjsDdsFormat.js +187 -0
- package/dist/formats/dds/CjsDdsFormat.js.map +1 -0
- package/dist/formats/dds/core/helpers.js +812 -0
- package/dist/formats/dds/core/helpers.js.map +1 -0
- package/dist/formats/dds/index.js +2 -0
- package/dist/formats/dds/index.js.map +1 -0
- package/dist/formats/fbx/CjsFbxFormat.js +260 -0
- package/dist/formats/fbx/CjsFbxFormat.js.map +1 -0
- package/dist/formats/fbx/core/helpers.js +3901 -0
- package/dist/formats/fbx/core/helpers.js.map +1 -0
- package/dist/formats/fbx/index.js +2 -0
- package/dist/formats/fbx/index.js.map +1 -0
- package/dist/formats/flac/CjsFlacFormat.js +81 -0
- package/dist/formats/flac/CjsFlacFormat.js.map +1 -0
- package/dist/formats/flac/core/helpers.js +295 -0
- package/dist/formats/flac/core/helpers.js.map +1 -0
- package/dist/formats/flac/index.js +2 -0
- package/dist/formats/flac/index.js.map +1 -0
- package/dist/formats/gif/CjsGifFormat.js +81 -0
- package/dist/formats/gif/CjsGifFormat.js.map +1 -0
- package/dist/formats/gif/core/helpers.js +360 -0
- package/dist/formats/gif/core/helpers.js.map +1 -0
- package/dist/formats/gif/index.js +2 -0
- package/dist/formats/gif/index.js.map +1 -0
- package/dist/formats/gltf/CjsGltfFormat.js +284 -0
- package/dist/formats/gltf/CjsGltfFormat.js.map +1 -0
- package/dist/formats/gltf/core/helpers.js +292 -0
- package/dist/formats/gltf/core/helpers.js.map +1 -0
- package/dist/formats/gltf/core/json.js +79 -0
- package/dist/formats/gltf/core/json.js.map +1 -0
- package/dist/formats/gltf/core/parser.js +666 -0
- package/dist/formats/gltf/core/parser.js.map +1 -0
- package/dist/formats/gltf/core/targets.js +163 -0
- package/dist/formats/gltf/core/targets.js.map +1 -0
- package/dist/formats/gltf/index.js +2 -0
- package/dist/formats/gltf/index.js.map +1 -0
- package/dist/formats/index.js +23 -0
- package/dist/formats/index.js.map +1 -0
- package/dist/formats/jpeg/CjsJpegFormat.js +200 -0
- package/dist/formats/jpeg/CjsJpegFormat.js.map +1 -0
- package/dist/formats/jpeg/core/helpers.js +350 -0
- package/dist/formats/jpeg/core/helpers.js.map +1 -0
- package/dist/formats/jpeg/core/jpeg.js +377 -0
- package/dist/formats/jpeg/core/jpeg.js.map +1 -0
- package/dist/formats/jpeg/index.js +2 -0
- package/dist/formats/jpeg/index.js.map +1 -0
- package/dist/formats/mp3/CjsMp3Format.js +186 -0
- package/dist/formats/mp3/CjsMp3Format.js.map +1 -0
- package/dist/formats/mp3/core/helpers.js +338 -0
- package/dist/formats/mp3/core/helpers.js.map +1 -0
- package/dist/formats/mp3/index.js +2 -0
- package/dist/formats/mp3/index.js.map +1 -0
- package/dist/formats/mp4/CjsMp4Format.js +185 -0
- package/dist/formats/mp4/CjsMp4Format.js.map +1 -0
- package/dist/formats/mp4/core/helpers.js +449 -0
- package/dist/formats/mp4/core/helpers.js.map +1 -0
- package/dist/formats/mp4/index.js +2 -0
- package/dist/formats/mp4/index.js.map +1 -0
- package/dist/formats/obj/CjsObjFormat.js +247 -0
- package/dist/formats/obj/CjsObjFormat.js.map +1 -0
- package/dist/formats/obj/core/helpers.js +573 -0
- package/dist/formats/obj/core/helpers.js.map +1 -0
- package/dist/formats/obj/core/json.js +64 -0
- package/dist/formats/obj/core/json.js.map +1 -0
- package/dist/formats/obj/core/parser.js +321 -0
- package/dist/formats/obj/core/parser.js.map +1 -0
- package/dist/formats/obj/index.js +2 -0
- package/dist/formats/obj/index.js.map +1 -0
- package/dist/formats/ogg/CjsOggFormat.js +82 -0
- package/dist/formats/ogg/CjsOggFormat.js.map +1 -0
- package/dist/formats/ogg/core/helpers.js +387 -0
- package/dist/formats/ogg/core/helpers.js.map +1 -0
- package/dist/formats/ogg/core/imdct.js +178 -0
- package/dist/formats/ogg/core/imdct.js.map +1 -0
- package/dist/formats/ogg/core/vorbis.js +999 -0
- package/dist/formats/ogg/core/vorbis.js.map +1 -0
- package/dist/formats/ogg/index.js +2 -0
- package/dist/formats/ogg/index.js.map +1 -0
- package/dist/formats/png/CjsPngFormat.js +189 -0
- package/dist/formats/png/CjsPngFormat.js.map +1 -0
- package/dist/formats/png/core/helpers.js +583 -0
- package/dist/formats/png/core/helpers.js.map +1 -0
- package/dist/formats/png/index.js +2 -0
- package/dist/formats/png/index.js.map +1 -0
- package/dist/formats/red/CjsRedFormat.js +247 -0
- package/dist/formats/red/CjsRedFormat.js.map +1 -0
- package/dist/formats/red/core/CjsRedReader.js +201 -0
- package/dist/formats/red/core/CjsRedReader.js.map +1 -0
- package/dist/formats/red/core/blackDefinitions.js +3 -0
- package/dist/formats/red/core/blackDefinitions.js.map +1 -0
- package/dist/formats/red/core/helpers.js +136 -0
- package/dist/formats/red/core/helpers.js.map +1 -0
- package/dist/formats/red/core/redGraph.js +68 -0
- package/dist/formats/red/core/redGraph.js.map +1 -0
- package/dist/formats/red/core/schema.js +4 -0
- package/dist/formats/red/core/schema.js.map +1 -0
- package/dist/formats/red/index.js +2 -0
- package/dist/formats/red/index.js.map +1 -0
- package/dist/formats/stl/CjsStlFormat.js +304 -0
- package/dist/formats/stl/CjsStlFormat.js.map +1 -0
- package/dist/formats/stl/core/helpers.js +257 -0
- package/dist/formats/stl/core/helpers.js.map +1 -0
- package/dist/formats/stl/core/json.js +51 -0
- package/dist/formats/stl/core/json.js.map +1 -0
- package/dist/formats/stl/core/stl.js +544 -0
- package/dist/formats/stl/core/stl.js.map +1 -0
- package/dist/formats/stl/core/targets.js +163 -0
- package/dist/formats/stl/core/targets.js.map +1 -0
- package/dist/formats/stl/index.js +2 -0
- package/dist/formats/stl/index.js.map +1 -0
- package/dist/formats/tga/CjsTgaFormat.js +186 -0
- package/dist/formats/tga/CjsTgaFormat.js.map +1 -0
- package/dist/formats/tga/core/helpers.js +446 -0
- package/dist/formats/tga/core/helpers.js.map +1 -0
- package/dist/formats/tga/index.js +2 -0
- package/dist/formats/tga/index.js.map +1 -0
- package/dist/formats/wav/CjsWavFormat.js +186 -0
- package/dist/formats/wav/CjsWavFormat.js.map +1 -0
- package/dist/formats/wav/core/helpers.js +328 -0
- package/dist/formats/wav/core/helpers.js.map +1 -0
- package/dist/formats/wav/index.js +2 -0
- package/dist/formats/wav/index.js.map +1 -0
- package/dist/formats/webm/CjsWebmFormat.js +185 -0
- package/dist/formats/webm/CjsWebmFormat.js.map +1 -0
- package/dist/formats/webm/core/helpers.js +537 -0
- package/dist/formats/webm/core/helpers.js.map +1 -0
- package/dist/formats/webm/index.js +2 -0
- package/dist/formats/webm/index.js.map +1 -0
- package/dist/formats/webp/CjsWebpFormat.js +80 -0
- package/dist/formats/webp/CjsWebpFormat.js.map +1 -0
- package/dist/formats/webp/core/helpers.js +214 -0
- package/dist/formats/webp/core/helpers.js.map +1 -0
- package/dist/formats/webp/index.js +2 -0
- package/dist/formats/webp/index.js.map +1 -0
- package/dist/formats/wem/CjsWemFormat.js +197 -0
- package/dist/formats/wem/CjsWemFormat.js.map +1 -0
- package/dist/formats/wem/core/bitStream.js +259 -0
- package/dist/formats/wem/core/bitStream.js.map +1 -0
- package/dist/formats/wem/core/codebookLibrary.js +164 -0
- package/dist/formats/wem/core/codebookLibrary.js.map +1 -0
- package/dist/formats/wem/core/helpers.js +336 -0
- package/dist/formats/wem/core/helpers.js.map +1 -0
- package/dist/formats/wem/core/packedCodebooksAotuv603.js +30 -0
- package/dist/formats/wem/core/packedCodebooksAotuv603.js.map +1 -0
- package/dist/formats/wem/core/wemToOgg.js +485 -0
- package/dist/formats/wem/core/wemToOgg.js.map +1 -0
- package/dist/formats/wem/index.js +2 -0
- package/dist/formats/wem/index.js.map +1 -0
- package/dist/formats/yaml/CjsYamlFormat.js +77 -0
- package/dist/formats/yaml/CjsYamlFormat.js.map +1 -0
- package/dist/formats/yaml/core/CjsYamlReader.js +304 -0
- package/dist/formats/yaml/core/CjsYamlReader.js.map +1 -0
- package/dist/formats/yaml/core/helpers.js +160 -0
- package/dist/formats/yaml/core/helpers.js.map +1 -0
- package/dist/formats/yaml/index.js +2 -0
- package/dist/formats/yaml/index.js.map +1 -0
- package/dist/generated/resources/AudioGeometryResData.js +47 -0
- package/dist/generated/resources/AudioGeometryResData.js.map +1 -0
- package/dist/generated/resources/CmfVertexReader.js +46 -0
- package/dist/generated/resources/CmfVertexReader.js.map +1 -0
- package/dist/generated/resources/GStateBindingCallbackData.js +31 -0
- package/dist/generated/resources/GStateBindingCallbackData.js.map +1 -0
- package/dist/generated/resources/MeshDecalData.js +37 -0
- package/dist/generated/resources/MeshDecalData.js.map +1 -0
- package/dist/generated/resources/MeshDecalLodData.js +34 -0
- package/dist/generated/resources/MeshDecalLodData.js.map +1 -0
- package/dist/generated/resources/Tr2AsyncSave.js +46 -0
- package/dist/generated/resources/Tr2AsyncSave.js.map +1 -0
- package/dist/generated/resources/Tr2CmfContents.js +37 -0
- package/dist/generated/resources/Tr2CmfContents.js.map +1 -0
- package/dist/generated/resources/Tr2GrannyIntersectionResult.js +58 -0
- package/dist/generated/resources/Tr2GrannyIntersectionResult.js.map +1 -0
- package/dist/generated/resources/Tr2LoadPrepareFence.js +37 -0
- package/dist/generated/resources/Tr2LoadPrepareFence.js.map +1 -0
- package/dist/generated/resources/Tr2MaterialArea.js +34 -0
- package/dist/generated/resources/Tr2MaterialArea.js.map +1 -0
- package/dist/generated/resources/Tr2MaterialMesh.js +31 -0
- package/dist/generated/resources/Tr2MaterialMesh.js.map +1 -0
- package/dist/generated/resources/Tr2MaterialRes.js +34 -0
- package/dist/generated/resources/Tr2MaterialRes.js.map +1 -0
- package/dist/generated/resources/Tr2ShaderPermutation.js +43 -0
- package/dist/generated/resources/Tr2ShaderPermutation.js.map +1 -0
- package/dist/generated/resources/Tr2TextureLodManager.js +60 -0
- package/dist/generated/resources/Tr2TextureLodManager.js.map +1 -0
- package/dist/generated/resources/Tr2TextureLodUpdateRequest.js +37 -0
- package/dist/generated/resources/Tr2TextureLodUpdateRequest.js.map +1 -0
- package/dist/generated/resources/Tr2TexturePackChannel.js +37 -0
- package/dist/generated/resources/Tr2TexturePackChannel.js.map +1 -0
- package/dist/generated/resources/Tr2TexturePipeline.js +44 -0
- package/dist/generated/resources/Tr2TexturePipeline.js.map +1 -0
- package/dist/generated/resources/Tr2TexturePipelineParams.js +34 -0
- package/dist/generated/resources/Tr2TexturePipelineParams.js.map +1 -0
- package/dist/generated/resources/Tr2TexturePipelineStepCompress.js +40 -0
- package/dist/generated/resources/Tr2TexturePipelineStepCompress.js.map +1 -0
- package/dist/generated/resources/Tr2TexturePipelineStepLimitSize.js +34 -0
- package/dist/generated/resources/Tr2TexturePipelineStepLimitSize.js.map +1 -0
- package/dist/generated/resources/Tr2TexturePipelineStepLoad.js +31 -0
- package/dist/generated/resources/Tr2TexturePipelineStepLoad.js.map +1 -0
- package/dist/generated/resources/Tr2TexturePipelineStepPack.js +43 -0
- package/dist/generated/resources/Tr2TexturePipelineStepPack.js.map +1 -0
- package/dist/generated/resources/TriGeometryResAreaData.js +59 -0
- package/dist/generated/resources/TriGeometryResAreaData.js.map +1 -0
- package/dist/generated/resources/TriGeometryResJointData.js +38 -0
- package/dist/generated/resources/TriGeometryResJointData.js.map +1 -0
- package/dist/generated/resources/TriGeometryResLodData.js +88 -0
- package/dist/generated/resources/TriGeometryResLodData.js.map +1 -0
- package/dist/generated/resources/TriGeometryResMeshData.js +63 -0
- package/dist/generated/resources/TriGeometryResMeshData.js.map +1 -0
- package/dist/generated/resources/TriGeometryResSkeletonData.js +34 -0
- package/dist/generated/resources/TriGeometryResSkeletonData.js.map +1 -0
- package/dist/generated/resources/TriJointBinding.js +38 -0
- package/dist/generated/resources/TriJointBinding.js.map +1 -0
- package/dist/generated/resources/TriMorphTargetGeometryConstants.js +46 -0
- package/dist/generated/resources/TriMorphTargetGeometryConstants.js.map +1 -0
- package/dist/generated/resources/TriRtGeometryConstants.js +88 -0
- package/dist/generated/resources/TriRtGeometryConstants.js.map +1 -0
- package/dist/generated/resources/enums.js +18 -0
- package/dist/generated/resources/enums.js.map +1 -0
- package/dist/generated/resources/index.js +32 -0
- package/dist/generated/resources/index.js.map +1 -0
- package/dist/index.js +52 -0
- package/dist/index.js.map +1 -0
- package/dist/resourcePath.js +18 -0
- package/dist/resourcePath.js.map +1 -0
- package/dist/resourceStates.js +9 -0
- package/dist/resourceStates.js.map +1 -0
- package/dist/resources/Tr2EffectRes.js +71 -0
- package/dist/resources/Tr2EffectRes.js.map +1 -0
- package/dist/resources/Tr2GrannyStateRes.js +44 -0
- package/dist/resources/Tr2GrannyStateRes.js.map +1 -0
- package/dist/resources/Tr2ImageRes.js +114 -0
- package/dist/resources/Tr2ImageRes.js.map +1 -0
- package/dist/resources/Tr2LightProfileRes.js +40 -0
- package/dist/resources/Tr2LightProfileRes.js.map +1 -0
- package/dist/resources/TriGeometryRes.js +216 -0
- package/dist/resources/TriGeometryRes.js.map +1 -0
- package/dist/resources/TriGrannyRes.js +43 -0
- package/dist/resources/TriGrannyRes.js.map +1 -0
- package/dist/resources/TriTextureRes.js +304 -0
- package/dist/resources/TriTextureRes.js.map +1 -0
- package/dist/resources/resourceBoundary.js +47 -0
- package/dist/resources/resourceBoundary.js.map +1 -0
- package/dist/texture/CjsTextureArrayRes.js +406 -0
- package/dist/texture/CjsTextureArrayRes.js.map +1 -0
- package/dist/texture/CjsTextureParameterProxy.js +133 -0
- package/dist/texture/CjsTextureParameterProxy.js.map +1 -0
- package/format-notices/black/LICENSE +21 -0
- package/format-notices/black/NOTICE +47 -0
- package/format-notices/bnk/LICENSE +21 -0
- package/format-notices/bnk/NOTICE +17 -0
- package/format-notices/cmf/LICENSE +21 -0
- package/format-notices/cmf/NOTICE +36 -0
- package/format-notices/dds/LICENSE +21 -0
- package/format-notices/dds/NOTICE +14 -0
- package/format-notices/fbx/LICENSE +21 -0
- package/format-notices/fbx/NOTICE +14 -0
- package/format-notices/flac/LICENSE +21 -0
- package/format-notices/flac/NOTICE +14 -0
- package/format-notices/gif/LICENSE +21 -0
- package/format-notices/gif/NOTICE +14 -0
- package/format-notices/gltf/LICENSE +21 -0
- package/format-notices/gltf/NOTICE +27 -0
- package/format-notices/jpeg/LICENSE +21 -0
- package/format-notices/jpeg/NOTICE +14 -0
- package/format-notices/mp3/LICENSE +21 -0
- package/format-notices/mp3/NOTICE +14 -0
- package/format-notices/mp4/LICENSE +21 -0
- package/format-notices/mp4/NOTICE +14 -0
- package/format-notices/obj/LICENSE +21 -0
- package/format-notices/obj/NOTICE +26 -0
- package/format-notices/ogg/LICENSE +21 -0
- package/format-notices/ogg/NOTICE +28 -0
- package/format-notices/png/LICENSE +21 -0
- package/format-notices/png/NOTICE +14 -0
- package/format-notices/red/LICENSE +21 -0
- package/format-notices/red/NOTICE +31 -0
- package/format-notices/stl/LICENSE +21 -0
- package/format-notices/stl/NOTICE +21 -0
- package/format-notices/tga/LICENSE +21 -0
- package/format-notices/tga/NOTICE +14 -0
- package/format-notices/wav/LICENSE +21 -0
- package/format-notices/wav/NOTICE +14 -0
- package/format-notices/webm/LICENSE +21 -0
- package/format-notices/webm/NOTICE +14 -0
- package/format-notices/webp/LICENSE +21 -0
- package/format-notices/webp/NOTICE +14 -0
- package/format-notices/wem/LICENSE +57 -0
- package/format-notices/wem/NOTICE +33 -0
- package/format-notices/yaml/LICENSE +21 -0
- package/format-notices/yaml/NOTICE +44 -0
- package/package.json +51 -0
- package/resource-lifecycle.md +487 -0
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
import { identity as _identity, applyDecs2311 as _applyDecs2311 } from './_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
+
import { CjsEventEmitter } from '@carbonenginejs/core-types/model';
|
|
3
|
+
import { type, carbon, impl, CjsSchema } from '@carbonenginejs/core-types/schema';
|
|
4
|
+
import { normalizeResourcePath, getResourceExtension } from './resourcePath.js';
|
|
5
|
+
|
|
6
|
+
let _initProto, _initClass, _init_path, _init_extra_path, _init_ext, _init_extra_ext, _init_requirement, _init_extra_requirement, _init_state, _init_extra_state;
|
|
7
|
+
let _CjsResource;
|
|
8
|
+
new class extends _identity {
|
|
9
|
+
static [class CjsResource extends CjsEventEmitter {
|
|
10
|
+
static {
|
|
11
|
+
({
|
|
12
|
+
e: [_init_path, _init_extra_path, _init_ext, _init_extra_ext, _init_requirement, _init_extra_requirement, _init_state, _init_extra_state, _initProto],
|
|
13
|
+
c: [_CjsResource, _initClass]
|
|
14
|
+
} = _applyDecs2311(this, [type.define({
|
|
15
|
+
className: "CjsResource",
|
|
16
|
+
family: "resource"
|
|
17
|
+
})], [[[type, type.path], 16, "path"], [[type, type.string], 16, "ext"], [[type, type.string], 16, "requirement"], [[type, type.string], 16, "state"], [[carbon, carbon.method, impl, impl.adapted], 18, "Initialize"], [[carbon, carbon.method, impl, impl.adapted], 18, "GetPath"], [[carbon, carbon.method, impl, impl.adapted], 18, "GetExt"], [[carbon, carbon.method, impl, impl.adapted], 18, "IsLoading"], [[carbon, carbon.method, impl, impl.adapted], 18, "HasLoaded"], [[carbon, carbon.method, impl, impl.adapted], 18, "IsPrepared"], [[carbon, carbon.method, impl, impl.adapted], 18, "IsGood"], [[carbon, carbon.method, impl, impl.adapted], 18, "IsFailed"]], 0, void 0, CjsEventEmitter));
|
|
18
|
+
}
|
|
19
|
+
#payload = (_initProto(this), null);
|
|
20
|
+
path = _init_path(this, "");
|
|
21
|
+
ext = (_init_extra_path(this), _init_ext(this, ""));
|
|
22
|
+
requirement = (_init_extra_ext(this), _init_requirement(this, ""));
|
|
23
|
+
state = (_init_extra_requirement(this), _init_state(this, _CjsResource.State.EMPTY));
|
|
24
|
+
get isResource() {
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
constructor(values = null) {
|
|
28
|
+
super(), _init_extra_state(this);
|
|
29
|
+
Object.defineProperty(this, "__adapterResources", {
|
|
30
|
+
value: Object.create(null),
|
|
31
|
+
enumerable: false,
|
|
32
|
+
configurable: true,
|
|
33
|
+
writable: true
|
|
34
|
+
});
|
|
35
|
+
Object.defineProperty(this, "__objectLoader", {
|
|
36
|
+
value: null,
|
|
37
|
+
enumerable: false,
|
|
38
|
+
configurable: true,
|
|
39
|
+
writable: true
|
|
40
|
+
});
|
|
41
|
+
if (values) {
|
|
42
|
+
this.SetValues(values);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Apply resource identity or metadata values without model graph semantics.
|
|
48
|
+
*
|
|
49
|
+
* @param {object|null} values
|
|
50
|
+
* @returns {CjsResource}
|
|
51
|
+
*/
|
|
52
|
+
SetValues(values = null) {
|
|
53
|
+
if (!values || typeof values !== "object") return this;
|
|
54
|
+
const fields = CjsSchema.getSchema(this.constructor).fields;
|
|
55
|
+
for (const field of fields) {
|
|
56
|
+
if (Object.prototype.hasOwnProperty.call(values, field.name)) {
|
|
57
|
+
this[field.name] = values[field.name];
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return this;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Export resource identity and schema metadata. Runtime state is not a model
|
|
65
|
+
* graph node; graph fields normally persist only their resource path.
|
|
66
|
+
*
|
|
67
|
+
* @returns {object}
|
|
68
|
+
*/
|
|
69
|
+
GetValues() {
|
|
70
|
+
const result = {};
|
|
71
|
+
for (const field of CjsSchema.getSchema(this.constructor).fields) {
|
|
72
|
+
result[field.name] = this[field.name];
|
|
73
|
+
}
|
|
74
|
+
return result;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Initialize the resource identity from a path and optional extension.
|
|
79
|
+
*
|
|
80
|
+
* @param {string} path
|
|
81
|
+
* @param {string|null} ext
|
|
82
|
+
* @param {string|null} requirement
|
|
83
|
+
* @returns {CjsResource}
|
|
84
|
+
*/
|
|
85
|
+
Initialize(path, ext = null, requirement = "") {
|
|
86
|
+
this.path = normalizeResourcePath(path);
|
|
87
|
+
this.ext = ext ? String(ext).replace(/^\./u, "").toLowerCase() : getResourceExtension(this.path);
|
|
88
|
+
this.requirement = requirement === null || requirement === undefined ? "" : String(requirement).trim().toLowerCase();
|
|
89
|
+
this.state = _CjsResource.State.EMPTY;
|
|
90
|
+
this.error = null;
|
|
91
|
+
return this;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Get the normalized resource path.
|
|
96
|
+
*
|
|
97
|
+
* @returns {string}
|
|
98
|
+
*/
|
|
99
|
+
GetPath() {
|
|
100
|
+
return this.path;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Get the normalized resource extension.
|
|
105
|
+
*
|
|
106
|
+
* @returns {string}
|
|
107
|
+
*/
|
|
108
|
+
GetExt() {
|
|
109
|
+
return this.ext;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/** Return the semantic outcome requested from this source path. */
|
|
113
|
+
GetRequirement() {
|
|
114
|
+
return this.requirement;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Return true when the resource is currently loading.
|
|
119
|
+
*
|
|
120
|
+
* @returns {boolean}
|
|
121
|
+
*/
|
|
122
|
+
IsLoading() {
|
|
123
|
+
return this.state === _CjsResource.State.REQUESTED || this.state === _CjsResource.State.LOADING;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Return true when CPU resource payload data has been loaded.
|
|
128
|
+
*
|
|
129
|
+
* @returns {boolean}
|
|
130
|
+
*/
|
|
131
|
+
HasLoaded() {
|
|
132
|
+
return this.state === _CjsResource.State.LOADED || this.state === _CjsResource.State.PREPARING || this.state === _CjsResource.State.PREPARED;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Return true when preparation has completed or produced a good resource.
|
|
137
|
+
*
|
|
138
|
+
* @returns {boolean}
|
|
139
|
+
*/
|
|
140
|
+
IsPrepared() {
|
|
141
|
+
return this.state === _CjsResource.State.PREPARED;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Return true when preparation completed successfully.
|
|
146
|
+
*
|
|
147
|
+
* @returns {boolean}
|
|
148
|
+
*/
|
|
149
|
+
IsGood() {
|
|
150
|
+
return this.IsPrepared();
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Return true when preparation failed.
|
|
155
|
+
*
|
|
156
|
+
* @returns {boolean}
|
|
157
|
+
*/
|
|
158
|
+
IsFailed() {
|
|
159
|
+
return this.state === _CjsResource.State.FAILED;
|
|
160
|
+
}
|
|
161
|
+
SetState(state, ...details) {
|
|
162
|
+
if (!_CjsResource.IsValidState(state)) {
|
|
163
|
+
throw new TypeError(`Invalid CjsResource state: ${state}`);
|
|
164
|
+
}
|
|
165
|
+
const previous = this.state;
|
|
166
|
+
if (previous === state) return this;
|
|
167
|
+
this.state = state;
|
|
168
|
+
this.EmitEvent?.(state, this, ...details);
|
|
169
|
+
this.EmitEvent?.("statechange", this, state, previous);
|
|
170
|
+
return this;
|
|
171
|
+
}
|
|
172
|
+
MarkRequested() {
|
|
173
|
+
return this.SetState(_CjsResource.State.REQUESTED);
|
|
174
|
+
}
|
|
175
|
+
MarkLoading() {
|
|
176
|
+
return this.SetState(_CjsResource.State.LOADING);
|
|
177
|
+
}
|
|
178
|
+
MarkLoaded() {
|
|
179
|
+
return this.SetState(_CjsResource.State.LOADED);
|
|
180
|
+
}
|
|
181
|
+
MarkPreparing() {
|
|
182
|
+
return this.SetState(_CjsResource.State.PREPARING);
|
|
183
|
+
}
|
|
184
|
+
MarkPrepared() {
|
|
185
|
+
return this.SetState(_CjsResource.State.PREPARED);
|
|
186
|
+
}
|
|
187
|
+
MarkGood() {
|
|
188
|
+
return this.MarkPrepared();
|
|
189
|
+
}
|
|
190
|
+
SetError(error) {
|
|
191
|
+
this.error = error || null;
|
|
192
|
+
return this.SetState(_CjsResource.State.FAILED, this.error);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Store the plain CPU payload associated with this resource.
|
|
197
|
+
* Concrete resource classes validate the fields they require before calling
|
|
198
|
+
* this method.
|
|
199
|
+
*
|
|
200
|
+
* @param {*} payload
|
|
201
|
+
* @returns {CjsResource}
|
|
202
|
+
*/
|
|
203
|
+
SetPayload(payload = null) {
|
|
204
|
+
this.#payload = payload;
|
|
205
|
+
return this;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Read the plain CPU payload associated with this resource.
|
|
210
|
+
*
|
|
211
|
+
* @returns {*}
|
|
212
|
+
*/
|
|
213
|
+
GetPayload() {
|
|
214
|
+
return this.#payload;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Returns true when a payload has been explicitly assigned.
|
|
219
|
+
*
|
|
220
|
+
* @returns {boolean}
|
|
221
|
+
*/
|
|
222
|
+
HasPayload() {
|
|
223
|
+
return this.#payload !== null && this.#payload !== undefined;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Release the complete payload reference after consumers have retained the
|
|
228
|
+
* scalars and typed-array views they require.
|
|
229
|
+
*/
|
|
230
|
+
ReleasePayload() {
|
|
231
|
+
this.#payload = null;
|
|
232
|
+
return this;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Bind the manager-owned object operation for this shared resource handle.
|
|
237
|
+
*
|
|
238
|
+
* @param {Function|null} loader
|
|
239
|
+
* @returns {CjsResource}
|
|
240
|
+
*/
|
|
241
|
+
SetObjectLoader(loader = null) {
|
|
242
|
+
if (loader !== null && typeof loader !== "function") {
|
|
243
|
+
throw new TypeError("CjsResource.SetObjectLoader requires a function or null.");
|
|
244
|
+
}
|
|
245
|
+
this.__objectLoader = loader;
|
|
246
|
+
return this;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Return the manager-owned, deduplicated object operation.
|
|
251
|
+
*
|
|
252
|
+
* @param {object} options
|
|
253
|
+
* @returns {Promise<*>}
|
|
254
|
+
*/
|
|
255
|
+
GetObject(options = {}) {
|
|
256
|
+
if (!this.__objectLoader) {
|
|
257
|
+
const error = new Error(`Resource has no object loader: ${this.path}`);
|
|
258
|
+
error.code = "CJS_RESOURCE_LOADER_UNBOUND";
|
|
259
|
+
return Promise.reject(error);
|
|
260
|
+
}
|
|
261
|
+
return this.__objectLoader(options);
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* Promise-shaped readiness boundary for callers that already hold a resource.
|
|
266
|
+
*
|
|
267
|
+
* @param {object} options
|
|
268
|
+
* @returns {Promise<*>}
|
|
269
|
+
*/
|
|
270
|
+
Ready(options = {}) {
|
|
271
|
+
return this.GetObject(options);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* Attach an opaque engine-owned resource object.
|
|
276
|
+
*
|
|
277
|
+
* Runtime-resource stores this value but does not inspect GPU APIs.
|
|
278
|
+
*
|
|
279
|
+
* @param {string} key
|
|
280
|
+
* @param {*} value
|
|
281
|
+
* @returns {CjsResource}
|
|
282
|
+
*/
|
|
283
|
+
SetAdapterResource(key, value) {
|
|
284
|
+
if (!key) throw new TypeError("CjsResource.SetAdapterResource requires a key.");
|
|
285
|
+
this.__adapterResources[String(key)] = value;
|
|
286
|
+
return this;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* Get an opaque engine-owned resource object.
|
|
291
|
+
*
|
|
292
|
+
* @param {string} key
|
|
293
|
+
* @returns {*}
|
|
294
|
+
*/
|
|
295
|
+
GetAdapterResource(key) {
|
|
296
|
+
return this.__adapterResources[String(key)] ?? null;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Returns true when an adapter resource exists for the given key.
|
|
301
|
+
*
|
|
302
|
+
* @param {string} key
|
|
303
|
+
* @returns {boolean}
|
|
304
|
+
*/
|
|
305
|
+
HasAdapterResource(key) {
|
|
306
|
+
return Object.prototype.hasOwnProperty.call(this.__adapterResources, String(key));
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* Remove an adapter resource and optionally call its destroy/dispose method.
|
|
311
|
+
*
|
|
312
|
+
* @param {string} key
|
|
313
|
+
* @param {object} options
|
|
314
|
+
* @returns {CjsResource}
|
|
315
|
+
*/
|
|
316
|
+
DestroyAdapterResource(key, options = {}) {
|
|
317
|
+
const name = String(key);
|
|
318
|
+
const value = this.__adapterResources[name];
|
|
319
|
+
if (value && options.destroy !== false) {
|
|
320
|
+
DestroyAdapterValue(value);
|
|
321
|
+
}
|
|
322
|
+
delete this.__adapterResources[name];
|
|
323
|
+
return this;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* Remove all adapter resources and optionally call their destroy/dispose methods.
|
|
328
|
+
*
|
|
329
|
+
* @param {object} options
|
|
330
|
+
* @returns {CjsResource}
|
|
331
|
+
*/
|
|
332
|
+
DestroyAdapterResources(options = {}) {
|
|
333
|
+
for (const key of Object.keys(this.__adapterResources)) {
|
|
334
|
+
this.DestroyAdapterResource(key, options);
|
|
335
|
+
}
|
|
336
|
+
return this;
|
|
337
|
+
}
|
|
338
|
+
static IsValidState(state) {
|
|
339
|
+
return Object.values(_CjsResource.State).includes(state);
|
|
340
|
+
}
|
|
341
|
+
}];
|
|
342
|
+
State = Object.freeze({
|
|
343
|
+
EMPTY: "empty",
|
|
344
|
+
REQUESTED: "requested",
|
|
345
|
+
LOADING: "loading",
|
|
346
|
+
LOADED: "loaded",
|
|
347
|
+
PREPARING: "preparing",
|
|
348
|
+
PREPARED: "prepared",
|
|
349
|
+
FAILED: "failed",
|
|
350
|
+
UNLOADED: "unloaded",
|
|
351
|
+
PURGED: "purged"
|
|
352
|
+
});
|
|
353
|
+
constructor() {
|
|
354
|
+
super(_CjsResource), _initClass();
|
|
355
|
+
}
|
|
356
|
+
}();
|
|
357
|
+
function DestroyAdapterValue(value) {
|
|
358
|
+
if (!value || typeof value !== "object") return;
|
|
359
|
+
const destroy = value.Destroy || value.Dispose || value.destroy || value.dispose;
|
|
360
|
+
if (typeof destroy === "function") {
|
|
361
|
+
destroy.call(value);
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
export { _CjsResource as CjsResource };
|
|
366
|
+
//# sourceMappingURL=CjsResource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CjsResource.js","sources":["../../src/CjsResource.js"],"sourcesContent":["import { CjsEventEmitter } from \"@carbonenginejs/core-types/model\";\nimport { CjsSchema, carbon, impl, type } from \"@carbonenginejs/core-types/schema\";\nimport { getResourceExtension, normalizeResourcePath } from \"./resourcePath.js\";\n\n@type.define({ className: \"CjsResource\", family: \"resource\" })\n/**\n * ResMan-owned runtime resource.\n *\n * Resources are not model graph objects: BLACK/RED graphs persist resource\n * paths (including empty paths), while CjsResMan constructs, initializes,\n * caches, and hydrates the corresponding runtime resource instances.\n */\nexport class CjsResource extends CjsEventEmitter\n{\n #payload = null;\n\n @type.path\n path = \"\";\n\n @type.string\n ext = \"\";\n\n @type.string\n requirement = \"\";\n\n @type.string\n state = CjsResource.State.EMPTY;\n\n get isResource() {\n return true;\n }\n\n constructor(values = null) {\n super();\n Object.defineProperty(this, \"__adapterResources\", {\n value: Object.create(null),\n enumerable: false,\n configurable: true,\n writable: true\n });\n Object.defineProperty(this, \"__objectLoader\", {\n value: null,\n enumerable: false,\n configurable: true,\n writable: true\n });\n if (values)\n {\n this.SetValues(values);\n }\n }\n\n /**\n * Apply resource identity or metadata values without model graph semantics.\n *\n * @param {object|null} values\n * @returns {CjsResource}\n */\n SetValues(values = null) {\n if (!values || typeof values !== \"object\") return this;\n const fields = CjsSchema.getSchema(this.constructor).fields;\n for (const field of fields) {\n if (Object.prototype.hasOwnProperty.call(values, field.name)) {\n this[field.name] = values[field.name];\n }\n }\n return this;\n }\n\n /**\n * Export resource identity and schema metadata. Runtime state is not a model\n * graph node; graph fields normally persist only their resource path.\n *\n * @returns {object}\n */\n GetValues() {\n const result = {};\n for (const field of CjsSchema.getSchema(this.constructor).fields) {\n result[field.name] = this[field.name];\n }\n return result;\n }\n\n /**\n * Initialize the resource identity from a path and optional extension.\n *\n * @param {string} path\n * @param {string|null} ext\n * @param {string|null} requirement\n * @returns {CjsResource}\n */\n @carbon.method\n @impl.adapted\n Initialize(path, ext = null, requirement = \"\") {\n this.path = normalizeResourcePath(path);\n this.ext = ext ? String(ext).replace(/^\\./u, \"\").toLowerCase() : getResourceExtension(this.path);\n this.requirement = requirement === null || requirement === undefined\n ? \"\"\n : String(requirement).trim().toLowerCase();\n this.state = CjsResource.State.EMPTY;\n this.error = null;\n return this;\n }\n\n /**\n * Get the normalized resource path.\n *\n * @returns {string}\n */\n @carbon.method\n @impl.adapted\n GetPath() {\n return this.path;\n }\n\n /**\n * Get the normalized resource extension.\n *\n * @returns {string}\n */\n @carbon.method\n @impl.adapted\n GetExt() {\n return this.ext;\n }\n\n /** Return the semantic outcome requested from this source path. */\n GetRequirement() {\n return this.requirement;\n }\n\n /**\n * Return true when the resource is currently loading.\n *\n * @returns {boolean}\n */\n @carbon.method\n @impl.adapted\n IsLoading() {\n return this.state === CjsResource.State.REQUESTED || this.state === CjsResource.State.LOADING;\n }\n\n /**\n * Return true when CPU resource payload data has been loaded.\n *\n * @returns {boolean}\n */\n @carbon.method\n @impl.adapted\n HasLoaded() {\n return this.state === CjsResource.State.LOADED\n || this.state === CjsResource.State.PREPARING\n || this.state === CjsResource.State.PREPARED;\n }\n\n /**\n * Return true when preparation has completed or produced a good resource.\n *\n * @returns {boolean}\n */\n @carbon.method\n @impl.adapted\n IsPrepared() {\n return this.state === CjsResource.State.PREPARED;\n }\n\n /**\n * Return true when preparation completed successfully.\n *\n * @returns {boolean}\n */\n @carbon.method\n @impl.adapted\n IsGood() {\n return this.IsPrepared();\n }\n\n /**\n * Return true when preparation failed.\n *\n * @returns {boolean}\n */\n @carbon.method\n @impl.adapted\n IsFailed() {\n return this.state === CjsResource.State.FAILED;\n }\n\n SetState(state, ...details) {\n if (!CjsResource.IsValidState(state)) {\n throw new TypeError(`Invalid CjsResource state: ${state}`);\n }\n const previous = this.state;\n if (previous === state) return this;\n this.state = state;\n this.EmitEvent?.(state, this, ...details);\n this.EmitEvent?.(\"statechange\", this, state, previous);\n return this;\n }\n\n MarkRequested() {\n return this.SetState(CjsResource.State.REQUESTED);\n }\n\n MarkLoading() {\n return this.SetState(CjsResource.State.LOADING);\n }\n\n MarkLoaded() {\n return this.SetState(CjsResource.State.LOADED);\n }\n\n MarkPreparing() {\n return this.SetState(CjsResource.State.PREPARING);\n }\n\n MarkPrepared() {\n return this.SetState(CjsResource.State.PREPARED);\n }\n\n MarkGood() {\n return this.MarkPrepared();\n }\n\n SetError(error) {\n this.error = error || null;\n return this.SetState(CjsResource.State.FAILED, this.error);\n }\n\n /**\n * Store the plain CPU payload associated with this resource.\n * Concrete resource classes validate the fields they require before calling\n * this method.\n *\n * @param {*} payload\n * @returns {CjsResource}\n */\n SetPayload(payload = null) {\n this.#payload = payload;\n return this;\n }\n\n /**\n * Read the plain CPU payload associated with this resource.\n *\n * @returns {*}\n */\n GetPayload() {\n return this.#payload;\n }\n\n /**\n * Returns true when a payload has been explicitly assigned.\n *\n * @returns {boolean}\n */\n HasPayload() {\n return this.#payload !== null && this.#payload !== undefined;\n }\n\n /**\n * Release the complete payload reference after consumers have retained the\n * scalars and typed-array views they require.\n */\n ReleasePayload() {\n this.#payload = null;\n return this;\n }\n\n /**\n * Bind the manager-owned object operation for this shared resource handle.\n *\n * @param {Function|null} loader\n * @returns {CjsResource}\n */\n SetObjectLoader(loader = null)\n {\n if (loader !== null && typeof loader !== \"function\")\n {\n throw new TypeError(\"CjsResource.SetObjectLoader requires a function or null.\");\n }\n this.__objectLoader = loader;\n return this;\n }\n\n /**\n * Return the manager-owned, deduplicated object operation.\n *\n * @param {object} options\n * @returns {Promise<*>}\n */\n GetObject(options = {})\n {\n if (!this.__objectLoader)\n {\n const error = new Error(`Resource has no object loader: ${this.path}`);\n error.code = \"CJS_RESOURCE_LOADER_UNBOUND\";\n return Promise.reject(error);\n }\n return this.__objectLoader(options);\n }\n\n /**\n * Promise-shaped readiness boundary for callers that already hold a resource.\n *\n * @param {object} options\n * @returns {Promise<*>}\n */\n Ready(options = {})\n {\n return this.GetObject(options);\n }\n\n /**\n * Attach an opaque engine-owned resource object.\n *\n * Runtime-resource stores this value but does not inspect GPU APIs.\n *\n * @param {string} key\n * @param {*} value\n * @returns {CjsResource}\n */\n SetAdapterResource(key, value) {\n if (!key) throw new TypeError(\"CjsResource.SetAdapterResource requires a key.\");\n this.__adapterResources[String(key)] = value;\n return this;\n }\n\n /**\n * Get an opaque engine-owned resource object.\n *\n * @param {string} key\n * @returns {*}\n */\n GetAdapterResource(key) {\n return this.__adapterResources[String(key)] ?? null;\n }\n\n /**\n * Returns true when an adapter resource exists for the given key.\n *\n * @param {string} key\n * @returns {boolean}\n */\n HasAdapterResource(key) {\n return Object.prototype.hasOwnProperty.call(this.__adapterResources, String(key));\n }\n\n /**\n * Remove an adapter resource and optionally call its destroy/dispose method.\n *\n * @param {string} key\n * @param {object} options\n * @returns {CjsResource}\n */\n DestroyAdapterResource(key, options = {}) {\n const name = String(key);\n const value = this.__adapterResources[name];\n if (value && options.destroy !== false) {\n DestroyAdapterValue(value);\n }\n delete this.__adapterResources[name];\n return this;\n }\n\n /**\n * Remove all adapter resources and optionally call their destroy/dispose methods.\n *\n * @param {object} options\n * @returns {CjsResource}\n */\n DestroyAdapterResources(options = {}) {\n for (const key of Object.keys(this.__adapterResources)) {\n this.DestroyAdapterResource(key, options);\n }\n return this;\n }\n\n static State = Object.freeze({\n EMPTY: \"empty\",\n REQUESTED: \"requested\",\n LOADING: \"loading\",\n LOADED: \"loaded\",\n PREPARING: \"preparing\",\n PREPARED: \"prepared\",\n FAILED: \"failed\",\n UNLOADED: \"unloaded\",\n PURGED: \"purged\"\n });\n\n static IsValidState(state) {\n return Object.values(CjsResource.State).includes(state);\n }\n}\n\nfunction DestroyAdapterValue(value) {\n if (!value || typeof value !== \"object\") return;\n const destroy = value.Destroy || value.Dispose || value.destroy || value.dispose;\n if (typeof destroy === \"function\") {\n destroy.call(value);\n }\n}\n"],"names":["_CjsResource","_identity","CjsResource","CjsEventEmitter","e","_init_path","_init_extra_path","_init_ext","_init_extra_ext","_init_requirement","_init_extra_requirement","_init_state","_init_extra_state","_initProto","c","_initClass","_applyDecs","type","define","className","family","path","string","carbon","method","impl","adapted","ext","requirement","state","State","EMPTY","isResource","constructor","values","Object","defineProperty","value","create","enumerable","configurable","writable","SetValues","fields","CjsSchema","getSchema","field","prototype","hasOwnProperty","call","name","GetValues","result","Initialize","normalizeResourcePath","String","replace","toLowerCase","getResourceExtension","undefined","trim","error","GetPath","GetExt","GetRequirement","IsLoading","REQUESTED","LOADING","HasLoaded","LOADED","PREPARING","PREPARED","IsPrepared","IsGood","IsFailed","FAILED","SetState","details","IsValidState","TypeError","previous","EmitEvent","MarkRequested","MarkLoading","MarkLoaded","MarkPreparing","MarkPrepared","MarkGood","SetError","SetPayload","payload","GetPayload","HasPayload","ReleasePayload","SetObjectLoader","loader","__objectLoader","GetObject","options","Error","code","Promise","reject","Ready","SetAdapterResource","key","__adapterResources","GetAdapterResource","HasAdapterResource","DestroyAdapterResource","destroy","DestroyAdapterValue","DestroyAdapterResources","keys","includes","freeze","UNLOADED","PURGED","Destroy","Dispose","dispose"],"mappings":";;;;;;AAEgF,IAAAA;AAAA,IAAA,cAAAC,SAAA,CAAA;AAAA,EAAA,QAEhF,MAAAC,WAAA,SAQiCC,eAAe,CAChD;AAAA,IAAA;AAAA,MAAA,CAAA;AAAAC,QAAAA,CAAA,GAAAC,UAAA,EAAAC,gB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,CAACrF,KAAK,CAAC;AACzD,IAAA;GACD;AAfQC,EAAAA,KAAK,GAAGK,MAAM,CAACgF,MAAM,CAAC;AAC3BpF,IAAAA,KAAK,EAAE,OAAO;AACdmC,IAAAA,SAAS,EAAE,WAAW;AACtBC,IAAAA,OAAO,EAAE,SAAS;AAClBE,IAAAA,MAAM,EAAE,QAAQ;AAChBC,IAAAA,SAAS,EAAE,WAAW;AACtBC,IAAAA,QAAQ,EAAE,UAAU;AACpBI,IAAAA,MAAM,EAAE,QAAQ;AAChByC,IAAAA,QAAQ,EAAE,UAAU;AACpBC,IAAAA,MAAM,EAAE;AACV,GAAC,CAAC;EAACpF,WAAAA,GAAA;IAAA,KAAA,CAAAjC,YAAA,GAAAe,UAAA,EAAA;AAAA,EAAA;AAAA,CAAA,EAAA;AAOL,SAASgG,mBAAmBA,CAAC1E,KAAK,EAAE;AAClC,EAAA,IAAI,CAACA,KAAK,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;AACzC,EAAA,MAAMyE,OAAO,GAAGzE,KAAK,CAACiF,OAAO,IAAIjF,KAAK,CAACkF,OAAO,IAAIlF,KAAK,CAACyE,OAAO,IAAIzE,KAAK,CAACmF,OAAO;AAChF,EAAA,IAAI,OAAOV,OAAO,KAAK,UAAU,EAAE;AACjCA,IAAAA,OAAO,CAAC7D,IAAI,CAACZ,KAAK,CAAC;AACrB,EAAA;AACF;;;;"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { normalizeResourcePath } from './resourcePath.js';
|
|
2
|
+
|
|
3
|
+
class CjsMemoryResourceSource {
|
|
4
|
+
#records = new Map();
|
|
5
|
+
constructor(records = null) {
|
|
6
|
+
if (records) this.SetRecords(records);
|
|
7
|
+
}
|
|
8
|
+
Set(path, value) {
|
|
9
|
+
this.#records.set(normalizeResourcePath(path), value);
|
|
10
|
+
return this;
|
|
11
|
+
}
|
|
12
|
+
SetRecords(records) {
|
|
13
|
+
for (const [path, value] of Object.entries(records)) {
|
|
14
|
+
this.Set(path, value);
|
|
15
|
+
}
|
|
16
|
+
return this;
|
|
17
|
+
}
|
|
18
|
+
Has(path) {
|
|
19
|
+
return this.#records.has(normalizeResourcePath(path));
|
|
20
|
+
}
|
|
21
|
+
async Read(path) {
|
|
22
|
+
const key = normalizeResourcePath(path);
|
|
23
|
+
if (!this.#records.has(key)) {
|
|
24
|
+
const error = new Error(`Resource not found: ${key}`);
|
|
25
|
+
error.code = "CJS_RESOURCE_NOT_FOUND";
|
|
26
|
+
error.path = key;
|
|
27
|
+
throw error;
|
|
28
|
+
}
|
|
29
|
+
return this.#records.get(key);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
class CjsFetchResourceSource {
|
|
33
|
+
constructor(options = {}) {
|
|
34
|
+
this.baseUrl = options.baseUrl || "";
|
|
35
|
+
this.fetch = options.fetch || globalThis.fetch;
|
|
36
|
+
}
|
|
37
|
+
async Read(path, options = {}) {
|
|
38
|
+
if (typeof this.fetch !== "function") {
|
|
39
|
+
throw new TypeError("CjsFetchResourceSource requires a fetch implementation.");
|
|
40
|
+
}
|
|
41
|
+
const response = await this.fetch(this.ResolveUrl(path), options);
|
|
42
|
+
if (!response.ok) {
|
|
43
|
+
const error = new Error(`Resource fetch failed: ${response.status} ${response.statusText}`);
|
|
44
|
+
error.code = "CJS_RESOURCE_FETCH_FAILED";
|
|
45
|
+
error.path = normalizeResourcePath(path);
|
|
46
|
+
error.status = response.status;
|
|
47
|
+
throw error;
|
|
48
|
+
}
|
|
49
|
+
return response.arrayBuffer();
|
|
50
|
+
}
|
|
51
|
+
ResolveUrl(path) {
|
|
52
|
+
const normalized = normalizeResourcePath(path);
|
|
53
|
+
if (!this.baseUrl) return normalized;
|
|
54
|
+
return new URL(normalized, this.baseUrl).toString();
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export { CjsFetchResourceSource, CjsMemoryResourceSource };
|
|
59
|
+
//# sourceMappingURL=CjsResourceSource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CjsResourceSource.js","sources":["../../src/CjsResourceSource.js"],"sourcesContent":["import { normalizeResourcePath } from \"./resourcePath.js\";\n\nexport class CjsMemoryResourceSource\n{\n #records = new Map();\n\n constructor(records = null) {\n if (records) this.SetRecords(records);\n }\n\n Set(path, value) {\n this.#records.set(normalizeResourcePath(path), value);\n return this;\n }\n\n SetRecords(records) {\n for (const [path, value] of Object.entries(records)) {\n this.Set(path, value);\n }\n return this;\n }\n\n Has(path) {\n return this.#records.has(normalizeResourcePath(path));\n }\n\n async Read(path) {\n const key = normalizeResourcePath(path);\n if (!this.#records.has(key)) {\n const error = new Error(`Resource not found: ${key}`);\n error.code = \"CJS_RESOURCE_NOT_FOUND\";\n error.path = key;\n throw error;\n }\n return this.#records.get(key);\n }\n}\n\nexport class CjsFetchResourceSource\n{\n constructor(options = {}) {\n this.baseUrl = options.baseUrl || \"\";\n this.fetch = options.fetch || globalThis.fetch;\n }\n\n async Read(path, options = {}) {\n if (typeof this.fetch !== \"function\") {\n throw new TypeError(\"CjsFetchResourceSource requires a fetch implementation.\");\n }\n\n const response = await this.fetch(this.ResolveUrl(path), options);\n if (!response.ok) {\n const error = new Error(`Resource fetch failed: ${response.status} ${response.statusText}`);\n error.code = \"CJS_RESOURCE_FETCH_FAILED\";\n error.path = normalizeResourcePath(path);\n error.status = response.status;\n throw error;\n }\n\n return response.arrayBuffer();\n }\n\n ResolveUrl(path) {\n const normalized = normalizeResourcePath(path);\n if (!this.baseUrl) return normalized;\n return new URL(normalized, this.baseUrl).toString();\n }\n}\n"],"names":["CjsMemoryResourceSource","Map","constructor","records","SetRecords","Set","path","value","set","normalizeResourcePath","Object","entries","Has","has","Read","key","error","Error","code","get","CjsFetchResourceSource","options","baseUrl","fetch","globalThis","TypeError","response","ResolveUrl","ok","status","statusText","arrayBuffer","normalized","URL","toString"],"mappings":";;AAEO,MAAMA,uBAAuB,CACpC;AACE,EAAA,QAAQ,GAAG,IAAI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yDecs2311(e, t, n, r, o, i) {
|
|
2
|
+
var a,
|
|
3
|
+
c,
|
|
4
|
+
u,
|
|
5
|
+
s,
|
|
6
|
+
f,
|
|
7
|
+
l,
|
|
8
|
+
p,
|
|
9
|
+
d = Symbol.metadata || Symbol.for("Symbol.metadata"),
|
|
10
|
+
m = Object.defineProperty,
|
|
11
|
+
h = Object.create,
|
|
12
|
+
y = [h(null), h(null)],
|
|
13
|
+
v = t.length;
|
|
14
|
+
function g(t, n, r) {
|
|
15
|
+
return function (o, i) {
|
|
16
|
+
n && (i = o, o = e);
|
|
17
|
+
for (var a = 0; a < t.length; a++) i = t[a].apply(o, r ? [i] : []);
|
|
18
|
+
return r ? i : o;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
function b(e, t, n, r) {
|
|
22
|
+
if ("function" != typeof e && (r || void 0 !== e)) throw new TypeError(t + " must " + (n || "be") + " a function" + (r ? "" : " or undefined"));
|
|
23
|
+
return e;
|
|
24
|
+
}
|
|
25
|
+
function applyDec(e, t, n, r, o, i, u, s, f, l, p) {
|
|
26
|
+
function d(e) {
|
|
27
|
+
if (!p(e)) throw new TypeError("Attempted to access private element on non-instance");
|
|
28
|
+
}
|
|
29
|
+
var h = [].concat(t[0]),
|
|
30
|
+
v = t[3],
|
|
31
|
+
w = !u,
|
|
32
|
+
D = 1 === o,
|
|
33
|
+
S = 3 === o,
|
|
34
|
+
j = 4 === o,
|
|
35
|
+
E = 2 === o;
|
|
36
|
+
function I(t, n, r) {
|
|
37
|
+
return function (o, i) {
|
|
38
|
+
return n && (i = o, o = e), r && r(o), P[t].call(o, i);
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
if (!w) {
|
|
42
|
+
var P = {},
|
|
43
|
+
k = [],
|
|
44
|
+
F = S ? "get" : j || D ? "set" : "value";
|
|
45
|
+
if (f ? (l || D ? P = {
|
|
46
|
+
get: _setFunctionName(function () {
|
|
47
|
+
return v(this);
|
|
48
|
+
}, r, "get"),
|
|
49
|
+
set: function (e) {
|
|
50
|
+
t[4](this, e);
|
|
51
|
+
}
|
|
52
|
+
} : P[F] = v, l || _setFunctionName(P[F], r, E ? "" : F)) : l || (P = Object.getOwnPropertyDescriptor(e, r)), !l && !f) {
|
|
53
|
+
if ((c = y[+s][r]) && 7 !== (c ^ o)) throw Error("Decorating two elements with the same name (" + P[F].name + ") is not supported yet");
|
|
54
|
+
y[+s][r] = o < 3 ? 1 : o;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
for (var N = e, O = h.length - 1; O >= 0; O -= n ? 2 : 1) {
|
|
58
|
+
var T = b(h[O], "A decorator", "be", true),
|
|
59
|
+
z = n ? h[O - 1] : void 0,
|
|
60
|
+
A = {},
|
|
61
|
+
H = {
|
|
62
|
+
kind: ["field", "accessor", "method", "getter", "setter", "class"][o],
|
|
63
|
+
name: r,
|
|
64
|
+
metadata: a,
|
|
65
|
+
addInitializer: function (e, t) {
|
|
66
|
+
if (e.v) throw new TypeError("attempted to call addInitializer after decoration was finished");
|
|
67
|
+
b(t, "An initializer", "be", true), i.push(t);
|
|
68
|
+
}.bind(null, A)
|
|
69
|
+
};
|
|
70
|
+
if (w) c = T.call(z, N, H), A.v = 1, b(c, "class decorators", "return") && (N = c);else if (H.static = s, H.private = f, c = H.access = {
|
|
71
|
+
has: f ? p.bind() : function (e) {
|
|
72
|
+
return r in e;
|
|
73
|
+
}
|
|
74
|
+
}, j || (c.get = f ? E ? function (e) {
|
|
75
|
+
return d(e), P.value;
|
|
76
|
+
} : I("get", 0, d) : function (e) {
|
|
77
|
+
return e[r];
|
|
78
|
+
}), E || S || (c.set = f ? I("set", 0, d) : function (e, t) {
|
|
79
|
+
e[r] = t;
|
|
80
|
+
}), N = T.call(z, D ? {
|
|
81
|
+
get: P.get,
|
|
82
|
+
set: P.set
|
|
83
|
+
} : P[F], H), A.v = 1, D) {
|
|
84
|
+
if ("object" == typeof N && N) (c = b(N.get, "accessor.get")) && (P.get = c), (c = b(N.set, "accessor.set")) && (P.set = c), (c = b(N.init, "accessor.init")) && k.unshift(c);else if (void 0 !== N) throw new TypeError("accessor decorators must return an object with get, set, or init properties or undefined");
|
|
85
|
+
} else b(N, (l ? "field" : "method") + " decorators", "return") && (l ? k.unshift(N) : P[F] = N);
|
|
86
|
+
}
|
|
87
|
+
return o < 2 && u.push(g(k, s, 1), g(i, s, 0)), l || w || (f ? D ? u.splice(-1, 0, I("get", s), I("set", s)) : u.push(E ? P[F] : b.call.bind(P[F])) : m(e, r, P)), N;
|
|
88
|
+
}
|
|
89
|
+
function w(e) {
|
|
90
|
+
return m(e, d, {
|
|
91
|
+
configurable: true,
|
|
92
|
+
enumerable: true,
|
|
93
|
+
value: a
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
return void 0 !== i && (a = i[d]), a = h(null == a ? null : a), f = [], l = function (e) {
|
|
97
|
+
e && f.push(g(e));
|
|
98
|
+
}, p = function (t, r) {
|
|
99
|
+
for (var i = 0; i < n.length; i++) {
|
|
100
|
+
var a = n[i],
|
|
101
|
+
c = a[1],
|
|
102
|
+
l = 7 & c;
|
|
103
|
+
if ((8 & c) == t && !l == r) {
|
|
104
|
+
var p = a[2],
|
|
105
|
+
d = !!a[3],
|
|
106
|
+
m = 16 & c;
|
|
107
|
+
applyDec(t ? e : e.prototype, a, m, d ? "#" + p : _toPropertyKey(p), l, l < 2 ? [] : t ? s = s || [] : u = u || [], f, !!t, d, r, t && d ? function (t) {
|
|
108
|
+
return _checkInRHS(t) === e;
|
|
109
|
+
} : o);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}, p(8, 0), p(0, 0), p(8, 1), p(0, 1), l(u), l(s), c = f, v || w(e), {
|
|
113
|
+
e: c,
|
|
114
|
+
get c() {
|
|
115
|
+
var n = [];
|
|
116
|
+
return v && [w(e = applyDec(e, [t], r, e.name, 5, n)), g(n, 1)];
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
function _checkInRHS(e) {
|
|
121
|
+
if (Object(e) !== e) throw TypeError("right-hand side of 'in' should be an object, got " + (null !== e ? typeof e : "null"));
|
|
122
|
+
return e;
|
|
123
|
+
}
|
|
124
|
+
function _identity(t) {
|
|
125
|
+
return t;
|
|
126
|
+
}
|
|
127
|
+
function _setFunctionName(e, t, n) {
|
|
128
|
+
"symbol" == typeof t && (t = (t = t.description) ? "[" + t + "]" : "");
|
|
129
|
+
try {
|
|
130
|
+
Object.defineProperty(e, "name", {
|
|
131
|
+
configurable: !0,
|
|
132
|
+
value: n ? n + " " + t : t
|
|
133
|
+
});
|
|
134
|
+
} catch (e) {}
|
|
135
|
+
return e;
|
|
136
|
+
}
|
|
137
|
+
function _toPrimitive(t, r) {
|
|
138
|
+
if ("object" != typeof t || !t) return t;
|
|
139
|
+
var e = t[Symbol.toPrimitive];
|
|
140
|
+
if (void 0 !== e) {
|
|
141
|
+
var i = e.call(t, r);
|
|
142
|
+
if ("object" != typeof i) return i;
|
|
143
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
144
|
+
}
|
|
145
|
+
return ("string" === r ? String : Number)(t);
|
|
146
|
+
}
|
|
147
|
+
function _toPropertyKey(t) {
|
|
148
|
+
var i = _toPrimitive(t, "string");
|
|
149
|
+
return "symbol" == typeof i ? i : i + "";
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export { _applyDecs2311 as applyDecs2311, _checkInRHS as checkInRHS, _identity as identity, _setFunctionName as setFunctionName, _toPrimitive as toPrimitive, _toPropertyKey as toPropertyKey };
|
|
153
|
+
//# sourceMappingURL=_rollupPluginBabelHelpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_rollupPluginBabelHelpers.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|