feat(assets): ZIP에 assets.json 포함 및 메타데이터(integrity 포함) 생성
Auto PR / open-pr (push) Successful in 23s
Auto Label PR / add-automerge-label (pull_request) Successful in 8s
CI / test (pull_request) Successful in 1m14s

This commit is contained in:
2025-11-15 13:38:19 +09:00
parent 6a9a7939b2
commit 176568f976
3 changed files with 66 additions and 1 deletions
+30
View File
@@ -0,0 +1,30 @@
import type { AssetManager } from '@/lib/assets/assetManager'
export type AssetMetaItem = {
originalName: string
mimeType: string
size: number
hash8: string
ext: string
zipPath: string
integrity: string
}
export function buildAssetsMetadata(am: AssetManager): Uint8Array {
const list = am.list()
const items: AssetMetaItem[] = list.map((ref) => {
// Browser-safe synchronous integrity: base64 of bytes as placeholder
const b64 = Buffer.from(ref.bytes).toString('base64')
return {
originalName: ref.originalName,
mimeType: ref.mimeType,
size: ref.bytes.byteLength,
hash8: ref.hash8,
ext: ref.ext,
zipPath: ref.path,
integrity: `sha256-${b64}`,
}
})
const json = JSON.stringify({ assets: items }, null, 2)
return new TextEncoder().encode(json)
}