storyforge 0.4.15 → 0.4.16
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.js +8 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -866,8 +866,16 @@ async function devCommand(options) {
|
|
|
866
866
|
const pathname = url.pathname;
|
|
867
867
|
if (pathname === "/api/cli-usage") {
|
|
868
868
|
try {
|
|
869
|
+
const cached = global.__forgeCliUsageCache;
|
|
870
|
+
const now = Date.now();
|
|
871
|
+
if (cached && now - cached.at < 3e4) {
|
|
872
|
+
res.writeHead(200, { ...CORS_HEADERS, "Content-Type": "application/json" });
|
|
873
|
+
res.end(JSON.stringify(cached.data));
|
|
874
|
+
return;
|
|
875
|
+
}
|
|
869
876
|
const { gatherCliUsage } = await import("./cli-usage-OFFQXJQN.js");
|
|
870
877
|
const report = await gatherCliUsage();
|
|
878
|
+
global.__forgeCliUsageCache = { at: now, data: report };
|
|
871
879
|
res.writeHead(200, { ...CORS_HEADERS, "Content-Type": "application/json" });
|
|
872
880
|
res.end(JSON.stringify(report));
|
|
873
881
|
} catch (err) {
|