feat(domain): archive contracts — sheet snapshot (lean document, caps, integrity), envelope v1 layered reader, branding and label schemas, report rebase, sheet index moved from the app; bundle carries asset hashes
This commit is contained in:
1 parent
8b86b926c8
commit
cdc0943f35
25 files changed
+2253
-116
No files matched your search
@@ -7,7 +7,8 @@ import type { Plugin } from 'vite'
|
||||
* application as the virtual module `virtual:faunosteo-sheet`.
|
||||
*
|
||||
* Mode `draft` embeds `document.json`, `sheet-ref.json`,
|
||||
* `report-migration-map.json` and the SVG assets of the seed folder; mode
|
||||
* `report-migration-map.json`, the SVG assets of the seed folder and their
|
||||
* manifest hashes (`assets.json`, carried into report archives); mode
|
||||
* `none` exports null and the app shows "no sheet configured". The default is
|
||||
* `draft` for the dev server and `none` for a build: a production bundle never
|
||||
* carries the medically unvalidated draft unless `SHEET_BUNDLE=draft` is set
|
||||
@@ -36,6 +37,7 @@ interface SeedFiles {
|
||||
document: unknown
|
||||
migrationMap: unknown
|
||||
assets: Record<string, string>
|
||||
assetHashes: Record<string, string>
|
||||
watched: string[]
|
||||
}
|
||||
|
||||
@@ -44,20 +46,24 @@ function readSeed(seedDir: string): SeedFiles {
|
||||
JSON.parse(readFileSync(join(seedDir, name), 'utf8')) as unknown
|
||||
const manifest = json('assets.json') as {
|
||||
file: string
|
||||
sha256: string
|
||||
svg_asset_id: string
|
||||
}[]
|
||||
const assets: Record<string, string> = {}
|
||||
const assetHashes: Record<string, string> = {}
|
||||
for (const asset of manifest) {
|
||||
assets[asset.svg_asset_id] = readFileSync(
|
||||
join(seedDir, 'assets', asset.file),
|
||||
'utf8',
|
||||
)
|
||||
assetHashes[asset.svg_asset_id] = asset.sha256
|
||||
}
|
||||
return {
|
||||
ref: json('sheet-ref.json'),
|
||||
document: json('document.json'),
|
||||
migrationMap: json('report-migration-map.json'),
|
||||
assets,
|
||||
assetHashes,
|
||||
watched: [
|
||||
'sheet-ref.json',
|
||||
'document.json',
|
||||
@@ -88,6 +94,7 @@ export function faunosteoSheetBundle(options: {
|
||||
document: seed.document,
|
||||
migrationMap: seed.migrationMap,
|
||||
assets: seed.assets,
|
||||
assetHashes: seed.assetHashes,
|
||||
}
|
||||
return `export const bundledSheet = ${JSON.stringify(payload)}\n`
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user