()
| 99 | } |
| 100 | |
| 101 | function buildRoutes() { |
| 102 | const catalog = readCatalogIndex(); |
| 103 | const sampleLastmods = new Map(catalog.i.map(([id]) => [id, readSampleDetail(id).sourceUpdatedAt])); |
| 104 | const sampleRoutes = Array.from(sampleLastmods.entries()).map(([id, lastmod]) => ({ |
| 105 | pathname: buildSamplePath(id), |
| 106 | lastmod |
| 107 | })); |
| 108 | const patternRoutes = readPatternMappings().patterns.map((pattern) => ({ |
| 109 | pathname: buildPatternPath(pattern.id), |
| 110 | lastmod: maxLastmod([ |
| 111 | fileLastmod(patternDefinitionsPath), |
| 112 | ...pattern.sampleIds.map((sampleId) => sampleLastmod(sampleLastmods, sampleId)) |
| 113 | ]) |
| 114 | })); |
| 115 | const languageRoutes = readLanguagePages().map((page) => ({ |
| 116 | pathname: buildLanguagePath(page.slug), |
| 117 | lastmod: page.updatedAt |
| 118 | })); |
| 119 | const contentLastmod = maxLastmod([ |
| 120 | fileLastmod(featureDetailsPath), |
| 121 | fileLastmod(patternDefinitionsPath), |
| 122 | ...sampleRoutes.map((route) => route.lastmod), |
| 123 | ...patternRoutes.map((route) => route.lastmod), |
| 124 | ...languageRoutes.map((route) => route.lastmod) |
| 125 | ]); |
| 126 | |
| 127 | return [ |
| 128 | { pathname: '/', lastmod: contentLastmod }, |
| 129 | { pathname: '/patterns/', lastmod: contentLastmod }, |
| 130 | { pathname: '/feature-map/', lastmod: contentLastmod }, |
| 131 | ...patternRoutes, |
| 132 | ...languageRoutes, |
| 133 | ...sampleRoutes |
| 134 | ] satisfies SitemapRoute[]; |
| 135 | } |
| 136 | |
| 137 | function escapeXml(value: string) { |
| 138 | return value |
no test coverage detected