1// The sample map for the repo's samples/ folder (one folder per sound), built 2// statically so songs can load it on any host with 3// samples('jev-samples/strudel.json'). Vite bundles each file into _astro/; 4// `no-inline` keeps small files as files, since Strudel prefixes every entry 5// with _base and a data: URI cannot take a prefix. In the dev server the glob 6// is live, so a sound added to samples/ plays after a reload. 7// 8// The map itself is built by src/jev/sampleMap.mjs, which the headless tools 9// use too. The extensions are its SAMPLE_EXTENSIONS, written out because a 10// glob must be a literal; sampleMap.test.mjs checks that they agree. 11import { sampleMap } from '../../jev/sampleMap.mjs'; 12 13const files = import.meta.glob('../../../../samples/*/*.{mp3,wav,ogg}', { 14 eager: true, 15 query: '?url&no-inline', 16 import: 'default', 17}); 18 19export function GET() { 20 return new Response(JSON.stringify(sampleMap(Object.entries(files))), { 21 headers: { 'Content-Type': 'application/json' }, 22 }); 23}