veryfront 0.1.86 → 0.1.88
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/esm/deno.js +1 -1
- package/esm/src/cache/distributed-cache-init.d.ts +9 -0
- package/esm/src/cache/distributed-cache-init.d.ts.map +1 -1
- package/esm/src/cache/distributed-cache-init.js +70 -52
- package/esm/src/cache/module-cache.d.ts +6 -2
- package/esm/src/cache/module-cache.d.ts.map +1 -1
- package/esm/src/cache/module-cache.js +73 -56
- package/esm/src/platform/adapters/fs/veryfront/content-metrics.d.ts +1 -1
- package/esm/src/platform/adapters/fs/veryfront/content-metrics.d.ts.map +1 -1
- package/esm/src/platform/adapters/fs/veryfront/content-metrics.js +7 -1
- package/esm/src/platform/adapters/fs/veryfront/file-list-index.d.ts +10 -0
- package/esm/src/platform/adapters/fs/veryfront/file-list-index.d.ts.map +1 -1
- package/esm/src/platform/adapters/fs/veryfront/file-list-index.js +83 -19
- package/esm/src/platform/adapters/fs/veryfront/read-operations-helpers.d.ts +5 -0
- package/esm/src/platform/adapters/fs/veryfront/read-operations-helpers.d.ts.map +1 -1
- package/esm/src/platform/adapters/fs/veryfront/read-operations-helpers.js +6 -0
- package/esm/src/platform/adapters/fs/veryfront/read-operations.d.ts.map +1 -1
- package/esm/src/platform/adapters/fs/veryfront/read-operations.js +53 -34
- package/esm/src/rendering/page-resolution/page-resolver.d.ts.map +1 -1
- package/esm/src/rendering/page-resolution/page-resolver.js +10 -4
- package/esm/src/transforms/esm/http-cache-wrapper.d.ts +3 -0
- package/esm/src/transforms/esm/http-cache-wrapper.d.ts.map +1 -1
- package/esm/src/transforms/esm/http-cache-wrapper.js +21 -7
- package/esm/src/utils/version.d.ts +1 -1
- package/esm/src/utils/version.js +1 -1
- package/package.json +1 -1
- package/src/deno.js +1 -1
- package/src/src/cache/distributed-cache-init.ts +95 -59
- package/src/src/cache/module-cache.ts +95 -57
- package/src/src/platform/adapters/fs/veryfront/content-metrics.ts +13 -2
- package/src/src/platform/adapters/fs/veryfront/file-list-index.ts +101 -18
- package/src/src/platform/adapters/fs/veryfront/read-operations-helpers.ts +10 -0
- package/src/src/platform/adapters/fs/veryfront/read-operations.ts +87 -30
- package/src/src/rendering/page-resolution/page-resolver.ts +17 -6
- package/src/src/transforms/esm/http-cache-wrapper.ts +28 -7
- package/src/src/utils/version.ts +1 -1
|
@@ -86,15 +86,26 @@ export class PageResolver {
|
|
|
86
86
|
primeRouterDetectionCache(cacheKey, "pages");
|
|
87
87
|
}
|
|
88
88
|
} else {
|
|
89
|
-
// Auto mode stays structural:
|
|
90
|
-
//
|
|
91
|
-
|
|
89
|
+
// Auto mode stays structural: detect the dominant router once, then keep
|
|
90
|
+
// pages fallback available for mixed or in-transition projects.
|
|
91
|
+
const useAppRouter = await detectAppRouter(
|
|
92
92
|
this.projectDir,
|
|
93
|
-
|
|
93
|
+
this.config,
|
|
94
94
|
this.adapter,
|
|
95
|
-
|
|
95
|
+
{ projectId: this.projectId },
|
|
96
96
|
);
|
|
97
|
-
|
|
97
|
+
|
|
98
|
+
if (useAppRouter) {
|
|
99
|
+
pageInfo = await getAppRouteEntity(
|
|
100
|
+
this.projectDir,
|
|
101
|
+
slug,
|
|
102
|
+
this.adapter,
|
|
103
|
+
appDirName,
|
|
104
|
+
);
|
|
105
|
+
if (!pageInfo) {
|
|
106
|
+
pageInfo = await getEntityBySlug(this.projectDir, slug, this.adapter);
|
|
107
|
+
}
|
|
108
|
+
} else {
|
|
98
109
|
pageInfo = await getEntityBySlug(this.projectDir, slug, this.adapter);
|
|
99
110
|
}
|
|
100
111
|
}
|
|
@@ -16,6 +16,7 @@ import { rendererLogger } from "../../utils/index.js";
|
|
|
16
16
|
import { VERSION } from "../../utils/version.js";
|
|
17
17
|
import { getCacheBaseDir } from "../../utils/cache-dir.js";
|
|
18
18
|
import { CacheBackends, createDistributedCacheAccessor } from "../../cache/backend.js";
|
|
19
|
+
import type { CacheBackend } from "../../cache/types.js";
|
|
19
20
|
import { HTTP_MODULE_DISTRIBUTED_TTL_SEC } from "../../utils/constants/cache.js";
|
|
20
21
|
import type {
|
|
21
22
|
BundleHash,
|
|
@@ -44,6 +45,26 @@ const getDistributedCache = createDistributedCacheAccessor(
|
|
|
44
45
|
"HTTP-CACHE-WRAPPER",
|
|
45
46
|
);
|
|
46
47
|
|
|
48
|
+
let testDistributedCacheAccessor: (() => Promise<CacheBackend | null>) | null = null;
|
|
49
|
+
|
|
50
|
+
function resolveDistributedCache(): Promise<CacheBackend | null> {
|
|
51
|
+
return testDistributedCacheAccessor ? testDistributedCacheAccessor() : getDistributedCache();
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function __setDistributedCacheAccessorForTests(
|
|
55
|
+
accessor: (() => Promise<CacheBackend | null>) | null,
|
|
56
|
+
): void {
|
|
57
|
+
testDistributedCacheAccessor = accessor;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export async function initializeHttpModuleDistributedCache(): Promise<boolean> {
|
|
61
|
+
const distributed = await resolveDistributedCache();
|
|
62
|
+
if (!distributed) return false;
|
|
63
|
+
|
|
64
|
+
logger.info("Initialized distributed cache backend", { backend: distributed.type });
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
|
|
47
68
|
/**
|
|
48
69
|
* Generate versioned cache key for HTTP bundles.
|
|
49
70
|
* Format: {VERSION}:{prefix}:{hash}
|
|
@@ -158,7 +179,7 @@ class HttpBundleCache {
|
|
|
158
179
|
* @returns Result containing local code or failure reason
|
|
159
180
|
*/
|
|
160
181
|
async getCodeByHash(hash: BundleHash | string): Promise<GetCodeResult> {
|
|
161
|
-
const distributed = await
|
|
182
|
+
const distributed = await resolveDistributedCache();
|
|
162
183
|
if (!distributed) {
|
|
163
184
|
return { code: null, wasGzipped: false, failReason: "not_found" };
|
|
164
185
|
}
|
|
@@ -214,7 +235,7 @@ class HttpBundleCache {
|
|
|
214
235
|
* @returns Result containing local code or failure reason
|
|
215
236
|
*/
|
|
216
237
|
async getCodeByUrl(hash: BundleHash | string): Promise<GetCodeResult> {
|
|
217
|
-
const distributed = await
|
|
238
|
+
const distributed = await resolveDistributedCache();
|
|
218
239
|
if (!distributed) {
|
|
219
240
|
return { code: null, wasGzipped: false, failReason: "not_found" };
|
|
220
241
|
}
|
|
@@ -265,7 +286,7 @@ class HttpBundleCache {
|
|
|
265
286
|
url: NormalizedUrl | string,
|
|
266
287
|
ttl: number = HTTP_MODULE_DISTRIBUTED_TTL_SEC,
|
|
267
288
|
): Promise<void> {
|
|
268
|
-
const distributed = await
|
|
289
|
+
const distributed = await resolveDistributedCache();
|
|
269
290
|
if (!distributed) return;
|
|
270
291
|
|
|
271
292
|
const hashStr = typeof hash === "string" ? hash : (hash as unknown as string);
|
|
@@ -305,7 +326,7 @@ class HttpBundleCache {
|
|
|
305
326
|
async getBatchCodes(
|
|
306
327
|
hashes: Array<BundleHash | string>,
|
|
307
328
|
): Promise<Map<string, LocalModuleCode>> {
|
|
308
|
-
const distributed = await
|
|
329
|
+
const distributed = await resolveDistributedCache();
|
|
309
330
|
if (!distributed) return new Map();
|
|
310
331
|
|
|
311
332
|
const results = new Map<string, LocalModuleCode>();
|
|
@@ -357,7 +378,7 @@ class HttpBundleCache {
|
|
|
357
378
|
* @returns Original URL or null
|
|
358
379
|
*/
|
|
359
380
|
async getOriginalUrl(hash: BundleHash | string): Promise<string | null> {
|
|
360
|
-
const distributed = await
|
|
381
|
+
const distributed = await resolveDistributedCache();
|
|
361
382
|
if (!distributed) return null;
|
|
362
383
|
|
|
363
384
|
const hashStr = typeof hash === "string" ? hash : (hash as unknown as string);
|
|
@@ -378,7 +399,7 @@ class HttpBundleCache {
|
|
|
378
399
|
* @returns true if deletion was attempted, false if cache unavailable
|
|
379
400
|
*/
|
|
380
401
|
async deleteCode(hash: BundleHash | string): Promise<boolean> {
|
|
381
|
-
const distributed = await
|
|
402
|
+
const distributed = await resolveDistributedCache();
|
|
382
403
|
if (!distributed) return false;
|
|
383
404
|
|
|
384
405
|
const hashStr = typeof hash === "string" ? hash : (hash as unknown as string);
|
|
@@ -403,7 +424,7 @@ class HttpBundleCache {
|
|
|
403
424
|
* Check if distributed cache is available.
|
|
404
425
|
*/
|
|
405
426
|
async isAvailable(): Promise<boolean> {
|
|
406
|
-
const distributed = await
|
|
427
|
+
const distributed = await resolveDistributedCache();
|
|
407
428
|
return distributed !== null;
|
|
408
429
|
}
|
|
409
430
|
}
|
package/src/src/utils/version.ts
CHANGED