veryfront 0.0.83 → 0.0.86

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.
Files changed (41) hide show
  1. package/README.md +21 -60
  2. package/esm/deno.js +1 -1
  3. package/esm/src/cli/app/components/list-select.js +2 -2
  4. package/esm/src/cli/app/index.d.ts +1 -1
  5. package/esm/src/cli/app/index.d.ts.map +1 -1
  6. package/esm/src/cli/app/index.js +26 -33
  7. package/esm/src/cli/app/state.d.ts +3 -0
  8. package/esm/src/cli/app/state.d.ts.map +1 -1
  9. package/esm/src/cli/app/state.js +4 -0
  10. package/esm/src/cli/app/views/dashboard.d.ts.map +1 -1
  11. package/esm/src/cli/app/views/dashboard.js +46 -58
  12. package/esm/src/cli/app/views/startup.d.ts +39 -0
  13. package/esm/src/cli/app/views/startup.d.ts.map +1 -0
  14. package/esm/src/cli/app/views/startup.js +103 -0
  15. package/esm/src/cli/commands/dev.js +2 -2
  16. package/esm/src/cli/commands/new.js +1 -1
  17. package/esm/src/cli/ui/colors.d.ts +8 -0
  18. package/esm/src/cli/ui/colors.d.ts.map +1 -1
  19. package/esm/src/cli/ui/colors.js +34 -0
  20. package/esm/src/cli/ui/dot-matrix.d.ts +8 -0
  21. package/esm/src/cli/ui/dot-matrix.d.ts.map +1 -1
  22. package/esm/src/cli/ui/dot-matrix.js +67 -2
  23. package/esm/src/cli/ui/tui.js +1 -1
  24. package/esm/src/modules/react-loader/ssr-module-loader/loader.d.ts.map +1 -1
  25. package/esm/src/modules/react-loader/ssr-module-loader/loader.js +28 -6
  26. package/esm/src/transforms/esm/http-cache.d.ts.map +1 -1
  27. package/esm/src/transforms/esm/http-cache.js +25 -17
  28. package/package.json +1 -1
  29. package/src/deno.js +1 -1
  30. package/src/src/cli/app/components/list-select.ts +2 -2
  31. package/src/src/cli/app/index.ts +34 -35
  32. package/src/src/cli/app/state.ts +7 -0
  33. package/src/src/cli/app/views/dashboard.ts +47 -61
  34. package/src/src/cli/app/views/startup.ts +132 -0
  35. package/src/src/cli/commands/dev.ts +2 -2
  36. package/src/src/cli/commands/new.ts +1 -1
  37. package/src/src/cli/ui/colors.ts +37 -0
  38. package/src/src/cli/ui/dot-matrix.ts +77 -1
  39. package/src/src/cli/ui/tui.ts +1 -1
  40. package/src/src/modules/react-loader/ssr-module-loader/loader.ts +43 -30
  41. package/src/src/transforms/esm/http-cache.ts +26 -17
@@ -34,9 +34,6 @@ const getDistributedCache = createDistributedCacheAccessor(
34
34
  "HTTP-CACHE",
35
35
  );
36
36
 
