veryfront 0.1.164 → 0.1.167
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/platform/adapters/fs/veryfront/adapter.d.ts +3 -0
- package/esm/src/platform/adapters/fs/veryfront/adapter.d.ts.map +1 -1
- package/esm/src/platform/adapters/fs/veryfront/adapter.js +39 -59
- package/esm/src/rendering/orchestrator/pipeline.d.ts +1 -0
- package/esm/src/rendering/orchestrator/pipeline.d.ts.map +1 -1
- package/esm/src/rendering/orchestrator/pipeline.js +4 -1
- package/esm/src/routing/api/module-loader/loader.d.ts +1 -0
- package/esm/src/routing/api/module-loader/loader.d.ts.map +1 -1
- package/esm/src/routing/api/module-loader/loader.js +9 -8
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/package.json +1 -1
- package/src/deno.js +1 -1
- package/src/src/platform/adapters/fs/veryfront/adapter.ts +68 -85
- package/src/src/rendering/orchestrator/pipeline.ts +18 -2
- package/src/src/routing/api/module-loader/loader.ts +24 -20
- package/src/src/utils/version-constant.ts +1 -1
package/esm/deno.js
CHANGED
|
@@ -29,6 +29,9 @@ export declare class VeryfrontFSAdapter implements FSAdapter {
|
|
|
29
29
|
private contentContext;
|
|
30
30
|
/** Whether running in proxy mode (shared adapter with per-request OAuth tokens) */
|
|
31
31
|
private proxyMode;
|
|
32
|
+
private getCurrentFileListCacheKey;
|
|
33
|
+
private getCachedFileListSync;
|
|
34
|
+
private getCachedFileListAsync;
|
|
32
35
|
constructor(config: FSAdapterConfig);
|
|
33
36
|
initialize(): Promise<void>;
|
|
34
37
|
private isPersistentCacheInvalidated;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../../../../../../src/src/platform/adapters/fs/veryfront/adapter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,UAAU,EAEV,cAAc,EACd,S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IAAI,GAAG,IAAI;IAK7C,gBAAgB,IAAI,MAAM,GAAG,IAAI;IAIjC,kBAAkB,IAAI,IAAI;IAK1B,iBAAiB,CAAC,OAAO,EAAE,sBAAsB,GAAG,IAAI;IAoCxD,iBAAiB,IAAI,sBAAsB,GAAG,IAAI;IAWlD,SAAS,IAAI,kBAAkB;YAIjB,iBAAiB;IAK/B;;;;;OAKG;YACW,uBAAuB;CAgFtC"}
|
|
@@ -44,6 +44,33 @@ export class VeryfrontFSAdapter {
|
|
|
44
44
|
contentContext = null;
|
|
45
45
|
/** Whether running in proxy mode (shared adapter with per-request OAuth tokens) */
|
|
46
46
|
proxyMode;
|
|
47
|
+
getCurrentFileListCacheKey() {
|
|
48
|
+
return this.contentContext ? buildFileListCacheKey(this.contentContext) : undefined;
|
|
49
|
+
}
|
|
50
|
+
getCachedFileListSync() {
|
|
51
|
+
const cacheKey = this.getCurrentFileListCacheKey();
|
|
52
|
+
if (!cacheKey)
|
|
53
|
+
return undefined;
|
|
54
|
+
return this.cache.get(cacheKey);
|
|
55
|
+
}
|
|
56
|
+
async getCachedFileListAsync(noContextMessage, lookupLabel, missReason) {
|
|
57
|
+
const cacheKey = this.getCurrentFileListCacheKey();
|
|
58
|
+
if (!cacheKey) {
|
|
59
|
+
logger.debug(noContextMessage);
|
|
60
|
+
return undefined;
|
|
61
|
+
}
|
|
62
|
+
const files = await this.cache.getAsync(cacheKey);
|
|
63
|
+
logger.debug(`${lookupLabel} lookup`, {
|
|
64
|
+
cacheKey,
|
|
65
|
+
hasResult: !!files,
|
|
66
|
+
resultSize: files?.length ?? 0,
|
|
67
|
+
hasContent: files?.filter((file) => !!file.content)?.length ?? 0,
|
|
68
|
+
});
|
|
69
|
+
if (!files?.length) {
|
|
70
|
+
this.scheduleFileListWarmup(missReason, cacheKey);
|
|
71
|
+
}
|
|
72
|
+
return { cacheKey, files };
|
|
73
|
+
}
|
|
47
74
|
constructor(config) {
|
|
48
75
|
this.invalidationCallbacks = config.invalidationCallbacks ?? {};
|
|
49
76
|
const vf = config.veryfront;
|
|
@@ -86,39 +113,12 @@ export class VeryfrontFSAdapter {
|
|
|
86
113
|
getReleaseId: () => this.contentContext?.releaseId ?? null,
|
|
87
114
|
getContentContext: () => this.contentContext,
|
|
88
115
|
getFileList: async () => {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
return undefined;
|
|
92
|
-
}
|
|
93
|
-
const cacheKey = buildFileListCacheKey(this.contentContext);
|
|
94
|
-
const result = await this.cache.getAsync(cacheKey);
|
|
95
|
-
logger.debug("getFileList lookup", {
|
|
96
|
-
cacheKey,
|
|
97
|
-
hasResult: !!result,
|
|
98
|
-
resultSize: result?.length ?? 0,
|
|
99
|
-
});
|
|
100
|
-
if (!result?.length) {
|
|
101
|
-
this.scheduleFileListWarmup("getFileList miss", cacheKey);
|
|
102
|
-
}
|
|
103
|
-
return result;
|
|
116
|
+
const cached = await this.getCachedFileListAsync("getFileList: no contentContext", "getFileList", "getFileList miss");
|
|
117
|
+
return cached?.files;
|
|
104
118
|
},
|
|
105
119
|
hasCachedFileList: async () => {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
return false;
|
|
109
|
-
}
|
|
110
|
-
const cacheKey = buildFileListCacheKey(this.contentContext);
|
|
111
|
-
const result = await this.cache.getAsync(cacheKey);
|
|
112
|
-
const hasResult = Array.isArray(result) && result.length > 0;
|
|
113
|
-
logger.debug("hasCachedFileList lookup", {
|
|
114
|
-
cacheKey,
|
|
115
|
-
hasResult,
|
|
116
|
-
resultSize: result?.length ?? 0,
|
|
117
|
-
});
|
|
118
|
-
if (!hasResult) {
|
|
119
|
-
this.scheduleFileListWarmup("hasCachedFileList miss", cacheKey);
|
|
120
|
-
}
|
|
121
|
-
return hasResult;
|
|
120
|
+
const cached = await this.getCachedFileListAsync("hasCachedFileList: no contentContext", "hasCachedFileList", "hasCachedFileList miss");
|
|
121
|
+
return Array.isArray(cached?.files) && cached.files.length > 0;
|
|
122
122
|
},
|
|
123
123
|
isPersistentCacheInvalidated: (prefix) => this.isPersistentCacheInvalidated(prefix),
|
|
124
124
|
isReleaseBeingInvalidated: (releaseId) => this.isPersistentCacheInvalidated(buildFileCacheKeyPrefix({
|
|
@@ -129,22 +129,8 @@ export class VeryfrontFSAdapter {
|
|
|
129
129
|
};
|
|
130
130
|
this.statOps = new StatOperations(this.client, this.cache, this.normalizer, contentContextGetter);
|
|
131
131
|
this.readOps = new ReadOperations(this.client, this.cache, this.normalizer, contentContextGetter, (path) => this.statOps.getOriginalApiPath(path), async () => {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
return undefined;
|
|
135
|
-
}
|
|
136
|
-
const cacheKey = buildFileListCacheKey(this.contentContext);
|
|
137
|
-
const result = await this.cache.getAsync(cacheKey);
|
|
138
|
-
logger.debug("getFileListCache lookup", {
|
|
139
|
-
cacheKey,
|
|
140
|
-
hasResult: !!result,
|
|
141
|
-
resultSize: result?.length ?? 0,
|
|
142
|
-
hasContent: result?.filter((f) => f.content)?.length ?? 0,
|
|
143
|
-
});
|
|
144
|
-
if (!result?.length) {
|
|
145
|
-
this.scheduleFileListWarmup("getFileListCache miss", cacheKey);
|
|
146
|
-
}
|
|
147
|
-
return result;
|
|
132
|
+
const cached = await this.getCachedFileListAsync("getFileListCache: no contentContext", "getFileListCache", "getFileListCache miss");
|
|
133
|
+
return cached?.files;
|
|
148
134
|
});
|
|
149
135
|
this.dirOps = new DirectoryOperations(this.client, this.cache, this.normalizer, contentContextGetter);
|
|
150
136
|
this.wsManager = new WebSocketManager({
|
|
@@ -419,16 +405,16 @@ export class VeryfrontFSAdapter {
|
|
|
419
405
|
});
|
|
420
406
|
return [];
|
|
421
407
|
}
|
|
422
|
-
const
|
|
423
|
-
const
|
|
424
|
-
|
|
408
|
+
const cached = await this.getCachedFileListAsync("getAllSourceFiles: no contentContext", "getAllSourceFiles", "getAllSourceFiles miss");
|
|
409
|
+
const cacheKey = cached?.cacheKey;
|
|
410
|
+
const files = cached?.files;
|
|
411
|
+
if (!cacheKey || !files?.length) {
|
|
425
412
|
logger.debug("getAllSourceFiles cache miss or empty", {
|
|
426
413
|
cacheKey,
|
|
427
414
|
initialized: this.initialized,
|
|
428
415
|
hasFiles: !!files,
|
|
429
416
|
fileCount: files?.length ?? 0,
|
|
430
417
|
});
|
|
431
|
-
this.scheduleFileListWarmup("getAllSourceFiles miss", cacheKey);
|
|
432
418
|
return [];
|
|
433
419
|
}
|
|
434
420
|
const fileSummary = summarizeFileList(files);
|
|
@@ -442,18 +428,12 @@ export class VeryfrontFSAdapter {
|
|
|
442
428
|
return files;
|
|
443
429
|
}
|
|
444
430
|
getEntityIdForPath(path) {
|
|
445
|
-
if (!this.contentContext)
|
|
446
|
-
return undefined;
|
|
447
431
|
const normalizedPath = this.normalizer.normalize(path);
|
|
448
|
-
const
|
|
449
|
-
const cachedFiles = this.cache.get(cacheKey);
|
|
432
|
+
const cachedFiles = this.getCachedFileListSync();
|
|
450
433
|
return cachedFiles?.find((f) => f.path === normalizedPath)?.id;
|
|
451
434
|
}
|
|
452
435
|
getFilePathByEntityId(entityId) {
|
|
453
|
-
|
|
454
|
-
return undefined;
|
|
455
|
-
const cacheKey = buildFileListCacheKey(this.contentContext);
|
|
456
|
-
const cachedFiles = this.cache.get(cacheKey);
|
|
436
|
+
const cachedFiles = this.getCachedFileListSync();
|
|
457
437
|
return cachedFiles?.find((f) => f.id === entityId)?.path;
|
|
458
438
|
}
|
|
459
439
|
async getFilePathByEntityIdAsync(entityId) {
|
|
@@ -71,6 +71,7 @@ export declare class RenderPipeline {
|
|
|
71
71
|
* Shared by both renderPage() and resolvePageData() to keep behavior aligned.
|
|
72
72
|
*/
|
|
73
73
|
private resolveDataFetching;
|
|
74
|
+
private applyFetchedDataResults;
|
|
74
75
|
renderPage(slug: string, options?: RenderOptions): Promise<RenderResult>;
|
|
75
76
|
/** Resolve page data for SPA client-side navigation without rendering HTML. */
|
|
76
77
|
resolvePageData(slug: string, options?: RenderOptions): Promise<PageDataResponse>;
|
|
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B,8EAA8E;IAC9E,iBAAiB,CAAC,EAAE,OAAO,qBAAqB,EAAE,sBAAsB,CAAC;CAC1E;AAeD,qBAAa,cAAc;IACzB,OAAO,CAAC,MAAM,CAAuB;IACrC,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,kBAAkB,CAAqB;gBAEnC,MAAM,EAAE,oBAAoB;IAaxC;;;OAGG;IACH,gBAAgB,IAAI,IAAI;IAKxB,OAAO,CAAC,UAAU;IAIlB,OAAO,CAAC,sBAAsB;YAIhB,0BAA0B;IAaxC;;;;;;;;;OASG;YACW,qBAAqB;IAyDnC;;;OAGG;YACW,mBAAmB;IAiGjC,OAAO,CAAC,uBAAuB;IAkCzB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC;IA+P9E,+EAA+E;IACzE,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAgMvF;;;;;;OAMG;IACH,OAAO,CAAC,aAAa;CAetB"}
|
|
@@ -196,6 +196,10 @@ export class RenderPipeline {
|
|
|
196
196
|
return { ...job, result: null, error: error };
|
|
197
197
|
}
|
|
198
198
|
})), DATA_FETCH_TIMEOUT_MS, `Data fetch for ${slug}`), { "render.data_job_count": dataJobs.length });
|
|
199
|
+
this.applyFetchedDataResults(slug, dataResults, pageProps, layoutProps);
|
|
200
|
+
return { params, pageProps, layoutProps };
|
|
201
|
+
}
|
|
202
|
+
applyFetchedDataResults(slug, dataResults, pageProps, layoutProps) {
|
|
199
203
|
for (const { type, id, result, error } of dataResults) {
|
|
200
204
|
if (error)
|
|
201
205
|
throw error;
|
|
@@ -222,7 +226,6 @@ export class RenderPipeline {
|
|
|
222
226
|
layoutProps.set(id, result.props);
|
|
223
227
|
}
|
|
224
228
|
}
|
|
225
|
-
return { params, pageProps, layoutProps };
|
|
226
229
|
}
|
|
227
230
|
async renderPage(slug, options) {
|
|
228
231
|
const pipelineStartTime = performance.now();
|
|
@@ -8,4 +8,5 @@ export declare function loadVeryfrontExportsMap(projectDir: string, fs: FileSyst
|
|
|
8
8
|
import?: string;
|
|
9
9
|
}>>;
|
|
10
10
|
export declare function rewriteNodeExternalImports(code: string, projectDir: string, fs: FileSystem, userDeps: Map<string, string>): Promise<string>;
|
|
11
|
+
export declare function rewriteCompiledBinaryVeryfrontImports(code: string): string;
|
|
11
12
|
//# sourceMappingURL=loader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../../../src/src/routing/api/module-loader/loader.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAI9D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AA4KjE,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAejE;AAgBD,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAyBtF;AAuaD,wBAAgB,gCAAgC,CAAC,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,EAAE,CAUxF;AAED,wBAAsB,2BAA2B,CAC/C,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,EAAE,EAAE,UAAU,EACd,aAAa,EAAE,cAAc,UAAU,EAAE,aAAa,GACrD,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAoBxB;AAED,wBAAsB,uBAAuB,CAC3C,UAAU,EAAE,MAAM,EAClB,EAAE,EAAE,UAAU,GACb,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,CAW9C;AAED,wBAAsB,0BAA0B,CAC9C,IAA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IAAI,EAAE,MAAM,GAAG,MAAM,CAqB1E"}
|
|
@@ -615,6 +615,14 @@ export async function rewriteNodeExternalImports(code, projectDir, fs, userDeps)
|
|
|
615
615
|
});
|
|
616
616
|
return transformed;
|
|
617
617
|
}
|
|
618
|
+
export function rewriteCompiledBinaryVeryfrontImports(code) {
|
|
619
|
+
let transformed = code;
|
|
620
|
+
transformed = transformed.replace(/from\s+["']veryfront["']/g, 'from "./_vf_runtime.mjs"');
|
|
621
|
+
transformed = transformed.replace(/import\s*\(\s*["']veryfront["']\s*\)/g, 'import("./_vf_runtime.mjs")');
|
|
622
|
+
transformed = transformed.replace(/from\s+["']veryfront\/([^"']+)["']/g, (_match, subpath) => `from "./_vf_${subpath.replace(/\//g, "_")}.mjs"`);
|
|
623
|
+
transformed = transformed.replace(/import\s*\(\s*["']veryfront\/([^"']+)["']\s*\)/g, (_match, subpath) => `import("./_vf_${subpath.replace(/\//g, "_")}.mjs")`);
|
|
624
|
+
return transformed;
|
|
625
|
+
}
|
|
618
626
|
async function rewriteExternalImports(code, projectDir, fs, userDeps = new Map()) {
|
|
619
627
|
let transformed = code;
|
|
620
628
|
if (isNode) {
|
|
@@ -693,14 +701,7 @@ async function rewriteExternalImports(code, projectDir, fs, userDeps = new Map()
|
|
|
693
701
|
// In compiled binaries, "veryfront" resolves to embedded source that can't be
|
|
694
702
|
// imported from external temp files. Rewrite to use local runtime shims.
|
|
695
703
|
if (isCompiledBinary()) {
|
|
696
|
-
|
|
697
|
-
transformed = transformed.replace(/from\s+["']veryfront["']/g, 'from "./_vf_runtime.mjs"');
|
|
698
|
-
// Dynamic root imports: import("veryfront")
|
|
699
|
-
transformed = transformed.replace(/import\s*\(\s*["']veryfront["']\s*\)/g, 'import("./_vf_runtime.mjs")');
|
|
700
|
-
// Subpath static imports: from "veryfront/agent" → from "./_vf_agent.mjs"
|
|
701
|
-
transformed = transformed.replace(/from\s+["']veryfront\/([^"']+)["']/g, (_match, subpath) => `from "./_vf_${subpath.replace(/\//g, "_")}.mjs"`);
|
|
702
|
-
// Subpath dynamic imports: import("veryfront/agent") → import("./_vf_agent.mjs")
|
|
703
|
-
transformed = transformed.replace(/import\s*\(\s*["']veryfront\/([^"']+)["']\s*\)/g, (_match, subpath) => `import("./_vf_${subpath.replace(/\//g, "_")}.mjs")`);
|
|
704
|
+
transformed = rewriteCompiledBinaryVeryfrontImports(transformed);
|
|
704
705
|
}
|
|
705
706
|
}
|
|
706
707
|
return transformed;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.1.
|
|
1
|
+
export declare const VERSION = "0.1.167";
|
|
2
2
|
//# sourceMappingURL=version-constant.d.ts.map
|
package/package.json
CHANGED
package/src/deno.js
CHANGED
|
@@ -70,6 +70,44 @@ export class VeryfrontFSAdapter implements FSAdapter {
|
|
|
70
70
|
/** Whether running in proxy mode (shared adapter with per-request OAuth tokens) */
|
|
71
71
|
private proxyMode: boolean;
|
|
72
72
|
|
|
73
|
+
private getCurrentFileListCacheKey(): string | undefined {
|
|
74
|
+
return this.contentContext ? buildFileListCacheKey(this.contentContext) : undefined;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
private getCachedFileListSync<T extends { path: string; id?: string }>(): T[] | undefined {
|
|
78
|
+
const cacheKey = this.getCurrentFileListCacheKey();
|
|
79
|
+
if (!cacheKey) return undefined;
|
|
80
|
+
return this.cache.get(cacheKey) as T[] | undefined;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
private async getCachedFileListAsync<T extends { path: string }>(
|
|
84
|
+
noContextMessage: string,
|
|
85
|
+
lookupLabel: string,
|
|
86
|
+
missReason: string,
|
|
87
|
+
): Promise<{ cacheKey: string; files: T[] | undefined } | undefined> {
|
|
88
|
+
const cacheKey = this.getCurrentFileListCacheKey();
|
|
89
|
+
if (!cacheKey) {
|
|
90
|
+
logger.debug(noContextMessage);
|
|
91
|
+
return undefined;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
const files = await this.cache.getAsync<T[]>(cacheKey);
|
|
95
|
+
logger.debug(`${lookupLabel} lookup`, {
|
|
96
|
+
cacheKey,
|
|
97
|
+
hasResult: !!files,
|
|
98
|
+
resultSize: files?.length ?? 0,
|
|
99
|
+
hasContent: (files as Array<{ content?: string }> | undefined)?.filter((file) =>
|
|
100
|
+
!!file.content
|
|
101
|
+
)?.length ?? 0,
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
if (!files?.length) {
|
|
105
|
+
this.scheduleFileListWarmup(missReason, cacheKey);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return { cacheKey, files };
|
|
109
|
+
}
|
|
110
|
+
|
|
73
111
|
constructor(config: FSAdapterConfig) {
|
|
74
112
|
this.invalidationCallbacks = config.invalidationCallbacks ?? {};
|
|
75
113
|
const vf = config.veryfront;
|
|
@@ -120,56 +158,23 @@ export class VeryfrontFSAdapter implements FSAdapter {
|
|
|
120
158
|
getReleaseId: () => this.contentContext?.releaseId ?? null,
|
|
121
159
|
getContentContext: () => this.contentContext,
|
|
122
160
|
getFileList: async () => {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
path: string;
|
|
133
|
-
content?: string;
|
|
134
|
-
type?: string;
|
|
135
|
-
size?: number;
|
|
136
|
-
updated_at?: string;
|
|
137
|
-
}>
|
|
138
|
-
>(cacheKey);
|
|
139
|
-
|
|
140
|
-
logger.debug("getFileList lookup", {
|
|
141
|
-
cacheKey,
|
|
142
|
-
hasResult: !!result,
|
|
143
|
-
resultSize: result?.length ?? 0,
|
|
144
|
-
});
|
|
145
|
-
|
|
146
|
-
if (!result?.length) {
|
|
147
|
-
this.scheduleFileListWarmup("getFileList miss", cacheKey);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
return result;
|
|
161
|
+
const cached = await this.getCachedFileListAsync<{
|
|
162
|
+
id?: string;
|
|
163
|
+
path: string;
|
|
164
|
+
content?: string;
|
|
165
|
+
type?: string;
|
|
166
|
+
size?: number;
|
|
167
|
+
updated_at?: string;
|
|
168
|
+
}>("getFileList: no contentContext", "getFileList", "getFileList miss");
|
|
169
|
+
return cached?.files;
|
|
151
170
|
},
|
|
152
171
|
hasCachedFileList: async () => {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
const result = await this.cache.getAsync<Array<{ path: string }>>(cacheKey);
|
|
160
|
-
const hasResult = Array.isArray(result) && result.length > 0;
|
|
161
|
-
|
|
162
|
-
logger.debug("hasCachedFileList lookup", {
|
|
163
|
-
cacheKey,
|
|
164
|
-
hasResult,
|
|
165
|
-
resultSize: result?.length ?? 0,
|
|
166
|
-
});
|
|
167
|
-
|
|
168
|
-
if (!hasResult) {
|
|
169
|
-
this.scheduleFileListWarmup("hasCachedFileList miss", cacheKey);
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
return hasResult;
|
|
172
|
+
const cached = await this.getCachedFileListAsync<{ path: string }>(
|
|
173
|
+
"hasCachedFileList: no contentContext",
|
|
174
|
+
"hasCachedFileList",
|
|
175
|
+
"hasCachedFileList miss",
|
|
176
|
+
);
|
|
177
|
+
return Array.isArray(cached?.files) && cached.files.length > 0;
|
|
173
178
|
},
|
|
174
179
|
isPersistentCacheInvalidated: (prefix: string) => this.isPersistentCacheInvalidated(prefix),
|
|
175
180
|
isReleaseBeingInvalidated: (releaseId: string) =>
|
|
@@ -196,28 +201,12 @@ export class VeryfrontFSAdapter implements FSAdapter {
|
|
|
196
201
|
contentContextGetter,
|
|
197
202
|
(path) => this.statOps.getOriginalApiPath(path),
|
|
198
203
|
async () => {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
const cacheKey = buildFileListCacheKey(this.contentContext);
|
|
205
|
-
const result = await this.cache.getAsync<Array<{ path: string; content?: string }>>(
|
|
206
|
-
cacheKey,
|
|
204
|
+
const cached = await this.getCachedFileListAsync<{ path: string; content?: string }>(
|
|
205
|
+
"getFileListCache: no contentContext",
|
|
206
|
+
"getFileListCache",
|
|
207
|
+
"getFileListCache miss",
|
|
207
208
|
);
|
|
208
|
-
|
|
209
|
-
logger.debug("getFileListCache lookup", {
|
|
210
|
-
cacheKey,
|
|
211
|
-
hasResult: !!result,
|
|
212
|
-
resultSize: result?.length ?? 0,
|
|
213
|
-
hasContent: result?.filter((f) => f.content)?.length ?? 0,
|
|
214
|
-
});
|
|
215
|
-
|
|
216
|
-
if (!result?.length) {
|
|
217
|
-
this.scheduleFileListWarmup("getFileListCache miss", cacheKey);
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
return result;
|
|
209
|
+
return cached?.files;
|
|
221
210
|
},
|
|
222
211
|
);
|
|
223
212
|
|
|
@@ -560,17 +549,21 @@ export class VeryfrontFSAdapter implements FSAdapter {
|
|
|
560
549
|
return [];
|
|
561
550
|
}
|
|
562
551
|
|
|
563
|
-
const
|
|
564
|
-
|
|
552
|
+
const cached = await this.getCachedFileListAsync<{ path: string; content?: string }>(
|
|
553
|
+
"getAllSourceFiles: no contentContext",
|
|
554
|
+
"getAllSourceFiles",
|
|
555
|
+
"getAllSourceFiles miss",
|
|
556
|
+
);
|
|
557
|
+
const cacheKey = cached?.cacheKey;
|
|
558
|
+
const files = cached?.files;
|
|
565
559
|
|
|
566
|
-
if (!files?.length) {
|
|
560
|
+
if (!cacheKey || !files?.length) {
|
|
567
561
|
logger.debug("getAllSourceFiles cache miss or empty", {
|
|
568
562
|
cacheKey,
|
|
569
563
|
initialized: this.initialized,
|
|
570
564
|
hasFiles: !!files,
|
|
571
565
|
fileCount: files?.length ?? 0,
|
|
572
566
|
});
|
|
573
|
-
this.scheduleFileListWarmup("getAllSourceFiles miss", cacheKey);
|
|
574
567
|
return [];
|
|
575
568
|
}
|
|
576
569
|
|
|
@@ -588,24 +581,14 @@ export class VeryfrontFSAdapter implements FSAdapter {
|
|
|
588
581
|
}
|
|
589
582
|
|
|
590
583
|
getEntityIdForPath(path: string): string | undefined {
|
|
591
|
-
if (!this.contentContext) return undefined;
|
|
592
|
-
|
|
593
584
|
const normalizedPath = this.normalizer.normalize(path);
|
|
594
|
-
const
|
|
595
|
-
const cachedFiles = this.cache.get(cacheKey) as
|
|
596
|
-
| Array<{ id?: string; path: string }>
|
|
597
|
-
| undefined;
|
|
585
|
+
const cachedFiles = this.getCachedFileListSync<{ id?: string; path: string }>();
|
|
598
586
|
|
|
599
587
|
return cachedFiles?.find((f) => f.path === normalizedPath)?.id;
|
|
600
588
|
}
|
|
601
589
|
|
|
602
590
|
getFilePathByEntityId(entityId: string): string | undefined {
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
const cacheKey = buildFileListCacheKey(this.contentContext);
|
|
606
|
-
const cachedFiles = this.cache.get(cacheKey) as
|
|
607
|
-
| Array<{ id?: string; path: string }>
|
|
608
|
-
| undefined;
|
|
591
|
+
const cachedFiles = this.getCachedFileListSync<{ id?: string; path: string }>();
|
|
609
592
|
|
|
610
593
|
return cachedFiles?.find((f) => f.id === entityId)?.path;
|
|
611
594
|
}
|
|
@@ -111,6 +111,13 @@ interface DataResolutionResult {
|
|
|
111
111
|
layoutProps: Map<string, Record<string, unknown>>;
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
+
interface FetchedDataResult {
|
|
115
|
+
type: "page" | "layout";
|
|
116
|
+
id: string;
|
|
117
|
+
result: Awaited<ReturnType<RenderPipeline["dataFetcher"]["fetchData"]>> | null;
|
|
118
|
+
error: Error | null;
|
|
119
|
+
}
|
|
120
|
+
|
|
114
121
|
export class RenderPipeline {
|
|
115
122
|
private config: RenderPipelineConfig;
|
|
116
123
|
private dataFetcher: DataFetcher;
|
|
@@ -322,6 +329,17 @@ export class RenderPipeline {
|
|
|
322
329
|
{ "render.data_job_count": dataJobs.length },
|
|
323
330
|
);
|
|
324
331
|
|
|
332
|
+
this.applyFetchedDataResults(slug, dataResults, pageProps, layoutProps);
|
|
333
|
+
|
|
334
|
+
return { params, pageProps, layoutProps };
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
private applyFetchedDataResults(
|
|
338
|
+
slug: string,
|
|
339
|
+
dataResults: FetchedDataResult[],
|
|
340
|
+
pageProps: Record<string, unknown>,
|
|
341
|
+
layoutProps: Map<string, Record<string, unknown>>,
|
|
342
|
+
): void {
|
|
325
343
|
for (const { type, id, result, error } of dataResults) {
|
|
326
344
|
if (error) throw error;
|
|
327
345
|
if (!result) continue;
|
|
@@ -348,8 +366,6 @@ export class RenderPipeline {
|
|
|
348
366
|
layoutProps.set(id, result.props as Record<string, unknown>);
|
|
349
367
|
}
|
|
350
368
|
}
|
|
351
|
-
|
|
352
|
-
return { params, pageProps, layoutProps };
|
|
353
369
|
}
|
|
354
370
|
|
|
355
371
|
async renderPage(slug: string, options?: RenderOptions): Promise<RenderResult> {
|
|
@@ -800,6 +800,29 @@ export async function rewriteNodeExternalImports(
|
|
|
800
800
|
return transformed;
|
|
801
801
|
}
|
|
802
802
|
|
|
803
|
+
export function rewriteCompiledBinaryVeryfrontImports(code: string): string {
|
|
804
|
+
let transformed = code;
|
|
805
|
+
|
|
806
|
+
transformed = transformed.replace(
|
|
807
|
+
/from\s+["']veryfront["']/g,
|
|
808
|
+
'from "./_vf_runtime.mjs"',
|
|
809
|
+
);
|
|
810
|
+
transformed = transformed.replace(
|
|
811
|
+
/import\s*\(\s*["']veryfront["']\s*\)/g,
|
|
812
|
+
'import("./_vf_runtime.mjs")',
|
|
813
|
+
);
|
|
814
|
+
transformed = transformed.replace(
|
|
815
|
+
/from\s+["']veryfront\/([^"']+)["']/g,
|
|
816
|
+
(_match, subpath: string) => `from "./_vf_${subpath.replace(/\//g, "_")}.mjs"`,
|
|
817
|
+
);
|
|
818
|
+
transformed = transformed.replace(
|
|
819
|
+
/import\s*\(\s*["']veryfront\/([^"']+)["']\s*\)/g,
|
|
820
|
+
(_match, subpath: string) => `import("./_vf_${subpath.replace(/\//g, "_")}.mjs")`,
|
|
821
|
+
);
|
|
822
|
+
|
|
823
|
+
return transformed;
|
|
824
|
+
}
|
|
825
|
+
|
|
803
826
|
async function rewriteExternalImports(
|
|
804
827
|
code: string,
|
|
805
828
|
projectDir: string,
|
|
@@ -924,26 +947,7 @@ async function rewriteExternalImports(
|
|
|
924
947
|
// In compiled binaries, "veryfront" resolves to embedded source that can't be
|
|
925
948
|
// imported from external temp files. Rewrite to use local runtime shims.
|
|
926
949
|
if (isCompiledBinary()) {
|
|
927
|
-
|
|
928
|
-
transformed = transformed.replace(
|
|
929
|
-
/from\s+["']veryfront["']/g,
|
|
930
|
-
'from "./_vf_runtime.mjs"',
|
|
931
|
-
);
|
|
932
|
-
// Dynamic root imports: import("veryfront")
|
|
933
|
-
transformed = transformed.replace(
|
|
934
|
-
/import\s*\(\s*["']veryfront["']\s*\)/g,
|
|
935
|
-
'import("./_vf_runtime.mjs")',
|
|
936
|
-
);
|
|
937
|
-
// Subpath static imports: from "veryfront/agent" → from "./_vf_agent.mjs"
|
|
938
|
-
transformed = transformed.replace(
|
|
939
|
-
/from\s+["']veryfront\/([^"']+)["']/g,
|
|
940
|
-
(_match, subpath: string) => `from "./_vf_${subpath.replace(/\//g, "_")}.mjs"`,
|
|
941
|
-
);
|
|
942
|
-
// Subpath dynamic imports: import("veryfront/agent") → import("./_vf_agent.mjs")
|
|
943
|
-
transformed = transformed.replace(
|
|
944
|
-
/import\s*\(\s*["']veryfront\/([^"']+)["']\s*\)/g,
|
|
945
|
-
(_match, subpath: string) => `import("./_vf_${subpath.replace(/\//g, "_")}.mjs")`,
|
|
946
|
-
);
|
|
950
|
+
transformed = rewriteCompiledBinaryVeryfrontImports(transformed);
|
|
947
951
|
}
|
|
948
952
|
}
|
|
949
953
|
|