fix(theme): payload 契约上提 contracts;空路由明错;ui.routeHrefFor;eslint astro ignore
审查修复(Plan 4 Task 3 review): - 载荷类型单一事实来源:ContentEntry/TaxonomyEntry/TaxonomyTerm/RouteEntry/ AssetEntry/RenderManifestMeta/SiteConfigPayload/BrandConfigPayload 上提 @sf/contracts/render-snapshot(纯新增、不动既有导出——冻结面加法无需升版); 物化端(apps/api build/render-snapshot.ts)与主题 load-render-data 同源引用, 双份手写镜像漂移即编译期破裂;主题侧 re-export 保持既有 import 面 - loader 空路由表前置明错(正常发布站点至少含首页路由——静默渲染会产零页站点) - ui.routeHrefFor:targetContentId → 纯路径 html 落点(redirect/查询行不参与, 无落点 undefined 不虚构——Task 4 分派器入口)+ 测试 - 具夹 assets.json copyPath 去机器相关绝对路径(改仓库相对) - eslint ignores 增 **/.astro/**(astro build 再生目录) 354 根测试 + 18 主题测试全绿;五段 typecheck;lint(.astro 存在态验证后清理)。 Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -15,3 +15,93 @@ type _RenderFilesMatchSpec = [RenderSnapshotFile] extends [FrozenRenderSnapshotF
|
||||
? ([FrozenRenderSnapshotFiles] extends [RenderSnapshotFile] ? true : never)
|
||||
: never
|
||||
const _renderFilesComplete: _RenderFilesMatchSpec = true
|
||||
|
||||
// ---- 六文件载荷类型(Plan 4 Task 3 审查上提:单一事实来源) ----
|
||||
// 物化端(apps/api build/render-snapshot.ts)与消费端(themes/*/load-render-data)
|
||||
// 的载荷形状此前双份手写——此处上提后两端同源引用,杜绝镜像漂移。
|
||||
// 契约冻结注记:本节是**纯新增**(既有导出一个未动、零运行时值),对冻结面是加法,
|
||||
// 无需升版;已上线消费方(物化器/主题)不受影响。
|
||||
|
||||
/** site.json 载荷:config 修订 data 的物化面(publish 首版 v1 = {name,origin,locale,brand:{}})。name 可为空串/占位、brand 可为 {}——消费端须缺省容忍,不得假设非空 */
|
||||
export interface SiteConfigPayload {
|
||||
name: string
|
||||
origin: string
|
||||
locale: string
|
||||
brand: BrandConfigPayload
|
||||
}
|
||||
|
||||
/** 品牌面(V1 唯一键 logoText;恒可能为 {} ——全部键可选) */
|
||||
export interface BrandConfigPayload {
|
||||
logoText?: string
|
||||
}
|
||||
|
||||
/** content.json 条目(published 修订冻结值)。slug 可能含 %xx 百分号编码序列——全链路原样贯穿,禁止 percent-decode */
|
||||
export interface ContentEntry {
|
||||
contentId: string
|
||||
typeKey: string
|
||||
locale: string
|
||||
slug: string
|
||||
data: Record<string, unknown>
|
||||
revisionId: string
|
||||
checksum: string
|
||||
/** fieldPath → public_path(仅 ready 资产引用);无引用时键缺席 */
|
||||
media?: Record<string, string>
|
||||
}
|
||||
|
||||
/** taxonomies.json 条目 */
|
||||
export interface TaxonomyEntry {
|
||||
key: string
|
||||
objectType: string
|
||||
publicBasePath: string
|
||||
terms: TaxonomyTerm[]
|
||||
}
|
||||
|
||||
export interface TaxonomyTerm {
|
||||
id: string
|
||||
sourceId: string
|
||||
slug: string
|
||||
name: string
|
||||
parentTermId: string | null
|
||||
data: Record<string, unknown>
|
||||
contentEntryIds: string[]
|
||||
}
|
||||
|
||||
/** routes.json 条目(物化端已过滤:只剩可服务形态 html/asset/redirect/gone,dynamic/unresolved 不进产物) */
|
||||
export interface RouteEntry {
|
||||
host: string
|
||||
routePath: string
|
||||
routeKind: 'html' | 'asset' | 'redirect' | 'gone'
|
||||
queryPolicy: 'ignore' | 'exact' | 'preserve' | 'dynamic'
|
||||
queryKey: string | null
|
||||
targetStatus: string
|
||||
targetContentId: string | null
|
||||
targetFile: string | null
|
||||
redirectStatus: number | null
|
||||
redirectLocation: string | null
|
||||
indexable: boolean
|
||||
priority: number
|
||||
verificationStatus: string
|
||||
}
|
||||
|
||||
/** assets.json 条目(ready 资产 + 实体副本路径解析结果) */
|
||||
export interface AssetEntry {
|
||||
publicPath: string
|
||||
storagePath: string
|
||||
copyPath: string
|
||||
sha256: string
|
||||
detectedMimeType: string
|
||||
byteSize: number
|
||||
width: number | null
|
||||
height: number | null
|
||||
altText: string | null
|
||||
}
|
||||
|
||||
/** render-manifest.json 载荷(版本块 + 计数 + 三哈希 + URL 重写统计) */
|
||||
export interface RenderManifestMeta {
|
||||
renderSnapshotVersion: number
|
||||
versions: { adapter: string; mapping: string; sanitizer: string; parser: string }
|
||||
counts: { contents: number; taxonomies: number; routes: number; assets: number }
|
||||
sourceHashes: { content: string; route: string; asset: string }
|
||||
urlRewrite: { rewritten: number; unresolved: number }
|
||||
generatedAt: string
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user