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.
- package/README.md +21 -60
- package/esm/deno.js +1 -1
- package/esm/src/cli/app/components/list-select.js +2 -2
- package/esm/src/cli/app/index.d.ts +1 -1
- package/esm/src/cli/app/index.d.ts.map +1 -1
- package/esm/src/cli/app/index.js +26 -33
- package/esm/src/cli/app/state.d.ts +3 -0
- package/esm/src/cli/app/state.d.ts.map +1 -1
- package/esm/src/cli/app/state.js +4 -0
- package/esm/src/cli/app/views/dashboard.d.ts.map +1 -1
- package/esm/src/cli/app/views/dashboard.js +46 -58
- package/esm/src/cli/app/views/startup.d.ts +39 -0
- package/esm/src/cli/app/views/startup.d.ts.map +1 -0
- package/esm/src/cli/app/views/startup.js +103 -0
- package/esm/src/cli/commands/dev.js +2 -2
- package/esm/src/cli/commands/new.js +1 -1
- package/esm/src/cli/ui/colors.d.ts +8 -0
- package/esm/src/cli/ui/colors.d.ts.map +1 -1
- package/esm/src/cli/ui/colors.js +34 -0
- package/esm/src/cli/ui/dot-matrix.d.ts +8 -0
- package/esm/src/cli/ui/dot-matrix.d.ts.map +1 -1
- package/esm/src/cli/ui/dot-matrix.js +67 -2
- package/esm/src/cli/ui/tui.js +1 -1
- package/esm/src/modules/react-loader/ssr-module-loader/loader.d.ts.map +1 -1
- package/esm/src/modules/react-loader/ssr-module-loader/loader.js +28 -6
- package/esm/src/transforms/esm/http-cache.d.ts.map +1 -1
- package/esm/src/transforms/esm/http-cache.js +25 -17
- package/package.json +1 -1
- package/src/deno.js +1 -1
- package/src/src/cli/app/components/list-select.ts +2 -2
- package/src/src/cli/app/index.ts +34 -35
- package/src/src/cli/app/state.ts +7 -0
- package/src/src/cli/app/views/dashboard.ts +47 -61
- package/src/src/cli/app/views/startup.ts +132 -0
- package/src/src/cli/commands/dev.ts +2 -2
- package/src/src/cli/commands/new.ts +1 -1
- package/src/src/cli/ui/colors.ts +37 -0
- package/src/src/cli/ui/dot-matrix.ts +77 -1
- package/src/src/cli/ui/tui.ts +1 -1
- package/src/src/modules/react-loader/ssr-module-loader/loader.ts +43 -30
- 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
|
-
//
|
|
198
|
-
//
|
|
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
|
-
|
|
204
|
-
|
|
205
|
-
|
|
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
|
|
208
|
-
|
|
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,
|
|
292
|
-
distributed.set(`code:${hash}`, code,
|
|
293
|
-
distributed.set(`hash:${hash}`, normalizedUrl,
|
|
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 });
|