@carbonenginejs/runtime-resource 0.1.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/FORMAT-PROVENANCE.md +155 -135
- package/LICENSE +21 -21
- package/NOTICE +29 -29
- package/README.md +548 -241
- package/dist/CjsMotherLode.js +1271 -56
- package/dist/CjsMotherLode.js.map +1 -1
- package/dist/CjsResMan.js +3005 -740
- package/dist/CjsResMan.js.map +1 -1
- package/dist/CjsResManQueue.js +214 -214
- package/dist/CjsResource.js +566 -366
- package/dist/CjsResource.js.map +1 -1
- package/dist/CjsResourceSource.js +59 -59
- package/dist/_virtual/_rollupPluginBabelHelpers.js +153 -153
- package/dist/format/CjsBlueReader.js +269 -0
- package/dist/format/CjsBlueReader.js.map +1 -0
- package/dist/format/CjsFormat.js +192 -178
- package/dist/format/CjsFormat.js.map +1 -1
- package/dist/format/CjsReader.js +18 -0
- package/dist/format/CjsReader.js.map +1 -0
- package/dist/format/CjsResourceProbe.js +277 -269
- package/dist/format/CjsResourceProbe.js.map +1 -1
- package/dist/format/payloadContract.js +173 -173
- package/dist/formats/black/CjsBlackFormat.js +278 -272
- package/dist/formats/black/CjsBlackFormat.js.map +1 -1
- package/dist/formats/black/core/CjsBlackBinaryReader.js +153 -153
- package/dist/formats/black/core/CjsBlackPropertyReaders.js +382 -382
- package/dist/formats/black/core/CjsBlackReader.js +639 -760
- package/dist/formats/black/core/CjsBlackReader.js.map +1 -1
- package/dist/formats/black/core/CjsBlackSchemaRegistry.js +433 -433
- package/dist/formats/black/core/black-schema-v1-2026-07-11.json.js +4 -4
- package/dist/formats/black/core/blackConstants.js +7 -7
- package/dist/formats/black/core/blackDefinitions.js +10 -10
- package/dist/formats/black/core/blackEnums.js +6 -6
- package/dist/formats/black/core/blackSchema.js +3 -3
- package/dist/formats/black/core/blackVersion.js +22 -22
- package/dist/formats/black/core/helpers.js +182 -182
- package/dist/formats/black/core/schema.js +4 -4
- package/dist/formats/black/index.js +2 -2
- package/dist/formats/bnk/CjsBnkFormat.js +238 -245
- package/dist/formats/bnk/CjsBnkFormat.js.map +1 -1
- package/dist/formats/bnk/core/graph.js +140 -0
- package/dist/formats/bnk/core/graph.js.map +1 -0
- package/dist/formats/bnk/core/helpers.js +409 -354
- package/dist/formats/bnk/core/helpers.js.map +1 -1
- package/dist/formats/bnk/core/musicNodes.js +521 -0
- package/dist/formats/bnk/core/musicNodes.js.map +1 -0
- package/dist/formats/bnk/core/soundbanksInfo.js +246 -246
- package/dist/formats/bnk/index.js +2 -3
- package/dist/formats/bnk/index.js.map +1 -1
- package/dist/formats/cmf/CjsCmfFormat.js +497 -491
- package/dist/formats/cmf/CjsCmfFormat.js.map +1 -1
- package/dist/formats/cmf/core/binary.js +118 -118
- package/dist/formats/cmf/core/buffers.js +233 -233
- package/dist/formats/cmf/core/constants.js +47 -47
- package/dist/formats/cmf/core/gr2Anim.js +453 -453
- package/dist/formats/cmf/core/helpers.js +287 -287
- package/dist/formats/cmf/core/pack.js +276 -276
- package/dist/formats/cmf/core/schema.js +364 -364
- package/dist/formats/cmf/core/shared.js +268 -268
- package/dist/formats/cmf/core/writer.js +517 -517
- package/dist/formats/cmf/index.js +2 -2
- package/dist/formats/dds/CjsDdsFormat.js +193 -187
- package/dist/formats/dds/CjsDdsFormat.js.map +1 -1
- package/dist/formats/dds/core/bc6h.js +288 -0
- package/dist/formats/dds/core/bc6h.js.map +1 -0
- package/dist/formats/dds/core/bc7.js +251 -0
- package/dist/formats/dds/core/bc7.js.map +1 -0
- package/dist/formats/dds/core/helpers.js +815 -812
- package/dist/formats/dds/core/helpers.js.map +1 -1
- package/dist/formats/dds/index.js +2 -2
- package/dist/formats/fbx/CjsFbxFormat.js +266 -260
- package/dist/formats/fbx/CjsFbxFormat.js.map +1 -1
- package/dist/formats/fbx/core/helpers.js +3901 -3901
- package/dist/formats/fbx/index.js +2 -2
- package/dist/formats/flac/CjsFlacFormat.js +87 -81
- package/dist/formats/flac/CjsFlacFormat.js.map +1 -1
- package/dist/formats/flac/core/helpers.js +295 -295
- package/dist/formats/flac/index.js +2 -2
- package/dist/formats/gif/CjsGifFormat.js +87 -81
- package/dist/formats/gif/CjsGifFormat.js.map +1 -1
- package/dist/formats/gif/core/helpers.js +360 -360
- package/dist/formats/gif/index.js +2 -2
- package/dist/formats/gltf/CjsGltfFormat.js +290 -284
- package/dist/formats/gltf/CjsGltfFormat.js.map +1 -1
- package/dist/formats/gltf/core/helpers.js +292 -292
- package/dist/formats/gltf/core/json.js +79 -79
- package/dist/formats/gltf/core/parser.js +666 -666
- package/dist/formats/gltf/core/targets.js +163 -163
- package/dist/formats/gltf/index.js +2 -2
- package/dist/formats/index.js +23 -23
- package/dist/formats/jpeg/CjsJpegFormat.js +206 -200
- package/dist/formats/jpeg/CjsJpegFormat.js.map +1 -1
- package/dist/formats/jpeg/core/helpers.js +350 -350
- package/dist/formats/jpeg/core/jpeg.js +377 -377
- package/dist/formats/jpeg/index.js +2 -2
- package/dist/formats/mp3/CjsMp3Format.js +192 -186
- package/dist/formats/mp3/CjsMp3Format.js.map +1 -1
- package/dist/formats/mp3/core/helpers.js +338 -338
- package/dist/formats/mp3/index.js +2 -2
- package/dist/formats/mp4/CjsMp4Format.js +191 -185
- package/dist/formats/mp4/CjsMp4Format.js.map +1 -1
- package/dist/formats/mp4/core/helpers.js +449 -449
- package/dist/formats/mp4/index.js +2 -2
- package/dist/formats/obj/CjsObjFormat.js +253 -247
- package/dist/formats/obj/CjsObjFormat.js.map +1 -1
- package/dist/formats/obj/core/helpers.js +573 -573
- package/dist/formats/obj/core/json.js +64 -64
- package/dist/formats/obj/core/parser.js +321 -321
- package/dist/formats/obj/index.js +2 -2
- package/dist/formats/ogg/CjsOggFormat.js +88 -82
- package/dist/formats/ogg/CjsOggFormat.js.map +1 -1
- package/dist/formats/ogg/core/helpers.js +387 -387
- package/dist/formats/ogg/core/imdct.js +178 -178
- package/dist/formats/ogg/core/vorbis.js +999 -999
- package/dist/formats/ogg/index.js +2 -2
- package/dist/formats/png/CjsPngFormat.js +195 -189
- package/dist/formats/png/CjsPngFormat.js.map +1 -1
- package/dist/formats/png/core/helpers.js +583 -583
- package/dist/formats/png/index.js +2 -2
- package/dist/formats/red/CjsRedFormat.js +261 -247
- package/dist/formats/red/CjsRedFormat.js.map +1 -1
- package/dist/formats/red/core/CjsRedReader.js +194 -201
- package/dist/formats/red/core/CjsRedReader.js.map +1 -1
- package/dist/formats/red/core/blackDefinitions.js +3 -3
- package/dist/formats/red/core/helpers.js +139 -136
- package/dist/formats/red/core/helpers.js.map +1 -1
- package/dist/formats/red/core/redGraph.js +68 -68
- package/dist/formats/red/core/schema.js +4 -4
- package/dist/formats/red/index.js +2 -2
- package/dist/formats/stl/CjsStlFormat.js +365 -304
- package/dist/formats/stl/CjsStlFormat.js.map +1 -1
- package/dist/formats/stl/core/helpers.js +261 -257
- package/dist/formats/stl/core/helpers.js.map +1 -1
- package/dist/formats/stl/core/json.js +51 -51
- package/dist/formats/stl/core/stl.js +629 -544
- package/dist/formats/stl/core/stl.js.map +1 -1
- package/dist/formats/stl/core/targets.js +163 -163
- package/dist/formats/stl/index.js +2 -2
- package/dist/formats/tga/CjsTgaFormat.js +192 -186
- package/dist/formats/tga/CjsTgaFormat.js.map +1 -1
- package/dist/formats/tga/core/helpers.js +446 -446
- package/dist/formats/tga/index.js +2 -2
- package/dist/formats/wav/CjsWavFormat.js +192 -186
- package/dist/formats/wav/CjsWavFormat.js.map +1 -1
- package/dist/formats/wav/core/helpers.js +328 -328
- package/dist/formats/wav/index.js +2 -2
- package/dist/formats/webm/CjsWebmFormat.js +191 -185
- package/dist/formats/webm/CjsWebmFormat.js.map +1 -1
- package/dist/formats/webm/core/helpers.js +537 -537
- package/dist/formats/webm/index.js +2 -2
- package/dist/formats/webp/CjsWebpFormat.js +86 -80
- package/dist/formats/webp/CjsWebpFormat.js.map +1 -1
- package/dist/formats/webp/core/helpers.js +214 -214
- package/dist/formats/webp/index.js +2 -2
- package/dist/formats/wem/CjsWemFormat.js +241 -197
- package/dist/formats/wem/CjsWemFormat.js.map +1 -1
- package/dist/formats/wem/core/bitStream.js +259 -259
- package/dist/formats/wem/core/codebookLibrary.js +164 -164
- package/dist/formats/wem/core/helpers.js +417 -336
- package/dist/formats/wem/core/helpers.js.map +1 -1
- package/dist/formats/wem/core/packedCodebooksAotuv603.js +30 -30
- package/dist/formats/wem/core/ptadpcm.js +77 -0
- package/dist/formats/wem/core/ptadpcm.js.map +1 -0
- package/dist/formats/wem/core/resolve.js +121 -0
- package/dist/formats/wem/core/resolve.js.map +1 -0
- package/dist/formats/wem/core/wemToOgg.js +485 -485
- package/dist/formats/wem/index.js +2 -2
- package/dist/formats/yaml/CjsYamlFormat.js +83 -77
- package/dist/formats/yaml/CjsYamlFormat.js.map +1 -1
- package/dist/formats/yaml/core/CjsYamlReader.js +305 -304
- package/dist/formats/yaml/core/CjsYamlReader.js.map +1 -1
- package/dist/formats/yaml/core/helpers.js +160 -160
- package/dist/formats/yaml/index.js +2 -2
- package/dist/index.js +48 -52
- package/dist/index.js.map +1 -1
- package/dist/resourcePath.js +18 -18
- package/dist/resourceStates.js +9 -9
- package/dist/{generated/resources → resources}/AudioGeometryResData.js +47 -47
- package/dist/resources/AudioGeometryResData.js.map +1 -0
- package/dist/{generated/resources → resources}/GStateBindingCallbackData.js +31 -31
- package/dist/resources/GStateBindingCallbackData.js.map +1 -0
- package/dist/{generated/resources → resources}/MeshDecalData.js +37 -37
- package/dist/resources/MeshDecalData.js.map +1 -0
- package/dist/{generated/resources → resources}/MeshDecalLodData.js +34 -34
- package/dist/resources/MeshDecalLodData.js.map +1 -0
- package/dist/resources/Tr2EffectRes.js +71 -71
- package/dist/resources/Tr2GrannyIntersectionResult.js +60 -0
- package/dist/resources/Tr2GrannyIntersectionResult.js.map +1 -0
- package/dist/resources/Tr2GrannyStateRes.js +44 -44
- package/dist/resources/Tr2ImageRes.js +114 -114
- package/dist/resources/Tr2LightProfileRes.js +40 -40
- package/dist/{generated/resources → resources}/Tr2MaterialArea.js +34 -34
- package/dist/resources/Tr2MaterialArea.js.map +1 -0
- package/dist/{generated/resources → resources}/Tr2MaterialMesh.js +31 -31
- package/dist/resources/Tr2MaterialMesh.js.map +1 -0
- package/dist/{generated/resources → resources}/Tr2MaterialRes.js +34 -34
- package/dist/resources/Tr2MaterialRes.js.map +1 -0
- package/dist/{generated/resources → resources}/Tr2ShaderPermutation.js +43 -43
- package/dist/resources/Tr2ShaderPermutation.js.map +1 -0
- package/dist/{generated/resources → resources}/Tr2TextureLodManager.js +100 -60
- package/dist/resources/Tr2TextureLodManager.js.map +1 -0
- package/dist/{generated/resources → resources}/Tr2TextureLodUpdateRequest.js +37 -37
- package/dist/resources/Tr2TextureLodUpdateRequest.js.map +1 -0
- package/dist/{generated/resources → resources}/Tr2TexturePackChannel.js +37 -37
- package/dist/resources/Tr2TexturePackChannel.js.map +1 -0
- package/dist/resources/Tr2TexturePipeline.js +68 -0
- package/dist/resources/Tr2TexturePipeline.js.map +1 -0
- package/dist/{generated/resources → resources}/Tr2TexturePipelineParams.js +34 -34
- package/dist/resources/Tr2TexturePipelineParams.js.map +1 -0
- package/dist/{generated/resources → resources}/Tr2TexturePipelineStepCompress.js +40 -40
- package/dist/resources/Tr2TexturePipelineStepCompress.js.map +1 -0
- package/dist/{generated/resources → resources}/Tr2TexturePipelineStepLimitSize.js +34 -34
- package/dist/resources/Tr2TexturePipelineStepLimitSize.js.map +1 -0
- package/dist/{generated/resources → resources}/Tr2TexturePipelineStepLoad.js +31 -31
- package/dist/resources/Tr2TexturePipelineStepLoad.js.map +1 -0
- package/dist/{generated/resources → resources}/Tr2TexturePipelineStepPack.js +43 -43
- package/dist/resources/Tr2TexturePipelineStepPack.js.map +1 -0
- package/dist/resources/TriGeometryRes.js +239 -216
- package/dist/resources/TriGeometryRes.js.map +1 -1
- package/dist/{generated/resources → resources}/TriGeometryResAreaData.js +59 -59
- package/dist/resources/TriGeometryResAreaData.js.map +1 -0
- package/dist/{generated/resources → resources}/TriGeometryResJointData.js +38 -38
- package/dist/resources/TriGeometryResJointData.js.map +1 -0
- package/dist/{generated/resources → resources}/TriGeometryResLodData.js +88 -88
- package/dist/resources/TriGeometryResLodData.js.map +1 -0
- package/dist/{generated/resources → resources}/TriGeometryResMeshData.js +63 -63
- package/dist/resources/TriGeometryResMeshData.js.map +1 -0
- package/dist/{generated/resources → resources}/TriGeometryResSkeletonData.js +34 -34
- package/dist/resources/TriGeometryResSkeletonData.js.map +1 -0
- package/dist/resources/TriGrannyRes.js +43 -43
- package/dist/{generated/resources → resources}/TriJointBinding.js +38 -38
- package/dist/resources/TriJointBinding.js.map +1 -0
- package/dist/{generated/resources → resources}/TriMorphTargetGeometryConstants.js +46 -46
- package/dist/resources/TriMorphTargetGeometryConstants.js.map +1 -0
- package/dist/{generated/resources → resources}/TriRtGeometryConstants.js +88 -88
- package/dist/resources/TriRtGeometryConstants.js.map +1 -0
- package/dist/resources/TriTextureRes.js +304 -304
- package/dist/{generated/resources → resources}/enums.js +18 -18
- package/dist/resources/enums.js.map +1 -0
- package/dist/resources/resourceBoundary.js +47 -47
- package/dist/resources/texturePipelineBehavior.js +320 -0
- package/dist/resources/texturePipelineBehavior.js.map +1 -0
- package/dist/texture/CjsTextureArrayRes.js +406 -406
- package/dist/texture/CjsTextureParameterProxy.js +133 -133
- package/format-notices/black/LICENSE +21 -21
- package/format-notices/black/NOTICE +47 -47
- package/format-notices/bnk/LICENSE +21 -21
- package/format-notices/bnk/NOTICE +20 -17
- package/format-notices/cmf/LICENSE +21 -21
- package/format-notices/cmf/NOTICE +36 -36
- package/format-notices/dds/LICENSE +21 -21
- package/format-notices/dds/NOTICE +14 -14
- package/format-notices/fbx/LICENSE +21 -21
- package/format-notices/fbx/NOTICE +14 -14
- package/format-notices/flac/LICENSE +21 -21
- package/format-notices/flac/NOTICE +14 -14
- package/format-notices/gif/LICENSE +21 -21
- package/format-notices/gif/NOTICE +14 -14
- package/format-notices/gltf/LICENSE +21 -21
- package/format-notices/gltf/NOTICE +27 -27
- package/format-notices/jpeg/LICENSE +21 -21
- package/format-notices/jpeg/NOTICE +14 -14
- package/format-notices/mp3/LICENSE +21 -21
- package/format-notices/mp3/NOTICE +14 -14
- package/format-notices/mp4/LICENSE +21 -21
- package/format-notices/mp4/NOTICE +14 -14
- package/format-notices/obj/LICENSE +21 -21
- package/format-notices/obj/NOTICE +26 -26
- package/format-notices/ogg/LICENSE +21 -21
- package/format-notices/ogg/NOTICE +28 -28
- package/format-notices/png/LICENSE +21 -21
- package/format-notices/png/NOTICE +14 -14
- package/format-notices/red/LICENSE +21 -21
- package/format-notices/red/NOTICE +31 -31
- package/format-notices/stl/LICENSE +21 -21
- package/format-notices/stl/NOTICE +21 -21
- package/format-notices/tga/LICENSE +21 -21
- package/format-notices/tga/NOTICE +14 -14
- package/format-notices/wav/LICENSE +21 -21
- package/format-notices/wav/NOTICE +14 -14
- package/format-notices/webm/LICENSE +21 -21
- package/format-notices/webm/NOTICE +14 -14
- package/format-notices/webp/LICENSE +21 -21
- package/format-notices/webp/NOTICE +14 -14
- package/format-notices/wem/LICENSE +57 -57
- package/format-notices/wem/NOTICE +33 -33
- package/format-notices/yaml/LICENSE +21 -21
- package/format-notices/yaml/NOTICE +44 -44
- package/package.json +51 -51
- package/resource-lifecycle.md +679 -487
- package/dist/generated/resources/AudioGeometryResData.js.map +0 -1
- package/dist/generated/resources/CmfVertexReader.js +0 -46
- package/dist/generated/resources/CmfVertexReader.js.map +0 -1
- package/dist/generated/resources/GStateBindingCallbackData.js.map +0 -1
- package/dist/generated/resources/MeshDecalData.js.map +0 -1
- package/dist/generated/resources/MeshDecalLodData.js.map +0 -1
- package/dist/generated/resources/Tr2AsyncSave.js +0 -46
- package/dist/generated/resources/Tr2AsyncSave.js.map +0 -1
- package/dist/generated/resources/Tr2CmfContents.js +0 -37
- package/dist/generated/resources/Tr2CmfContents.js.map +0 -1
- package/dist/generated/resources/Tr2GrannyIntersectionResult.js +0 -58
- package/dist/generated/resources/Tr2GrannyIntersectionResult.js.map +0 -1
- package/dist/generated/resources/Tr2LoadPrepareFence.js +0 -37
- package/dist/generated/resources/Tr2LoadPrepareFence.js.map +0 -1
- package/dist/generated/resources/Tr2MaterialArea.js.map +0 -1
- package/dist/generated/resources/Tr2MaterialMesh.js.map +0 -1
- package/dist/generated/resources/Tr2MaterialRes.js.map +0 -1
- package/dist/generated/resources/Tr2ShaderPermutation.js.map +0 -1
- package/dist/generated/resources/Tr2TextureLodManager.js.map +0 -1
- package/dist/generated/resources/Tr2TextureLodUpdateRequest.js.map +0 -1
- package/dist/generated/resources/Tr2TexturePackChannel.js.map +0 -1
- package/dist/generated/resources/Tr2TexturePipeline.js +0 -44
- package/dist/generated/resources/Tr2TexturePipeline.js.map +0 -1
- package/dist/generated/resources/Tr2TexturePipelineParams.js.map +0 -1
- package/dist/generated/resources/Tr2TexturePipelineStepCompress.js.map +0 -1
- package/dist/generated/resources/Tr2TexturePipelineStepLimitSize.js.map +0 -1
- package/dist/generated/resources/Tr2TexturePipelineStepLoad.js.map +0 -1
- package/dist/generated/resources/Tr2TexturePipelineStepPack.js.map +0 -1
- package/dist/generated/resources/TriGeometryResAreaData.js.map +0 -1
- package/dist/generated/resources/TriGeometryResJointData.js.map +0 -1
- package/dist/generated/resources/TriGeometryResLodData.js.map +0 -1
- package/dist/generated/resources/TriGeometryResMeshData.js.map +0 -1
- package/dist/generated/resources/TriGeometryResSkeletonData.js.map +0 -1
- package/dist/generated/resources/TriJointBinding.js.map +0 -1
- package/dist/generated/resources/TriMorphTargetGeometryConstants.js.map +0 -1
- package/dist/generated/resources/TriRtGeometryConstants.js.map +0 -1
- package/dist/generated/resources/enums.js.map +0 -1
- package/dist/generated/resources/index.js +0 -32
- package/dist/generated/resources/index.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CjsYamlReader.js","sources":["../../../../../src/formats/yaml/core/CjsYamlReader.js"],"sourcesContent":["import {\n LineCounter,\n isAlias,\n isMap,\n isScalar,\n isSeq,\n parseDocument,\n visit\n} from \"yaml\";\n\nimport { TAG_HANDLE, TAG_PRESERVE, TAG_REJECT, toJsonGraph } from \"./helpers.js\";\n\nconst TAG_PREFIX = \"tag:yaml.org,2002:\";\nconst PYTHON_TUPLE = `${TAG_PREFIX}python/tuple`;\nconst PYTHON_UNICODE = `${TAG_PREFIX}python/unicode`;\nconst PYTHON_PROJECTED_DECAL = `${TAG_PREFIX}python/object:paperDoll.ProjectedDecal`;\nconst PYTHON_PART_METADATA = `${TAG_PREFIX}python/object:paperDoll.AvatarPartMetaData`;\n\nconst STANDARD_TAGS = new Set([\n \"binary\", \"bool\", \"float\", \"int\", \"map\", \"merge\", \"null\", \"omap\",\n \"pairs\", \"seq\", \"set\", \"str\", \"timestamp\"\n].map(name => `${TAG_PREFIX}${name}`));\n\nfunction canonicalTag(tag)\n{\n if (typeof tag !== \"string\") return tag;\n if (tag.startsWith(\"!!\")) return `${TAG_PREFIX}${tag.slice(2)}`;\n return tag;\n}\n\nfunction displayMessage(error)\n{\n return String(error && error.message ? error.message : error).trim();\n}\n\nfunction defineMappingValue(target, key, value)\n{\n Object.defineProperty(target, key, {\n value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n}\n\nexport class CjsYamlReader\n{\n constructor(input, options = {})\n {\n if (typeof input !== \"string\")\n {\n throw new TypeError(\"CjsYamlFormat input must be a YAML string\");\n }\n\n this.source = input;\n this.options = options;\n this.lineCounter = new LineCounter();\n this.document = parseDocument(input, {\n keepSourceTokens: true,\n lineCounter: this.lineCounter,\n prettyErrors: true,\n strict: true,\n uniqueKeys: this.options.uniqueKeys\n });\n this.inventory = this.BuildInventory();\n }\n\n Read()\n {\n return this.ReadPayload();\n }\n\n ReadPayload()\n {\n return toJsonGraph(this.ReadRaw(), this.options);\n }\n\n ReadRaw()\n {\n this.AssertSyntax();\n this.AssertAliasLimit();\n return this.Convert(this.document.contents, new Map());\n }\n\n ReadDocument()\n {\n let value = null;\n const errors = this.inventory.errors.slice();\n\n if (!errors.length)\n {\n try\n {\n this.AssertAliasLimit();\n value = this.Convert(this.document.contents, new Map());\n }\n catch (error)\n {\n errors.push(this.DescribeError(error));\n }\n }\n\n return {\n format: { id: \"yaml\" },\n source: { name: this.options.sourceName, length: this.source.length },\n root: { kind: this.RootKind() },\n value,\n tags: this.inventory.tags,\n anchors: this.inventory.anchors,\n aliases: this.inventory.aliases,\n warnings: this.inventory.warnings,\n errors\n };\n }\n\n Inspect()\n {\n return {\n format: { id: \"yaml\" },\n source: { name: this.options.sourceName, length: this.source.length },\n root: { kind: this.RootKind() },\n tags: this.inventory.tags,\n anchors: this.inventory.anchors,\n aliases: this.inventory.aliases,\n warnings: this.inventory.warnings,\n errors: this.inventory.errors\n };\n }\n\n RootKind()\n {\n const node = this.document.contents;\n if (node === null) return \"null\";\n if (isMap(node)) return \"mapping\";\n if (isSeq(node)) return \"sequence\";\n if (isScalar(node)) return \"scalar\";\n if (isAlias(node)) return \"alias\";\n return \"unknown\";\n }\n\n AssertSyntax()\n {\n if (!this.document.errors.length) return;\n const first = this.document.errors[0];\n const source = this.options.sourceName ? ` in ${this.options.sourceName}` : \"\";\n throw new SyntaxError(`CjsYamlFormat${source}: ${displayMessage(first)}`);\n }\n\n AssertAliasLimit()\n {\n if (this.inventory.aliases.length <= this.options.maxAliasCount) return;\n const source = this.options.sourceName ? ` in ${this.options.sourceName}` : \"\";\n throw new RangeError(`CjsYamlFormat${source}: alias count ${this.inventory.aliases.length} exceeds maxAliasCount ${this.options.maxAliasCount}`);\n }\n\n Convert(node, memo)\n {\n if (node === null || node === undefined) return null;\n\n if (isAlias(node))\n {\n const source = node.resolve(this.document);\n if (!source) throw this.NodeError(node, `unresolved alias \"${node.source}\"`);\n return this.Convert(source, memo);\n }\n\n if (memo.has(node)) return memo.get(node);\n\n const tag = this.CustomTag(node);\n if (tag)\n {\n this.AssertTagAllowed(tag, node);\n const handler = this.FindTagHandler(tag);\n\n if (handler)\n {\n const value = this.ConvertBase(node, memo, true);\n const handled = handler(value, this.TagContext(tag, node));\n memo.set(node, handled);\n return handled;\n }\n\n if (tag === PYTHON_TUPLE)\n {\n if (!isSeq(node)) throw this.NodeError(node, `${tag} must decorate a sequence`);\n return this.ConvertBase(node, memo, true);\n }\n\n if (tag === PYTHON_UNICODE)\n {\n if (!isScalar(node) || typeof node.value !== \"string\")\n {\n throw this.NodeError(node, `${tag} must decorate a string scalar`);\n }\n return node.value;\n }\n\n if (this.options.tagPolicy === TAG_REJECT)\n {\n throw this.NodeError(node, `custom tag \"${tag}\" is rejected by tagPolicy`);\n }\n\n if (this.options.tagPolicy === TAG_HANDLE)\n {\n throw this.NodeError(node, `custom tag \"${tag}\" has no explicit handler`);\n }\n\n if (this.options.tagPolicy === TAG_PRESERVE || tag === PYTHON_PROJECTED_DECAL || tag === PYTHON_PART_METADATA)\n {\n const wrapper = { [this.options.tagField]: tag };\n memo.set(node, wrapper);\n wrapper[this.options.valueField] = this.ConvertBase(node, memo, false);\n return wrapper;\n }\n }\n\n return this.ConvertBase(node, memo, true);\n }\n\n ConvertBase(node, memo, memoize)\n {\n if (isScalar(node)) return node.value;\n\n if (isSeq(node))\n {\n const out = [];\n if (memoize) memo.set(node, out);\n for (const item of node.items) out.push(this.Convert(item, memo));\n return out;\n }\n\n if (isMap(node))\n {\n const out = {};\n if (memoize) memo.set(node, out);\n for (const pair of node.items)\n {\n const key = this.MapKey(pair.key);\n if (this.options.uniqueKeys && Object.prototype.hasOwnProperty.call(out, key))\n {\n throw this.NodeError(pair.key, `duplicate mapping key \"${key}\"`);\n }\n // Defining the property prevents keys such as \"__proto__\" from\n // mutating the result object's prototype.\n defineMappingValue(out, key, this.Convert(pair.value, memo));\n }\n return out;\n }\n\n throw this.NodeError(node, \"unsupported YAML node\");\n }\n\n MapKey(node)\n {\n if (!isScalar(node)) throw this.NodeError(node, \"mapping keys must be scalar values\");\n return String(node.value);\n }\n\n CustomTag(node)\n {\n const tag = canonicalTag(node.tag);\n return tag && !STANDARD_TAGS.has(tag) ? tag : null;\n }\n\n AssertTagAllowed(tag, node)\n {\n if (!this.options.allowedTags) return;\n const allowed = new Set(this.options.allowedTags.map(canonicalTag));\n if (!allowed.has(tag)) throw this.NodeError(node, `custom tag \"${tag}\" is not in allowedTags`);\n }\n\n FindTagHandler(tag)\n {\n const handlers = this.options.tagHandlers;\n const short = tag.startsWith(TAG_PREFIX) ? `!!${tag.slice(TAG_PREFIX.length)}` : tag;\n if (handlers instanceof Map) return handlers.get(tag) || handlers.get(short) || null;\n return handlers[tag] || handlers[short] || null;\n }\n\n TagContext(tag, node)\n {\n return {\n tag,\n sourceName: this.options.sourceName,\n location: this.TagLocation(node)\n };\n }\n\n NodeError(node, message)\n {\n const at = node && node.tag ? this.TagLocation(node) : this.Location(node);\n const source = this.options.sourceName ? `${this.options.sourceName}:` : \"\";\n const where = at ? `${source}${at.line}:${at.column}` : (this.options.sourceName || \"YAML input\");\n const error = new Error(`CjsYamlFormat ${where}: ${message}`);\n error.code = \"YAML_TAG_POLICY\";\n error.location = at;\n return error;\n }\n\n Location(node)\n {\n if (!node || !Array.isArray(node.range)) return null;\n const pos = this.lineCounter.linePos(node.range[0]);\n return { offset: node.range[0], line: pos.line, column: pos.col };\n }\n\n TagLocation(node)\n {\n const fallback = this.Location(node);\n if (!fallback || !node.tag) return fallback;\n\n const lineStart = this.source.lastIndexOf(\"\\n\", node.range[0] - 1) + 1;\n const prefix = this.source.slice(lineStart, node.range[0]);\n const tags = [ ...prefix.matchAll(/!<[^>]+>|!!?[^\\s[\\]{},]+/g) ];\n const match = tags[tags.length - 1];\n if (!match) return fallback;\n\n const offset = lineStart + match.index;\n const pos = this.lineCounter.linePos(offset);\n return { offset, line: pos.line, column: pos.col };\n }\n\n DescribeError(error)\n {\n const linePos = error && error.linePos && error.linePos[0];\n return {\n code: error && error.code ? error.code : \"YAML_ERROR\",\n message: displayMessage(error),\n location: error && error.location ? error.location : (linePos ? {\n line: linePos.line,\n column: linePos.col\n } : null)\n };\n }\n\n BuildInventory()\n {\n const tags = [];\n const anchors = [];\n const aliases = [];\n\n visit(this.document, (_key, node) =>\n {\n if (!node || typeof node !== \"object\") return;\n const tag = this.CustomTag(node);\n const location = tag ? this.TagLocation(node) : this.Location(node);\n if (tag) tags.push({ tag, kind: this.NodeKind(node), location });\n if (node.anchor) anchors.push({ name: node.anchor, kind: this.NodeKind(node), location });\n if (isAlias(node)) aliases.push({ name: node.source, location });\n });\n\n return {\n tags,\n anchors,\n aliases,\n warnings: this.document.warnings.map(error => this.DescribeError(error)),\n errors: this.document.errors.map(error => this.DescribeError(error))\n };\n }\n\n NodeKind(node)\n {\n if (isMap(node)) return \"mapping\";\n if (isSeq(node)) return \"sequence\";\n if (isScalar(node)) return \"scalar\";\n if (isAlias(node)) return \"alias\";\n return \"unknown\";\n }\n}\n\nexport default CjsYamlReader;\n"],"names":["TAG_PREFIX","PYTHON_TUPLE","PYTHON_UNICODE","PYTHON_PROJECTED_DECAL","PYTHON_PART_METADATA","STANDARD_TAGS","Set","map","name","canonicalTag","tag","startsWith","slice","displayMessage","error","String","message","trim","defineMappingValue","target","key","value","Object","defineProperty","enumerable","configurable","writable","CjsYamlReader","constructor","input","options","TypeError","source","lineCounter","LineCounter","document","parseDocument","keepSourceTokens","prettyErrors","strict","uniqueKeys","inventory","BuildInventory","Read","ReadPayload","toJsonGraph","ReadRaw","AssertSyntax","AssertAliasLimit","Convert","contents","Map","ReadDocument","errors","length","push","DescribeError","format","id","sourceName","root","kind","RootKind","tags","anchors","aliases","warnings","Inspect","node","isMap","isSeq","isScalar","isAlias","first","SyntaxError","maxAliasCount","RangeError","memo","undefined","resolve","NodeError","has","get","CustomTag","AssertTagAllowed","handler","FindTagHandler","ConvertBase","handled","TagContext","set","tagPolicy","TAG_REJECT","TAG_HANDLE","TAG_PRESERVE","wrapper","tagField","valueField","memoize","out","item","items","pair","MapKey","prototype","hasOwnProperty","call","allowedTags","allowed","handlers","tagHandlers","short","location","TagLocation","at","Location","where","line","column","Error","code","Array","isArray","range","pos","linePos","offset","col","fallback","lineStart","lastIndexOf","prefix","matchAll","match","index","visit","_key","NodeKind","anchor"],"mappings":";;;AAYA,MAAMA,UAAU,GAAG,oBAAoB;AACvC,MAAMC,YAAY,GAAG,CAAA,EAAGD,UAAU,CAAA,YAAA,CAAc;AAChD,MAAME,cAAc,GAAG,CAAA,EAAGF,UAAU,CAAA,cAAA,CAAgB;AACpD,MAAMG,sBAAsB,GAAG,CAAA,EAAGH,UAAU,CAAA,sCAAA,CAAwC;AACpF,MAAMI,oBAAoB,GAAG,CAAA,EAAGJ,UAAU,CAAA,0CAAA,CAA4C;AAEtF,MAAMK,aAAa,GAAG,IAAIC,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;AACd;AAEA,SAASG,cAAcA,CAACC,KAAK,EAC7B;AACI,EAAA,OAAOC,MAAM,CAACD,KAAK,IAAIA,KAAK,CAACE,OAAO,GAAGF,KAAK,CAACE,OAAO,GAAGF,KAAK,CAAC,CAACG,IAAI,EAAE;AACxE;AAEA,SAASC,kBAAkBA,CAACC,MAAM,EAAEC,GAAG,EAAEC,KAAK,EAC9C;AACIC,EAAAA,M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AI,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;;;;"}
|
|
1
|
+
{"version":3,"file":"CjsYamlReader.js","sources":["../../../../../src/formats/yaml/core/CjsYamlReader.js"],"sourcesContent":["import {\n LineCounter,\n isAlias,\n isMap,\n isScalar,\n isSeq,\n parseDocument,\n visit\n} from \"yaml\";\n\nimport { CjsReader } from \"../../../format/CjsReader.js\";\nimport { TAG_HANDLE, TAG_PRESERVE, TAG_REJECT, toJsonGraph } from \"./helpers.js\";\n\nconst TAG_PREFIX = \"tag:yaml.org,2002:\";\nconst PYTHON_TUPLE = `${TAG_PREFIX}python/tuple`;\nconst PYTHON_UNICODE = `${TAG_PREFIX}python/unicode`;\nconst PYTHON_PROJECTED_DECAL = `${TAG_PREFIX}python/object:paperDoll.ProjectedDecal`;\nconst PYTHON_PART_METADATA = `${TAG_PREFIX}python/object:paperDoll.AvatarPartMetaData`;\n\nconst STANDARD_TAGS = new Set([\n \"binary\", \"bool\", \"float\", \"int\", \"map\", \"merge\", \"null\", \"omap\",\n \"pairs\", \"seq\", \"set\", \"str\", \"timestamp\"\n].map(name => `${TAG_PREFIX}${name}`));\n\nfunction canonicalTag(tag)\n{\n if (typeof tag !== \"string\") return tag;\n if (tag.startsWith(\"!!\")) return `${TAG_PREFIX}${tag.slice(2)}`;\n return tag;\n}\n\nfunction displayMessage(error)\n{\n return String(error && error.message ? error.message : error).trim();\n}\n\nfunction defineMappingValue(target, key, value)\n{\n Object.defineProperty(target, key, {\n value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n}\n\nexport class CjsYamlReader extends CjsReader\n{\n constructor(input, options = {})\n {\n super(options);\n\n if (typeof input !== \"string\")\n {\n throw new TypeError(\"CjsYamlFormat input must be a YAML string\");\n }\n\n this.source = input;\n this.lineCounter = new LineCounter();\n this.document = parseDocument(input, {\n keepSourceTokens: true,\n lineCounter: this.lineCounter,\n prettyErrors: true,\n strict: true,\n uniqueKeys: this.options.uniqueKeys\n });\n this.inventory = this.BuildInventory();\n }\n\n Read()\n {\n return this.ReadPayload();\n }\n\n ReadPayload()\n {\n return toJsonGraph(this.ReadRaw(), this.options);\n }\n\n ReadRaw()\n {\n this.AssertSyntax();\n this.AssertAliasLimit();\n return this.Convert(this.document.contents, new Map());\n }\n\n ReadDocument()\n {\n let value = null;\n const errors = this.inventory.errors.slice();\n\n if (!errors.length)\n {\n try\n {\n this.AssertAliasLimit();\n value = this.Convert(this.document.contents, new Map());\n }\n catch (error)\n {\n errors.push(this.DescribeError(error));\n }\n }\n\n return {\n format: { id: \"yaml\" },\n source: { name: this.options.sourceName, length: this.source.length },\n root: { kind: this.RootKind() },\n value,\n tags: this.inventory.tags,\n anchors: this.inventory.anchors,\n aliases: this.inventory.aliases,\n warnings: this.inventory.warnings,\n errors\n };\n }\n\n Inspect()\n {\n return {\n format: { id: \"yaml\" },\n source: { name: this.options.sourceName, length: this.source.length },\n root: { kind: this.RootKind() },\n tags: this.inventory.tags,\n anchors: this.inventory.anchors,\n aliases: this.inventory.aliases,\n warnings: this.inventory.warnings,\n errors: this.inventory.errors\n };\n }\n\n RootKind()\n {\n const node = this.document.contents;\n if (node === null) return \"null\";\n if (isMap(node)) return \"mapping\";\n if (isSeq(node)) return \"sequence\";\n if (isScalar(node)) return \"scalar\";\n if (isAlias(node)) return \"alias\";\n return \"unknown\";\n }\n\n AssertSyntax()\n {\n if (!this.document.errors.length) return;\n const first = this.document.errors[0];\n const source = this.options.sourceName ? ` in ${this.options.sourceName}` : \"\";\n throw new SyntaxError(`CjsYamlFormat${source}: ${displayMessage(first)}`);\n }\n\n AssertAliasLimit()\n {\n if (this.inventory.aliases.length <= this.options.maxAliasCount) return;\n const source = this.options.sourceName ? ` in ${this.options.sourceName}` : \"\";\n throw new RangeError(`CjsYamlFormat${source}: alias count ${this.inventory.aliases.length} exceeds maxAliasCount ${this.options.maxAliasCount}`);\n }\n\n Convert(node, memo)\n {\n if (node === null || node === undefined) return null;\n\n if (isAlias(node))\n {\n const source = node.resolve(this.document);\n if (!source) throw this.NodeError(node, `unresolved alias \"${node.source}\"`);\n return this.Convert(source, memo);\n }\n\n if (memo.has(node)) return memo.get(node);\n\n const tag = this.CustomTag(node);\n if (tag)\n {\n this.AssertTagAllowed(tag, node);\n const handler = this.FindTagHandler(tag);\n\n if (handler)\n {\n const value = this.ConvertBase(node, memo, true);\n const handled = handler(value, this.TagContext(tag, node));\n memo.set(node, handled);\n return handled;\n }\n\n if (tag === PYTHON_TUPLE)\n {\n if (!isSeq(node)) throw this.NodeError(node, `${tag} must decorate a sequence`);\n return this.ConvertBase(node, memo, true);\n }\n\n if (tag === PYTHON_UNICODE)\n {\n if (!isScalar(node) || typeof node.value !== \"string\")\n {\n throw this.NodeError(node, `${tag} must decorate a string scalar`);\n }\n return node.value;\n }\n\n if (this.options.tagPolicy === TAG_REJECT)\n {\n throw this.NodeError(node, `custom tag \"${tag}\" is rejected by tagPolicy`);\n }\n\n if (this.options.tagPolicy === TAG_HANDLE)\n {\n throw this.NodeError(node, `custom tag \"${tag}\" has no explicit handler`);\n }\n\n if (this.options.tagPolicy === TAG_PRESERVE || tag === PYTHON_PROJECTED_DECAL || tag === PYTHON_PART_METADATA)\n {\n const wrapper = { [this.options.tagField]: tag };\n memo.set(node, wrapper);\n wrapper[this.options.valueField] = this.ConvertBase(node, memo, false);\n return wrapper;\n }\n }\n\n return this.ConvertBase(node, memo, true);\n }\n\n ConvertBase(node, memo, memoize)\n {\n if (isScalar(node)) return node.value;\n\n if (isSeq(node))\n {\n const out = [];\n if (memoize) memo.set(node, out);\n for (const item of node.items) out.push(this.Convert(item, memo));\n return out;\n }\n\n if (isMap(node))\n {\n const out = {};\n if (memoize) memo.set(node, out);\n for (const pair of node.items)\n {\n const key = this.MapKey(pair.key);\n if (this.options.uniqueKeys && Object.prototype.hasOwnProperty.call(out, key))\n {\n throw this.NodeError(pair.key, `duplicate mapping key \"${key}\"`);\n }\n // Defining the property prevents keys such as \"__proto__\" from\n // mutating the result object's prototype.\n defineMappingValue(out, key, this.Convert(pair.value, memo));\n }\n return out;\n }\n\n throw this.NodeError(node, \"unsupported YAML node\");\n }\n\n MapKey(node)\n {\n if (!isScalar(node)) throw this.NodeError(node, \"mapping keys must be scalar values\");\n return String(node.value);\n }\n\n CustomTag(node)\n {\n const tag = canonicalTag(node.tag);\n return tag && !STANDARD_TAGS.has(tag) ? tag : null;\n }\n\n AssertTagAllowed(tag, node)\n {\n if (!this.options.allowedTags) return;\n const allowed = new Set(this.options.allowedTags.map(canonicalTag));\n if (!allowed.has(tag)) throw this.NodeError(node, `custom tag \"${tag}\" is not in allowedTags`);\n }\n\n FindTagHandler(tag)\n {\n const handlers = this.options.tagHandlers;\n const short = tag.startsWith(TAG_PREFIX) ? `!!${tag.slice(TAG_PREFIX.length)}` : tag;\n if (handlers instanceof Map) return handlers.get(tag) || handlers.get(short) || null;\n return handlers[tag] || handlers[short] || null;\n }\n\n TagContext(tag, node)\n {\n return {\n tag,\n sourceName: this.options.sourceName,\n location: this.TagLocation(node)\n };\n }\n\n NodeError(node, message)\n {\n const at = node && node.tag ? this.TagLocation(node) : this.Location(node);\n const source = this.options.sourceName ? `${this.options.sourceName}:` : \"\";\n const where = at ? `${source}${at.line}:${at.column}` : (this.options.sourceName || \"YAML input\");\n const error = new Error(`CjsYamlFormat ${where}: ${message}`);\n error.code = \"YAML_TAG_POLICY\";\n error.location = at;\n return error;\n }\n\n Location(node)\n {\n if (!node || !Array.isArray(node.range)) return null;\n const pos = this.lineCounter.linePos(node.range[0]);\n return { offset: node.range[0], line: pos.line, column: pos.col };\n }\n\n TagLocation(node)\n {\n const fallback = this.Location(node);\n if (!fallback || !node.tag) return fallback;\n\n const lineStart = this.source.lastIndexOf(\"\\n\", node.range[0] - 1) + 1;\n const prefix = this.source.slice(lineStart, node.range[0]);\n const tags = [ ...prefix.matchAll(/!<[^>]+>|!!?[^\\s[\\]{},]+/g) ];\n const match = tags[tags.length - 1];\n if (!match) return fallback;\n\n const offset = lineStart + match.index;\n const pos = this.lineCounter.linePos(offset);\n return { offset, line: pos.line, column: pos.col };\n }\n\n DescribeError(error)\n {\n const linePos = error && error.linePos && error.linePos[0];\n return {\n code: error && error.code ? error.code : \"YAML_ERROR\",\n message: displayMessage(error),\n location: error && error.location ? error.location : (linePos ? {\n line: linePos.line,\n column: linePos.col\n } : null)\n };\n }\n\n BuildInventory()\n {\n const tags = [];\n const anchors = [];\n const aliases = [];\n\n visit(this.document, (_key, node) =>\n {\n if (!node || typeof node !== \"object\") return;\n const tag = this.CustomTag(node);\n const location = tag ? this.TagLocation(node) : this.Location(node);\n if (tag) tags.push({ tag, kind: this.NodeKind(node), location });\n if (node.anchor) anchors.push({ name: node.anchor, kind: this.NodeKind(node), location });\n if (isAlias(node)) aliases.push({ name: node.source, location });\n });\n\n return {\n tags,\n anchors,\n aliases,\n warnings: this.document.warnings.map(error => this.DescribeError(error)),\n errors: this.document.errors.map(error => this.DescribeError(error))\n };\n }\n\n NodeKind(node)\n {\n if (isMap(node)) return \"mapping\";\n if (isSeq(node)) return \"sequence\";\n if (isScalar(node)) return \"scalar\";\n if (isAlias(node)) return \"alias\";\n return \"unknown\";\n }\n}\n\nexport default CjsYamlReader;\n"],"names":["TAG_PREFIX","PYTHON_TUPLE","PYTHON_UNICODE","PYTHON_PROJECTED_DECAL","PYTHON_PART_METADATA","STANDARD_TAGS","Set","map","name","canonicalTag","tag","startsWith","slice","displayMessage","error","String","message","trim","defineMappingValue","target","key","value","Object","defineProperty","enumerable","configurable","writable","CjsYamlReader","CjsReader","constructor","input","options","TypeError","source","lineCounter","LineCounter","document","parseDocument","keepSourceTokens","prettyErrors","strict","uniqueKeys","inventory","BuildInventory","Read","ReadPayload","toJsonGraph","ReadRaw","AssertSyntax","AssertAliasLimit","Convert","contents","Map","ReadDocument","errors","length","push","DescribeError","format","id","sourceName","root","kind","RootKind","tags","anchors","aliases","warnings","Inspect","node","isMap","isSeq","isScalar","isAlias","first","SyntaxError","maxAliasCount","RangeError","memo","undefined","resolve","NodeError","has","get","CustomTag","AssertTagAllowed","handler","FindTagHandler","ConvertBase","handled","TagContext","set","tagPolicy","TAG_REJECT","TAG_HANDLE","TAG_PRESERVE","wrapper","tagField","valueField","memoize","out","item","items","pair","MapKey","prototype","hasOwnProperty","call","allowedTags","allowed","handlers","tagHandlers","short","location","TagLocation","at","Location","where","line","column","Error","code","Array","isArray","range","pos","linePos","offset","col","fallback","lineStart","lastIndexOf","prefix","matchAll","match","index","visit","_key","NodeKind","anchor"],"mappings":";;;;AAaA,MAAMA,UAAU,GAAG,oBAAoB;AACvC,MAAMC,YAAY,GAAG,CAAA,EAAGD,UAAU,CAAA,YAAA,CAAc;AAChD,MAAME,cAAc,GAAG,CAAA,EAAGF,UAAU,CAAA,cAAA,CAAgB;AACpD,MAAMG,sBAAsB,GAAG,CAAA,EAAGH,UAAU,CAAA,sCAAA,CAAwC;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C/C,GAAG,CAACO,KAAK,IAAI,IAAI,CAAC2C,aAAa,CAAC3C,KAAK,CAAC;KACtE;AACL,EAAA;EAEA4H,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;;;;"}
|
|
@@ -1,160 +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
|
|
1
|
+
const OUTPUT_JSON = "json";
|
|
2
|
+
const OUTPUT_PAYLOAD = "payload";
|
|
3
|
+
const OUTPUT_RAW = "raw";
|
|
4
|
+
const OUTPUT_DOCUMENT = "document";
|
|
5
|
+
const TAG_PRESERVE = "preserve";
|
|
6
|
+
const TAG_REJECT = "reject";
|
|
7
|
+
const TAG_HANDLE = "handle";
|
|
8
|
+
const DEFAULT_VALUES = Object.freeze({
|
|
9
|
+
emit: OUTPUT_PAYLOAD,
|
|
10
|
+
tagPolicy: TAG_PRESERVE,
|
|
11
|
+
allowedTags: null,
|
|
12
|
+
tagHandlers: Object.freeze({}),
|
|
13
|
+
sourceName: null,
|
|
14
|
+
maxAliasCount: 100,
|
|
15
|
+
uniqueKeys: true,
|
|
16
|
+
idField: "$yamlId",
|
|
17
|
+
refField: "$yamlRef",
|
|
18
|
+
valuesField: "$yamlValues",
|
|
19
|
+
tagField: "$yamlTag",
|
|
20
|
+
valueField: "$yamlValue"
|
|
21
|
+
});
|
|
22
|
+
const OPTION_KEYS = new Set(Object.keys(DEFAULT_VALUES));
|
|
23
|
+
function hasOwn(value, key) {
|
|
24
|
+
return Object.prototype.hasOwnProperty.call(value, key);
|
|
25
|
+
}
|
|
26
|
+
function defineMappingValue(target, key, value) {
|
|
27
|
+
Object.defineProperty(target, key, {
|
|
28
|
+
value,
|
|
29
|
+
enumerable: true,
|
|
30
|
+
configurable: true,
|
|
31
|
+
writable: true
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
function normalizeEmit(value, readerName) {
|
|
35
|
+
if (value === OUTPUT_JSON || value === OUTPUT_PAYLOAD) return value;
|
|
36
|
+
if (value === OUTPUT_RAW || value === OUTPUT_DOCUMENT) return value;
|
|
37
|
+
throw new TypeError(`${readerName} unknown emit value "${value}"`);
|
|
38
|
+
}
|
|
39
|
+
function normalizeTagPolicy(value, readerName) {
|
|
40
|
+
if (value === TAG_PRESERVE || value === TAG_REJECT || value === TAG_HANDLE) return value;
|
|
41
|
+
throw new TypeError(`${readerName} unknown tagPolicy value "${value}"`);
|
|
42
|
+
}
|
|
43
|
+
function normalizeAllowedTags(value, readerName) {
|
|
44
|
+
if (value === null || value === undefined) return null;
|
|
45
|
+
if (!Array.isArray(value) && !(value instanceof Set)) {
|
|
46
|
+
throw new TypeError(`${readerName} allowedTags must be an array, Set, or null`);
|
|
47
|
+
}
|
|
48
|
+
return [...value];
|
|
49
|
+
}
|
|
50
|
+
function normalizeTagHandlers(value, readerName) {
|
|
51
|
+
if (value instanceof Map) {
|
|
52
|
+
for (const [tag, handler] of value) {
|
|
53
|
+
if (typeof handler !== "function") {
|
|
54
|
+
throw new TypeError(`${readerName} tag handler "${tag}" must be a function`);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return new Map(value);
|
|
58
|
+
}
|
|
59
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
60
|
+
throw new TypeError(`${readerName} tagHandlers must be an object or Map`);
|
|
61
|
+
}
|
|
62
|
+
for (const [tag, handler] of Object.entries(value)) {
|
|
63
|
+
if (typeof handler !== "function") {
|
|
64
|
+
throw new TypeError(`${readerName} tag handler "${tag}" must be a function`);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
...value
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function normalizeField(value, name, readerName) {
|
|
72
|
+
if (typeof value !== "string" || !value) {
|
|
73
|
+
throw new TypeError(`${readerName} ${name} must be a non-empty string`);
|
|
74
|
+
}
|
|
75
|
+
return value;
|
|
76
|
+
}
|
|
77
|
+
function normalizeBoolean(value, name, readerName) {
|
|
78
|
+
if (typeof value !== "boolean") throw new TypeError(`${readerName} ${name} must be a boolean`);
|
|
79
|
+
return value;
|
|
80
|
+
}
|
|
81
|
+
function normalizeValues(base, options = {}, readerName = "CjsYamlFormat") {
|
|
82
|
+
if (!options || typeof options !== "object" || Array.isArray(options)) {
|
|
83
|
+
throw new TypeError(`${readerName} options must be an object`);
|
|
84
|
+
}
|
|
85
|
+
for (const key of Object.keys(options)) {
|
|
86
|
+
if (!OPTION_KEYS.has(key)) throw new TypeError(`${readerName} unknown option "${key}"`);
|
|
87
|
+
}
|
|
88
|
+
const values = {
|
|
89
|
+
...base,
|
|
90
|
+
allowedTags: base.allowedTags ? [...base.allowedTags] : null,
|
|
91
|
+
tagHandlers: base.tagHandlers instanceof Map ? new Map(base.tagHandlers) : {
|
|
92
|
+
...base.tagHandlers
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
if (hasOwn(options, "emit")) values.emit = normalizeEmit(options.emit, readerName);
|
|
96
|
+
if (hasOwn(options, "tagPolicy")) values.tagPolicy = normalizeTagPolicy(options.tagPolicy, readerName);
|
|
97
|
+
if (hasOwn(options, "allowedTags")) values.allowedTags = normalizeAllowedTags(options.allowedTags, readerName);
|
|
98
|
+
if (hasOwn(options, "tagHandlers")) values.tagHandlers = normalizeTagHandlers(options.tagHandlers, readerName);
|
|
99
|
+
if (hasOwn(options, "sourceName")) values.sourceName = options.sourceName == null ? null : String(options.sourceName);
|
|
100
|
+
if (hasOwn(options, "maxAliasCount")) {
|
|
101
|
+
if (!Number.isInteger(options.maxAliasCount) || options.maxAliasCount < 0) {
|
|
102
|
+
throw new TypeError(`${readerName} maxAliasCount must be a non-negative integer`);
|
|
103
|
+
}
|
|
104
|
+
values.maxAliasCount = options.maxAliasCount;
|
|
105
|
+
}
|
|
106
|
+
if (hasOwn(options, "uniqueKeys")) {
|
|
107
|
+
values.uniqueKeys = normalizeBoolean(options.uniqueKeys, "uniqueKeys", readerName);
|
|
108
|
+
}
|
|
109
|
+
for (const name of ["idField", "refField", "valuesField", "tagField", "valueField"]) {
|
|
110
|
+
if (hasOwn(options, name)) values[name] = normalizeField(options[name], name, readerName);
|
|
111
|
+
}
|
|
112
|
+
return values;
|
|
113
|
+
}
|
|
114
|
+
function toJsonGraph(value, options) {
|
|
115
|
+
const counts = new WeakMap();
|
|
116
|
+
const traversed = new WeakSet();
|
|
117
|
+
const count = node => {
|
|
118
|
+
if (!node || typeof node !== "object") return;
|
|
119
|
+
counts.set(node, (counts.get(node) || 0) + 1);
|
|
120
|
+
if (traversed.has(node)) return;
|
|
121
|
+
traversed.add(node);
|
|
122
|
+
if (Array.isArray(node)) node.forEach(count);else Object.keys(node).forEach(key => count(node[key]));
|
|
123
|
+
};
|
|
124
|
+
count(value);
|
|
125
|
+
const ids = new WeakMap();
|
|
126
|
+
let nextId = 1;
|
|
127
|
+
const encode = node => {
|
|
128
|
+
if (node === null || typeof node !== "object") return node;
|
|
129
|
+
if (ArrayBuffer.isView(node)) return Array.from(node, encode);
|
|
130
|
+
if (node instanceof Date) return node.toISOString();
|
|
131
|
+
const repeated = (counts.get(node) || 0) > 1;
|
|
132
|
+
if (ids.has(node)) return {
|
|
133
|
+
[options.refField]: ids.get(node)
|
|
134
|
+
};
|
|
135
|
+
let id = null;
|
|
136
|
+
if (repeated) {
|
|
137
|
+
id = nextId++;
|
|
138
|
+
ids.set(node, id);
|
|
139
|
+
}
|
|
140
|
+
if (Array.isArray(node)) {
|
|
141
|
+
const values = node.map(encode);
|
|
142
|
+
return repeated ? {
|
|
143
|
+
[options.idField]: id,
|
|
144
|
+
[options.valuesField]: values
|
|
145
|
+
} : values;
|
|
146
|
+
}
|
|
147
|
+
if (repeated && Object.prototype.hasOwnProperty.call(node, options.idField)) {
|
|
148
|
+
throw new TypeError(`CjsYamlFormat cannot encode repeated mapping: reserved field "${options.idField}" already exists`);
|
|
149
|
+
}
|
|
150
|
+
const out = repeated ? {
|
|
151
|
+
[options.idField]: id
|
|
152
|
+
} : {};
|
|
153
|
+
for (const key of Object.keys(node)) defineMappingValue(out, key, encode(node[key]));
|
|
154
|
+
return out;
|
|
155
|
+
};
|
|
156
|
+
return encode(value);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export { DEFAULT_VALUES, OUTPUT_DOCUMENT, OUTPUT_JSON, OUTPUT_PAYLOAD, OUTPUT_RAW, TAG_HANDLE, TAG_PRESERVE, TAG_REJECT, normalizeValues, toJsonGraph };
|
|
160
|
+
//# sourceMappingURL=helpers.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { CjsYamlFormat, CjsYamlFormat as default } from './CjsYamlFormat.js';
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export { CjsYamlFormat, CjsYamlFormat as default } from './CjsYamlFormat.js';
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
package/dist/index.js
CHANGED
|
@@ -1,52 +1,48 @@
|
|
|
1
|
-
export { CjsResourceState, isTerminalResourceState } from './resourceStates.js';
|
|
2
|
-
export { getResourceExtension, normalizeResourceExtension, normalizeResourcePath } from './resourcePath.js';
|
|
3
|
-
export { CjsResource } from './CjsResource.js';
|
|
4
|
-
export { TriTextureRes } from './resources/TriTextureRes.js';
|
|
5
|
-
export { TriGeometryRes } from './resources/TriGeometryRes.js';
|
|
6
|
-
export { Tr2EffectRes } from './resources/Tr2EffectRes.js';
|
|
7
|
-
export { Tr2ImageRes } from './resources/Tr2ImageRes.js';
|
|
8
|
-
export { TriGrannyRes } from './resources/TriGrannyRes.js';
|
|
9
|
-
export { Tr2GrannyStateRes } from './resources/Tr2GrannyStateRes.js';
|
|
10
|
-
export { Tr2LightProfileRes } from './resources/Tr2LightProfileRes.js';
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
13
|
-
export { AudioGeometryResData } from './
|
|
14
|
-
export {
|
|
15
|
-
export {
|
|
16
|
-
export {
|
|
17
|
-
export {
|
|
18
|
-
export {
|
|
19
|
-
export {
|
|
20
|
-
export {
|
|
21
|
-
export {
|
|
22
|
-
export {
|
|
23
|
-
export {
|
|
24
|
-
export {
|
|
25
|
-
export {
|
|
26
|
-
export {
|
|
27
|
-
export {
|
|
28
|
-
export {
|
|
29
|
-
export {
|
|
30
|
-
export {
|
|
31
|
-
export {
|
|
32
|
-
export {
|
|
33
|
-
export {
|
|
34
|
-
export {
|
|
35
|
-
export {
|
|
36
|
-
export {
|
|
37
|
-
export {
|
|
38
|
-
export {
|
|
39
|
-
export {
|
|
40
|
-
export {
|
|
41
|
-
export {
|
|
42
|
-
export {
|
|
43
|
-
export {
|
|
44
|
-
export {
|
|
45
|
-
export {
|
|
46
|
-
export {
|
|
47
|
-
export {
|
|
48
|
-
|
|
49
|
-
export { CjsFetchResourceSource, CjsMemoryResourceSource } from './CjsResourceSource.js';
|
|
50
|
-
export { CjsResManQueue } from './CjsResManQueue.js';
|
|
51
|
-
export { CjsResMan } from './CjsResMan.js';
|
|
52
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
export { CjsResourceState, isTerminalResourceState } from './resourceStates.js';
|
|
2
|
+
export { getResourceExtension, normalizeResourceExtension, normalizeResourcePath } from './resourcePath.js';
|
|
3
|
+
export { CjsResource } from './CjsResource.js';
|
|
4
|
+
export { TriTextureRes } from './resources/TriTextureRes.js';
|
|
5
|
+
export { TriGeometryRes } from './resources/TriGeometryRes.js';
|
|
6
|
+
export { Tr2EffectRes } from './resources/Tr2EffectRes.js';
|
|
7
|
+
export { Tr2ImageRes } from './resources/Tr2ImageRes.js';
|
|
8
|
+
export { TriGrannyRes } from './resources/TriGrannyRes.js';
|
|
9
|
+
export { Tr2GrannyStateRes } from './resources/Tr2GrannyStateRes.js';
|
|
10
|
+
export { Tr2LightProfileRes } from './resources/Tr2LightProfileRes.js';
|
|
11
|
+
export { Tr2TextureLodManager } from './resources/Tr2TextureLodManager.js';
|
|
12
|
+
export { Tr2TexturePipeline } from './resources/Tr2TexturePipeline.js';
|
|
13
|
+
export { AudioGeometryResData } from './resources/AudioGeometryResData.js';
|
|
14
|
+
export { GStateBindingCallbackData } from './resources/GStateBindingCallbackData.js';
|
|
15
|
+
export { MeshDecalData } from './resources/MeshDecalData.js';
|
|
16
|
+
export { MeshDecalLodData } from './resources/MeshDecalLodData.js';
|
|
17
|
+
export { Tr2GrannyIntersectionResult } from './resources/Tr2GrannyIntersectionResult.js';
|
|
18
|
+
export { Tr2MaterialArea } from './resources/Tr2MaterialArea.js';
|
|
19
|
+
export { Tr2MaterialMesh } from './resources/Tr2MaterialMesh.js';
|
|
20
|
+
export { Tr2MaterialRes } from './resources/Tr2MaterialRes.js';
|
|
21
|
+
export { Tr2ShaderPermutation } from './resources/Tr2ShaderPermutation.js';
|
|
22
|
+
export { Tr2TextureLodUpdateRequest } from './resources/Tr2TextureLodUpdateRequest.js';
|
|
23
|
+
export { Tr2TexturePackChannel } from './resources/Tr2TexturePackChannel.js';
|
|
24
|
+
export { Tr2TexturePipelineParams } from './resources/Tr2TexturePipelineParams.js';
|
|
25
|
+
export { Tr2TexturePipelineStepCompress } from './resources/Tr2TexturePipelineStepCompress.js';
|
|
26
|
+
export { Tr2TexturePipelineStepLimitSize } from './resources/Tr2TexturePipelineStepLimitSize.js';
|
|
27
|
+
export { Tr2TexturePipelineStepLoad } from './resources/Tr2TexturePipelineStepLoad.js';
|
|
28
|
+
export { Tr2TexturePipelineStepPack } from './resources/Tr2TexturePipelineStepPack.js';
|
|
29
|
+
export { TriGeometryResAreaData } from './resources/TriGeometryResAreaData.js';
|
|
30
|
+
export { TriGeometryResJointData } from './resources/TriGeometryResJointData.js';
|
|
31
|
+
export { TriGeometryResLodData } from './resources/TriGeometryResLodData.js';
|
|
32
|
+
export { TriGeometryResMeshData } from './resources/TriGeometryResMeshData.js';
|
|
33
|
+
export { TriGeometryResSkeletonData } from './resources/TriGeometryResSkeletonData.js';
|
|
34
|
+
export { TriJointBinding } from './resources/TriJointBinding.js';
|
|
35
|
+
export { TriMorphTargetGeometryConstants } from './resources/TriMorphTargetGeometryConstants.js';
|
|
36
|
+
export { TriRtGeometryConstants } from './resources/TriRtGeometryConstants.js';
|
|
37
|
+
export { GrannyDeprecationLevel, Tr2Lod } from './resources/enums.js';
|
|
38
|
+
export { CjsTextureArrayRes } from './texture/CjsTextureArrayRes.js';
|
|
39
|
+
export { CjsTextureParameterProxy } from './texture/CjsTextureParameterProxy.js';
|
|
40
|
+
export { CjsResourceProbe } from './format/CjsResourceProbe.js';
|
|
41
|
+
export { ResourcePayloadType, ResourcePayloadValues, validateAudioPayload, validateRgbaPayload, validateTexturePayload, validateVideoPayload } from './format/payloadContract.js';
|
|
42
|
+
export { CjsFormat, ValidateFormatContract } from './format/CjsFormat.js';
|
|
43
|
+
export { CjsEventEmitter } from '@carbonenginejs/core-types/model';
|
|
44
|
+
export { CjsMotherLode, getMotherLodeKey } from './CjsMotherLode.js';
|
|
45
|
+
export { CjsFetchResourceSource, CjsMemoryResourceSource } from './CjsResourceSource.js';
|
|
46
|
+
export { CjsResManQueue } from './CjsResManQueue.js';
|
|
47
|
+
export { CjsResMan } from './CjsResMan.js';
|
|
48
|
+
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/resourcePath.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
function normalizeResourcePath(value) {
|
|
2
|
-
return String(value ?? "").trim().replace(/\\/g, "/").replace(/\/+/g, "/").toLowerCase();
|
|
3
|
-
}
|
|
4
|
-
function getResourceExtension(value) {
|
|
5
|
-
const path = normalizeResourcePath(value);
|
|
6
|
-
const queryIndex = path.search(/[?#]/u);
|
|
7
|
-
const cleanPath = queryIndex === -1 ? path : path.slice(0, queryIndex);
|
|
8
|
-
const slashIndex = cleanPath.lastIndexOf("/");
|
|
9
|
-
const dotIndex = cleanPath.lastIndexOf(".");
|
|
10
|
-
if (dotIndex === -1 || dotIndex < slashIndex) return "";
|
|
11
|
-
return cleanPath.slice(dotIndex + 1);
|
|
12
|
-
}
|
|
13
|
-
function normalizeResourceExtension(value) {
|
|
14
|
-
return String(value ?? "").trim().replace(/^\./u, "").toLowerCase();
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export { getResourceExtension, normalizeResourceExtension, normalizeResourcePath };
|
|
18
|
-
//# sourceMappingURL=resourcePath.js.map
|
|
1
|
+
function normalizeResourcePath(value) {
|
|
2
|
+
return String(value ?? "").trim().replace(/\\/g, "/").replace(/\/+/g, "/").toLowerCase();
|
|
3
|
+
}
|
|
4
|
+
function getResourceExtension(value) {
|
|
5
|
+
const path = normalizeResourcePath(value);
|
|
6
|
+
const queryIndex = path.search(/[?#]/u);
|
|
7
|
+
const cleanPath = queryIndex === -1 ? path : path.slice(0, queryIndex);
|
|
8
|
+
const slashIndex = cleanPath.lastIndexOf("/");
|
|
9
|
+
const dotIndex = cleanPath.lastIndexOf(".");
|
|
10
|
+
if (dotIndex === -1 || dotIndex < slashIndex) return "";
|
|
11
|
+
return cleanPath.slice(dotIndex + 1);
|
|
12
|
+
}
|
|
13
|
+
function normalizeResourceExtension(value) {
|
|
14
|
+
return String(value ?? "").trim().replace(/^\./u, "").toLowerCase();
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export { getResourceExtension, normalizeResourceExtension, normalizeResourcePath };
|
|
18
|
+
//# sourceMappingURL=resourcePath.js.map
|