veryfront 0.1.73 → 0.1.75
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/cli/commands/knowledge/command-help.d.ts.map +1 -1
- package/esm/cli/commands/knowledge/command-help.js +3 -1
- package/esm/cli/commands/knowledge/command.d.ts +34 -5
- package/esm/cli/commands/knowledge/command.d.ts.map +1 -1
- package/esm/cli/commands/knowledge/command.js +151 -22
- package/esm/cli/commands/knowledge/parser-source.d.ts.map +1 -1
- package/esm/cli/commands/knowledge/parser-source.js +110 -5
- package/esm/deno.d.ts +2 -0
- package/esm/deno.js +3 -1
- package/esm/src/data/data-fetcher.d.ts +11 -1
- package/esm/src/data/data-fetcher.d.ts.map +1 -1
- package/esm/src/data/data-fetcher.js +5 -2
- package/esm/src/data/index.d.ts +1 -1
- package/esm/src/data/index.d.ts.map +1 -1
- package/esm/src/data/server-data-fetcher.d.ts +14 -1
- package/esm/src/data/server-data-fetcher.d.ts.map +1 -1
- package/esm/src/data/server-data-fetcher.js +49 -3
- package/esm/src/rendering/orchestrator/lifecycle.d.ts +4 -0
- package/esm/src/rendering/orchestrator/lifecycle.d.ts.map +1 -1
- package/esm/src/rendering/orchestrator/lifecycle.js +8 -0
- package/esm/src/rendering/orchestrator/pipeline.d.ts.map +1 -1
- package/esm/src/rendering/orchestrator/pipeline.js +6 -1
- package/esm/src/rendering/orchestrator/ssr-orchestrator.d.ts +26 -1
- package/esm/src/rendering/orchestrator/ssr-orchestrator.d.ts.map +1 -1
- package/esm/src/rendering/orchestrator/ssr-orchestrator.js +77 -1
- package/esm/src/routing/api/handler.d.ts.map +1 -1
- package/esm/src/routing/api/handler.js +6 -2
- package/esm/src/routing/api/route-executor.d.ts +8 -2
- package/esm/src/routing/api/route-executor.d.ts.map +1 -1
- package/esm/src/routing/api/route-executor.js +131 -3
- package/esm/src/security/deno-permissions.d.ts +6 -0
- package/esm/src/security/deno-permissions.d.ts.map +1 -1
- package/esm/src/security/deno-permissions.js +10 -0
- package/esm/src/security/sandbox/project-worker.d.ts +61 -0
- package/esm/src/security/sandbox/project-worker.d.ts.map +1 -0
- package/esm/src/security/sandbox/project-worker.js +318 -0
- package/esm/src/security/sandbox/worker-permissions.d.ts +30 -0
- package/esm/src/security/sandbox/worker-permissions.d.ts.map +1 -0
- package/esm/src/security/sandbox/worker-permissions.js +60 -0
- package/esm/src/security/sandbox/worker-pool.d.ts +87 -0
- package/esm/src/security/sandbox/worker-pool.d.ts.map +1 -0
- package/esm/src/security/sandbox/worker-pool.js +356 -0
- package/esm/src/security/sandbox/worker-types.d.ts +165 -0
- package/esm/src/security/sandbox/worker-types.d.ts.map +1 -0
- package/esm/src/security/sandbox/worker-types.js +17 -0
- package/esm/src/server/handlers/request/ssr/ssr.handler.d.ts +2 -0
- package/esm/src/server/handlers/request/ssr/ssr.handler.d.ts.map +1 -1
- package/esm/src/server/handlers/request/ssr/ssr.handler.js +6 -2
- package/esm/src/server/project-env/storage.d.ts +6 -0
- package/esm/src/server/project-env/storage.d.ts.map +1 -1
- package/esm/src/server/project-env/storage.js +8 -0
- package/esm/src/server/runtime-handler/adapter-factory.d.ts +3 -0
- package/esm/src/server/runtime-handler/adapter-factory.d.ts.map +1 -1
- package/esm/src/server/runtime-handler/adapter-factory.js +6 -5
- package/esm/src/server/runtime-handler/index.d.ts +33 -0
- package/esm/src/server/runtime-handler/index.d.ts.map +1 -1
- package/esm/src/server/runtime-handler/index.js +103 -37
- package/esm/src/server/runtime-handler/local-project-discovery.d.ts +32 -4
- package/esm/src/server/runtime-handler/local-project-discovery.d.ts.map +1 -1
- package/esm/src/server/runtime-handler/local-project-discovery.js +46 -16
- package/esm/src/server/runtime-handler/project-isolation.d.ts +5 -0
- package/esm/src/server/runtime-handler/project-isolation.d.ts.map +1 -1
- package/esm/src/server/runtime-handler/project-isolation.js +44 -0
- package/esm/src/server/services/rendering/ssr.service.d.ts +19 -1
- package/esm/src/server/services/rendering/ssr.service.d.ts.map +1 -1
- package/esm/src/server/services/rendering/ssr.service.js +9 -1
- package/esm/src/server/shared/renderer/adapter.d.ts +25 -0
- package/esm/src/server/shared/renderer/adapter.d.ts.map +1 -1
- package/esm/src/server/shared/renderer/adapter.js +83 -10
- package/esm/src/server/shared/renderer/index.d.ts +1 -1
- package/esm/src/server/shared/renderer/index.d.ts.map +1 -1
- package/esm/src/server/shared/renderer/index.js +1 -1
- package/esm/src/server/shared/renderer/memory/pressure.d.ts +7 -0
- package/esm/src/server/shared/renderer/memory/pressure.d.ts.map +1 -1
- package/esm/src/server/shared/renderer/memory/pressure.js +7 -0
- package/esm/src/transforms/pipeline/stages/ssr-vf-modules/path-resolver.d.ts +4 -4
- package/esm/src/transforms/pipeline/stages/ssr-vf-modules/path-resolver.d.ts.map +1 -1
- package/esm/src/transforms/pipeline/stages/ssr-vf-modules/path-resolver.js +15 -15
- package/esm/src/utils/index.d.ts +10 -1
- package/esm/src/utils/index.d.ts.map +1 -1
- package/esm/src/utils/index.js +9 -1
- package/esm/src/utils/logger/index.d.ts +1 -1
- package/esm/src/utils/logger/index.d.ts.map +1 -1
- package/esm/src/utils/logger/index.js +1 -1
- package/esm/src/utils/logger/logger.d.ts +14 -0
- package/esm/src/utils/logger/logger.d.ts.map +1 -1
- package/esm/src/utils/logger/logger.js +17 -0
- package/esm/src/workflow/claude-code/tool.d.ts +5 -5
- package/package.json +4 -1
- package/src/cli/commands/knowledge/command-help.ts +3 -1
- package/src/cli/commands/knowledge/command.ts +180 -22
- package/src/cli/commands/knowledge/parser-source.ts +110 -5
- package/src/deno.js +3 -1
- package/src/src/data/data-fetcher.ts +18 -2
- package/src/src/data/index.ts +1 -1
- package/src/src/data/server-data-fetcher.ts +78 -3
- package/src/src/rendering/orchestrator/lifecycle.ts +11 -0
- package/src/src/rendering/orchestrator/pipeline.ts +7 -2
- package/src/src/rendering/orchestrator/ssr-orchestrator.ts +119 -0
- package/src/src/routing/api/handler.ts +16 -3
- package/src/src/routing/api/route-executor.ts +222 -1
- package/src/src/security/deno-permissions.ts +11 -0
- package/src/src/security/sandbox/project-worker.ts +416 -0
- package/src/src/security/sandbox/worker-permissions.ts +74 -0
- package/src/src/security/sandbox/worker-pool.ts +451 -0
- package/src/src/security/sandbox/worker-types.ts +209 -0
- package/src/src/server/handlers/request/ssr/ssr.handler.ts +11 -2
- package/src/src/server/project-env/storage.ts +9 -0
- package/src/src/server/runtime-handler/adapter-factory.ts +13 -5
- package/src/src/server/runtime-handler/index.ts +132 -39
- package/src/src/server/runtime-handler/local-project-discovery.ts +51 -17
- package/src/src/server/runtime-handler/project-isolation.ts +53 -0
- package/src/src/server/services/rendering/ssr.service.ts +34 -3
- package/src/src/server/shared/renderer/adapter.ts +107 -8
- package/src/src/server/shared/renderer/index.ts +7 -1
- package/src/src/server/shared/renderer/memory/pressure.ts +8 -0
- package/src/src/transforms/pipeline/stages/ssr-vf-modules/path-resolver.ts +18 -12
- package/src/src/utils/index.ts +11 -0
- package/src/src/utils/logger/index.ts +1 -0
- package/src/src/utils/logger/logger.ts +34 -0
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
export async function tryReadWithExtensions(
|
|
21
21
|
fs: ReturnType<typeof createFileSystem>,
|
|
22
22
|
basePath: string,
|
|
23
|
+
existsFn: (path: string) => Promise<boolean> = exists,
|
|
23
24
|
): Promise<{ sourcePath: string; content: string } | null> {
|
|
24
25
|
// Try all extensions, including .src versions for embedded sources
|
|
25
26
|
const allExtensions = [
|
|
@@ -30,7 +31,7 @@ export async function tryReadWithExtensions(
|
|
|
30
31
|
for (const ext of allExtensions) {
|
|
31
32
|
const sourcePath = basePath + ext;
|
|
32
33
|
try {
|
|
33
|
-
if (await
|
|
34
|
+
if (await existsFn(sourcePath)) {
|
|
34
35
|
const content = await fs.readTextFile(sourcePath);
|
|
35
36
|
return { sourcePath, content };
|
|
36
37
|
}
|
|
@@ -47,6 +48,7 @@ export async function tryReadWithExtensions(
|
|
|
47
48
|
export async function resolveFrameworkFile(
|
|
48
49
|
vfModulePath: string,
|
|
49
50
|
fs: ReturnType<typeof createFileSystem>,
|
|
51
|
+
existsFn: (path: string) => Promise<boolean> = exists,
|
|
50
52
|
): Promise<{ sourcePath: string; content: string } | null> {
|
|
51
53
|
const pathWithoutPrefix = vfModulePath
|
|
52
54
|
.replace(/^\/_vf_modules\//, "")
|
|
@@ -78,7 +80,7 @@ export async function resolveFrameworkFile(
|
|
|
78
80
|
fullPath: pathWithPrefixDir,
|
|
79
81
|
});
|
|
80
82
|
|
|
81
|
-
const withPrefix = await tryReadWithExtensions(fs, pathWithPrefixDir);
|
|
83
|
+
const withPrefix = await tryReadWithExtensions(fs, pathWithPrefixDir, existsFn);
|
|
82
84
|
if (withPrefix) {
|
|
83
85
|
logger.debug(`${LOG_PREFIX} Found with prefix`, { sourcePath: withPrefix.sourcePath });
|
|
84
86
|
return withPrefix;
|
|
@@ -93,7 +95,7 @@ export async function resolveFrameworkFile(
|
|
|
93
95
|
fullPath: pathWithoutPrefixDir,
|
|
94
96
|
});
|
|
95
97
|
|
|
96
|
-
const withoutPrefix = await tryReadWithExtensions(fs, pathWithoutPrefixDir);
|
|
98
|
+
const withoutPrefix = await tryReadWithExtensions(fs, pathWithoutPrefixDir, existsFn);
|
|
97
99
|
if (withoutPrefix) {
|
|
98
100
|
logger.debug(`${LOG_PREFIX} Found without prefix`, { sourcePath: withoutPrefix.sourcePath });
|
|
99
101
|
return withoutPrefix;
|
|
@@ -118,7 +120,10 @@ export async function resolveFrameworkFile(
|
|
|
118
120
|
* then falls back to regular src/. This matches resolveFrameworkFile's behavior
|
|
119
121
|
* and ensures consistent path resolution for cycle detection.
|
|
120
122
|
*/
|
|
121
|
-
export async function resolveVeryfrontSourcePath(
|
|
123
|
+
export async function resolveVeryfrontSourcePath(
|
|
124
|
+
specifier: string,
|
|
125
|
+
existsFn: (path: string) => Promise<boolean> = exists,
|
|
126
|
+
): Promise<string | null> {
|
|
122
127
|
if (!specifier.startsWith("#veryfront/")) return null;
|
|
123
128
|
|
|
124
129
|
const mappedTarget = resolveInternalModuleTarget(specifier);
|
|
@@ -143,13 +148,13 @@ export async function resolveVeryfrontSourcePath(specifier: string): Promise<str
|
|
|
143
148
|
// Try exact path with .src suffix first (for embedded sources)
|
|
144
149
|
try {
|
|
145
150
|
const srcPath = basePath + ".src";
|
|
146
|
-
if (await
|
|
151
|
+
if (await existsFn(srcPath)) return srcPath;
|
|
147
152
|
} catch (_) {
|
|
148
153
|
/* expected: file may not exist at this path */
|
|
149
154
|
}
|
|
150
155
|
// Try exact path
|
|
151
156
|
try {
|
|
152
|
-
if (await
|
|
157
|
+
if (await existsFn(basePath)) return basePath;
|
|
153
158
|
} catch (_) {
|
|
154
159
|
/* expected: file may not exist at this path */
|
|
155
160
|
}
|
|
@@ -166,7 +171,7 @@ export async function resolveVeryfrontSourcePath(specifier: string): Promise<str
|
|
|
166
171
|
for (const ext of allExtensions) {
|
|
167
172
|
const pathWithExt = basePath + ext;
|
|
168
173
|
try {
|
|
169
|
-
if (await
|
|
174
|
+
if (await existsFn(pathWithExt)) return pathWithExt;
|
|
170
175
|
} catch (_) {
|
|
171
176
|
/* expected: file may not exist at this path */
|
|
172
177
|
}
|
|
@@ -176,7 +181,7 @@ export async function resolveVeryfrontSourcePath(specifier: string): Promise<str
|
|
|
176
181
|
for (const ext of allExtensions) {
|
|
177
182
|
const indexPath = join(basePath, "index" + ext);
|
|
178
183
|
try {
|
|
179
|
-
if (await
|
|
184
|
+
if (await existsFn(indexPath)) return indexPath;
|
|
180
185
|
} catch (_) {
|
|
181
186
|
/* expected: file may not exist at this path */
|
|
182
187
|
}
|
|
@@ -197,6 +202,7 @@ export async function resolveRelativeFrameworkImport(
|
|
|
197
202
|
specifier: string,
|
|
198
203
|
fromSourcePath: string,
|
|
199
204
|
_fs: ReturnType<typeof createFileSystem>,
|
|
205
|
+
existsFn: (path: string) => Promise<boolean> = exists,
|
|
200
206
|
): Promise<string | null> {
|
|
201
207
|
const fromDir = fromSourcePath.substring(0, fromSourcePath.lastIndexOf("/"));
|
|
202
208
|
const parts = fromDir.split("/").filter(Boolean);
|
|
@@ -219,7 +225,7 @@ export async function resolveRelativeFrameworkImport(
|
|
|
219
225
|
if (/\.(tsx?|jsx?|mjs)$/.test(specifier)) {
|
|
220
226
|
// Try exact path first
|
|
221
227
|
try {
|
|
222
|
-
if (await
|
|
228
|
+
if (await existsFn(basePath)) return basePath;
|
|
223
229
|
} catch (_) {
|
|
224
230
|
/* expected: file may not exist at this path */
|
|
225
231
|
}
|
|
@@ -227,7 +233,7 @@ export async function resolveRelativeFrameworkImport(
|
|
|
227
233
|
// Try with .src suffix for embedded sources
|
|
228
234
|
try {
|
|
229
235
|
const srcPath = basePath + ".src";
|
|
230
|
-
if (await
|
|
236
|
+
if (await existsFn(srcPath)) return srcPath;
|
|
231
237
|
} catch (_) {
|
|
232
238
|
/* expected: file may not exist at this path */
|
|
233
239
|
}
|
|
@@ -245,7 +251,7 @@ export async function resolveRelativeFrameworkImport(
|
|
|
245
251
|
for (const ext of allExtensions) {
|
|
246
252
|
const pathWithExt = basePath + ext;
|
|
247
253
|
try {
|
|
248
|
-
if (await
|
|
254
|
+
if (await existsFn(pathWithExt)) return pathWithExt;
|
|
249
255
|
} catch (_) {
|
|
250
256
|
/* expected: file may not exist at this path */
|
|
251
257
|
}
|
|
@@ -255,7 +261,7 @@ export async function resolveRelativeFrameworkImport(
|
|
|
255
261
|
for (const ext of allExtensions) {
|
|
256
262
|
const indexPath = join(basePath, "index" + ext);
|
|
257
263
|
try {
|
|
258
|
-
if (await
|
|
264
|
+
if (await existsFn(indexPath)) return indexPath;
|
|
259
265
|
} catch (_) {
|
|
260
266
|
/* expected: file may not exist at this path */
|
|
261
267
|
}
|
package/src/src/utils/index.ts
CHANGED
|
@@ -3,7 +3,16 @@
|
|
|
3
3
|
* (breakpoints, timeouts, HTTP codes), hashing, memoization, and feature flags.
|
|
4
4
|
*
|
|
5
5
|
* @module utils
|
|
6
|
+
*
|
|
7
|
+
* @example Structured logging
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { serverLogger } from "veryfront/utils";
|
|
10
|
+
*
|
|
11
|
+
* serverLogger.info("Booting server", { project_id: "proj_123" });
|
|
12
|
+
* ```
|
|
6
13
|
*/
|
|
14
|
+
import "../../_dnt.polyfills.js";
|
|
15
|
+
|
|
7
16
|
|
|
8
17
|
export {
|
|
9
18
|
type GlobalWithBun,
|
|
@@ -17,11 +26,13 @@ export {
|
|
|
17
26
|
export {
|
|
18
27
|
agentLogger,
|
|
19
28
|
bundlerLogger,
|
|
29
|
+
createJobUserLogger,
|
|
20
30
|
logger,
|
|
21
31
|
refreshLoggerConfig,
|
|
22
32
|
rendererLogger,
|
|
23
33
|
serverLogger,
|
|
24
34
|
} from "./logger/index.js";
|
|
35
|
+
export type { Logger } from "./logger/index.js";
|
|
25
36
|
|
|
26
37
|
export {
|
|
27
38
|
BREAKPOINT_LG,
|
|
@@ -60,6 +60,12 @@ export interface LogEntry {
|
|
|
60
60
|
release_id?: string;
|
|
61
61
|
branch_id?: string;
|
|
62
62
|
branch_name?: string;
|
|
63
|
+
job_id?: string;
|
|
64
|
+
batch_id?: string;
|
|
65
|
+
job_target?: string;
|
|
66
|
+
task?: string;
|
|
67
|
+
event_kind?: string;
|
|
68
|
+
user_visible?: string;
|
|
63
69
|
// Duration for timed operations
|
|
64
70
|
/** @deprecated Use `duration_ms` instead. Kept for Grafana dashboard transition. Planned removal after Grafana dashboard migration is complete. */
|
|
65
71
|
durationMs?: number;
|
|
@@ -314,6 +320,12 @@ class ConsoleLogger implements Logger {
|
|
|
314
320
|
extractToEntryField(entry, mergedContext, "release_id", (v) => String(v));
|
|
315
321
|
extractToEntryField(entry, mergedContext, "branch_id", (v) => String(v));
|
|
316
322
|
extractToEntryField(entry, mergedContext, "branch_name", (v) => String(v));
|
|
323
|
+
extractToEntryField(entry, mergedContext, "job_id", (v) => String(v));
|
|
324
|
+
extractToEntryField(entry, mergedContext, "batch_id", (v) => String(v));
|
|
325
|
+
extractToEntryField(entry, mergedContext, "job_target", (v) => String(v));
|
|
326
|
+
extractToEntryField(entry, mergedContext, "task", (v) => String(v));
|
|
327
|
+
extractToEntryField(entry, mergedContext, "event_kind", (v) => String(v));
|
|
328
|
+
extractToEntryField(entry, mergedContext, "user_visible", (v) => String(v));
|
|
317
329
|
extractToEntryField(entry, mergedContext, "duration_ms", (v) => Number(v));
|
|
318
330
|
|
|
319
331
|
// Emit snake_case aliases for camelCase fields (transition period)
|
|
@@ -568,3 +580,25 @@ export function createRequestLogger(
|
|
|
568
580
|
): Logger {
|
|
569
581
|
return baseLogger.child(requestContext);
|
|
570
582
|
}
|
|
583
|
+
|
|
584
|
+
export function createJobUserLogger(
|
|
585
|
+
baseLogger: Logger,
|
|
586
|
+
jobContext: {
|
|
587
|
+
projectId: string;
|
|
588
|
+
jobId: string;
|
|
589
|
+
task: string;
|
|
590
|
+
batchId?: string | null;
|
|
591
|
+
jobTarget?: string | null;
|
|
592
|
+
eventKind?: string;
|
|
593
|
+
},
|
|
594
|
+
): Logger {
|
|
595
|
+
return baseLogger.child({
|
|
596
|
+
project_id: jobContext.projectId,
|
|
597
|
+
job_id: jobContext.jobId,
|
|
598
|
+
...(jobContext.batchId ? { batch_id: jobContext.batchId } : {}),
|
|
599
|
+
...(jobContext.jobTarget ? { job_target: jobContext.jobTarget } : {}),
|
|
600
|
+
task: jobContext.task,
|
|
601
|
+
event_kind: jobContext.eventKind ?? "job_user_log",
|
|
602
|
+
user_visible: "true",
|
|
603
|
+
});
|
|
604
|
+
}
|