@carbonenginejs/runtime-resource 0.17.0 → 0.18.1
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/dist/format/carbonEffect/CjsCarbonEffectWriter.js +16 -4
- package/dist/format/carbonEffect/CjsCarbonEffectWriter.js.map +1 -1
- package/dist/format/carbonEffect/backendEngineId.js +1 -3
- package/dist/format/carbonEffect/backendEngineId.js.map +1 -1
- package/dist/format/carbonEffect/buildCarbonEffectContainer.js +11 -1
- package/dist/format/carbonEffect/buildCarbonEffectContainer.js.map +1 -1
- package/dist/format/carbonEffect/carbonEffectBackendBlock.js +38 -1
- package/dist/format/carbonEffect/carbonEffectBackendBlock.js.map +1 -1
- package/dist/format/carbonEffect/carbonEffectRecords.js +45 -1
- package/dist/format/carbonEffect/carbonEffectRecords.js.map +1 -1
- package/dist/format/carbonEffect/carbonEffectResourceTransform.js +120 -60
- package/dist/format/carbonEffect/carbonEffectResourceTransform.js.map +1 -1
- package/dist/format/effect/effectPermutationGraph.js +46 -29
- package/dist/format/effect/effectPermutationGraph.js.map +1 -1
- package/dist/format/index.js +1 -1
- package/dist/formats/dds/core/helpers.js +35 -6
- package/dist/formats/dds/core/helpers.js.map +1 -1
- package/dist/formats/hlsl/core/carbonDescriptionToRuntime.js +53 -1
- package/dist/formats/hlsl/core/carbonDescriptionToRuntime.js.map +1 -1
- package/dist/formats/hlsl/core/detailMapFamily.js +1 -1
- package/dist/formats/hlsl/core/detailMapFamily.js.map +1 -1
- package/dist/formats/hlsl/core/localLightFamily.js +1 -1
- package/dist/formats/hlsl/core/localLightFamily.js.map +1 -1
- package/dist/formats/hlsl/core/tr2/shader/HlslEffectBindingManifest.js +10 -1
- package/dist/formats/hlsl/core/tr2/shader/HlslEffectBindingManifest.js.map +1 -1
- package/dist/formats/index.js +3 -0
- package/dist/formats/index.js.map +1 -1
- package/dist/formats/schemabound/CjsSchemaBoundFormat.js +236 -0
- package/dist/formats/schemabound/CjsSchemaBoundFormat.js.map +1 -0
- package/dist/formats/schemabound/core/schemaBoundErrors.js +9 -0
- package/dist/formats/schemabound/core/schemaBoundErrors.js.map +1 -0
- package/dist/formats/schemabound/core/schemaBoundValues.js +307 -0
- package/dist/formats/schemabound/core/schemaBoundValues.js.map +1 -0
- package/dist/formats/schemabound/index.js +2 -0
- package/dist/formats/schemabound/index.js.map +1 -0
- package/dist/formats/sqlite/CjsSqliteFormat.js +244 -0
- package/dist/formats/sqlite/CjsSqliteFormat.js.map +1 -0
- package/dist/formats/sqlite/core/sqlitePages.js +159 -0
- package/dist/formats/sqlite/core/sqlitePages.js.map +1 -0
- package/dist/formats/sqlite/core/sqliteRecords.js +174 -0
- package/dist/formats/sqlite/core/sqliteRecords.js.map +1 -0
- package/dist/formats/sqlite/core/sqliteSchema.js +100 -0
- package/dist/formats/sqlite/core/sqliteSchema.js.map +1 -0
- package/dist/formats/sqlite/index.js +2 -0
- package/dist/formats/sqlite/index.js.map +1 -0
- package/dist/formats/static/CjsStaticFormat.js +220 -0
- package/dist/formats/static/CjsStaticFormat.js.map +1 -0
- package/dist/formats/static/index.js +2 -0
- package/dist/formats/static/index.js.map +1 -0
- package/dist/formats/webgl/core/buildGlslEffectContainer.js +3 -1
- package/dist/formats/webgl/core/buildGlslEffectContainer.js.map +1 -1
- package/dist/formats/webgl/core/effectPackage.js +13 -5
- package/dist/formats/webgl/core/effectPackage.js.map +1 -1
- package/dist/formats/webgl/core/glsl/DxbcGlslEmitter.js +10 -2
- package/dist/formats/webgl/core/glsl/DxbcGlslEmitter.js.map +1 -1
- package/dist/formats/webgl/core/glslBackendBlock.js +6 -5
- package/dist/formats/webgl/core/glslBackendBlock.js.map +1 -1
- package/dist/formats/webgl/core/glslBackendBodySet.js +0 -1
- package/dist/formats/webgl/core/glslBackendBodySet.js.map +1 -1
- package/dist/formats/webgpu/CjsWebgpuFormat.js +161 -163
- package/dist/formats/webgpu/CjsWebgpuFormat.js.map +1 -1
- package/dist/formats/webgpu/core/buildCarbonEffectContainer.js +3 -1
- package/dist/formats/webgpu/core/buildCarbonEffectContainer.js.map +1 -1
- package/dist/formats/webgpu/core/carbonWebgpu/containerViews.js +179 -131
- package/dist/formats/webgpu/core/carbonWebgpu/containerViews.js.map +1 -1
- package/dist/formats/webgpu/core/effectBackendBodySet.js +2 -3
- package/dist/formats/webgpu/core/effectBackendBodySet.js.map +1 -1
- package/dist/formats/webgpu/core/helpers.js +111 -99
- package/dist/formats/webgpu/core/helpers.js.map +1 -1
- package/dist/formats/webgpu/core/packageEffect.js +44 -33
- package/dist/formats/webgpu/core/packageEffect.js.map +1 -1
- package/dist/formats/webgpu/core/wgsl/buildResourceTransformPlan.js +9 -1
- package/dist/formats/webgpu/core/wgsl/buildResourceTransformPlan.js.map +1 -1
- package/dist/resource/shader/reflection/Tr2EffectStageInput.js +14 -0
- package/dist/resource/shader/reflection/Tr2EffectStageInput.js.map +1 -1
- package/docs/concepts/shader-resource-model.md +34 -1
- package/docs/formats/README.md +21 -0
- package/docs/formats/carbon-effect-container.md +54 -27
- package/docs/formats/schemabound.md +112 -0
- package/docs/formats/static.md +119 -0
- package/docs/formats/webgl/README.md +5 -3
- package/docs/formats/webgpu/README.md +2 -2
- package/docs/formats/webgpu/architecture.md +2 -2
- package/docs/formats/webgpu/formats/carbon-webgpu.md +24 -6
- package/docs/formats/webgpu/guides/effect-packaging.md +1 -2
- package/docs/formats/webgpu/reference/api.md +7 -6
- package/docs/formats/webgpu/reference/wgsl-compatibility.md +2 -2
- package/docs/reference/classes/formats.md +33 -0
- package/package.json +5 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HlslEffectBindingManifest.js","sources":["../../../../../../../src/formats/hlsl/core/tr2/shader/HlslEffectBindingManifest.js"],"sourcesContent":["import { HlslRenderContextEnum, hlslShaderStageName } from \"../HlslRenderContextEnum.js\";\n\n/**\n * Carbon-backed binding manifest for register-named shader outputs.\n *\n * This maps generated fallback symbols such as `cb0`, `t3`, `s0`, and `u1`\n * back to the exact stage metadata read from Trinity effect data.\n */\nexport class HlslEffectBindingManifest\n{\n /**\n * Builds a manifest from a loaded `HlslEffectRes`.\n *\n * @param {object} effectRes Loaded effect resource with `GetShader()`.\n * @param {object} [options] Manifest options.\n * @returns {HlslEffectBindingManifest} Carbon binding manifest.\n */\n static fromTr2EffectRes(effectRes, options = {})\n {\n const shader = effectRes.GetShader();\n return HlslEffectBindingManifest.fromEffectDescription(shader.GetEffectDescription(), options);\n }\n\n /**\n * Builds a manifest from a decoded `HlslEffectDescription`.\n *\n * @param {object} effectDescription Decoded effect description.\n * @param {object} [options] Manifest options.\n * @returns {HlslEffectBindingManifest} Carbon binding manifest.\n */\n static fromEffectDescription(effectDescription, options = {})\n {\n return new HlslEffectBindingManifest(effectDescription, options);\n }\n\n /**\n * Creates a binding manifest.\n *\n * @param {object} effectDescription Decoded effect description.\n * @param {object} [options] Manifest options.\n */\n constructor(effectDescription, options = {})\n {\n this.effectName = effectDescription?.effectName || options.effectName || \"\";\n this.version = effectDescription?.version || 0;\n this.passes = buildPasses(effectDescription);\n this.stages = buildStages(effectDescription);\n }\n\n /**\n * Resolves a generated binding symbol for one stage.\n *\n * @param {object} query Stage and symbol query.\n * @param {string} query.techniqueName Technique name.\n * @param {number} query.passIndex Pass index.\n * @param {number} [query.stageType] Trinity stage enum value.\n * @param {string} [query.stageName] Stage name.\n * @param {string} query.symbol Generated symbol such as `cb0` or `t3`.\n * @param {number} [query.registerSpace] Optional D3D register-space disambiguator.\n * @returns {object|null} Matching binding record, or null.\n */\n resolve(query)\n {\n const stage = this.stages.find((entry) =>\n entry.techniqueName === query.techniqueName &&\n entry.passIndex === query.passIndex &&\n (Number.isInteger(query.stageType) ? entry.stageType === query.stageType : entry.stageName === query.stageName)\n );\n if (!stage) return null;\n return stage.bindings.find((entry) =>\n entry.generatedSymbol === query.symbol &&\n (!Number.isInteger(query.registerSpace) || entry.registerSpace === query.registerSpace)\n ) || null;\n }\n\n /**\n * Returns a JSON-safe manifest snapshot.\n *\n * @returns {object} Serializable binding manifest.\n */\n toJSON()\n {\n return {\n effectName: this.effectName,\n version: this.version,\n passes: this.passes.map((entry) => cloneJson(entry)),\n stages: this.stages.map((entry) => cloneJson(entry))\n };\n }\n}\n\n/**\n * Builds pass render-state records from the decoded effect description.\n *\n * @param {object} effectDescription Decoded effect description.\n * @returns {object[]} Pass render-state manifest records.\n */\nfunction buildPasses(effectDescription)\n{\n const passes = [];\n for (const technique of effectDescription?.techniques || [])\n {\n for (let passIndex = 0; passIndex < technique.passes.length; passIndex += 1)\n {\n const pass = technique.passes[passIndex];\n passes.push({\n techniqueName: technique.name,\n passIndex,\n renderStates: pass.renderStates,\n states: (pass.cjsRenderStateSetup?.entries || []).map(({ key, value }) => ({\n state: key,\n value\n }))\n });\n }\n }\n return passes;\n}\n\n/**\n * Builds all stage records from the decoded effect description.\n *\n * @param {object} effectDescription Decoded effect description.\n * @returns {object[]} Stage binding manifest records.\n */\nfunction buildStages(effectDescription)\n{\n const stages = [];\n for (const technique of effectDescription?.techniques || [])\n {\n for (let passIndex = 0; passIndex < technique.passes.length; passIndex += 1)\n {\n const pass = technique.passes[passIndex];\n for (let stageType = 0; stageType < HlslRenderContextEnum.SHADER_TYPE_COUNT; stageType += 1)\n {\n const stage = pass.stageInputs[stageType];\n if (!stage?.m_exists) continue;\n stages.push(buildStage(effectDescription, technique.name, passIndex, pass, stageType, stage));\n }\n }\n }\n return stages;\n}\n\n/**\n * Builds one stage binding manifest record.\n *\n * @param {object} effectDescription Decoded effect description.\n * @param {string} techniqueName Technique name.\n * @param {number} passIndex Pass index.\n * @param {object} pass Pass metadata.\n * @param {number} stageType Stage enum value.\n * @param {object} stage Stage input metadata.\n * @returns {object} Stage binding record.\n */\nfunction buildStage(effectDescription, techniqueName, passIndex, pass, stageType, stage)\n{\n const bindings = [];\n const seen = new Set();\n\n for (const register of stage.signature?.registers || [])\n {\n const binding = buildRegisterBinding(effectDescription, pass, stageType, stage, register);\n if (!binding) continue;\n const identity = bindingIdentity(binding.kind, binding.registerSpace, binding.registerIndex);\n if (seen.has(identity)) continue;\n seen.add(identity);\n bindings.push(binding);\n }\n\n addSignatureSamplerBindings(effectDescription, pass, stageType, stage, bindings, seen);\n\n addMapBindings(effectDescription, pass, stageType, stage, bindings, seen, \"resource\", \"t\", stage.resources);\n addMapBindings(effectDescription, pass, stageType, stage, bindings, seen, \"sampler\", \"s\", stage.samplers);\n addMapBindings(effectDescription, pass, stageType, stage, bindings, seen, \"uav\", \"u\", stage.uavs);\n\n return {\n techniqueName,\n passIndex,\n stageType,\n stageName: hlslShaderStageName(stageType),\n shaderHandle: stage.m_shader,\n shaderBytecode: stage.cjsShaderBytecode?.toJSON?.() ?? stage.cjsShaderBytecode,\n pipelineInputs: cloneJson(stage.signature?.pipelineInputs || []),\n threadGroupSize: cloneJson(stage.signature?.threadGroupSize || null),\n bindings\n };\n}\n\n/**\n * Adds v13+ static samplers, which Carbon stores separately from the general\n * signature register list. In particular, SM 5.1 effects may declare `s0`\n * only in `signature.samplers`.\n *\n * @param {object} effectDescription Decoded effect description.\n * @param {object} pass Pass metadata.\n * @param {number} stageType Stage enum value.\n * @param {object} stage Stage input metadata.\n * @param {object[]} bindings Destination bindings.\n * @param {Set<string>} seen Class/space/register identities already added.\n */\nfunction addSignatureSamplerBindings(effectDescription, pass, stageType, stage, bindings, seen)\n{\n for (const sampler of stage.signature?.samplers || [])\n {\n if (!Number.isInteger(sampler?.registerIndex)) continue;\n const registerSpace = Number.isInteger(sampler.registerSpace) ? sampler.registerSpace : stageType;\n const identity = bindingIdentity(\"sampler\", registerSpace, sampler.registerIndex);\n if (seen.has(identity)) continue;\n const mapMetadata = stage.samplers.get(sampler.registerIndex) || null;\n const name = metadataName(\"sampler\", mapMetadata || sampler, stage, sampler.registerIndex);\n bindings.push({\n kind: \"sampler\",\n generatedSymbol: `s${sampler.registerIndex}`,\n registerIndex: sampler.registerIndex,\n registerType: 1,\n registerSpace,\n registerCount: 1,\n arrayCount: 1,\n dynamic: Boolean(mapMetadata?.sampler?.isDynamic),\n metadataName: name,\n carbon: {\n name: mapMetadata?.name || null,\n sampler: cloneJson(sampler.sampler)\n },\n annotations: annotationsFor(effectDescription, name),\n heapView: isHeapView(pass, \"sampler\", stageType, sampler.registerIndex),\n sourceTruth: \"carbon-signature-sampler\"\n });\n seen.add(identity);\n }\n}\n\n/**\n * Builds one binding from a Carbon register declaration.\n *\n * @param {object} effectDescription Decoded effect description.\n * @param {object} pass Pass metadata.\n * @param {number} stageType Stage enum value.\n * @param {object} stage Stage input metadata.\n * @param {object} register Carbon register declaration.\n * @returns {object|null} Binding record.\n */\nfunction buildRegisterBinding(effectDescription, pass, stageType, stage, register)\n{\n const classification = classifyRegister(register.registerType);\n if (!classification) return null;\n const metadata = metadataForBinding(stage, classification.kind, register.registerIndex);\n const generatedSymbol = `${classification.prefix}${register.registerIndex}`;\n return {\n kind: classification.kind,\n generatedSymbol,\n registerIndex: register.registerIndex,\n registerType: register.registerType,\n registerSpace: register.registerSpace,\n registerCount: register.registerCount,\n arrayCount: register.arrayCount,\n dynamic: Boolean(register.dynamic),\n metadataName: metadataName(classification.kind, metadata, stage, register.registerIndex),\n carbon: carbonPayload(classification.kind, metadata, stage, register.registerIndex),\n annotations: annotationsFor(effectDescription, metadataName(classification.kind, metadata, stage, register.registerIndex)),\n heapView: isHeapView(pass, classification.kind, stageType, register.registerIndex),\n sourceTruth: \"carbon-stage-register\"\n };\n}\n\n/**\n * Adds bindings found in Carbon maps but absent from the signature register list.\n *\n * @param {object} effectDescription Decoded effect description.\n * @param {object} pass Pass metadata.\n * @param {number} stageType Stage enum value.\n * @param {object} stage Stage input metadata.\n * @param {object[]} bindings Destination bindings.\n * @param {Set<string>} seen Generated symbols already added.\n * @param {string} kind Binding kind.\n * @param {string} prefix Generated symbol prefix.\n * @param {Map<number, object>} map Carbon register map.\n */\nfunction addMapBindings(effectDescription, pass, stageType, stage, bindings, seen, kind, prefix, map)\n{\n for (const [ registerIndex, metadata ] of map.entries())\n {\n // Carbon register maps do not carry a register space. When an exact\n // signature source already names this class/index, it wins regardless\n // of space; treating stageType as an additional exact space would\n // manufacture duplicate SM 5.1 bindings.\n if (bindings.some((entry) => entry.kind === kind && entry.registerIndex === registerIndex)) continue;\n const registerSpace = stageType;\n const identity = bindingIdentity(kind, registerSpace, registerIndex);\n const generatedSymbol = `${prefix}${registerIndex}`;\n if (seen.has(identity)) continue;\n bindings.push({\n kind,\n generatedSymbol,\n registerIndex,\n registerType: null,\n registerSpace,\n registerCount: metadata?.arrayElements || 1,\n arrayCount: metadata?.arrayElements || 1,\n dynamic: true,\n metadataName: metadataName(kind, metadata, stage, registerIndex),\n carbon: carbonPayload(kind, metadata, stage, registerIndex),\n annotations: annotationsFor(effectDescription, metadataName(kind, metadata, stage, registerIndex)),\n heapView: isHeapView(pass, kind, stageType, registerIndex),\n sourceTruth: \"carbon-register-map\"\n });\n seen.add(identity);\n }\n}\n\n/**\n * Builds a class-aware identity for one D3D register binding.\n *\n * @param {string} kind Binding class.\n * @param {number} registerSpace D3D register space.\n * @param {number} registerIndex D3D register index.\n * @returns {string} Stable identity.\n */\nfunction bindingIdentity(kind, registerSpace, registerIndex)\n{\n return `${kind}:${registerSpace}:${registerIndex}`;\n}\n\n/**\n * Classifies a Carbon register type into generated-symbol kind.\n *\n * @param {number} registerType Carbon register type.\n * @returns {{kind:string,prefix:string}|null} Binding classification.\n */\nfunction classifyRegister(registerType)\n{\n if (registerType === 0) return { kind: \"constantBuffer\", prefix: \"cb\" };\n if (registerType === 1) return { kind: \"sampler\", prefix: \"s\" };\n if (registerType >= 32 && registerType <= 63) return { kind: \"resource\", prefix: \"t\" };\n if (registerType >= 64 && registerType <= 95) return { kind: \"uav\", prefix: \"u\" };\n return null;\n}\n\n/**\n * Gets register metadata for a classified binding.\n *\n * @param {object} stage Stage input metadata.\n * @param {string} kind Binding kind.\n * @param {number} registerIndex Register index.\n * @returns {object|null} Carbon metadata object.\n */\nfunction metadataForBinding(stage, kind, registerIndex)\n{\n if (kind === \"resource\") return stage.resources.get(registerIndex) || null;\n if (kind === \"sampler\") return stage.samplers.get(registerIndex) || null;\n if (kind === \"uav\") return stage.uavs.get(registerIndex) || null;\n return null;\n}\n\n/**\n * Gets the best Carbon metadata name for one binding.\n *\n * @param {string} kind Binding kind.\n * @param {object|null} metadata Carbon metadata object.\n * @param {object} stage Stage input metadata.\n * @param {number} registerIndex Register index.\n * @returns {string|null} Metadata name.\n */\nfunction metadataName(kind, metadata, stage, registerIndex)\n{\n if (metadata?.name) return metadata.name;\n if (kind === \"constantBuffer\" && registerIndex === 0 && stage.constants.length) return \"$LocalConstants\";\n return null;\n}\n\n/**\n * Builds the Carbon metadata payload for one binding.\n *\n * @param {string} kind Binding kind.\n * @param {object|null} metadata Carbon metadata object.\n * @param {object} stage Stage input metadata.\n * @param {number} registerIndex Register index.\n * @returns {object|null} JSON-safe Carbon payload.\n */\nfunction carbonPayload(kind, metadata, stage, registerIndex)\n{\n if (kind === \"constantBuffer\")\n {\n const hasLocalConstants = registerIndex === 0 && stage.constants.length > 0;\n return {\n hasLocalConstants,\n constantValueSize: hasLocalConstants ? stage.m_constantValueSize : 0,\n constants: hasLocalConstants ? stage.constants.map((entry) => entry?.toJSON?.() ?? entry) : [],\n // The exact authored default bytes for the stage's local constant\n // buffer. A consumer that zero-fills instead of using these\n // changes every authored default the scene does not override -\n // the effect-resource contract calls the bytes mandatory, and a\n // background effect whose Tint and intensity read zero renders\n // pure black while drawing \"correctly\".\n constantValues: hasLocalConstants && stage.constantValues ? Array.from(stage.constantValues) : []\n };\n }\n return metadata?.toJSON?.() ?? cloneJson(metadata);\n}\n\n/**\n * Gets top-level annotations for a named parameter.\n *\n * @param {object} effectDescription Decoded effect description.\n * @param {string|null} name Parameter name.\n * @returns {object[]} JSON-safe annotations.\n */\nfunction annotationsFor(effectDescription, name)\n{\n if (!name) return [];\n const annotations = effectDescription.annotations?.get(name) || [];\n return annotations.map((entry) => entry?.toJSON?.() ?? entry);\n}\n\n/**\n * Checks whether a binding is marked as a heap view in the resource-set description.\n *\n * @param {object} pass Pass metadata.\n * @param {string} kind Binding kind.\n * @param {number} stageType Stage enum value.\n * @param {number} registerIndex Register index.\n * @returns {boolean} True when the binding is a heap view.\n */\nfunction isHeapView(pass, kind, stageType, registerIndex)\n{\n const heapKind = kind === \"resource\" ? \"srv\" : kind === \"sampler\" ? \"sampler\" : kind === \"uav\" ? \"uav\" : null;\n if (!heapKind) return false;\n return Boolean(pass.resourceSetDesc?.heapViews?.some((entry) =>\n entry.kind === heapKind &&\n entry.stageType === stageType &&\n entry.registerIndex === registerIndex\n ));\n}\n\n/**\n * Deep-clones JSON-like values.\n *\n * @param {*} value Value to clone.\n * @returns {*} JSON-like clone.\n */\nfunction cloneJson(value)\n{\n if (Array.isArray(value)) return value.map(cloneJson);\n if (value && typeof value === \"object\")\n {\n return Object.fromEntries(Object.entries(value).map(([ key, entry ]) => [ key, cloneJson(entry) ]));\n }\n return value;\n}\n"],"names":["HlslEffectBindingManifest","fromTr2EffectRes","effectRes","options","shader","GetShader","fromEffectDescription","GetEffectDescription","effectDescription","constructor","effectName","version","passes","buildPasses","stages","buildStages","resolve","query","stage","find","entry","techniqueName","passIndex","Number","isInteger","stageType","stageName","bindings","generatedSymbol","symbol","registerSpace","toJSON","map","cloneJson","technique","techniques","length","pass","push","name","renderStates","states","cjsRenderStateSetup","entries","key","value","state","HlslRenderContextEnum","SHADER_TYPE_COUNT","stageInputs","m_exists","buildStage","seen","Set","register","signature","registers","binding","buildRegisterBinding","identity","bindingIdentity","kind","registerIndex","has","add","addSignatureSamplerBindings","addMapBindings","resources","samplers","uavs","hlslShaderStageName","shaderHandle","m_shader","shaderBytecode","cjsShaderBytecode","pipelineInputs","threadGroupSize","sampler","mapMetadata","get","metadataName","registerType","registerCount","arrayCount","dynamic","Boolean","isDynamic","carbon","annotations","annotationsFor","heapView","isHeapView","sourceTruth","classification","classifyRegister","metadata","metadataForBinding","prefix","carbonPayload","some","arrayElements","constants","hasLocalConstants","constantValueSize","m_constantValueSize","constantValues","Array","from","heapKind","resourceSetDesc","heapViews","isArray","Object","fromEntries"],"mappings":";;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,yBAAyB,CACtC;AACI;AACJ;AACA;AACA;AACA;AACA;AACA;EACI,OAAOC,gBAAgBA,CAACC,SAAS,EAAEC,OAAO,GAAG,EAAE,EAC/C;AACI,IAAA,MAAMC,MAAM,GAAGF,SAAS,CAACG,SAAS,EAAE;IACpC,OAAOL,yBAAyB,CAACM,qBAAqB,CAACF,MAAM,CAACG,oBAAoB,EAAE,EAAEJ,OAAO,CAAC;AAClG,EAAA;;AAEA;AACJ;AACA;AACA;AACA;AACA;AACA;EACI,OAAOG,qBAAqBA,CAACE,iBAAiB,EAAEL,OAAO,GAAG,EAAE,EAC5D;AACI,IAAA,OAAO,IAAIH,yBAAyB,CAACQ,iBAAiB,EAAEL,OAAO,CAAC;AACpE,EAAA;;AAEA;AACJ;AACA;AACA;AACA;AACA;AACIM,EAAAA,WAAWA,CAACD,iBAAiB,EAAEL,OAAO,GAAG,EAAE,EAC3C;IACI,IAAI,CAACO,UAAU,GAAGF,iBAAiB,EAAEE,UAAU,IAAIP,OAAO,CAACO,UAAU,IAAI,EAAE;AAC3E,IAAA,IAAI,CAACC,OAAO,GAAGH,iBAAiB,EAAEG,OAAO,IAAI,CAAC;AAC9C,IAAA,IAAI,CAACC,MAAM,GAAGC,WAAW,CAACL,iBAAiB,CAAC;AAC5C,IAAA,IAAI,CAACM,MAAM,GAAGC,WAAW,CAACP,iBAAiB,CAAC;AAChD,EAAA;;AAEA;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACIQ,OAAOA,CAACC,KAAK,EACb;IACI,MAAMC,KAAK,GAAG,IAAI,CAACJ,MAAM,CAACK,IAAI,CAAEC,KAAK,IACjCA,KAAK,CAACC,aAAa,KAAKJ,KAAK,CAACI,aAAa,IACjDD,KAAK,C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S,IAC7BL,KAAK,CAAC0C,aAAa,KAAKA,aACxB,CAAC,CAAC;AACN;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS7B,SAASA,CAACY,KAAK,EACxB;AACI,EAAA,IAAI6D,KAAK,CAACK,OAAO,CAAClE,KAAK,CAAC,EAAE,OAAOA,KAAK,CAACb,GAAG,CAACC,SAAS,CAAC;AACrD,EAAA,IAAIY,KAAK,IAAI,OAAOA,KAAK,KAAK,QAAQ,EACtC;AACI,IAAA,OAAOmE,MAAM,CAACC,WAAW,CAACD,MAAM,CAACrE,OAAO,CAACE,KAAK,CAAC,CAACb,GAAG,CAAC,CAAC,CAAEY,GAAG,EAAExB,KAAK,CAAE,KAAK,CAAEwB,GAAG,EAAEX,SAAS,CAACb,KAAK,CAAC,CAAE,CAAC,CAAC;AACvG,EAAA;AACA,EAAA,OAAOyB,KAAK;AAChB;;;;"}
|
|
1
|
+
{"version":3,"file":"HlslEffectBindingManifest.js","sources":["../../../../../../../src/formats/hlsl/core/tr2/shader/HlslEffectBindingManifest.js"],"sourcesContent":["import { HlslRenderContextEnum, hlslShaderStageName } from \"../HlslRenderContextEnum.js\";\n\n/**\n * Carbon-backed binding manifest for register-named shader outputs.\n *\n * This maps generated fallback symbols such as `cb0`, `t3`, `s0`, and `u1`\n * back to the exact stage metadata read from Trinity effect data.\n */\nexport class HlslEffectBindingManifest\n{\n /**\n * Builds a manifest from a loaded `HlslEffectRes`.\n *\n * @param {object} effectRes Loaded effect resource with `GetShader()`.\n * @param {object} [options] Manifest options.\n * @returns {HlslEffectBindingManifest} Carbon binding manifest.\n */\n static fromTr2EffectRes(effectRes, options = {})\n {\n const shader = effectRes.GetShader();\n return HlslEffectBindingManifest.fromEffectDescription(shader.GetEffectDescription(), options);\n }\n\n /**\n * Builds a manifest from a decoded `HlslEffectDescription`.\n *\n * @param {object} effectDescription Decoded effect description.\n * @param {object} [options] Manifest options.\n * @returns {HlslEffectBindingManifest} Carbon binding manifest.\n */\n static fromEffectDescription(effectDescription, options = {})\n {\n return new HlslEffectBindingManifest(effectDescription, options);\n }\n\n /**\n * Creates a binding manifest.\n *\n * @param {object} effectDescription Decoded effect description.\n * @param {object} [options] Manifest options.\n */\n constructor(effectDescription, options = {})\n {\n this.effectName = effectDescription?.effectName || options.effectName || \"\";\n this.version = effectDescription?.version || 0;\n this.passes = buildPasses(effectDescription);\n this.stages = buildStages(effectDescription);\n }\n\n /**\n * Resolves a generated binding symbol for one stage.\n *\n * @param {object} query Stage and symbol query.\n * @param {string} query.techniqueName Technique name.\n * @param {number} query.passIndex Pass index.\n * @param {number} [query.stageType] Trinity stage enum value.\n * @param {string} [query.stageName] Stage name.\n * @param {string} query.symbol Generated symbol such as `cb0` or `t3`.\n * @param {number} [query.registerSpace] Optional D3D register-space disambiguator.\n * @returns {object|null} Matching binding record, or null.\n */\n resolve(query)\n {\n const stage = this.stages.find((entry) =>\n entry.techniqueName === query.techniqueName &&\n entry.passIndex === query.passIndex &&\n (Number.isInteger(query.stageType) ? entry.stageType === query.stageType : entry.stageName === query.stageName)\n );\n if (!stage) return null;\n return stage.bindings.find((entry) =>\n entry.generatedSymbol === query.symbol &&\n (!Number.isInteger(query.registerSpace) || entry.registerSpace === query.registerSpace)\n ) || null;\n }\n\n /**\n * Returns a JSON-safe manifest snapshot.\n *\n * @returns {object} Serializable binding manifest.\n */\n toJSON()\n {\n return {\n effectName: this.effectName,\n version: this.version,\n passes: this.passes.map((entry) => cloneJson(entry)),\n stages: this.stages.map((entry) => cloneJson(entry))\n };\n }\n}\n\n/**\n * Builds pass render-state records from the decoded effect description.\n *\n * @param {object} effectDescription Decoded effect description.\n * @returns {object[]} Pass render-state manifest records.\n */\nfunction buildPasses(effectDescription)\n{\n const passes = [];\n for (const technique of effectDescription?.techniques || [])\n {\n for (let passIndex = 0; passIndex < technique.passes.length; passIndex += 1)\n {\n const pass = technique.passes[passIndex];\n passes.push({\n techniqueName: technique.name,\n passIndex,\n renderStates: pass.renderStates,\n states: (pass.cjsRenderStateSetup?.entries || []).map(({ key, value }) => ({\n state: key,\n value\n }))\n });\n }\n }\n return passes;\n}\n\n/**\n * Builds all stage records from the decoded effect description.\n *\n * @param {object} effectDescription Decoded effect description.\n * @returns {object[]} Stage binding manifest records.\n */\nfunction buildStages(effectDescription)\n{\n const stages = [];\n for (const technique of effectDescription?.techniques || [])\n {\n for (let passIndex = 0; passIndex < technique.passes.length; passIndex += 1)\n {\n const pass = technique.passes[passIndex];\n for (let stageType = 0; stageType < HlslRenderContextEnum.SHADER_TYPE_COUNT; stageType += 1)\n {\n const stage = pass.stageInputs[stageType];\n if (!stage?.m_exists) continue;\n stages.push(buildStage(effectDescription, technique.name, passIndex, pass, stageType, stage));\n }\n }\n }\n return stages;\n}\n\n/**\n * Builds one stage binding manifest record.\n *\n * @param {object} effectDescription Decoded effect description.\n * @param {string} techniqueName Technique name.\n * @param {number} passIndex Pass index.\n * @param {object} pass Pass metadata.\n * @param {number} stageType Stage enum value.\n * @param {object} stage Stage input metadata.\n * @returns {object} Stage binding record.\n */\nfunction buildStage(effectDescription, techniqueName, passIndex, pass, stageType, stage)\n{\n const bindings = [];\n const seen = new Set();\n\n for (const register of stage.signature?.registers || [])\n {\n const binding = buildRegisterBinding(effectDescription, pass, stageType, stage, register);\n if (!binding) continue;\n const identity = bindingIdentity(binding.kind, binding.registerSpace, binding.registerIndex);\n if (seen.has(identity)) continue;\n seen.add(identity);\n bindings.push(binding);\n }\n\n addSignatureSamplerBindings(effectDescription, pass, stageType, stage, bindings, seen);\n\n addMapBindings(effectDescription, pass, stageType, stage, bindings, seen, \"resource\", \"t\", stage.resources);\n addMapBindings(effectDescription, pass, stageType, stage, bindings, seen, \"sampler\", \"s\", stage.samplers);\n addMapBindings(effectDescription, pass, stageType, stage, bindings, seen, \"uav\", \"u\", stage.uavs);\n\n return {\n techniqueName,\n passIndex,\n stageType,\n stageName: hlslShaderStageName(stageType),\n shaderHandle: stage.m_shader,\n shaderBytecode: stage.cjsShaderBytecode?.toJSON?.() ?? stage.cjsShaderBytecode,\n pipelineInputs: cloneJson(stage.signature?.pipelineInputs || []),\n threadGroupSize: cloneJson(stage.signature?.threadGroupSize || null),\n bindings\n };\n}\n\n/**\n * Adds v13+ static samplers, which Carbon stores separately from the general\n * signature register list. In particular, SM 5.1 effects may declare `s0`\n * only in `signature.samplers`.\n *\n * @param {object} effectDescription Decoded effect description.\n * @param {object} pass Pass metadata.\n * @param {number} stageType Stage enum value.\n * @param {object} stage Stage input metadata.\n * @param {object[]} bindings Destination bindings.\n * @param {Set<string>} seen Class/space/register identities already added.\n */\nfunction addSignatureSamplerBindings(effectDescription, pass, stageType, stage, bindings, seen)\n{\n for (const sampler of stage.signature?.samplers || [])\n {\n if (!Number.isInteger(sampler?.registerIndex)) continue;\n const registerSpace = Number.isInteger(sampler.registerSpace) ? sampler.registerSpace : stageType;\n const identity = bindingIdentity(\"sampler\", registerSpace, sampler.registerIndex);\n if (seen.has(identity)) continue;\n const mapMetadata = stage.samplers.get(sampler.registerIndex) || null;\n const name = metadataName(\"sampler\", mapMetadata || sampler, stage, sampler.registerIndex);\n bindings.push({\n kind: \"sampler\",\n generatedSymbol: `s${sampler.registerIndex}`,\n registerIndex: sampler.registerIndex,\n registerType: 1,\n registerSpace,\n registerCount: 1,\n arrayCount: 1,\n dynamic: Boolean(mapMetadata?.sampler?.isDynamic),\n metadataName: name,\n carbon: {\n name: mapMetadata?.name || null,\n sampler: cloneJson(sampler.sampler)\n },\n annotations: annotationsFor(effectDescription, name),\n heapView: isHeapView(pass, \"sampler\", stageType, sampler.registerIndex),\n sourceTruth: \"carbon-signature-sampler\"\n });\n seen.add(identity);\n }\n}\n\n/**\n * Builds one binding from a Carbon register declaration.\n *\n * @param {object} effectDescription Decoded effect description.\n * @param {object} pass Pass metadata.\n * @param {number} stageType Stage enum value.\n * @param {object} stage Stage input metadata.\n * @param {object} register Carbon register declaration.\n * @returns {object|null} Binding record.\n */\nfunction buildRegisterBinding(effectDescription, pass, stageType, stage, register)\n{\n const classification = classifyRegister(register.registerType);\n if (!classification) return null;\n const metadata = metadataForBinding(stage, classification.kind, register.registerIndex);\n const generatedSymbol = `${classification.prefix}${register.registerIndex}`;\n return {\n kind: classification.kind,\n generatedSymbol,\n registerIndex: register.registerIndex,\n registerType: register.registerType,\n registerSpace: register.registerSpace,\n registerCount: register.registerCount,\n arrayCount: register.arrayCount,\n // A sampler's `dynamic` is the override authorisation, never the\n // per-frame register flag. `isRegisterDynamic` answers a constant-buffer\n // question -- it returns true for every register whose type is not a\n // constant buffer -- so reading it here marked every DX11 sampler\n // dynamic by construction, contradicting the `isDynamic: false` sitting\n // beside it in the same binding's `carbon.sampler`. DX12 reaches these\n // samplers through the signature path, which already uses the sampler\n // flag, so the same sampler disagreed across backends for no reason\n // other than which code path declared it.\n dynamic: classification.kind === \"sampler\"\n ? Boolean(metadata?.sampler?.isDynamic)\n : Boolean(register.dynamic),\n metadataName: metadataName(classification.kind, metadata, stage, register.registerIndex),\n carbon: carbonPayload(classification.kind, metadata, stage, register.registerIndex),\n annotations: annotationsFor(effectDescription, metadataName(classification.kind, metadata, stage, register.registerIndex)),\n heapView: isHeapView(pass, classification.kind, stageType, register.registerIndex),\n sourceTruth: \"carbon-stage-register\"\n };\n}\n\n/**\n * Adds bindings found in Carbon maps but absent from the signature register list.\n *\n * @param {object} effectDescription Decoded effect description.\n * @param {object} pass Pass metadata.\n * @param {number} stageType Stage enum value.\n * @param {object} stage Stage input metadata.\n * @param {object[]} bindings Destination bindings.\n * @param {Set<string>} seen Generated symbols already added.\n * @param {string} kind Binding kind.\n * @param {string} prefix Generated symbol prefix.\n * @param {Map<number, object>} map Carbon register map.\n */\nfunction addMapBindings(effectDescription, pass, stageType, stage, bindings, seen, kind, prefix, map)\n{\n for (const [ registerIndex, metadata ] of map.entries())\n {\n // Carbon register maps do not carry a register space. When an exact\n // signature source already names this class/index, it wins regardless\n // of space; treating stageType as an additional exact space would\n // manufacture duplicate SM 5.1 bindings.\n if (bindings.some((entry) => entry.kind === kind && entry.registerIndex === registerIndex)) continue;\n const registerSpace = stageType;\n const identity = bindingIdentity(kind, registerSpace, registerIndex);\n const generatedSymbol = `${prefix}${registerIndex}`;\n if (seen.has(identity)) continue;\n bindings.push({\n kind,\n generatedSymbol,\n registerIndex,\n registerType: null,\n registerSpace,\n registerCount: metadata?.arrayElements || 1,\n arrayCount: metadata?.arrayElements || 1,\n dynamic: true,\n metadataName: metadataName(kind, metadata, stage, registerIndex),\n carbon: carbonPayload(kind, metadata, stage, registerIndex),\n annotations: annotationsFor(effectDescription, metadataName(kind, metadata, stage, registerIndex)),\n heapView: isHeapView(pass, kind, stageType, registerIndex),\n sourceTruth: \"carbon-register-map\"\n });\n seen.add(identity);\n }\n}\n\n/**\n * Builds a class-aware identity for one D3D register binding.\n *\n * @param {string} kind Binding class.\n * @param {number} registerSpace D3D register space.\n * @param {number} registerIndex D3D register index.\n * @returns {string} Stable identity.\n */\nfunction bindingIdentity(kind, registerSpace, registerIndex)\n{\n return `${kind}:${registerSpace}:${registerIndex}`;\n}\n\n/**\n * Classifies a Carbon register type into generated-symbol kind.\n *\n * @param {number} registerType Carbon register type.\n * @returns {{kind:string,prefix:string}|null} Binding classification.\n */\nfunction classifyRegister(registerType)\n{\n if (registerType === 0) return { kind: \"constantBuffer\", prefix: \"cb\" };\n if (registerType === 1) return { kind: \"sampler\", prefix: \"s\" };\n if (registerType >= 32 && registerType <= 63) return { kind: \"resource\", prefix: \"t\" };\n if (registerType >= 64 && registerType <= 95) return { kind: \"uav\", prefix: \"u\" };\n return null;\n}\n\n/**\n * Gets register metadata for a classified binding.\n *\n * @param {object} stage Stage input metadata.\n * @param {string} kind Binding kind.\n * @param {number} registerIndex Register index.\n * @returns {object|null} Carbon metadata object.\n */\nfunction metadataForBinding(stage, kind, registerIndex)\n{\n if (kind === \"resource\") return stage.resources.get(registerIndex) || null;\n if (kind === \"sampler\") return stage.samplers.get(registerIndex) || null;\n if (kind === \"uav\") return stage.uavs.get(registerIndex) || null;\n return null;\n}\n\n/**\n * Gets the best Carbon metadata name for one binding.\n *\n * @param {string} kind Binding kind.\n * @param {object|null} metadata Carbon metadata object.\n * @param {object} stage Stage input metadata.\n * @param {number} registerIndex Register index.\n * @returns {string|null} Metadata name.\n */\nfunction metadataName(kind, metadata, stage, registerIndex)\n{\n if (metadata?.name) return metadata.name;\n if (kind === \"constantBuffer\" && registerIndex === 0 && stage.constants.length) return \"$LocalConstants\";\n return null;\n}\n\n/**\n * Builds the Carbon metadata payload for one binding.\n *\n * @param {string} kind Binding kind.\n * @param {object|null} metadata Carbon metadata object.\n * @param {object} stage Stage input metadata.\n * @param {number} registerIndex Register index.\n * @returns {object|null} JSON-safe Carbon payload.\n */\nfunction carbonPayload(kind, metadata, stage, registerIndex)\n{\n if (kind === \"constantBuffer\")\n {\n const hasLocalConstants = registerIndex === 0 && stage.constants.length > 0;\n return {\n hasLocalConstants,\n constantValueSize: hasLocalConstants ? stage.m_constantValueSize : 0,\n constants: hasLocalConstants ? stage.constants.map((entry) => entry?.toJSON?.() ?? entry) : [],\n // The exact authored default bytes for the stage's local constant\n // buffer. A consumer that zero-fills instead of using these\n // changes every authored default the scene does not override -\n // the effect-resource contract calls the bytes mandatory, and a\n // background effect whose Tint and intensity read zero renders\n // pure black while drawing \"correctly\".\n constantValues: hasLocalConstants && stage.constantValues ? Array.from(stage.constantValues) : []\n };\n }\n return metadata?.toJSON?.() ?? cloneJson(metadata);\n}\n\n/**\n * Gets top-level annotations for a named parameter.\n *\n * @param {object} effectDescription Decoded effect description.\n * @param {string|null} name Parameter name.\n * @returns {object[]} JSON-safe annotations.\n */\nfunction annotationsFor(effectDescription, name)\n{\n if (!name) return [];\n const annotations = effectDescription.annotations?.get(name) || [];\n return annotations.map((entry) => entry?.toJSON?.() ?? entry);\n}\n\n/**\n * Checks whether a binding is marked as a heap view in the resource-set description.\n *\n * @param {object} pass Pass metadata.\n * @param {string} kind Binding kind.\n * @param {number} stageType Stage enum value.\n * @param {number} registerIndex Register index.\n * @returns {boolean} True when the binding is a heap view.\n */\nfunction isHeapView(pass, kind, stageType, registerIndex)\n{\n const heapKind = kind === \"resource\" ? \"srv\" : kind === \"sampler\" ? \"sampler\" : kind === \"uav\" ? \"uav\" : null;\n if (!heapKind) return false;\n return Boolean(pass.resourceSetDesc?.heapViews?.some((entry) =>\n entry.kind === heapKind &&\n entry.stageType === stageType &&\n entry.registerIndex === registerIndex\n ));\n}\n\n/**\n * Deep-clones JSON-like values.\n *\n * @param {*} value Value to clone.\n * @returns {*} JSON-like clone.\n */\nfunction cloneJson(value)\n{\n if (Array.isArray(value)) return value.map(cloneJson);\n if (value && typeof value === \"object\")\n {\n return Object.fromEntries(Object.entries(value).map(([ key, entry ]) => [ key, cloneJson(entry) ]));\n }\n return value;\n}\n"],"names":["HlslEffectBindingManifest","fromTr2EffectRes","effectRes","options","shader","GetShader","fromEffectDescription","GetEffectDescription","effectDescription","constructor","effectName","version","passes","buildPasses","stages","buildStages","resolve","query","stage","find","entry","techniqueName","passIndex","Number","isInteger","stageType","stageName","bindings","generatedSymbol","symbol","registerSpace","toJSON","map","cloneJson","technique","techniques","length","pass","push","name","renderStates","states","cjsRenderStateSetup","entries","key","value","state","HlslRenderContextEnum","SHADER_TYPE_COUNT","stageInputs","m_exists","buildStage","seen","Set","register","signature","registers","binding","buildRegisterBinding","identity","bindingIdentity","kind","registerIndex","has","add","addSignatureSamplerBindings","addMapBindings","resources","samplers","uavs","hlslShaderStageName","shaderHandle","m_shader","shaderBytecode","cjsShaderBytecode","pipelineInputs","threadGroupSize","sampler","mapMetadata","get","metadataName","registerType","registerCount","arrayCount","dynamic","Boolean","isDynamic","carbon","annotations","annotationsFor","heapView","isHeapView","sourceTruth","classification","classifyRegister","metadata","metadataForBinding","prefix","carbonPayload","some","arrayElements","constants","hasLocalConstants","constantValueSize","m_constantValueSize","constantValues","Array","from","heapKind","resourceSetDesc","heapViews","isArray","Object","fromEntries"],"mappings":";;AAEA;AACA;AACA;AACA;AACA;A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,SAAS,IAC7BL,KAAK,CAAC0C,aAAa,KAAKA,aACxB,CAAC,CAAC;AACN;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS7B,SAASA,CAACY,KAAK,EACxB;AACI,EAAA,IAAI6D,KAAK,CAACK,OAAO,CAAClE,KAAK,CAAC,EAAE,OAAOA,KAAK,CAACb,GAAG,CAACC,SAAS,CAAC;AACrD,EAAA,IAAIY,KAAK,IAAI,OAAOA,KAAK,KAAK,QAAQ,EACtC;AACI,IAAA,OAAOmE,MAAM,CAACC,WAAW,CAACD,MAAM,CAACrE,OAAO,CAACE,KAAK,CAAC,CAACb,GAAG,CAAC,CAAC,CAAEY,GAAG,EAAExB,KAAK,CAAE,KAAK,CAAEwB,GAAG,EAAEX,SAAS,CAACb,KAAK,CAAC,CAAE,CAAC,CAAC;AACvG,EAAA;AACA,EAAA,OAAOyB,KAAK;AAChB;;;;"}
|
package/dist/formats/index.js
CHANGED
|
@@ -23,6 +23,9 @@ export { CjsOggFormat } from './ogg/CjsOggFormat.js';
|
|
|
23
23
|
export { CjsPickleFormat } from './pickle/CjsPickleFormat.js';
|
|
24
24
|
export { CjsPngFormat } from './png/CjsPngFormat.js';
|
|
25
25
|
export { CjsRedFormat } from './red/CjsRedFormat.js';
|
|
26
|
+
export { CjsSchemaBoundFormat } from './schemabound/CjsSchemaBoundFormat.js';
|
|
27
|
+
export { CjsSqliteFormat } from './sqlite/CjsSqliteFormat.js';
|
|
28
|
+
export { CJS_STATIC_FAMILIES, CjsStaticFormat } from './static/CjsStaticFormat.js';
|
|
26
29
|
export { CjsStlFormat } from './stl/CjsStlFormat.js';
|
|
27
30
|
export { CjsTgaFormat } from './tga/CjsTgaFormat.js';
|
|
28
31
|
export { CjsWavFormat } from './wav/CjsWavFormat.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import { CjsYamlFormat } from '../yaml/CjsYamlFormat.js';
|
|
2
|
+
import { ReadValue } from './core/schemaBoundValues.js';
|
|
3
|
+
import { SchemaBoundError } from './core/schemaBoundErrors.js';
|
|
4
|
+
|
|
5
|
+
const OUTPUT_JSON = "json";
|
|
6
|
+
const OUTPUT_PAYLOAD = "payload";
|
|
7
|
+
const ROOT_TYPES = new Set(["dict", "list", "object"]);
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Reads a container whose layout lives in a separate schema.
|
|
11
|
+
*
|
|
12
|
+
* This is the third of the three families that share the `.static` extension,
|
|
13
|
+
* and the one an extension check is least able to help with: the bytes carry no
|
|
14
|
+
* signature, no version and no self-description. What they carry is a payload
|
|
15
|
+
* whose every field position, width and meaning is stated in a sibling `.schema`
|
|
16
|
+
* document — so the schema is not a hint here, it is the reader.
|
|
17
|
+
*
|
|
18
|
+
* That makes this the opposite of the hash-identified containers, where the
|
|
19
|
+
* header names a layout it does not describe and the layout has to be derived
|
|
20
|
+
* and pinned per dataset. Nothing needs deriving for this family. Supply the
|
|
21
|
+
* schema and the bytes decode.
|
|
22
|
+
*
|
|
23
|
+
* **The schema is required and there is no default.** Given the wrong schema
|
|
24
|
+
* these bytes decode into plausible nonsense rather than failing, because there
|
|
25
|
+
* is nothing in them to disagree with. Pair each payload with the `.schema`
|
|
26
|
+
* that shipped beside it.
|
|
27
|
+
*
|
|
28
|
+
* Read {@link CjsSchemaBoundFormat.read} before writing anything that walks the
|
|
29
|
+
* result: a record's variable section changes length from record to record, and
|
|
30
|
+
* a decoder written around a constant stride will read the first record
|
|
31
|
+
* correctly and everything after it wrongly.
|
|
32
|
+
*/
|
|
33
|
+
class CjsSchemaBoundFormat {
|
|
34
|
+
/**
|
|
35
|
+
* Reports whether a schema can drive this reader.
|
|
36
|
+
*
|
|
37
|
+
* The question is about the schema, never the payload. These containers have
|
|
38
|
+
* no signature to test, so claiming to recognize the bytes would be a claim
|
|
39
|
+
* this format cannot support - and `CjsStaticFormat` already answers which
|
|
40
|
+
* family a `.static` file belongs to.
|
|
41
|
+
*
|
|
42
|
+
* @param {object|Uint8Array|ArrayBuffer|string} schema Schema document or its bytes.
|
|
43
|
+
* @returns {boolean} True when the schema has a root this reader understands.
|
|
44
|
+
*/
|
|
45
|
+
static is(schema) {
|
|
46
|
+
try {
|
|
47
|
+
return ROOT_TYPES.has(this.schema(schema).type);
|
|
48
|
+
} catch {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Reports whether this format can read a payload described by a schema.
|
|
55
|
+
*
|
|
56
|
+
* @param {object|Uint8Array|ArrayBuffer|string} schema Schema document or its bytes.
|
|
57
|
+
* @param {object} [options] Probe options.
|
|
58
|
+
* @returns {object} Resource probe.
|
|
59
|
+
*/
|
|
60
|
+
static isSupported(schema, options = null) {
|
|
61
|
+
return Probe(this.is(schema), options);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// INTERIM, 2026-08-16. No `inspect` alias, matching CjsSqliteFormat and
|
|
65
|
+
// diverging from the older formats. Both are held by the same undecided
|
|
66
|
+
// question; see maintenance/INTERIM-sqlite-and-static-2026-08-16.md.
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Reads a container against its schema.
|
|
70
|
+
*
|
|
71
|
+
* The whole payload decodes in one pass. Three properties are worth knowing
|
|
72
|
+
* before relying on the result:
|
|
73
|
+
*
|
|
74
|
+
* - **A keyed container's index is at the end.** Nothing at the front points
|
|
75
|
+
* at it; it is found by reading the last four bytes as the index's own size.
|
|
76
|
+
* - **Record offsets are relative to the four-byte header**, not to the file.
|
|
77
|
+
* Decoding from the file start reads one field early, which looks like a
|
|
78
|
+
* wrong layout rather than a wrong base.
|
|
79
|
+
* - **The per-record offset table varies in length.** An optional attribute
|
|
80
|
+
* that is absent occupies no slot, so consecutive records hold their
|
|
81
|
+
* variable data at different distances from their own start.
|
|
82
|
+
*
|
|
83
|
+
* An absent optional takes the default its schema declares. Where none is
|
|
84
|
+
* declared the attribute is left off the record entirely, which is what the
|
|
85
|
+
* published static data exports show for those same rows.
|
|
86
|
+
*
|
|
87
|
+
* @param {Uint8Array|ArrayBuffer} input Container bytes.
|
|
88
|
+
* @param {object} options Read options.
|
|
89
|
+
* @param {object|Uint8Array|ArrayBuffer|string} options.schema The sibling schema.
|
|
90
|
+
* @param {string} [options.output] `json` or `payload`.
|
|
91
|
+
* @returns {object|Array} The decoded container.
|
|
92
|
+
*/
|
|
93
|
+
static read(input, options = {}) {
|
|
94
|
+
const bytes = Normalize(input);
|
|
95
|
+
const schema = this.schema(options.schema);
|
|
96
|
+
if (!ROOT_TYPES.has(schema.type)) {
|
|
97
|
+
throw SchemaBoundError(`A container's root must be a dict, list or object, not ${schema.type}.`);
|
|
98
|
+
}
|
|
99
|
+
const context = {
|
|
100
|
+
bytes,
|
|
101
|
+
view: new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength)
|
|
102
|
+
};
|
|
103
|
+
const decoded = ReadValue(context, 0, schema).value;
|
|
104
|
+
return options.output === OUTPUT_PAYLOAD ? decoded : ToJSON(decoded);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/** Reads to plain JSON-compatible values. */
|
|
108
|
+
static readJSON(input, options = {}) {
|
|
109
|
+
return this.read(input, {
|
|
110
|
+
...options,
|
|
111
|
+
output: OUTPUT_JSON
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/** Reads with wide integers left as `BigInt`. */
|
|
116
|
+
static readPayload(input, options = {}) {
|
|
117
|
+
return this.read(input, {
|
|
118
|
+
...options,
|
|
119
|
+
output: OUTPUT_PAYLOAD
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Parses a schema document, accepting YAML bytes, YAML text or a parsed object.
|
|
125
|
+
*
|
|
126
|
+
* @param {object|Uint8Array|ArrayBuffer|string} schema Schema in any accepted form.
|
|
127
|
+
* @returns {object} The parsed schema.
|
|
128
|
+
*/
|
|
129
|
+
static schema(schema) {
|
|
130
|
+
if (!schema) {
|
|
131
|
+
throw SchemaBoundError("This format cannot read a container without its schema.");
|
|
132
|
+
}
|
|
133
|
+
if (typeof schema === "object" && !ArrayBuffer.isView(schema) && !(schema instanceof ArrayBuffer)) {
|
|
134
|
+
return schema;
|
|
135
|
+
}
|
|
136
|
+
const parsed = CjsYamlFormat.read(typeof schema === "string" ? schema : Normalize(schema));
|
|
137
|
+
if (!parsed || typeof parsed !== "object") {
|
|
138
|
+
throw SchemaBoundError("A schema must parse to a mapping.");
|
|
139
|
+
}
|
|
140
|
+
return Resolve(parsed);
|
|
141
|
+
}
|
|
142
|
+
static Output = Object.freeze({
|
|
143
|
+
JSON: OUTPUT_JSON,
|
|
144
|
+
PAYLOAD: OUTPUT_PAYLOAD
|
|
145
|
+
});
|
|
146
|
+
static id = "schemabound";
|
|
147
|
+
static extensions = Object.freeze([".static"]);
|
|
148
|
+
static type = Object.freeze(["data"]);
|
|
149
|
+
static mediaTypes = Object.freeze(["data"]);
|
|
150
|
+
static inputTypes = Object.freeze(["schemabound"]);
|
|
151
|
+
static outputTypes = Object.freeze([OUTPUT_JSON, OUTPUT_PAYLOAD]);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Rejoins YAML anchors and aliases into the graph they describe.
|
|
156
|
+
*
|
|
157
|
+
* These schemas share repeated declarations by anchor - a container with two
|
|
158
|
+
* coordinates writes the vector's component aliases once - and the YAML reader
|
|
159
|
+
* reports that sharing as `$yamlId` and `$yamlRef` markers rather than
|
|
160
|
+
* duplicating the node. Left alone, `$yamlId` reads as one more component and
|
|
161
|
+
* `$yamlRef` as a declaration with no fields at all.
|
|
162
|
+
*
|
|
163
|
+
* @param {*} value Parsed schema, or any part of one.
|
|
164
|
+
* @returns {*} The same schema with anchors resolved and markers removed.
|
|
165
|
+
*/
|
|
166
|
+
function Resolve(value) {
|
|
167
|
+
const anchors = new Map();
|
|
168
|
+
const walk = node => {
|
|
169
|
+
if (Array.isArray(node)) return node.map(walk);
|
|
170
|
+
if (!node || typeof node !== "object") return node;
|
|
171
|
+
if (Object.hasOwn(node, "$yamlRef")) {
|
|
172
|
+
const target = anchors.get(node.$yamlRef);
|
|
173
|
+
if (!target) {
|
|
174
|
+
throw SchemaBoundError(`The schema refers to an anchor it never declares: ${node.$yamlRef}.`);
|
|
175
|
+
}
|
|
176
|
+
return target;
|
|
177
|
+
}
|
|
178
|
+
const result = {};
|
|
179
|
+
const id = node.$yamlId;
|
|
180
|
+
if (id !== undefined) anchors.set(id, result);
|
|
181
|
+
for (const [key, member] of Object.entries(node)) {
|
|
182
|
+
if (key !== "$yamlId") result[key] = walk(member);
|
|
183
|
+
}
|
|
184
|
+
return result;
|
|
185
|
+
};
|
|
186
|
+
return walk(value);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/** Builds the probe shape the resource manager routes on. */
|
|
190
|
+
function Probe(usable, options) {
|
|
191
|
+
return {
|
|
192
|
+
format: "schemabound",
|
|
193
|
+
source: "buffer",
|
|
194
|
+
supported: usable ? "full" : "none",
|
|
195
|
+
confidence: usable ? 1 : 0,
|
|
196
|
+
preferred: "schemabound",
|
|
197
|
+
// The schema is read to answer this, so it is measured rather than declared.
|
|
198
|
+
// It says nothing about any payload: these containers carry no signature.
|
|
199
|
+
verified: true,
|
|
200
|
+
reason: usable ? "The schema declares a root this reader can decode." : "The schema is missing, unparsable, or declares an unreadable root.",
|
|
201
|
+
variants: [{
|
|
202
|
+
kind: "container",
|
|
203
|
+
codec: "schemabound",
|
|
204
|
+
supported: usable
|
|
205
|
+
}],
|
|
206
|
+
metadata: {
|
|
207
|
+
family: "schemabound",
|
|
208
|
+
requiresSchema: true,
|
|
209
|
+
decodable: usable
|
|
210
|
+
},
|
|
211
|
+
...(options || {})
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/** Converts decoded values to something `JSON.stringify` keeps losslessly. */
|
|
216
|
+
function ToJSON(value) {
|
|
217
|
+
if (typeof value === "bigint") return value.toString(10);
|
|
218
|
+
if (Array.isArray(value)) return value.map(ToJSON);
|
|
219
|
+
if (value && typeof value === "object") {
|
|
220
|
+
const result = {};
|
|
221
|
+
for (const [key, member] of Object.entries(value)) result[key] = ToJSON(member);
|
|
222
|
+
return result;
|
|
223
|
+
}
|
|
224
|
+
return value;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/** Accepts the byte forms every other format here accepts. */
|
|
228
|
+
function Normalize(input) {
|
|
229
|
+
if (input instanceof Uint8Array) return input;
|
|
230
|
+
if (input instanceof ArrayBuffer) return new Uint8Array(input);
|
|
231
|
+
if (ArrayBuffer.isView(input)) return new Uint8Array(input.buffer, input.byteOffset, input.byteLength);
|
|
232
|
+
throw SchemaBoundError("A schema-bound container must be supplied as bytes.");
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
export { CjsSchemaBoundFormat };
|
|
236
|
+
//# sourceMappingURL=CjsSchemaBoundFormat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CjsSchemaBoundFormat.js","sources":["../../../../src/formats/schemabound/CjsSchemaBoundFormat.js"],"sourcesContent":["import { CjsYamlFormat } from \"../yaml/index.js\";\nimport { ReadValue } from \"./core/schemaBoundValues.js\";\nimport { SchemaBoundError } from \"./core/schemaBoundErrors.js\";\n\nconst OUTPUT_JSON = \"json\";\nconst OUTPUT_PAYLOAD = \"payload\";\nconst ROOT_TYPES = new Set([ \"dict\", \"list\", \"object\" ]);\n\n/**\n * Reads a container whose layout lives in a separate schema.\n *\n * This is the third of the three families that share the `.static` extension,\n * and the one an extension check is least able to help with: the bytes carry no\n * signature, no version and no self-description. What they carry is a payload\n * whose every field position, width and meaning is stated in a sibling `.schema`\n * document — so the schema is not a hint here, it is the reader.\n *\n * That makes this the opposite of the hash-identified containers, where the\n * header names a layout it does not describe and the layout has to be derived\n * and pinned per dataset. Nothing needs deriving for this family. Supply the\n * schema and the bytes decode.\n *\n * **The schema is required and there is no default.** Given the wrong schema\n * these bytes decode into plausible nonsense rather than failing, because there\n * is nothing in them to disagree with. Pair each payload with the `.schema`\n * that shipped beside it.\n *\n * Read {@link CjsSchemaBoundFormat.read} before writing anything that walks the\n * result: a record's variable section changes length from record to record, and\n * a decoder written around a constant stride will read the first record\n * correctly and everything after it wrongly.\n */\nexport class CjsSchemaBoundFormat {\n\n /**\n * Reports whether a schema can drive this reader.\n *\n * The question is about the schema, never the payload. These containers have\n * no signature to test, so claiming to recognize the bytes would be a claim\n * this format cannot support - and `CjsStaticFormat` already answers which\n * family a `.static` file belongs to.\n *\n * @param {object|Uint8Array|ArrayBuffer|string} schema Schema document or its bytes.\n * @returns {boolean} True when the schema has a root this reader understands.\n */\n static is(schema) {\n try {\n return ROOT_TYPES.has(this.schema(schema).type);\n } catch {\n return false;\n }\n }\n\n /**\n * Reports whether this format can read a payload described by a schema.\n *\n * @param {object|Uint8Array|ArrayBuffer|string} schema Schema document or its bytes.\n * @param {object} [options] Probe options.\n * @returns {object} Resource probe.\n */\n static isSupported(schema, options = null) {\n return Probe(this.is(schema), options);\n }\n\n // INTERIM, 2026-08-16. No `inspect` alias, matching CjsSqliteFormat and\n // diverging from the older formats. Both are held by the same undecided\n // question; see maintenance/INTERIM-sqlite-and-static-2026-08-16.md.\n\n /**\n * Reads a container against its schema.\n *\n * The whole payload decodes in one pass. Three properties are worth knowing\n * before relying on the result:\n *\n * - **A keyed container's index is at the end.** Nothing at the front points\n * at it; it is found by reading the last four bytes as the index's own size.\n * - **Record offsets are relative to the four-byte header**, not to the file.\n * Decoding from the file start reads one field early, which looks like a\n * wrong layout rather than a wrong base.\n * - **The per-record offset table varies in length.** An optional attribute\n * that is absent occupies no slot, so consecutive records hold their\n * variable data at different distances from their own start.\n *\n * An absent optional takes the default its schema declares. Where none is\n * declared the attribute is left off the record entirely, which is what the\n * published static data exports show for those same rows.\n *\n * @param {Uint8Array|ArrayBuffer} input Container bytes.\n * @param {object} options Read options.\n * @param {object|Uint8Array|ArrayBuffer|string} options.schema The sibling schema.\n * @param {string} [options.output] `json` or `payload`.\n * @returns {object|Array} The decoded container.\n */\n static read(input, options = {}) {\n const bytes = Normalize(input);\n const schema = this.schema(options.schema);\n\n if (!ROOT_TYPES.has(schema.type)) {\n throw SchemaBoundError(`A container's root must be a dict, list or object, not ${schema.type}.`);\n }\n\n const context = {\n bytes,\n view: new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength)\n };\n const decoded = ReadValue(context, 0, schema).value;\n\n return options.output === OUTPUT_PAYLOAD ? decoded : ToJSON(decoded);\n }\n\n /** Reads to plain JSON-compatible values. */\n static readJSON(input, options = {}) {\n return this.read(input, { ...options, output: OUTPUT_JSON });\n }\n\n /** Reads with wide integers left as `BigInt`. */\n static readPayload(input, options = {}) {\n return this.read(input, { ...options, output: OUTPUT_PAYLOAD });\n }\n\n /**\n * Parses a schema document, accepting YAML bytes, YAML text or a parsed object.\n *\n * @param {object|Uint8Array|ArrayBuffer|string} schema Schema in any accepted form.\n * @returns {object} The parsed schema.\n */\n static schema(schema) {\n if (!schema) {\n throw SchemaBoundError(\"This format cannot read a container without its schema.\");\n }\n\n if (typeof schema === \"object\" && !ArrayBuffer.isView(schema) && !(schema instanceof ArrayBuffer)) {\n return schema;\n }\n\n const parsed = CjsYamlFormat.read(typeof schema === \"string\" ? schema : Normalize(schema));\n\n if (!parsed || typeof parsed !== \"object\") {\n throw SchemaBoundError(\"A schema must parse to a mapping.\");\n }\n\n return Resolve(parsed);\n }\n\n static Output = Object.freeze({ JSON: OUTPUT_JSON, PAYLOAD: OUTPUT_PAYLOAD });\n\n static id = \"schemabound\";\n static extensions = Object.freeze([ \".static\" ]);\n static type = Object.freeze([ \"data\" ]);\n static mediaTypes = Object.freeze([ \"data\" ]);\n static inputTypes = Object.freeze([ \"schemabound\" ]);\n static outputTypes = Object.freeze([ OUTPUT_JSON, OUTPUT_PAYLOAD ]);\n}\n\n/**\n * Rejoins YAML anchors and aliases into the graph they describe.\n *\n * These schemas share repeated declarations by anchor - a container with two\n * coordinates writes the vector's component aliases once - and the YAML reader\n * reports that sharing as `$yamlId` and `$yamlRef` markers rather than\n * duplicating the node. Left alone, `$yamlId` reads as one more component and\n * `$yamlRef` as a declaration with no fields at all.\n *\n * @param {*} value Parsed schema, or any part of one.\n * @returns {*} The same schema with anchors resolved and markers removed.\n */\nfunction Resolve(value) {\n const anchors = new Map();\n\n const walk = node => {\n if (Array.isArray(node)) return node.map(walk);\n\n if (!node || typeof node !== \"object\") return node;\n\n if (Object.hasOwn(node, \"$yamlRef\")) {\n const target = anchors.get(node.$yamlRef);\n\n if (!target) {\n throw SchemaBoundError(`The schema refers to an anchor it never declares: ${node.$yamlRef}.`);\n }\n\n return target;\n }\n\n const result = {};\n const id = node.$yamlId;\n\n if (id !== undefined) anchors.set(id, result);\n\n for (const [ key, member ] of Object.entries(node)) {\n if (key !== \"$yamlId\") result[key] = walk(member);\n }\n\n return result;\n };\n\n return walk(value);\n}\n\n/** Builds the probe shape the resource manager routes on. */\nfunction Probe(usable, options) {\n return {\n format: \"schemabound\",\n source: \"buffer\",\n supported: usable ? \"full\" : \"none\",\n confidence: usable ? 1 : 0,\n preferred: \"schemabound\",\n // The schema is read to answer this, so it is measured rather than declared.\n // It says nothing about any payload: these containers carry no signature.\n verified: true,\n reason: usable\n ? \"The schema declares a root this reader can decode.\"\n : \"The schema is missing, unparsable, or declares an unreadable root.\",\n variants: [ { kind: \"container\", codec: \"schemabound\", supported: usable } ],\n metadata: { family: \"schemabound\", requiresSchema: true, decodable: usable },\n ...(options || {})\n };\n}\n\n/** Converts decoded values to something `JSON.stringify` keeps losslessly. */\nfunction ToJSON(value) {\n if (typeof value === \"bigint\") return value.toString(10);\n\n if (Array.isArray(value)) return value.map(ToJSON);\n\n if (value && typeof value === \"object\") {\n const result = {};\n\n for (const [ key, member ] of Object.entries(value)) result[key] = ToJSON(member);\n\n return result;\n }\n\n return value;\n}\n\n/** Accepts the byte forms every other format here accepts. */\nfunction Normalize(input) {\n if (input instanceof Uint8Array) return input;\n\n if (input instanceof ArrayBuffer) return new Uint8Array(input);\n\n if (ArrayBuffer.isView(input)) return new Uint8Array(input.buffer, input.byteOffset, input.byteLength);\n\n throw SchemaBoundError(\"A schema-bound container must be supplied as bytes.\");\n}\n\nexport default CjsSchemaBoundFormat;\n"],"names":["OUTPUT_JSON","OUTPUT_PAYLOAD","ROOT_TYPES","Set","CjsSchemaBoundFormat","is","schema","has","type","isSupported","options","Probe","read","input","bytes","Normalize","SchemaBoundError","context","view","DataView","buffer","byteOffset","byteLength","decoded","ReadValue","value","output","ToJSON","readJSON","readPayload","ArrayBuffer","isView","parsed","CjsYamlFormat","Resolve","Output","Object","freeze","JSON","PAYLOAD","id","extensions","mediaTypes","inputTypes","outputTypes","anchors","Map","walk","node","Array","isArray","map","hasOwn","target","get","$yamlRef","result","$yamlId","undefined","set","key","member","entries","usable","format","source","supported","confidence","preferred","verified","reason","variants","kind","codec","metadata","family","requiresSchema","decodable","toString","Uint8Array"],"mappings":";;;;AAIA,MAAMA,WAAW,GAAG,MAAM;AAC1B,MAAMC,cAAc,GAAG,SAAS;AAChC,MAAMC,UAAU,GAAG,IAAIC,GAAG,CAAC,CAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAE,CAAC;;AAExD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,oBAAoB,CAAC;AAEhC;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACE,OAAOC,EAAEA,CAACC,MAAM,EAAE;IAChB,IAAI;AACF,MAAA,OAAOJ,UAAU,CAACK,GAAG,CAAC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0B,GAAG,CAACxB,MAAM,CAAC;AAElD,EAAA,IAAIF,KAAK,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IACtC,MAAM+B,MAAM,GAAG,EAAE;IAEjB,KAAK,MAAM,CAAEI,GAAG,EAAEC,MAAM,CAAE,IAAIzB,MAAM,CAAC0B,OAAO,CAACrC,KAAK,CAAC,EAAE+B,MAAM,CAACI,GAAG,CAAC,GAAGjC,MAAM,CAACkC,MAAM,CAAC;AAEjF,IAAA,OAAOL,MAAM;AACf,EAAA;AAEA,EAAA,OAAO/B,KAAK;AACd;;AAEA;AACA,SAASV,SAASA,CAACF,KAAK,EAAE;AACxB,EAAA,IAAIA,KAAK,YAAYkE,UAAU,EAAE,OAAOlE,KAAK;EAE7C,IAAIA,KAAK,YAAYiB,WAAW,EAAE,OAAO,IAAIiD,UAAU,CAAClE,KAAK,CAAC;EAE9D,IAAIiB,WAAW,CAACC,MAAM,CAAClB,KAAK,CAAC,EAAE,OAAO,IAAIkE,UAAU,CAAClE,KAAK,CAACO,MAAM,EAAEP,KAAK,CAACQ,UAAU,EAAER,KAAK,CAACS,UAAU,CAAC;EAEtG,MAAMN,gBAAgB,CAAC,qDAAqD,CAAC;AAC/E;;;;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Builds the error every part of this format throws, with one code. */
|
|
2
|
+
function SchemaBoundError(message, extra = null) {
|
|
3
|
+
const error = new TypeError(message);
|
|
4
|
+
error.code = "CJS_SCHEMA_BOUND_INVALID";
|
|
5
|
+
return Object.assign(error, extra || {});
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export { SchemaBoundError };
|
|
9
|
+
//# sourceMappingURL=schemaBoundErrors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemaBoundErrors.js","sources":["../../../../../src/formats/schemabound/core/schemaBoundErrors.js"],"sourcesContent":["/** Builds the error every part of this format throws, with one code. */\nexport function SchemaBoundError(message, extra = null) {\n const error = new TypeError(message);\n\n error.code = \"CJS_SCHEMA_BOUND_INVALID\";\n\n return Object.assign(error, extra || {});\n}\n\nexport default SchemaBoundError;\n"],"names":["SchemaBoundError","message","extra","error","TypeError","code","Object","assign"],"mappings":"AAAA;AACO,SAASA,gBAAgBA,CAACC,OAAO,EAAEC,KAAK,GAAG,IAAI,EAAE;AACtD,EAAA,MAAMC,KAAK,GAAG,IAAIC,SAAS,CAACH,OAAO,CAAC;EAEpCE,KAAK,CAACE,IAAI,GAAG,0BAA0B;EAEvC,OAAOC,MAAM,CAACC,MAAM,CAACJ,KAAK,EAAED,KAAK,IAAI,EAAE,CAAC;AAC1C;;;;"}
|