import type { AssetManager } from '@/lib/assets/assetManager' export type AssetsIndex = { images: string[] fonts: string[] other: string[] } export function buildAssetsIndex(am: AssetManager): Uint8Array { // 그룹별 경로 수집 const images: string[] = [] const fonts: string[] = [] const other: string[] = [] for (const ref of am.list()) { if (ref.mimeType.startsWith('image/')) images.push(ref.path) else if (ref.mimeType.startsWith('font/')) fonts.push(ref.path) else other.push(ref.path) } // 경로 사전순 정렬로 일정한 출력 보장 images.sort() fonts.sort() other.sort() const obj: AssetsIndex = { images, fonts, other } const json = JSON.stringify(obj, null, 2) return new TextEncoder().encode(json) }