@emeryld/rrroutes-export 1.0.24 → 1.0.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +22 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +22 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/tools/finalized-leaves-viewer.html +93 -20
package/package.json
CHANGED
|
@@ -423,6 +423,24 @@
|
|
|
423
423
|
.changelog-schema-type {
|
|
424
424
|
color: var(--schema-accent);
|
|
425
425
|
}
|
|
426
|
+
.changelog-schema-details {
|
|
427
|
+
margin-top: 6px;
|
|
428
|
+
}
|
|
429
|
+
.changelog-schema-details > summary {
|
|
430
|
+
color: var(--schema-accent);
|
|
431
|
+
font-size: 12px;
|
|
432
|
+
}
|
|
433
|
+
.changelog-schema-details-body {
|
|
434
|
+
margin-top: 6px;
|
|
435
|
+
display: grid;
|
|
436
|
+
gap: 4px;
|
|
437
|
+
}
|
|
438
|
+
.changelog-schema-line > summary {
|
|
439
|
+
font-size: 12px;
|
|
440
|
+
}
|
|
441
|
+
.changelog-schema-line .meta {
|
|
442
|
+
margin-top: 4px;
|
|
443
|
+
}
|
|
426
444
|
|
|
427
445
|
.event-title-row {
|
|
428
446
|
display: inline-flex;
|
|
@@ -1849,6 +1867,23 @@
|
|
|
1849
1867
|
return basePath
|
|
1850
1868
|
}
|
|
1851
1869
|
|
|
1870
|
+
function stripSectionPrefix(path, section) {
|
|
1871
|
+
if (typeof path !== 'string' || typeof section !== 'string') return ''
|
|
1872
|
+
if (!path) return ''
|
|
1873
|
+
if (path === section) return ''
|
|
1874
|
+
if (path.startsWith(`${section}.`)) return path.slice(section.length + 1)
|
|
1875
|
+
if (path.startsWith(`${section}[]`)) return path.slice(section.length)
|
|
1876
|
+
return path
|
|
1877
|
+
}
|
|
1878
|
+
|
|
1879
|
+
function sourceSchemaLocation(section, path) {
|
|
1880
|
+
if (typeof section !== 'string' || !section) return String(path || '')
|
|
1881
|
+
const normalizedPath = stripSectionPrefix(path, section)
|
|
1882
|
+
if (!normalizedPath) return section
|
|
1883
|
+
if (normalizedPath.startsWith('[]')) return `${section}${normalizedPath}`
|
|
1884
|
+
return `${section}.${normalizedPath}`
|
|
1885
|
+
}
|
|
1886
|
+
|
|
1852
1887
|
function parseSignatureEntry(signature) {
|
|
1853
1888
|
if (typeof signature !== 'string') return null
|
|
1854
1889
|
const typeMatch = signature.match(/(?:^|,\s*)type=([^,]+)/)
|
|
@@ -1952,7 +1987,7 @@
|
|
|
1952
1987
|
function formatSchemaDiffLine(delta) {
|
|
1953
1988
|
if (!delta || typeof delta !== 'object') return null
|
|
1954
1989
|
if ('section' in delta) {
|
|
1955
|
-
const location =
|
|
1990
|
+
const location = sourceSchemaLocation(delta.section, delta.path)
|
|
1956
1991
|
if (delta.op === 'added') {
|
|
1957
1992
|
const afterType = formatSourceTypeLabel(delta.after)
|
|
1958
1993
|
if (afterType) return buildSchemaDiffLine(delta.op, afterType, location)
|
|
@@ -2029,7 +2064,7 @@
|
|
|
2029
2064
|
'<svg viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"><path d="M2 4h12"/><path d="M2 8h12"/><path d="M2 12h12"/><circle cx="6" cy="4" r="1.6" fill="currentColor" stroke="none"/><circle cx="10.5" cy="8" r="1.6" fill="currentColor" stroke="none"/><circle cx="4.5" cy="12" r="1.6" fill="currentColor" stroke="none"/></svg>',
|
|
2030
2065
|
}
|
|
2031
2066
|
|
|
2032
|
-
function eventVisualByType(type) {
|
|
2067
|
+
function eventVisualByType(type, eventKind) {
|
|
2033
2068
|
switch (type) {
|
|
2034
2069
|
case 'route_added':
|
|
2035
2070
|
return {
|
|
@@ -2045,7 +2080,8 @@
|
|
|
2045
2080
|
}
|
|
2046
2081
|
case 'schema_changed':
|
|
2047
2082
|
return {
|
|
2048
|
-
actionText:
|
|
2083
|
+
actionText:
|
|
2084
|
+
eventKind === 'route' ? 'modified route' : 'modified schema',
|
|
2049
2085
|
actionClass: 'event-action-modified',
|
|
2050
2086
|
icon: 'schema',
|
|
2051
2087
|
}
|
|
@@ -2104,13 +2140,61 @@
|
|
|
2104
2140
|
|
|
2105
2141
|
function renderEventTitle(item) {
|
|
2106
2142
|
const row = el('div', 'event-title-row mono')
|
|
2107
|
-
const visual = eventVisualByType(item?.event?.type)
|
|
2143
|
+
const visual = eventVisualByType(item?.event?.type, item?.eventKind)
|
|
2108
2144
|
row.appendChild(el('span', visual.actionClass, visual.actionText))
|
|
2109
2145
|
row.appendChild(renderEventIcon(visual.icon))
|
|
2110
2146
|
row.appendChild(el('span', 'event-name', `[${resolveEventName(item)}]`))
|
|
2111
2147
|
return row
|
|
2112
2148
|
}
|
|
2113
2149
|
|
|
2150
|
+
function schemaDiffRawDetail(delta) {
|
|
2151
|
+
if (!delta || typeof delta !== 'object') return ''
|
|
2152
|
+
if ('path' in delta) {
|
|
2153
|
+
const location = formatPathLabel(delta.path) || String(delta.path || '')
|
|
2154
|
+
if (delta.op === 'added') {
|
|
2155
|
+
return `added ${location}: ${formatRouteSchemaEntry(delta.after)}`
|
|
2156
|
+
}
|
|
2157
|
+
if (delta.op === 'removed') {
|
|
2158
|
+
return `removed ${location}: ${formatRouteSchemaEntry(delta.before)}`
|
|
2159
|
+
}
|
|
2160
|
+
return `changed ${location}: ${formatRouteSchemaEntry(delta.before)} -> ${formatRouteSchemaEntry(delta.after)}`
|
|
2161
|
+
}
|
|
2162
|
+
if ('section' in delta) {
|
|
2163
|
+
const location = sourceSchemaLocation(delta.section, delta.path)
|
|
2164
|
+
if (delta.op === 'added') {
|
|
2165
|
+
return `added ${location}: ${JSON.stringify(delta.after || [])}`
|
|
2166
|
+
}
|
|
2167
|
+
if (delta.op === 'removed') {
|
|
2168
|
+
return `removed ${location}: ${JSON.stringify(delta.before || [])}`
|
|
2169
|
+
}
|
|
2170
|
+
return `changed ${location}: ${JSON.stringify(delta.before || [])} -> ${JSON.stringify(delta.after || [])}`
|
|
2171
|
+
}
|
|
2172
|
+
return JSON.stringify(delta)
|
|
2173
|
+
}
|
|
2174
|
+
|
|
2175
|
+
function renderSchemaDiffNested(schemaDiff) {
|
|
2176
|
+
if (!Array.isArray(schemaDiff) || schemaDiff.length === 0) return null
|
|
2177
|
+
const wrapper = el('details', 'changelog-schema-details')
|
|
2178
|
+
wrapper.appendChild(
|
|
2179
|
+
el('summary', 'mono', `schema changes (${schemaDiff.length})`),
|
|
2180
|
+
)
|
|
2181
|
+
const body = el('div', 'changelog-schema-details-body')
|
|
2182
|
+
schemaDiff.forEach((delta) => {
|
|
2183
|
+
const lineNode = formatSchemaDiffLine(delta)
|
|
2184
|
+
if (!lineNode) return
|
|
2185
|
+
const lineDetails = el('details', 'changelog-schema-line')
|
|
2186
|
+
const lineSummary = el('summary')
|
|
2187
|
+
lineSummary.appendChild(lineNode)
|
|
2188
|
+
lineDetails.appendChild(lineSummary)
|
|
2189
|
+
lineDetails.appendChild(
|
|
2190
|
+
el('div', 'meta mono', schemaDiffRawDetail(delta)),
|
|
2191
|
+
)
|
|
2192
|
+
body.appendChild(lineDetails)
|
|
2193
|
+
})
|
|
2194
|
+
wrapper.appendChild(body)
|
|
2195
|
+
return wrapper
|
|
2196
|
+
}
|
|
2197
|
+
|
|
2114
2198
|
function renderEventCard(event, commitBySha, options = {}) {
|
|
2115
2199
|
const card = el('div', 'leaf-content')
|
|
2116
2200
|
const commit = commitBySha.get(event.commitSha)
|
|
@@ -2128,16 +2212,8 @@
|
|
|
2128
2212
|
card.appendChild(renderEventTitle(options.item))
|
|
2129
2213
|
}
|
|
2130
2214
|
if (Array.isArray(event.schemaDiff) && event.schemaDiff.length > 0) {
|
|
2131
|
-
|
|
2132
|
-
|
|
2133
|
-
)
|
|
2134
|
-
const schemaChanges = el('div')
|
|
2135
|
-
event.schemaDiff.forEach((delta) => {
|
|
2136
|
-
const lineNode = formatSchemaDiffLine(delta)
|
|
2137
|
-
if (!lineNode) return
|
|
2138
|
-
schemaChanges.appendChild(lineNode)
|
|
2139
|
-
})
|
|
2140
|
-
card.appendChild(schemaChanges)
|
|
2215
|
+
const schemaDetails = renderSchemaDiffNested(event.schemaDiff)
|
|
2216
|
+
if (schemaDetails) card.appendChild(schemaDetails)
|
|
2141
2217
|
}
|
|
2142
2218
|
if (Array.isArray(event.cfgDiff) && event.cfgDiff.length > 0) {
|
|
2143
2219
|
card.appendChild(
|
|
@@ -2234,11 +2310,8 @@
|
|
|
2234
2310
|
row.appendChild(renderEventTitle(item))
|
|
2235
2311
|
|
|
2236
2312
|
if (Array.isArray(event.schemaDiff) && event.schemaDiff.length > 0) {
|
|
2237
|
-
event.schemaDiff
|
|
2238
|
-
|
|
2239
|
-
if (!lineNode) return
|
|
2240
|
-
row.appendChild(lineNode)
|
|
2241
|
-
})
|
|
2313
|
+
const schemaDetails = renderSchemaDiffNested(event.schemaDiff)
|
|
2314
|
+
if (schemaDetails) row.appendChild(schemaDetails)
|
|
2242
2315
|
}
|
|
2243
2316
|
if (Array.isArray(event.cfgDiff) && event.cfgDiff.length > 0) {
|
|
2244
2317
|
event.cfgDiff.forEach((diff) => {
|
|
@@ -2329,7 +2402,7 @@
|
|
|
2329
2402
|
return { op, location, before, after }
|
|
2330
2403
|
}
|
|
2331
2404
|
if ('section' in delta) {
|
|
2332
|
-
const location =
|
|
2405
|
+
const location = sourceSchemaLocation(delta.section, delta.path)
|
|
2333
2406
|
const before = Array.isArray(delta.before)
|
|
2334
2407
|
? delta.before.map((item) => normalizeSignatureToken(item)).filter(Boolean)
|
|
2335
2408
|
: []
|