@carbonenginejs/runtime-resource 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/FORMAT-PROVENANCE.md +135 -0
- package/LICENSE +21 -0
- package/NOTICE +29 -0
- package/README.md +241 -0
- package/dist/CjsMotherLode.js +56 -0
- package/dist/CjsMotherLode.js.map +1 -0
- package/dist/CjsResMan.js +740 -0
- package/dist/CjsResMan.js.map +1 -0
- package/dist/CjsResManQueue.js +214 -0
- package/dist/CjsResManQueue.js.map +1 -0
- package/dist/CjsResource.js +366 -0
- package/dist/CjsResource.js.map +1 -0
- package/dist/CjsResourceSource.js +59 -0
- package/dist/CjsResourceSource.js.map +1 -0
- package/dist/_virtual/_rollupPluginBabelHelpers.js +153 -0
- package/dist/_virtual/_rollupPluginBabelHelpers.js.map +1 -0
- package/dist/format/CjsFormat.js +178 -0
- package/dist/format/CjsFormat.js.map +1 -0
- package/dist/format/CjsResourceProbe.js +269 -0
- package/dist/format/CjsResourceProbe.js.map +1 -0
- package/dist/format/payloadContract.js +173 -0
- package/dist/format/payloadContract.js.map +1 -0
- package/dist/formats/black/CjsBlackFormat.js +272 -0
- package/dist/formats/black/CjsBlackFormat.js.map +1 -0
- package/dist/formats/black/core/CjsBlackBinaryReader.js +153 -0
- package/dist/formats/black/core/CjsBlackBinaryReader.js.map +1 -0
- package/dist/formats/black/core/CjsBlackPropertyReaders.js +382 -0
- package/dist/formats/black/core/CjsBlackPropertyReaders.js.map +1 -0
- package/dist/formats/black/core/CjsBlackReader.js +760 -0
- package/dist/formats/black/core/CjsBlackReader.js.map +1 -0
- package/dist/formats/black/core/CjsBlackSchemaRegistry.js +433 -0
- package/dist/formats/black/core/CjsBlackSchemaRegistry.js.map +1 -0
- package/dist/formats/black/core/black-schema-v1-2026-07-11.json.js +4 -0
- package/dist/formats/black/core/black-schema-v1-2026-07-11.json.js.map +1 -0
- package/dist/formats/black/core/blackConstants.js +7 -0
- package/dist/formats/black/core/blackConstants.js.map +1 -0
- package/dist/formats/black/core/blackDefinitions.js +10 -0
- package/dist/formats/black/core/blackDefinitions.js.map +1 -0
- package/dist/formats/black/core/blackEnums.js +6 -0
- package/dist/formats/black/core/blackEnums.js.map +1 -0
- package/dist/formats/black/core/blackSchema.js +3 -0
- package/dist/formats/black/core/blackSchema.js.map +1 -0
- package/dist/formats/black/core/blackVersion.js +22 -0
- package/dist/formats/black/core/blackVersion.js.map +1 -0
- package/dist/formats/black/core/helpers.js +182 -0
- package/dist/formats/black/core/helpers.js.map +1 -0
- package/dist/formats/black/core/schema.js +4 -0
- package/dist/formats/black/core/schema.js.map +1 -0
- package/dist/formats/black/index.js +2 -0
- package/dist/formats/black/index.js.map +1 -0
- package/dist/formats/bnk/CjsBnkFormat.js +245 -0
- package/dist/formats/bnk/CjsBnkFormat.js.map +1 -0
- package/dist/formats/bnk/core/helpers.js +354 -0
- package/dist/formats/bnk/core/helpers.js.map +1 -0
- package/dist/formats/bnk/core/soundbanksInfo.js +246 -0
- package/dist/formats/bnk/core/soundbanksInfo.js.map +1 -0
- package/dist/formats/bnk/index.js +3 -0
- package/dist/formats/bnk/index.js.map +1 -0
- package/dist/formats/cmf/CjsCmfFormat.js +491 -0
- package/dist/formats/cmf/CjsCmfFormat.js.map +1 -0
- package/dist/formats/cmf/core/binary.js +118 -0
- package/dist/formats/cmf/core/binary.js.map +1 -0
- package/dist/formats/cmf/core/buffers.js +233 -0
- package/dist/formats/cmf/core/buffers.js.map +1 -0
- package/dist/formats/cmf/core/constants.js +47 -0
- package/dist/formats/cmf/core/constants.js.map +1 -0
- package/dist/formats/cmf/core/gr2Anim.js +453 -0
- package/dist/formats/cmf/core/gr2Anim.js.map +1 -0
- package/dist/formats/cmf/core/helpers.js +287 -0
- package/dist/formats/cmf/core/helpers.js.map +1 -0
- package/dist/formats/cmf/core/pack.js +276 -0
- package/dist/formats/cmf/core/pack.js.map +1 -0
- package/dist/formats/cmf/core/schema.js +364 -0
- package/dist/formats/cmf/core/schema.js.map +1 -0
- package/dist/formats/cmf/core/shared.js +268 -0
- package/dist/formats/cmf/core/shared.js.map +1 -0
- package/dist/formats/cmf/core/writer.js +517 -0
- package/dist/formats/cmf/core/writer.js.map +1 -0
- package/dist/formats/cmf/index.js +2 -0
- package/dist/formats/cmf/index.js.map +1 -0
- package/dist/formats/dds/CjsDdsFormat.js +187 -0
- package/dist/formats/dds/CjsDdsFormat.js.map +1 -0
- package/dist/formats/dds/core/helpers.js +812 -0
- package/dist/formats/dds/core/helpers.js.map +1 -0
- package/dist/formats/dds/index.js +2 -0
- package/dist/formats/dds/index.js.map +1 -0
- package/dist/formats/fbx/CjsFbxFormat.js +260 -0
- package/dist/formats/fbx/CjsFbxFormat.js.map +1 -0
- package/dist/formats/fbx/core/helpers.js +3901 -0
- package/dist/formats/fbx/core/helpers.js.map +1 -0
- package/dist/formats/fbx/index.js +2 -0
- package/dist/formats/fbx/index.js.map +1 -0
- package/dist/formats/flac/CjsFlacFormat.js +81 -0
- package/dist/formats/flac/CjsFlacFormat.js.map +1 -0
- package/dist/formats/flac/core/helpers.js +295 -0
- package/dist/formats/flac/core/helpers.js.map +1 -0
- package/dist/formats/flac/index.js +2 -0
- package/dist/formats/flac/index.js.map +1 -0
- package/dist/formats/gif/CjsGifFormat.js +81 -0
- package/dist/formats/gif/CjsGifFormat.js.map +1 -0
- package/dist/formats/gif/core/helpers.js +360 -0
- package/dist/formats/gif/core/helpers.js.map +1 -0
- package/dist/formats/gif/index.js +2 -0
- package/dist/formats/gif/index.js.map +1 -0
- package/dist/formats/gltf/CjsGltfFormat.js +284 -0
- package/dist/formats/gltf/CjsGltfFormat.js.map +1 -0
- package/dist/formats/gltf/core/helpers.js +292 -0
- package/dist/formats/gltf/core/helpers.js.map +1 -0
- package/dist/formats/gltf/core/json.js +79 -0
- package/dist/formats/gltf/core/json.js.map +1 -0
- package/dist/formats/gltf/core/parser.js +666 -0
- package/dist/formats/gltf/core/parser.js.map +1 -0
- package/dist/formats/gltf/core/targets.js +163 -0
- package/dist/formats/gltf/core/targets.js.map +1 -0
- package/dist/formats/gltf/index.js +2 -0
- package/dist/formats/gltf/index.js.map +1 -0
- package/dist/formats/index.js +23 -0
- package/dist/formats/index.js.map +1 -0
- package/dist/formats/jpeg/CjsJpegFormat.js +200 -0
- package/dist/formats/jpeg/CjsJpegFormat.js.map +1 -0
- package/dist/formats/jpeg/core/helpers.js +350 -0
- package/dist/formats/jpeg/core/helpers.js.map +1 -0
- package/dist/formats/jpeg/core/jpeg.js +377 -0
- package/dist/formats/jpeg/core/jpeg.js.map +1 -0
- package/dist/formats/jpeg/index.js +2 -0
- package/dist/formats/jpeg/index.js.map +1 -0
- package/dist/formats/mp3/CjsMp3Format.js +186 -0
- package/dist/formats/mp3/CjsMp3Format.js.map +1 -0
- package/dist/formats/mp3/core/helpers.js +338 -0
- package/dist/formats/mp3/core/helpers.js.map +1 -0
- package/dist/formats/mp3/index.js +2 -0
- package/dist/formats/mp3/index.js.map +1 -0
- package/dist/formats/mp4/CjsMp4Format.js +185 -0
- package/dist/formats/mp4/CjsMp4Format.js.map +1 -0
- package/dist/formats/mp4/core/helpers.js +449 -0
- package/dist/formats/mp4/core/helpers.js.map +1 -0
- package/dist/formats/mp4/index.js +2 -0
- package/dist/formats/mp4/index.js.map +1 -0
- package/dist/formats/obj/CjsObjFormat.js +247 -0
- package/dist/formats/obj/CjsObjFormat.js.map +1 -0
- package/dist/formats/obj/core/helpers.js +573 -0
- package/dist/formats/obj/core/helpers.js.map +1 -0
- package/dist/formats/obj/core/json.js +64 -0
- package/dist/formats/obj/core/json.js.map +1 -0
- package/dist/formats/obj/core/parser.js +321 -0
- package/dist/formats/obj/core/parser.js.map +1 -0
- package/dist/formats/obj/index.js +2 -0
- package/dist/formats/obj/index.js.map +1 -0
- package/dist/formats/ogg/CjsOggFormat.js +82 -0
- package/dist/formats/ogg/CjsOggFormat.js.map +1 -0
- package/dist/formats/ogg/core/helpers.js +387 -0
- package/dist/formats/ogg/core/helpers.js.map +1 -0
- package/dist/formats/ogg/core/imdct.js +178 -0
- package/dist/formats/ogg/core/imdct.js.map +1 -0
- package/dist/formats/ogg/core/vorbis.js +999 -0
- package/dist/formats/ogg/core/vorbis.js.map +1 -0
- package/dist/formats/ogg/index.js +2 -0
- package/dist/formats/ogg/index.js.map +1 -0
- package/dist/formats/png/CjsPngFormat.js +189 -0
- package/dist/formats/png/CjsPngFormat.js.map +1 -0
- package/dist/formats/png/core/helpers.js +583 -0
- package/dist/formats/png/core/helpers.js.map +1 -0
- package/dist/formats/png/index.js +2 -0
- package/dist/formats/png/index.js.map +1 -0
- package/dist/formats/red/CjsRedFormat.js +247 -0
- package/dist/formats/red/CjsRedFormat.js.map +1 -0
- package/dist/formats/red/core/CjsRedReader.js +201 -0
- package/dist/formats/red/core/CjsRedReader.js.map +1 -0
- package/dist/formats/red/core/blackDefinitions.js +3 -0
- package/dist/formats/red/core/blackDefinitions.js.map +1 -0
- package/dist/formats/red/core/helpers.js +136 -0
- package/dist/formats/red/core/helpers.js.map +1 -0
- package/dist/formats/red/core/redGraph.js +68 -0
- package/dist/formats/red/core/redGraph.js.map +1 -0
- package/dist/formats/red/core/schema.js +4 -0
- package/dist/formats/red/core/schema.js.map +1 -0
- package/dist/formats/red/index.js +2 -0
- package/dist/formats/red/index.js.map +1 -0
- package/dist/formats/stl/CjsStlFormat.js +304 -0
- package/dist/formats/stl/CjsStlFormat.js.map +1 -0
- package/dist/formats/stl/core/helpers.js +257 -0
- package/dist/formats/stl/core/helpers.js.map +1 -0
- package/dist/formats/stl/core/json.js +51 -0
- package/dist/formats/stl/core/json.js.map +1 -0
- package/dist/formats/stl/core/stl.js +544 -0
- package/dist/formats/stl/core/stl.js.map +1 -0
- package/dist/formats/stl/core/targets.js +163 -0
- package/dist/formats/stl/core/targets.js.map +1 -0
- package/dist/formats/stl/index.js +2 -0
- package/dist/formats/stl/index.js.map +1 -0
- package/dist/formats/tga/CjsTgaFormat.js +186 -0
- package/dist/formats/tga/CjsTgaFormat.js.map +1 -0
- package/dist/formats/tga/core/helpers.js +446 -0
- package/dist/formats/tga/core/helpers.js.map +1 -0
- package/dist/formats/tga/index.js +2 -0
- package/dist/formats/tga/index.js.map +1 -0
- package/dist/formats/wav/CjsWavFormat.js +186 -0
- package/dist/formats/wav/CjsWavFormat.js.map +1 -0
- package/dist/formats/wav/core/helpers.js +328 -0
- package/dist/formats/wav/core/helpers.js.map +1 -0
- package/dist/formats/wav/index.js +2 -0
- package/dist/formats/wav/index.js.map +1 -0
- package/dist/formats/webm/CjsWebmFormat.js +185 -0
- package/dist/formats/webm/CjsWebmFormat.js.map +1 -0
- package/dist/formats/webm/core/helpers.js +537 -0
- package/dist/formats/webm/core/helpers.js.map +1 -0
- package/dist/formats/webm/index.js +2 -0
- package/dist/formats/webm/index.js.map +1 -0
- package/dist/formats/webp/CjsWebpFormat.js +80 -0
- package/dist/formats/webp/CjsWebpFormat.js.map +1 -0
- package/dist/formats/webp/core/helpers.js +214 -0
- package/dist/formats/webp/core/helpers.js.map +1 -0
- package/dist/formats/webp/index.js +2 -0
- package/dist/formats/webp/index.js.map +1 -0
- package/dist/formats/wem/CjsWemFormat.js +197 -0
- package/dist/formats/wem/CjsWemFormat.js.map +1 -0
- package/dist/formats/wem/core/bitStream.js +259 -0
- package/dist/formats/wem/core/bitStream.js.map +1 -0
- package/dist/formats/wem/core/codebookLibrary.js +164 -0
- package/dist/formats/wem/core/codebookLibrary.js.map +1 -0
- package/dist/formats/wem/core/helpers.js +336 -0
- package/dist/formats/wem/core/helpers.js.map +1 -0
- package/dist/formats/wem/core/packedCodebooksAotuv603.js +30 -0
- package/dist/formats/wem/core/packedCodebooksAotuv603.js.map +1 -0
- package/dist/formats/wem/core/wemToOgg.js +485 -0
- package/dist/formats/wem/core/wemToOgg.js.map +1 -0
- package/dist/formats/wem/index.js +2 -0
- package/dist/formats/wem/index.js.map +1 -0
- package/dist/formats/yaml/CjsYamlFormat.js +77 -0
- package/dist/formats/yaml/CjsYamlFormat.js.map +1 -0
- package/dist/formats/yaml/core/CjsYamlReader.js +304 -0
- package/dist/formats/yaml/core/CjsYamlReader.js.map +1 -0
- package/dist/formats/yaml/core/helpers.js +160 -0
- package/dist/formats/yaml/core/helpers.js.map +1 -0
- package/dist/formats/yaml/index.js +2 -0
- package/dist/formats/yaml/index.js.map +1 -0
- package/dist/generated/resources/AudioGeometryResData.js +47 -0
- package/dist/generated/resources/AudioGeometryResData.js.map +1 -0
- package/dist/generated/resources/CmfVertexReader.js +46 -0
- package/dist/generated/resources/CmfVertexReader.js.map +1 -0
- package/dist/generated/resources/GStateBindingCallbackData.js +31 -0
- package/dist/generated/resources/GStateBindingCallbackData.js.map +1 -0
- package/dist/generated/resources/MeshDecalData.js +37 -0
- package/dist/generated/resources/MeshDecalData.js.map +1 -0
- package/dist/generated/resources/MeshDecalLodData.js +34 -0
- package/dist/generated/resources/MeshDecalLodData.js.map +1 -0
- package/dist/generated/resources/Tr2AsyncSave.js +46 -0
- package/dist/generated/resources/Tr2AsyncSave.js.map +1 -0
- package/dist/generated/resources/Tr2CmfContents.js +37 -0
- package/dist/generated/resources/Tr2CmfContents.js.map +1 -0
- package/dist/generated/resources/Tr2GrannyIntersectionResult.js +58 -0
- package/dist/generated/resources/Tr2GrannyIntersectionResult.js.map +1 -0
- package/dist/generated/resources/Tr2LoadPrepareFence.js +37 -0
- package/dist/generated/resources/Tr2LoadPrepareFence.js.map +1 -0
- package/dist/generated/resources/Tr2MaterialArea.js +34 -0
- package/dist/generated/resources/Tr2MaterialArea.js.map +1 -0
- package/dist/generated/resources/Tr2MaterialMesh.js +31 -0
- package/dist/generated/resources/Tr2MaterialMesh.js.map +1 -0
- package/dist/generated/resources/Tr2MaterialRes.js +34 -0
- package/dist/generated/resources/Tr2MaterialRes.js.map +1 -0
- package/dist/generated/resources/Tr2ShaderPermutation.js +43 -0
- package/dist/generated/resources/Tr2ShaderPermutation.js.map +1 -0
- package/dist/generated/resources/Tr2TextureLodManager.js +60 -0
- package/dist/generated/resources/Tr2TextureLodManager.js.map +1 -0
- package/dist/generated/resources/Tr2TextureLodUpdateRequest.js +37 -0
- package/dist/generated/resources/Tr2TextureLodUpdateRequest.js.map +1 -0
- package/dist/generated/resources/Tr2TexturePackChannel.js +37 -0
- package/dist/generated/resources/Tr2TexturePackChannel.js.map +1 -0
- package/dist/generated/resources/Tr2TexturePipeline.js +44 -0
- package/dist/generated/resources/Tr2TexturePipeline.js.map +1 -0
- package/dist/generated/resources/Tr2TexturePipelineParams.js +34 -0
- package/dist/generated/resources/Tr2TexturePipelineParams.js.map +1 -0
- package/dist/generated/resources/Tr2TexturePipelineStepCompress.js +40 -0
- package/dist/generated/resources/Tr2TexturePipelineStepCompress.js.map +1 -0
- package/dist/generated/resources/Tr2TexturePipelineStepLimitSize.js +34 -0
- package/dist/generated/resources/Tr2TexturePipelineStepLimitSize.js.map +1 -0
- package/dist/generated/resources/Tr2TexturePipelineStepLoad.js +31 -0
- package/dist/generated/resources/Tr2TexturePipelineStepLoad.js.map +1 -0
- package/dist/generated/resources/Tr2TexturePipelineStepPack.js +43 -0
- package/dist/generated/resources/Tr2TexturePipelineStepPack.js.map +1 -0
- package/dist/generated/resources/TriGeometryResAreaData.js +59 -0
- package/dist/generated/resources/TriGeometryResAreaData.js.map +1 -0
- package/dist/generated/resources/TriGeometryResJointData.js +38 -0
- package/dist/generated/resources/TriGeometryResJointData.js.map +1 -0
- package/dist/generated/resources/TriGeometryResLodData.js +88 -0
- package/dist/generated/resources/TriGeometryResLodData.js.map +1 -0
- package/dist/generated/resources/TriGeometryResMeshData.js +63 -0
- package/dist/generated/resources/TriGeometryResMeshData.js.map +1 -0
- package/dist/generated/resources/TriGeometryResSkeletonData.js +34 -0
- package/dist/generated/resources/TriGeometryResSkeletonData.js.map +1 -0
- package/dist/generated/resources/TriJointBinding.js +38 -0
- package/dist/generated/resources/TriJointBinding.js.map +1 -0
- package/dist/generated/resources/TriMorphTargetGeometryConstants.js +46 -0
- package/dist/generated/resources/TriMorphTargetGeometryConstants.js.map +1 -0
- package/dist/generated/resources/TriRtGeometryConstants.js +88 -0
- package/dist/generated/resources/TriRtGeometryConstants.js.map +1 -0
- package/dist/generated/resources/enums.js +18 -0
- package/dist/generated/resources/enums.js.map +1 -0
- package/dist/generated/resources/index.js +32 -0
- package/dist/generated/resources/index.js.map +1 -0
- package/dist/index.js +52 -0
- package/dist/index.js.map +1 -0
- package/dist/resourcePath.js +18 -0
- package/dist/resourcePath.js.map +1 -0
- package/dist/resourceStates.js +9 -0
- package/dist/resourceStates.js.map +1 -0
- package/dist/resources/Tr2EffectRes.js +71 -0
- package/dist/resources/Tr2EffectRes.js.map +1 -0
- package/dist/resources/Tr2GrannyStateRes.js +44 -0
- package/dist/resources/Tr2GrannyStateRes.js.map +1 -0
- package/dist/resources/Tr2ImageRes.js +114 -0
- package/dist/resources/Tr2ImageRes.js.map +1 -0
- package/dist/resources/Tr2LightProfileRes.js +40 -0
- package/dist/resources/Tr2LightProfileRes.js.map +1 -0
- package/dist/resources/TriGeometryRes.js +216 -0
- package/dist/resources/TriGeometryRes.js.map +1 -0
- package/dist/resources/TriGrannyRes.js +43 -0
- package/dist/resources/TriGrannyRes.js.map +1 -0
- package/dist/resources/TriTextureRes.js +304 -0
- package/dist/resources/TriTextureRes.js.map +1 -0
- package/dist/resources/resourceBoundary.js +47 -0
- package/dist/resources/resourceBoundary.js.map +1 -0
- package/dist/texture/CjsTextureArrayRes.js +406 -0
- package/dist/texture/CjsTextureArrayRes.js.map +1 -0
- package/dist/texture/CjsTextureParameterProxy.js +133 -0
- package/dist/texture/CjsTextureParameterProxy.js.map +1 -0
- package/format-notices/black/LICENSE +21 -0
- package/format-notices/black/NOTICE +47 -0
- package/format-notices/bnk/LICENSE +21 -0
- package/format-notices/bnk/NOTICE +17 -0
- package/format-notices/cmf/LICENSE +21 -0
- package/format-notices/cmf/NOTICE +36 -0
- package/format-notices/dds/LICENSE +21 -0
- package/format-notices/dds/NOTICE +14 -0
- package/format-notices/fbx/LICENSE +21 -0
- package/format-notices/fbx/NOTICE +14 -0
- package/format-notices/flac/LICENSE +21 -0
- package/format-notices/flac/NOTICE +14 -0
- package/format-notices/gif/LICENSE +21 -0
- package/format-notices/gif/NOTICE +14 -0
- package/format-notices/gltf/LICENSE +21 -0
- package/format-notices/gltf/NOTICE +27 -0
- package/format-notices/jpeg/LICENSE +21 -0
- package/format-notices/jpeg/NOTICE +14 -0
- package/format-notices/mp3/LICENSE +21 -0
- package/format-notices/mp3/NOTICE +14 -0
- package/format-notices/mp4/LICENSE +21 -0
- package/format-notices/mp4/NOTICE +14 -0
- package/format-notices/obj/LICENSE +21 -0
- package/format-notices/obj/NOTICE +26 -0
- package/format-notices/ogg/LICENSE +21 -0
- package/format-notices/ogg/NOTICE +28 -0
- package/format-notices/png/LICENSE +21 -0
- package/format-notices/png/NOTICE +14 -0
- package/format-notices/red/LICENSE +21 -0
- package/format-notices/red/NOTICE +31 -0
- package/format-notices/stl/LICENSE +21 -0
- package/format-notices/stl/NOTICE +21 -0
- package/format-notices/tga/LICENSE +21 -0
- package/format-notices/tga/NOTICE +14 -0
- package/format-notices/wav/LICENSE +21 -0
- package/format-notices/wav/NOTICE +14 -0
- package/format-notices/webm/LICENSE +21 -0
- package/format-notices/webm/NOTICE +14 -0
- package/format-notices/webp/LICENSE +21 -0
- package/format-notices/webp/NOTICE +14 -0
- package/format-notices/wem/LICENSE +57 -0
- package/format-notices/wem/NOTICE +33 -0
- package/format-notices/yaml/LICENSE +21 -0
- package/format-notices/yaml/NOTICE +44 -0
- package/package.json +51 -0
- package/resource-lifecycle.md +487 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { CjsYamlReader } from './core/CjsYamlReader.js';
|
|
2
|
+
import { DEFAULT_VALUES, normalizeValues, toJsonGraph, OUTPUT_RAW, OUTPUT_DOCUMENT, OUTPUT_JSON, OUTPUT_PAYLOAD, TAG_PRESERVE, TAG_REJECT, TAG_HANDLE } from './core/helpers.js';
|
|
3
|
+
|
|
4
|
+
const FORMAT_NAME = "CjsYamlFormat";
|
|
5
|
+
class CjsYamlFormat {
|
|
6
|
+
#values = DEFAULT_VALUES;
|
|
7
|
+
constructor(options = {}) {
|
|
8
|
+
this.SetValues(options);
|
|
9
|
+
}
|
|
10
|
+
SetValues(options = {}) {
|
|
11
|
+
this.#values = normalizeValues(this.#values, options, FORMAT_NAME);
|
|
12
|
+
return this;
|
|
13
|
+
}
|
|
14
|
+
GetValues(options = {}) {
|
|
15
|
+
return normalizeValues(this.#values, options, FORMAT_NAME);
|
|
16
|
+
}
|
|
17
|
+
Read(input, options = {}) {
|
|
18
|
+
return CjsYamlFormat.read(input, this.GetValues(options));
|
|
19
|
+
}
|
|
20
|
+
ReadPayload(input, options = {}) {
|
|
21
|
+
return CjsYamlFormat.readPayload(input, this.GetValues(options));
|
|
22
|
+
}
|
|
23
|
+
ReadRaw(input, options = {}) {
|
|
24
|
+
return CjsYamlFormat.readRaw(input, this.GetValues(options));
|
|
25
|
+
}
|
|
26
|
+
ReadDocument(input, options = {}) {
|
|
27
|
+
return CjsYamlFormat.readDocument(input, this.GetValues(options));
|
|
28
|
+
}
|
|
29
|
+
Inspect(input, options = {}) {
|
|
30
|
+
return CjsYamlFormat.inspect(input, this.GetValues(options));
|
|
31
|
+
}
|
|
32
|
+
ToJSON(value, options = {}) {
|
|
33
|
+
return toJsonGraph(value, this.GetValues(options));
|
|
34
|
+
}
|
|
35
|
+
static read(input, options = {}) {
|
|
36
|
+
const values = normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME);
|
|
37
|
+
if (values.emit === OUTPUT_RAW) return new CjsYamlReader(input, values).ReadRaw();
|
|
38
|
+
if (values.emit === OUTPUT_DOCUMENT) return new CjsYamlReader(input, values).ReadDocument();
|
|
39
|
+
return new CjsYamlReader(input, values).ReadPayload();
|
|
40
|
+
}
|
|
41
|
+
static readPayload(input, options = {}) {
|
|
42
|
+
const values = normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME);
|
|
43
|
+
return new CjsYamlReader(input, values).ReadPayload();
|
|
44
|
+
}
|
|
45
|
+
static readRaw(input, options = {}) {
|
|
46
|
+
const values = normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME);
|
|
47
|
+
return new CjsYamlReader(input, values).ReadRaw();
|
|
48
|
+
}
|
|
49
|
+
static readDocument(input, options = {}) {
|
|
50
|
+
const values = normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME);
|
|
51
|
+
return new CjsYamlReader(input, values).ReadDocument();
|
|
52
|
+
}
|
|
53
|
+
static inspect(input, options = {}) {
|
|
54
|
+
const values = normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME);
|
|
55
|
+
return new CjsYamlReader(input, values).Inspect();
|
|
56
|
+
}
|
|
57
|
+
static toJSON(value, options = {}) {
|
|
58
|
+
return toJsonGraph(value, normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME));
|
|
59
|
+
}
|
|
60
|
+
static OUTPUT_JSON = OUTPUT_JSON;
|
|
61
|
+
static OUTPUT_PAYLOAD = OUTPUT_PAYLOAD;
|
|
62
|
+
static OUTPUT_RAW = OUTPUT_RAW;
|
|
63
|
+
static OUTPUT_DOCUMENT = OUTPUT_DOCUMENT;
|
|
64
|
+
static TAG_PRESERVE = TAG_PRESERVE;
|
|
65
|
+
static TAG_REJECT = TAG_REJECT;
|
|
66
|
+
static TAG_HANDLE = TAG_HANDLE;
|
|
67
|
+
static id = "yaml";
|
|
68
|
+
static extensions = Object.freeze([".yaml", ".yml"]);
|
|
69
|
+
static type = Object.freeze(["data"]);
|
|
70
|
+
static mediaTypes = Object.freeze(["data"]);
|
|
71
|
+
static inputTypes = Object.freeze(["yaml"]);
|
|
72
|
+
static outputTypes = Object.freeze([OUTPUT_JSON, OUTPUT_PAYLOAD]);
|
|
73
|
+
static debugOutputTypes = Object.freeze([OUTPUT_RAW, OUTPUT_DOCUMENT]);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export { CjsYamlFormat, CjsYamlFormat as default };
|
|
77
|
+
//# sourceMappingURL=CjsYamlFormat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CjsYamlFormat.js","sources":["../../../../src/formats/yaml/CjsYamlFormat.js"],"sourcesContent":["import { CjsYamlReader } from \"./core/CjsYamlReader.js\";\nimport {\n DEFAULT_VALUES,\n OUTPUT_DOCUMENT,\n OUTPUT_JSON,\n OUTPUT_PAYLOAD,\n OUTPUT_RAW,\n TAG_HANDLE,\n TAG_PRESERVE,\n TAG_REJECT,\n normalizeValues,\n toJsonGraph\n} from \"./core/helpers.js\";\n\nconst FORMAT_NAME = \"CjsYamlFormat\";\n\nexport class CjsYamlFormat\n{\n #values = DEFAULT_VALUES;\n\n constructor(options = {})\n {\n this.SetValues(options);\n }\n\n SetValues(options = {})\n {\n this.#values = normalizeValues(this.#values, options, FORMAT_NAME);\n return this;\n }\n\n GetValues(options = {})\n {\n return normalizeValues(this.#values, options, FORMAT_NAME);\n }\n\n Read(input, options = {})\n {\n return CjsYamlFormat.read(input, this.GetValues(options));\n }\n\n ReadPayload(input, options = {})\n {\n return CjsYamlFormat.readPayload(input, this.GetValues(options));\n }\n\n ReadRaw(input, options = {})\n {\n return CjsYamlFormat.readRaw(input, this.GetValues(options));\n }\n\n ReadDocument(input, options = {})\n {\n return CjsYamlFormat.readDocument(input, this.GetValues(options));\n }\n\n Inspect(input, options = {})\n {\n return CjsYamlFormat.inspect(input, this.GetValues(options));\n }\n\n ToJSON(value, options = {})\n {\n return toJsonGraph(value, this.GetValues(options));\n }\n\n static read(input, options = {})\n {\n const values = normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME);\n if (values.emit === OUTPUT_RAW) return new CjsYamlReader(input, values).ReadRaw();\n if (values.emit === OUTPUT_DOCUMENT) return new CjsYamlReader(input, values).ReadDocument();\n return new CjsYamlReader(input, values).ReadPayload();\n }\n\n static readPayload(input, options = {})\n {\n const values = normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME);\n return new CjsYamlReader(input, values).ReadPayload();\n }\n\n static readRaw(input, options = {})\n {\n const values = normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME);\n return new CjsYamlReader(input, values).ReadRaw();\n }\n\n static readDocument(input, options = {})\n {\n const values = normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME);\n return new CjsYamlReader(input, values).ReadDocument();\n }\n\n static inspect(input, options = {})\n {\n const values = normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME);\n return new CjsYamlReader(input, values).Inspect();\n }\n\n static toJSON(value, options = {})\n {\n return toJsonGraph(value, normalizeValues(DEFAULT_VALUES, options, FORMAT_NAME));\n }\n\n static OUTPUT_JSON = OUTPUT_JSON;\n static OUTPUT_PAYLOAD = OUTPUT_PAYLOAD;\n static OUTPUT_RAW = OUTPUT_RAW;\n static OUTPUT_DOCUMENT = OUTPUT_DOCUMENT;\n static TAG_PRESERVE = TAG_PRESERVE;\n static TAG_REJECT = TAG_REJECT;\n static TAG_HANDLE = TAG_HANDLE;\n static id = \"yaml\";\n static extensions = Object.freeze([ \".yaml\", \".yml\" ]);\n static type = Object.freeze([ \"data\" ]);\n static mediaTypes = Object.freeze([ \"data\" ]);\n static inputTypes = Object.freeze([ \"yaml\" ]);\n static outputTypes = Object.freeze([ OUTPUT_JSON, OUTPUT_PAYLOAD ]);\n static debugOutputTypes = Object.freeze([ OUTPUT_RAW, OUTPUT_DOCUMENT ]);\n}\n\nexport default CjsYamlFormat;\n"],"names":["FORMAT_NAME","CjsYamlFormat","DEFAULT_VALUES","constructor","options","SetValues","normalizeValues","GetValues","Read","input","read","ReadPayload","readPayload","ReadRaw","readRaw","ReadDocument","readDocument","Inspect","inspect","ToJSON","value","toJsonGraph","values","emit","OUTPUT_RAW","CjsYamlReader","OUTPUT_DOCUMENT","toJSON","OUTPUT_JSON","OUTPUT_PAYLOAD","TAG_PRESERVE","TAG_REJECT","TAG_HANDLE","id","extensions","Object","freeze","type","mediaTypes","inputTypes","outputTypes","debugOut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GJ,MAAM,CAACC,MAAM,CAAC,CAAE,MAAM,CAAE,CAAC;EAC7C,OAAOI,WAAW,GAAGL,MAAM,CAACC,MAAM,CAAC,CAAER,WAAW,EAAEC,cAAc,CAAE,CAAC;EACnE,OAAOY,gBAAgB,GAAGN,MAAM,CAACC,MAAM,CAAC,CAAEZ,UAAU,EAAEE,eAAe,CAAE,CAAC;AAC5E;;;;"}
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
import { LineCounter, parseDocument, isMap, isSeq, isScalar, isAlias, visit } from 'yaml';
|
|
2
|
+
import { toJsonGraph, TAG_REJECT, TAG_HANDLE, TAG_PRESERVE } from './helpers.js';
|
|
3
|
+
|
|
4
|
+
const TAG_PREFIX = "tag:yaml.org,2002:";
|
|
5
|
+
const PYTHON_TUPLE = `${TAG_PREFIX}python/tuple`;
|
|
6
|
+
const PYTHON_UNICODE = `${TAG_PREFIX}python/unicode`;
|
|
7
|
+
const PYTHON_PROJECTED_DECAL = `${TAG_PREFIX}python/object:paperDoll.ProjectedDecal`;
|
|
8
|
+
const PYTHON_PART_METADATA = `${TAG_PREFIX}python/object:paperDoll.AvatarPartMetaData`;
|
|
9
|
+
const STANDARD_TAGS = new Set(["binary", "bool", "float", "int", "map", "merge", "null", "omap", "pairs", "seq", "set", "str", "timestamp"].map(name => `${TAG_PREFIX}${name}`));
|
|
10
|
+
function canonicalTag(tag) {
|
|
11
|
+
if (typeof tag !== "string") return tag;
|
|
12
|
+
if (tag.startsWith("!!")) return `${TAG_PREFIX}${tag.slice(2)}`;
|
|
13
|
+
return tag;
|
|
14
|
+
}
|
|
15
|
+
function displayMessage(error) {
|
|
16
|
+
return String(error && error.message ? error.message : error).trim();
|
|
17
|
+
}
|
|
18
|
+
function defineMappingValue(target, key, value) {
|
|
19
|
+
Object.defineProperty(target, key, {
|
|
20
|
+
value,
|
|
21
|
+
enumerable: true,
|
|
22
|
+
configurable: true,
|
|
23
|
+
writable: true
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
class CjsYamlReader {
|
|
27
|
+
constructor(input, options = {}) {
|
|
28
|
+
if (typeof input !== "string") {
|
|
29
|
+
throw new TypeError("CjsYamlFormat input must be a YAML string");
|
|
30
|
+
}
|
|
31
|
+
this.source = input;
|
|
32
|
+
this.options = options;
|
|
33
|
+
this.lineCounter = new LineCounter();
|
|
34
|
+
this.document = parseDocument(input, {
|
|
35
|
+
keepSourceTokens: true,
|
|
36
|
+
lineCounter: this.lineCounter,
|
|
37
|
+
prettyErrors: true,
|
|
38
|
+
strict: true,
|
|
39
|
+
uniqueKeys: this.options.uniqueKeys
|
|
40
|
+
});
|
|
41
|
+
this.inventory = this.BuildInventory();
|
|
42
|
+
}
|
|
43
|
+
Read() {
|
|
44
|
+
return this.ReadPayload();
|
|
45
|
+
}
|
|
46
|
+
ReadPayload() {
|
|
47
|
+
return toJsonGraph(this.ReadRaw(), this.options);
|
|
48
|
+
}
|
|
49
|
+
ReadRaw() {
|
|
50
|
+
this.AssertSyntax();
|
|
51
|
+
this.AssertAliasLimit();
|
|
52
|
+
return this.Convert(this.document.contents, new Map());
|
|
53
|
+
}
|
|
54
|
+
ReadDocument() {
|
|
55
|
+
let value = null;
|
|
56
|
+
const errors = this.inventory.errors.slice();
|
|
57
|
+
if (!errors.length) {
|
|
58
|
+
try {
|
|
59
|
+
this.AssertAliasLimit();
|
|
60
|
+
value = this.Convert(this.document.contents, new Map());
|
|
61
|
+
} catch (error) {
|
|
62
|
+
errors.push(this.DescribeError(error));
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return {
|
|
66
|
+
format: {
|
|
67
|
+
id: "yaml"
|
|
68
|
+
},
|
|
69
|
+
source: {
|
|
70
|
+
name: this.options.sourceName,
|
|
71
|
+
length: this.source.length
|
|
72
|
+
},
|
|
73
|
+
root: {
|
|
74
|
+
kind: this.RootKind()
|
|
75
|
+
},
|
|
76
|
+
value,
|
|
77
|
+
tags: this.inventory.tags,
|
|
78
|
+
anchors: this.inventory.anchors,
|
|
79
|
+
aliases: this.inventory.aliases,
|
|
80
|
+
warnings: this.inventory.warnings,
|
|
81
|
+
errors
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
Inspect() {
|
|
85
|
+
return {
|
|
86
|
+
format: {
|
|
87
|
+
id: "yaml"
|
|
88
|
+
},
|
|
89
|
+
source: {
|
|
90
|
+
name: this.options.sourceName,
|
|
91
|
+
length: this.source.length
|
|
92
|
+
},
|
|
93
|
+
root: {
|
|
94
|
+
kind: this.RootKind()
|
|
95
|
+
},
|
|
96
|
+
tags: this.inventory.tags,
|
|
97
|
+
anchors: this.inventory.anchors,
|
|
98
|
+
aliases: this.inventory.aliases,
|
|
99
|
+
warnings: this.inventory.warnings,
|
|
100
|
+
errors: this.inventory.errors
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
RootKind() {
|
|
104
|
+
const node = this.document.contents;
|
|
105
|
+
if (node === null) return "null";
|
|
106
|
+
if (isMap(node)) return "mapping";
|
|
107
|
+
if (isSeq(node)) return "sequence";
|
|
108
|
+
if (isScalar(node)) return "scalar";
|
|
109
|
+
if (isAlias(node)) return "alias";
|
|
110
|
+
return "unknown";
|
|
111
|
+
}
|
|
112
|
+
AssertSyntax() {
|
|
113
|
+
if (!this.document.errors.length) return;
|
|
114
|
+
const first = this.document.errors[0];
|
|
115
|
+
const source = this.options.sourceName ? ` in ${this.options.sourceName}` : "";
|
|
116
|
+
throw new SyntaxError(`CjsYamlFormat${source}: ${displayMessage(first)}`);
|
|
117
|
+
}
|
|
118
|
+
AssertAliasLimit() {
|
|
119
|
+
if (this.inventory.aliases.length <= this.options.maxAliasCount) return;
|
|
120
|
+
const source = this.options.sourceName ? ` in ${this.options.sourceName}` : "";
|
|
121
|
+
throw new RangeError(`CjsYamlFormat${source}: alias count ${this.inventory.aliases.length} exceeds maxAliasCount ${this.options.maxAliasCount}`);
|
|
122
|
+
}
|
|
123
|
+
Convert(node, memo) {
|
|
124
|
+
if (node === null || node === undefined) return null;
|
|
125
|
+
if (isAlias(node)) {
|
|
126
|
+
const source = node.resolve(this.document);
|
|
127
|
+
if (!source) throw this.NodeError(node, `unresolved alias "${node.source}"`);
|
|
128
|
+
return this.Convert(source, memo);
|
|
129
|
+
}
|
|
130
|
+
if (memo.has(node)) return memo.get(node);
|
|
131
|
+
const tag = this.CustomTag(node);
|
|
132
|
+
if (tag) {
|
|
133
|
+
this.AssertTagAllowed(tag, node);
|
|
134
|
+
const handler = this.FindTagHandler(tag);
|
|
135
|
+
if (handler) {
|
|
136
|
+
const value = this.ConvertBase(node, memo, true);
|
|
137
|
+
const handled = handler(value, this.TagContext(tag, node));
|
|
138
|
+
memo.set(node, handled);
|
|
139
|
+
return handled;
|
|
140
|
+
}
|
|
141
|
+
if (tag === PYTHON_TUPLE) {
|
|
142
|
+
if (!isSeq(node)) throw this.NodeError(node, `${tag} must decorate a sequence`);
|
|
143
|
+
return this.ConvertBase(node, memo, true);
|
|
144
|
+
}
|
|
145
|
+
if (tag === PYTHON_UNICODE) {
|
|
146
|
+
if (!isScalar(node) || typeof node.value !== "string") {
|
|
147
|
+
throw this.NodeError(node, `${tag} must decorate a string scalar`);
|
|
148
|
+
}
|
|
149
|
+
return node.value;
|
|
150
|
+
}
|
|
151
|
+
if (this.options.tagPolicy === TAG_REJECT) {
|
|
152
|
+
throw this.NodeError(node, `custom tag "${tag}" is rejected by tagPolicy`);
|
|
153
|
+
}
|
|
154
|
+
if (this.options.tagPolicy === TAG_HANDLE) {
|
|
155
|
+
throw this.NodeError(node, `custom tag "${tag}" has no explicit handler`);
|
|
156
|
+
}
|
|
157
|
+
if (this.options.tagPolicy === TAG_PRESERVE || tag === PYTHON_PROJECTED_DECAL || tag === PYTHON_PART_METADATA) {
|
|
158
|
+
const wrapper = {
|
|
159
|
+
[this.options.tagField]: tag
|
|
160
|
+
};
|
|
161
|
+
memo.set(node, wrapper);
|
|
162
|
+
wrapper[this.options.valueField] = this.ConvertBase(node, memo, false);
|
|
163
|
+
return wrapper;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
return this.ConvertBase(node, memo, true);
|
|
167
|
+
}
|
|
168
|
+
ConvertBase(node, memo, memoize) {
|
|
169
|
+
if (isScalar(node)) return node.value;
|
|
170
|
+
if (isSeq(node)) {
|
|
171
|
+
const out = [];
|
|
172
|
+
if (memoize) memo.set(node, out);
|
|
173
|
+
for (const item of node.items) out.push(this.Convert(item, memo));
|
|
174
|
+
return out;
|
|
175
|
+
}
|
|
176
|
+
if (isMap(node)) {
|
|
177
|
+
const out = {};
|
|
178
|
+
if (memoize) memo.set(node, out);
|
|
179
|
+
for (const pair of node.items) {
|
|
180
|
+
const key = this.MapKey(pair.key);
|
|
181
|
+
if (this.options.uniqueKeys && Object.prototype.hasOwnProperty.call(out, key)) {
|
|
182
|
+
throw this.NodeError(pair.key, `duplicate mapping key "${key}"`);
|
|
183
|
+
}
|
|
184
|
+
// Defining the property prevents keys such as "__proto__" from
|
|
185
|
+
// mutating the result object's prototype.
|
|
186
|
+
defineMappingValue(out, key, this.Convert(pair.value, memo));
|
|
187
|
+
}
|
|
188
|
+
return out;
|
|
189
|
+
}
|
|
190
|
+
throw this.NodeError(node, "unsupported YAML node");
|
|
191
|
+
}
|
|
192
|
+
MapKey(node) {
|
|
193
|
+
if (!isScalar(node)) throw this.NodeError(node, "mapping keys must be scalar values");
|
|
194
|
+
return String(node.value);
|
|
195
|
+
}
|
|
196
|
+
CustomTag(node) {
|
|
197
|
+
const tag = canonicalTag(node.tag);
|
|
198
|
+
return tag && !STANDARD_TAGS.has(tag) ? tag : null;
|
|
199
|
+
}
|
|
200
|
+
AssertTagAllowed(tag, node) {
|
|
201
|
+
if (!this.options.allowedTags) return;
|
|
202
|
+
const allowed = new Set(this.options.allowedTags.map(canonicalTag));
|
|
203
|
+
if (!allowed.has(tag)) throw this.NodeError(node, `custom tag "${tag}" is not in allowedTags`);
|
|
204
|
+
}
|
|
205
|
+
FindTagHandler(tag) {
|
|
206
|
+
const handlers = this.options.tagHandlers;
|
|
207
|
+
const short = tag.startsWith(TAG_PREFIX) ? `!!${tag.slice(TAG_PREFIX.length)}` : tag;
|
|
208
|
+
if (handlers instanceof Map) return handlers.get(tag) || handlers.get(short) || null;
|
|
209
|
+
return handlers[tag] || handlers[short] || null;
|
|
210
|
+
}
|
|
211
|
+
TagContext(tag, node) {
|
|
212
|
+
return {
|
|
213
|
+
tag,
|
|
214
|
+
sourceName: this.options.sourceName,
|
|
215
|
+
location: this.TagLocation(node)
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
NodeError(node, message) {
|
|
219
|
+
const at = node && node.tag ? this.TagLocation(node) : this.Location(node);
|
|
220
|
+
const source = this.options.sourceName ? `${this.options.sourceName}:` : "";
|
|
221
|
+
const where = at ? `${source}${at.line}:${at.column}` : this.options.sourceName || "YAML input";
|
|
222
|
+
const error = new Error(`CjsYamlFormat ${where}: ${message}`);
|
|
223
|
+
error.code = "YAML_TAG_POLICY";
|
|
224
|
+
error.location = at;
|
|
225
|
+
return error;
|
|
226
|
+
}
|
|
227
|
+
Location(node) {
|
|
228
|
+
if (!node || !Array.isArray(node.range)) return null;
|
|
229
|
+
const pos = this.lineCounter.linePos(node.range[0]);
|
|
230
|
+
return {
|
|
231
|
+
offset: node.range[0],
|
|
232
|
+
line: pos.line,
|
|
233
|
+
column: pos.col
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
TagLocation(node) {
|
|
237
|
+
const fallback = this.Location(node);
|
|
238
|
+
if (!fallback || !node.tag) return fallback;
|
|
239
|
+
const lineStart = this.source.lastIndexOf("\n", node.range[0] - 1) + 1;
|
|
240
|
+
const prefix = this.source.slice(lineStart, node.range[0]);
|
|
241
|
+
const tags = [...prefix.matchAll(/!<[^>]+>|!!?[^\s[\]{},]+/g)];
|
|
242
|
+
const match = tags[tags.length - 1];
|
|
243
|
+
if (!match) return fallback;
|
|
244
|
+
const offset = lineStart + match.index;
|
|
245
|
+
const pos = this.lineCounter.linePos(offset);
|
|
246
|
+
return {
|
|
247
|
+
offset,
|
|
248
|
+
line: pos.line,
|
|
249
|
+
column: pos.col
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
DescribeError(error) {
|
|
253
|
+
const linePos = error && error.linePos && error.linePos[0];
|
|
254
|
+
return {
|
|
255
|
+
code: error && error.code ? error.code : "YAML_ERROR",
|
|
256
|
+
message: displayMessage(error),
|
|
257
|
+
location: error && error.location ? error.location : linePos ? {
|
|
258
|
+
line: linePos.line,
|
|
259
|
+
column: linePos.col
|
|
260
|
+
} : null
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
BuildInventory() {
|
|
264
|
+
const tags = [];
|
|
265
|
+
const anchors = [];
|
|
266
|
+
const aliases = [];
|
|
267
|
+
visit(this.document, (_key, node) => {
|
|
268
|
+
if (!node || typeof node !== "object") return;
|
|
269
|
+
const tag = this.CustomTag(node);
|
|
270
|
+
const location = tag ? this.TagLocation(node) : this.Location(node);
|
|
271
|
+
if (tag) tags.push({
|
|
272
|
+
tag,
|
|
273
|
+
kind: this.NodeKind(node),
|
|
274
|
+
location
|
|
275
|
+
});
|
|
276
|
+
if (node.anchor) anchors.push({
|
|
277
|
+
name: node.anchor,
|
|
278
|
+
kind: this.NodeKind(node),
|
|
279
|
+
location
|
|
280
|
+
});
|
|
281
|
+
if (isAlias(node)) aliases.push({
|
|
282
|
+
name: node.source,
|
|
283
|
+
location
|
|
284
|
+
});
|
|
285
|
+
});
|
|
286
|
+
return {
|
|
287
|
+
tags,
|
|
288
|
+
anchors,
|
|
289
|
+
aliases,
|
|
290
|
+
warnings: this.document.warnings.map(error => this.DescribeError(error)),
|
|
291
|
+
errors: this.document.errors.map(error => this.DescribeError(error))
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
NodeKind(node) {
|
|
295
|
+
if (isMap(node)) return "mapping";
|
|
296
|
+
if (isSeq(node)) return "sequence";
|
|
297
|
+
if (isScalar(node)) return "scalar";
|
|
298
|
+
if (isAlias(node)) return "alias";
|
|
299
|
+
return "unknown";
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
export { CjsYamlReader };
|
|
304
|
+
//# sourceMappingURL=CjsYamlReader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CjsYamlReader.js","sources":["../../../../../src/formats/yaml/core/CjsYamlReader.js"],"sourcesContent":["import {\n LineCounter,\n isAlias,\n isMap,\n isScalar,\n isSeq,\n parseDocument,\n visit\n} from \"yaml\";\n\nimport { TAG_HANDLE, TAG_PRESERVE, TAG_REJECT, toJsonGraph } from \"./helpers.js\";\n\nconst TAG_PREFIX = \"tag:yaml.org,2002:\";\nconst PYTHON_TUPLE = `${TAG_PREFIX}python/tuple`;\nconst PYTHON_UNICODE = `${TAG_PREFIX}python/unicode`;\nconst PYTHON_PROJECTED_DECAL = `${TAG_PREFIX}python/object:paperDoll.ProjectedDecal`;\nconst PYTHON_PART_METADATA = `${TAG_PREFIX}python/object:paperDoll.AvatarPartMetaData`;\n\nconst STANDARD_TAGS = new Set([\n \"binary\", \"bool\", \"float\", \"int\", \"map\", \"merge\", \"null\", \"omap\",\n \"pairs\", \"seq\", \"set\", \"str\", \"timestamp\"\n].map(name => `${TAG_PREFIX}${name}`));\n\nfunction canonicalTag(tag)\n{\n if (typeof tag !== \"string\") return tag;\n if (tag.startsWith(\"!!\")) return `${TAG_PREFIX}${tag.slice(2)}`;\n return tag;\n}\n\nfunction displayMessage(error)\n{\n return String(error && error.message ? error.message : error).trim();\n}\n\nfunction defineMappingValue(target, key, value)\n{\n Object.defineProperty(target, key, {\n value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n}\n\nexport class CjsYamlReader\n{\n constructor(input, options = {})\n {\n if (typeof input !== \"string\")\n {\n throw new TypeError(\"CjsYamlFormat input must be a YAML string\");\n }\n\n this.source = input;\n this.options = options;\n this.lineCounter = new LineCounter();\n this.document = parseDocument(input, {\n keepSourceTokens: true,\n lineCounter: this.lineCounter,\n prettyErrors: true,\n strict: true,\n uniqueKeys: this.options.uniqueKeys\n });\n this.inventory = this.BuildInventory();\n }\n\n Read()\n {\n return this.ReadPayload();\n }\n\n ReadPayload()\n {\n return toJsonGraph(this.ReadRaw(), this.options);\n }\n\n ReadRaw()\n {\n this.AssertSyntax();\n this.AssertAliasLimit();\n return this.Convert(this.document.contents, new Map());\n }\n\n ReadDocument()\n {\n let value = null;\n const errors = this.inventory.errors.slice();\n\n if (!errors.length)\n {\n try\n {\n this.AssertAliasLimit();\n value = this.Convert(this.document.contents, new Map());\n }\n catch (error)\n {\n errors.push(this.DescribeError(error));\n }\n }\n\n return {\n format: { id: \"yaml\" },\n source: { name: this.options.sourceName, length: this.source.length },\n root: { kind: this.RootKind() },\n value,\n tags: this.inventory.tags,\n anchors: this.inventory.anchors,\n aliases: this.inventory.aliases,\n warnings: this.inventory.warnings,\n errors\n };\n }\n\n Inspect()\n {\n return {\n format: { id: \"yaml\" },\n source: { name: this.options.sourceName, length: this.source.length },\n root: { kind: this.RootKind() },\n tags: this.inventory.tags,\n anchors: this.inventory.anchors,\n aliases: this.inventory.aliases,\n warnings: this.inventory.warnings,\n errors: this.inventory.errors\n };\n }\n\n RootKind()\n {\n const node = this.document.contents;\n if (node === null) return \"null\";\n if (isMap(node)) return \"mapping\";\n if (isSeq(node)) return \"sequence\";\n if (isScalar(node)) return \"scalar\";\n if (isAlias(node)) return \"alias\";\n return \"unknown\";\n }\n\n AssertSyntax()\n {\n if (!this.document.errors.length) return;\n const first = this.document.errors[0];\n const source = this.options.sourceName ? ` in ${this.options.sourceName}` : \"\";\n throw new SyntaxError(`CjsYamlFormat${source}: ${displayMessage(first)}`);\n }\n\n AssertAliasLimit()\n {\n if (this.inventory.aliases.length <= this.options.maxAliasCount) return;\n const source = this.options.sourceName ? ` in ${this.options.sourceName}` : \"\";\n throw new RangeError(`CjsYamlFormat${source}: alias count ${this.inventory.aliases.length} exceeds maxAliasCount ${this.options.maxAliasCount}`);\n }\n\n Convert(node, memo)\n {\n if (node === null || node === undefined) return null;\n\n if (isAlias(node))\n {\n const source = node.resolve(this.document);\n if (!source) throw this.NodeError(node, `unresolved alias \"${node.source}\"`);\n return this.Convert(source, memo);\n }\n\n if (memo.has(node)) return memo.get(node);\n\n const tag = this.CustomTag(node);\n if (tag)\n {\n this.AssertTagAllowed(tag, node);\n const handler = this.FindTagHandler(tag);\n\n if (handler)\n {\n const value = this.ConvertBase(node, memo, true);\n const handled = handler(value, this.TagContext(tag, node));\n memo.set(node, handled);\n return handled;\n }\n\n if (tag === PYTHON_TUPLE)\n {\n if (!isSeq(node)) throw this.NodeError(node, `${tag} must decorate a sequence`);\n return this.ConvertBase(node, memo, true);\n }\n\n if (tag === PYTHON_UNICODE)\n {\n if (!isScalar(node) || typeof node.value !== \"string\")\n {\n throw this.NodeError(node, `${tag} must decorate a string scalar`);\n }\n return node.value;\n }\n\n if (this.options.tagPolicy === TAG_REJECT)\n {\n throw this.NodeError(node, `custom tag \"${tag}\" is rejected by tagPolicy`);\n }\n\n if (this.options.tagPolicy === TAG_HANDLE)\n {\n throw this.NodeError(node, `custom tag \"${tag}\" has no explicit handler`);\n }\n\n if (this.options.tagPolicy === TAG_PRESERVE || tag === PYTHON_PROJECTED_DECAL || tag === PYTHON_PART_METADATA)\n {\n const wrapper = { [this.options.tagField]: tag };\n memo.set(node, wrapper);\n wrapper[this.options.valueField] = this.ConvertBase(node, memo, false);\n return wrapper;\n }\n }\n\n return this.ConvertBase(node, memo, true);\n }\n\n ConvertBase(node, memo, memoize)\n {\n if (isScalar(node)) return node.value;\n\n if (isSeq(node))\n {\n const out = [];\n if (memoize) memo.set(node, out);\n for (const item of node.items) out.push(this.Convert(item, memo));\n return out;\n }\n\n if (isMap(node))\n {\n const out = {};\n if (memoize) memo.set(node, out);\n for (const pair of node.items)\n {\n const key = this.MapKey(pair.key);\n if (this.options.uniqueKeys && Object.prototype.hasOwnProperty.call(out, key))\n {\n throw this.NodeError(pair.key, `duplicate mapping key \"${key}\"`);\n }\n // Defining the property prevents keys such as \"__proto__\" from\n // mutating the result object's prototype.\n defineMappingValue(out, key, this.Convert(pair.value, memo));\n }\n return out;\n }\n\n throw this.NodeError(node, \"unsupported YAML node\");\n }\n\n MapKey(node)\n {\n if (!isScalar(node)) throw this.NodeError(node, \"mapping keys must be scalar values\");\n return String(node.value);\n }\n\n CustomTag(node)\n {\n const tag = canonicalTag(node.tag);\n return tag && !STANDARD_TAGS.has(tag) ? tag : null;\n }\n\n AssertTagAllowed(tag, node)\n {\n if (!this.options.allowedTags) return;\n const allowed = new Set(this.options.allowedTags.map(canonicalTag));\n if (!allowed.has(tag)) throw this.NodeError(node, `custom tag \"${tag}\" is not in allowedTags`);\n }\n\n FindTagHandler(tag)\n {\n const handlers = this.options.tagHandlers;\n const short = tag.startsWith(TAG_PREFIX) ? `!!${tag.slice(TAG_PREFIX.length)}` : tag;\n if (handlers instanceof Map) return handlers.get(tag) || handlers.get(short) || null;\n return handlers[tag] || handlers[short] || null;\n }\n\n TagContext(tag, node)\n {\n return {\n tag,\n sourceName: this.options.sourceName,\n location: this.TagLocation(node)\n };\n }\n\n NodeError(node, message)\n {\n const at = node && node.tag ? this.TagLocation(node) : this.Location(node);\n const source = this.options.sourceName ? `${this.options.sourceName}:` : \"\";\n const where = at ? `${source}${at.line}:${at.column}` : (this.options.sourceName || \"YAML input\");\n const error = new Error(`CjsYamlFormat ${where}: ${message}`);\n error.code = \"YAML_TAG_POLICY\";\n error.location = at;\n return error;\n }\n\n Location(node)\n {\n if (!node || !Array.isArray(node.range)) return null;\n const pos = this.lineCounter.linePos(node.range[0]);\n return { offset: node.range[0], line: pos.line, column: pos.col };\n }\n\n TagLocation(node)\n {\n const fallback = this.Location(node);\n if (!fallback || !node.tag) return fallback;\n\n const lineStart = this.source.lastIndexOf(\"\\n\", node.range[0] - 1) + 1;\n const prefix = this.source.slice(lineStart, node.range[0]);\n const tags = [ ...prefix.matchAll(/!<[^>]+>|!!?[^\\s[\\]{},]+/g) ];\n const match = tags[tags.length - 1];\n if (!match) return fallback;\n\n const offset = lineStart + match.index;\n const pos = this.lineCounter.linePos(offset);\n return { offset, line: pos.line, column: pos.col };\n }\n\n DescribeError(error)\n {\n const linePos = error && error.linePos && error.linePos[0];\n return {\n code: error && error.code ? error.code : \"YAML_ERROR\",\n message: displayMessage(error),\n location: error && error.location ? error.location : (linePos ? {\n line: linePos.line,\n column: linePos.col\n } : null)\n };\n }\n\n BuildInventory()\n {\n const tags = [];\n const anchors = [];\n const aliases = [];\n\n visit(this.document, (_key, node) =>\n {\n if (!node || typeof node !== \"object\") return;\n const tag = this.CustomTag(node);\n const location = tag ? this.TagLocation(node) : this.Location(node);\n if (tag) tags.push({ tag, kind: this.NodeKind(node), location });\n if (node.anchor) anchors.push({ name: node.anchor, kind: this.NodeKind(node), location });\n if (isAlias(node)) aliases.push({ name: node.source, location });\n });\n\n return {\n tags,\n anchors,\n aliases,\n warnings: this.document.warnings.map(error => this.DescribeError(error)),\n errors: this.document.errors.map(error => this.DescribeError(error))\n };\n }\n\n NodeKind(node)\n {\n if (isMap(node)) return \"mapping\";\n if (isSeq(node)) return \"sequence\";\n if (isScalar(node)) return \"scalar\";\n if (isAlias(node)) return \"alias\";\n return \"unknown\";\n }\n}\n\nexport default CjsYamlReader;\n"],"names":["TAG_PREFIX","PYTHON_TUPLE","PYTHON_UNICODE","PYTHON_PROJECTED_DECAL","PYTHON_PART_METADATA","STANDARD_TAGS","Set","map","name","canonicalTag","tag","startsWith","slice","displayMessage","error","String","message","trim","defineMappingValue","target","key","value","Object","defineProperty","enumerable","configurable","writable","CjsYamlReader","constructor","input","options","TypeError","source","lineCounter","LineCounter","document","parseDocument","keepSourceTokens","prettyErrors","strict","uniqueKeys","inventory","BuildInventory","Read","ReadPayload","toJsonGraph","ReadRaw","AssertSyntax","AssertAliasLimit","Convert","contents","Map","ReadDocument","errors","length","push","DescribeError","format","id","sourceName","root","kind","RootKind","tags","anchors","aliases","warnings","Inspect","node","isMap","isSeq","isScalar","isAlias","first","SyntaxError","maxAliasCount","RangeError","memo","undefined","resolve","NodeError","has","get","CustomTag","AssertTagAllowed","handler","FindTagHandler","ConvertBase","handled","TagContext","set","tagPolicy","TAG_REJECT","TAG_HANDLE","TAG_PRESERVE","wrapper","tagField","valueField","memoize","out","item","items","pair","MapKey","prototype","hasOwnProperty","call","allowedTags","allowed","handlers","tagHandlers","short","location","TagLocation","at","Location","where","line","column","Error","code","Array","isArray","range","pos","linePos","offset","col","fallback","lineStart","lastIndexOf","prefix","matchAll","match","index","visit","_key","NodeKind","anchor"],"mappings":";;;AAYA,MAAMA,UAAU,GAAG,oBAAoB;AACvC,MAAMC,YAAY,GAAG,CAAA,EAAGD,UAAU,CAAA,YAAA,CAAc;AAChD,MAAME,cAAc,GAAG,CAAA,EAAGF,UAAU,CAAA,cAAA,CAAgB;AACpD,MAAMG,sBAAsB,GAAG,CAAA,EAAGH,UAAU,CAAA,sCAAA,CAAwC;AACpF,MAAMI,oBAAoB,GAAG,CAAA,EAAGJ,UAAU,CAAA,0CAAA,CAA4C;AAEtF,MAAMK,aAAa,GAAG,IAAIC,GAAG,CAAC,CAC1B,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAChE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,CAC5C,CAACC,GAAG,CAACC,IAAI,IAAI,CAAA,EAAGR,UAAU,GAAGQ,IAAI,CAAA,CAAE,CAAC,CAAC;AAEtC,SAASC,YAAYA,CAACC,GAAG,EACzB;AACI,EAAA,IAAI,OAAOA,GAAG,KAAK,QAAQ,EAAE,OAAOA,GAAG;AACvC,EAAA,IAAIA,GAAG,CAACC,UAAU,CAAC,IAAI,CAAC,EAAE,OAAO,CAAA,EAAGX,UAAU,GAAGU,GAAG,CAACE,KAAK,CAAC,CAAC,CAAC,CAAA,CAAE;AAC/D,EAAA,OAAOF,GAAG;AAC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IAAI,CAAC;QAAE/C,IAAI,EAAE4D,IAAI,CAACsE,MAAM;AAAE7E,QAAAA,IAAI,EAAE,IAAI,CAAC4E,QAAQ,CAACrE,IAAI,CAAC;AAAE4C,QAAAA;AAAS,OAAC,CAAC;MACzF,IAAIxC,OAAO,CAACJ,IAAI,CAAC,EAAEH,OAAO,CAACV,IAAI,CAAC;QAAE/C,IAAI,EAAE4D,IAAI,CAACpC,MAAM;AAAEgF,QAAAA;AAAS,OAAC,CAAC;AACpE,IAAA,CAAC,CAAC;IAEF,OAAO;MACHjD,IAAI;MACJC,OAAO;MACPC,OAAO;AACPC,MAAAA,QAAQ,EAAE,IAAI,CAAC/B,QAAQ,CAAC+B,QAAQ,CAAC3D,GAAG,CAACO,KAAK,IAAI,IAAI,CAAC0C,aAAa,CAAC1C,KAAK,CAAC,CAAC;AACxEuC,MAAAA,MAAM,EAAE,IAAI,CAAClB,QAAQ,CAACkB,MAAM,CAAC9C,GAAG,CAACO,KAAK,IAAI,IAAI,CAAC0C,aAAa,CAAC1C,KAAK,CAAC;KACtE;AACL,EAAA;EAEA2H,QAAQA,CAACrE,IAAI,EACb;AACI,IAAA,IAAIC,KAAK,CAACD,IAAI,CAAC,EAAE,OAAO,SAAS;AACjC,IAAA,IAAIE,KAAK,CAACF,IAAI,CAAC,EAAE,OAAO,UAAU;AAClC,IAAA,IAAIG,QAAQ,CAACH,IAAI,CAAC,EAAE,OAAO,QAAQ;AACnC,IAAA,IAAII,OAAO,CAACJ,IAAI,CAAC,EAAE,OAAO,OAAO;AACjC,IAAA,OAAO,SAAS;AACpB,EAAA;AACJ;;;;"}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
const OUTPUT_JSON = "json";
|
|
2
|
+
const OUTPUT_PAYLOAD = "payload";
|
|
3
|
+
const OUTPUT_RAW = "raw";
|
|
4
|
+
const OUTPUT_DOCUMENT = "document";
|
|
5
|
+
const TAG_PRESERVE = "preserve";
|
|
6
|
+
const TAG_REJECT = "reject";
|
|
7
|
+
const TAG_HANDLE = "handle";
|
|
8
|
+
const DEFAULT_VALUES = Object.freeze({
|
|
9
|
+
emit: OUTPUT_PAYLOAD,
|
|
10
|
+
tagPolicy: TAG_PRESERVE,
|
|
11
|
+
allowedTags: null,
|
|
12
|
+
tagHandlers: Object.freeze({}),
|
|
13
|
+
sourceName: null,
|
|
14
|
+
maxAliasCount: 100,
|
|
15
|
+
uniqueKeys: true,
|
|
16
|
+
idField: "$yamlId",
|
|
17
|
+
refField: "$yamlRef",
|
|
18
|
+
valuesField: "$yamlValues",
|
|
19
|
+
tagField: "$yamlTag",
|
|
20
|
+
valueField: "$yamlValue"
|
|
21
|
+
});
|
|
22
|
+
const OPTION_KEYS = new Set(Object.keys(DEFAULT_VALUES));
|
|
23
|
+
function hasOwn(value, key) {
|
|
24
|
+
return Object.prototype.hasOwnProperty.call(value, key);
|
|
25
|
+
}
|
|
26
|
+
function defineMappingValue(target, key, value) {
|
|
27
|
+
Object.defineProperty(target, key, {
|
|
28
|
+
value,
|
|
29
|
+
enumerable: true,
|
|
30
|
+
configurable: true,
|
|
31
|
+
writable: true
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
function normalizeEmit(value, readerName) {
|
|
35
|
+
if (value === OUTPUT_JSON || value === OUTPUT_PAYLOAD) return value;
|
|
36
|
+
if (value === OUTPUT_RAW || value === OUTPUT_DOCUMENT) return value;
|
|
37
|
+
throw new TypeError(`${readerName} unknown emit value "${value}"`);
|
|
38
|
+
}
|
|
39
|
+
function normalizeTagPolicy(value, readerName) {
|
|
40
|
+
if (value === TAG_PRESERVE || value === TAG_REJECT || value === TAG_HANDLE) return value;
|
|
41
|
+
throw new TypeError(`${readerName} unknown tagPolicy value "${value}"`);
|
|
42
|
+
}
|
|
43
|
+
function normalizeAllowedTags(value, readerName) {
|
|
44
|
+
if (value === null || value === undefined) return null;
|
|
45
|
+
if (!Array.isArray(value) && !(value instanceof Set)) {
|
|
46
|
+
throw new TypeError(`${readerName} allowedTags must be an array, Set, or null`);
|
|
47
|
+
}
|
|
48
|
+
return [...value];
|
|
49
|
+
}
|
|
50
|
+
function normalizeTagHandlers(value, readerName) {
|
|
51
|
+
if (value instanceof Map) {
|
|
52
|
+
for (const [tag, handler] of value) {
|
|
53
|
+
if (typeof handler !== "function") {
|
|
54
|
+
throw new TypeError(`${readerName} tag handler "${tag}" must be a function`);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return new Map(value);
|
|
58
|
+
}
|
|
59
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
60
|
+
throw new TypeError(`${readerName} tagHandlers must be an object or Map`);
|
|
61
|
+
}
|
|
62
|
+
for (const [tag, handler] of Object.entries(value)) {
|
|
63
|
+
if (typeof handler !== "function") {
|
|
64
|
+
throw new TypeError(`${readerName} tag handler "${tag}" must be a function`);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
...value
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function normalizeField(value, name, readerName) {
|
|
72
|
+
if (typeof value !== "string" || !value) {
|
|
73
|
+
throw new TypeError(`${readerName} ${name} must be a non-empty string`);
|
|
74
|
+
}
|
|
75
|
+
return value;
|
|
76
|
+
}
|
|
77
|
+
function normalizeBoolean(value, name, readerName) {
|
|
78
|
+
if (typeof value !== "boolean") throw new TypeError(`${readerName} ${name} must be a boolean`);
|
|
79
|
+
return value;
|
|
80
|
+
}
|
|
81
|
+
function normalizeValues(base, options = {}, readerName = "CjsYamlFormat") {
|
|
82
|
+
if (!options || typeof options !== "object" || Array.isArray(options)) {
|
|
83
|
+
throw new TypeError(`${readerName} options must be an object`);
|
|
84
|
+
}
|
|
85
|
+
for (const key of Object.keys(options)) {
|
|
86
|
+
if (!OPTION_KEYS.has(key)) throw new TypeError(`${readerName} unknown option "${key}"`);
|
|
87
|
+
}
|
|
88
|
+
const values = {
|
|
89
|
+
...base,
|
|
90
|
+
allowedTags: base.allowedTags ? [...base.allowedTags] : null,
|
|
91
|
+
tagHandlers: base.tagHandlers instanceof Map ? new Map(base.tagHandlers) : {
|
|
92
|
+
...base.tagHandlers
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
if (hasOwn(options, "emit")) values.emit = normalizeEmit(options.emit, readerName);
|
|
96
|
+
if (hasOwn(options, "tagPolicy")) values.tagPolicy = normalizeTagPolicy(options.tagPolicy, readerName);
|
|
97
|
+
if (hasOwn(options, "allowedTags")) values.allowedTags = normalizeAllowedTags(options.allowedTags, readerName);
|
|
98
|
+
if (hasOwn(options, "tagHandlers")) values.tagHandlers = normalizeTagHandlers(options.tagHandlers, readerName);
|
|
99
|
+
if (hasOwn(options, "sourceName")) values.sourceName = options.sourceName == null ? null : String(options.sourceName);
|
|
100
|
+
if (hasOwn(options, "maxAliasCount")) {
|
|
101
|
+
if (!Number.isInteger(options.maxAliasCount) || options.maxAliasCount < 0) {
|
|
102
|
+
throw new TypeError(`${readerName} maxAliasCount must be a non-negative integer`);
|
|
103
|
+
}
|
|
104
|
+
values.maxAliasCount = options.maxAliasCount;
|
|
105
|
+
}
|
|
106
|
+
if (hasOwn(options, "uniqueKeys")) {
|
|
107
|
+
values.uniqueKeys = normalizeBoolean(options.uniqueKeys, "uniqueKeys", readerName);
|
|
108
|
+
}
|
|
109
|
+
for (const name of ["idField", "refField", "valuesField", "tagField", "valueField"]) {
|
|
110
|
+
if (hasOwn(options, name)) values[name] = normalizeField(options[name], name, readerName);
|
|
111
|
+
}
|
|
112
|
+
return values;
|
|
113
|
+
}
|
|
114
|
+
function toJsonGraph(value, options) {
|
|
115
|
+
const counts = new WeakMap();
|
|
116
|
+
const traversed = new WeakSet();
|
|
117
|
+
const count = node => {
|
|
118
|
+
if (!node || typeof node !== "object") return;
|
|
119
|
+
counts.set(node, (counts.get(node) || 0) + 1);
|
|
120
|
+
if (traversed.has(node)) return;
|
|
121
|
+
traversed.add(node);
|
|
122
|
+
if (Array.isArray(node)) node.forEach(count);else Object.keys(node).forEach(key => count(node[key]));
|
|
123
|
+
};
|
|
124
|
+
count(value);
|
|
125
|
+
const ids = new WeakMap();
|
|
126
|
+
let nextId = 1;
|
|
127
|
+
const encode = node => {
|
|
128
|
+
if (node === null || typeof node !== "object") return node;
|
|
129
|
+
if (ArrayBuffer.isView(node)) return Array.from(node, encode);
|
|
130
|
+
if (node instanceof Date) return node.toISOString();
|
|
131
|
+
const repeated = (counts.get(node) || 0) > 1;
|
|
132
|
+
if (ids.has(node)) return {
|
|
133
|
+
[options.refField]: ids.get(node)
|
|
134
|
+
};
|
|
135
|
+
let id = null;
|
|
136
|
+
if (repeated) {
|
|
137
|
+
id = nextId++;
|
|
138
|
+
ids.set(node, id);
|
|
139
|
+
}
|
|
140
|
+
if (Array.isArray(node)) {
|
|
141
|
+
const values = node.map(encode);
|
|
142
|
+
return repeated ? {
|
|
143
|
+
[options.idField]: id,
|
|
144
|
+
[options.valuesField]: values
|
|
145
|
+
} : values;
|
|
146
|
+
}
|
|
147
|
+
if (repeated && Object.prototype.hasOwnProperty.call(node, options.idField)) {
|
|
148
|
+
throw new TypeError(`CjsYamlFormat cannot encode repeated mapping: reserved field "${options.idField}" already exists`);
|
|
149
|
+
}
|
|
150
|
+
const out = repeated ? {
|
|
151
|
+
[options.idField]: id
|
|
152
|
+
} : {};
|
|
153
|
+
for (const key of Object.keys(node)) defineMappingValue(out, key, encode(node[key]));
|
|
154
|
+
return out;
|
|
155
|
+
};
|
|
156
|
+
return encode(value);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export { DEFAULT_VALUES, OUTPUT_DOCUMENT, OUTPUT_JSON, OUTPUT_PAYLOAD, OUTPUT_RAW, TAG_HANDLE, TAG_PRESERVE, TAG_REJECT, normalizeValues, toJsonGraph };
|
|
160
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.js","sources":["../../../../../src/formats/yaml/core/helpers.js"],"sourcesContent":["export const OUTPUT_JSON = \"json\";\nexport const OUTPUT_PAYLOAD = \"payload\";\nexport const OUTPUT_RAW = \"raw\";\nexport const OUTPUT_DOCUMENT = \"document\";\n\nexport const TAG_PRESERVE = \"preserve\";\nexport const TAG_REJECT = \"reject\";\nexport const TAG_HANDLE = \"handle\";\n\nexport const DEFAULT_VALUES = Object.freeze({\n emit: OUTPUT_PAYLOAD,\n tagPolicy: TAG_PRESERVE,\n allowedTags: null,\n tagHandlers: Object.freeze({}),\n sourceName: null,\n maxAliasCount: 100,\n uniqueKeys: true,\n idField: \"$yamlId\",\n refField: \"$yamlRef\",\n valuesField: \"$yamlValues\",\n tagField: \"$yamlTag\",\n valueField: \"$yamlValue\"\n});\n\nconst OPTION_KEYS = new Set(Object.keys(DEFAULT_VALUES));\n\nfunction hasOwn(value, key)\n{\n return Object.prototype.hasOwnProperty.call(value, key);\n}\n\nfunction defineMappingValue(target, key, value)\n{\n Object.defineProperty(target, key, {\n value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n}\n\nfunction normalizeEmit(value, readerName)\n{\n if (value === OUTPUT_JSON || value === OUTPUT_PAYLOAD) return value;\n if (value === OUTPUT_RAW || value === OUTPUT_DOCUMENT) return value;\n throw new TypeError(`${readerName} unknown emit value \"${value}\"`);\n}\n\nfunction normalizeTagPolicy(value, readerName)\n{\n if (value === TAG_PRESERVE || value === TAG_REJECT || value === TAG_HANDLE) return value;\n throw new TypeError(`${readerName} unknown tagPolicy value \"${value}\"`);\n}\n\nfunction normalizeAllowedTags(value, readerName)\n{\n if (value === null || value === undefined) return null;\n if (!Array.isArray(value) && !(value instanceof Set))\n {\n throw new TypeError(`${readerName} allowedTags must be an array, Set, or null`);\n }\n return [ ...value ];\n}\n\nfunction normalizeTagHandlers(value, readerName)\n{\n if (value instanceof Map)\n {\n for (const [ tag, handler ] of value)\n {\n if (typeof handler !== \"function\")\n {\n throw new TypeError(`${readerName} tag handler \"${tag}\" must be a function`);\n }\n }\n return new Map(value);\n }\n if (!value || typeof value !== \"object\" || Array.isArray(value))\n {\n throw new TypeError(`${readerName} tagHandlers must be an object or Map`);\n }\n for (const [ tag, handler ] of Object.entries(value))\n {\n if (typeof handler !== \"function\")\n {\n throw new TypeError(`${readerName} tag handler \"${tag}\" must be a function`);\n }\n }\n return { ...value };\n}\n\nfunction normalizeField(value, name, readerName)\n{\n if (typeof value !== \"string\" || !value)\n {\n throw new TypeError(`${readerName} ${name} must be a non-empty string`);\n }\n return value;\n}\n\nfunction normalizeBoolean(value, name, readerName)\n{\n if (typeof value !== \"boolean\") throw new TypeError(`${readerName} ${name} must be a boolean`);\n return value;\n}\n\nexport function normalizeValues(base, options = {}, readerName = \"CjsYamlFormat\")\n{\n if (!options || typeof options !== \"object\" || Array.isArray(options))\n {\n throw new TypeError(`${readerName} options must be an object`);\n }\n\n for (const key of Object.keys(options))\n {\n if (!OPTION_KEYS.has(key)) throw new TypeError(`${readerName} unknown option \"${key}\"`);\n }\n\n const values = {\n ...base,\n allowedTags: base.allowedTags ? [ ...base.allowedTags ] : null,\n tagHandlers: base.tagHandlers instanceof Map ? new Map(base.tagHandlers) : { ...base.tagHandlers }\n };\n\n if (hasOwn(options, \"emit\")) values.emit = normalizeEmit(options.emit, readerName);\n if (hasOwn(options, \"tagPolicy\")) values.tagPolicy = normalizeTagPolicy(options.tagPolicy, readerName);\n if (hasOwn(options, \"allowedTags\")) values.allowedTags = normalizeAllowedTags(options.allowedTags, readerName);\n if (hasOwn(options, \"tagHandlers\")) values.tagHandlers = normalizeTagHandlers(options.tagHandlers, readerName);\n if (hasOwn(options, \"sourceName\")) values.sourceName = options.sourceName == null ? null : String(options.sourceName);\n if (hasOwn(options, \"maxAliasCount\"))\n {\n if (!Number.isInteger(options.maxAliasCount) || options.maxAliasCount < 0)\n {\n throw new TypeError(`${readerName} maxAliasCount must be a non-negative integer`);\n }\n values.maxAliasCount = options.maxAliasCount;\n }\n if (hasOwn(options, \"uniqueKeys\"))\n {\n values.uniqueKeys = normalizeBoolean(options.uniqueKeys, \"uniqueKeys\", readerName);\n }\n\n for (const name of [ \"idField\", \"refField\", \"valuesField\", \"tagField\", \"valueField\" ])\n {\n if (hasOwn(options, name)) values[name] = normalizeField(options[name], name, readerName);\n }\n\n return values;\n}\n\nexport function toJsonGraph(value, options)\n{\n const counts = new WeakMap();\n const traversed = new WeakSet();\n\n const count = (node) =>\n {\n if (!node || typeof node !== \"object\") return;\n counts.set(node, (counts.get(node) || 0) + 1);\n if (traversed.has(node)) return;\n traversed.add(node);\n if (Array.isArray(node)) node.forEach(count);\n else Object.keys(node).forEach(key => count(node[key]));\n };\n count(value);\n\n const ids = new WeakMap();\n let nextId = 1;\n\n const encode = (node) =>\n {\n if (node === null || typeof node !== \"object\") return node;\n if (ArrayBuffer.isView(node)) return Array.from(node, encode);\n if (node instanceof Date) return node.toISOString();\n\n const repeated = (counts.get(node) || 0) > 1;\n if (ids.has(node)) return { [options.refField]: ids.get(node) };\n\n let id = null;\n if (repeated)\n {\n id = nextId++;\n ids.set(node, id);\n }\n\n if (Array.isArray(node))\n {\n const values = node.map(encode);\n return repeated ? { [options.idField]: id, [options.valuesField]: values } : values;\n }\n\n if (repeated && Object.prototype.hasOwnProperty.call(node, options.idField))\n {\n throw new TypeError(`CjsYamlFormat cannot encode repeated mapping: reserved field \"${options.idField}\" already exists`);\n }\n\n const out = repeated ? { [options.idField]: id } : {};\n for (const key of Object.keys(node)) defineMappingValue(out, key, encode(node[key]));\n return out;\n };\n\n return encode(value);\n}\n"],"names":["OUTPUT_JSON","OUTPUT_PAYLOAD","OUTPUT_RAW","OUTPUT_DOCUMENT","TAG_PRESERVE","TAG_REJECT","TAG_HANDLE","DEFAULT_VALUES","Object","freeze","emit","tagPolicy","allowedTags","tagHandlers","sourceName","maxAliasCount","uniqueKeys","idField","refField","valuesField","tagField","valueField","OPTION_KEYS","Set","keys","hasOwn","value","key","prototype","hasOwnProperty","call","defineMappingValue","target","defineProperty","enumerable","configurable","writable","normalizeEmit","readerName","TypeError","normalizeTagPolicy","normalizeAllowedTags","undefined","Array","isArray","normalizeTagHandlers","Map","tag","handler","entries","normalizeField","name","normalizeBoolean","normalizeValues","base","options","has","values","String","Number","isInteger","toJsonGraph","counts","WeakMap","traversed","WeakSet","count","node","set","get","add","forEach","ids","nextId","encode","ArrayBuffer","isView","from","Date","toISOString","repeated","id","map","out"],"mappings":"AAAO,MAAMA,WAAW,GAAG;AACpB,MAAMC,cAAc,GAAG;AACvB,MAAMC,UAAU,GAAG;AACnB,MAAMC,eAAe,GAAG;AAExB,MAAMC,YAAY,GAAG;AACrB,MAAMC,UAAU,GAAG;AACnB,MAAMC,UAAU,GAAG;MAEbC,cAAc,GAAGC,MAAM,CAACC,MAAM,CAAC;AACxCC,EAAAA,IAAI,EAAET,cAAc;AACpBU,EAAAA,SAAS,EAAEP,YAAY;AACvBQ,EAAAA,WAAW,EAAE,IAAI;AACjBC,EAAAA,WAAW,EAAEL,MAAM,CAACC,MAAM,CAAC,EAAE,CAAC;AAC9BK,EAAAA,UAAU,EAAE,IAAI;AAChBC,EAAAA,aAAa,EAAE,GAAG;AAClBC,EAAAA,UAAU,EAAE,IAAI;AAChBC,EAAAA,OAAO,EAAE,SAAS;AAClBC,EAAAA,QAAQ,EAAE,UAAU;AACpBC,EAAAA,WAAW,EAAE,aAAa;AAC1BC,EAAAA,QAAQ,EAAE,UAAU;AACpBC,EAAAA,UAAU,EAAE;AAChB,CAAC;AAED,MAAMC,WAAW,GAAG,IAAIC,GAAG,CAACf,MAAM,CAACgB,IAAI,CAACjB,cAAc,CAAC,CAAC;AAExD,SAASkB,MAAMA,CAACC,KAAK,EAAEC,GAAG,EAC1B;EACI,OAAOnB,MAAM,CAACoB,SAAS,CAACC,cAAc,CAACC,IAAI,CAACJ,KAAK,EAAEC,GAAG,CAAC;AAC3D;AAEA,SAASI,kBAAkBA,CAACC,MAAM,EAAEL,GAAG,EAAED,KAAK,EAC9C;AACIlB,EAAAA,MAAM,CAACyB,cAAc,CAACD,MAAM,EAAEL,GAAG,EAAE;IA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