@wildshard/shard-format 0.82.1 → 0.82.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wildshard/shard-format",
3
- "version": "0.82.1",
3
+ "version": "0.82.2",
4
4
  "description": "The raw shardfile format: the spec, the validator and a validate CLI. The public, versioned contract every other repo builds on.",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
@@ -9,7 +9,8 @@ import { AudioRoutingSchema, AudioVoiceBindingsSchema } from './audioRouting.ts'
9
9
  import { AudioLoopEmitterSchema, AudioPlaybackSchema, AudioSurfaceSchema, AudioLoopGraphSchema, AudioObservationSystemSchema, AudioPcmProgramSchema, AudioMusicSchema, AudioSamplesSchema, AudioZonesSchema, AudioPhraseProgramSchema, AudioPhraseScheduleSchema } from './audioProfiles.ts';
10
10
 
11
11
  const id = v.pipe(v.string(), v.minLength(1), v.maxLength(128));
12
- const recordingPath = v.pipe(v.string(), v.maxLength(256), v.regex(/^\/assets\/(?:music|sfx)\/(?:[a-zA-Z0-9][a-zA-Z0-9._-]*\/)+[a-zA-Z0-9][a-zA-Z0-9._-]*\.(?:m4a|wav)$/u));
12
+ // SF4: a zone's recordings sit under its slug (`/assets/<slug>/music|sfx/…`) beside the engine-wide folders
13
+ const recordingPath = v.pipe(v.string(), v.maxLength(256), v.regex(/^\/assets\/(?:[a-z0-9]+(?:-[a-z0-9]+)*\/)?(?:music|sfx)\/(?:[a-zA-Z0-9][a-zA-Z0-9._-]*\/)+[a-zA-Z0-9][a-zA-Z0-9._-]*\.(?:m4a|wav)$/u));
13
14
  const recordingRef = v.pipe(v.string(), v.regex(/^(?:commons:)?[a-f0-9]{64}$/u));
14
15
  const recordings = v.pipe(v.record(recordingPath, recordingRef), v.check(rows => Object.keys(rows).length <= 1024, 'bounded audio recording bindings'));
15
16
  const finite = v.pipe(v.number(), v.finite());
@@ -61,6 +61,7 @@ import { MigrationsSchema, migrationRules } from './migrations.ts';
61
61
  import { skinLookRules } from './skinAssets.ts';
62
62
  import { skinLookTextureRefs } from './skin-textures.ts';
63
63
  import { attachmentFileRules } from './creature-attachments.ts';
64
+ import { isTextureKind } from './texture-kind.ts';
64
65
  import { MaterialsSchema, FamilyLooksSchema, MaterialCurvesSchema, TextureSamplersSchema, materialExists, materialTextureRefs, materialGraphRules, materialCurveRules, textureSamplerRules, graphBindingSources } from './materials.ts';
65
66
  import { PostStackSchema, postStackRules } from './postStack.ts';
66
67
  import { LookSkySchema, lookSkyRules } from './look-sky.ts';
@@ -286,7 +287,7 @@ export function shardfileRules(s: Shardfile, sections?: ReadonlyMap<string, unkn
286
287
  const id = libraryPending.pop(); if (id === undefined || libraryClosure.has(id)) continue;
287
288
  libraryClosure.add(id); libraryPending.push(...files.get(id)?.dependencies ?? []);
288
289
  }
289
- if (materialRefs.some((id) => !/^(?:commons:)?[a-f0-9]{64}$/u.test(id) || !libraryClosure.has(id) || (id.startsWith('commons:') ? !s.requires.commons.includes(id.slice(8)) : files.get(id)?.kind !== 'ktx2'))) errors.push('admitted material texture library references');
290
+ if (materialRefs.some((id) => !/^(?:commons:)?[a-f0-9]{64}$/u.test(id) || !libraryClosure.has(id) || (id.startsWith('commons:') ? !s.requires.commons.includes(id.slice(8)) : !isTextureKind(files.get(id)?.kind)))) errors.push('admitted material texture library references');
290
291
  if (s.items.rows.some(row => row.view.asset !== undefined && (!libraryClosure.has(row.view.asset) ||
291
292
  (row.view.asset.startsWith('commons:') ? !commons.has(row.view.asset.slice(8)) : files.get(row.view.asset)?.kind !== 'glb')))) errors.push('admitted item model library references');
292
293
  const lut = s.look.grade.lut === null || s.look.grade.lut.startsWith('commons:') ? null : files.get(s.look.grade.lut);
@@ -0,0 +1,3 @@
1
+ /** SF16/SF17 (J525): a texture named by hash is a KTX2 or a PNG or JPEG image the cook encodes. */
2
+ export const isTextureKind = (kind: string | undefined): boolean =>
3
+ kind === 'ktx2' || kind === 'image'