@emeryld/rrroutes-export 1.0.23 → 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/exportFinalizedLeaves.changelog.d.ts +1 -0
- package/dist/index.cjs +36 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +36 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/tools/finalized-leaves-viewer.html +106 -22
|
@@ -32,6 +32,7 @@ type CommitSnapshot = {
|
|
|
32
32
|
commit: ChangelogCommit;
|
|
33
33
|
routesByKey: Record<string, RouteSnapshot>;
|
|
34
34
|
sourceObjectsById: Record<string, SourceObjectSnapshot>;
|
|
35
|
+
missing?: boolean;
|
|
35
36
|
unresolvedModule?: boolean;
|
|
36
37
|
fallbackReason?: 'module_unresolved' | 'snapshot_error';
|
|
37
38
|
fallbackError?: string;
|
package/dist/index.cjs
CHANGED
|
@@ -1827,6 +1827,19 @@ function flattenSourceSections(snapshot) {
|
|
|
1827
1827
|
}
|
|
1828
1828
|
return map;
|
|
1829
1829
|
}
|
|
1830
|
+
function emptySourceSnapshotLike(snapshot) {
|
|
1831
|
+
return {
|
|
1832
|
+
id: snapshot.id,
|
|
1833
|
+
displayName: snapshot.displayName,
|
|
1834
|
+
routeKeys: [],
|
|
1835
|
+
sections: {
|
|
1836
|
+
params: {},
|
|
1837
|
+
query: {},
|
|
1838
|
+
body: {},
|
|
1839
|
+
output: {}
|
|
1840
|
+
}
|
|
1841
|
+
};
|
|
1842
|
+
}
|
|
1830
1843
|
function diffSourceSchemas(before, after) {
|
|
1831
1844
|
const prev = flattenSourceSections(before);
|
|
1832
1845
|
const next = flattenSourceSections(after);
|
|
@@ -2204,6 +2217,7 @@ async function createSnapshot(repoRoot, moduleCandidates, exportName, commit, te
|
|
|
2204
2217
|
commit,
|
|
2205
2218
|
routesByKey: {},
|
|
2206
2219
|
sourceObjectsById: {},
|
|
2220
|
+
missing: true,
|
|
2207
2221
|
fallbackReason: "snapshot_error",
|
|
2208
2222
|
fallbackError: message
|
|
2209
2223
|
};
|
|
@@ -2224,12 +2238,14 @@ function diffSnapshots(previous, current) {
|
|
|
2224
2238
|
const prevRoute = previous.routesByKey[routeKey];
|
|
2225
2239
|
const nextRoute = current.routesByKey[routeKey];
|
|
2226
2240
|
if (!prevRoute && nextRoute) {
|
|
2241
|
+
const schemaDiff2 = diffRouteSchemas({}, nextRoute.flatSchema);
|
|
2227
2242
|
routeEvents.push({
|
|
2228
2243
|
type: "route_added",
|
|
2229
2244
|
commitSha: current.commit.sha,
|
|
2230
2245
|
routeKey,
|
|
2231
2246
|
method: nextRoute.method,
|
|
2232
|
-
path: nextRoute.path
|
|
2247
|
+
path: nextRoute.path,
|
|
2248
|
+
schemaDiff: schemaDiff2.length > 0 ? schemaDiff2 : void 0
|
|
2233
2249
|
});
|
|
2234
2250
|
continue;
|
|
2235
2251
|
}
|
|
@@ -2275,12 +2291,17 @@ function diffSnapshots(previous, current) {
|
|
|
2275
2291
|
const prevSource = previous.sourceObjectsById[sourceObjectId];
|
|
2276
2292
|
const nextSource = current.sourceObjectsById[sourceObjectId];
|
|
2277
2293
|
if (!prevSource && nextSource) {
|
|
2294
|
+
const schemaDiff2 = diffSourceSchemas(
|
|
2295
|
+
emptySourceSnapshotLike(nextSource),
|
|
2296
|
+
nextSource
|
|
2297
|
+
);
|
|
2278
2298
|
sourceEvents.push({
|
|
2279
2299
|
type: "source_object_added",
|
|
2280
2300
|
commitSha: current.commit.sha,
|
|
2281
2301
|
sourceObjectId,
|
|
2282
2302
|
displayName: nextSource.displayName,
|
|
2283
|
-
impactedRoutes: nextSource.routeKeys
|
|
2303
|
+
impactedRoutes: nextSource.routeKeys,
|
|
2304
|
+
schemaDiff: schemaDiff2.length > 0 ? schemaDiff2 : void 0
|
|
2284
2305
|
});
|
|
2285
2306
|
continue;
|
|
2286
2307
|
}
|
|
@@ -2495,14 +2516,23 @@ async function exportFinalizedLeavesChangelog(options) {
|
|
|
2495
2516
|
}
|
|
2496
2517
|
const routeEvents = [];
|
|
2497
2518
|
const sourceEvents = [];
|
|
2498
|
-
log("[changelog] diffing
|
|
2499
|
-
|
|
2519
|
+
log("[changelog] diffing successful snapshots");
|
|
2520
|
+
let previousSnapshot;
|
|
2521
|
+
for (const snapshot of snapshots) {
|
|
2522
|
+
if (snapshot.missing) {
|
|
2523
|
+
continue;
|
|
2524
|
+
}
|
|
2525
|
+
if (!previousSnapshot) {
|
|
2526
|
+
previousSnapshot = snapshot;
|
|
2527
|
+
continue;
|
|
2528
|
+
}
|
|
2500
2529
|
const { routeEvents: nextRouteEvents, sourceEvents: nextSourceEvents } = diffSnapshots(
|
|
2501
|
-
|
|
2502
|
-
|
|
2530
|
+
previousSnapshot,
|
|
2531
|
+
snapshot
|
|
2503
2532
|
);
|
|
2504
2533
|
routeEvents.push(...nextRouteEvents);
|
|
2505
2534
|
sourceEvents.push(...nextSourceEvents);
|
|
2535
|
+
previousSnapshot = snapshot;
|
|
2506
2536
|
}
|
|
2507
2537
|
log(
|
|
2508
2538
|
`[changelog] diff complete: route events=${routeEvents.length}, source events=${sourceEvents.length}`
|