@carbonenginejs/runtime-resource 0.16.0 → 0.18.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.
Files changed (54) hide show
  1. package/dist/format/CjsFormat.js +84 -83
  2. package/dist/format/CjsFormat.js.map +1 -1
  3. package/dist/format/CjsResourceProbe.js +87 -86
  4. package/dist/format/CjsResourceProbe.js.map +1 -1
  5. package/dist/format/carbonEffect/backendEngineId.js +98 -0
  6. package/dist/format/carbonEffect/backendEngineId.js.map +1 -0
  7. package/dist/format/carbonEffect/carbonEffectBackendBlock.js +24 -23
  8. package/dist/format/carbonEffect/carbonEffectBackendBlock.js.map +1 -1
  9. package/dist/format/carbonEffect/carbonEffectResourceTransform.js +1 -1
  10. package/dist/format/carbonEffect/carbonEffectResourceTransform.js.map +1 -1
  11. package/dist/format/effect/effectPermutationGraph.js +46 -29
  12. package/dist/format/effect/effectPermutationGraph.js.map +1 -1
  13. package/dist/format/index.js +1 -1
  14. package/dist/formats/hlsl/core/detailMapFamily.js +1 -1
  15. package/dist/formats/hlsl/core/detailMapFamily.js.map +1 -1
  16. package/dist/formats/hlsl/core/localLightFamily.js +1 -1
  17. package/dist/formats/hlsl/core/localLightFamily.js.map +1 -1
  18. package/dist/formats/png/core/helpers.js +27 -8
  19. package/dist/formats/png/core/helpers.js.map +1 -1
  20. package/dist/formats/webgl/core/effectPackage.js +143 -56
  21. package/dist/formats/webgl/core/effectPackage.js.map +1 -1
  22. package/dist/formats/webgl/core/glsl/DxbcGlslEmitter.js +799 -456
  23. package/dist/formats/webgl/core/glsl/DxbcGlslEmitter.js.map +1 -1
  24. package/dist/formats/webgl/core/glslBackendBlock.js +74 -30
  25. package/dist/formats/webgl/core/glslBackendBlock.js.map +1 -1
  26. package/dist/formats/webgl/core/glslBackendBodySet.js +0 -1
  27. package/dist/formats/webgl/core/glslBackendBodySet.js.map +1 -1
  28. package/dist/formats/webgl/core/helpers.js +53 -53
  29. package/dist/formats/webgl/core/helpers.js.map +1 -1
  30. package/dist/formats/webgl/core/readGlslEffectContainer.js +82 -67
  31. package/dist/formats/webgl/core/readGlslEffectContainer.js.map +1 -1
  32. package/dist/formats/webgpu/CjsWebgpuFormat.js +161 -163
  33. package/dist/formats/webgpu/CjsWebgpuFormat.js.map +1 -1
  34. package/dist/formats/webgpu/core/carbonWebgpu/CarbonWebgpuContainer.js +10 -1
  35. package/dist/formats/webgpu/core/carbonWebgpu/CarbonWebgpuContainer.js.map +1 -1
  36. package/dist/formats/webgpu/core/effectBackendBodySet.js +21 -22
  37. package/dist/formats/webgpu/core/effectBackendBodySet.js.map +1 -1
  38. package/dist/formats/webgpu/core/helpers.js +111 -99
  39. package/dist/formats/webgpu/core/helpers.js.map +1 -1
  40. package/dist/formats/webgpu/core/packageEffect.js +30 -32
  41. package/dist/formats/webgpu/core/packageEffect.js.map +1 -1
  42. package/dist/formats/wem/CjsWemFormat.js +121 -121
  43. package/dist/formats/wem/CjsWemFormat.js.map +1 -1
  44. package/dist/formats/wem/core/resolve.js +8 -8
  45. package/dist/formats/wem/core/resolve.js.map +1 -1
  46. package/dist/resource/shader/reflection/Tr2EffectStageInput.js +102 -60
  47. package/dist/resource/shader/reflection/Tr2EffectStageInput.js.map +1 -1
  48. package/docs/concepts/format-type-resolution.md +79 -0
  49. package/docs/formats/README.md +11 -0
  50. package/docs/formats/webgpu/formats/carbon-webgpu.md +11 -4
  51. package/docs/formats/webgpu/reference/api.md +7 -6
  52. package/docs/formats/wwise.md +25 -0
  53. package/docs/roadmap.md +19 -0
  54. package/package.json +2 -2
@@ -1,46 +1,46 @@
1
1
  import { MediaType, PayloadType } from '@carbonenginejs/runtime-utils/media';
2
2
  import { CjsResourceProbe as _CjsResourceProbe } from './CjsResourceProbe.js';
3
3
 
4
- /**
5
- * Base class for format readers that defines the static
6
- * `read`/`readAsync`/`isSupported`/`resolveType` contract and instance
7
- * option handling that concrete format packages implement.
4
+ /**
5
+ * Base class for format readers that defines the static
6
+ * `read`/`readAsync`/`isSupported`/`resolveType` contract and instance
7
+ * option handling that concrete format packages implement.
8
8
  */
