@carbonenginejs/runtime-resource 0.20.0 → 0.22.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/NOTICE +6 -0
- package/dist/CjsResMan.js +1374 -1318
- package/dist/CjsResMan.js.map +1 -1
- package/dist/format/CjsFormat.js +393 -164
- package/dist/format/CjsFormat.js.map +1 -1
- package/dist/format/CjsFormatStore.js +315 -0
- package/dist/format/CjsFormatStore.js.map +1 -0
- package/dist/format/CjsResourceProbe.js +66 -234
- package/dist/format/CjsResourceProbe.js.map +1 -1
- package/dist/format/payloadContract.js +47 -6
- package/dist/format/payloadContract.js.map +1 -1
- package/dist/formats/black/CjsBlackFormat.js +23 -6
- package/dist/formats/black/CjsBlackFormat.js.map +1 -1
- package/dist/formats/bnk/CjsBnkFormat.js +122 -120
- package/dist/formats/bnk/CjsBnkFormat.js.map +1 -1
- package/dist/formats/bnk/core/helpers.js +5 -15
- package/dist/formats/bnk/core/helpers.js.map +1 -1
- package/dist/formats/cmf/CjsCmfFormat.js +31 -14
- package/dist/formats/cmf/CjsCmfFormat.js.map +1 -1
- package/dist/formats/dds/CjsDdsFormat.js +29 -19
- package/dist/formats/dds/CjsDdsFormat.js.map +1 -1
- package/dist/formats/dds/core/helpers.js +4 -5
- package/dist/formats/dds/core/helpers.js.map +1 -1
- package/dist/formats/dxbc/CjsDxbcFormat.js +15 -13
- package/dist/formats/dxbc/CjsDxbcFormat.js.map +1 -1
- package/dist/formats/fbx/CjsFbxFormat.js +27 -19
- package/dist/formats/fbx/CjsFbxFormat.js.map +1 -1
- package/dist/formats/fbx/core/helpers.js +4 -4
- package/dist/formats/fbx/core/helpers.js.map +1 -1
- package/dist/formats/flac/CjsFlacFormat.js +19 -17
- package/dist/formats/flac/CjsFlacFormat.js.map +1 -1
- package/dist/formats/flac/core/helpers.js +5 -11
- package/dist/formats/flac/core/helpers.js.map +1 -1
- package/dist/formats/fsd/32/CjsFsd32Format.js +55 -0
- package/dist/formats/fsd/32/CjsFsd32Format.js.map +1 -0
- package/dist/formats/fsd/32/index.js +2 -0
- package/dist/formats/fsd/32/index.js.map +1 -0
- package/dist/formats/fsd/64/CjsFsd64Format.js +119 -0
- package/dist/formats/fsd/64/CjsFsd64Format.js.map +1 -0
- package/dist/formats/fsd/64/core/CjsFsd64Binary.js +393 -0
- package/dist/formats/fsd/64/core/CjsFsd64Binary.js.map +1 -0
- package/dist/formats/fsd/64/core/CjsFsd64Reader.js +138 -0
- package/dist/formats/fsd/64/core/CjsFsd64Reader.js.map +1 -0
- package/dist/formats/fsd/64/core/CjsFsd64SchemaDecoder.js +389 -0
- package/dist/formats/fsd/64/core/CjsFsd64SchemaDecoder.js.map +1 -0
- package/dist/formats/fsd/64/core/CjsFsd64SchemaReader.js +43 -0
- package/dist/formats/fsd/64/core/CjsFsd64SchemaReader.js.map +1 -0
- package/dist/formats/fsd/64/core/fsd64Records.js +60 -0
- package/dist/formats/fsd/64/core/fsd64Records.js.map +1 -0
- package/dist/formats/fsd/64/index.js +7 -0
- package/dist/formats/fsd/64/index.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64ReaderSetCharacterStaticData.js +33 -0
- package/dist/formats/fsd/64/readers/CjsFsd64ReaderSetCharacterStaticData.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaAgentTypes.js +35 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaAgentTypes.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaAgentsInSpace.js +50 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaAgentsInSpace.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaAncestries.js +75 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaAncestries.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaArchetypes.js +57 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaArchetypes.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaAudioMetadata.js +201 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaAudioMetadata.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaBloodlines.js +73 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaBloodlines.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCategories.js +53 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCategories.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterAvatarBehaviors.js +44 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterAvatarBehaviors.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterColorLocations.js +38 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterColorLocations.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterColorNames.js +34 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterColorNames.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterModifierLocations.js +34 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterModifierLocations.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterPortraitResources.js +44 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterPortraitResources.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterResources.js +81 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterResources.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterSculptingLocations.js +34 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCharacterSculptingLocations.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCompressibleTypes.js +41 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCompressibleTypes.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaContrabandTypes.js +63 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaContrabandTypes.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaControlTowerResources.js +76 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaControlTowerResources.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCorporationActivities.js +38 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCorporationActivities.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCorporationRoleGroups.js +74 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCorporationRoleGroups.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCorporationRoles.js +59 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaCorporationRoles.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaDogmaAttributeCategories.js +46 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaDogmaAttributeCategories.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaDogmaAttributes.js +133 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaDogmaAttributes.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaDogmaEffects.js +236 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaDogmaEffects.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaDogmaUnits.js +60 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaDogmaUnits.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaDynamicItemAttributes.js +95 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaDynamicItemAttributes.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaEpicArcs.js +106 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaEpicArcs.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaExpertSystems.js +86 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaExpertSystems.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaFactions.js +117 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaFactions.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaGraphicIds.js +70 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaGraphicIds.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaGraphicMaterialSets.js +173 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaGraphicMaterialSets.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaGroups.js +77 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaGroups.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaIcons.js +62 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaIcons.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaMarketGroups.js +63 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaMarketGroups.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaMetaGroups.js +86 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaMetaGroups.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaNpcCorporationDivisions.js +72 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaNpcCorporationDivisions.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaNpcCorporations.js +326 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaNpcCorporations.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaPaperdolls.js +279 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaPaperdolls.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaRaces.js +64 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaRaces.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSchoolMap.js +40 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSchoolMap.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSchools.js +113 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSchools.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkillPlans.js +130 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkillPlans.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrComponentCategories.js +38 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrComponentCategories.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrComponentPointValues.js +45 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrComponentPointValues.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrComponentRarities.js +44 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrComponentRarities.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrComponents.js +163 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrComponents.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrSlotCategories.js +37 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrSlotCategories.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrSlotConfigurations.js +77 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrSlotConfigurations.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrSlotNames.js +37 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrSlotNames.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrSlots.js +74 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrSlots.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrTierThresholds.js +44 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaSkinrTierThresholds.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaStationOperations.js +120 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaStationOperations.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaStationServices.js +49 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaStationServices.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaTypeDogma.js +73 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaTypeDogma.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaTypeLists.js +122 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaTypeLists.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaTypeMaterials.js +83 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaTypeMaterials.js.map +1 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaTypes.js +194 -0
- package/dist/formats/fsd/64/readers/CjsFsd64SchemaTypes.js.map +1 -0
- package/dist/formats/fsd/64/readers/index.js +58 -0
- package/dist/formats/fsd/64/readers/index.js.map +1 -0
- package/dist/formats/fsd/CjsFsdFormat.js +62 -0
- package/dist/formats/fsd/CjsFsdFormat.js.map +1 -0
- package/dist/formats/fsd/index.js +9 -0
- package/dist/formats/fsd/index.js.map +1 -0
- package/dist/formats/gif/CjsGifFormat.js +26 -16
- package/dist/formats/gif/CjsGifFormat.js.map +1 -1
- package/dist/formats/gif/core/helpers.js +6 -18
- package/dist/formats/gif/core/helpers.js.map +1 -1
- package/dist/formats/gltf/CjsGltfFormat.js +25 -13
- package/dist/formats/gltf/CjsGltfFormat.js.map +1 -1
- package/dist/formats/gr2/CjsGr2Format.js +27 -6
- package/dist/formats/gr2/CjsGr2Format.js.map +1 -1
- package/dist/formats/hlsl/CjsHlslFormat.js +20 -16
- package/dist/formats/hlsl/CjsHlslFormat.js.map +1 -1
- package/dist/formats/hlsl/core/analysis.js +1 -1
- package/dist/formats/index.js +5 -0
- package/dist/formats/index.js.map +1 -1
- package/dist/formats/jpeg/CjsJpegFormat.js +26 -19
- package/dist/formats/jpeg/CjsJpegFormat.js.map +1 -1
- package/dist/formats/jpeg/core/helpers.js +6 -15
- package/dist/formats/jpeg/core/helpers.js.map +1 -1
- package/dist/formats/jpeg/core/jpeg.js +0 -3
- package/dist/formats/jpeg/core/jpeg.js.map +1 -1
- package/dist/formats/mp3/CjsMp3Format.js +19 -19
- package/dist/formats/mp3/CjsMp3Format.js.map +1 -1
- package/dist/formats/mp3/core/helpers.js +5 -11
- package/dist/formats/mp3/core/helpers.js.map +1 -1
- package/dist/formats/mp4/CjsMp4Format.js +20 -19
- package/dist/formats/mp4/CjsMp4Format.js.map +1 -1
- package/dist/formats/mp4/core/helpers.js +6 -15
- package/dist/formats/mp4/core/helpers.js.map +1 -1
- package/dist/formats/obj/CjsObjFormat.js +25 -12
- package/dist/formats/obj/CjsObjFormat.js.map +1 -1
- package/dist/formats/ogg/CjsOggFormat.js +26 -17
- package/dist/formats/ogg/CjsOggFormat.js.map +1 -1
- package/dist/formats/ogg/core/helpers.js +5 -16
- package/dist/formats/ogg/core/helpers.js.map +1 -1
- package/dist/formats/pickle/CjsPickleFormat.js +64 -5
- package/dist/formats/pickle/CjsPickleFormat.js.map +1 -1
- package/dist/formats/png/CjsPngFormat.js +28 -19
- package/dist/formats/png/CjsPngFormat.js.map +1 -1
- package/dist/formats/png/core/helpers.js +5 -14
- package/dist/formats/png/core/helpers.js.map +1 -1
- package/dist/formats/red/CjsRedFormat.js +19 -5
- package/dist/formats/red/CjsRedFormat.js.map +1 -1
- package/dist/formats/schemabound/CjsSchemaBoundFormat.js +48 -38
- package/dist/formats/schemabound/CjsSchemaBoundFormat.js.map +1 -1
- package/dist/formats/sqlite/CjsSqliteFormat.js +49 -41
- package/dist/formats/sqlite/CjsSqliteFormat.js.map +1 -1
- package/dist/formats/static/CjsStaticFormat.js +15 -57
- package/dist/formats/static/CjsStaticFormat.js.map +1 -1
- package/dist/formats/static/staticContainers.js +6 -6
- package/dist/formats/static/staticContainers.js.map +1 -1
- package/dist/formats/stl/CjsStlFormat.js +25 -12
- package/dist/formats/stl/CjsStlFormat.js.map +1 -1
- package/dist/formats/tga/CjsTgaFormat.js +26 -19
- package/dist/formats/tga/CjsTgaFormat.js.map +1 -1
- package/dist/formats/tga/core/helpers.js +7 -22
- package/dist/formats/tga/core/helpers.js.map +1 -1
- package/dist/formats/wav/CjsWavFormat.js +26 -19
- package/dist/formats/wav/CjsWavFormat.js.map +1 -1
- package/dist/formats/wav/core/helpers.js +7 -16
- package/dist/formats/wav/core/helpers.js.map +1 -1
- package/dist/formats/webgl/CjsWebglFormat.js +11 -13
- package/dist/formats/webgl/CjsWebglFormat.js.map +1 -1
- package/dist/formats/webgl/core/glsl/DxbcGlslEmitter.js +31 -1
- package/dist/formats/webgl/core/glsl/DxbcGlslEmitter.js.map +1 -1
- package/dist/formats/webgl/core/readGlslEffectContainer.js +8 -8
- package/dist/formats/webgl/core/readGlslEffectContainer.js.map +1 -1
- package/dist/formats/webgpu/CjsWebgpuFormat.js +11 -5
- package/dist/formats/webgpu/CjsWebgpuFormat.js.map +1 -1
- package/dist/formats/webm/CjsWebmFormat.js +20 -19
- package/dist/formats/webm/CjsWebmFormat.js.map +1 -1
- package/dist/formats/webm/core/helpers.js +6 -15
- package/dist/formats/webm/core/helpers.js.map +1 -1
- package/dist/formats/webp/CjsWebpFormat.js +19 -17
- package/dist/formats/webp/CjsWebpFormat.js.map +1 -1
- package/dist/formats/webp/core/helpers.js +5 -11
- package/dist/formats/webp/core/helpers.js.map +1 -1
- package/dist/formats/wem/CjsWemFormat.js +128 -141
- package/dist/formats/wem/CjsWemFormat.js.map +1 -1
- package/dist/formats/wem/core/helpers.js +1 -114
- package/dist/formats/wem/core/helpers.js.map +1 -1
- package/dist/formats/wem/core/{resolve.js → probeCodecSupport.js} +11 -18
- package/dist/formats/wem/core/probeCodecSupport.js.map +1 -0
- package/dist/formats/yaml/CjsYamlFormat.js +20 -5
- package/dist/formats/yaml/CjsYamlFormat.js.map +1 -1
- package/dist/generated/index.js +2 -0
- package/dist/generated/index.js.map +1 -0
- package/dist/generated/resources/Tr2RaycastGeometryRes.js +34 -0
- package/dist/generated/resources/Tr2RaycastGeometryRes.js.map +1 -0
- package/dist/generated/resources/index.js +2 -0
- package/dist/generated/resources/index.js.map +1 -0
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/resource/CjsResource.js +134 -0
- package/dist/resource/CjsResource.js.map +1 -1
- package/dist/resource/ResourceRequirement.js +42 -0
- package/dist/resource/ResourceRequirement.js.map +1 -0
- package/dist/resource/Tr2LightProfileRes.js +2 -1
- package/dist/resource/Tr2LightProfileRes.js.map +1 -1
- package/dist/resource/geometry/TriGeometryRes.js +34 -7
- package/dist/resource/geometry/TriGeometryRes.js.map +1 -1
- package/dist/resource/geometry/granny/Tr2GrannyStateRes.js +184 -7
- package/dist/resource/geometry/granny/Tr2GrannyStateRes.js.map +1 -1
- package/dist/resource/geometry/granny/TriGrannyRes.js +20 -8
- package/dist/resource/geometry/granny/TriGrannyRes.js.map +1 -1
- package/dist/resource/index.js +1 -0
- package/dist/resource/index.js.map +1 -1
- package/dist/resource/resourceBoundary.js +24 -1
- package/dist/resource/resourceBoundary.js.map +1 -1
- package/dist/resource/shader/Tr2EffectRes.js +2 -1
- package/dist/resource/shader/Tr2EffectRes.js.map +1 -1
- package/dist/resource/texture/CjsTextureArrayRes.js +2 -1
- package/dist/resource/texture/CjsTextureArrayRes.js.map +1 -1
- package/dist/resource/texture/Tr2ImageRes.js +2 -1
- package/dist/resource/texture/Tr2ImageRes.js.map +1 -1
- package/dist/resource/texture/TriTextureRes.js +40 -2
- package/dist/resource/texture/TriTextureRes.js.map +1 -1
- package/docs/architecture.md +121 -116
- package/docs/concepts/format-capabilities.md +90 -0
- package/docs/formats/README.md +14 -6
- package/docs/formats/fsd.md +104 -0
- package/docs/formats/gr2.md +1 -1
- package/docs/formats/hlsl/reference/api.md +6 -4
- package/docs/formats/provenance.md +18 -0
- package/docs/formats/schemabound.md +10 -4
- package/docs/formats/static.md +26 -26
- package/docs/formats/webgpu/reference/api.md +4 -3
- package/docs/reference/classes/core.md +22 -2
- package/docs/reference/classes/formats.md +643 -1
- package/docs/reference/classes/resources.md +463 -453
- package/docs/reference/queues.md +205 -194
- package/docs/roadmap.md +14 -18
- package/format-notices/fsd/LICENSE +21 -0
- package/format-notices/fsd/NOTICE +11 -0
- package/package.json +70 -64
- package/dist/formats/wem/core/resolve.js.map +0 -1
- package/docs/concepts/format-type-resolution.md +0 -79
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CjsFormat.js","sources":["../../../src/format/CjsFormat.js"],"sourcesContent":["import { MediaType, PayloadType } from \"@carbonenginejs/runtime-utils/media\";\r\nimport { CjsResourceProbe } from \"./CjsResourceProbe.js\";\r\n\r\n/**\r\n * Base class for format readers that defines the static\r\n * `read`/`readAsync`/`isSupported`/`resolveType` contract and instance\r\n * option handling that concrete format packages implement.\r\n */\r\nexport class CjsFormat\r\n{\r\n options = {};\r\n\r\n /**\r\n * Convenience factory for simple format helpers.\r\n * Keep this lightweight so format classes can stay pure-reader implementations.\r\n *\r\n * @param {*} input\r\n * @param {object} options\r\n * @returns {Promise<*>|*}\r\n */\r\n static read(input, options = null) {\r\n const reader = new this(options || {});\r\n return reader.Read(input, options || {});\r\n }\r\n\r\n /**\r\n * Async convenience factory for format readers.\r\n *\r\n * @param {*} input\r\n * @param {object} options\r\n * @returns {Promise<*>}\r\n */\r\n static async readAsync(input, options = null) {\r\n const reader = new this(options || {});\r\n return reader.ReadAsync(input, options || {});\r\n }\r\n\r\n /**\r\n * Canonical support probe entrypoint.\r\n * Returns a probe report including compressed/raw capability variants when implemented.\r\n *\r\n * @param {*} input\r\n * @param {object} options\r\n * @returns {CjsResourceProbe}\r\n */\r\n static isSupported(input, options = null) {\r\n const source = typeof input === \"string\" ? \"path\" : \"buffer\";\r\n const formatName = this.name\r\n ? this.name.replace(/^Cjs/u, \"\").replace(/Format$/u, \"\").toLowerCase()\r\n : \"format\";\r\n return CjsResourceProbe.createUnsupported(formatName, \"No probe implementation.\", { source, ...options });\r\n }\r\n\r\n /**\r\n * Alias for canonical naming.\r\n *\r\n * @param {*} input\r\n * @param {object} options\r\n * @returns {CjsResourceProbe}\r\n */\r\n static inspect(input, options = null) {\r\n return this.isSupported(input, options);\r\n }\r\n\r\n /**\r\n * Content-verified type/route resolution (optional per format).\r\n * Contract: docs/concepts/format-type-resolution.md.\r\n *\r\n * Where inspect()/isSupported() report what the container CLAIMS,\r\n * resolveType() performs one bounded asynchronous content check (magic, a\r\n * first frame/block, a setup header) and reports what the reader has\r\n * evidence it can actually decode. Overrides return a CjsResourceProbe\r\n * with `verified: true` and declared/resolved/mismatch evidence in\r\n * `metadata`; `preferred` names the resolved decode route. A caller-forced\r\n * emit always wins over a resolution, and this base implementation - the\r\n * zero-extra-work path for formats without an override - delegates to\r\n * isSupported() with `verified` false so an unverified result never\r\n * changes a route.\r\n *\r\n * @param {*} input Bytes (or path where the format supports it).\r\n * @param {object|null} options Format options.\r\n * @returns {Promise<CjsResourceProbe>} Probe report; content-verified only when overridden.\r\n */\r\n static async resolveType(input, options = null) {\r\n const report = CjsResourceProbe.from(this.isSupported(input, options));\r\n report.verified = false;\r\n return report;\r\n }\r\n\r\n /** Creates a CjsFormat with caller-provided reader configuration. */\r\n constructor(options = null) {\r\n this.options = { ...(options || {}) };\r\n }\r\n\r\n /** Applies supported format options for the resource format configuration. */\r\n SetValues(values = null) {\r\n if (!values || typeof values !== \"object\") {\r\n return this;\r\n }\r\n if (Object.prototype.hasOwnProperty.call(values, \"options\")) {\r\n this.options = { ...(values.options || {}) };\r\n } else {\r\n this.options = { ...this.options, ...values };\r\n }\r\n return this;\r\n }\r\n\r\n /**\r\n * Returns a copy of the current format options for the resource format\r\n * configuration.\r\n */\r\n GetValues() {\r\n return { options: { ...this.options } };\r\n }\r\n\r\n /**\r\n * Initializes the format with the supplied values and context for the resource\r\n * format configuration.\r\n */\r\n Initialize(values = null) {\r\n return this.SetValues(values || {});\r\n }\r\n\r\n /**\r\n * Primary instance read entrypoint for synchronous readers.\r\n * Implementations may override with async handling in readAsync only if needed.\r\n */\r\n Read(input, options = null) {\r\n throw new Error(`${this.constructor.name}.Read must be implemented by a format package.`);\r\n }\r\n\r\n /**\r\n * Primary async read entrypoint for asynchronous readers.\r\n * Defaults to sync Read for compatibility.\r\n */\r\n async ReadAsync(input, options = null) {\r\n return this.Read(input, options);\r\n }\r\n\r\n /**\r\n * Canonical package-family group names - the shared vocabulary object from\r\n * runtime-utils (kb: runtime-utils owns cross-package media vocabulary).\r\n * Same object identity as `@carbonenginejs/runtime-utils/media` MediaType,\r\n * so tokens can never drift between packages.\r\n */\r\n static Type = MediaType;\r\n\r\n /**\r\n * Canonical media-type groups used by format registration - the shared\r\n * runtime-utils MediaType object (see Type above).\r\n */\r\n static MediaType = MediaType;\r\n\r\n /**\r\n * Canonical output-type tokens used by format emit contracts. Shared\r\n * payload ROLES come from runtime-utils PayloadType; the remaining tokens\r\n * (cmf/gr2/json/pcm/rgba/shared/objJson) are format-emit names owned by\r\n * their formats and enumerated here for discoverability only.\r\n */\r\n static OutputType = Object.freeze({\r\n AUDIO: PayloadType.AUDIO,\r\n CMF: \"cmf\",\r\n GR2: \"gr2\",\r\n IMAGE: PayloadType.IMAGE,\r\n JSON: \"json\",\r\n PCM: \"pcm\",\r\n RAW: PayloadType.RAW,\r\n RGBA: \"rgba\",\r\n SCHEMA: PayloadType.SCHEMA,\r\n SHADER: PayloadType.SHADER,\r\n SHARED: \"shared\",\r\n TEXTURE: PayloadType.TEXTURE,\r\n VIDEO: PayloadType.VIDEO,\r\n OBJ_JSON: \"objJson\"\r\n });\r\n\r\n static type = Object.freeze([]);\r\n static mediaTypes = Object.freeze([]);\r\n static inputTypes = Object.freeze([]);\r\n static outputTypes = Object.freeze([]);\r\n static debugOutputTypes = Object.freeze([\"json\", \"raw\"]);\r\n\r\n /**\r\n * Optional browser-worker module declaration.\r\n *\r\n * Concrete formats opt in with their exact `import.meta.url`, export name,\r\n * and optional clone-safe output restrictions.\r\n */\r\n static worker = null;\r\n\r\n /**\r\n * Asserts that a format class declares the metadata required for\r\n * registration and routing.\r\n *\r\n * @param {typeof CjsFormat} Constructor\r\n * @returns {void}\r\n */\r\n static validateContract(Constructor)\r\n {\r\n if (!Constructor) {\r\n throw new TypeError(\"CjsFormat.validateContract requires a format class.\");\r\n }\r\n const hasOutput = Array.isArray(Constructor.outputTypes) && Constructor.outputTypes.length > 0;\r\n const hasInput = Array.isArray(Constructor.inputTypes) && Constructor.inputTypes.length > 0;\r\n const hasMedia = Array.isArray(Constructor.mediaTypes) && Constructor.mediaTypes.length > 0;\r\n const hasType = Array.isArray(Constructor.type) && Constructor.type.length > 0;\r\n const hasDebug = Array.isArray(Constructor.debugOutputTypes) && Constructor.debugOutputTypes.length > 0;\r\n if (!hasType || !hasMedia || !hasInput || !hasOutput || !hasDebug) {\r\n throw new TypeError(`Format contract missing metadata: type:${hasType} mediaTypes:${hasMedia} inputTypes:${hasInput} outputTypes:${hasOutput} debugOutputTypes:${hasDebug}`);\r\n }\r\n }\r\n}\r\n"],"names":["CjsFormat","options","read","input","reader","Read","readAsync","ReadAsync","isSupported","source","formatName","name","replace","toLowerCase","CjsResourceProbe","createUnsupported","inspect","resolveType","report","from","verified","constructor","SetValues","values","Object","prototype","hasOwnProperty","call","GetValues","Initialize","Error","Type","MediaType","OutputType","freeze","AUDIO","PayloadType","CMF","GR2","IMAGE","JSON","PCM","RAW","RGBA","SCHEMA","SHADER","SHARED","TEXTURE","VIDEO","OBJ_JSON","type","mediaTypes","inputTypes","outputTypes","debugOutputTypes","worker","validateContract","Constructor","TypeError","hasOutput","Array","isArray","length","hasInput","hasMedia","hasType","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BAAgB,CAACQ,MAAM,GAAG,CAAC;AACvG,IAAA,IAAI,CAACG,OAAO,IAAI,CAACD,QAAQ,IAAI,CAACD,QAAQ,IAAI,CAACJ,SAAS,IAAI,CAACO,QAAQ,EAAE;AACjE,MAAA,MAAM,IAAIR,SAAS,CAAC,CAAA,uCAAA,EAA0CO,OAAO,CAAA,YAAA,EAAeD,QAAQ,CAAA,YAAA,EAAeD,QAAQ,CAAA,aAAA,EAAgBJ,SAAS,CAAA,kBAAA,EAAqBO,QAAQ,EAAE,CAAC;AAC9K,IAAA;AACF,EAAA;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"CjsFormat.js","sources":["../../../src/format/CjsFormat.js"],"sourcesContent":["import { MediaType, PayloadType } from \"@carbonenginejs/runtime-utils/media\";\n\nconst OUTPUT_ROLE_RUNTIME = \"runtime\";\nconst OUTPUT_ROLE_DEBUG = \"debug\";\nconst READ_MODE_SYNC = \"sync\";\nconst READ_MODE_ASYNC = \"async\";\n\n/**\n * Decorator-free base for every concrete format facade.\n *\n * The format subpaths must remain directly importable from authored source, so\n * this base deliberately does not import the decorated CjsResourceProbe model.\n * Formats return plain support reports; CjsResourceProbe.from() is the optional\n * resource-layer normalization boundary.\n */\nexport class CjsFormat\n{\n options = {};\n\n constructor(options = null)\n {\n this.options = { ...(options || {}) };\n }\n\n /** Apply caller-provided instance defaults. */\n SetValues(values = null)\n {\n this.options = { ...this.options, ...(values || {}) };\n return this;\n }\n\n /** Return caller-provided instance defaults. */\n GetValues()\n {\n return { ...this.options };\n }\n\n /** Read through the concrete instance implementation. */\n Read(_input, _options = null)\n {\n const error = new Error(`${this.constructor.name}.Read is not implemented.`);\n error.code = \"CJS_FORMAT_READ_NOT_IMPLEMENTED\";\n throw error;\n }\n\n /** Async instance read; synchronous readers inherit this exact fallback. */\n async ReadAsync(input, options = null)\n {\n return this.Read(input, options);\n }\n\n /** Inspect with the instance's normalized options when available. */\n Inspect(input, options = null)\n {\n const values = typeof this.GetValues === \"function\"\n ? this.GetValues(options || {})\n : options || {};\n return this.constructor.inspect(input, values);\n }\n\n /** Return the cheap, unverified support report for this instance profile. */\n GetSupport(input, options = null)\n {\n const values = typeof this.GetValues === \"function\"\n ? this.GetValues(options || {})\n : options || {};\n return this.constructor.getSupport(input, values);\n }\n\n /** Exercise one exact output through the real asynchronous read path. */\n VerifySupport(input, options = null)\n {\n const values = typeof this.GetValues === \"function\"\n ? this.GetValues(options || {})\n : options || {};\n return this.constructor.verifySupport(input, values);\n }\n\n /**\n * Static read boundary. Concrete formats normally override this; the base\n * fallback supports the few formats implemented only as instance readers.\n */\n static read(input, options = null)\n {\n const reader = new this(options || {});\n if (reader.Read === CjsFormat.prototype.Read)\n {\n const error = new Error(`${this.name}.read is not implemented.`);\n error.code = \"CJS_FORMAT_READ_NOT_IMPLEMENTED\";\n throw error;\n }\n return reader.Read(input, options || {});\n }\n\n /** Async read boundary used by support verification and resource loading. */\n static async readAsync(input, options = null)\n {\n if (Object.hasOwn(this, \"read\")) return this.read(input, options || {});\n const reader = new this(options || {});\n return reader.ReadAsync(input, options || {});\n }\n\n /**\n * Synchronous structural metadata accessor.\n *\n * Inspection answers what the input is. It does not claim that any decoder\n * output works in the current environment.\n */\n static inspect(_input, _options = null)\n {\n const error = new Error(`${this.name}.inspect is not implemented.`);\n error.code = \"CJS_FORMAT_INSPECT_NOT_IMPLEMENTED\";\n throw error;\n }\n\n /** Cheap synchronous identification used only for route selection. */\n static is(input, options = null)\n {\n try\n {\n if (Object.hasOwn(this, \"probeSupport\"))\n {\n return recognizesProbe(this.probeSupport(input, options || {}));\n }\n this.inspect(input, options || {});\n return true;\n }\n catch\n {\n return false;\n }\n }\n\n /**\n * Format-specific cheap support probe hook.\n *\n * Concrete formats may override this with header/environment reasoning. The\n * public getSupport() method normalizes its result into the uniform contract.\n */\n static probeSupport(input, options = null)\n {\n try\n {\n return {\n format: this.id,\n source: typeof input === \"string\" ? \"path\" : \"buffer\",\n recognized: true,\n metadata: this.inspect(input, options || {}),\n reason: \"Container structure recognized.\"\n };\n }\n catch (error)\n {\n return {\n format: this.id,\n source: typeof input === \"string\" ? \"path\" : \"buffer\",\n recognized: false,\n metadata: null,\n reason: error?.message || \"Input was not recognized.\",\n errors: [ error?.message || \"Input was not recognized.\" ]\n };\n }\n }\n\n /**\n * Cheap synchronous output support report.\n *\n * This is advisory: it may use headers, structure, and current environment\n * features, but never claims that the decoder ran. Every output entry is\n * therefore returned with verified:false.\n */\n static getSupport(input, options = null)\n {\n const values = options && typeof options === \"object\" ? options : {};\n let report;\n try\n {\n report = this.probeSupport(input, values);\n }\n catch (error)\n {\n report = {\n format: this.id,\n source: typeof input === \"string\" ? \"path\" : \"buffer\",\n recognized: false,\n reason: error?.message || \"Support probe failed.\",\n errors: [ error?.message || \"Support probe failed.\" ]\n };\n }\n return normalizeSupportReport(this, report, values);\n }\n\n /**\n * Prove one exact output by exercising the real asynchronous reader.\n *\n * This is an explicit diagnostic/capability operation. Normal resource\n * loading calls readAsync() once and treats its successful result as proof;\n * it must not verify and then decode the same payload a second time.\n */\n static async verifySupport(input, options = null)\n {\n const values = options && typeof options === \"object\" ? options : {};\n const report = this.getSupport(input, values);\n const capability = this.getOutputCapability(report.output);\n\n if (!capability)\n {\n const message = report.output\n ? `${this.name} declares no output ${JSON.stringify(report.output)}.`\n : `${this.name} declares no verifiable default output.`;\n return Object.freeze({\n ...report,\n supported: false,\n verified: true,\n reason: message,\n error: Object.freeze({\n name: \"Error\",\n code: \"CJS_FORMAT_OUTPUT_UNDECLARED\",\n message\n })\n });\n }\n\n try\n {\n await this.readAsync(input, { ...values, emit: capability.output });\n return freezeVerification(report, capability, true, null);\n }\n catch (error)\n {\n return freezeVerification(report, capability, false, error);\n }\n }\n\n /** Return the canonical declaration for one output selector. */\n static getOutputCapability(output = null)\n {\n if (!output)\n {\n return Object.values(this.outputs).find(entry => entry.default) || null;\n }\n const normalized = String(output).toLowerCase();\n return Object.values(this.outputs).find(entry =>\n entry.output.toLowerCase() === normalized) || null;\n }\n\n /** Freeze and validate one format's authoritative output map. */\n static defineOutputs(definitions = {})\n {\n if (!definitions || typeof definitions !== \"object\" || Array.isArray(definitions))\n {\n throw new TypeError(\"CjsFormat.defineOutputs requires an object map.\");\n }\n\n const outputs = {};\n let defaults = 0;\n for (const [ output, definition ] of Object.entries(definitions))\n {\n if (!output || !definition || typeof definition !== \"object\" || Array.isArray(definition))\n {\n throw new TypeError(\"Each format output requires a non-empty name and descriptor.\");\n }\n const role = definition.role || OUTPUT_ROLE_RUNTIME;\n const readMode = definition.readMode || READ_MODE_SYNC;\n if (![ OUTPUT_ROLE_RUNTIME, OUTPUT_ROLE_DEBUG ].includes(role))\n {\n throw new TypeError(`Format output ${output} has invalid role ${JSON.stringify(role)}.`);\n }\n if (![ READ_MODE_SYNC, READ_MODE_ASYNC ].includes(readMode))\n {\n throw new TypeError(`Format output ${output} has invalid readMode ${JSON.stringify(readMode)}.`);\n }\n if (definition.default === true) defaults++;\n const probes = definition.probes ?? definition.probe ?? output;\n outputs[output] = Object.freeze({\n output,\n payloadType: definition.payloadType || output,\n role,\n readMode,\n decoded: definition.decoded === true,\n passthrough: definition.passthrough === true,\n default: definition.default === true,\n probes: Object.freeze((Array.isArray(probes) ? probes : [ probes ]).map(String)),\n requires: Object.freeze([ ...(definition.requires || []) ])\n });\n }\n if (defaults > 1) throw new TypeError(\"A format may declare only one default output.\");\n if (Object.keys(outputs).length > 0 && defaults !== 1)\n {\n throw new TypeError(\"A format with outputs must declare exactly one default output.\");\n }\n return Object.freeze(outputs);\n }\n\n /** Assert the canonical format surface without requiring optional outputs. */\n static validateContract(Constructor)\n {\n if (typeof Constructor !== \"function\" || !(Constructor.prototype instanceof CjsFormat))\n {\n throw new TypeError(\"CjsFormat.validateContract requires a CjsFormat subclass.\");\n }\n if (typeof Constructor.id !== \"string\" || !Constructor.id)\n {\n throw new TypeError(`${Constructor.name} must declare a non-empty id.`);\n }\n if (!Array.isArray(Constructor.mediaTypes) || Constructor.mediaTypes.length === 0\n || !Object.isFrozen(Constructor.mediaTypes))\n {\n throw new TypeError(`${Constructor.name} must declare frozen non-empty mediaTypes.`);\n }\n for (const mediaType of Constructor.mediaTypes)\n {\n if (!Object.values(MediaType).includes(mediaType))\n {\n throw new TypeError(`${Constructor.name} media type ${JSON.stringify(mediaType)} is not canonical.`);\n }\n }\n if (!Array.isArray(Constructor.extensions) || !Object.isFrozen(Constructor.extensions))\n {\n throw new TypeError(`${Constructor.name} must declare frozen extensions.`);\n }\n if (!Constructor.outputs || typeof Constructor.outputs !== \"object\"\n || Array.isArray(Constructor.outputs) || !Object.isFrozen(Constructor.outputs))\n {\n throw new TypeError(`${Constructor.name} must declare frozen outputs.`);\n }\n if (typeof Constructor.requestResponseType !== \"string\" || !Constructor.requestResponseType)\n {\n throw new TypeError(`${Constructor.name} must declare a requestResponseType.`);\n }\n if (Constructor.worker !== null)\n {\n if (!Constructor.worker || typeof Constructor.worker !== \"object\" || !Object.isFrozen(Constructor.worker))\n {\n throw new TypeError(`${Constructor.name}.worker must be null or a frozen descriptor.`);\n }\n if (typeof Constructor.worker.module !== \"string\" || !Constructor.worker.module\n || typeof Constructor.worker.exportName !== \"string\" || !Constructor.worker.exportName\n || !Array.isArray(Constructor.worker.outputTypes) || !Object.isFrozen(Constructor.worker.outputTypes))\n {\n throw new TypeError(`${Constructor.name}.worker has an invalid execution descriptor.`);\n }\n for (const output of Constructor.worker.outputTypes)\n {\n if (!Constructor.getOutputCapability(output))\n {\n throw new TypeError(`${Constructor.name}.worker names undeclared output ${JSON.stringify(output)}.`);\n }\n }\n if (Constructor.worker.defaultOutput && !Constructor.getOutputCapability(Constructor.worker.defaultOutput))\n {\n throw new TypeError(`${Constructor.name}.worker names an undeclared default output.`);\n }\n }\n for (const retired of [ \"type\", \"inputTypes\", \"outputTypes\", \"debugOutputTypes\", \"implementationStatus\" ])\n {\n if (Object.hasOwn(Constructor, retired))\n {\n throw new TypeError(`${Constructor.name} must not declare retired static ${retired}.`);\n }\n }\n let defaults = 0;\n for (const [ output, capability ] of Object.entries(Constructor.outputs))\n {\n if (!Object.isFrozen(capability))\n {\n throw new TypeError(`${Constructor.name} output capabilities must be frozen.`);\n }\n if (capability.output !== output)\n {\n throw new TypeError(`${Constructor.name} output ${output} has a mismatched descriptor.`);\n }\n if (capability.default) defaults++;\n }\n if (Object.keys(Constructor.outputs).length > 0 && defaults !== 1)\n {\n throw new TypeError(`${Constructor.name} must declare exactly one default output.`);\n }\n }\n\n static Type = MediaType;\n static MediaType = MediaType;\n static OutputType = Object.freeze({\n AUDIO: PayloadType.AUDIO,\n CMF: \"cmf\",\n DOCUMENT: \"document\",\n GR2: \"gr2\",\n IMAGE: PayloadType.IMAGE,\n JSON: \"json\",\n MEDIA: \"media\",\n METADATA: \"metadata\",\n OGG: \"ogg\",\n PAYLOAD: \"payload\",\n PCM: \"pcm\",\n RAW: PayloadType.RAW,\n RGBA: \"rgba\",\n RUNTIME: \"runtime\",\n SCHEMA: PayloadType.SCHEMA,\n SHADER: PayloadType.SHADER,\n SHARED: \"shared\",\n TEXTURE: PayloadType.TEXTURE,\n VIDEO: PayloadType.VIDEO\n });\n\n static id = \"\";\n static mediaTypes = Object.freeze([]);\n static extensions = Object.freeze([]);\n static outputs = Object.freeze({});\n static requestResponseType = \"arraybuffer\";\n static worker = null;\n}\n\nfunction normalizeSupportReport(Format, rawReport, options)\n{\n const raw = typeof rawReport === \"boolean\"\n ? { recognized: rawReport, supported: rawReport }\n : rawReport && typeof rawReport === \"object\" ? rawReport : {};\n const requested = options.emit ?? null;\n const capability = Format.getOutputCapability(requested);\n const legacyVariants = Array.isArray(raw.variants) ? raw.variants : [];\n const rawPositive = raw.supported === true\n || raw.supported === \"full\"\n || raw.supported === \"partial\";\n const recognized = raw.recognized === true\n || (raw.recognized !== false && (raw.metadata != null || rawPositive));\n\n const outputs = Object.values(Format.outputs).map(entry =>\n {\n const variant = findLegacyVariant(entry, legacyVariants);\n const supported = variant\n ? variant.supported === true\n : recognized && (legacyVariants.length === 0 ? raw.supported !== false && raw.supported !== \"none\" : false);\n return Object.freeze({\n ...entry,\n supported,\n verified: false,\n codec: variant?.codec || \"\",\n reason: variant?.reason\n || raw.reason\n || (supported ? \"Output appears usable from structural evidence.\" : \"Output was not supported by the structural probe.\"),\n requires: Object.freeze([ ...(variant?.requires || entry.requires) ])\n });\n });\n\n const selected = capability\n ? outputs.find(entry => entry.output === capability.output) || null\n : null;\n const preferredOutput = resolvePreferredOutput(raw.preferredOutput, outputs)\n || outputs.find(entry => entry.supported && entry.role === OUTPUT_ROLE_RUNTIME)?.output\n || outputs.find(entry => entry.supported)?.output\n || \"\";\n\n return Object.freeze({\n format: Format.id || raw.format || Format.name,\n source: raw.source || options.source || \"buffer\",\n recognized,\n output: capability?.output || (requested == null ? \"\" : String(requested)),\n supported: selected?.supported === true,\n verified: false,\n preferredOutput,\n reason: selected?.reason || raw.reason || (recognized ? \"Input recognized.\" : \"Input not recognized.\"),\n metadata: raw.metadata ?? null,\n capability: selected,\n outputs: Object.freeze(outputs),\n warnings: Object.freeze([ ...(raw.warnings || []) ]),\n errors: Object.freeze([ ...(raw.errors || []) ]),\n error: null\n });\n}\n\nfunction recognizesProbe(report)\n{\n if (report === true) return true;\n if (!report || typeof report !== \"object\" || report.recognized === false) return false;\n return report.recognized === true\n || report.supported === true\n || report.supported === \"full\"\n || report.supported === \"partial\"\n || report.metadata != null;\n}\n\nfunction findLegacyVariant(capability, variants)\n{\n const probes = new Set(capability.probes.map(value => value.toLowerCase()));\n const matches = variants.filter(variant =>\n {\n for (const value of [ variant?.output, variant?.kind, variant?.payloadType ])\n {\n if (value != null && probes.has(String(value).toLowerCase())) return true;\n }\n return false;\n });\n const output = capability.output.toLowerCase();\n return matches.find(variant => String(variant?.output || \"\").toLowerCase() === output)\n || matches.find(variant => String(variant?.kind || \"\").toLowerCase() === output)\n || matches.find(variant => String(variant?.payloadType || \"\").toLowerCase() === output)\n || matches.find(variant => variant.supported === true)\n || matches[0]\n || null;\n}\n\nfunction resolvePreferredOutput(preferredOutput, outputs)\n{\n if (!preferredOutput) return \"\";\n const normalized = String(preferredOutput).toLowerCase();\n const direct = outputs.find(entry => entry.output.toLowerCase() === normalized);\n return direct?.output || \"\";\n}\n\nfunction freezeVerification(report, capability, supported, error)\n{\n const errorReport = error ? serializeError(error) : null;\n const outputs = report.outputs.map(entry => entry.output === capability.output\n ? Object.freeze({\n ...entry,\n supported,\n verified: true,\n reason: supported ? \"The real asynchronous read path completed successfully.\" : errorReport.message\n })\n : entry);\n return Object.freeze({\n ...report,\n recognized: supported ? true : report.recognized,\n supported,\n verified: true,\n reason: supported ? \"The real asynchronous read path completed successfully.\" : errorReport.message,\n capability: outputs.find(entry => entry.output === capability.output) || null,\n outputs: Object.freeze(outputs),\n errors: errorReport ? Object.freeze([ ...report.errors, errorReport.message ]) : report.errors,\n error: errorReport\n });\n}\n\nfunction serializeError(error)\n{\n const details = {};\n for (const [ key, value ] of Object.entries(error || {}))\n {\n if ([ \"name\", \"code\", \"message\", \"cause\" ].includes(key)) continue;\n details[key] = value;\n }\n return Object.freeze({\n name: error?.name || \"Error\",\n code: error?.code || \"CJS_FORMAT_VERIFY_FAILED\",\n message: error?.message || String(error),\n details: Object.freeze(details),\n cause: error?.cause\n ? Object.freeze({\n name: error.cause.name || \"Error\",\n code: error.cause.code || \"\",\n message: error.cause.message || String(error.cause)\n })\n : null\n });\n}\n\nexport const CjsFormatOutputRole = Object.freeze({\n RUNTIME: OUTPUT_ROLE_RUNTIME,\n DEBUG: OUTPUT_ROLE_DEBUG\n});\n\nexport const CjsFormatReadMode = Object.freeze({\n SYNC: READ_MODE_SYNC,\n ASYNC: READ_MODE_ASYNC\n});\n\nexport default CjsFormat;\n"],"names":["OUTPUT_ROLE_RUNTIME","OUTPUT_ROLE_DEBUG","READ_MODE_SYNC","READ_MODE_ASYNC","CjsFormat","options","constructor","SetValues","values","GetValues","Read","_input","_options","error","Error","name","code","ReadAsync","input","Inspect","inspect","GetSupport","getSupport","VerifySupport","verifySupport","read","reader","prototype","readAsync","Object","hasOwn","is","recognizesProbe","probeSupport","format","id","source","recognized","metadata","reason","message","errors","report","normalizeSupportReport","capability","getOutputCapability","output","JSON","stringify","freeze","supported","verified","emit","freezeVerification","outputs","find","entry","default","normalized","String","toLowerCase","defineOutputs","definitions","Array","isArray","TypeError","defaults","definition","entries","role","readMode","includes","probes","probe","payloadType","decoded","passthrough","map","requires","keys","length","validateContract","Constructor","mediaTypes","isFrozen","mediaType","MediaType","extensions","requestResponseType","worker","module","exportName","outputTypes","defaultOutput","retired","Type","OutputType","AUDIO","PayloadType","CMF","DOCUMENT","GR2","IMAGE","MEDIA","METADATA","OGG","PAYLOAD","PCM","RAW","RGBA","RUNTIME","SCHEMA","SHADER","SHARED","TEXTURE","VIDEO","Format","rawReport","raw","requested","legacyVariants","variants","rawPositive","variant","findLegacyVariant","codec","selected","preferredOutput","resolvePreferredOutput","warnings","Set","value","matches","filter","kind","has","direct","errorReport","serializeError","details","key","cause","CjsFormatOutputRole","DEBUG","CjsFormatReadMode","SYNC","ASYNC"],"mappings":";;AAEA,MAAMA,mBAAmB,GAAG,SAAS;AACrC,MAAMC,iBAAiB,GAAG,OAAO;AACjC,MAAMC,cAAc,GAAG,MAAM;AAC7B,MAAMC,eAAe,GAAG,OAAO;;AAE/B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,SAAS,CACtB;EACEC,OAAO,GAAG,EAAE;AAEZC,EAAAA,WAAWA,CAACD,OAAO,GAAG,IAAI,EAC1B;IACE,IAAI,CAACA,OAAO,GAAG;MAAE,IAAIA,OAAO,IAAI,EAAE;KAAG;AACvC,EAAA;;AAEA;AACAE,EAAAA,SAASA,CAACC,MAAM,GAAG,IAAI,EACvB;IACE,IAAI,CAACH,OAAO,GAAG;MAAE,GAAG,IAAI,CAACA,OAAO;MAAE,IAAIG,MAAM,IAAI,EAAE;KAAG;AACrD,IAAA,OAAO,IAAI;AACb,EAAA;;AAEA;AACAC,EAAAA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IAAImB,MAAM,CAAC9C,KAAK,CAAC;AACxC8H,IAAAA,OAAO,EAAE9G,MAAM,CAACoB,MAAM,CAAC0F,OAAO,CAAC;IAC/BE,KAAK,EAAEhI,KAAK,EAAEgI,KAAK,GACfhH,MAAM,CAACoB,MAAM,CAAC;AACdlC,MAAAA,IAAI,EAAEF,KAAK,CAACgI,KAAK,CAAC9H,IAAI,IAAI,OAAO;AACjCC,MAAAA,IAAI,EAAEH,KAAK,CAACgI,KAAK,CAAC7H,IAAI,IAAI,EAAE;MAC5BwB,OAAO,EAAE3B,KAAK,CAACgI,KAAK,CAACrG,OAAO,IAAImB,MAAM,CAAC9C,KAAK,CAACgI,KAAK;AACpD,KAAC,CAAC,GACA;AACN,GAAC,CAAC;AACJ;MAEaC,mBAAmB,GAAGjH,MAAM,CAACoB,MAAM,CAAC;AAC/C6D,EAAAA,OAAO,EAAE9G,mBAAmB;AAC5B+I,EAAAA,KAAK,EAAE9I;AACT,CAAC;MAEY+I,iBAAiB,GAAGnH,MAAM,CAACoB,MAAM,CAAC;AAC7CgG,EAAAA,IAAI,EAAE/I,cAAc;AACpBgJ,EAAAA,KAAK,EAAE/I;AACT,CAAC;;;;"}
|
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
import { normalizeResourceExtension } from '@carbonenginejs/runtime-utils/path';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* One registered route: an extension, the format that reads it, the reader to
|
|
5
|
+
* call, and the output to ask for.
|
|
6
|
+
*
|
|
7
|
+
* The unit is deliberately not a bare format class. A format class does not
|
|
8
|
+
* answer the question "how is this file read", because three separate things
|
|
9
|
+
* can vary independently and every one of them is live in this package:
|
|
10
|
+
*
|
|
11
|
+
* - **Several formats under one extension.** `.static` is read by both
|
|
12
|
+
* `CjsStaticFormat` and `CjsSchemaBoundFormat`, and only content tells them
|
|
13
|
+
* apart.
|
|
14
|
+
* - **Several readers on one format, chosen by CONTENT.** `CjsGr2Format` reads
|
|
15
|
+
* `.gr2` and `.gsf` through the same `readRawInput`, because they are the
|
|
16
|
+
* same Granny container — the suffix only denotes what the root object holds.
|
|
17
|
+
* `read` projects geometry and `readGsf` projects a state machine, and
|
|
18
|
+
* `isGsf` is what actually tells them apart. The extension is a hint, not the
|
|
19
|
+
* discriminator, which is why a route may carry its own `accepts` probe.
|
|
20
|
+
* - **Several outputs from one reader.** `CjsDdsFormat` declares `texture`,
|
|
21
|
+
* `image`, and `rgba` capability descriptors in `outputs` off a single
|
|
22
|
+
* `read`, selected by `options.emit`.
|
|
23
|
+
*
|
|
24
|
+
* ccpwgl mapped one extension to one constructor and stopped, which is why
|
|
25
|
+
* every one of those cases has to be hardcoded at a call site there. Naming the
|
|
26
|
+
* route makes them registration data instead - and the resource that reads a
|
|
27
|
+
* `.gsf` no longer has to know that the method is called `readGsf`.
|
|
28
|
+
*/
|
|
29
|
+
class CjsFormatRoute {
|
|
30
|
+
constructor(Format, options = {}) {
|
|
31
|
+
this.Format = Format;
|
|
32
|
+
this.read = options.read || "read";
|
|
33
|
+
this.output = options.output || null;
|
|
34
|
+
this.accepts = options.accepts || null;
|
|
35
|
+
this.name = options.name || `${Format.name || "format"}.${this.read}`;
|
|
36
|
+
if (typeof Format[this.read] !== "function") {
|
|
37
|
+
throw new TypeError(`${Format.name || "format"} has no reader named ${JSON.stringify(this.read)}. ` + "A route names the entry point to call, so a misspelling here would " + "otherwise surface as a failed load of the first matching file.");
|
|
38
|
+
}
|
|
39
|
+
if (this.accepts !== null && typeof this.accepts !== "function" && typeof Format[this.accepts] !== "function") {
|
|
40
|
+
throw new TypeError(`${Format.name || "format"} has no probe named ${JSON.stringify(this.accepts)}. ` + "A route's probe is what separates two readers over one container, so " + "a missing one would silently route every file to the first route.");
|
|
41
|
+
}
|
|
42
|
+
if (this.output && typeof Format.getOutputCapability === "function" && !Format.getOutputCapability(this.output)) {
|
|
43
|
+
throw new TypeError(`${Format.name || "format"} does not declare the output ` + `${JSON.stringify(this.output)}; it declares ` + `${Object.keys(Format.outputs || {}).map(value => JSON.stringify(value)).join(", ")}.`);
|
|
44
|
+
}
|
|
45
|
+
Object.freeze(this);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Whether this route recognises the data.
|
|
50
|
+
*
|
|
51
|
+
* The route's own probe answers when it has one, and it is the only thing
|
|
52
|
+
* that can separate two readers over ONE container. `Format.is` says
|
|
53
|
+
* "yes, this is a Granny file" for both a `.gr2` and a `.gsf`, because it is
|
|
54
|
+
* — the question it answers is about the container, not about which
|
|
55
|
+
* projection applies. `isGsf` is the question that matters there.
|
|
56
|
+
*
|
|
57
|
+
* Falling back to `Format.is` is right when the routes belong to
|
|
58
|
+
* different formats, which is the `.static` case.
|
|
59
|
+
*
|
|
60
|
+
* A route with no probe at all answers yes: the extension already selected
|
|
61
|
+
* it, and a format is entitled to reject its own file later with a better
|
|
62
|
+
* message than a probe could give. A probe that throws has declined rather
|
|
63
|
+
* than failed — probes read headers of files they may not own.
|
|
64
|
+
*/
|
|
65
|
+
Accepts(data) {
|
|
66
|
+
if (data === undefined) return true;
|
|
67
|
+
const probe = typeof this.accepts === "function" ? this.accepts : this.accepts ? this.Format[this.accepts] : this.Format.is;
|
|
68
|
+
if (typeof probe !== "function") return true;
|
|
69
|
+
try {
|
|
70
|
+
return isPositiveProbe(probe.call(this.Format, data));
|
|
71
|
+
} catch {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Read data through this route.
|
|
78
|
+
*
|
|
79
|
+
* The registered output is applied as `emit` unless the caller names one,
|
|
80
|
+
* which is what makes "which representation of a DDS do we want" a
|
|
81
|
+
* registration decision rather than something every call site repeats.
|
|
82
|
+
*
|
|
83
|
+
* @param {*} data Source data.
|
|
84
|
+
* @param {object|null} [options] Reader options; `emit` overrides the route's output.
|
|
85
|
+
* @returns {*} Whatever the reader returns.
|
|
86
|
+
*/
|
|
87
|
+
Read(data, options = null) {
|
|
88
|
+
const values = {
|
|
89
|
+
...(options || {})
|
|
90
|
+
};
|
|
91
|
+
if (this.output && values.emit === undefined) values.emit = this.output;
|
|
92
|
+
return this.Format[this.read](data, values);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* The link between a resource and the formats that can populate it.
|
|
98
|
+
*
|
|
99
|
+
* WHY THIS EXISTS RATHER THAN A RESOURCE IMPORTING ITS FORMATS. ccpwgl's
|
|
100
|
+
* `Tw2TextureRes` imports its five texture formats directly, and that is a
|
|
101
|
+
* reasonable shape for a bundled application. It is the wrong shape for a
|
|
102
|
+
* library: every format here is an explicitly tree-shakeable subpath, so a
|
|
103
|
+
* consumer that pulls in one texture resource must not thereby drag in DDS,
|
|
104
|
+
* PNG, JPEG, TGA, GIF and WebP. A resource that imports its formats destroys
|
|
105
|
+
* that, quietly and permanently.
|
|
106
|
+
*
|
|
107
|
+
* So nobody imports anybody. The composing application registers the routes it
|
|
108
|
+
* actually wants, and both the manager and a resource loading itself ask the
|
|
109
|
+
* store. That is also what makes "which formats exist" a property of the
|
|
110
|
+
* composed application rather than a list baked into the loader.
|
|
111
|
+
*
|
|
112
|
+
* WHAT THE STORE DOES NOT OWN: which resource class a file becomes. That is
|
|
113
|
+
* `CjsResMan.RegisterExtension`'s Handler, and duplicating it here would make
|
|
114
|
+
* two registries disagree about one question. The store answers how bytes are
|
|
115
|
+
* read; the manager answers what they become.
|
|
116
|
+
*
|
|
117
|
+
* ORDER IS THE CALLER'S. Registration order is retained per extension, because
|
|
118
|
+
* where several routes answer for one suffix the caller's ordering is the
|
|
119
|
+
* routing policy.
|
|
120
|
+
*/
|
|
121
|
+
class CjsFormatStore {
|
|
122
|
+
#byExtension = new Map();
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Register a format, by default under every extension it declares.
|
|
126
|
+
*
|
|
127
|
+
* `Format.extensions` is a CONVENIENCE, not the routing authority. It exists
|
|
128
|
+
* so a composition root can register a pile of formats without restating
|
|
129
|
+
* what each one reads, and that is the whole of its job. The caller may name
|
|
130
|
+
* extensions instead, and then the declaration is not consulted at all — a
|
|
131
|
+
* format reading a suffix its author never anticipated is a deployment's
|
|
132
|
+
* business, not the format's.
|
|
133
|
+
*
|
|
134
|
+
* That is also the only way to reach `webgl`, `webgpu` and `dxbc` through a
|
|
135
|
+
* store. They declare nothing because their inputs are logical names rather
|
|
136
|
+
* than file suffixes, which is a statement about what they read, not a bar on
|
|
137
|
+
* an application routing a suffix to one of them.
|
|
138
|
+
*
|
|
139
|
+
* The second argument may be the extensions alone, or a route:
|
|
140
|
+
*
|
|
141
|
+
* ```js
|
|
142
|
+
* store.Register(CjsPngFormat); // as declared
|
|
143
|
+
* store.Register(CjsGr2Format, { extensions: ".gsf", read: "readGsf" });
|
|
144
|
+
* store.Register(CjsDdsFormat, { extensions: ".dds", output: "texture" });
|
|
145
|
+
* ```
|
|
146
|
+
*
|
|
147
|
+
* Registering the same route twice under one extension is a no-op, so a
|
|
148
|
+
* composition root may register defensively. Two routes over the same format
|
|
149
|
+
* that differ in reader or output are NOT duplicates — that is the whole
|
|
150
|
+
* point of naming them.
|
|
151
|
+
*
|
|
152
|
+
* @param {Function} Format Format class.
|
|
153
|
+
* @param {string|string[]|object|null} [options] Extensions, or a route descriptor.
|
|
154
|
+
* @returns {CjsFormatStore} This store.
|
|
155
|
+
*/
|
|
156
|
+
Register(Format, options = null) {
|
|
157
|
+
if (typeof Format !== "function") {
|
|
158
|
+
throw new TypeError("CjsFormatStore.Register requires a format class.");
|
|
159
|
+
}
|
|
160
|
+
const settings = options === null || options === undefined ? {} : typeof options === "string" || Array.isArray(options) ? {
|
|
161
|
+
extensions: options
|
|
162
|
+
} : options;
|
|
163
|
+
const supplied = settings.extensions === undefined || settings.extensions === null ? null : Array.isArray(settings.extensions) ? settings.extensions : [settings.extensions];
|
|
164
|
+
const declared = supplied || Format.extensions;
|
|
165
|
+
if (!Array.isArray(declared) || declared.length === 0) {
|
|
166
|
+
const name = Format.name || "format";
|
|
167
|
+
const error = new Error(`${name} declares no extensions and none were supplied, so there is ` + "nothing to route it under. Pass the extensions this application " + "wants it to read: Register(Format, \".ext\"). Formats whose inputs " + "are logical names rather than file suffixes - webgl, webgpu, dxbc - " + "declare none, and are usually used directly instead.");
|
|
168
|
+
error.code = "CJS_FORMAT_STORE_NO_EXTENSIONS";
|
|
169
|
+
throw error;
|
|
170
|
+
}
|
|
171
|
+
const route = new CjsFormatRoute(Format, settings);
|
|
172
|
+
for (const extension of declared) {
|
|
173
|
+
const key = normalizeResourceExtension(extension);
|
|
174
|
+
if (!key) {
|
|
175
|
+
// An empty key would register silently and route nothing, which is the
|
|
176
|
+
// worst of both outcomes: the caller believes the format is reachable.
|
|
177
|
+
throw new TypeError(`CjsFormatStore.Register cannot route ${Format.name || "a format"} ` + `under ${JSON.stringify(extension)}, which is not an extension.`);
|
|
178
|
+
}
|
|
179
|
+
const existing = this.#byExtension.get(key);
|
|
180
|
+
if (!existing) this.#byExtension.set(key, [route]);else if (!existing.some(entry => isSameRoute(entry, route))) existing.push(route);
|
|
181
|
+
}
|
|
182
|
+
return this;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Register several formats in caller order.
|
|
187
|
+
*
|
|
188
|
+
* An entry is either a format class, which registers under what it declares,
|
|
189
|
+
* or a `[Format, extensionsOrRoute]` pair.
|
|
190
|
+
*
|
|
191
|
+
* @param {Iterable<Function|[Function, string|string[]|object]>} formats
|
|
192
|
+
* @returns {CjsFormatStore} This store.
|
|
193
|
+
*/
|
|
194
|
+
RegisterAll(formats) {
|
|
195
|
+
for (const entry of formats || []) {
|
|
196
|
+
if (Array.isArray(entry)) this.Register(entry[0], entry[1]);else this.Register(entry);
|
|
197
|
+
}
|
|
198
|
+
return this;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Every route registered for an extension, in registration order.
|
|
203
|
+
*
|
|
204
|
+
* @param {string} extension
|
|
205
|
+
* @returns {CjsFormatRoute[]} A copy; the store's own order is not exposed for mutation.
|
|
206
|
+
*/
|
|
207
|
+
Get(extension) {
|
|
208
|
+
return [...(this.#byExtension.get(normalizeResourceExtension(extension)) || [])];
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Whether anything is registered for an extension.
|
|
213
|
+
*
|
|
214
|
+
* @param {string} extension
|
|
215
|
+
* @returns {boolean}
|
|
216
|
+
*/
|
|
217
|
+
Has(extension) {
|
|
218
|
+
return this.#byExtension.has(normalizeResourceExtension(extension));
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* The route that should read this data.
|
|
223
|
+
*
|
|
224
|
+
* Three filters apply in order, and each exists because something in this
|
|
225
|
+
* package needs it:
|
|
226
|
+
*
|
|
227
|
+
* 1. **Extension** narrows to the routes registered for the suffix.
|
|
228
|
+
* 2. **Output**, when the caller wants a particular representation, narrows
|
|
229
|
+
* further and pins that output onto an otherwise unpinned route. A caller
|
|
230
|
+
* asking for `texture` must not be handed the route registered to decode
|
|
231
|
+
* the same file to `rgba`; resource requirements select classes instead.
|
|
232
|
+
* 3. **Content** separates what remains, because with several candidates left
|
|
233
|
+
* nothing else can. With exactly one the data is not consulted at all: the
|
|
234
|
+
* extension already decided, and the format is entitled to reject its own
|
|
235
|
+
* file with a better message than a probe could produce.
|
|
236
|
+
*
|
|
237
|
+
* Returns `null` rather than guessing when nothing matches, so the caller
|
|
238
|
+
* reports what it could not read instead of handing bytes to a reader that
|
|
239
|
+
* never claimed them.
|
|
240
|
+
*
|
|
241
|
+
* @param {string} extension
|
|
242
|
+
* @param {*} [data] Data to probe when more than one route remains.
|
|
243
|
+
* @param {object|null} [options] May carry `output` to select a representation.
|
|
244
|
+
* @returns {CjsFormatRoute|null} The chosen route.
|
|
245
|
+
*/
|
|
246
|
+
Resolve(extension, data, options = null) {
|
|
247
|
+
let candidates = this.#byExtension.get(normalizeResourceExtension(extension)) || [];
|
|
248
|
+
const output = options?.output || null;
|
|
249
|
+
if (output) {
|
|
250
|
+
candidates = candidates.filter(route => route.output === output || route.output === null && routeDeclaresOutput(route, output));
|
|
251
|
+
// A requested output nothing was registered for is a miss, not a reason
|
|
252
|
+
// to fall back to a route that produces something else entirely.
|
|
253
|
+
if (candidates.length === 0) return null;
|
|
254
|
+
candidates = candidates.map(route => pinRouteOutput(route, output));
|
|
255
|
+
}
|
|
256
|
+
if (candidates.length === 0) return null;
|
|
257
|
+
if (candidates.length === 1) return candidates[0];
|
|
258
|
+
if (data === undefined) return candidates[0];
|
|
259
|
+
return candidates.find(route => route.Accepts(data)) || null;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/** Every extension the store can route, sorted. */
|
|
263
|
+
Extensions() {
|
|
264
|
+
return [...this.#byExtension.keys()].sort();
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
/** Forget every registration. */
|
|
268
|
+
Clear() {
|
|
269
|
+
this.#byExtension.clear();
|
|
270
|
+
return this;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* Whether two routes are the same registration.
|
|
276
|
+
*
|
|
277
|
+
* Same format but a different reader or output is a DIFFERENT route, which is
|
|
278
|
+
* how one format serves `.gr2` and `.gsf`, or serves `.dds` as both a
|
|
279
|
+
* compressed texture and decoded RGBA.
|
|
280
|
+
*/
|
|
281
|
+
function isSameRoute(left, right) {
|
|
282
|
+
return left.Format === right.Format && left.read === right.read && left.output === right.output && left.accepts === right.accepts;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Accept only the canonical boolean routing verdict.
|
|
287
|
+
*
|
|
288
|
+
* Requiring literal true prevents a stale report object from becoming an
|
|
289
|
+
* accidental match merely because objects are truthy.
|
|
290
|
+
*
|
|
291
|
+
* @param {*} report A routing verdict.
|
|
292
|
+
* @returns {boolean}
|
|
293
|
+
*/
|
|
294
|
+
function isPositiveProbe(report) {
|
|
295
|
+
return report === true;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
/** Whether an unpinned route's format can produce the requested output. */
|
|
299
|
+
function routeDeclaresOutput(route, output) {
|
|
300
|
+
return typeof route.Format.getOutputCapability === "function" ? route.Format.getOutputCapability(output) !== null : Object.hasOwn(route.Format.outputs || {}, output);
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/** Return a route that applies the output which selected an unpinned route. */
|
|
304
|
+
function pinRouteOutput(route, output) {
|
|
305
|
+
if (route.output === output) return route;
|
|
306
|
+
return new CjsFormatRoute(route.Format, {
|
|
307
|
+
read: route.read,
|
|
308
|
+
output,
|
|
309
|
+
accepts: route.accepts,
|
|
310
|
+
name: route.name
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
export { CjsFormatRoute, CjsFormatStore };
|
|
315
|
+
//# sourceMappingURL=CjsFormatStore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CjsFormatStore.js","sources":["../../../src/format/CjsFormatStore.js"],"sourcesContent":["import { normalizeResourceExtension } from \"@carbonenginejs/runtime-utils/path\";\r\n\r\n/**\r\n * One registered route: an extension, the format that reads it, the reader to\r\n * call, and the output to ask for.\r\n *\r\n * The unit is deliberately not a bare format class. A format class does not\r\n * answer the question \"how is this file read\", because three separate things\r\n * can vary independently and every one of them is live in this package:\r\n *\r\n * - **Several formats under one extension.** `.static` is read by both\r\n * `CjsStaticFormat` and `CjsSchemaBoundFormat`, and only content tells them\r\n * apart.\r\n * - **Several readers on one format, chosen by CONTENT.** `CjsGr2Format` reads\r\n * `.gr2` and `.gsf` through the same `readRawInput`, because they are the\r\n * same Granny container — the suffix only denotes what the root object holds.\r\n * `read` projects geometry and `readGsf` projects a state machine, and\r\n * `isGsf` is what actually tells them apart. The extension is a hint, not the\r\n * discriminator, which is why a route may carry its own `accepts` probe.\r\n * - **Several outputs from one reader.** `CjsDdsFormat` declares `texture`,\n * `image`, and `rgba` capability descriptors in `outputs` off a single\n * `read`, selected by `options.emit`.\n *\r\n * ccpwgl mapped one extension to one constructor and stopped, which is why\r\n * every one of those cases has to be hardcoded at a call site there. Naming the\r\n * route makes them registration data instead - and the resource that reads a\r\n * `.gsf` no longer has to know that the method is called `readGsf`.\r\n */\r\nclass CjsFormatRoute\r\n{\r\n constructor(Format, options = {})\r\n {\r\n this.Format = Format;\r\n this.read = options.read || \"read\";\r\n this.output = options.output || null;\r\n this.accepts = options.accepts || null;\r\n this.name = options.name || `${Format.name || \"format\"}.${this.read}`;\r\n\r\n if (typeof Format[this.read] !== \"function\")\r\n {\r\n throw new TypeError(\r\n `${Format.name || \"format\"} has no reader named ${JSON.stringify(this.read)}. `\r\n + \"A route names the entry point to call, so a misspelling here would \"\r\n + \"otherwise surface as a failed load of the first matching file.\"\r\n );\r\n }\r\n if (this.accepts !== null\r\n && typeof this.accepts !== \"function\"\r\n && typeof Format[this.accepts] !== \"function\")\r\n {\r\n throw new TypeError(\r\n `${Format.name || \"format\"} has no probe named ${JSON.stringify(this.accepts)}. `\r\n + \"A route's probe is what separates two readers over one container, so \"\r\n + \"a missing one would silently route every file to the first route.\"\r\n );\r\n }\r\n if (this.output && typeof Format.getOutputCapability === \"function\"\n && !Format.getOutputCapability(this.output))\n {\r\n throw new TypeError(\r\n `${Format.name || \"format\"} does not declare the output `\r\n + `${JSON.stringify(this.output)}; it declares `\r\n + `${Object.keys(Format.outputs || {}).map(value => JSON.stringify(value)).join(\", \")}.`\n );\r\n }\r\n Object.freeze(this);\r\n }\r\n\r\n /**\r\n * Whether this route recognises the data.\r\n *\r\n * The route's own probe answers when it has one, and it is the only thing\r\n * that can separate two readers over ONE container. `Format.is` says\n * \"yes, this is a Granny file\" for both a `.gr2` and a `.gsf`, because it is\r\n * — the question it answers is about the container, not about which\r\n * projection applies. `isGsf` is the question that matters there.\r\n *\r\n * Falling back to `Format.is` is right when the routes belong to\n * different formats, which is the `.static` case.\r\n *\r\n * A route with no probe at all answers yes: the extension already selected\r\n * it, and a format is entitled to reject its own file later with a better\r\n * message than a probe could give. A probe that throws has declined rather\r\n * than failed — probes read headers of files they may not own.\r\n */\r\n Accepts(data)\r\n {\r\n if (data === undefined) return true;\r\n const probe = typeof this.accepts === \"function\"\r\n ? this.accepts\r\n : this.accepts\r\n ? this.Format[this.accepts]\r\n : this.Format.is;\n if (typeof probe !== \"function\") return true;\r\n try { return isPositiveProbe(probe.call(this.Format, data)); }\r\n catch { return false; }\r\n }\r\n\r\n /**\r\n * Read data through this route.\r\n *\r\n * The registered output is applied as `emit` unless the caller names one,\r\n * which is what makes \"which representation of a DDS do we want\" a\r\n * registration decision rather than something every call site repeats.\r\n *\r\n * @param {*} data Source data.\r\n * @param {object|null} [options] Reader options; `emit` overrides the route's output.\r\n * @returns {*} Whatever the reader returns.\r\n */\r\n Read(data, options = null)\r\n {\r\n const values = { ...(options || {}) };\r\n if (this.output && values.emit === undefined) values.emit = this.output;\r\n return this.Format[this.read](data, values);\r\n }\r\n}\r\n\r\n/**\r\n * The link between a resource and the formats that can populate it.\r\n *\r\n * WHY THIS EXISTS RATHER THAN A RESOURCE IMPORTING ITS FORMATS. ccpwgl's\r\n * `Tw2TextureRes` imports its five texture formats directly, and that is a\r\n * reasonable shape for a bundled application. It is the wrong shape for a\r\n * library: every format here is an explicitly tree-shakeable subpath, so a\r\n * consumer that pulls in one texture resource must not thereby drag in DDS,\r\n * PNG, JPEG, TGA, GIF and WebP. A resource that imports its formats destroys\r\n * that, quietly and permanently.\r\n *\r\n * So nobody imports anybody. The composing application registers the routes it\r\n * actually wants, and both the manager and a resource loading itself ask the\r\n * store. That is also what makes \"which formats exist\" a property of the\r\n * composed application rather than a list baked into the loader.\r\n *\r\n * WHAT THE STORE DOES NOT OWN: which resource class a file becomes. That is\r\n * `CjsResMan.RegisterExtension`'s Handler, and duplicating it here would make\r\n * two registries disagree about one question. The store answers how bytes are\r\n * read; the manager answers what they become.\r\n *\r\n * ORDER IS THE CALLER'S. Registration order is retained per extension, because\r\n * where several routes answer for one suffix the caller's ordering is the\r\n * routing policy.\r\n */\r\nexport class CjsFormatStore\r\n{\r\n #byExtension = new Map();\r\n\r\n /**\r\n * Register a format, by default under every extension it declares.\r\n *\r\n * `Format.extensions` is a CONVENIENCE, not the routing authority. It exists\r\n * so a composition root can register a pile of formats without restating\r\n * what each one reads, and that is the whole of its job. The caller may name\r\n * extensions instead, and then the declaration is not consulted at all — a\r\n * format reading a suffix its author never anticipated is a deployment's\r\n * business, not the format's.\r\n *\r\n * That is also the only way to reach `webgl`, `webgpu` and `dxbc` through a\r\n * store. They declare nothing because their inputs are logical names rather\r\n * than file suffixes, which is a statement about what they read, not a bar on\r\n * an application routing a suffix to one of them.\r\n *\r\n * The second argument may be the extensions alone, or a route:\r\n *\r\n * ```js\r\n * store.Register(CjsPngFormat); // as declared\r\n * store.Register(CjsGr2Format, { extensions: \".gsf\", read: \"readGsf\" });\r\n * store.Register(CjsDdsFormat, { extensions: \".dds\", output: \"texture\" });\r\n * ```\r\n *\r\n * Registering the same route twice under one extension is a no-op, so a\r\n * composition root may register defensively. Two routes over the same format\r\n * that differ in reader or output are NOT duplicates — that is the whole\r\n * point of naming them.\r\n *\r\n * @param {Function} Format Format class.\r\n * @param {string|string[]|object|null} [options] Extensions, or a route descriptor.\r\n * @returns {CjsFormatStore} This store.\r\n */\r\n Register(Format, options = null)\r\n {\r\n if (typeof Format !== \"function\")\r\n {\r\n throw new TypeError(\"CjsFormatStore.Register requires a format class.\");\r\n }\r\n\r\n const settings = options === null || options === undefined\r\n ? {}\r\n : (typeof options === \"string\" || Array.isArray(options))\r\n ? { extensions: options }\r\n : options;\r\n\r\n const supplied = settings.extensions === undefined || settings.extensions === null\r\n ? null\r\n : Array.isArray(settings.extensions) ? settings.extensions : [ settings.extensions ];\r\n const declared = supplied || Format.extensions;\r\n if (!Array.isArray(declared) || declared.length === 0)\r\n {\r\n const name = Format.name || \"format\";\r\n const error = new Error(\r\n `${name} declares no extensions and none were supplied, so there is `\r\n + \"nothing to route it under. Pass the extensions this application \"\r\n + \"wants it to read: Register(Format, \\\".ext\\\"). Formats whose inputs \"\r\n + \"are logical names rather than file suffixes - webgl, webgpu, dxbc - \"\r\n + \"declare none, and are usually used directly instead.\"\r\n );\r\n error.code = \"CJS_FORMAT_STORE_NO_EXTENSIONS\";\r\n throw error;\r\n }\r\n\r\n const route = new CjsFormatRoute(Format, settings);\r\n for (const extension of declared)\r\n {\r\n const key = normalizeResourceExtension(extension);\r\n if (!key)\r\n {\r\n // An empty key would register silently and route nothing, which is the\r\n // worst of both outcomes: the caller believes the format is reachable.\r\n throw new TypeError(\r\n `CjsFormatStore.Register cannot route ${Format.name || \"a format\"} `\r\n + `under ${JSON.stringify(extension)}, which is not an extension.`\r\n );\r\n }\r\n const existing = this.#byExtension.get(key);\r\n if (!existing) this.#byExtension.set(key, [ route ]);\r\n else if (!existing.some(entry => isSameRoute(entry, route))) existing.push(route);\r\n }\r\n return this;\r\n }\r\n\r\n /**\r\n * Register several formats in caller order.\r\n *\r\n * An entry is either a format class, which registers under what it declares,\r\n * or a `[Format, extensionsOrRoute]` pair.\r\n *\r\n * @param {Iterable<Function|[Function, string|string[]|object]>} formats\r\n * @returns {CjsFormatStore} This store.\r\n */\r\n RegisterAll(formats)\r\n {\r\n for (const entry of formats || [])\r\n {\r\n if (Array.isArray(entry)) this.Register(entry[0], entry[1]);\r\n else this.Register(entry);\r\n }\r\n return this;\r\n }\r\n\r\n /**\r\n * Every route registered for an extension, in registration order.\r\n *\r\n * @param {string} extension\r\n * @returns {CjsFormatRoute[]} A copy; the store's own order is not exposed for mutation.\r\n */\r\n Get(extension)\r\n {\r\n return [ ...(this.#byExtension.get(normalizeResourceExtension(extension)) || []) ];\r\n }\r\n\r\n /**\r\n * Whether anything is registered for an extension.\r\n *\r\n * @param {string} extension\r\n * @returns {boolean}\r\n */\r\n Has(extension)\r\n {\r\n return this.#byExtension.has(normalizeResourceExtension(extension));\r\n }\r\n\r\n /**\r\n * The route that should read this data.\r\n *\r\n * Three filters apply in order, and each exists because something in this\r\n * package needs it:\r\n *\r\n * 1. **Extension** narrows to the routes registered for the suffix.\r\n * 2. **Output**, when the caller wants a particular representation, narrows\r\n * further and pins that output onto an otherwise unpinned route. A caller\r\n * asking for `texture` must not be handed the route registered to decode\r\n * the same file to `rgba`; resource requirements select classes instead.\r\n * 3. **Content** separates what remains, because with several candidates left\r\n * nothing else can. With exactly one the data is not consulted at all: the\r\n * extension already decided, and the format is entitled to reject its own\r\n * file with a better message than a probe could produce.\r\n *\r\n * Returns `null` rather than guessing when nothing matches, so the caller\r\n * reports what it could not read instead of handing bytes to a reader that\r\n * never claimed them.\r\n *\r\n * @param {string} extension\r\n * @param {*} [data] Data to probe when more than one route remains.\r\n * @param {object|null} [options] May carry `output` to select a representation.\r\n * @returns {CjsFormatRoute|null} The chosen route.\r\n */\r\n Resolve(extension, data, options = null)\r\n {\r\n let candidates = this.#byExtension.get(normalizeResourceExtension(extension)) || [];\r\n\r\n const output = options?.output || null;\r\n if (output)\r\n {\r\n candidates = candidates.filter(route => route.output === output\r\n || (route.output === null && routeDeclaresOutput(route, output)));\r\n // A requested output nothing was registered for is a miss, not a reason\r\n // to fall back to a route that produces something else entirely.\r\n if (candidates.length === 0) return null;\r\n candidates = candidates.map(route => pinRouteOutput(route, output));\r\n }\r\n\r\n if (candidates.length === 0) return null;\r\n if (candidates.length === 1) return candidates[0];\r\n if (data === undefined) return candidates[0];\r\n\r\n return candidates.find(route => route.Accepts(data)) || null;\r\n }\r\n\r\n /** Every extension the store can route, sorted. */\r\n Extensions()\r\n {\r\n return [ ...this.#byExtension.keys() ].sort();\r\n }\r\n\r\n /** Forget every registration. */\r\n Clear()\r\n {\r\n this.#byExtension.clear();\r\n return this;\r\n }\r\n}\r\n\r\n/**\r\n * Whether two routes are the same registration.\r\n *\r\n * Same format but a different reader or output is a DIFFERENT route, which is\r\n * how one format serves `.gr2` and `.gsf`, or serves `.dds` as both a\r\n * compressed texture and decoded RGBA.\r\n */\r\nfunction isSameRoute(left, right)\r\n{\r\n return left.Format === right.Format\r\n && left.read === right.read\r\n && left.output === right.output\r\n && left.accepts === right.accepts;\r\n}\r\n\r\n/**\r\n * Accept only the canonical boolean routing verdict.\r\n *\r\n * Requiring literal true prevents a stale report object from becoming an\r\n * accidental match merely because objects are truthy.\r\n *\r\n * @param {*} report A routing verdict.\r\n * @returns {boolean}\r\n */\r\nfunction isPositiveProbe(report)\n{\n return report === true;\n}\n\r\n/** Whether an unpinned route's format can produce the requested output. */\r\nfunction routeDeclaresOutput(route, output)\n{\n return typeof route.Format.getOutputCapability === \"function\"\n ? route.Format.getOutputCapability(output) !== null\n : Object.hasOwn(route.Format.outputs || {}, output);\n}\r\n\r\n/** Return a route that applies the output which selected an unpinned route. */\r\nfunction pinRouteOutput(route, output)\r\n{\r\n if (route.output === output) return route;\r\n return new CjsFormatRoute(route.Format, {\r\n read: route.read,\r\n output,\r\n accepts: route.accepts,\r\n name: route.name\r\n });\r\n}\r\n\r\nexport { CjsFormatRoute };\r\nexport default CjsFormatStore;\r\n"],"names":["CjsFormatRoute","constructor","Format","options","read","output","accepts","name","TypeError","JSON","stringify","getOutputCapability","Object","keys","outputs","map","value","join","freeze","Accepts","data","undefined","probe","is","isPositiveProbe","call","Read","values","emit","CjsFormatStore","Map","Register","settings","Array","isArray","extensions","supplied","declared","length","error","Error","code","route","extension","key","normalizeResourceExtension","existing","get","set","some","entry","isSameRoute","push","RegisterAll","formats","Get","Has","has","Resolve","candidates","filter","routeDeclaresOutput","pinRouteOutput","find","Extensions","sort","Clear","clear","left","right","report","hasOwn"],"mappings":";;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,cAAc,CACpB;AACEC,EAAAA,WAAWA,CAACC,MAAM,EAAEC,OAAO,GAAG,EAAE,EAChC;IACE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