37
- /** TTL for cached modules in distributed cache (uses centralized config) */
38
- const DISTRIBUTED_CACHE_TTL_SECONDS = HTTP_MODULE_DISTRIBUTED_TTL_SEC;
39
-
40
37
  type CacheOptions = {
41
38
  cacheDir: string;
42
39
  importMap: ImportMapConfig;
@@ -47,6 +44,12 @@ type CacheOptions = {
47
44
  const cachedPaths = new LRUCache<string, string>({ maxEntries: HTTP_MODULE_CACHE_MAX_ENTRIES });
48
45
  const processingStack = new Set<string>();
49
46
 
47
+ /** Tracks last TTL refresh per hash. Refresh every 4h to keep 20h+ remaining (24h total). */
48
+ const lastDistributedRefresh = new LRUCache<string, number>({
49
+ maxEntries: HTTP_MODULE_CACHE_MAX_ENTRIES,
50
+ });
51
+ const DISTRIBUTED_REFRESH_INTERVAL_MS = 4 * 60 * 60 * 1000;
52
+
50
53
  function ensureAbsoluteDir(path: string): string {
51
54
  return isAbsolute(path) ? path : join(cwd(), path);
52
55
  }
@@ -194,22 +197,28 @@ async function cacheHttpModule(url: string, options: CacheOptions): Promise<stri
194
197
  if (await exists(cachePath)) {
195
198
  cachedPaths.set(cacheKey, cachePath);
196
199
 
197
- // Synchronously ensure code:{hash} exists in distributed cache for cross-pod recovery
198
- // This backfills bundles created before code:{hash} storage was added
199
- // Synchronous to guarantee data is stored before other pods need it
200
+ // Refresh distributed cache TTL so bundles outlive transforms that reference them.
201
+ // Without this, bundles expire (24h) while SSR transforms (6h) are still valid.
200
202
  const distributed = await getDistributedCache();
201
203
  if (distributed) {
202
204
  const hash = simpleHash(normalizedUrl);
203
- try {
204
- const hasCode = await distributed.get(`code:${hash}`);
205
- if (!hasCode) {
205
+ const hashStr = String(hash);
206
+ const now = Date.now();
207
+ const lastRefresh = lastDistributedRefresh.get(hashStr);
208
+ const needsRefresh = !lastRefresh || (now - lastRefresh > DISTRIBUTED_REFRESH_INTERVAL_MS);
209
+
210
+ if (needsRefresh) {
211
+ try {
206
212
  const code = await fs.readTextFile(cachePath);
207
- await distributed.set(`code:${hash}`, code, DISTRIBUTED_CACHE_TTL_SECONDS);
208
- logger.info("[HTTP-CACHE] Backfilled code:{hash} for existing bundle", { hash });
213
+ await Promise.all([
214
+ distributed.set(`code:${hash}`, code, HTTP_MODULE_DISTRIBUTED_TTL_SEC),
215
+ distributed.set(`hash:${hash}`, normalizedUrl, HTTP_MODULE_DISTRIBUTED_TTL_SEC),
216
+ ]);
217
+ lastDistributedRefresh.set(hashStr, now);
218
+ logger.debug("[HTTP-CACHE] Refreshed distributed cache TTL", { hash });
219
+ } catch (error) {
220
+ logger.debug("[HTTP-CACHE] Distributed cache refresh failed", { hash, error });
209
221
  }
210
- } catch (error) {
211
- // Log but don't fail - backfill is best-effort
212
- logger.debug("[HTTP-CACHE] Backfill failed, continuing", { hash, error });
213
222
  }
214
223
  }
215
224
 
@@ -288,9 +297,9 @@ async function cacheHttpModule(url: string, options: CacheOptions): Promise<stri
288
297
  const hash = simpleHash(normalizedUrl);
289
298
  try {
290
299
  await Promise.all([
291
- distributed.set(normalizedUrl, code, DISTRIBUTED_CACHE_TTL_SECONDS),
292
- distributed.set(`code:${hash}`, code, DISTRIBUTED_CACHE_TTL_SECONDS),
293
- distributed.set(`hash:${hash}`, normalizedUrl, DISTRIBUTED_CACHE_TTL_SECONDS),
300
+ distributed.set(normalizedUrl, code, HTTP_MODULE_DISTRIBUTED_TTL_SEC),
301
+ distributed.set(`code:${hash}`, code, HTTP_MODULE_DISTRIBUTED_TTL_SEC),
302
+ distributed.set(`hash:${hash}`, normalizedUrl, HTTP_MODULE_DISTRIBUTED_TTL_SEC),
294
303
  ]);
295
304
  } catch (error) {
296
305
  logger.debug("[HTTP-CACHE] Distributed cache set failed", { url: normalizedUrl, error });