9
9
  class CjsFormat {
10
10
  options = {};
11
11
 
12
- /**
13
- * Convenience factory for simple format helpers.
14
- * Keep this lightweight so format classes can stay pure-reader implementations.
15
- *
16
- * @param {*} input
17
- * @param {object} options
18
- * @returns {Promise<*>|*}
12
+ /**
13
+ * Convenience factory for simple format helpers.
14
+ * Keep this lightweight so format classes can stay pure-reader implementations.
15
+ *
16
+ * @param {*} input
17
+ * @param {object} options
18
+ * @returns {Promise<*>|*}
19
19
  */
20
20
  static read(input, options = null) {
21
21
  const reader = new this(options || {});
22
22
  return reader.Read(input, options || {});
23
23
  }
24
24
 
25
- /**
26
- * Async convenience factory for format readers.
27
- *
28
- * @param {*} input
29
- * @param {object} options
30
- * @returns {Promise<*>}
25
+ /**
26
+ * Async convenience factory for format readers.
27
+ *
28
+ * @param {*} input
29
+ * @param {object} options
30
+ * @returns {Promise<*>}
31
31
  */
32
32
  static async readAsync(input, options = null) {
33
33
  const reader = new this(options || {});
34
34
  return reader.ReadAsync(input, options || {});
35
35
  }
36
36
 
37
- /**
38
- * Canonical support probe entrypoint.
39
- * Returns a probe report including compressed/raw capability variants when implemented.
40
- *
41
- * @param {*} input
42
- * @param {object} options
43
- * @returns {CjsResourceProbe}
37
+ /**
38
+ * Canonical support probe entrypoint.
39
+ * Returns a probe report including compressed/raw capability variants when implemented.
40
+ *
41
+ * @param {*} input
42
+ * @param {object} options
43
+ * @returns {CjsResourceProbe}
44
44
  */
45
45
  static isSupported(input, options = null) {
46
46
  const source = typeof input === "string" ? "path" : "buffer";
@@ -51,34 +51,35 @@ class CjsFormat {
51
51
  });
52
52
  }
53
53
 
54
- /**
55
- * Alias for canonical naming.
56
- *
57
- * @param {*} input
58
- * @param {object} options
59
- * @returns {CjsResourceProbe}
54
+ /**
55
+ * Alias for canonical naming.
56
+ *
57
+ * @param {*} input
58
+ * @param {object} options
59
+ * @returns {CjsResourceProbe}
60
60
  */
61
61
  static inspect(input, options = null) {
62
62
  return this.isSupported(input, options);
63
63
  }
64
64
 
65
- /**
66
- * Content-verified type/route resolution (kb §5, optional per format).
67
- *
68
- * Where inspect()/isSupported() report what the container CLAIMS,
69
- * resolveType() performs one bounded asynchronous content check (magic, a
70
- * first frame/block, a setup header) and reports what the reader has
71
- * evidence it can actually decode. Overrides return a CjsResourceProbe
72
- * with `verified: true` and declared/resolved/mismatch evidence in
73
- * `metadata`; `preferred` names the resolved decode route. A caller-forced
74
- * emit always wins over a resolution, and this base implementation - the
75
- * zero-extra-work path for formats without an override - delegates to
76
- * isSupported() with `verified` false so an unverified result never
77
- * changes a route.
78
- *
79
- * @param {*} input Bytes (or path where the format supports it).
80
- * @param {object|null} options Format options.
81
- * @returns {Promise<CjsResourceProbe>} Probe report; content-verified only when overridden.
65
+ /**
66
+ * Content-verified type/route resolution (optional per format).
67
+ * Contract: docs/concepts/format-type-resolution.md.
68
+ *
69
+ * Where inspect()/isSupported() report what the container CLAIMS,
70
+ * resolveType() performs one bounded asynchronous content check (magic, a
71
+ * first frame/block, a setup header) and reports what the reader has
72
+ * evidence it can actually decode. Overrides return a CjsResourceProbe
73
+ * with `verified: true` and declared/resolved/mismatch evidence in
74
+ * `metadata`; `preferred` names the resolved decode route. A caller-forced
75
+ * emit always wins over a resolution, and this base implementation - the
76
+ * zero-extra-work path for formats without an override - delegates to
77
+ * isSupported() with `verified` false so an unverified result never
78
+ * changes a route.
79
+ *
80
+ * @param {*} input Bytes (or path where the format supports it).
81
+ * @param {object|null} options Format options.
82
+ * @returns {Promise<CjsResourceProbe>} Probe report; content-verified only when overridden.
82
83
  */
