@joycostudio/chopper 0.5.0 → 0.5.2

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/README.md CHANGED
@@ -31,5 +31,24 @@ chopper codecs sync public/chopper-codecs
31
31
  The browser defaults to a module worker and verifies the codec manifest and
32
32
  each downloaded artifact. Node resolves the same artifacts from this package.
33
33
 
34
+ Batch results expose the same complete optimization provenance as the core API:
35
+
36
+ ```ts
37
+ import { runConfig } from '@joycostudio/chopper/node'
38
+
39
+ const result = await runConfig({ mode: 'report' })
40
+ if (result.ok) {
41
+ for (const file of result.data.files) {
42
+ if (file.optimization) {
43
+ console.log(file.input, file.optimization.recipe, file.optimization.manifestHash)
44
+ }
45
+ }
46
+ }
47
+ ```
48
+
49
+ `optimization` is present for successful `write`, `check`, and `report` entries
50
+ and omitted for failures. The existing `beforeBytes`, `afterBytes`, and
51
+ `engineId` fields remain available on each successful entry.
52
+
34
53
  See the repository README for recipes, CLI commands, config, and the
35
54
  implementation plan.
@@ -1,5 +1,5 @@
1
1
  {
2
- "chopperVersion": "0.5.0",
2
+ "chopperVersion": "0.5.2",
3
3
  "manifestHash": "2046d60deb0f9f224743f4404f3c6e8ba5399f81b2811fa50466e93fce3bd322",
4
4
  "gltfTransformVersion": "4.4.2",
5
5
  "meshoptimizerVersion": "1.0.1",
@@ -7,7 +7,7 @@ var failure = (code, message, cause) => ({
7
7
 
8
8
  // package.json
9
9
  var package_default = {
10
- version: "0.5.0"};
10
+ version: "0.5.2"};
11
11
 
12
12
  // src/codecs/manifest.ts
13
13
  var CODEC_MANIFEST_HASH = "2046d60deb0f9f224743f4404f3c6e8ba5399f81b2811fa50466e93fce3bd322";
@@ -100,5 +100,5 @@ var CODEC_MANIFEST = {
100
100
  var ENGINE_ID = `chopper@${package_default.version}:${CODEC_MANIFEST_HASH}`;
101
101
 
102
102
  export { CODEC_ARTIFACTS, CODEC_MANIFEST, CODEC_MANIFEST_HASH, ENGINE_ID, failure, success };
103
- //# sourceMappingURL=chunk-6WQPPVM2.js.map
104
- //# sourceMappingURL=chunk-6WQPPVM2.js.map
103
+ //# sourceMappingURL=chunk-C47JCVDL.js.map
104
+ //# sourceMappingURL=chunk-C47JCVDL.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/core/result.ts","../../package.json","../../src/codecs/manifest.ts"],"names":[],"mappings":";AA0BO,IAAM,UAAU,CAAI,IAAA,MAAgC,EAAE,EAAA,EAAI,MAAM,IAAA,EAAK;AAErE,IAAM,OAAA,GAAU,CAAC,IAAA,EAAwB,OAAA,EAAiB,KAAA,MAAqC;AAAA,EACpG,EAAA,EAAI,KAAA;AAAA,EACJ,KAAA,EAAO,KAAA,KAAU,MAAA,GAAY,EAAE,IAAA,EAAM,SAAQ,GAAI,EAAE,IAAA,EAAM,OAAA,EAAS,KAAA;AACpE,CAAA;;;AC/BA,IAAA,eAAA,GAAA;AAAA,EAEE,OAAA,EAAW,OAqEb,CAAA;;;ACrEO,IAAM,mBAAA,GAAsB;AAE5B,IAAM,eAAA,GAAkB;AAAA,EAC7B,WAAA,EAAa;AAAA,IACX,WAAA,EAAa,eAAA;AAAA,IACb,cAAA,EAAgB,OAAA;AAAA,IAChB,WAAA,EAAa,yBAAA;AAAA,IACb,UAAA,EAAY,eAAA;AAAA,IACZ,MAAA,EAAQ;AAAA,GACV;AAAA,EACA,WAAA,EAAa;AAAA,IACX,WAAA,EAAa,eAAA;AAAA,IACb,cAAA,EAAgB,OAAA;AAAA,IAChB,WAAA,EAAa,4BAAA;AAAA,IACb,UAAA,EAAY,kBAAA;AAAA,IACZ,MAAA,EAAQ;AAAA,GACV;AAAA,EACA,WAAA,EAAa;AAAA,IACX,WAAA,EAAa,eAAA;AAAA,IACb,cAAA,EAAgB,OAAA;AAAA,IAChB,WAAA,EAAa,4BAAA;AAAA,IACb,UAAA,EAAY,kBAAA;AAAA,IACZ,MAAA,EAAQ;AAAA,GACV;AAAA,EACA,WAAA,EAAa;AAAA,I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GACV;AAAA,EACA,gBAAA,EAAkB;AAAA,IAChB,WAAA,EAAa,aAAA;AAAA,IACb,cAAA,EAAgB,OAAA;AAAA,IAChB,WAAA,EAAa,oBAAA;AAAA,IACb,UAAA,EAAY,oBAAA;AAAA,IACZ,MAAA,EAAQ;AAAA;AAEZ;AAQO,IAAM,cAAA,GAAiB;AAAA,EAC5B,gBAAgB,eAAA,CAAgB,OAAA;AAAA,EAChC,YAAA,EAAc,mBAAA;AAAA,EACd,oBAAA,EAAsB,OAAA;AAAA,EACtB,oBAAA,EAAsB,OAAA;AAAA,EACtB,SAAA,EAAW;AACb;AAEO,IAAM,SAAA,GAAY,CAAA,QAAA,EAAW,eAAA,CAAgB,OAAO,IAAI,mBAAmB,CAAA","file":"chunk-6WQPPVM2.js","sourcesContent":["export type ChopperErrorCode =\n | 'unsupported_asset'\n | 'invalid_recipe'\n | 'codec_load_failed'\n | 'decode_failed'\n | 'encode_failed'\n | 'validation_failed'\n | 'aborted'\n | 'io_failed'\n\nexport interface ChopperFailure {\n ok: false\n error: {\n code: ChopperErrorCode\n message: string\n cause?: unknown\n }\n}\n\nexport interface ChopperSuccess<T> {\n ok: true\n data: T\n}\n\nexport type ChopperResult<T> = ChopperSuccess<T> | ChopperFailure\n\nexport const success = <T>(data: T): ChopperSuccess<T> => ({ ok: true, data })\n\nexport const failure = (code: ChopperErrorCode, message: string, cause?: unknown): ChopperFailure => ({\n ok: false,\n error: cause === undefined ? { code, message } : { code, message, cause },\n})\n","{\n \"name\": \"@joycostudio/chopper\",\n \"version\": \"0.5.0\",\n \"description\": \"Isomorphic asset optimization pipeline\",\n \"type\": \"module\",\n \"license\": \"ISC\",\n \"author\": \"joyco.studio\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/joyco-studio/chopper.git\",\n \"directory\": \"packages/chopper\"\n },\n \"homepage\": \"https://github.com/joyco-studio/chopper#readme\",\n \"bugs\": \"https://github.com/joyco-studio/chopper/issues\",\n \"publishConfig\": {\n \"registry\": \"https://registry.npmjs.org\",\n \"access\": \"public\"\n },\n \"files\": [\n \"dist\",\n \"codecs\",\n \"README.md\",\n \"THIRD_PARTY_NOTICES.md\"\n ],\n \"bin\": {\n \"chopper\": \"dist/cli/index.js\"\n },\n \"exports\": {\n \".\": {\n \"types\": \"./dist/index.d.ts\",\n \"import\": \"./dist/index.js\"\n },\n \"./browser\": {\n \"types\": \"./dist/browser/index.d.ts\",\n \"import\": \"./dist/browser/index.js\"\n },\n \"./node\": {\n \"types\": \"./dist/node/index.d.ts\",\n \"import\": \"./dist/node/index.js\",\n \"default\": \"./dist/node/index.js\"\n },\n \"./config\": {\n \"types\": \"./dist/config/index.d.ts\",\n \"import\": \"./dist/config/index.js\"\n },\n \"./package.json\": \"./package.json\"\n },\n \"scripts\": {\n \"build\": \"pnpm codecs:sync && tsup\",\n \"codecs:sync\": \"tsx ../../scripts/sync-codecs.ts\",\n \"dev\": \"tsup --watch\",\n \"typecheck\": \"tsc --noEmit\"\n },\n \"dependencies\": {\n \"@gltf-transform/core\": \"4.4.2\",\n \"@gltf-transform/extensions\": \"4.4.2\",\n \"@gltf-transform/functions\": \"4.4.2\",\n \"@jsquash/avif\": \"2.1.1\",\n \"@jsquash/jpeg\": \"1.6.0\",\n \"@jsquash/png\": \"3.1.1\",\n \"@jsquash/resize\": \"2.1.1\",\n \"@jsquash/webp\": \"1.5.0\",\n \"draco3dgltf\": \"1.5.7\",\n \"jiti\": \"2.7.0\",\n \"ktx2-encoder\": \"0.6.0\",\n \"meshoptimizer\": \"1.0.1\",\n \"tinyglobby\": \"0.2.17\"\n },\n \"devDependencies\": {\n \"@types/draco3dgltf\": \"1.4.3\"\n }\n}\n","import packageMetadata from '../../package.json'\n\nexport const CODEC_MANIFEST_HASH = '2046d60deb0f9f224743f4404f3c6e8ba5399f81b2811fa50466e93fce3bd322'\n\nexport const CODEC_ARTIFACTS = {\n avifEncoder: {\n packageName: '@jsquash/avif',\n packageVersion: '2.1.1',\n packagePath: 'codec/enc/avif_enc.wasm',\n publicFile: 'avif_enc.wasm',\n sha256: 'd9f2a95164362af48558d176e619becfd49dd97b50b86c679b47100860522b3d',\n },\n jpegDecoder: {\n packageName: '@jsquash/jpeg',\n packageVersion: '1.6.0',\n packagePath: 'codec/dec/mozjpeg_dec.wasm',\n publicFile: 'mozjpeg_dec.wasm',\n sha256: 'a7c4b12169817e779ff4af137981393ae924944e167ad1bd95747c9199162d3e',\n },\n jpegEncoder: {\n packageName: '@jsquash/jpeg',\n packageVersion: '1.6.0',\n packagePath: 'codec/enc/mozjpeg_enc.wasm',\n publicFile: 'mozjpeg_enc.wasm',\n sha256: '24d4177f1c4963e2058b107189249651c61fdef125570e79b1dfb63c8bb49326',\n },\n ktx2Encoder: {\n packageName: 'ktx2-encoder',\n packageVersion: '0.6.0',\n packagePath: 'dist/basis/basis_encoder.wasm',\n publicFile: 'basis_encoder.wasm',\n sha256: '9807719e87cf3d979b0d69ae7112eb88aec6a0e0206c0b2d00dc0bed0d581b80',\n },\n png: {\n packageName: '@jsquash/png',\n packageVersion: '3.1.1',\n packagePath: 'codec/pkg/squoosh_png_bg.wasm',\n publicFile: 'squoosh_png_bg.wasm',\n sha256: '263d6e658808a74b72a1a99c5cc1d619237e70c150db6e41d5d84d3d117ab9be',\n },\n resize: {\n packageName: '@jsquash/resize',\n packageVersion: '2.1.1',\n packagePath: 'lib/resize/pkg/squoosh_resize_bg.wasm',\n publicFile: 'squoosh_resize_bg.wasm',\n sha256: '5b1f702d502c4d0a70b99f78691bd554d566ba95859e4c57af5435955a1d74a5',\n },\n webpEncoder: {\n packageName: '@jsquash/webp',\n packageVersion: '1.5.0',\n packagePath: 'codec/enc/webp_enc.wasm',\n publicFile: 'webp_enc.wasm',\n sha256: 'b6085bb6702f144e9dc6016d58d230b34a84976bf0d080b7390b4b4b137d6ab7',\n },\n dracoDecoderScript: {\n packageName: 'draco3dgltf',\n packageVersion: '1.5.7',\n packagePath: 'draco_decoder_gltf_nodejs.js',\n publicFile: 'draco_decoder_gltf.js',\n sha256: '8bb2952d2ba7d67e1414f8df819410cb0434a666be53f671fff75f68843d76f6',\n },\n dracoDecoderWasm: {\n packageName: 'draco3dgltf',\n packageVersion: '1.5.7',\n packagePath: 'draco_decoder_gltf.wasm',\n publicFile: 'draco_decoder_gltf.wasm',\n sha256: '712db3449ae2041d6e8a224c395bda6cedb49e51322fae38b7db9beb8b381889',\n },\n dracoEncoderScript: {\n packageName: 'draco3dgltf',\n packageVersion: '1.5.7',\n packagePath: 'draco_encoder_gltf_nodejs.js',\n publicFile: 'draco_encoder_gltf.js',\n sha256: '8434adecd1446459601763e499be3697546056bca90b286a538ae0483a00845a',\n },\n dracoEncoderWasm: {\n packageName: 'draco3dgltf',\n packageVersion: '1.5.7',\n packagePath: 'draco_encoder.wasm',\n publicFile: 'draco_encoder.wasm',\n sha256: 'd2a3ac80c91980d5d321c116454834ff36264825c6d1794cc84e42288f158958',\n },\n} as const\n\nexport type CodecArtifactName = keyof typeof CODEC_ARTIFACTS\nexport type ImageWasmModuleName = Extract<\n CodecArtifactName,\n 'avifEncoder' | 'jpegDecoder' | 'jpegEncoder' | 'png' | 'resize' | 'webpEncoder'\n>\n\nexport const CODEC_MANIFEST = {\n chopperVersion: packageMetadata.version,\n manifestHash: CODEC_MANIFEST_HASH,\n gltfTransformVersion: '4.4.2',\n meshoptimizerVersion: '1.0.1',\n artifacts: CODEC_ARTIFACTS,\n} as const\n\nexport const ENGINE_ID = `chopper@${packageMetadata.version}:${CODEC_MANIFEST_HASH}` as const\n"]}
1
+ {"version":3,"sources":["../../src/core/result.ts","../../package.json","../../src/codecs/manifest.ts"],"names":[],"mappings":";AA0BO,IAAM,UAAU,CAAI,IAAA,MAAgC,EAAE,EAAA,EAAI,MAAM,IAAA,EAAK;AAErE,IAAM,OAAA,GAAU,CAAC,IAAA,EAAwB,OAAA,EAAiB,KAAA,MAAqC;AAAA,EACpG,EAAA,EAAI,KAAA;AAAA,EACJ,KAAA,EAAO,KAAA,KAAU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BAAmB,CAAA","file":"chunk-C47JCVDL.js","sourcesContent":["export type ChopperErrorCode =\n | 'unsupported_asset'\n | 'invalid_recipe'\n | 'codec_load_failed'\n | 'decode_failed'\n | 'encode_failed'\n | 'validation_failed'\n | 'aborted'\n | 'io_failed'\n\nexport interface ChopperFailure {\n ok: false\n error: {\n code: ChopperErrorCode\n message: string\n cause?: unknown\n }\n}\n\nexport interface ChopperSuccess<T> {\n ok: true\n data: T\n}\n\nexport type ChopperResult<T> = ChopperSuccess<T> | ChopperFailure\n\nexport const success = <T>(data: T): ChopperSuccess<T> => ({ ok: true, data })\n\nexport const failure = (code: ChopperErrorCode, message: string, cause?: unknown): ChopperFailure => ({\n ok: false,\n error: cause === undefined ? { code, message } : { code, message, cause },\n})\n","{\n \"name\": \"@joycostudio/chopper\",\n \"version\": \"0.5.2\",\n \"description\": \"Isomorphic asset optimization pipeline\",\n \"type\": \"module\",\n \"license\": \"ISC\",\n \"author\": \"joyco.studio\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/joyco-studio/chopper.git\",\n \"directory\": \"packages/chopper\"\n },\n \"homepage\": \"https://github.com/joyco-studio/chopper#readme\",\n \"bugs\": \"https://github.com/joyco-studio/chopper/issues\",\n \"publishConfig\": {\n \"registry\": \"https://registry.npmjs.org\",\n \"access\": \"public\"\n },\n \"files\": [\n \"dist\",\n \"codecs\",\n \"README.md\",\n \"THIRD_PARTY_NOTICES.md\"\n ],\n \"bin\": {\n \"chopper\": \"dist/cli/index.js\"\n },\n \"exports\": {\n \".\": {\n \"types\": \"./dist/index.d.ts\",\n \"import\": \"./dist/index.js\"\n },\n \"./browser\": {\n \"types\": \"./dist/browser/index.d.ts\",\n \"import\": \"./dist/browser/index.js\"\n },\n \"./node\": {\n \"types\": \"./dist/node/index.d.ts\",\n \"import\": \"./dist/node/index.js\",\n \"default\": \"./dist/node/index.js\"\n },\n \"./config\": {\n \"types\": \"./dist/config/index.d.ts\",\n \"import\": \"./dist/config/index.js\"\n },\n \"./package.json\": \"./package.json\"\n },\n \"scripts\": {\n \"build\": \"pnpm codecs:sync && tsup\",\n \"codecs:sync\": \"tsx ../../scripts/sync-codecs.ts\",\n \"dev\": \"tsup --watch\",\n \"typecheck\": \"tsc --noEmit\"\n },\n \"dependencies\": {\n \"@gltf-transform/core\": \"4.4.2\",\n \"@gltf-transform/extensions\": \"4.4.2\",\n \"@gltf-transform/functions\": \"4.4.2\",\n \"@jsquash/avif\": \"2.1.1\",\n \"@jsquash/jpeg\": \"1.6.0\",\n \"@jsquash/png\": \"3.1.1\",\n \"@jsquash/resize\": \"2.1.1\",\n \"@jsquash/webp\": \"1.5.0\",\n \"draco3dgltf\": \"1.5.7\",\n \"jiti\": \"2.7.0\",\n \"ktx2-encoder\": \"0.6.0\",\n \"meshoptimizer\": \"1.0.1\",\n \"tinyglobby\": \"0.2.17\"\n },\n \"devDependencies\": {\n \"@types/draco3dgltf\": \"1.4.3\"\n }\n}\n","import packageMetadata from '../../package.json'\n\nexport const CODEC_MANIFEST_HASH = '2046d60deb0f9f224743f4404f3c6e8ba5399f81b2811fa50466e93fce3bd322'\n\nexport const CODEC_ARTIFACTS = {\n avifEncoder: {\n packageName: '@jsquash/avif',\n packageVersion: '2.1.1',\n packagePath: 'codec/enc/avif_enc.wasm',\n publicFile: 'avif_enc.wasm',\n sha256: 'd9f2a95164362af48558d176e619becfd49dd97b50b86c679b47100860522b3d',\n },\n jpegDecoder: {\n packageName: '@jsquash/jpeg',\n packageVersion: '1.6.0',\n packagePath: 'codec/dec/mozjpeg_dec.wasm',\n publicFile: 'mozjpeg_dec.wasm',\n sha256: 'a7c4b12169817e779ff4af137981393ae924944e167ad1bd95747c9199162d3e',\n },\n jpegEncoder: {\n packageName: '@jsquash/jpeg',\n packageVersion: '1.6.0',\n packagePath: 'codec/enc/mozjpeg_enc.wasm',\n publicFile: 'mozjpeg_enc.wasm',\n sha256: '24d4177f1c4963e2058b107189249651c61fdef125570e79b1dfb63c8bb49326',\n },\n ktx2Encoder: {\n packageName: 'ktx2-encoder',\n packageVersion: '0.6.0',\n packagePath: 'dist/basis/basis_encoder.wasm',\n publicFile: 'basis_encoder.wasm',\n sha256: '9807719e87cf3d979b0d69ae7112eb88aec6a0e0206c0b2d00dc0bed0d581b80',\n },\n png: {\n packageName: '@jsquash/png',\n packageVersion: '3.1.1',\n packagePath: 'codec/pkg/squoosh_png_bg.wasm',\n publicFile: 'squoosh_png_bg.wasm',\n sha256: '263d6e658808a74b72a1a99c5cc1d619237e70c150db6e41d5d84d3d117ab9be',\n },\n resize: {\n packageName: '@jsquash/resize',\n packageVersion: '2.1.1',\n packagePath: 'lib/resize/pkg/squoosh_resize_bg.wasm',\n publicFile: 'squoosh_resize_bg.wasm',\n sha256: '5b1f702d502c4d0a70b99f78691bd554d566ba95859e4c57af5435955a1d74a5',\n },\n webpEncoder: {\n packageName: '@jsquash/webp',\n packageVersion: '1.5.0',\n packagePath: 'codec/enc/webp_enc.wasm',\n publicFile: 'webp_enc.wasm',\n sha256: 'b6085bb6702f144e9dc6016d58d230b34a84976bf0d080b7390b4b4b137d6ab7',\n },\n dracoDecoderScript: {\n packageName: 'draco3dgltf',\n packageVersion: '1.5.7',\n packagePath: 'draco_decoder_gltf_nodejs.js',\n publicFile: 'draco_decoder_gltf.js',\n sha256: '8bb2952d2ba7d67e1414f8df819410cb0434a666be53f671fff75f68843d76f6',\n },\n dracoDecoderWasm: {\n packageName: 'draco3dgltf',\n packageVersion: '1.5.7',\n packagePath: 'draco_decoder_gltf.wasm',\n publicFile: 'draco_decoder_gltf.wasm',\n sha256: '712db3449ae2041d6e8a224c395bda6cedb49e51322fae38b7db9beb8b381889',\n },\n dracoEncoderScript: {\n packageName: 'draco3dgltf',\n packageVersion: '1.5.7',\n packagePath: 'draco_encoder_gltf_nodejs.js',\n publicFile: 'draco_encoder_gltf.js',\n sha256: '8434adecd1446459601763e499be3697546056bca90b286a538ae0483a00845a',\n },\n dracoEncoderWasm: {\n packageName: 'draco3dgltf',\n packageVersion: '1.5.7',\n packagePath: 'draco_encoder.wasm',\n publicFile: 'draco_encoder.wasm',\n sha256: 'd2a3ac80c91980d5d321c116454834ff36264825c6d1794cc84e42288f158958',\n },\n} as const\n\nexport type CodecArtifactName = keyof typeof CODEC_ARTIFACTS\nexport type ImageWasmModuleName = Extract<\n CodecArtifactName,\n 'avifEncoder' | 'jpegDecoder' | 'jpegEncoder' | 'png' | 'resize' | 'webpEncoder'\n>\n\nexport const CODEC_MANIFEST = {\n chopperVersion: packageMetadata.version,\n manifestHash: CODEC_MANIFEST_HASH,\n gltfTransformVersion: '4.4.2',\n meshoptimizerVersion: '1.0.1',\n artifacts: CODEC_ARTIFACTS,\n} as const\n\nexport const ENGINE_ID = `chopper@${packageMetadata.version}:${CODEC_MANIFEST_HASH}` as const\n"]}
@@ -1,4 +1,4 @@
1
- import { CODEC_MANIFEST_HASH, CODEC_MANIFEST, ENGINE_ID, failure, success, CODEC_ARTIFACTS } from './chunk-6WQPPVM2.js';
1
+ import { CODEC_MANIFEST_HASH, CODEC_MANIFEST, ENGINE_ID, failure, success, CODEC_ARTIFACTS } from './chunk-C47JCVDL.js';
2
2
  import { __commonJS, __toESM } from './chunk-5WRI5ZAA.js';
3
3
 
4
4
  // ../../node_modules/.pnpm/iota-array@1.0.0/node_modules/iota-array/iota.js
@@ -1409,6 +1409,12 @@ function outputMimeType(encoding) {
1409
1409
  return `image/${encoding.codec}`;
1410
1410
  }
1411
1411
 
1412
+ // src/core/object-validation.ts
1413
+ function unknownFieldIssue(value, allowedFields, subject) {
1414
+ const field = Object.keys(value).find((key) => !allowedFields.includes(key));
1415
+ return field ? `Unknown ${subject} field: ${field}` : void 0;
1416
+ }
1417
+
1412
1418
  // src/core/validation.ts
1413
1419
  function validateRecipe(recipe) {
1414
1420
  const shapeIssue = recipeShapeIssue(recipe);
@@ -1448,15 +1454,26 @@ function recipeShapeIssue(recipe) {
1448
1454
  return `Unsupported recipe kind: ${String(candidate.kind)}`;
1449
1455
  }
1450
1456
  if (candidate.kind === "image") {
1457
+ const unknownField2 = unknownFieldIssue(candidate, ["kind", "encode"], "image recipe");
1458
+ if (unknownField2) return unknownField2;
1451
1459
  return encodingShapeIssue(candidate.encode);
1452
1460
  }
1461
+ const unknownField = unknownFieldIssue(candidate, ["kind", "methods", "textures", "geometry"], "GLB recipe");
1462
+ if (unknownField) return unknownField;
1453
1463
  if (candidate.methods !== void 0 && !Array.isArray(candidate.methods)) {
1454
1464
  return "GLB methods must be an array";
1455
1465
  }
1456
1466
  for (const method of candidate.methods ?? []) {
1457
- if (!method || typeof method !== "object" || !["dedup", "prune", "resample"].includes(String(method.method))) {
1467
+ if (!method || typeof method !== "object") {
1468
+ return "GLB methods contain an unsupported transform";
1469
+ }
1470
+ const entry = method;
1471
+ if (!["dedup", "prune", "resample"].includes(String(entry.method))) {
1458
1472
  return "GLB methods contain an unsupported transform";
1459
1473
  }
1474
+ const allowedFields = entry.method === "dedup" ? ["method", "keepUniqueNames", "propertyTypes"] : entry.method === "prune" ? ["method", "keepAttributes", "keepExtras", "keepLeaves", "keepSolidTextures", "propertyTypes"] : ["method", "tolerance", "cleanup"];
1475
+ const unknownField2 = unknownFieldIssue(entry, allowedFields, "GLB method");
1476
+ if (unknownField2) return unknownField2;
1460
1477
  }
1461
1478
  if (candidate.textures !== void 0 && !Array.isArray(candidate.textures)) {
1462
1479
  return "GLB textures must be an array";
@@ -1464,19 +1481,32 @@ function recipeShapeIssue(recipe) {
1464
1481
  for (const texture of candidate.textures ?? []) {
1465
1482
  if (!texture || typeof texture !== "object") return "Texture recipes must be objects";
1466
1483
  const entry = texture;
1484
+ const unknownField2 = unknownFieldIssue(entry, ["label", "select", "encode"], "texture recipe");
1485
+ if (unknownField2) return unknownField2;
1467
1486
  if (typeof entry.label !== "string") return "Texture recipe labels must be strings";
1468
1487
  if (!entry.select || typeof entry.select !== "object") return "Texture recipes require a selector";
1469
1488
  const selector = entry.select;
1470
- const values = selector[selector.by === "slot" ? "slots" : selector.by === "name" ? "names" : "indices"];
1471
- if (!["slot", "name", "index"].includes(String(selector.by)) || !Array.isArray(values)) {
1489
+ if (!["slot", "name", "index"].includes(String(selector.by))) {
1472
1490
  return "Texture recipe selectors are malformed";
1473
1491
  }
1492
+ const valueField = selector.by === "slot" ? "slots" : selector.by === "name" ? "names" : "indices";
1493
+ const selectorUnknownField = unknownFieldIssue(selector, ["by", valueField], "texture selector");
1494
+ if (selectorUnknownField) return selectorUnknownField;
1495
+ if (!Array.isArray(selector[valueField])) return "Texture recipe selectors are malformed";
1474
1496
  const encodingIssue2 = encodingShapeIssue(entry.encode);
1475
1497
  if (encodingIssue2) return encodingIssue2;
1476
1498
  }
1477
1499
  if (candidate.geometry !== void 0 && candidate.geometry !== false && (!candidate.geometry || typeof candidate.geometry !== "object" || !["draco", "meshopt"].includes(String(candidate.geometry.codec)))) {
1478
1500
  return "GLB geometry must be false, Draco, or Meshopt";
1479
1501
  }
1502
+ if (candidate.geometry && typeof candidate.geometry === "object") {
1503
+ const geometryUnknownField = unknownFieldIssue(
1504
+ candidate.geometry,
1505
+ ["codec"],
1506
+ "GLB geometry"
1507
+ );
1508
+ if (geometryUnknownField) return geometryUnknownField;
1509
+ }
1480
1510
  return void 0;
1481
1511
  }
1482
1512
  function encodingShapeIssue(encoding) {
@@ -1491,6 +1521,16 @@ function encodingShapeIssue(encoding) {
1491
1521
  if (candidate.codec === "ktx2" && candidate.mode === "uastc-hdr" && candidate.maxSize !== void 0) {
1492
1522
  return "UASTC HDR does not support maxSize; resizing requires a decoded 8-bit image. Author the source at its target resolution.";
1493
1523
  }
1524
+ const allowedFields = candidate.codec === "webp" ? ["codec", "maxSize", "quality", "effort", "lossless", "nearLossless"] : candidate.codec === "avif" ? ["codec", "maxSize", "quality", "effort", "lossless", "chromaSubsampling"] : candidate.codec === "jpeg" ? ["codec", "maxSize", "quality", "chromaSubsampling"] : candidate.codec === "png" ? ["codec", "maxSize"] : candidate.mode === "uastc" ? ["codec", "mode", "maxSize", "colorSpace", "normalMap", "level", "mipmaps", "zstd", "rdo"] : candidate.mode === "etc1s" ? ["codec", "mode", "maxSize", "colorSpace", "normalMap", "quality", "compression", "mipmaps"] : ["codec", "mode", "level", "mipmaps", "zstd"];
1525
+ const unknownField = unknownFieldIssue(candidate, allowedFields, "image encoding");
1526
+ if (unknownField) return unknownField;
1527
+ if (candidate.codec === "ktx2" && candidate.mode === "uastc" && candidate.rdo !== void 0) {
1528
+ if (!candidate.rdo || typeof candidate.rdo !== "object" || Array.isArray(candidate.rdo)) {
1529
+ return "UASTC RDO must be an object";
1530
+ }
1531
+ const rdoUnknownField = unknownFieldIssue(candidate.rdo, ["lambda"], "UASTC RDO");
1532
+ if (rdoUnknownField) return rdoUnknownField;
1533
+ }
1494
1534
  return void 0;
1495
1535
  }
1496
1536
  function recipeIssue(recipe) {
@@ -26942,5 +26982,5 @@ is-buffer/index.js:
26942
26982
  */
26943
26983
 
26944
26984
  export { createInProcessChopper };
26945
- //# sourceMappingURL=in-process-P6TQNY2L.js.map
26946
- //# sourceMappingURL=in-process-P6TQNY2L.js.map
26985
+ //# sourceMappingURL=in-process-Y2RGECEF.js.map
26986
+ //# sourceMappingURL=in-process-Y2RGECEF.js.map