@0x1f320.sh/why-did-you-render-mcp 1.0.0-dev.16 → 1.0.0-dev.17
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/server/index.js +24 -4
- package/package.json +1 -1
package/dist/server/index.js
CHANGED
|
@@ -117,7 +117,8 @@ function toResult(stored) {
|
|
|
117
117
|
displayName: stored.displayName,
|
|
118
118
|
reason: stored.reason,
|
|
119
119
|
...stored.hookName != null && { hookName: stored.hookName },
|
|
120
|
-
...stored.commitId != null && { commitId: stored.commitId }
|
|
120
|
+
...stored.commitId != null && { commitId: stored.commitId },
|
|
121
|
+
...stored.timestamp != null && { timestamp: stored.timestamp }
|
|
121
122
|
};
|
|
122
123
|
}
|
|
123
124
|
//#endregion
|
|
@@ -139,6 +140,7 @@ var RenderStore = class {
|
|
|
139
140
|
const stored = {
|
|
140
141
|
...report,
|
|
141
142
|
projectId,
|
|
143
|
+
timestamp: Date.now(),
|
|
142
144
|
...commitId != null && { commitId }
|
|
143
145
|
};
|
|
144
146
|
const bk = this.bufferKey(projectId, commitId);
|
|
@@ -292,6 +294,24 @@ var RenderStore = class {
|
|
|
292
294
|
}
|
|
293
295
|
return [...ids].sort((a, b) => a - b);
|
|
294
296
|
}
|
|
297
|
+
getCommits(projectId) {
|
|
298
|
+
this.flush(projectId);
|
|
299
|
+
const files = projectId ? this.projectFiles(projectId) : this.jsonlFiles();
|
|
300
|
+
const commits = [];
|
|
301
|
+
for (const f of files) {
|
|
302
|
+
const parsed = this.parseFilename(f);
|
|
303
|
+
if (parsed?.commitId == null) continue;
|
|
304
|
+
const renders = readJsonl(join(this.dir, f));
|
|
305
|
+
if (renders.length === 0) continue;
|
|
306
|
+
commits.push({
|
|
307
|
+
commitId: parsed.commitId,
|
|
308
|
+
timestamp: renders.find((r) => r.timestamp != null)?.timestamp ?? null,
|
|
309
|
+
renderCount: renders.length,
|
|
310
|
+
components: [...new Set(renders.map((r) => r.displayName))]
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
return commits.sort((a, b) => a.commitId - b.commitId);
|
|
314
|
+
}
|
|
295
315
|
getRendersByCommit(commitId, projectId) {
|
|
296
316
|
if (projectId) {
|
|
297
317
|
this.flush(projectId, commitId);
|
|
@@ -476,9 +496,9 @@ function register$5(server) {
|
|
|
476
496
|
}, async ({ project }) => {
|
|
477
497
|
const resolved = resolveProject(project);
|
|
478
498
|
if (resolved.error) return textResult(resolved.error);
|
|
479
|
-
const
|
|
480
|
-
if (
|
|
481
|
-
return textResult(JSON.stringify(
|
|
499
|
+
const commits = store.getCommits(resolved.projectId);
|
|
500
|
+
if (commits.length === 0) return textResult("No commits recorded yet. Make sure the browser is connected and triggering re-renders.");
|
|
501
|
+
return textResult(JSON.stringify(commits, null, 2));
|
|
482
502
|
});
|
|
483
503
|
}
|
|
484
504
|
//#endregion
|
package/package.json
CHANGED