83
84
  static async resolveType(input, options = null) {
84
85
  const report = _CjsResourceProbe.from(this.isSupported(input, options));
@@ -111,9 +112,9 @@ class CjsFormat {
111
112
  return this;
112
113
  }
113
114
 
114
- /**
115
- * Returns a copy of the current format options for the resource format
116
- * configuration.
115
+ /**
116
+ * Returns a copy of the current format options for the resource format
117
+ * configuration.
117
118
  */
118
119
  GetValues() {
119
120
  return {
@@ -123,49 +124,49 @@ class CjsFormat {
123
124
  };
124
125
  }
125
126
 
126
- /**
127
- * Initializes the format with the supplied values and context for the resource
128
- * format configuration.
127
+ /**
128
+ * Initializes the format with the supplied values and context for the resource
129
+ * format configuration.
129
130
  */
130
131
  Initialize(values = null) {
131
132
  return this.SetValues(values || {});
132
133
  }
133
134
 
134
- /**
135
- * Primary instance read entrypoint for synchronous readers.
136
- * Implementations may override with async handling in readAsync only if needed.
135
+ /**
136
+ * Primary instance read entrypoint for synchronous readers.
137
+ * Implementations may override with async handling in readAsync only if needed.
137
138
  */
138
139
  Read(input, options = null) {
139
140
  throw new Error(`${this.constructor.name}.Read must be implemented by a format package.`);
140
141
  }
141
142
 
142
- /**
143
- * Primary async read entrypoint for asynchronous readers.
144
- * Defaults to sync Read for compatibility.
143
+ /**
144
+ * Primary async read entrypoint for asynchronous readers.
145
+ * Defaults to sync Read for compatibility.
145
146
  */
146
147
  async ReadAsync(input, options = null) {
147
148
  return this.Read(input, options);
148
149
  }
149
150
 
150
- /**
151
- * Canonical package-family group names - the shared vocabulary object from
152
- * runtime-utils (kb: runtime-utils owns cross-package media vocabulary).
153
- * Same object identity as `@carbonenginejs/runtime-utils/media` MediaType,
154
- * so tokens can never drift between packages.
151
+ /**
152
+ * Canonical package-family group names - the shared vocabulary object from
153
+ * runtime-utils (kb: runtime-utils owns cross-package media vocabulary).
154
+ * Same object identity as `@carbonenginejs/runtime-utils/media` MediaType,
155
+ * so tokens can never drift between packages.
155
156
  */
156
157
  static Type = MediaType;
157
158
 
158
- /**
159
- * Canonical media-type groups used by format registration - the shared
160
- * runtime-utils MediaType object (see Type above).
159
+ /**
160
+ * Canonical media-type groups used by format registration - the shared
161
+ * runtime-utils MediaType object (see Type above).
161
162
  */
162
163
  static MediaType = MediaType;
163
164
 
164
- /**
165
- * Canonical output-type tokens used by format emit contracts. Shared
166
- * payload ROLES come from runtime-utils PayloadType; the remaining tokens
167
- * (cmf/gr2/json/pcm/rgba/shared/objJson) are format-emit names owned by
168
- * their formats and enumerated here for discoverability only.
165
+ /**
166
+ * Canonical output-type tokens used by format emit contracts. Shared
167
+ * payload ROLES come from runtime-utils PayloadType; the remaining tokens
168
+ * (cmf/gr2/json/pcm/rgba/shared/objJson) are format-emit names owned by
169
+ * their formats and enumerated here for discoverability only.
169
170
  */
170
171
  static OutputType = Object.freeze({
171
172
  AUDIO: PayloadType.AUDIO,
@@ -189,20 +190,20 @@ class CjsFormat {
189
190
  static outputTypes = Object.freeze([]);
190
191
  static debugOutputTypes = Object.freeze(["json", "raw"]);
191
192
 
192
- /**
193
- * Optional browser-worker module declaration.
194
- *
195
- * Concrete formats opt in with their exact `import.meta.url`, export name,
196
- * and optional clone-safe output restrictions.
193
+ /**
194
+ * Optional browser-worker module declaration.
195
+ *
196
+ * Concrete formats opt in with their exact `import.meta.url`, export name,
197
+ * and optional clone-safe output restrictions.
197
198
  */
198
199
  static worker = null;
199
200
 
200
- /**
201
- * Asserts that a format class declares the metadata required for
202
- * registration and routing.
203
- *
204
- * @param {typeof CjsFormat} Constructor
205
- * @returns {void}
201
+ /**
202
+ * Asserts that a format class declares the metadata required for
203
+ * registration and routing.
204
+ *
205
+ * @param {typeof CjsFormat} Constructor
206
+ * @returns {void}
206
207
  */
207
208
  static validateContract(Constructor) {
208
209
  if (!Constructor) {
@@ -1 +1 @@
1
- {"version":3,"file":"CjsFormat.js","sources":["../../../src/format/CjsFormat.js"],"sourcesContent":["import { MediaType, PayloadType } from \"@carbonenginejs/runtime-utils/media\";\nimport { CjsResourceProbe } from \"./CjsResourceProbe.js\";\n\n/**\n * Base class for format readers that defines the static\n * `read`/`readAsync`/`isSupported`/`resolveType` contract and instance\n * option handling that concrete format packages implement.\n */\nexport class CjsFormat\n{\n options = {};\n\n /**\n * Convenience factory for simple format helpers.\n * Keep this lightweight so format classes can stay pure-reader implementations.\n *\n * @param {*} input\n * @param {object} options\n * @returns {Promise<*>|*}\n */\n static read(input, options = null) {\n const reader = new this(options || {});\n return reader.Read(input, options || {});\n }\n\n /**\n * Async convenience factory for format readers.\n *\n * @param {*} input\n * @param {object} options\n * @returns {Promise<*>}\n */\n static async readAsync(input, options = null) {\n const reader = new this(options || {});\n return reader.ReadAsync(input, options || {});\n }\n\n /**\n * Canonical support probe entrypoint.\n * Returns a probe report including compressed/raw capability variants when implemented.\n *\n * @param {*} input\n * @param {object} options\n * @returns {CjsResourceProbe}\n */\n static isSupported(input, options = null) {\n const source = typeof input === \"string\" ? \"path\" : \"buffer\";\n const formatName = this.name\n ? this.name.replace(/^Cjs/u, \"\").replace(/Format$/u, \"\").toLowerCase()\n : \"format\";\n return CjsResourceProbe.createUnsupported(formatName, \"No probe implementation.\", { source, ...options });\n }\n\n /**\n * Alias for canonical naming.\n *\n * @param {*} input\n * @param {object} options\n * @returns {CjsResourceProbe}\n */\n static inspect(input, options = null) {\n return this.isSupported(input, options);\n }\n\n /**\n * Content-verified type/route resolution (kb §5, optional per format).\n *\n * Where inspect()/isSupported() report what the container CLAIMS,\n * resolveType() performs one bounded asynchronous content check (magic, a\n * first frame/block, a setup header) and reports what the reader has\n * evidence it can actually decode. Overrides return a CjsResourceProbe\n * with `verified: true` and declared/resolved/mismatch evidence in\n * `metadata`; `preferred` names the resolved decode route. A caller-forced\n * emit always wins over a resolution, and this base implementation - the\n * zero-extra-work path for formats without an override - delegates to\n * isSupported() with `verified` false so an unverified result never\n * changes a route.\n *\n * @param {*} input Bytes (or path where the format supports it).\n * @param {object|null} options Format options.\n * @returns {Promise<CjsResourceProbe>} Probe report; content-verified only when overridden.\n */\n static async resolveType(input, options = null) {\n const report = CjsResourceProbe.from(this.isSupported(input, options));\n report.verified = false;\n return report;\n }\n\n /** Creates a CjsFormat with caller-provided reader configuration. */\n constructor(options = null) {\n this.options = { ...(options || {}) };\n }\n\n /** Applies supported format options for the resource format configuration. */\n SetValues(values = null) {\n if (!values || typeof values !== \"object\") {\n return this;\n }\n if (Object.prototype.hasOwnProperty.call(values, \"options\")) {\n this.options = { ...(values.options || {}) };\n } else {\n this.options = { ...this.options, ...values };\n }\n return this;\n }\n\n /**\n * Returns a copy of the current format options for the resource format\n * configuration.\n */\n GetValues() {\n return { options: { ...this.options } };\n }\n\n /**\n * Initializes the format with the supplied values and context for the resource\n * format configuration.\n */\n Initialize(values = null) {\n return this.SetValues(values || {});\n }\n\n /**\n * Primary instance read entrypoint for synchronous readers.\n * Implementations may override with async handling in readAsync only if needed.\n */\n Read(input, options = null) {\n throw new Error(`${this.constructor.name}.Read must be implemented by a format package.`);\n }\n\n /**\n * Primary async read entrypoint for asynchronous readers.\n * Defaults to sync Read for compatibility.\n */\n async ReadAsync(input, options = null) {\n return this.Read(input, options);\n }\n\n /**\n * Canonical package-family group names - the shared vocabulary object from\n * runtime-utils (kb: runtime-utils owns cross-package media vocabulary).\n * Same object identity as `@carbonenginejs/runtime-utils/media` MediaType,\n * so tokens can never drift between packages.\n */\n static Type = MediaType;\n\n /**\n * Canonical media-type groups used by format registration - the shared\n * runtime-utils MediaType object (see Type above).\n */\n static MediaType = MediaType;\n\n /**\n * Canonical output-type tokens used by format emit contracts. Shared\n * payload ROLES come from runtime-utils PayloadType; the remaining tokens\n * (cmf/gr2/json/pcm/rgba/shared/objJson) are format-emit names owned by\n * their formats and enumerated here for discoverability only.\n */\n static OutputType = Object.freeze({\n AUDIO: PayloadType.AUDIO,\n CMF: \"cmf\",\n GR2: \"gr2\",\n IMAGE: PayloadType.IMAGE,\n JSON: \"json\",\n PCM: \"pcm\",\n RAW: PayloadType.RAW,\n RGBA: \"rgba\",\n SCHEMA: PayloadType.SCHEMA,\n SHADER: PayloadType.SHADER,\n SHARED: \"shared\",\n TEXTURE: PayloadType.TEXTURE,\n VIDEO: PayloadType.VIDEO,\n OBJ_JSON: \"objJson\"\n });\n\n static type = Object.freeze([]);\n static mediaTypes = Object.freeze([]);\n static inputTypes = Object.freeze([]);\n static outputTypes = Object.freeze([]);\n static debugOutputTypes = Object.freeze([\"json\", \"raw\"]);\n\n /**\n * Optional browser-worker module declaration.\n *\n * Concrete formats opt in with their exact `import.meta.url`, export name,\n * and optional clone-safe output restrictions.\n */\n static worker = null;\n\n /**\n * Asserts that a format class declares the metadata required for\n * registration and routing.\n *\n * @param {typeof CjsFormat} Constructor\n * @returns {void}\n */\n static validateContract(Constructor)\n {\n if (!Constructor) {\n throw new TypeError(\"CjsFormat.validateContract requires a format class.\");\n }\n const hasOutput = Array.isArray(Constructor.outputTypes) && Constructor.outputTypes.length > 0;\n const hasInput = Array.isArray(Constructor.inputTypes) && Constructor.inputTypes.length > 0;\n const hasMedia = Array.isArray(Constructor.mediaTypes) && Constructor.mediaTypes.length > 0;\n const hasType = Array.isArray(Constructor.type) && Constructor.type.length > 0;\n const hasDebug = Array.isArray(Constructor.debugOutputTypes) && Constructor.debugOutputTypes.length > 0;\n if (!hasType || !hasMedia || !hasInput || !hasOutput || !hasDebug) {\n throw new TypeError(`Format contract missing metadata: type:${hasType} mediaTypes:${hasMedia} inputTypes:${hasInput} outputTypes:${hasOutput} debugOutputTypes:${hasDebug}`);\n }\n }\n}\n"],"names":["CjsFormat","options","read","input","reader","Read","readAsync","ReadAsync","isSupported","source","formatName","name","replace","toLowerCase","CjsResourceProbe","createUnsupported","inspect","resolveType","report","from","verified","constructor","SetValues","values","Object","prototype","hasOwnProperty","call","GetValues","Initialize","Error","Type","MediaType","OutputType","freeze","AUDIO","PayloadType","CMF","GR2","IMAGE","JSON","PCM","RAW","RGBA","SCHEMA","SHADER","SHARED","TEXTURE","VIDEO","OBJ_JSON","type","mediaTypes","inputTypes","outputTypes","debugOutputTypes","worker","validateContract","Constructor","TypeError","hasOutput","Array","isArray","length","hasInput","hasMedia","hasType","hasDebug"],"mappings":";;;AAGA;AACA;AACA;AACA;AACA;AACO,MAAMA,SAAS,CACtB;EACEC,OAAO,GAAG,EAAE;;AAEZ;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACE,EAAA,OAAOC,IAAIA,CAACC,KA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AAS,CAAC,CAAA,uCAAA,EAA0CO,OAAO,CAAA,YAAA,EAAeD,QAAQ,CAAA,YAAA,EAAeD,QAAQ,CAAA,aAAA,EAAgBJ,SAAS,CAAA,kBAAA,EAAqBO,QAAQ,EAAE,CAAC;AAC9K,IAAA;AACF,EAAA;AACF;;;;"}
1
+ {"version":3,"file":"CjsFormat.js","sources":["../../../src/format/CjsFormat.js"],"sourcesContent":["import { MediaType, PayloadType } from \"@carbonenginejs/runtime-utils/media\";\r\nimport { CjsResourceProbe } from \"./CjsResourceProbe.js\";\r\n\r\n/**\r\n * Base class for format readers that defines the static\r\n * `read`/`readAsync`/`isSupported`/`resolveType` contract and instance\r\n * option handling that concrete format packages implement.\r\n */\r\nexport class CjsFormat\r\n{\r\n options = {};\r\n\r\n /**\r\n * Convenience factory for simple format helpers.\r\n * Keep this lightweight so format classes can stay pure-reader implementations.\r\n *\r\n * @param {*} input\r\n * @param {object} options\r\n * @returns {Promise<*>|*}\r\n */\r\n static read(input, options = null) {\r\n const reader = new this(options || {});\r\n return reader.Read(input, options || {});\r\n }\r\n\r\n /**\r\n * Async convenience factory for format readers.\r\n *\r\n * @param {*} input\r\n * @param {object} options\r\n * @returns {Promise<*>}\r\n */\r\n static async readAsync(input, options = null) {\r\n const reader = new this(options || {});\r\n return reader.ReadAsync(input, options || {});\r\n }\r\n\r\n /**\r\n * Canonical support probe entrypoint.\r\n * Returns a probe report including compressed/raw capability variants when implemented.\r\n *\r\n * @param {*} input\r\n * @param {object} options\r\n * @returns {CjsResourceProbe}\r\n */\r\n static isSupported(input, options = null) {\r\n const source = typeof input === \"string\" ? \"path\" : \"buffer\";\r\n const formatName = this.name\r\n ? this.name.replace(/^Cjs/u, \"\").replace(/Format$/u, \"\").toLowerCase()\r\n : \"format\";\r\n return CjsResourceProbe.createUnsupported(formatName, \"No probe implementation.\", { source, ...options });\r\n }\r\n\r\n /**\r\n * Alias for canonical naming.\r\n *\r\n * @param {*} input\r\n * @param {object} options\r\n * @returns {CjsResourceProbe}\r\n */\r\n static inspect(input, options = null) {\r\n return this.isSupported(input, options);\r\n }\r\n\r\n /**\r\n * Content-verified type/route resolution (optional per format).\r\n * Contract: docs/concepts/format-type-resolution.md.\r\n *\r\n * Where inspect()/isSupported() report what the container CLAIMS,\r\n * resolveType() performs one bounded asynchronous content check (magic, a\r\n * first frame/block, a setup header) and reports what the reader has\r\n * evidence it can actually decode. Overrides return a CjsResourceProbe\r\n * with `verified: true` and declared/resolved/mismatch evidence in\r\n * `metadata`; `preferred` names the resolved decode route. A caller-forced\r\n * emit always wins over a resolution, and this base implementation - the\r\n * zero-extra-work path for formats without an override - delegates to\r\n * isSupported() with `verified` false so an unverified result never\r\n * changes a route.\r\n *\r\n * @param {*} input Bytes (or path where the format supports it).\r\n * @param {object|null} options Format options.\r\n * @returns {Promise<CjsResourceProbe>} Probe report; content-verified only when overridden.\r\n */\r\n static async resolveType(input, options = null) {\r\n const report = CjsResourceProbe.from(this.isSupported(input, options));\r\n report.verified = false;\r\n return report;\r\n }\r\n\r\n /** Creates a CjsFormat with caller-provided reader configuration. */\r\n constructor(options = null) {\r\n this.options = { ...(options || {}) };\r\n }\r\n\r\n /** Applies supported format options for the resource format configuration. */\r\n SetValues(values = null) {\r\n if (!values || typeof values !== \"object\") {\r\n return this;\r\n }\r\n if (Object.prototype.hasOwnProperty.call(values, \"options\")) {\r\n this.options = { ...(values.options || {}) };\r\n } else {\r\n this.options = { ...this.options, ...values };\r\n }\r\n return this;\r\n }\r\n\r\n /**\r\n * Returns a copy of the current format options for the resource format\r\n * configuration.\r\n */\r\n GetValues() {\r\n return { options: { ...this.options } };\r\n }\r\n\r\n /**\r\n * Initializes the format with the supplied values and context for the resource\r\n * format configuration.\r\n */\r\n Initialize(values = null) {\r\n return this.SetValues(values || {});\r\n }\r\n\r\n /**\r\n * Primary instance read entrypoint for synchronous readers.\r\n * Implementations may override with async handling in readAsync only if needed.\r\n */\r\n Read(input, options = null) {\r\n throw new Error(`${this.constructor.name}.Read must be implemented by a format package.`);\r\n }\r\n\r\n /**\r\n * Primary async read entrypoint for asynchronous readers.\r\n * Defaults to sync Read for compatibility.\r\n */\r\n async ReadAsync(input, options = null) {\r\n return this.Read(input, options);\r\n }\r\n\r\n /**\r\n * Canonical package-family group names - the shared vocabulary object from\r\n * runtime-utils (kb: runtime-utils owns cross-package media vocabulary).\r\n * Same object identity as `@carbonenginejs/runtime-utils/media` MediaType,\r\n * so tokens can never drift between packages.\r\n */\r\n static Type = MediaType;\r\n\r\n /**\r\n * Canonical media-type groups used by format registration - the shared\r\n * runtime-utils MediaType object (see Type above).\r\n */\r\n static MediaType = MediaType;\r\n\r\n /**\r\n * Canonical output-type tokens used by format emit contracts. Shared\r\n * payload ROLES come from runtime-utils PayloadType; the remaining tokens\r\n * (cmf/gr2/json/pcm/rgba/shared/objJson) are format-emit names owned by\r\n * their formats and enumerated here for discoverability only.\r\n */\r\n static OutputType = Object.freeze({\r\n AUDIO: PayloadType.AUDIO,\r\n CMF: \"cmf\",\r\n GR2: \"gr2\",\r\n IMAGE: PayloadType.IMAGE,\r\n JSON: \"json\",\r\n PCM: \"pcm\",\r\n RAW: PayloadType.RAW,\r\n RGBA: \"rgba\",\r\n SCHEMA: PayloadType.SCHEMA,\r\n SHADER: PayloadType.SHADER,\r\n SHARED: \"shared\",\r\n TEXTURE: PayloadType.TEXTURE,\r\n VIDEO: PayloadType.VIDEO,\r\n OBJ_JSON: \"objJson\"\r\n });\r\n\r\n static type = Object.freeze([]);\r\n static mediaTypes = Object.freeze([]);\r\n static inputTypes = Object.freeze([]);\r\n static outputTypes = Object.freeze([]);\r\n static debugOutputTypes = Object.freeze([\"json\", \"raw\"]);\r\n\r\n /**\r\n * Optional browser-worker module declaration.\r\n *\r\n * Concrete formats opt in with their exact `import.meta.url`, export name,\r\n * and optional clone-safe output restrictions.\r\n */\r\n static worker = null;\r\n\r\n /**\r\n * Asserts that a format class declares the metadata required for\r\n * registration and routing.\r\n *\r\n * @param {typeof CjsFormat} Constructor\r\n * @returns {void}\r\n */\r\n static validateContract(Constructor)\r\n {\r\n if (!Constructor) {\r\n throw new TypeError(\"CjsFormat.validateContract requires a format class.\");\r\n }\r\n const hasOutput = Array.isArray(Constructor.outputTypes) && Constructor.outputTypes.length > 0;\r\n const hasInput = Array.isArray(Constructor.inputTypes) && Constructor.inputTypes.length > 0;\r\n const hasMedia = Array.isArray(Constructor.mediaTypes) && Constructor.mediaTypes.length > 0;\r\n const hasType = Array.isArray(Constructor.type) && Constructor.type.length > 0;\r\n const hasDebug = Array.isArray(Constructor.debugOutputTypes) && Constructor.debugOutputTypes.length > 0;\r\n if (!hasType || !hasMedia || !hasInput || !hasOutput || !hasDebug) {\r\n throw new TypeError(`Format contract missing metadata: type:${hasType} mediaTypes:${hasMedia} inputTypes:${hasInput} outputTypes:${hasOutput} debugOutputTypes:${hasDebug}`);\r\n }\r\n }\r\n}\r\n"],"names":["CjsFormat","options","read","input","reader","Read","readAsync","ReadAsync","isSupported","source","formatName","name","replace","toLowerCase","CjsResourceProbe","createUnsupported","inspect","resolveType","report","from","verified","constructor","SetValues","values","Object","prototype","hasOwnProperty","call","GetValues","Initialize","Error","Type","MediaType","OutputType","freeze","AUDIO","PayloadType","CMF","GR2","IMAGE","JSON","PCM","RAW","RGBA","SCHEMA","SHADER","SHARED","TEXTURE","VIDEO","OBJ_JSON","type","mediaTypes","inputTypes","outputTypes","debugOutputTypes","worker","validateContract","Constructor","TypeError","hasOutput","Array","isArray","length","hasInput","hasMedia","hasType","hasDebug"],"mappings":";;;AAGA;AACA;AACA;AACA;AACA;AACO,MAAMA,SAAS,CACtB;EACEC,OAAO,GAAG,EAAE;;AAEZ;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACE,EAAA,OAAOC,IAAIA,CAACC,KAAK,EAAEF,OAAO,GAAG,IAAI,EAAE;IACjC,MAAMG,MAAM,GAAG,IAAI,IAAI,CAACH,OAAO,IAAI,EAAE,CAAC;IACtC,OAAOG,MAAM,CAACC,IAAI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AAA,EAAqBO,QAAQ,EAAE,CAAC;AAC9K,IAAA;AACF,EAAA;AACF;;;;"}
@@ -4,16 +4,16 @@ import { io, type } from '@carbonenginejs/runtime-utils/schema';
4
4
 
5
5
  let _initClass, _init_format, _init_extra_format, _init_source, _init_extra_source, _init_supported, _init_extra_supported, _init_verified, _init_extra_verified, _init_confidence, _init_extra_confidence, _init_preferred, _init_extra_preferred, _init_reason, _init_extra_reason, _init_metadata, _init_extra_metadata, _init_variant, _init_extra_variant, _init_variants, _init_extra_variants, _init_warnings, _init_extra_warnings, _init_errors, _init_extra_errors;
6
6
 
7
- /**
8
- * Standard probe report for resource formats and a reusable base for format-specific probes.
9
- *
10
- * Instances can be built by:
11
- * - returning plain object JSON payloads from format packages, then converted with CjsResourceProbe.from(...)
12
- * - returning CjsResourceProbe instances directly
13
- *
14
- * A format can report multiple usable variants in one payload, such as a
15
- * native compressed texture and a decoded RGBA fallback, without deciding
16
- * which engine-gpu or media backend should use.
7
+ /**
8
+ * Standard probe report for resource formats and a reusable base for format-specific probes.
9
+ *
10
+ * Instances can be built by:
11
+ * - returning plain object JSON payloads from format packages, then converted with CjsResourceProbe.from(...)
12
+ * - returning CjsResourceProbe instances directly
13
+ *
14
+ * A format can report multiple usable variants in one payload, such as a
15
+ * native compressed texture and a decoded RGBA fallback, without deciding
16
+ * which engine-gpu or media backend should use.
17
17
  */
18
18
  let _CjsResourceProbe;
19
19
  class CjsResourceProbe extends CjsModel {
@@ -30,11 +30,12 @@ class CjsResourceProbe extends CjsModel {
30
30
  source = (_init_extra_format(this), _init_source(this, ""));
31
31
  supported = (_init_extra_source(this), _init_supported(this, "none"));
32
32
 
33
- /**
34
- * True when the report's variant flags are CONTENT-verified (a bounded
35
- * resolveType() check ran), false when they are declaration-derived
36
- * (inspect/isSupported). Declared/resolved/mismatch evidence rides in
37
- * `metadata` per the kb §5 content-verified type resolution contract.
33
+ /**
34
+ * True when the report's variant flags are CONTENT-verified (a bounded
35
+ * resolveType() check ran), false when they are declaration-derived
36
+ * (inspect/isSupported). Declared/resolved/mismatch evidence rides in
37
+ * `metadata` per the content-verified type resolution contract
38
+ // (docs/concepts/format-type-resolution.md).
38
39
  */
39
40
  verified = (_init_extra_supported(this), _init_verified(this, false));
40
41
  confidence = (_init_extra_verified(this), _init_confidence(this, 0));
@@ -56,11 +57,11 @@ class CjsResourceProbe extends CjsModel {
56
57
  });
57
58
  }
58
59
 
59
- /**
60
- * Initialize probe fields from a plain object payload.
61
- *
62
- * @param {object|null} values
63
- * @returns {CjsResourceProbe}
60
+ /**
61
+ * Initialize probe fields from a plain object payload.
62
+ *
63
+ * @param {object|null} values
64
+ * @returns {CjsResourceProbe}
64
65
  */
65
66
  Initialize(values = null) {
66
67
  this.SetValues(values || {}, {
@@ -69,15 +70,15 @@ class CjsResourceProbe extends CjsModel {
69
70
  return this;
70
71
  }
71
72
 
72
- /**
73
- * Lightweight probe entrypoint.
74
- * Format packages should override this or provide their own probe implementation.
75
- *
76
- * @param {*} src
77
- * Raw source path or source payload passed by caller.
78
- * @param {object|null} options
79
- * Optional metadata/control overrides.
80
- * @returns {CjsResourceProbe}
73
+ /**
74
+ * Lightweight probe entrypoint.
75
+ * Format packages should override this or provide their own probe implementation.
76
+ *
77
+ * @param {*} src
78
+ * Raw source path or source payload passed by caller.
79
+ * @param {object|null} options
80
+ * Optional metadata/control overrides.
81
+ * @returns {CjsResourceProbe}
81
82
  */
82
83
  static isSupported(src, options = null) {
83
84
  return new _CjsResourceProbe({
@@ -96,24 +97,24 @@ class CjsResourceProbe extends CjsModel {
96
97
  });
97
98
  }
98
99
 
99
- /**
100
- * Detailed probe with report-style metadata. Aliases isSupported() in this minimal base.
101
- *
102
- * @param {*} src
103
- * @param {object|null} options
104
- * @returns {CjsResourceProbe}
100
+ /**
101
+ * Detailed probe with report-style metadata. Aliases isSupported() in this minimal base.
102
+ *
103
+ * @param {*} src
104
+ * @param {object|null} options
105
+ * @returns {CjsResourceProbe}
105
106
  */
106
107
  static inspect(src, options = null) {
107
108
  return _CjsResourceProbe.isSupported(src, options);
108
109
  }
109
110
 
110
- /**
111
- * Build a probe report representing explicit failure.
112
- *
113
- * @param {string} format
114
- * @param {string} reason
115
- * @param {object|null} options
116
- * @returns {CjsResourceProbe}
111
+ /**
112
+ * Build a probe report representing explicit failure.
113
+ *
114
+ * @param {string} format
115
+ * @param {string} reason
116
+ * @param {object|null} options
117
+ * @returns {CjsResourceProbe}
117
118
  */
118
119
  static createUnsupported(format, reason, options = null) {
119
120
  return new _CjsResourceProbe({
@@ -130,13 +131,13 @@ class CjsResourceProbe extends CjsModel {
130
131
  });
131
132
  }
132
133
 
133
- /**
134
- * Build a probe report representing one or more variants.
135
- *
136
- * @param {string} format
137
- * @param {Array<Object>} variants
138
- * @param {object|null} options
139
- * @returns {CjsResourceProbe}
134
+ /**
135
+ * Build a probe report representing one or more variants.
136
+ *
137
+ * @param {string} format
138
+ * @param {Array<Object>} variants
139
+ * @param {object|null} options
140
+ * @returns {CjsResourceProbe}
140
141
  */
141
142
  static createSupported(format, variants, options = null) {
142
143
  const normalizedVariants = Array.isArray(variants) ? variants : [];
@@ -159,11 +160,11 @@ class CjsResourceProbe extends CjsModel {
159
160
  });
160
161
  }
161
162
 
162
- /**
163
- * Normalize incoming report payloads into a standard CjsResourceProbe instance.
164
- *
165
- * @param {CjsResourceProbe|object|null} input
166
- * @returns {CjsResourceProbe}
163
+ /**
164
+ * Normalize incoming report payloads into a standard CjsResourceProbe instance.
165
+ *
166
+ * @param {CjsResourceProbe|object|null} input
167
+ * @returns {CjsResourceProbe}
167
168
  */
168
169
  static from(input) {
169
170
  if (input instanceof _CjsResourceProbe) return input;
@@ -175,11 +176,11 @@ class CjsResourceProbe extends CjsModel {
175
176
  return _CjsResourceProbe.createUnsupported("", "Invalid probe payload.");
176
177
  }
177
178
 
178
- /**
179
- * Normalize a plain probe report while preserving format-specific metadata.
180
- *
181
- * @param {object} input
182
- * @returns {object}
179
+ /**
180
+ * Normalize a plain probe report while preserving format-specific metadata.
181
+ *
182
+ * @param {object} input
183
+ * @returns {object}
183
184
  */
184
185
  static normalizeReport(input) {
185
186
  const variants = Array.isArray(input.variants) ? input.variants.map(entry => _CjsResourceProbe.normalizeVariant(entry)) : [];
@@ -190,11 +191,11 @@ class CjsResourceProbe extends CjsModel {
190
191
  };
191
192
  }
192
193
 
193
- /**
194
- * Normalize variant objects so runtimes can evaluate capability uniformly.
195
- *
196
- * @param {object|any} input
197
- * @returns {{kind: string, payloadType: string, codec: string, format: string, supported: boolean, reason: string, meta: *}}
194
+ /**
195
+ * Normalize variant objects so runtimes can evaluate capability uniformly.
196
+ *
197
+ * @param {object|any} input
198
+ * @returns {{kind: string, payloadType: string, codec: string, format: string, supported: boolean, reason: string, meta: *}}
198
199
  */
199
200
  static normalizeVariant(input) {
200
201
  if (!input || typeof input !== "object") {
@@ -221,11 +222,11 @@ class CjsResourceProbe extends CjsModel {
221
222
  };
222
223
  }
223
224
 
224
- /**
225
- * Select best preferred variant from normalized variant list.
226
- *
227
- * @param {Array<Object>} variants
228
- * @returns {string}
225
+ /**
226
+ * Select best preferred variant from normalized variant list.
227
+ *
228
+ * @param {Array<Object>} variants
229
+ * @returns {string}
229
230
  */
230
231
  static selectPreferred(variants) {
231
232
  if (!Array.isArray(variants) || variants.length < 1) return "";
@@ -234,38 +235,38 @@ class CjsResourceProbe extends CjsModel {
234
235
  return preferred ? preferred.codec || preferred.payloadType || preferred.kind || "" : "";
235
236
  }
236
237
 
237
- /**
238
- * Returns true if any supported variant is available.
239
- *
240
- * @returns {boolean}
238
+ /**
239
+ * Returns true if any supported variant is available.
240
+ *
241
+ * @returns {boolean}
241
242
  */
242
243
  isSupported() {
243
244
  return this.supported === "full" || this.supported === "partial";
244
245
  }
245
246
 
246
- /**
247
- * Returns true if raw fallback variant is supported.
248
- *
249
- * @returns {boolean}
247
+ /**
248
+ * Returns true if raw fallback variant is supported.
249
+ *
250
+ * @returns {boolean}
250
251
  */
251
252
  canUseRaw() {
252
253
  return this.variants.some(entry => entry && ["raw", "rgba"].includes(entry.kind) && entry.supported);
253
254
  }
254
255
 
255
- /**
256
- * Returns true if compressed variant is supported.
257
- *
258
- * @returns {boolean}
256
+ /**
257
+ * Returns true if compressed variant is supported.
258
+ *
259
+ * @returns {boolean}
259
260
  */
260
261
  canUseCompressed() {
261
262
  return this.variants.some(entry => entry && entry.kind === "compressed" && entry.supported);
262
263
  }
263
264
 
264
- /**
265
- * Return true when a supported variant of the requested kind exists.
266
- *
267
- * @param {string} kind
268
- * @returns {boolean}
265
+ /**
266
+ * Return true when a supported variant of the requested kind exists.
267
+ *
268
+ * @param {string} kind
269
+ * @returns {boolean}
269
270
  */
270
271
  canUse(kind) {
271
272
  return this.variants.some(entry => entry && entry.kind === kind && entry.supported);