@carbonenginejs/runtime-resource 0.19.2 → 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 +90 -12
- package/dist/formats/webgl/core/glsl/DxbcGlslEmitter.js.map +1 -1
- package/dist/formats/webgl/core/helpers.js +2 -2
- package/dist/formats/webgl/core/helpers.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
package/dist/format/CjsFormat.js
CHANGED
|
@@ -1,224 +1,453 @@
|
|
|
1
1
|
import { MediaType, PayloadType } from '@carbonenginejs/runtime-utils/media';
|
|
2
|
-
import { CjsResourceProbe as _CjsResourceProbe } from './CjsResourceProbe.js';
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
const OUTPUT_ROLE_RUNTIME = "runtime";
|
|
4
|
+
const OUTPUT_ROLE_DEBUG = "debug";
|
|
5
|
+
const READ_MODE_SYNC = "sync";
|
|
6
|
+
const READ_MODE_ASYNC = "async";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Decorator-free base for every concrete format facade.
|
|
10
|
+
*
|
|
11
|
+
* The format subpaths must remain directly importable from authored source, so
|
|
12
|
+
* this base deliberately does not import the decorated CjsResourceProbe model.
|
|
13
|
+
* Formats return plain support reports; CjsResourceProbe.from() is the optional
|
|
14
|
+
* resource-layer normalization boundary.
|
|
8
15
|
*/
|
|
9
16
|
class CjsFormat {
|
|
10
17
|
options = {};
|
|
18
|
+
constructor(options = null) {
|
|
19
|
+
this.options = {
|
|
20
|
+
...(options || {})
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** Apply caller-provided instance defaults. */
|
|
25
|
+
SetValues(values = null) {
|
|
26
|
+
this.options = {
|
|
27
|
+
...this.options,
|
|
28
|
+
...(values || {})
|
|
29
|
+
};
|
|
30
|
+
return this;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** Return caller-provided instance defaults. */
|
|
34
|
+
GetValues() {
|
|
35
|
+
return {
|
|
36
|
+
...this.options
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** Read through the concrete instance implementation. */
|
|
41
|
+
Read(_input, _options = null) {
|
|
42
|
+
const error = new Error(`${this.constructor.name}.Read is not implemented.`);
|
|
43
|
+
error.code = "CJS_FORMAT_READ_NOT_IMPLEMENTED";
|
|
44
|
+
throw error;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** Async instance read; synchronous readers inherit this exact fallback. */
|
|
48
|
+
async ReadAsync(input, options = null) {
|
|
49
|
+
return this.Read(input, options);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** Inspect with the instance's normalized options when available. */
|
|
53
|
+
Inspect(input, options = null) {
|
|
54
|
+
const values = typeof this.GetValues === "function" ? this.GetValues(options || {}) : options || {};
|
|
55
|
+
return this.constructor.inspect(input, values);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** Return the cheap, unverified support report for this instance profile. */
|
|
59
|
+
GetSupport(input, options = null) {
|
|
60
|
+
const values = typeof this.GetValues === "function" ? this.GetValues(options || {}) : options || {};
|
|
61
|
+
return this.constructor.getSupport(input, values);
|
|
62
|
+
}
|
|
11
63
|
|
|
12
|
-
/**
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
64
|
+
/** Exercise one exact output through the real asynchronous read path. */
|
|
65
|
+
VerifySupport(input, options = null) {
|
|
66
|
+
const values = typeof this.GetValues === "function" ? this.GetValues(options || {}) : options || {};
|
|
67
|
+
return this.constructor.verifySupport(input, values);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Static read boundary. Concrete formats normally override this; the base
|
|
72
|
+
* fallback supports the few formats implemented only as instance readers.
|
|
19
73
|
*/
|
|
20
74
|
static read(input, options = null) {
|
|
21
75
|
const reader = new this(options || {});
|
|
76
|
+
if (reader.Read === CjsFormat.prototype.Read) {
|
|
77
|
+
const error = new Error(`${this.name}.read is not implemented.`);
|
|
78
|
+
error.code = "CJS_FORMAT_READ_NOT_IMPLEMENTED";
|
|
79
|
+
throw error;
|
|
80
|
+
}
|
|
22
81
|
return reader.Read(input, options || {});
|
|
23
82
|
}
|
|
24
83
|
|
|
25
|
-
/**
|
|
26
|
-
* Async convenience factory for format readers.
|
|
27
|
-
*
|
|
28
|
-
* @param {*} input
|
|
29
|
-
* @param {object} options
|
|
30
|
-
* @returns {Promise<*>}
|
|
31
|
-
*/
|
|
84
|
+
/** Async read boundary used by support verification and resource loading. */
|
|
32
85
|
static async readAsync(input, options = null) {
|
|
86
|
+
if (Object.hasOwn(this, "read")) return this.read(input, options || {});
|
|
33
87
|
const reader = new this(options || {});
|
|
34
88
|
return reader.ReadAsync(input, options || {});
|
|
35
89
|
}
|
|
36
90
|
|
|
37
|
-
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* @param {object} options
|
|
43
|
-
* @returns {CjsResourceProbe}
|
|
44
|
-
*/
|
|
45
|
-
static isSupported(input, options = null) {
|
|
46
|
-
const source = typeof input === "string" ? "path" : "buffer";
|
|
47
|
-
const formatName = this.name ? this.name.replace(/^Cjs/u, "").replace(/Format$/u, "").toLowerCase() : "format";
|
|
48
|
-
return _CjsResourceProbe.createUnsupported(formatName, "No probe implementation.", {
|
|
49
|
-
source,
|
|
50
|
-
...options
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Alias for canonical naming.
|
|
56
|
-
*
|
|
57
|
-
* @param {*} input
|
|
58
|
-
* @param {object} options
|
|
59
|
-
* @returns {CjsResourceProbe}
|
|
60
|
-
*/
|
|
61
|
-
static inspect(input, options = null) {
|
|
62
|
-
return this.isSupported(input, options);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Content-verified type/route resolution (optional per format).
|
|
67
|
-
* Contract: docs/concepts/format-type-resolution.md.
|
|
68
|
-
*
|
|
69
|
-
* Where inspect()/isSupported() report what the container CLAIMS,
|
|
70
|
-
* resolveType() performs one bounded asynchronous content check (magic, a
|
|
71
|
-
* first frame/block, a setup header) and reports what the reader has
|
|
72
|
-
* evidence it can actually decode. Overrides return a CjsResourceProbe
|
|
73
|
-
* with `verified: true` and declared/resolved/mismatch evidence in
|
|
74
|
-
* `metadata`; `preferred` names the resolved decode route. A caller-forced
|
|
75
|
-
* emit always wins over a resolution, and this base implementation - the
|
|
76
|
-
* zero-extra-work path for formats without an override - delegates to
|
|
77
|
-
* isSupported() with `verified` false so an unverified result never
|
|
78
|
-
* changes a route.
|
|
79
|
-
*
|
|
80
|
-
* @param {*} input Bytes (or path where the format supports it).
|
|
81
|
-
* @param {object|null} options Format options.
|
|
82
|
-
* @returns {Promise<CjsResourceProbe>} Probe report; content-verified only when overridden.
|
|
91
|
+
/**
|
|
92
|
+
* Synchronous structural metadata accessor.
|
|
93
|
+
*
|
|
94
|
+
* Inspection answers what the input is. It does not claim that any decoder
|
|
95
|
+
* output works in the current environment.
|
|
83
96
|
*/
|
|
84
|
-
static
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
|
|
97
|
+
static inspect(_input, _options = null) {
|
|
98
|
+
const error = new Error(`${this.name}.inspect is not implemented.`);
|
|
99
|
+
error.code = "CJS_FORMAT_INSPECT_NOT_IMPLEMENTED";
|
|
100
|
+
throw error;
|
|
88
101
|
}
|
|
89
102
|
|
|
90
|
-
/**
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
103
|
+
/** Cheap synchronous identification used only for route selection. */
|
|
104
|
+
static is(input, options = null) {
|
|
105
|
+
try {
|
|
106
|
+
if (Object.hasOwn(this, "probeSupport")) {
|
|
107
|
+
return recognizesProbe(this.probeSupport(input, options || {}));
|
|
108
|
+
}
|
|
109
|
+
this.inspect(input, options || {});
|
|
110
|
+
return true;
|
|
111
|
+
} catch {
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
95
114
|
}
|
|
96
115
|
|
|
97
|
-
/**
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
116
|
+
/**
|
|
117
|
+
* Format-specific cheap support probe hook.
|
|
118
|
+
*
|
|
119
|
+
* Concrete formats may override this with header/environment reasoning. The
|
|
120
|
+
* public getSupport() method normalizes its result into the uniform contract.
|
|
121
|
+
*/
|
|
122
|
+
static probeSupport(input, options = null) {
|
|
123
|
+
try {
|
|
124
|
+
return {
|
|
125
|
+
format: this.id,
|
|
126
|
+
source: typeof input === "string" ? "path" : "buffer",
|
|
127
|
+
recognized: true,
|
|
128
|
+
metadata: this.inspect(input, options || {}),
|
|
129
|
+
reason: "Container structure recognized."
|
|
105
130
|
};
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
131
|
+
} catch (error) {
|
|
132
|
+
return {
|
|
133
|
+
format: this.id,
|
|
134
|
+
source: typeof input === "string" ? "path" : "buffer",
|
|
135
|
+
recognized: false,
|
|
136
|
+
metadata: null,
|
|
137
|
+
reason: error?.message || "Input was not recognized.",
|
|
138
|
+
errors: [error?.message || "Input was not recognized."]
|
|
110
139
|
};
|
|
111
140
|
}
|
|
112
|
-
return this;
|
|
113
141
|
}
|
|
114
142
|
|
|
115
|
-
/**
|
|
116
|
-
*
|
|
117
|
-
*
|
|
143
|
+
/**
|
|
144
|
+
* Cheap synchronous output support report.
|
|
145
|
+
*
|
|
146
|
+
* This is advisory: it may use headers, structure, and current environment
|
|
147
|
+
* features, but never claims that the decoder ran. Every output entry is
|
|
148
|
+
* therefore returned with verified:false.
|
|
118
149
|
*/
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}
|
|
150
|
+
static getSupport(input, options = null) {
|
|
151
|
+
const values = options && typeof options === "object" ? options : {};
|
|
152
|
+
let report;
|
|
153
|
+
try {
|
|
154
|
+
report = this.probeSupport(input, values);
|
|
155
|
+
} catch (error) {
|
|
156
|
+
report = {
|
|
157
|
+
format: this.id,
|
|
158
|
+
source: typeof input === "string" ? "path" : "buffer",
|
|
159
|
+
recognized: false,
|
|
160
|
+
reason: error?.message || "Support probe failed.",
|
|
161
|
+
errors: [error?.message || "Support probe failed."]
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
return normalizeSupportReport(this, report, values);
|
|
125
165
|
}
|
|
126
166
|
|
|
127
|
-
/**
|
|
128
|
-
*
|
|
129
|
-
*
|
|
167
|
+
/**
|
|
168
|
+
* Prove one exact output by exercising the real asynchronous reader.
|
|
169
|
+
*
|
|
170
|
+
* This is an explicit diagnostic/capability operation. Normal resource
|
|
171
|
+
* loading calls readAsync() once and treats its successful result as proof;
|
|
172
|
+
* it must not verify and then decode the same payload a second time.
|
|
130
173
|
*/
|
|
131
|
-
|
|
132
|
-
|
|
174
|
+
static async verifySupport(input, options = null) {
|
|
175
|
+
const values = options && typeof options === "object" ? options : {};
|
|
176
|
+
const report = this.getSupport(input, values);
|
|
177
|
+
const capability = this.getOutputCapability(report.output);
|
|
178
|
+
if (!capability) {
|
|
179
|
+
const message = report.output ? `${this.name} declares no output ${JSON.stringify(report.output)}.` : `${this.name} declares no verifiable default output.`;
|
|
180
|
+
return Object.freeze({
|
|
181
|
+
...report,
|
|
182
|
+
supported: false,
|
|
183
|
+
verified: true,
|
|
184
|
+
reason: message,
|
|
185
|
+
error: Object.freeze({
|
|
186
|
+
name: "Error",
|
|
187
|
+
code: "CJS_FORMAT_OUTPUT_UNDECLARED",
|
|
188
|
+
message
|
|
189
|
+
})
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
try {
|
|
193
|
+
await this.readAsync(input, {
|
|
194
|
+
...values,
|
|
195
|
+
emit: capability.output
|
|
196
|
+
});
|
|
197
|
+
return freezeVerification(report, capability, true, null);
|
|
198
|
+
} catch (error) {
|
|
199
|
+
return freezeVerification(report, capability, false, error);
|
|
200
|
+
}
|
|
133
201
|
}
|
|
134
202
|
|
|
135
|
-
/**
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
203
|
+
/** Return the canonical declaration for one output selector. */
|
|
204
|
+
static getOutputCapability(output = null) {
|
|
205
|
+
if (!output) {
|
|
206
|
+
return Object.values(this.outputs).find(entry => entry.default) || null;
|
|
207
|
+
}
|
|
208
|
+
const normalized = String(output).toLowerCase();
|
|
209
|
+
return Object.values(this.outputs).find(entry => entry.output.toLowerCase() === normalized) || null;
|
|
141
210
|
}
|
|
142
211
|
|
|
143
|
-
/**
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
212
|
+
/** Freeze and validate one format's authoritative output map. */
|
|
213
|
+
static defineOutputs(definitions = {}) {
|
|
214
|
+
if (!definitions || typeof definitions !== "object" || Array.isArray(definitions)) {
|
|
215
|
+
throw new TypeError("CjsFormat.defineOutputs requires an object map.");
|
|
216
|
+
}
|
|
217
|
+
const outputs = {};
|
|
218
|
+
let defaults = 0;
|
|
219
|
+
for (const [output, definition] of Object.entries(definitions)) {
|
|
220
|
+
if (!output || !definition || typeof definition !== "object" || Array.isArray(definition)) {
|
|
221
|
+
throw new TypeError("Each format output requires a non-empty name and descriptor.");
|
|
222
|
+
}
|
|
223
|
+
const role = definition.role || OUTPUT_ROLE_RUNTIME;
|
|
224
|
+
const readMode = definition.readMode || READ_MODE_SYNC;
|
|
225
|
+
if (![OUTPUT_ROLE_RUNTIME, OUTPUT_ROLE_DEBUG].includes(role)) {
|
|
226
|
+
throw new TypeError(`Format output ${output} has invalid role ${JSON.stringify(role)}.`);
|
|
227
|
+
}
|
|
228
|
+
if (![READ_MODE_SYNC, READ_MODE_ASYNC].includes(readMode)) {
|
|
229
|
+
throw new TypeError(`Format output ${output} has invalid readMode ${JSON.stringify(readMode)}.`);
|
|
230
|
+
}
|
|
231
|
+
if (definition.default === true) defaults++;
|
|
232
|
+
const probes = definition.probes ?? definition.probe ?? output;
|
|
233
|
+
outputs[output] = Object.freeze({
|
|
234
|
+
output,
|
|
235
|
+
payloadType: definition.payloadType || output,
|
|
236
|
+
role,
|
|
237
|
+
readMode,
|
|
238
|
+
decoded: definition.decoded === true,
|
|
239
|
+
passthrough: definition.passthrough === true,
|
|
240
|
+
default: definition.default === true,
|
|
241
|
+
probes: Object.freeze((Array.isArray(probes) ? probes : [probes]).map(String)),
|
|
242
|
+
requires: Object.freeze([...(definition.requires || [])])
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
if (defaults > 1) throw new TypeError("A format may declare only one default output.");
|
|
246
|
+
if (Object.keys(outputs).length > 0 && defaults !== 1) {
|
|
247
|
+
throw new TypeError("A format with outputs must declare exactly one default output.");
|
|
248
|
+
}
|
|
249
|
+
return Object.freeze(outputs);
|
|
149
250
|
}
|
|
150
251
|
|
|
151
|
-
/**
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
252
|
+
/** Assert the canonical format surface without requiring optional outputs. */
|
|
253
|
+
static validateContract(Constructor) {
|
|
254
|
+
if (typeof Constructor !== "function" || !(Constructor.prototype instanceof CjsFormat)) {
|
|
255
|
+
throw new TypeError("CjsFormat.validateContract requires a CjsFormat subclass.");
|
|
256
|
+
}
|
|
257
|
+
if (typeof Constructor.id !== "string" || !Constructor.id) {
|
|
258
|
+
throw new TypeError(`${Constructor.name} must declare a non-empty id.`);
|
|
259
|
+
}
|
|
260
|
+
if (!Array.isArray(Constructor.mediaTypes) || Constructor.mediaTypes.length === 0 || !Object.isFrozen(Constructor.mediaTypes)) {
|
|
261
|
+
throw new TypeError(`${Constructor.name} must declare frozen non-empty mediaTypes.`);
|
|
262
|
+
}
|
|
263
|
+
for (const mediaType of Constructor.mediaTypes) {
|
|
264
|
+
if (!Object.values(MediaType).includes(mediaType)) {
|
|
265
|
+
throw new TypeError(`${Constructor.name} media type ${JSON.stringify(mediaType)} is not canonical.`);
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
if (!Array.isArray(Constructor.extensions) || !Object.isFrozen(Constructor.extensions)) {
|
|
269
|
+
throw new TypeError(`${Constructor.name} must declare frozen extensions.`);
|
|
270
|
+
}
|
|
271
|
+
if (!Constructor.outputs || typeof Constructor.outputs !== "object" || Array.isArray(Constructor.outputs) || !Object.isFrozen(Constructor.outputs)) {
|
|
272
|
+
throw new TypeError(`${Constructor.name} must declare frozen outputs.`);
|
|
273
|
+
}
|
|
274
|
+
if (typeof Constructor.requestResponseType !== "string" || !Constructor.requestResponseType) {
|
|
275
|
+
throw new TypeError(`${Constructor.name} must declare a requestResponseType.`);
|
|
276
|
+
}
|
|
277
|
+
if (Constructor.worker !== null) {
|
|
278
|
+
if (!Constructor.worker || typeof Constructor.worker !== "object" || !Object.isFrozen(Constructor.worker)) {
|
|
279
|
+
throw new TypeError(`${Constructor.name}.worker must be null or a frozen descriptor.`);
|
|
280
|
+
}
|
|
281
|
+
if (typeof Constructor.worker.module !== "string" || !Constructor.worker.module || typeof Constructor.worker.exportName !== "string" || !Constructor.worker.exportName || !Array.isArray(Constructor.worker.outputTypes) || !Object.isFrozen(Constructor.worker.outputTypes)) {
|
|
282
|
+
throw new TypeError(`${Constructor.name}.worker has an invalid execution descriptor.`);
|
|
283
|
+
}
|
|
284
|
+
for (const output of Constructor.worker.outputTypes) {
|
|
285
|
+
if (!Constructor.getOutputCapability(output)) {
|
|
286
|
+
throw new TypeError(`${Constructor.name}.worker names undeclared output ${JSON.stringify(output)}.`);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
if (Constructor.worker.defaultOutput && !Constructor.getOutputCapability(Constructor.worker.defaultOutput)) {
|
|
290
|
+
throw new TypeError(`${Constructor.name}.worker names an undeclared default output.`);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
for (const retired of ["type", "inputTypes", "outputTypes", "debugOutputTypes", "implementationStatus"]) {
|
|
294
|
+
if (Object.hasOwn(Constructor, retired)) {
|
|
295
|
+
throw new TypeError(`${Constructor.name} must not declare retired static ${retired}.`);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
let defaults = 0;
|
|
299
|
+
for (const [output, capability] of Object.entries(Constructor.outputs)) {
|
|
300
|
+
if (!Object.isFrozen(capability)) {
|
|
301
|
+
throw new TypeError(`${Constructor.name} output capabilities must be frozen.`);
|
|
302
|
+
}
|
|
303
|
+
if (capability.output !== output) {
|
|
304
|
+
throw new TypeError(`${Constructor.name} output ${output} has a mismatched descriptor.`);
|
|
305
|
+
}
|
|
306
|
+
if (capability.default) defaults++;
|
|
307
|
+
}
|
|
308
|
+
if (Object.keys(Constructor.outputs).length > 0 && defaults !== 1) {
|
|
309
|
+
throw new TypeError(`${Constructor.name} must declare exactly one default output.`);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
157
312
|
static Type = MediaType;
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* Canonical media-type groups used by format registration - the shared
|
|
161
|
-
* runtime-utils MediaType object (see Type above).
|
|
162
|
-
*/
|
|
163
313
|
static MediaType = MediaType;
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
* Canonical output-type tokens used by format emit contracts. Shared
|
|
167
|
-
* payload ROLES come from runtime-utils PayloadType; the remaining tokens
|
|
168
|
-
* (cmf/gr2/json/pcm/rgba/shared/objJson) are format-emit names owned by
|
|
169
|
-
* their formats and enumerated here for discoverability only.
|
|
170
|
-
*/
|
|
171
314
|
static OutputType = Object.freeze({
|
|
172
315
|
AUDIO: PayloadType.AUDIO,
|
|
173
316
|
CMF: "cmf",
|
|
317
|
+
DOCUMENT: "document",
|
|
174
318
|
GR2: "gr2",
|
|
175
319
|
IMAGE: PayloadType.IMAGE,
|
|
176
320
|
JSON: "json",
|
|
321
|
+
MEDIA: "media",
|
|
322
|
+
METADATA: "metadata",
|
|
323
|
+
OGG: "ogg",
|
|
324
|
+
PAYLOAD: "payload",
|
|
177
325
|
PCM: "pcm",
|
|
178
326
|
RAW: PayloadType.RAW,
|
|
179
327
|
RGBA: "rgba",
|
|
328
|
+
RUNTIME: "runtime",
|
|
180
329
|
SCHEMA: PayloadType.SCHEMA,
|
|
181
330
|
SHADER: PayloadType.SHADER,
|
|
182
331
|
SHARED: "shared",
|
|
183
332
|
TEXTURE: PayloadType.TEXTURE,
|
|
184
|
-
VIDEO: PayloadType.VIDEO
|
|
185
|
-
OBJ_JSON: "objJson"
|
|
333
|
+
VIDEO: PayloadType.VIDEO
|
|
186
334
|
});
|
|
187
|
-
static
|
|
335
|
+
static id = "";
|
|
188
336
|
static mediaTypes = Object.freeze([]);
|
|
189
|
-
static
|
|
190
|
-
static
|
|
191
|
-
static
|
|
192
|
-
|
|
193
|
-
/**
|
|
194
|
-
* Optional browser-worker module declaration.
|
|
195
|
-
*
|
|
196
|
-
* Concrete formats opt in with their exact `import.meta.url`, export name,
|
|
197
|
-
* and optional clone-safe output restrictions.
|
|
198
|
-
*/
|
|
337
|
+
static extensions = Object.freeze([]);
|
|
338
|
+
static outputs = Object.freeze({});
|
|
339
|
+
static requestResponseType = "arraybuffer";
|
|
199
340
|
static worker = null;
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
const
|
|
213
|
-
const
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
341
|
+
}
|
|
342
|
+
function normalizeSupportReport(Format, rawReport, options) {
|
|
343
|
+
const raw = typeof rawReport === "boolean" ? {
|
|
344
|
+
recognized: rawReport,
|
|
345
|
+
supported: rawReport
|
|
346
|
+
} : rawReport && typeof rawReport === "object" ? rawReport : {};
|
|
347
|
+
const requested = options.emit ?? null;
|
|
348
|
+
const capability = Format.getOutputCapability(requested);
|
|
349
|
+
const legacyVariants = Array.isArray(raw.variants) ? raw.variants : [];
|
|
350
|
+
const rawPositive = raw.supported === true || raw.supported === "full" || raw.supported === "partial";
|
|
351
|
+
const recognized = raw.recognized === true || raw.recognized !== false && (raw.metadata != null || rawPositive);
|
|
352
|
+
const outputs = Object.values(Format.outputs).map(entry => {
|
|
353
|
+
const variant = findLegacyVariant(entry, legacyVariants);
|
|
354
|
+
const supported = variant ? variant.supported === true : recognized && (legacyVariants.length === 0 ? raw.supported !== false && raw.supported !== "none" : false);
|
|
355
|
+
return Object.freeze({
|
|
356
|
+
...entry,
|
|
357
|
+
supported,
|
|
358
|
+
verified: false,
|
|
359
|
+
codec: variant?.codec || "",
|
|
360
|
+
reason: variant?.reason || raw.reason || (supported ? "Output appears usable from structural evidence." : "Output was not supported by the structural probe."),
|
|
361
|
+
requires: Object.freeze([...(variant?.requires || entry.requires)])
|
|
362
|
+
});
|
|
363
|
+
});
|
|
364
|
+
const selected = capability ? outputs.find(entry => entry.output === capability.output) || null : null;
|
|
365
|
+
const preferredOutput = resolvePreferredOutput(raw.preferredOutput, outputs) || outputs.find(entry => entry.supported && entry.role === OUTPUT_ROLE_RUNTIME)?.output || outputs.find(entry => entry.supported)?.output || "";
|
|
366
|
+
return Object.freeze({
|
|
367
|
+
format: Format.id || raw.format || Format.name,
|
|
368
|
+
source: raw.source || options.source || "buffer",
|
|
369
|
+
recognized,
|
|
370
|
+
output: capability?.output || (requested == null ? "" : String(requested)),
|
|
371
|
+
supported: selected?.supported === true,
|
|
372
|
+
verified: false,
|
|
373
|
+
preferredOutput,
|
|
374
|
+
reason: selected?.reason || raw.reason || (recognized ? "Input recognized." : "Input not recognized."),
|
|
375
|
+
metadata: raw.metadata ?? null,
|
|
376
|
+
capability: selected,
|
|
377
|
+
outputs: Object.freeze(outputs),
|
|
378
|
+
warnings: Object.freeze([...(raw.warnings || [])]),
|
|
379
|
+
errors: Object.freeze([...(raw.errors || [])]),
|
|
380
|
+
error: null
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
function recognizesProbe(report) {
|
|
384
|
+
if (report === true) return true;
|
|
385
|
+
if (!report || typeof report !== "object" || report.recognized === false) return false;
|
|
386
|
+
return report.recognized === true || report.supported === true || report.supported === "full" || report.supported === "partial" || report.metadata != null;
|
|
387
|
+
}
|
|
388
|
+
function findLegacyVariant(capability, variants) {
|
|
389
|
+
const probes = new Set(capability.probes.map(value => value.toLowerCase()));
|
|
390
|
+
const matches = variants.filter(variant => {
|
|
391
|
+
for (const value of [variant?.output, variant?.kind, variant?.payloadType]) {
|
|
392
|
+
if (value != null && probes.has(String(value).toLowerCase())) return true;
|
|
219
393
|
}
|
|
394
|
+
return false;
|
|
395
|
+
});
|
|
396
|
+
const output = capability.output.toLowerCase();
|
|
397
|
+
return matches.find(variant => String(variant?.output || "").toLowerCase() === output) || matches.find(variant => String(variant?.kind || "").toLowerCase() === output) || matches.find(variant => String(variant?.payloadType || "").toLowerCase() === output) || matches.find(variant => variant.supported === true) || matches[0] || null;
|
|
398
|
+
}
|
|
399
|
+
function resolvePreferredOutput(preferredOutput, outputs) {
|
|
400
|
+
if (!preferredOutput) return "";
|
|
401
|
+
const normalized = String(preferredOutput).toLowerCase();
|
|
402
|
+
const direct = outputs.find(entry => entry.output.toLowerCase() === normalized);
|
|
403
|
+
return direct?.output || "";
|
|
404
|
+
}
|
|
405
|
+
function freezeVerification(report, capability, supported, error) {
|
|
406
|
+
const errorReport = error ? serializeError(error) : null;
|
|
407
|
+
const outputs = report.outputs.map(entry => entry.output === capability.output ? Object.freeze({
|
|
408
|
+
...entry,
|
|
409
|
+
supported,
|
|
410
|
+
verified: true,
|
|
411
|
+
reason: supported ? "The real asynchronous read path completed successfully." : errorReport.message
|
|
412
|
+
}) : entry);
|
|
413
|
+
return Object.freeze({
|
|
414
|
+
...report,
|
|
415
|
+
recognized: supported ? true : report.recognized,
|
|
416
|
+
supported,
|
|
417
|
+
verified: true,
|
|
418
|
+
reason: supported ? "The real asynchronous read path completed successfully." : errorReport.message,
|
|
419
|
+
capability: outputs.find(entry => entry.output === capability.output) || null,
|
|
420
|
+
outputs: Object.freeze(outputs),
|
|
421
|
+
errors: errorReport ? Object.freeze([...report.errors, errorReport.message]) : report.errors,
|
|
422
|
+
error: errorReport
|
|
423
|
+
});
|
|
424
|
+
}
|
|
425
|
+
function serializeError(error) {
|
|
426
|
+
const details = {};
|
|
427
|
+
for (const [key, value] of Object.entries(error || {})) {
|
|
428
|
+
if (["name", "code", "message", "cause"].includes(key)) continue;
|
|
429
|
+
details[key] = value;
|
|
220
430
|
}
|
|
431
|
+
return Object.freeze({
|
|
432
|
+
name: error?.name || "Error",
|
|
433
|
+
code: error?.code || "CJS_FORMAT_VERIFY_FAILED",
|
|
434
|
+
message: error?.message || String(error),
|
|
435
|
+
details: Object.freeze(details),
|
|
436
|
+
cause: error?.cause ? Object.freeze({
|
|
437
|
+
name: error.cause.name || "Error",
|
|
438
|
+
code: error.cause.code || "",
|
|
439
|
+
message: error.cause.message || String(error.cause)
|
|
440
|
+
}) : null
|
|
441
|
+
});
|
|
221
442
|
}
|
|
443
|
+
const CjsFormatOutputRole = Object.freeze({
|
|
444
|
+
RUNTIME: OUTPUT_ROLE_RUNTIME,
|
|
445
|
+
DEBUG: OUTPUT_ROLE_DEBUG
|
|
446
|
+
});
|
|
447
|
+
const CjsFormatReadMode = Object.freeze({
|
|
448
|
+
SYNC: READ_MODE_SYNC,
|
|
449
|
+
ASYNC: READ_MODE_ASYNC
|
|
450
|
+
});
|
|
222
451
|
|
|
223
|
-
export { CjsFormat };
|
|
452
|
+
export { CjsFormat, CjsFormatOutputRole, CjsFormatReadMode };
|
|
224
453
|
//# sourceMappingURL=CjsFormat.js.map
|