veryfront 0.1.604 → 0.1.606

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 (26) hide show
  1. package/esm/deno.js +1 -1
  2. package/esm/extensions/ext-llm-anthropic/src/anthropic-stream.d.ts.map +1 -1
  3. package/esm/extensions/ext-llm-anthropic/src/anthropic-stream.js +12 -0
  4. package/esm/src/modules/react-loader/ssr-module-loader/cache/memory.d.ts +10 -4
  5. package/esm/src/modules/react-loader/ssr-module-loader/cache/memory.d.ts.map +1 -1
  6. package/esm/src/modules/react-loader/ssr-module-loader/cache/memory.js +15 -7
  7. package/esm/src/modules/react-loader/ssr-module-loader/loader.d.ts.map +1 -1
  8. package/esm/src/modules/react-loader/ssr-module-loader/loader.js +8 -2
  9. package/esm/src/sandbox/lazy-sandbox.d.ts +1 -0
  10. package/esm/src/sandbox/lazy-sandbox.d.ts.map +1 -1
  11. package/esm/src/sandbox/lazy-sandbox.js +24 -0
  12. package/esm/src/server/services/rsc/endpoints/rsc-bundles.generated.js +1 -1
  13. package/esm/src/transforms/import-rewriter/url-builder.d.ts +9 -2
  14. package/esm/src/transforms/import-rewriter/url-builder.d.ts.map +1 -1
  15. package/esm/src/transforms/import-rewriter/url-builder.js +9 -2
  16. package/esm/src/transforms/pipeline/stages/ssr-vf-modules/constants.d.ts +1 -1
  17. package/esm/src/transforms/pipeline/stages/ssr-vf-modules/constants.d.ts.map +1 -1
  18. package/esm/src/transforms/pipeline/stages/ssr-vf-modules/constants.js +8 -2
  19. package/esm/src/transforms/pipeline/stages/ssr-vf-modules/transform.d.ts +6 -0
  20. package/esm/src/transforms/pipeline/stages/ssr-vf-modules/transform.d.ts.map +1 -1
  21. package/esm/src/transforms/pipeline/stages/ssr-vf-modules/transform.js +105 -18
  22. package/esm/src/utils/constants/cdn.d.ts +2 -2
  23. package/esm/src/utils/constants/cdn.js +1 -1
  24. package/esm/src/utils/version-constant.d.ts +1 -1
  25. package/esm/src/utils/version-constant.js +1 -1
  26. package/package.json +1 -1
package/esm/deno.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export default {
2
2
  "name": "veryfront",
3
- "version": "0.1.604",
3
+ "version": "0.1.606",
4
4
  "license": "Apache-2.0",
5
5
  "nodeModulesDir": "auto",
6
6
  "workspace": [
@@ -1 +1 @@
1
- {"version":3,"file":"anthropic-stream.d.ts","sourceRoot":"","sources":["../../../../src/extensions/ext-llm-anthropic/src/anthropic-stream.ts"],"names":[],"mappings":"AAOA,KAAK,YAAY,GAAG;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B,CAAC;AAaF,wBAAgB,8BAA8B,CAC5C,GAAG,EAAE,OAAO,GACX,MAAM,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAgBlD;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,YAAY,GAAG,SAAS,CAsBhF;AAED,wBAAuB,8BAA8B,CACnD,MAAM,EAAE,cAAc,CAAC,UAAU,CAAC,GACjC,aAAa,CAAC,OAAO,CAAC,CA6OxB"}
1
+ {"version":3,"file":"anthropic-stream.d.ts","sourceRoot":"","sources":["../../../../src/extensions/ext-llm-anthropic/src/anthropic-stream.ts"],"names":[],"mappings":"AAOA,KAAK,YAAY,GAAG;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B,CAAC;AAaF,wBAAgB,8BAA8B,CAC5C,GAAG,EAAE,OAAO,GACX,MAAM,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAgBlD;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,YAAY,GAAG,SAAS,CAsBhF;AAED,wBAAuB,8BAA8B,CACnD,MAAM,EAAE,cAAc,CAAC,UAAU,CAAC,GACjC,aAAa,CAAC,OAAO,CAAC,CA0PxB"}
@@ -43,6 +43,7 @@ export async function* streamAnthropicCompatibleParts(stream) {
43
43
  const reasoningBlocks = new Map();
44
44
  let finishReason = null;
45
45
  let usage;
46
+ let completedClientToolUseStep = false;
46
47
  for await (const chunk of stream) {
47
48
  buffer += decoder.decode(chunk, { stream: true });
48
49
  const parsed = parseSseChunk(buffer);
@@ -206,6 +207,9 @@ export async function* streamAnthropicCompatibleParts(stream) {
206
207
  input: current.input.length > 0 ? current.input : "{}",
207
208
  ...(current.providerExecuted ? { providerExecuted: true } : {}),
208
209
  };
210
+ if (!current.providerExecuted) {
211
+ completedClientToolUseStep = true;
212
+ }
209
213
  toolCalls.delete(index);
210
214
  continue;
211
215
  }
@@ -217,6 +221,14 @@ export async function* streamAnthropicCompatibleParts(stream) {
217
221
  }
218
222
  }
219
223
  }
224
+ if (completedClientToolUseStep && toolCalls.size === 0) {
225
+ yield {
226
+ type: "finish",
227
+ finishReason: { unified: "tool-calls", raw: "tool_use" },
228
+ ...(usage ? { usage } : {}),
229
+ };
230
+ return;
231
+ }
220
232
  }
221
233
  if (buffer.trim().length > 0) {
222
234
  const parsed = parseSseChunk(`${buffer}\n\n`);
@@ -13,18 +13,24 @@ export declare function getTransformSemaphore(): Semaphore;
13
13
  *
14
14
  * Note: The "__single__" project and projects with "local-" prefix bypass
15
15
  * rate limiting since there's no noisy-neighbor concern in single-project mode.
16
+ * `bypass` forces the same behavior for callers that know they are
17
+ * single-tenant (e.g. the dev server, whose projectId is the project slug and
18
+ * therefore does not match the prefix allowlist). When bypassing, no slot is
19
+ * tracked, so the matching {@link releaseTransformSlot} must also bypass.
16
20
  */
17
- export declare function acquireTransformSlot(projectId: string): boolean;
21
+ export declare function acquireTransformSlot(projectId: string, bypass?: boolean): boolean;
18
22
  /**
19
23
  * Try to acquire a project-level transform slot with retries.
20
24
  * Waits up to timeoutMs for a slot to become available.
21
25
  * Returns true if acquired, false if timed out.
22
26
  */
23
- export declare function tryAcquireTransformSlot(projectId: string, timeoutMs: number): Promise<boolean>;
27
+ export declare function tryAcquireTransformSlot(projectId: string, timeoutMs: number, bypass?: boolean): Promise<boolean>;
24
28
  /**
25
- * Release a project-level transform slot.
29
+ * Release a project-level transform slot. `bypass` must match the value
30
+ * passed to the corresponding {@link acquireTransformSlot} so a bypassing
31
+ * caller never decrements another caller's tracked count.
26
32
  */
27
- export declare function releaseTransformSlot(projectId: string): void;
33
+ export declare function releaseTransformSlot(projectId: string, bypass?: boolean): void;
28
34
  /**
29
35
  * Get per-project transform statistics.
30
36
  */
@@ -1 +1 @@
1
- {"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../../../../../src/src/modules/react-loader/ssr-module-loader/cache/memory.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAO5D,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAExD,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAOnE,eAAO,MAAM,iBAAiB,oCAE5B,CAAC;AAEH,eAAO,MAAM,uBAAuB,oCAElC,CAAC;AAEH,eAAO,MAAM,gBAAgB,4BAAmC,CAAC;AAEjE,eAAO,MAAM,aAAa,0BAExB,CAAC;AAEH,eAAO,MAAM,gBAAgB,4BAAmC,CAAC;AAGjE,wBAAgB,qBAAqB,IAAI,SAAS,CAKjD;AAwBD;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAW/D;AAKD;;;;GAIG;AACH,wBAAsB,uBAAuB,CAC3C,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,OAAO,CAAC,CAUlB;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAU5D;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI;IACnC,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACrC,CAOA;AAiDD,wBAAgB,mBAAmB,IAAI,IAAI,CAqB1C;AAED,wBAAgB,6BAA6B,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAiDrE"}
1
+ {"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../../../../../src/src/modules/react-loader/ssr-module-loader/cache/memory.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAO5D,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAExD,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAOnE,eAAO,MAAM,iBAAiB,oCAE5B,CAAC;AAEH,eAAO,MAAM,uBAAuB,oCAElC,CAAC;AAEH,eAAO,MAAM,gBAAgB,4BAAmC,CAAC;AAEjE,eAAO,MAAM,aAAa,0BAExB,CAAC;AAEH,eAAO,MAAM,gBAAgB,4BAAmC,CAAC;AAGjE,wBAAgB,qBAAqB,IAAI,SAAS,CAKjD;AAwBD;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,UAAQ,GAAG,OAAO,CAY/E;AAKD;;;;GAIG;AACH,wBAAsB,uBAAuB,CAC3C,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,MAAM,UAAQ,GACb,OAAO,CAAC,OAAO,CAAC,CAUlB;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,UAAQ,GAAG,IAAI,CAU5E;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI;IACnC,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACrC,CAOA;AAiDD,wBAAgB,mBAAmB,IAAI,IAAI,CAqB1C;AAED,wBAAgB,6BAA6B,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAiDrE"}
@@ -67,11 +67,17 @@ const RATE_LIMIT_BYPASS_PREFIXES = ["local-", "test_"];
67
67
  *
68
68
  * Note: The "__single__" project and projects with "local-" prefix bypass
69
69
  * rate limiting since there's no noisy-neighbor concern in single-project mode.
70
+ * `bypass` forces the same behavior for callers that know they are
71
+ * single-tenant (e.g. the dev server, whose projectId is the project slug and
72
+ * therefore does not match the prefix allowlist). When bypassing, no slot is
73
+ * tracked, so the matching {@link releaseTransformSlot} must also bypass.
70
74
  */
71
- export function acquireTransformSlot(projectId) {
75
+ export function acquireTransformSlot(projectId, bypass = false) {
72
76
  const limit = getTransformPerProjectLimit();
73
77
  if (limit <= 0)
74
78
  return true;
79
+ if (bypass)
80
+ return true;
75
81
  if (RATE_LIMIT_BYPASS_PROJECTS.has(projectId))
76
82
  return true;
77
83
  if (RATE_LIMIT_BYPASS_PREFIXES.some((prefix) => projectId.startsWith(prefix)))
@@ -89,22 +95,24 @@ const PROJECT_SLOT_RETRY_INTERVAL_MS = 50;
89
95
  * Waits up to timeoutMs for a slot to become available.
90
96
  * Returns true if acquired, false if timed out.
91
97
  */
92
- export async function tryAcquireTransformSlot(projectId, timeoutMs) {
93
- if (acquireTransformSlot(projectId))
98
+ export async function tryAcquireTransformSlot(projectId, timeoutMs, bypass = false) {
99
+ if (acquireTransformSlot(projectId, bypass))
94
100
  return true;
95
101
  const deadline = Date.now() + timeoutMs;
96
102
  while (Date.now() < deadline) {
97
103
  await new Promise((resolve) => dntShim.setTimeout(resolve, PROJECT_SLOT_RETRY_INTERVAL_MS)); // no cleanup needed: one-shot
98
- if (acquireTransformSlot(projectId))
104
+ if (acquireTransformSlot(projectId, bypass))
99
105
  return true;
100
106
  }
101
107
  return false;
102
108
  }
103
109
  /**
104
- * Release a project-level transform slot.
110
+ * Release a project-level transform slot. `bypass` must match the value
111
+ * passed to the corresponding {@link acquireTransformSlot} so a bypassing
112
+ * caller never decrements another caller's tracked count.
105
113
  */
106
- export function releaseTransformSlot(projectId) {
107
- if (getTransformPerProjectLimit() <= 0)
114
+ export function releaseTransformSlot(projectId, bypass = false) {
115
+ if (bypass || getTransformPerProjectLimit() <= 0)
108
116
  return;
109
117
  const current = projectTransformCounts.get(projectId) ?? 0;
110
118
  if (current <= 1) {
@@ -1 +1 @@
1
- {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../../../src/src/modules/react-loader/ssr-module-loader/loader.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,KAAK,KAAK,MAAM,4BAA4B,CAAC;AAsCzD,OAAO,KAAK,EAAoB,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAkB3E;;;;;GAKG;AACH,qBAAa,eAAe;IAKd,OAAO,CAAC,OAAO;IAJ3B,OAAO,CAAC,KAAK,CAAkB;IAC/B,OAAO,CAAC,cAAc,CAA2B;IACjD,OAAO,CAAC,YAAY,CAAyB;gBAEzB,OAAO,EAAE,sBAAsB;YAWrC,qBAAqB;YAuCrB,0BAA0B;IAwHxC,aAAa,CACX,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IA+C7B,UAAU,CACd,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;YAK1C,2BAA2B;IAYzC,OAAO,CAAC,yBAAyB;YAiBnB,2BAA2B;CA+V1C"}
1
+ {"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../../../src/src/modules/react-loader/ssr-module-loader/loader.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,KAAK,KAAK,MAAM,4BAA4B,CAAC;AAsCzD,OAAO,KAAK,EAAoB,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAkB3E;;;;;GAKG;AACH,qBAAa,eAAe;IAKd,OAAO,CAAC,OAAO;IAJ3B,OAAO,CAAC,KAAK,CAAkB;IAC/B,OAAO,CAAC,cAAc,CAA2B;IACjD,OAAO,CAAC,YAAY,CAAyB;gBAEzB,OAAO,EAAE,sBAAsB;YAWrC,qBAAqB;YAgDrB,0BAA0B;IAwHxC,aAAa,CACX,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IA+C7B,UAAU,CACd,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;YAK1C,2BAA2B;IAYzC,OAAO,CAAC,yBAAyB;YAiBnB,2BAA2B;CA+V1C"}
@@ -56,7 +56,13 @@ export class SSRModuleLoader {
56
56
  const projectId = this.options.projectId;
57
57
  const semaphore = useSemaphore ? getTransformSemaphore() : undefined;
58
58
  let semaphoreAcquired = false;
59
- if (!await tryAcquireTransformSlot(projectId, TRANSFORM_ACQUIRE_TIMEOUT_MS)) {
59
+ // The per-project limit is noisy-neighbor protection for multi-tenant
60
+ // cloud. The dev server is single-tenant, so the limit only produces
61
+ // false "at capacity" failures when a cold-cache render fans out across
62
+ // the framework tree. Bypass it in dev; the global semaphore still bounds
63
+ // total concurrency.
64
+ const bypassProjectLimit = this.options.dev === true;
65
+ if (!await tryAcquireTransformSlot(projectId, TRANSFORM_ACQUIRE_TIMEOUT_MS, bypassProjectLimit)) {
60
66
  throw createTransformCapacityError(mode, `Project ${projectId} at transform capacity. Consider reducing page complexity or request rate.`, filePath);
61
67
  }
62
68
  try {
@@ -72,7 +78,7 @@ export class SSRModuleLoader {
72
78
  if (semaphore && semaphoreAcquired) {
73
79
  semaphore.release();
74
80
  }
75
- releaseTransformSlot(projectId);
81
+ releaseTransformSlot(projectId, bypassProjectLimit);
76
82
  }
77
83
  }
78
84
  async importModuleFromCacheEntry(filePath, fileName, cacheEntry) {
@@ -74,6 +74,7 @@ export declare class LazySandbox {
74
74
  get url(): string | null;
75
75
  get isActive(): boolean;
76
76
  private bootstrapSession;
77
+ private bootstrapCreatedSession;
77
78
  private resolveReadyEndpoint;
78
79
  private attachExistingSession;
79
80
  private getSession;
@@ -1 +1 @@
1
- {"version":3,"file":"lazy-sandbox.d.ts","sourceRoot":"","sources":["../../../src/src/sandbox/lazy-sandbox.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,uBAAuB,EAE5B,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,cAAc,EACpB,MAAM,YAAY,CAAC;AAEpB,wCAAwC;AACxC,MAAM,WAAW,kBAAmB,SAAQ,cAAc;IACxD;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sFAAsF;IACtF,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,sGAAsG;IACtG,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAC/C,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,cAAc,CAAC,EA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,CAAC,KAAK,UAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAoDvC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAwC5B,IAAI,EAAE,IAAI,MAAM,GAAG,IAAI,CAEtB;IAED,IAAI,GAAG,IAAI,MAAM,GAAG,IAAI,CAEvB;IAED,IAAI,QAAQ,IAAI,OAAO,CAEtB;YAEa,gBAAgB;YAqBhB,uBAAuB;YAiCvB,oBAAoB;YASpB,qBAAqB;YAkBrB,UAAU;YAcV,mBAAmB;YA4BnB,4BAA4B;YAiC5B,YAAY;IAc1B,OAAO,CAAC,kBAAkB;IAY1B,OAAO,CAAC,iBAAiB;YAMX,aAAa;IAO3B,OAAO,CAAC,eAAe;IAOvB,OAAO,CAAC,gBAAgB;IAIxB,OAAO,CAAC,iBAAiB;IAYzB,OAAO,CAAC,kBAAkB;YAKZ,gCAAgC;IAU9C,OAAO,CAAC,8BAA8B;YAmBxB,SAAS;YAkCT,cAAc;YAId,YAAY;IAI1B,OAAO,CAAC,qBAAqB;YAIf,gCAAgC;IAU9C,OAAO,CAAC,sBAAsB;IAM9B,OAAO,CAAC,yBAAyB;IAKjC,OAAO,CAAC,gBAAgB;IAQxB,OAAO,CAAC,WAAW;IAInB,OAAO,CAAC,WAAW;CAMpB"}
@@ -10,6 +10,8 @@ const DEFAULT_CONTROL_REQUEST_TIMEOUT_MS = 15_000;
10
10
  const DEFAULT_EXEC_START_TIMEOUT_MS = 30_000;
11
11
  const DEFAULT_EXEC_START_MAX_ATTEMPTS = 3;
12
12
  const DEFAULT_EXEC_START_RETRY_DELAY_MS = 1_000;
13
+ const CREATED_SESSION_BOOTSTRAP_MAX_ATTEMPTS = 2;
14
+ const DATA_PLANE_READINESS_FAILURE_PREFIX = "Sandbox data plane did not become ready:";
13
15
  const RETRYABLE_DATA_PLANE_READINESS_STATUS_CODES = new Set([404, 502, 503, 504]);
14
16
  const REPROVISIONABLE_EXEC_START_ERROR_CODES = new Set([
15
17
  "ECONNREFUSED",
@@ -350,6 +352,20 @@ export class LazySandbox {
350
352
  await this.attachExistingSession(this.sandboxId);
351
353
  return;
352
354
  }
355
+ for (let attempt = 1; attempt <= CREATED_SESSION_BOOTSTRAP_MAX_ATTEMPTS; attempt += 1) {
356
+ try {
357
+ await this.bootstrapCreatedSession();
358
+ return;
359
+ }
360
+ catch (error) {
361
+ if (attempt >= CREATED_SESSION_BOOTSTRAP_MAX_ATTEMPTS ||
362
+ !isDataPlaneReadinessFailure(error)) {
363
+ throw error;
364
+ }
365
+ }
366
+ }
367
+ }
368
+ async bootstrapCreatedSession() {
353
369
  const projectId = this.resolveProjectId();
354
370
  const res = await this.fetchControl(`${this.apiUrl}/sandbox-sessions`, {
355
371
  method: "POST",
@@ -619,6 +635,14 @@ function isRetryableExecStartStatus(status) {
619
635
  function isRetryableExecStartError(error) {
620
636
  return error instanceof Error && /fetch failed/i.test(error.message);
621
637
  }
638
+ function isDataPlaneReadinessFailure(error) {
639
+ if (!(error instanceof Error)) {
640
+ return false;
641
+ }
642
+ const detail = "detail" in error && typeof error.detail === "string" ? error.detail : undefined;
643
+ return error.message.startsWith(DATA_PLANE_READINESS_FAILURE_PREFIX) ||
644
+ detail?.startsWith(DATA_PLANE_READINESS_FAILURE_PREFIX) === true;
645
+ }
622
646
  function shouldReprovisionAfterExecStartFailure(error) {
623
647
  if (!(error instanceof Error)) {
624
648
  return false;
@@ -5,5 +5,5 @@
5
5
  * Do not edit manually — run `deno task generate` to regenerate.
6
6
  * @module
7
7
  */
8
- export const CLIENT_BOOT_BUNDLE = 'var W=Object.defineProperty;var q=(t,e,r)=>e in t?W(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var p=(t,e,r)=>q(t,typeof e!="symbol"?e+"":e,r);var z="3.2.3";function X(t,e,r,n){let s=[];if(n?.external?.length&&s.push(`external=${n.external.join(",")}`),s.push(`target=${n?.target??"es2022"}`),n?.deps){let d=Object.entries(n.deps).map(([l,R])=>`${l}@${R}`).join(",");s.push(`deps=${d}`)}let u=e?`@${e}`:"",c=r??"",i=s.length?`?${s.join("&")}`:"";return`https://esm.sh/${t}${u}${c}${i}`}function f(t,e,r,n=!1){return X(t,e,r,{external:n?["react"]:void 0,deps:{csstype:z}})}var K="19.1.1",E=K;function P(t=E){return{react:f("react",t),"react-dom":f("react-dom",t,void 0,!0),"react-dom/client":f("react-dom",t,"/client",!0),"react-dom/server":f("react-dom",t,"/server",!0),"react/jsx-runtime":f("react",t,"/jsx-runtime",!0),"react/jsx-dev-runtime":f("react",t,"/jsx-dev-runtime",!0)}}function V(t=E){return P(t).react}function w(t=E){return P(t)["react-dom/client"]}function Z(t){return t.replaceAll("+","-").replaceAll("/","_").replaceAll("=","")}function D(t){return Z(btoa(t))}var Ht=Object.freeze({react:"","react-dom":"","react-dom/client":"","react-dom/server":"","react/jsx-runtime":"","react/jsx-dev-runtime":""});function v(t,e){if(!e)return!1;if(Object.prototype.hasOwnProperty.call(e,t))return!0;for(let r of Object.keys(e))if(r.endsWith("/")&&t.startsWith(r))return!0;return!1}function Q(t){try{return JSON.parse(t)?.imports??{}}catch{return{}}}function H(t=document){let e=t.querySelector(\'script[type="importmap"]\');return e?.textContent?Q(e.textContent):{}}var a="/_veryfront",b={RSC:`${a}/rsc/`,FS:`${a}/fs/`,MODULES:`${a}/modules/`,PAGES:`${a}/pages/`,DATA:`${a}/data/`,LIB:`${a}/lib/`,CHUNKS:`${a}/chunks/`,CLIENT:`${a}/client/`},F={HMR_RUNTIME:`${a}/hmr-runtime.js`,HMR:`${a}/hmr.js`,ERROR_OVERLAY:`${a}/error-overlay.js`,DEV_LOADER:`${a}/dev-loader.js`,CLIENT_LOG:`${a}/log`,CLIENT_JS:`${a}/client.js`,ROUTER_JS:`${a}/router.js`,PREFETCH_JS:`${a}/prefetch.js`,MANIFEST_JSON:`${a}/manifest.json`,APP_JS:`${a}/app.js`,RSC_CLIENT:`${a}/rsc/client.js`,RSC_MANIFEST:`${a}/rsc/manifest`,RSC_STREAM:`${a}/rsc/stream`,RSC_PAYLOAD:`${a}/rsc/payload`,RSC_RENDER:`${a}/rsc/render`,RSC_PAGE:`${a}/rsc/page`,RSC_MODULE:`${a}/rsc/module`,RSC_DOM:`${a}/rsc/dom.js`,LIB_CHAT_REACT:`${a}/lib/chat/react.js`,LIB_CHAT_COMPONENTS:`${a}/lib/chat/components.js`,LIB_CHAT_PRIMITIVES:`${a}/lib/chat/primitives.js`};var et={ROOT:".veryfront",CACHE:".veryfront/cache",KV:".veryfront/kv",LOGS:".veryfront/logs",TMP:".veryfront/tmp"},Gt=et.CACHE;var jt={HMR_RUNTIME:F.HMR_RUNTIME,ERROR_OVERLAY:F.ERROR_OVERLAY};var y=b.RSC,$=b.FS,k="veryfront-hydration-data",_="rsc-root";function x(t=document){try{let e=t.getElementById(k);return e?JSON.parse(e.textContent||"{}"):null}catch(e){return console.debug?.("[RSC] hydration data parse failed",e),null}}function S(t){return t?.clientModuleStrategy?t.clientModuleStrategy:t?.dev?"fs":"rsc-module"}function rt(t){return`${$}${D(t)}.js`}function ot(t,e){let r=e?`&v=${encodeURIComponent(e)}`:"";return`${y}module?rel=${encodeURIComponent(t)}${r}`}function T(t){if(t.strategy==="fs"){let e=t.absPath??t.rel;return e?rt(e):null}return ot(t.rel,t.version)}function I(t=document,e=E){let r=H(t);return{react:v("react",r)?"react":V(e),reactDomClient:v("react-dom/client",r)?"react-dom/client":w(e)}}function o(t){return{...t,create(e){return new M(e?.message||e?.detail||t.title,{slug:t.slug,category:t.category,status:e?.status??t.status,title:t.title,suggestion:t.suggestion,detail:e?.detail,cause:e?.cause,instance:e?.instance,context:e?.context})}}}var M=class extends Error{constructor(r,n){super(r);p(this,"slug");p(this,"category");p(this,"status");p(this,"title");p(this,"suggestion");p(this,"detail");p(this,"cause");p(this,"instance");p(this,"context");this.name="VeryfrontError",this.slug=n.slug,this.category=n.category,this.status=n.status,this.title=n.title,this.suggestion=n.suggestion,this.detail=n.detail,this.cause=n.cause,this.instance=n.instance,this.context=n.context}toRFC9457(){return{type:`https://veryfront.com/docs/errors/${this.slug}`,title:this.title,status:this.status,detail:this.detail,instance:this.instance,category:this.category,suggestion:this.suggestion,cause:typeof this.cause=="string"?this.cause:void 0}}getDocsUrl(){return`https://veryfront.com/docs/errors/${this.slug}`}};var le=o({slug:"config-not-found",category:"CONFIG",status:404,title:"Configuration file not found",suggestion:"Run \'vf init\' to create a configuration file"}),ue=o({slug:"config-invalid",category:"CONFIG",status:400,title:"Invalid configuration format",suggestion:"Check your veryfront.config.ts for syntax errors"}),ge=o({slug:"config-parse-error",category:"CONFIG",status:400,title:"Failed to parse configuration",suggestion:"Ensure your configuration file is valid TypeScript/JSON"}),de=o({slug:"config-validation-error",category:"CONFIG",status:422,title:"Configuration validation failed",suggestion:"Check the configuration against the schema requirements"}),pe=o({slug:"config-type-error",category:"CONFIG",status:400,title:"Configuration type mismatch",suggestion:"Ensure configuration values match expected types"}),Re=o({slug:"import-map-invalid",category:"CONFIG",status:400,title:"Invalid import map configuration",suggestion:"Check your import map syntax and paths"}),fe=o({slug:"cors-config-invalid",category:"CONFIG",status:400,title:"Invalid CORS configuration",suggestion:"Review CORS settings in your configuration"}),me=o({slug:"config-validation-failed",category:"CONFIG",status:400,title:"Configuration validation failed",suggestion:"Check configuration values against requirements"}),Ee=o({slug:"build-failed",category:"BUILD",status:500,title:"Build process failed",suggestion:"Check the build output for specific errors"}),ye=o({slug:"bundle-error",category:"BUILD",status:500,title:"Bundle generation failed",suggestion:"Review bundler output for details"}),_e=o({slug:"typescript-error",category:"BUILD",status:500,title:"TypeScript compilation error",suggestion:"Fix TypeScript errors shown in the output"}),he=o({slug:"mdx-compile-error",category:"BUILD",status:500,title:"MDX compilation failed",suggestion:"Check your MDX file syntax"}),Ce=o({slug:"asset-optimization-error",category:"BUILD",status:500,title:"Asset optimization failed",suggestion:"Check asset file formats and paths"}),Oe=o({slug:"ssg-generation-error",category:"BUILD",status:500,title:"Static site generation failed",suggestion:"Review SSG configuration and data fetching"}),xe=o({slug:"sourcemap-error",category:"BUILD",status:500,title:"Source map generation failed",suggestion:"Check source map configuration"}),Se=o({slug:"compilation-error",category:"BUILD",status:500,title:"Compilation failed",suggestion:"Review compiler output for specific errors"}),Te=o({slug:"hydration-mismatch",category:"RUNTIME",status:500,title:"Client/server hydration mismatch",suggestion:"Ensure server and client render the same content"}),Ie=o({slug:"render-error",category:"RUNTIME",status:500,title:"Component render failed",suggestion:"Check component for runtime errors"}),Ae=o({slug:"component-error",category:"RUNTIME",status:500,title:"Component execution error",suggestion:"Review component logic and props"}),Ne=o({slug:"layout-not-found",category:"RUNTIME",status:404,title:"Layout component not found",suggestion:"Ensure layout file exists at the expected path"}),De=o({slug:"page-not-found",category:"RUNTIME",status:404,title:"Page component not found",suggestion:"Check that the page file exists in the routes directory"}),ve=o({slug:"api-error",category:"RUNTIME",status:500,title:"API route handler error",suggestion:"Review API route handler for errors"}),be=o({slug:"middleware-error",category:"RUNTIME",status:500,title:"Middleware execution error",suggestion:"Check middleware function for errors"}),Me=o({slug:"route-conflict",category:"ROUTE",status:409,title:"Conflicting route definitions",suggestion:"Rename or reorganize conflicting route files"}),Le=o({slug:"invalid-route-file",category:"ROUTE",status:400,title:"Invalid route file structure",suggestion:"Ensure route file exports required functions"}),Ue=o({slug:"route-handler-invalid",category:"ROUTE",status:400,title:"Invalid route handler export",suggestion:"Export a valid handler function from the route file"}),Pe=o({slug:"dynamic-route-error",category:"ROUTE",status:500,title:"Dynamic route parsing failed",suggestion:"Check dynamic route segment syntax"}),Ve=o({slug:"route-params-error",category:"ROUTE",status:400,title:"Route parameters invalid",suggestion:"Validate route parameter values"}),we=o({slug:"api-route-error",category:"ROUTE",status:500,title:"API route definition error",suggestion:"Review API route configuration"}),He=o({slug:"module-not-found",category:"MODULE",status:404,title:"Module could not be resolved",suggestion:"Check the import path and ensure the module is installed"}),Fe=o({slug:"import-resolution-error",category:"MODULE",status:500,title:"Import path resolution failed",suggestion:"Verify import paths and module configuration"}),$e=o({slug:"circular-dependency",category:"MODULE",status:500,title:"Circular dependency detected",suggestion:"Refactor imports to break the circular dependency"}),ke=o({slug:"invalid-import",category:"MODULE",status:400,title:"Invalid import statement",suggestion:"Fix import syntax or path"}),Be=o({slug:"dependency-missing",category:"MODULE",status:404,title:"Required dependency not installed",suggestion:"Install the missing dependency with your package manager"}),Ge=o({slug:"version-mismatch",category:"MODULE",status:409,title:"Dependency version mismatch",suggestion:"Update dependencies to compatible versions"}),je=o({slug:"port-in-use",category:"SERVER",status:409,title:"Server port already in use",suggestion:"Use a different port or stop the process using this port"}),Ye=o({slug:"server-start-error",category:"SERVER",status:500,title:"Server failed to start",suggestion:"Check server configuration and port availability"}),We=o({slug:"cache-error",category:"SERVER",status:500,title:"Cache operation failed",suggestion:"Clear the cache and try again"}),qe=o({slug:"file-watch-error",category:"SERVER",status:500,title:"File watcher error",suggestion:"Restart the development server"}),ze=o({slug:"request-error",category:"SERVER",status:500,title:"HTTP request handling error",suggestion:"Check request handler and middleware"}),Xe=o({slug:"service-overloaded",category:"SERVER",status:503,title:"Service overloaded",suggestion:"Reduce load or scale up resources"}),Je=o({slug:"cache-path-mismatch",category:"SERVER",status:500,title:"Cache path mismatch",suggestion:"Clear the cache directory and rebuild"}),Ke=o({slug:"network-error",category:"SERVER",status:502,title:"Network operation failed",suggestion:"Check network connectivity and retry"}),Ze=o({slug:"api-client-error",category:"SERVER",status:500,title:"API client request failed",suggestion:"Check API connectivity and authentication"}),Qe=o({slug:"token-storage-error",category:"SERVER",status:500,title:"Token storage operation failed",suggestion:"Check token storage backend and credentials"}),tr=o({slug:"cache-invariant-violation",category:"SERVER",status:500,title:"Cache path invariant violated",suggestion:"Clear the cache and rebuild"}),er=o({slug:"release-not-found",category:"SERVER",status:404,title:"No active release found",suggestion:"Deploy the project to create a release for this environment"}),rr=o({slug:"fallback-exhausted",category:"SERVER",status:500,title:"Primary and fallback operations both failed",suggestion:"Check service availability and connectivity"}),or=o({slug:"client-boundary-violation",category:"BOUNDARY",status:400,title:"Client boundary rule violation",suggestion:"Add \'use client\' directive or move code to a client component"}),nr=o({slug:"server-only-in-client",category:"BOUNDARY",status:400,title:"Server-only code in client component",suggestion:"Move server-only code to a server component"}),sr=o({slug:"client-only-in-server",category:"BOUNDARY",status:400,title:"Client-only code in server component",suggestion:"Move client-only code to a client component"}),ir=o({slug:"invalid-use-client",category:"BOUNDARY",status:400,title:"Invalid \'use client\' directive",suggestion:"Place \'use client\' at the top of the file"}),ar=o({slug:"invalid-use-server",category:"BOUNDARY",status:400,title:"Invalid \'use server\' directive",suggestion:"Place \'use server\' at the top of the file or function"}),cr=o({slug:"rsc-payload-error",category:"BOUNDARY",status:500,title:"RSC payload serialization error",suggestion:"Ensure props are serializable (no functions, symbols, etc.)"}),lr=o({slug:"hmr-error",category:"DEV",status:500,title:"Hot module replacement error",suggestion:"Restart the development server"}),ur=o({slug:"dev-server-error",category:"DEV",status:500,title:"Development server error",suggestion:"Check the dev server logs and restart"}),gr=o({slug:"fast-refresh-error",category:"DEV",status:500,title:"Fast refresh failed",suggestion:"Save the file again or restart the dev server"}),dr=o({slug:"error-overlay-error",category:"DEV",status:500,title:"Error overlay failed",suggestion:"Check browser console for details"}),pr=o({slug:"source-map-error",category:"DEV",status:500,title:"Source map loading error",suggestion:"Rebuild or clear cache"}),Rr=o({slug:"deployment-error",category:"DEPLOY",status:500,title:"Deployment process failed",suggestion:"Check deployment logs for details"}),fr=o({slug:"platform-error",category:"DEPLOY",status:500,title:"Platform-specific error",suggestion:"Check platform documentation and requirements"}),mr=o({slug:"env-var-missing",category:"DEPLOY",status:500,title:"Required environment variable missing",suggestion:"Set the required environment variable"}),Er=o({slug:"production-build-required",category:"DEPLOY",status:400,title:"Production build required",suggestion:"Run \'vf build\' before deploying"}),yr=o({slug:"agent-error",category:"AGENT",status:500,title:"Agent operation error",suggestion:"Check agent configuration and logs"}),_r=o({slug:"agent-not-found",category:"AGENT",status:404,title:"Agent not found",suggestion:"Verify the agent ID exists"}),hr=o({slug:"agent-timeout",category:"AGENT",status:408,title:"Agent operation timed out",suggestion:"Increase timeout or simplify the request"}),Cr=o({slug:"agent-intent-error",category:"AGENT",status:400,title:"Agent intent parsing error",suggestion:"Rephrase the request more clearly"}),Or=o({slug:"orchestration-error",category:"AGENT",status:500,title:"Multi-agent orchestration error",suggestion:"Check agent coordination logic"}),xr=o({slug:"cost-limit-exceeded",category:"AGENT",status:429,title:"Cost limit exceeded",suggestion:"Wait for the budget period to reset or increase the limit"}),Sr=o({slug:"unknown-error",category:"GENERAL",status:500,title:"Unknown/unclassified error",suggestion:"Check logs for more details"}),Tr=o({slug:"permission-denied",category:"GENERAL",status:403,title:"File/resource permission denied",suggestion:"Check file permissions and access rights"}),Ir=o({slug:"file-not-found",category:"GENERAL",status:404,title:"File not found",suggestion:"Verify the file path exists"}),Ar=o({slug:"resource-not-found",category:"GENERAL",status:404,title:"Requested resource not found",suggestion:"Verify the referenced resource ID or name exists"}),Nr=o({slug:"invalid-argument",category:"GENERAL",status:400,title:"Invalid function argument",suggestion:"Check argument types and values"}),Dr=o({slug:"timeout-error",category:"GENERAL",status:408,title:"Operation timed out",suggestion:"Increase timeout or optimize the operation"}),vr=o({slug:"initialization-error",category:"GENERAL",status:500,title:"Initialization failed",suggestion:"Check initialization requirements and dependencies"}),br=o({slug:"not-supported",category:"GENERAL",status:501,title:"Feature not supported",suggestion:"Check documentation for supported features"}),B=o({slug:"security-violation",category:"GENERAL",status:403,title:"Security violation detected",suggestion:"Check for path traversal or unauthorized access attempts"}),Mr=o({slug:"input-validation-failed",category:"GENERAL",status:400,title:"Input validation failed",suggestion:"Check request input against validation rules"});var nt=[{pattern:/<script[^>]*>[\\s\\S]*?<\\/script>/gi,name:"inline script"},{pattern:/javascript:/gi,name:"javascript: URL"},{pattern:/\\bon\\w+\\s*=/gi,name:"event handler attribute"},{pattern:/data:\\s*text\\/html/gi,name:"data: HTML URL"}];function st(){let t=globalThis;return t.__VERYFRONT_DEV__===!0||t.Deno?.env?.get?.("VERYFRONT_ENV")==="development"}function h(t,e={}){let{strict:r=!1,warn:n=!0}=e;for(let{pattern:s,name:u}of nt)if(s.lastIndex=0,!!s.test(t)&&(n&&console.warn(`[Security] Suspicious ${u} detected in server HTML`),r||!st()))throw B.create({detail:`Potentially unsafe HTML: ${u} detected`});return t}var m=class{constructor(e,r){this.prefix=e;this.level=r}log(e,r,n,...s){this.level>e||r?.(n,...s)}debug(e,...r){this.log(0,console.debug,`[${this.prefix}] DEBUG: ${e}`,...r)}info(e,...r){this.log(1,console.log,`[${this.prefix}] ${e}`,...r)}warn(e,...r){this.log(2,console.warn,`[${this.prefix}] WARN: ${e}`,...r)}error(e,...r){this.log(3,console.error,`[${this.prefix}] ERROR: ${e}`,...r)}};function it(){if(typeof window>"u")return 2;let t=globalThis;return t.__VERYFRONT_DEV__||t.__RSC_DEV__?t.__VERYFRONT_DEBUG__||t.__RSC_DEBUG__?0:1:2}var A=it(),g=new m("RSC",A),Hr=new m("PREFETCH",A),Fr=new m("HYDRATE",A),$r=new m("VERYFRONT",A);function C(t,e){let r=e==="root"?_:`rsc-slot-${e}`,n=t.getElementById(r);if(n)return n;let s=t.createElement("div");return s.id=r,t.body.appendChild(s),s}function at(t,e){if(e.type!=="slot")return;let r=C(t,e.id);r.innerHTML=h(String(e.html??""))}function G(t,e){let r=e.split(`\n`),n=r.pop()??"";for(let s of r){let u=s.trim();if(!u)continue;let c;try{c=JSON.parse(u)}catch(d){g.debug("[client-dom] malformed NDJSON line",{line:u,error:d instanceof Error?d.message:String(d)});continue}if(!c||typeof c!="object")continue;let i=c;if(i.type==="slot"){at(t,i);try{ut(t,i.id||"root")}catch(d){g.debug("[client-dom] hydration optional failed",d)}}}return n}function ct(t){return new Promise((e,r)=>{let n=()=>r(new DOMException("aborted","AbortError"));if(t.aborted){n();return}t.addEventListener("abort",n,{once:!0})})}async function j(t,e=document,r){let n="body"in t?t:null,s=n?.body??t;if(!s)return;let u=s.getReader(),c=new TextDecoder,i="",d=!1;try{for(;;){if(r?.aborted)throw new DOMException("aborted","AbortError");let l=u.read(),{done:R,value:O}=r?await Promise.race([l,ct(r)]):await l;if(R){d=!0;break}i+=c.decode(O,{stream:!0}),i=G(e,i)}i&&G(e,`${i}\n`)}catch(l){throw l instanceof Error&&l.name==="AbortError"||g.debug("[client-dom] consumeNdjsonStream error",l),l}finally{try{await u.cancel()}catch(l){d||g.debug("[client-dom] reader.cancel failed",l)}try{u.releaseLock()}catch(l){g.debug("[client-dom] reader.releaseLock failed",l)}if(typeof s.cancel=="function")try{await s.cancel()}catch(l){g.debug("[client-dom] stream.cancel failed",l)}if(typeof n?.body?.cancel=="function")try{await n.body.cancel()}catch(l){g.debug("[client-dom] response.body.cancel failed",l)}}}function lt(t,e){let r=C(t,e),n=[],s=u=>{let c=u;c.dataset?.clientRef&&n.push(c);for(let i of u.children)s(i)};return s(r),n}function ut(t,e){let r=lt(t,e);for(let n of r){let s=n.dataset?.clientRef;s&&(n.dataset.hydrated="true",g.debug("[client-dom] marked for hydration",s))}}var gt=100;function dt(t,e){if(globalThis.__VF_CLIENT_MOD_CACHE??(globalThis.__VF_CLIENT_MOD_CACHE=new Map),globalThis.__VF_CLIENT_MOD_CACHE.size>=gt){let r=globalThis.__VF_CLIENT_MOD_CACHE.keys().next().value;r&&globalThis.__VF_CLIENT_MOD_CACHE.delete(r)}globalThis.__VF_CLIENT_MOD_CACHE.set(t,e)}function pt(t){let e=t.match(/^\\/app\\/(.+)#([A-Za-z0-9_]+)$/);return e?{rel:`/${e[1]||""}`,exportName:e[2]||"default"}:null}async function Rt(){try{let t=await fetch("/_veryfront/rsc/manifest");return t.ok?await t.json():null}catch{return null}}async function ft(t,e,r){let n=t.graphIds?.client.find(c=>c.rel===e)?.path,s=`${e}#${t.hash??""}`;try{let c=globalThis.__VF_CLIENT_MOD_CACHE?.get(s);if(c)return c}catch(c){g.debug("hydrate: cache get failed",c)}let u=T({strategy:r,rel:e,absPath:n,version:t.hash});if(!u)return null;try{let c=await import(u);try{dt(s,c)}catch(i){g.debug("hydrate: cache set failed",i)}return c}catch(c){return g.debug("hydrate: failed to import module",{moduleUrl:u,error:c}),null}}async function Y(t=document){let e=null;try{e=await Rt()}catch(i){g.debug("hydrate: fetch manifest failed",i)}if(!e){g.debug("hydrate: no manifest");return}let r=Array.from(t.querySelectorAll("[data-client-ref]"));try{let i=globalThis.__VF_MANIFEST_HASH;if(!r.some(l=>l.dataset?.hydrated!=="true")&&i&&e.hash&&i===e.hash)return}catch(i){g.debug("hydrate: hmr hash read failed",i)}if(r.length===0){try{globalThis.__VF_MANIFEST_HASH=e.hash??""}catch(i){g.debug("hydrate: set hash failed",i)}return}let n=S(x(t));try{if(globalThis.__VF_TEST_MODE__){globalThis.__VF_HYDRATE_CALLED=!0,globalThis.__VF_MANIFEST_HASH=e.hash??"";return}}catch(i){g.debug("hydrate: test mode flags failed",i)}let s=I(t),[{default:u},{createRoot:c}]=await Promise.all([import(s.react),import(s.reactDomClient)]);for(let i of r){let d=i.dataset?.clientRef??"";if(!d||i.dataset?.hydrated==="true")continue;let l=pt(d);if(!l)continue;let R=await ft(e,l.rel,n);if(!R)continue;let O=R[l.exportName]??R.default;if(typeof O=="function")try{c(i).render(u.createElement(O,{})),i.dataset.hydrated="true"}catch(U){g.warn("hydrate: render failed",U)}}try{globalThis.__VF_MANIFEST_HASH=e.hash??""}catch(i){g.debug("hydrate: set hash failed (post)",i)}}async function mt(){let t=I(document),[e,r]=await Promise.all([import(t.react),import(t.reactDomClient)]);return{React:e,ReactDOM:r}}var Et=new Set(["SCRIPT","STYLE","NOSCRIPT","TEMPLATE"]);function L(t){let e=t.getAttribute("style")??"";return t.hasAttribute("data-veryfront-head")||t.hasAttribute("hidden")||/(?:^|;)\\s*display\\s*:\\s*none(?:\\s*;|$)/i.test(e)||Et.has(t.tagName.toUpperCase())}function yt(t,e){return t.find(r=>r.tagName.toUpperCase()==="DIV"&&!!r.getAttribute("class")?.trim()&&!L(r))??e}function _t(t,e){return t===e}function ht(t,e){let r=document.createElement("div");r.setAttribute("data-veryfront-hydration-root","page");let n=t.find(s=>!L(s));n?.parentNode===e?e.insertBefore(r,n):e.appendChild(r);for(let s of t)!L(s)&&s.parentNode===e&&r.appendChild(s);return r}function Ct(t,e){return!!e?.pagePath&&typeof t?.__veryfrontRenderPage=="function"}function Ot(t,e){return e?.pagePath?!1:!!t.getElementById(_)}function xt(t=import.meta.url){try{return new URL(t,"http://veryfront.local").searchParams.get("hydrate")==="1"}catch{return!1}}async function St(t){try{let e=await fetch(y+"stream"+t);if(!e.ok||!e.body)return!1;let r=new AbortController;return addEventListener("pagehide",()=>r.abort(),{once:!0}),await j(e,document,r.signal),!0}catch(e){return console.debug?.("[RSC] tryStream failed",e),!1}}async function N(){try{await Y(document)}catch(t){console.debug?.("[RSC] hydration failed",t)}}async function Tt(t,e){try{let{React:r,ReactDOM:n}=await mt(),s=T({strategy:e,rel:t});if(!s)return!1;console.debug?.("[RSC] Loading component from:",s);let c=(await import(s)).default;if(typeof c!="function")return console.debug?.("[RSC] Page component is not a function"),!1;let i=Array.from(document.body.children),d=yt(i,document.body),l=_t(d,document.body)?ht(i,document.body):d,R=r.createElement(c,{});return n.hydrateRoot(l,R,{identifierPrefix:"vf",onRecoverableError:()=>{}}),console.debug?.("[RSC] Page component hydrated successfully"),!0}catch(r){return console.error("[RSC] Page hydration failed",r),!1}}async function It(t){try{let e=await fetch(y+"payload"+t);if(!e.ok)return!1;let r=await e.json();if(r?.slots){for(let[n,s]of Object.entries(r.slots))C(document,n).innerHTML=h(String(s||""));return!0}return C(document,_).innerHTML=h(String(r?.html||"")),!0}catch(e){return console.debug?.("[RSC] payload fetch failed",e),!1}}async function At(){try{let t=globalThis.window?.location.search??"",e=x(document);if(xt()){await N();return}let r=e?.pagePath,n=S(e);if(r){if(Ct(globalThis.window,e)){console.debug?.("[RSC] Page renderer owns hydration");return}console.debug?.("[RSC] Found page component in hydration data:",r),await Tt(r,n)&&console.debug?.("[RSC] Client component hydrated successfully");return}if(!Ot(document,e))return;if(await St(t)){await N();return}if(await It(t)){await N();return}await N()}catch(t){console.error("[RSC] boot failed",t)}}if(typeof document<"u"){let t=()=>{At()};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",t,{once:!0}):t()}export{At as boot,yt as selectHydrationRoot,Ot as shouldAttemptRSCTransport,xt as shouldHydrateOnly,Ct as shouldUsePageRendererHydration,_t as shouldWrapPageHydrationRoot};\n';
8
+ export const CLIENT_BOOT_BUNDLE = 'var W=Object.defineProperty;var q=(t,e,r)=>e in t?W(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var p=(t,e,r)=>q(t,typeof e!="symbol"?e+"":e,r);var z="3.2.3";function X(t,e,r,n){let s=[];if(n?.external?.length&&s.push(`external=${n.external.join(",")}`),s.push(`target=${n?.target??"es2022"}`),n?.deps){let d=Object.entries(n.deps).map(([l,R])=>`${l}@${R}`).join(",");s.push(`deps=${d}`)}let u=e?`@${e}`:"",c=r??"",i=s.length?`?${s.join("&")}`:"";return`https://esm.sh/${t}${u}${c}${i}`}function f(t,e,r,n=!1){return X(t,e,r,{external:n?["react"]:void 0,deps:{csstype:z}})}var K="19.2.4",E=K;function P(t=E){return{react:f("react",t),"react-dom":f("react-dom",t,void 0,!0),"react-dom/client":f("react-dom",t,"/client",!0),"react-dom/server":f("react-dom",t,"/server",!0),"react/jsx-runtime":f("react",t,"/jsx-runtime",!0),"react/jsx-dev-runtime":f("react",t,"/jsx-dev-runtime",!0)}}function V(t=E){return P(t).react}function w(t=E){return P(t)["react-dom/client"]}function Z(t){return t.replaceAll("+","-").replaceAll("/","_").replaceAll("=","")}function D(t){return Z(btoa(t))}var Ht=Object.freeze({react:"","react-dom":"","react-dom/client":"","react-dom/server":"","react/jsx-runtime":"","react/jsx-dev-runtime":""});function v(t,e){if(!e)return!1;if(Object.prototype.hasOwnProperty.call(e,t))return!0;for(let r of Object.keys(e))if(r.endsWith("/")&&t.startsWith(r))return!0;return!1}function Q(t){try{return JSON.parse(t)?.imports??{}}catch{return{}}}function H(t=document){let e=t.querySelector(\'script[type="importmap"]\');return e?.textContent?Q(e.textContent):{}}var a="/_veryfront",b={RSC:`${a}/rsc/`,FS:`${a}/fs/`,MODULES:`${a}/modules/`,PAGES:`${a}/pages/`,DATA:`${a}/data/`,LIB:`${a}/lib/`,CHUNKS:`${a}/chunks/`,CLIENT:`${a}/client/`},F={HMR_RUNTIME:`${a}/hmr-runtime.js`,HMR:`${a}/hmr.js`,ERROR_OVERLAY:`${a}/error-overlay.js`,DEV_LOADER:`${a}/dev-loader.js`,CLIENT_LOG:`${a}/log`,CLIENT_JS:`${a}/client.js`,ROUTER_JS:`${a}/router.js`,PREFETCH_JS:`${a}/prefetch.js`,MANIFEST_JSON:`${a}/manifest.json`,APP_JS:`${a}/app.js`,RSC_CLIENT:`${a}/rsc/client.js`,RSC_MANIFEST:`${a}/rsc/manifest`,RSC_STREAM:`${a}/rsc/stream`,RSC_PAYLOAD:`${a}/rsc/payload`,RSC_RENDER:`${a}/rsc/render`,RSC_PAGE:`${a}/rsc/page`,RSC_MODULE:`${a}/rsc/module`,RSC_DOM:`${a}/rsc/dom.js`,LIB_CHAT_REACT:`${a}/lib/chat/react.js`,LIB_CHAT_COMPONENTS:`${a}/lib/chat/components.js`,LIB_CHAT_PRIMITIVES:`${a}/lib/chat/primitives.js`};var et={ROOT:".veryfront",CACHE:".veryfront/cache",KV:".veryfront/kv",LOGS:".veryfront/logs",TMP:".veryfront/tmp"},Gt=et.CACHE;var jt={HMR_RUNTIME:F.HMR_RUNTIME,ERROR_OVERLAY:F.ERROR_OVERLAY};var y=b.RSC,$=b.FS,k="veryfront-hydration-data",_="rsc-root";function x(t=document){try{let e=t.getElementById(k);return e?JSON.parse(e.textContent||"{}"):null}catch(e){return console.debug?.("[RSC] hydration data parse failed",e),null}}function S(t){return t?.clientModuleStrategy?t.clientModuleStrategy:t?.dev?"fs":"rsc-module"}function rt(t){return`${$}${D(t)}.js`}function ot(t,e){let r=e?`&v=${encodeURIComponent(e)}`:"";return`${y}module?rel=${encodeURIComponent(t)}${r}`}function T(t){if(t.strategy==="fs"){let e=t.absPath??t.rel;return e?rt(e):null}return ot(t.rel,t.version)}function I(t=document,e=E){let r=H(t);return{react:v("react",r)?"react":V(e),reactDomClient:v("react-dom/client",r)?"react-dom/client":w(e)}}function o(t){return{...t,create(e){return new M(e?.message||e?.detail||t.title,{slug:t.slug,category:t.category,status:e?.status??t.status,title:t.title,suggestion:t.suggestion,detail:e?.detail,cause:e?.cause,instance:e?.instance,context:e?.context})}}}var M=class extends Error{constructor(r,n){super(r);p(this,"slug");p(this,"category");p(this,"status");p(this,"title");p(this,"suggestion");p(this,"detail");p(this,"cause");p(this,"instance");p(this,"context");this.name="VeryfrontError",this.slug=n.slug,this.category=n.category,this.status=n.status,this.title=n.title,this.suggestion=n.suggestion,this.detail=n.detail,this.cause=n.cause,this.instance=n.instance,this.context=n.context}toRFC9457(){return{type:`https://veryfront.com/docs/errors/${this.slug}`,title:this.title,status:this.status,detail:this.detail,instance:this.instance,category:this.category,suggestion:this.suggestion,cause:typeof this.cause=="string"?this.cause:void 0}}getDocsUrl(){return`https://veryfront.com/docs/errors/${this.slug}`}};var le=o({slug:"config-not-found",category:"CONFIG",status:404,title:"Configuration file not found",suggestion:"Run \'vf init\' to create a configuration file"}),ue=o({slug:"config-invalid",category:"CONFIG",status:400,title:"Invalid configuration format",suggestion:"Check your veryfront.config.ts for syntax errors"}),ge=o({slug:"config-parse-error",category:"CONFIG",status:400,title:"Failed to parse configuration",suggestion:"Ensure your configuration file is valid TypeScript/JSON"}),de=o({slug:"config-validation-error",category:"CONFIG",status:422,title:"Configuration validation failed",suggestion:"Check the configuration against the schema requirements"}),pe=o({slug:"config-type-error",category:"CONFIG",status:400,title:"Configuration type mismatch",suggestion:"Ensure configuration values match expected types"}),Re=o({slug:"import-map-invalid",category:"CONFIG",status:400,title:"Invalid import map configuration",suggestion:"Check your import map syntax and paths"}),fe=o({slug:"cors-config-invalid",category:"CONFIG",status:400,title:"Invalid CORS configuration",suggestion:"Review CORS settings in your configuration"}),me=o({slug:"config-validation-failed",category:"CONFIG",status:400,title:"Configuration validation failed",suggestion:"Check configuration values against requirements"}),Ee=o({slug:"build-failed",category:"BUILD",status:500,title:"Build process failed",suggestion:"Check the build output for specific errors"}),ye=o({slug:"bundle-error",category:"BUILD",status:500,title:"Bundle generation failed",suggestion:"Review bundler output for details"}),_e=o({slug:"typescript-error",category:"BUILD",status:500,title:"TypeScript compilation error",suggestion:"Fix TypeScript errors shown in the output"}),he=o({slug:"mdx-compile-error",category:"BUILD",status:500,title:"MDX compilation failed",suggestion:"Check your MDX file syntax"}),Ce=o({slug:"asset-optimization-error",category:"BUILD",status:500,title:"Asset optimization failed",suggestion:"Check asset file formats and paths"}),Oe=o({slug:"ssg-generation-error",category:"BUILD",status:500,title:"Static site generation failed",suggestion:"Review SSG configuration and data fetching"}),xe=o({slug:"sourcemap-error",category:"BUILD",status:500,title:"Source map generation failed",suggestion:"Check source map configuration"}),Se=o({slug:"compilation-error",category:"BUILD",status:500,title:"Compilation failed",suggestion:"Review compiler output for specific errors"}),Te=o({slug:"hydration-mismatch",category:"RUNTIME",status:500,title:"Client/server hydration mismatch",suggestion:"Ensure server and client render the same content"}),Ie=o({slug:"render-error",category:"RUNTIME",status:500,title:"Component render failed",suggestion:"Check component for runtime errors"}),Ae=o({slug:"component-error",category:"RUNTIME",status:500,title:"Component execution error",suggestion:"Review component logic and props"}),Ne=o({slug:"layout-not-found",category:"RUNTIME",status:404,title:"Layout component not found",suggestion:"Ensure layout file exists at the expected path"}),De=o({slug:"page-not-found",category:"RUNTIME",status:404,title:"Page component not found",suggestion:"Check that the page file exists in the routes directory"}),ve=o({slug:"api-error",category:"RUNTIME",status:500,title:"API route handler error",suggestion:"Review API route handler for errors"}),be=o({slug:"middleware-error",category:"RUNTIME",status:500,title:"Middleware execution error",suggestion:"Check middleware function for errors"}),Me=o({slug:"route-conflict",category:"ROUTE",status:409,title:"Conflicting route definitions",suggestion:"Rename or reorganize conflicting route files"}),Le=o({slug:"invalid-route-file",category:"ROUTE",status:400,title:"Invalid route file structure",suggestion:"Ensure route file exports required functions"}),Ue=o({slug:"route-handler-invalid",category:"ROUTE",status:400,title:"Invalid route handler export",suggestion:"Export a valid handler function from the route file"}),Pe=o({slug:"dynamic-route-error",category:"ROUTE",status:500,title:"Dynamic route parsing failed",suggestion:"Check dynamic route segment syntax"}),Ve=o({slug:"route-params-error",category:"ROUTE",status:400,title:"Route parameters invalid",suggestion:"Validate route parameter values"}),we=o({slug:"api-route-error",category:"ROUTE",status:500,title:"API route definition error",suggestion:"Review API route configuration"}),He=o({slug:"module-not-found",category:"MODULE",status:404,title:"Module could not be resolved",suggestion:"Check the import path and ensure the module is installed"}),Fe=o({slug:"import-resolution-error",category:"MODULE",status:500,title:"Import path resolution failed",suggestion:"Verify import paths and module configuration"}),$e=o({slug:"circular-dependency",category:"MODULE",status:500,title:"Circular dependency detected",suggestion:"Refactor imports to break the circular dependency"}),ke=o({slug:"invalid-import",category:"MODULE",status:400,title:"Invalid import statement",suggestion:"Fix import syntax or path"}),Be=o({slug:"dependency-missing",category:"MODULE",status:404,title:"Required dependency not installed",suggestion:"Install the missing dependency with your package manager"}),Ge=o({slug:"version-mismatch",category:"MODULE",status:409,title:"Dependency version mismatch",suggestion:"Update dependencies to compatible versions"}),je=o({slug:"port-in-use",category:"SERVER",status:409,title:"Server port already in use",suggestion:"Use a different port or stop the process using this port"}),Ye=o({slug:"server-start-error",category:"SERVER",status:500,title:"Server failed to start",suggestion:"Check server configuration and port availability"}),We=o({slug:"cache-error",category:"SERVER",status:500,title:"Cache operation failed",suggestion:"Clear the cache and try again"}),qe=o({slug:"file-watch-error",category:"SERVER",status:500,title:"File watcher error",suggestion:"Restart the development server"}),ze=o({slug:"request-error",category:"SERVER",status:500,title:"HTTP request handling error",suggestion:"Check request handler and middleware"}),Xe=o({slug:"service-overloaded",category:"SERVER",status:503,title:"Service overloaded",suggestion:"Reduce load or scale up resources"}),Je=o({slug:"cache-path-mismatch",category:"SERVER",status:500,title:"Cache path mismatch",suggestion:"Clear the cache directory and rebuild"}),Ke=o({slug:"network-error",category:"SERVER",status:502,title:"Network operation failed",suggestion:"Check network connectivity and retry"}),Ze=o({slug:"api-client-error",category:"SERVER",status:500,title:"API client request failed",suggestion:"Check API connectivity and authentication"}),Qe=o({slug:"token-storage-error",category:"SERVER",status:500,title:"Token storage operation failed",suggestion:"Check token storage backend and credentials"}),tr=o({slug:"cache-invariant-violation",category:"SERVER",status:500,title:"Cache path invariant violated",suggestion:"Clear the cache and rebuild"}),er=o({slug:"release-not-found",category:"SERVER",status:404,title:"No active release found",suggestion:"Deploy the project to create a release for this environment"}),rr=o({slug:"fallback-exhausted",category:"SERVER",status:500,title:"Primary and fallback operations both failed",suggestion:"Check service availability and connectivity"}),or=o({slug:"client-boundary-violation",category:"BOUNDARY",status:400,title:"Client boundary rule violation",suggestion:"Add \'use client\' directive or move code to a client component"}),nr=o({slug:"server-only-in-client",category:"BOUNDARY",status:400,title:"Server-only code in client component",suggestion:"Move server-only code to a server component"}),sr=o({slug:"client-only-in-server",category:"BOUNDARY",status:400,title:"Client-only code in server component",suggestion:"Move client-only code to a client component"}),ir=o({slug:"invalid-use-client",category:"BOUNDARY",status:400,title:"Invalid \'use client\' directive",suggestion:"Place \'use client\' at the top of the file"}),ar=o({slug:"invalid-use-server",category:"BOUNDARY",status:400,title:"Invalid \'use server\' directive",suggestion:"Place \'use server\' at the top of the file or function"}),cr=o({slug:"rsc-payload-error",category:"BOUNDARY",status:500,title:"RSC payload serialization error",suggestion:"Ensure props are serializable (no functions, symbols, etc.)"}),lr=o({slug:"hmr-error",category:"DEV",status:500,title:"Hot module replacement error",suggestion:"Restart the development server"}),ur=o({slug:"dev-server-error",category:"DEV",status:500,title:"Development server error",suggestion:"Check the dev server logs and restart"}),gr=o({slug:"fast-refresh-error",category:"DEV",status:500,title:"Fast refresh failed",suggestion:"Save the file again or restart the dev server"}),dr=o({slug:"error-overlay-error",category:"DEV",status:500,title:"Error overlay failed",suggestion:"Check browser console for details"}),pr=o({slug:"source-map-error",category:"DEV",status:500,title:"Source map loading error",suggestion:"Rebuild or clear cache"}),Rr=o({slug:"deployment-error",category:"DEPLOY",status:500,title:"Deployment process failed",suggestion:"Check deployment logs for details"}),fr=o({slug:"platform-error",category:"DEPLOY",status:500,title:"Platform-specific error",suggestion:"Check platform documentation and requirements"}),mr=o({slug:"env-var-missing",category:"DEPLOY",status:500,title:"Required environment variable missing",suggestion:"Set the required environment variable"}),Er=o({slug:"production-build-required",category:"DEPLOY",status:400,title:"Production build required",suggestion:"Run \'vf build\' before deploying"}),yr=o({slug:"agent-error",category:"AGENT",status:500,title:"Agent operation error",suggestion:"Check agent configuration and logs"}),_r=o({slug:"agent-not-found",category:"AGENT",status:404,title:"Agent not found",suggestion:"Verify the agent ID exists"}),hr=o({slug:"agent-timeout",category:"AGENT",status:408,title:"Agent operation timed out",suggestion:"Increase timeout or simplify the request"}),Cr=o({slug:"agent-intent-error",category:"AGENT",status:400,title:"Agent intent parsing error",suggestion:"Rephrase the request more clearly"}),Or=o({slug:"orchestration-error",category:"AGENT",status:500,title:"Multi-agent orchestration error",suggestion:"Check agent coordination logic"}),xr=o({slug:"cost-limit-exceeded",category:"AGENT",status:429,title:"Cost limit exceeded",suggestion:"Wait for the budget period to reset or increase the limit"}),Sr=o({slug:"unknown-error",category:"GENERAL",status:500,title:"Unknown/unclassified error",suggestion:"Check logs for more details"}),Tr=o({slug:"permission-denied",category:"GENERAL",status:403,title:"File/resource permission denied",suggestion:"Check file permissions and access rights"}),Ir=o({slug:"file-not-found",category:"GENERAL",status:404,title:"File not found",suggestion:"Verify the file path exists"}),Ar=o({slug:"resource-not-found",category:"GENERAL",status:404,title:"Requested resource not found",suggestion:"Verify the referenced resource ID or name exists"}),Nr=o({slug:"invalid-argument",category:"GENERAL",status:400,title:"Invalid function argument",suggestion:"Check argument types and values"}),Dr=o({slug:"timeout-error",category:"GENERAL",status:408,title:"Operation timed out",suggestion:"Increase timeout or optimize the operation"}),vr=o({slug:"initialization-error",category:"GENERAL",status:500,title:"Initialization failed",suggestion:"Check initialization requirements and dependencies"}),br=o({slug:"not-supported",category:"GENERAL",status:501,title:"Feature not supported",suggestion:"Check documentation for supported features"}),B=o({slug:"security-violation",category:"GENERAL",status:403,title:"Security violation detected",suggestion:"Check for path traversal or unauthorized access attempts"}),Mr=o({slug:"input-validation-failed",category:"GENERAL",status:400,title:"Input validation failed",suggestion:"Check request input against validation rules"});var nt=[{pattern:/<script[^>]*>[\\s\\S]*?<\\/script>/gi,name:"inline script"},{pattern:/javascript:/gi,name:"javascript: URL"},{pattern:/\\bon\\w+\\s*=/gi,name:"event handler attribute"},{pattern:/data:\\s*text\\/html/gi,name:"data: HTML URL"}];function st(){let t=globalThis;return t.__VERYFRONT_DEV__===!0||t.Deno?.env?.get?.("VERYFRONT_ENV")==="development"}function h(t,e={}){let{strict:r=!1,warn:n=!0}=e;for(let{pattern:s,name:u}of nt)if(s.lastIndex=0,!!s.test(t)&&(n&&console.warn(`[Security] Suspicious ${u} detected in server HTML`),r||!st()))throw B.create({detail:`Potentially unsafe HTML: ${u} detected`});return t}var m=class{constructor(e,r){this.prefix=e;this.level=r}log(e,r,n,...s){this.level>e||r?.(n,...s)}debug(e,...r){this.log(0,console.debug,`[${this.prefix}] DEBUG: ${e}`,...r)}info(e,...r){this.log(1,console.log,`[${this.prefix}] ${e}`,...r)}warn(e,...r){this.log(2,console.warn,`[${this.prefix}] WARN: ${e}`,...r)}error(e,...r){this.log(3,console.error,`[${this.prefix}] ERROR: ${e}`,...r)}};function it(){if(typeof window>"u")return 2;let t=globalThis;return t.__VERYFRONT_DEV__||t.__RSC_DEV__?t.__VERYFRONT_DEBUG__||t.__RSC_DEBUG__?0:1:2}var A=it(),g=new m("RSC",A),Hr=new m("PREFETCH",A),Fr=new m("HYDRATE",A),$r=new m("VERYFRONT",A);function C(t,e){let r=e==="root"?_:`rsc-slot-${e}`,n=t.getElementById(r);if(n)return n;let s=t.createElement("div");return s.id=r,t.body.appendChild(s),s}function at(t,e){if(e.type!=="slot")return;let r=C(t,e.id);r.innerHTML=h(String(e.html??""))}function G(t,e){let r=e.split(`\n`),n=r.pop()??"";for(let s of r){let u=s.trim();if(!u)continue;let c;try{c=JSON.parse(u)}catch(d){g.debug("[client-dom] malformed NDJSON line",{line:u,error:d instanceof Error?d.message:String(d)});continue}if(!c||typeof c!="object")continue;let i=c;if(i.type==="slot"){at(t,i);try{ut(t,i.id||"root")}catch(d){g.debug("[client-dom] hydration optional failed",d)}}}return n}function ct(t){return new Promise((e,r)=>{let n=()=>r(new DOMException("aborted","AbortError"));if(t.aborted){n();return}t.addEventListener("abort",n,{once:!0})})}async function j(t,e=document,r){let n="body"in t?t:null,s=n?.body??t;if(!s)return;let u=s.getReader(),c=new TextDecoder,i="",d=!1;try{for(;;){if(r?.aborted)throw new DOMException("aborted","AbortError");let l=u.read(),{done:R,value:O}=r?await Promise.race([l,ct(r)]):await l;if(R){d=!0;break}i+=c.decode(O,{stream:!0}),i=G(e,i)}i&&G(e,`${i}\n`)}catch(l){throw l instanceof Error&&l.name==="AbortError"||g.debug("[client-dom] consumeNdjsonStream error",l),l}finally{try{await u.cancel()}catch(l){d||g.debug("[client-dom] reader.cancel failed",l)}try{u.releaseLock()}catch(l){g.debug("[client-dom] reader.releaseLock failed",l)}if(typeof s.cancel=="function")try{await s.cancel()}catch(l){g.debug("[client-dom] stream.cancel failed",l)}if(typeof n?.body?.cancel=="function")try{await n.body.cancel()}catch(l){g.debug("[client-dom] response.body.cancel failed",l)}}}function lt(t,e){let r=C(t,e),n=[],s=u=>{let c=u;c.dataset?.clientRef&&n.push(c);for(let i of u.children)s(i)};return s(r),n}function ut(t,e){let r=lt(t,e);for(let n of r){let s=n.dataset?.clientRef;s&&(n.dataset.hydrated="true",g.debug("[client-dom] marked for hydration",s))}}var gt=100;function dt(t,e){if(globalThis.__VF_CLIENT_MOD_CACHE??(globalThis.__VF_CLIENT_MOD_CACHE=new Map),globalThis.__VF_CLIENT_MOD_CACHE.size>=gt){let r=globalThis.__VF_CLIENT_MOD_CACHE.keys().next().value;r&&globalThis.__VF_CLIENT_MOD_CACHE.delete(r)}globalThis.__VF_CLIENT_MOD_CACHE.set(t,e)}function pt(t){let e=t.match(/^\\/app\\/(.+)#([A-Za-z0-9_]+)$/);return e?{rel:`/${e[1]||""}`,exportName:e[2]||"default"}:null}async function Rt(){try{let t=await fetch("/_veryfront/rsc/manifest");return t.ok?await t.json():null}catch{return null}}async function ft(t,e,r){let n=t.graphIds?.client.find(c=>c.rel===e)?.path,s=`${e}#${t.hash??""}`;try{let c=globalThis.__VF_CLIENT_MOD_CACHE?.get(s);if(c)return c}catch(c){g.debug("hydrate: cache get failed",c)}let u=T({strategy:r,rel:e,absPath:n,version:t.hash});if(!u)return null;try{let c=await import(u);try{dt(s,c)}catch(i){g.debug("hydrate: cache set failed",i)}return c}catch(c){return g.debug("hydrate: failed to import module",{moduleUrl:u,error:c}),null}}async function Y(t=document){let e=null;try{e=await Rt()}catch(i){g.debug("hydrate: fetch manifest failed",i)}if(!e){g.debug("hydrate: no manifest");return}let r=Array.from(t.querySelectorAll("[data-client-ref]"));try{let i=globalThis.__VF_MANIFEST_HASH;if(!r.some(l=>l.dataset?.hydrated!=="true")&&i&&e.hash&&i===e.hash)return}catch(i){g.debug("hydrate: hmr hash read failed",i)}if(r.length===0){try{globalThis.__VF_MANIFEST_HASH=e.hash??""}catch(i){g.debug("hydrate: set hash failed",i)}return}let n=S(x(t));try{if(globalThis.__VF_TEST_MODE__){globalThis.__VF_HYDRATE_CALLED=!0,globalThis.__VF_MANIFEST_HASH=e.hash??"";return}}catch(i){g.debug("hydrate: test mode flags failed",i)}let s=I(t),[{default:u},{createRoot:c}]=await Promise.all([import(s.react),import(s.reactDomClient)]);for(let i of r){let d=i.dataset?.clientRef??"";if(!d||i.dataset?.hydrated==="true")continue;let l=pt(d);if(!l)continue;let R=await ft(e,l.rel,n);if(!R)continue;let O=R[l.exportName]??R.default;if(typeof O=="function")try{c(i).render(u.createElement(O,{})),i.dataset.hydrated="true"}catch(U){g.warn("hydrate: render failed",U)}}try{globalThis.__VF_MANIFEST_HASH=e.hash??""}catch(i){g.debug("hydrate: set hash failed (post)",i)}}async function mt(){let t=I(document),[e,r]=await Promise.all([import(t.react),import(t.reactDomClient)]);return{React:e,ReactDOM:r}}var Et=new Set(["SCRIPT","STYLE","NOSCRIPT","TEMPLATE"]);function L(t){let e=t.getAttribute("style")??"";return t.hasAttribute("data-veryfront-head")||t.hasAttribute("hidden")||/(?:^|;)\\s*display\\s*:\\s*none(?:\\s*;|$)/i.test(e)||Et.has(t.tagName.toUpperCase())}function yt(t,e){return t.find(r=>r.tagName.toUpperCase()==="DIV"&&!!r.getAttribute("class")?.trim()&&!L(r))??e}function _t(t,e){return t===e}function ht(t,e){let r=document.createElement("div");r.setAttribute("data-veryfront-hydration-root","page");let n=t.find(s=>!L(s));n?.parentNode===e?e.insertBefore(r,n):e.appendChild(r);for(let s of t)!L(s)&&s.parentNode===e&&r.appendChild(s);return r}function Ct(t,e){return!!e?.pagePath&&typeof t?.__veryfrontRenderPage=="function"}function Ot(t,e){return e?.pagePath?!1:!!t.getElementById(_)}function xt(t=import.meta.url){try{return new URL(t,"http://veryfront.local").searchParams.get("hydrate")==="1"}catch{return!1}}async function St(t){try{let e=await fetch(y+"stream"+t);if(!e.ok||!e.body)return!1;let r=new AbortController;return addEventListener("pagehide",()=>r.abort(),{once:!0}),await j(e,document,r.signal),!0}catch(e){return console.debug?.("[RSC] tryStream failed",e),!1}}async function N(){try{await Y(document)}catch(t){console.debug?.("[RSC] hydration failed",t)}}async function Tt(t,e){try{let{React:r,ReactDOM:n}=await mt(),s=T({strategy:e,rel:t});if(!s)return!1;console.debug?.("[RSC] Loading component from:",s);let c=(await import(s)).default;if(typeof c!="function")return console.debug?.("[RSC] Page component is not a function"),!1;let i=Array.from(document.body.children),d=yt(i,document.body),l=_t(d,document.body)?ht(i,document.body):d,R=r.createElement(c,{});return n.hydrateRoot(l,R,{identifierPrefix:"vf",onRecoverableError:()=>{}}),console.debug?.("[RSC] Page component hydrated successfully"),!0}catch(r){return console.error("[RSC] Page hydration failed",r),!1}}async function It(t){try{let e=await fetch(y+"payload"+t);if(!e.ok)return!1;let r=await e.json();if(r?.slots){for(let[n,s]of Object.entries(r.slots))C(document,n).innerHTML=h(String(s||""));return!0}return C(document,_).innerHTML=h(String(r?.html||"")),!0}catch(e){return console.debug?.("[RSC] payload fetch failed",e),!1}}async function At(){try{let t=globalThis.window?.location.search??"",e=x(document);if(xt()){await N();return}let r=e?.pagePath,n=S(e);if(r){if(Ct(globalThis.window,e)){console.debug?.("[RSC] Page renderer owns hydration");return}console.debug?.("[RSC] Found page component in hydration data:",r),await Tt(r,n)&&console.debug?.("[RSC] Client component hydrated successfully");return}if(!Ot(document,e))return;if(await St(t)){await N();return}if(await It(t)){await N();return}await N()}catch(t){console.error("[RSC] boot failed",t)}}if(typeof document<"u"){let t=()=>{At()};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",t,{once:!0}):t()}export{At as boot,yt as selectHydrationRoot,Ot as shouldAttemptRSCTransport,xt as shouldHydrateOnly,Ct as shouldUsePageRendererHydration,_t as shouldWrapPageHydrationRoot};\n';
9
9
  export const CLIENT_DOM_BUNDLE = 'var N=Object.defineProperty;var A=(r,t,o)=>t in r?N(r,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):r[t]=o;var l=(r,t,o)=>A(r,typeof t!="symbol"?t+"":t,o);function e(r){return{...r,create(t){return new f(t?.message||t?.detail||r.title,{slug:r.slug,category:r.category,status:t?.status??r.status,title:r.title,suggestion:r.suggestion,detail:t?.detail,cause:t?.cause,instance:t?.instance,context:t?.context})}}}var f=class extends Error{constructor(o,s){super(o);l(this,"slug");l(this,"category");l(this,"status");l(this,"title");l(this,"suggestion");l(this,"detail");l(this,"cause");l(this,"instance");l(this,"context");this.name="VeryfrontError",this.slug=s.slug,this.category=s.category,this.status=s.status,this.title=s.title,this.suggestion=s.suggestion,this.detail=s.detail,this.cause=s.cause,this.instance=s.instance,this.context=s.context}toRFC9457(){return{type:`https://veryfront.com/docs/errors/${this.slug}`,title:this.title,status:this.status,detail:this.detail,instance:this.instance,category:this.category,suggestion:this.suggestion,cause:typeof this.cause=="string"?this.cause:void 0}}getDocsUrl(){return`https://veryfront.com/docs/errors/${this.slug}`}};var z=e({slug:"config-not-found",category:"CONFIG",status:404,title:"Configuration file not found",suggestion:"Run \'vf init\' to create a configuration file"}),W=e({slug:"config-invalid",category:"CONFIG",status:400,title:"Invalid configuration format",suggestion:"Check your veryfront.config.ts for syntax errors"}),X=e({slug:"config-parse-error",category:"CONFIG",status:400,title:"Failed to parse configuration",suggestion:"Ensure your configuration file is valid TypeScript/JSON"}),J=e({slug:"config-validation-error",category:"CONFIG",status:422,title:"Configuration validation failed",suggestion:"Check the configuration against the schema requirements"}),K=e({slug:"config-type-error",category:"CONFIG",status:400,title:"Configuration type mismatch",suggestion:"Ensure configuration values match expected types"}),Z=e({slug:"import-map-invalid",category:"CONFIG",status:400,title:"Invalid import map configuration",suggestion:"Check your import map syntax and paths"}),Q=e({slug:"cors-config-invalid",category:"CONFIG",status:400,title:"Invalid CORS configuration",suggestion:"Review CORS settings in your configuration"}),ee=e({slug:"config-validation-failed",category:"CONFIG",status:400,title:"Configuration validation failed",suggestion:"Check configuration values against requirements"}),te=e({slug:"build-failed",category:"BUILD",status:500,title:"Build process failed",suggestion:"Check the build output for specific errors"}),re=e({slug:"bundle-error",category:"BUILD",status:500,title:"Bundle generation failed",suggestion:"Review bundler output for details"}),oe=e({slug:"typescript-error",category:"BUILD",status:500,title:"TypeScript compilation error",suggestion:"Fix TypeScript errors shown in the output"}),se=e({slug:"mdx-compile-error",category:"BUILD",status:500,title:"MDX compilation failed",suggestion:"Check your MDX file syntax"}),ne=e({slug:"asset-optimization-error",category:"BUILD",status:500,title:"Asset optimization failed",suggestion:"Check asset file formats and paths"}),ie=e({slug:"ssg-generation-error",category:"BUILD",status:500,title:"Static site generation failed",suggestion:"Review SSG configuration and data fetching"}),ae=e({slug:"sourcemap-error",category:"BUILD",status:500,title:"Source map generation failed",suggestion:"Check source map configuration"}),ce=e({slug:"compilation-error",category:"BUILD",status:500,title:"Compilation failed",suggestion:"Review compiler output for specific errors"}),ue=e({slug:"hydration-mismatch",category:"RUNTIME",status:500,title:"Client/server hydration mismatch",suggestion:"Ensure server and client render the same content"}),le=e({slug:"render-error",category:"RUNTIME",status:500,title:"Component render failed",suggestion:"Check component for runtime errors"}),ge=e({slug:"component-error",category:"RUNTIME",status:500,title:"Component execution error",suggestion:"Review component logic and props"}),de=e({slug:"layout-not-found",category:"RUNTIME",status:404,title:"Layout component not found",suggestion:"Ensure layout file exists at the expected path"}),pe=e({slug:"page-not-found",category:"RUNTIME",status:404,title:"Page component not found",suggestion:"Check that the page file exists in the routes directory"}),Ee=e({slug:"api-error",category:"RUNTIME",status:500,title:"API route handler error",suggestion:"Review API route handler for errors"}),Re=e({slug:"middleware-error",category:"RUNTIME",status:500,title:"Middleware execution error",suggestion:"Check middleware function for errors"}),fe=e({slug:"route-conflict",category:"ROUTE",status:409,title:"Conflicting route definitions",suggestion:"Rename or reorganize conflicting route files"}),me=e({slug:"invalid-route-file",category:"ROUTE",status:400,title:"Invalid route file structure",suggestion:"Ensure route file exports required functions"}),ye=e({slug:"route-handler-invalid",category:"ROUTE",status:400,title:"Invalid route handler export",suggestion:"Export a valid handler function from the route file"}),_e=e({slug:"dynamic-route-error",category:"ROUTE",status:500,title:"Dynamic route parsing failed",suggestion:"Check dynamic route segment syntax"}),Oe=e({slug:"route-params-error",category:"ROUTE",status:400,title:"Route parameters invalid",suggestion:"Validate route parameter values"}),he=e({slug:"api-route-error",category:"ROUTE",status:500,title:"API route definition error",suggestion:"Review API route configuration"}),Te=e({slug:"module-not-found",category:"MODULE",status:404,title:"Module could not be resolved",suggestion:"Check the import path and ensure the module is installed"}),Ie=e({slug:"import-resolution-error",category:"MODULE",status:500,title:"Import path resolution failed",suggestion:"Verify import paths and module configuration"}),ve=e({slug:"circular-dependency",category:"MODULE",status:500,title:"Circular dependency detected",suggestion:"Refactor imports to break the circular dependency"}),xe=e({slug:"invalid-import",category:"MODULE",status:400,title:"Invalid import statement",suggestion:"Fix import syntax or path"}),Ne=e({slug:"dependency-missing",category:"MODULE",status:404,title:"Required dependency not installed",suggestion:"Install the missing dependency with your package manager"}),Ae=e({slug:"version-mismatch",category:"MODULE",status:409,title:"Dependency version mismatch",suggestion:"Update dependencies to compatible versions"}),Ce=e({slug:"port-in-use",category:"SERVER",status:409,title:"Server port already in use",suggestion:"Use a different port or stop the process using this port"}),Se=e({slug:"server-start-error",category:"SERVER",status:500,title:"Server failed to start",suggestion:"Check server configuration and port availability"}),De=e({slug:"cache-error",category:"SERVER",status:500,title:"Cache operation failed",suggestion:"Clear the cache and try again"}),Le=e({slug:"file-watch-error",category:"SERVER",status:500,title:"File watcher error",suggestion:"Restart the development server"}),Ue=e({slug:"request-error",category:"SERVER",status:500,title:"HTTP request handling error",suggestion:"Check request handler and middleware"}),be=e({slug:"service-overloaded",category:"SERVER",status:503,title:"Service overloaded",suggestion:"Reduce load or scale up resources"}),Me=e({slug:"cache-path-mismatch",category:"SERVER",status:500,title:"Cache path mismatch",suggestion:"Clear the cache directory and rebuild"}),Pe=e({slug:"network-error",category:"SERVER",status:502,title:"Network operation failed",suggestion:"Check network connectivity and retry"}),Ve=e({slug:"api-client-error",category:"SERVER",status:500,title:"API client request failed",suggestion:"Check API connectivity and authentication"}),Fe=e({slug:"token-storage-error",category:"SERVER",status:500,title:"Token storage operation failed",suggestion:"Check token storage backend and credentials"}),ke=e({slug:"cache-invariant-violation",category:"SERVER",status:500,title:"Cache path invariant violated",suggestion:"Clear the cache and rebuild"}),we=e({slug:"release-not-found",category:"SERVER",status:404,title:"No active release found",suggestion:"Deploy the project to create a release for this environment"}),Ge=e({slug:"fallback-exhausted",category:"SERVER",status:500,title:"Primary and fallback operations both failed",suggestion:"Check service availability and connectivity"}),He=e({slug:"client-boundary-violation",category:"BOUNDARY",status:400,title:"Client boundary rule violation",suggestion:"Add \'use client\' directive or move code to a client component"}),Be=e({slug:"server-only-in-client",category:"BOUNDARY",status:400,title:"Server-only code in client component",suggestion:"Move server-only code to a server component"}),$e=e({slug:"client-only-in-server",category:"BOUNDARY",status:400,title:"Client-only code in server component",suggestion:"Move client-only code to a client component"}),Ye=e({slug:"invalid-use-client",category:"BOUNDARY",status:400,title:"Invalid \'use client\' directive",suggestion:"Place \'use client\' at the top of the file"}),je=e({slug:"invalid-use-server",category:"BOUNDARY",status:400,title:"Invalid \'use server\' directive",suggestion:"Place \'use server\' at the top of the file or function"}),qe=e({slug:"rsc-payload-error",category:"BOUNDARY",status:500,title:"RSC payload serialization error",suggestion:"Ensure props are serializable (no functions, symbols, etc.)"}),ze=e({slug:"hmr-error",category:"DEV",status:500,title:"Hot module replacement error",suggestion:"Restart the development server"}),We=e({slug:"dev-server-error",category:"DEV",status:500,title:"Development server error",suggestion:"Check the dev server logs and restart"}),Xe=e({slug:"fast-refresh-error",category:"DEV",status:500,title:"Fast refresh failed",suggestion:"Save the file again or restart the dev server"}),Je=e({slug:"error-overlay-error",category:"DEV",status:500,title:"Error overlay failed",suggestion:"Check browser console for details"}),Ke=e({slug:"source-map-error",category:"DEV",status:500,title:"Source map loading error",suggestion:"Rebuild or clear cache"}),Ze=e({slug:"deployment-error",category:"DEPLOY",status:500,title:"Deployment process failed",suggestion:"Check deployment logs for details"}),Qe=e({slug:"platform-error",category:"DEPLOY",status:500,title:"Platform-specific error",suggestion:"Check platform documentation and requirements"}),et=e({slug:"env-var-missing",category:"DEPLOY",status:500,title:"Required environment variable missing",suggestion:"Set the required environment variable"}),tt=e({slug:"production-build-required",category:"DEPLOY",status:400,title:"Production build required",suggestion:"Run \'vf build\' before deploying"}),rt=e({slug:"agent-error",category:"AGENT",status:500,title:"Agent operation error",suggestion:"Check agent configuration and logs"}),ot=e({slug:"agent-not-found",category:"AGENT",status:404,title:"Agent not found",suggestion:"Verify the agent ID exists"}),st=e({slug:"agent-timeout",category:"AGENT",status:408,title:"Agent operation timed out",suggestion:"Increase timeout or simplify the request"}),nt=e({slug:"agent-intent-error",category:"AGENT",status:400,title:"Agent intent parsing error",suggestion:"Rephrase the request more clearly"}),it=e({slug:"orchestration-error",category:"AGENT",status:500,title:"Multi-agent orchestration error",suggestion:"Check agent coordination logic"}),at=e({slug:"cost-limit-exceeded",category:"AGENT",status:429,title:"Cost limit exceeded",suggestion:"Wait for the budget period to reset or increase the limit"}),ct=e({slug:"unknown-error",category:"GENERAL",status:500,title:"Unknown/unclassified error",suggestion:"Check logs for more details"}),ut=e({slug:"permission-denied",category:"GENERAL",status:403,title:"File/resource permission denied",suggestion:"Check file permissions and access rights"}),lt=e({slug:"file-not-found",category:"GENERAL",status:404,title:"File not found",suggestion:"Verify the file path exists"}),gt=e({slug:"resource-not-found",category:"GENERAL",status:404,title:"Requested resource not found",suggestion:"Verify the referenced resource ID or name exists"}),dt=e({slug:"invalid-argument",category:"GENERAL",status:400,title:"Invalid function argument",suggestion:"Check argument types and values"}),pt=e({slug:"timeout-error",category:"GENERAL",status:408,title:"Operation timed out",suggestion:"Increase timeout or optimize the operation"}),Et=e({slug:"initialization-error",category:"GENERAL",status:500,title:"Initialization failed",suggestion:"Check initialization requirements and dependencies"}),Rt=e({slug:"not-supported",category:"GENERAL",status:501,title:"Feature not supported",suggestion:"Check documentation for supported features"}),y=e({slug:"security-violation",category:"GENERAL",status:403,title:"Security violation detected",suggestion:"Check for path traversal or unauthorized access attempts"}),ft=e({slug:"input-validation-failed",category:"GENERAL",status:400,title:"Input validation failed",suggestion:"Check request input against validation rules"});var C=[{pattern:/<script[^>]*>[\\s\\S]*?<\\/script>/gi,name:"inline script"},{pattern:/javascript:/gi,name:"javascript: URL"},{pattern:/\\bon\\w+\\s*=/gi,name:"event handler attribute"},{pattern:/data:\\s*text\\/html/gi,name:"data: HTML URL"}];function S(){let r=globalThis;return r.__VERYFRONT_DEV__===!0||r.Deno?.env?.get?.("VERYFRONT_ENV")==="development"}function _(r,t={}){let{strict:o=!1,warn:s=!0}=t;for(let{pattern:i,name:c}of C)if(i.lastIndex=0,!!i.test(r)&&(s&&console.warn(`[Security] Suspicious ${c} detected in server HTML`),o||!S()))throw y.create({detail:`Potentially unsafe HTML: ${c} detected`});return r}var E=class{constructor(t,o){this.prefix=t;this.level=o}log(t,o,s,...i){this.level>t||o?.(s,...i)}debug(t,...o){this.log(0,console.debug,`[${this.prefix}] DEBUG: ${t}`,...o)}info(t,...o){this.log(1,console.log,`[${this.prefix}] ${t}`,...o)}warn(t,...o){this.log(2,console.warn,`[${this.prefix}] WARN: ${t}`,...o)}error(t,...o){this.log(3,console.error,`[${this.prefix}] ERROR: ${t}`,...o)}};function D(){if(typeof window>"u")return 2;let r=globalThis;return r.__VERYFRONT_DEV__||r.__RSC_DEV__?r.__VERYFRONT_DEBUG__||r.__RSC_DEBUG__?0:1:2}var R=D(),d=new E("RSC",R),Tt=new E("PREFETCH",R),It=new E("HYDRATE",R),vt=new E("VERYFRONT",R);var n="/_veryfront",m={RSC:`${n}/rsc/`,FS:`${n}/fs/`,MODULES:`${n}/modules/`,PAGES:`${n}/pages/`,DATA:`${n}/data/`,LIB:`${n}/lib/`,CHUNKS:`${n}/chunks/`,CLIENT:`${n}/client/`},O={HMR_RUNTIME:`${n}/hmr-runtime.js`,HMR:`${n}/hmr.js`,ERROR_OVERLAY:`${n}/error-overlay.js`,DEV_LOADER:`${n}/dev-loader.js`,CLIENT_LOG:`${n}/log`,CLIENT_JS:`${n}/client.js`,ROUTER_JS:`${n}/router.js`,PREFETCH_JS:`${n}/prefetch.js`,MANIFEST_JSON:`${n}/manifest.json`,APP_JS:`${n}/app.js`,RSC_CLIENT:`${n}/rsc/client.js`,RSC_MANIFEST:`${n}/rsc/manifest`,RSC_STREAM:`${n}/rsc/stream`,RSC_PAYLOAD:`${n}/rsc/payload`,RSC_RENDER:`${n}/rsc/render`,RSC_PAGE:`${n}/rsc/page`,RSC_MODULE:`${n}/rsc/module`,RSC_DOM:`${n}/rsc/dom.js`,LIB_CHAT_REACT:`${n}/lib/chat/react.js`,LIB_CHAT_COMPONENTS:`${n}/lib/chat/components.js`,LIB_CHAT_PRIMITIVES:`${n}/lib/chat/primitives.js`};var U={ROOT:".veryfront",CACHE:".veryfront/cache",KV:".veryfront/kv",LOGS:".veryfront/logs",TMP:".veryfront/tmp"},St=U.CACHE;var Dt={HMR_RUNTIME:O.HMR_RUNTIME,ERROR_OVERLAY:O.ERROR_OVERLAY};var Mt=m.RSC,Pt=m.FS;var h="rsc-root";function I(r,t){let o=t==="root"?h:`rsc-slot-${t}`,s=r.getElementById(o);if(s)return s;let i=r.createElement("div");return i.id=o,r.body.appendChild(i),i}function b(r,t){if(t.type!=="slot")return;let o=I(r,t.id);o.innerHTML=_(String(t.html??""))}function T(r,t){let o=t.split(`\n`),s=o.pop()??"";for(let i of o){let c=i.trim();if(!c)continue;let g;try{g=JSON.parse(c)}catch(p){d.debug("[client-dom] malformed NDJSON line",{line:c,error:p instanceof Error?p.message:String(p)});continue}if(!g||typeof g!="object")continue;let u=g;if(u.type==="slot"){b(r,u);try{V(r,u.id||"root")}catch(p){d.debug("[client-dom] hydration optional failed",p)}}}return s}function M(r){return new Promise((t,o)=>{let s=()=>o(new DOMException("aborted","AbortError"));if(r.aborted){s();return}r.addEventListener("abort",s,{once:!0})})}async function Gt(r,t=document,o){let s="body"in r?r:null,i=s?.body??r;if(!i)return;let c=i.getReader(),g=new TextDecoder,u="",p=!1;try{for(;;){if(o?.aborted)throw new DOMException("aborted","AbortError");let a=c.read(),{done:v,value:x}=o?await Promise.race([a,M(o)]):await a;if(v){p=!0;break}u+=g.decode(x,{stream:!0}),u=T(t,u)}u&&T(t,`${u}\n`)}catch(a){throw a instanceof Error&&a.name==="AbortError"||d.debug("[client-dom] consumeNdjsonStream error",a),a}finally{try{await c.cancel()}catch(a){p||d.debug("[client-dom] reader.cancel failed",a)}try{c.releaseLock()}catch(a){d.debug("[client-dom] reader.releaseLock failed",a)}if(typeof i.cancel=="function")try{await i.cancel()}catch(a){d.debug("[client-dom] stream.cancel failed",a)}if(typeof s?.body?.cancel=="function")try{await s.body.cancel()}catch(a){d.debug("[client-dom] response.body.cancel failed",a)}}}function P(r,t){let o=I(r,t),s=[],i=c=>{let g=c;g.dataset?.clientRef&&s.push(g);for(let u of c.children)i(u)};return i(o),s}function V(r,t){let o=P(r,t);for(let s of o){let i=s.dataset?.clientRef;i&&(s.dataset.hydrated="true",d.debug("[client-dom] marked for hydration",i))}}export{Gt as consumeNdjsonStream,I as getContainer};\n';
@@ -4,8 +4,15 @@
4
4
  * Single source of truth for all URL generation.
5
5
  * Ensures consistent URLs across SSR and browser for hydration parity.
6
6
  */
7
- /** Default React version - used when not specified */
8
- export declare const DEFAULT_REACT_VERSION = "19.1.1";
7
+ /**
8
+ * Default React version - used when not specified.
9
+ *
10
+ * MUST match the React version the build bundles (see `react/deno.json`),
11
+ * because veryfront's framework React re-export is generated against that
12
+ * version and references its named exports. A drift guard in
13
+ * `src/utils/constants/cdn.test.ts` enforces this.
14
+ */
15
+ export declare const DEFAULT_REACT_VERSION = "19.2.4";
9
16
  /** Tailwind CSS version */
10
17
  export declare const TAILWIND_VERSION = "4.1.8";
11
18
  /** csstype version - must match deno.json for type consistency */
@@ -1 +1 @@
1
- {"version":3,"file":"url-builder.d.ts","sourceRoot":"","sources":["../../../../src/src/transforms/import-rewriter/url-builder.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,sDAAsD;AACtD,eAAO,MAAM,qBAAqB,WAAW,CAAC;AAE9C,2BAA2B;AAC3B,eAAO,MAAM,gBAAgB,UAAU,CAAC;AAExC,kEAAkE;AAClE,eAAO,MAAM,eAAe,UAAU,CAAC;AAEvC,KAAK,YAAY,GAAG;IAClB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,MAA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AE;IAAE,eAAe,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,MAAM,CAGhG;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAE/C;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAMtE"}
@@ -4,8 +4,15 @@
4
4
  * Single source of truth for all URL generation.
5
5
  * Ensures consistent URLs across SSR and browser for hydration parity.
6
6
  */
7
- /** Default React version - used when not specified */
8
- export const DEFAULT_REACT_VERSION = "19.1.1";
7
+ /**
8
+ * Default React version - used when not specified.
9
+ *
10
+ * MUST match the React version the build bundles (see `react/deno.json`),
11
+ * because veryfront's framework React re-export is generated against that
12
+ * version and references its named exports. A drift guard in
13
+ * `src/utils/constants/cdn.test.ts` enforces this.
14
+ */
15
+ export const DEFAULT_REACT_VERSION = "19.2.4";
9
16
  /** Tailwind CSS version */
10
17
  export const TAILWIND_VERSION = "4.1.8";
11
18
  /** csstype version - must match deno.json for type consistency */
@@ -13,7 +13,7 @@ export declare const frameworkTransformFlight: Singleflight<string>;
13
13
  export declare const veryfrontTransformCache: Map<string, string>;
14
14
  export declare const frameworkFileCache: Map<string, string>;
15
15
  export declare const transformingFiles: Set<string>;
16
- export declare const MAX_RELATIVE_IMPORT_DEPTH = 10;
16
+ export declare const MAX_RELATIVE_IMPORT_DEPTH = 64;
17
17
  export interface TransformContext {
18
18
  reactVersion: string;
19
19
  projectDir: string;
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../../src/src/transforms/pipeline/stages/ssr-vf-modules/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAErE,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAEjE,eAAO,MAAM,UAAU,qBAAqB,CAAC;AAG7C,eAAO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;AAGjE,eAAO,MAAM,kBAAkB,qBAA4B,CAAC;AAG5D,eAAO,MAAM,iBAAiB,aAAoB,CAAC;AASnD,eAAO,MAAM,yBAAyB,KAAK,CAAC;AAE5C,MAAM,WAAW,gBAAgB;IAC/B,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,EAAE,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC;CACzC"}
@@ -38,5 +38,11 @@ export const veryfrontTransformCache = new Map();
38
38
  export const frameworkFileCache = new Map();
39
39
  // Track files currently being transformed to detect cycles
40
40
  export const transformingFiles = new Set();
41
- // Maximum recursion depth for relative imports
42
- export const MAX_RELATIVE_IMPORT_DEPTH = 10;
41
+ // Maximum recursion depth for chained relative imports within framework
42
+ // source. veryfront's own framework tree has relative-import chains deeper
43
+ // than 10 (e.g. errors/utils/schemas internals reach ~11), and crossing a
44
+ // `#veryfront/` boundary resets the counter, so this only bounds consecutive
45
+ // `./`/`../` nesting. Cycles are caught separately by `transformingFiles`;
46
+ // this is purely a stack-safety bound, so it is set generously above the
47
+ // framework's real depth. Exceeding it falls back to a degraded transform.
48
+ export const MAX_RELATIVE_IMPORT_DEPTH = 64;
@@ -25,6 +25,12 @@ export declare function isCyclePlaceholder(code: string): boolean;
25
25
  * - contentHash: Content-based invalidation
26
26
  */
27
27
  export declare function cacheTransformedCode(transformed: string, vfModulePath: string, fs: ReturnType<typeof createFileSystem>): Promise<string>;
28
+ /**
29
+ * If `resolvedPath` is one of veryfront's React re-export modules
30
+ * (`FRAMEWORK_ROOT/react/*.js`), return the esm.sh URL it should be rewritten
31
+ * to for the given React version. Returns `null` for anything else.
32
+ */
33
+ export declare function reactReExportToEsmUrl(resolvedPath: string, reactVersion: string, reactImportMap?: Record<string, string>): string | null;
28
34
  /**
29
35
  * Core transformation logic for framework TypeScript/TSX files.
30
36
  * Compiles to JavaScript and recursively resolves all imports:
@@ -1 +1 @@
1
- {"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../../../../../src/src/transforms/pipeline/stages/ssr-vf-modules/transform.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAarE,OAAO,EAOL,KAAK,gBAAgB,EAGtB,MAAM,gBAAgB,CAAC;AAKxB;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAExD;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,oBAAoB,CACxC,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,EACpB,EAAE,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC,GACtC,OAAO,CAAC,MAAM,CAAC,CA2BjB;AAqLD;;;;;GAKG;AACH,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,EAClB,GAAG,EAAE,gBAAgB,EACrB,oBAAoB,UAAQ,EAC5B,KAAK,SAAI,GACR,OAAO,CAAC,MAAM,CAAC,CAiQjB;AAED;;;GAGG;AACH,wBAAsB,kCAAkC,CACtD,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE,gBAAgB,GACpB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CA4CxB;AAED;;;GAGG;AACH,wBAAsB,wBAAwB,CAC5C,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,MAAM,EAClB,EAAE,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC,GACtC,OAAO,CAAC,MAAM,CAAC,CAEjB"}
1
+ {"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../../../../../src/src/transforms/pipeline/stages/ssr-vf-modules/transform.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAarE,OAAO,EAOL,KAAK,gBAAgB,EAGtB,MAAM,gBAAgB,CAAC;AAKxB;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAExD;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,oBAAoB,CACxC,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,EACpB,EAAE,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC,GACtC,OAAO,CAAC,MAAM,CAAC,CA2BjB;AAwED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,MAAM,EACpB,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACtC,MAAM,GAAG,IAAI,CAKf;AAwMD;;;;;GAKG;AACH,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,EAClB,GAAG,EAAE,gBAAgB,EACrB,oBAAoB,UAAQ,EAC5B,KAAK,SAAI,GACR,OAAO,CAAC,MAAM,CAAC,CAsPjB;AAED;;;GAGG;AACH,wBAAsB,kCAAkC,CACtD,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE,gBAAgB,GACpB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CA4CxB;AAED;;;GAGG;AACH,wBAAsB,wBAAwB,CAC5C,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,MAAM,EAClB,EAAE,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC,GACtC,OAAO,CAAC,MAAM,CAAC,CAEjB"}
@@ -70,6 +70,70 @@ export async function cacheTransformedCode(transformed, vfModulePath, fs) {
70
70
  // `frameworkFileCache` first, so when the main path has already produced
71
71
  // a high-quality entry the fallback prefers it.
72
72
  const fallbackTransformCache = new Map();
73
+ /**
74
+ * Resolve a bare `react` / `react-dom` (or subpath) specifier to its esm.sh
75
+ * URL for the given React version. Returns `null` for anything that is not a
76
+ * React specifier.
77
+ *
78
+ * Both the main transform path and the depth-limit fallback use this so a
79
+ * framework module always links against the single esm.sh React bundle used
80
+ * during SSR. Leaving `react` bare would resolve it to the project's own
81
+ * React copy — a second React instance whose dispatcher is null, which makes
82
+ * the first hook throw "Cannot read properties of null (reading 'useEffect')".
83
+ */
84
+ function resolveReactSpecifier(specifier, reactVersion, reactImportMap = getReactImportMap(reactVersion)) {
85
+ const mapped = reactImportMap[specifier];
86
+ if (mapped)
87
+ return mapped;
88
+ if (specifier.startsWith("react/")) {
89
+ return buildReactUrl("react", reactVersion, "/" + specifier.slice("react/".length), true);
90
+ }
91
+ if (specifier.startsWith("react-dom/")) {
92
+ return buildReactUrl("react-dom", reactVersion, "/" + specifier.slice("react-dom/".length), true);
93
+ }
94
+ return null;
95
+ }
96
+ /**
97
+ * veryfront's own React re-export modules under `FRAMEWORK_ROOT/react/`
98
+ * mapped to the bare specifier they stand in for. Each re-export bridges to
99
+ * project React via `export * from "react"` (etc.), which during SSR resolves
100
+ * to the project's `node_modules` copy — a *different* React instance than
101
+ * the esm.sh react-dom bundle uses. The dnt build rewrites framework
102
+ * `import ... from "react"` to a relative import of these files, so a
103
+ * framework module that does `useEffect` ends up reading a null dispatcher.
104
+ * Rewriting these imports straight to the esm.sh bundle keeps every SSR
105
+ * module on a single React instance.
106
+ *
107
+ * Keys must match the compiled re-export filenames under
108
+ * `FRAMEWORK_ROOT/react/`, which the build emits from the `react/*.ts` source
109
+ * modules (`react.ts`, `react-dom.ts`, `react-dom-client.ts`,
110
+ * `react-dom-server.ts`, `jsx-runtime.ts`, `jsx-dev-runtime.ts`). If one is
111
+ * renamed or added, update this map too: a stale key silently reintroduces
112
+ * the dual-React-instance bug.
113
+ */
114
+ const REACT_REEXPORT_SPECIFIERS = {
115
+ "react.js": "react",
116
+ "react-dom.js": "react-dom",
117
+ "react-dom-client.js": "react-dom/client",
118
+ "react-dom-server.js": "react-dom/server",
119
+ "jsx-runtime.js": "react/jsx-runtime",
120
+ "jsx-dev-runtime.js": "react/jsx-dev-runtime",
121
+ };
122
+ /** `FRAMEWORK_ROOT/react/` prefix, precomputed (invariant per process). */
123
+ const REACT_REEXPORT_DIR = join(FRAMEWORK_ROOT, "react") + "/";
124
+ /**
125
+ * If `resolvedPath` is one of veryfront's React re-export modules
126
+ * (`FRAMEWORK_ROOT/react/*.js`), return the esm.sh URL it should be rewritten
127
+ * to for the given React version. Returns `null` for anything else.
128
+ */
129
+ export function reactReExportToEsmUrl(resolvedPath, reactVersion, reactImportMap) {
130
+ if (!resolvedPath.startsWith(REACT_REEXPORT_DIR))
131
+ return null;
132
+ const specifier = REACT_REEXPORT_SPECIFIERS[resolvedPath.slice(REACT_REEXPORT_DIR.length)];
133
+ if (!specifier)
134
+ return null;
135
+ return resolveReactSpecifier(specifier, reactVersion, reactImportMap);
136
+ }
73
137
  /**
74
138
  * Pick an esbuild loader for a file path, honoring the embedded `.src`
75
139
  * suffix used in compiled binaries (`foo.ts.src` → `ts`). Recognizes
@@ -176,9 +240,12 @@ async function transformAndCacheFallbackDep(resolvedPath, ctx, visited) {
176
240
  */
177
241
  async function rewriteFallbackRelativeImports(code, sourcePath, ctx, visited = new Set()) {
178
242
  visited.add(sourcePath);
243
+ // Note: we do not early-return when there are no relative imports, because
244
+ // react/react-dom specifiers still need rewriting below.
179
245
  const relativeImports = findRelativeImports(code);
180
- if (relativeImports.length === 0)
181
- return code;
246
+ // Built once and reused for both the relative-import loop (React re-export
247
+ // rewriting) and the final specifier pass below.
248
+ const reactImportMap = getReactImportMap(ctx.reactVersion);
182
249
  const replacements = new Map();
183
250
  for (const specifier of relativeImports) {
184
251
  // Skip non-code imports the runtime cannot load this way.
@@ -190,6 +257,13 @@ async function rewriteFallbackRelativeImports(code, sourcePath, ctx, visited = n
190
257
  logger.warn(`${LOG_PREFIX} Depth-limit fallback could not resolve relative import "${specifier}"`, { sourcePath: sourcePath.slice(-60) });
191
258
  continue;
192
259
  }
260
+ // Same React-instance fix as the main path: route React re-exports to the
261
+ // esm.sh bundle instead of linking veryfront's project-React bridge.
262
+ const reactUrl = reactReExportToEsmUrl(resolvedPath, ctx.reactVersion, reactImportMap);
263
+ if (reactUrl) {
264
+ replacements.set(specifier, reactUrl);
265
+ continue;
266
+ }
193
267
  // Embedded sources (.tsx.src / .ts.src / .jsx.src / .js.src) used by
194
268
  // compiled binaries are not loadable by the runtime. Materialize a
195
269
  // cache file the runtime can import instead of linking at the .src
@@ -205,14 +279,27 @@ async function rewriteFallbackRelativeImports(code, sourcePath, ctx, visited = n
205
279
  replacements.set(specifier, `file://${resolvedPath}`);
206
280
  }
207
281
  }
208
- if (replacements.size === 0)
209
- return code;
210
- return await replaceSpecifiers(code, (specifier) => {
282
+ // React imports must be rewritten even when there are no relative imports,
283
+ // so SSR links against the single esm.sh React bundle (see
284
+ // resolveReactSpecifier).
285
+ const rewritten = await replaceSpecifiers(code, (specifier) => {
211
286
  if (specifier.startsWith("./") || specifier.startsWith("../")) {
212
287
  return replacements.get(specifier) ?? null;
213
288
  }
214
- return null;
289
+ return resolveReactSpecifier(specifier, ctx.reactVersion, reactImportMap);
290
+ });
291
+ // Materialize any `https://esm.sh/...` React imports as local file:// bundles
292
+ // (same pass the main path runs). The cached fallback module is later loaded
293
+ // from file://, and Node rejects `import ... from "https:"`
294
+ // (ERR_UNSUPPORTED_ESM_URL_SCHEME); leaving the remote specifier in would
295
+ // break SSR under Node whenever a deep framework file hits this fallback.
296
+ const importMap = await loadImportMap(ctx.projectDir);
297
+ const cacheResult = await cacheHttpImportsToLocal(rewritten, {
298
+ cacheDir: getHttpBundleCacheDir(),
299
+ importMap,
300
+ reactVersion: ctx.reactVersion,
215
301
  });
302
+ return cacheResult.code;
216
303
  }
217
304
  /**
218
305
  * Core transformation logic for framework TypeScript/TSX files.
@@ -304,6 +391,9 @@ export async function transformFrameworkCode(content, sourcePath, ctx, throwOnMi
304
391
  // Safety: MAX_RELATIVE_IMPORT_DEPTH limits recursion, transformingFiles detects
305
392
  // cycles, and frameworkFileCache deduplicates already-transformed files.
306
393
  const relativeReplacements = new Map();
394
+ // Built once and reused for both the relative-import loop (React
395
+ // re-export rewriting) and the final specifier pass below.
396
+ const reactImportMap = getReactImportMap(ctx.reactVersion);
307
397
  // Prefixes for framework source directories - files outside these are
308
398
  // already-compiled JS (e.g. dnt shims) that should not be recursively transformed.
309
399
  const frameworkSrcDir = join(FRAMEWORK_ROOT, "src") + "/";
@@ -325,6 +415,14 @@ export async function transformFrameworkCode(content, sourcePath, ctx, throwOnMi
325
415
  logger.warn(`${LOG_PREFIX} Could not resolve relative import "${specifier}" in ${sourcePath}`);
326
416
  continue;
327
417
  }
418
+ // veryfront's own React re-exports bridge to project React, which is a
419
+ // different instance than the esm.sh react-dom bundle during SSR.
420
+ // Point these straight at the esm.sh bundle so SSR shares one React.
421
+ const reactUrl = reactReExportToEsmUrl(resolvedPath, ctx.reactVersion, reactImportMap);
422
+ if (reactUrl) {
423
+ relativeReplacements.set(specifier, reactUrl);
424
+ continue;
425
+ }
328
426
  // Files outside framework source directories (e.g. _dnt.shims.js,
329
427
  // _dnt.polyfills.js) are already-compiled JS with bare npm imports
330
428
  // that Deno resolves natively. Skip recursive transformation and
@@ -376,8 +474,6 @@ export async function transformFrameworkCode(content, sourcePath, ctx, throwOnMi
376
474
  }
377
475
  }
378
476
  }
379
- // Rewrite imports to resolved paths
380
- const reactImportMap = getReactImportMap(ctx.reactVersion);
381
477
  // Handle Deno import-map aliases (e.g. #deno-config) that only exist in
382
478
  // the Deno runtime and cannot be resolved by esm.sh or the HTTP cache.
383
479
  // We create a cached JS stub module so the transformed code can import it
@@ -400,16 +496,7 @@ export async function transformFrameworkCode(content, sourcePath, ctx, throwOnMi
400
496
  if (specifier.startsWith("./") || specifier.startsWith("../")) {
401
497
  return relativeReplacements.get(specifier) ?? null;
402
498
  }
403
- const mapped = reactImportMap[specifier];
404
- if (mapped)
405
- return mapped;
406
- if (specifier.startsWith("react/")) {
407
- return buildReactUrl("react", ctx.reactVersion, "/" + specifier.slice("react/".length), true);
408
- }
409
- if (specifier.startsWith("react-dom/")) {
410
- return buildReactUrl("react-dom", ctx.reactVersion, "/" + specifier.slice("react-dom/".length), true);
411
- }
412
- return null;
499
+ return resolveReactSpecifier(specifier, ctx.reactVersion, reactImportMap);
413
500
  });
414
501
  // Cache HTTP imports to local filesystem
415
502
  const importMap = await loadImportMap(ctx.projectDir);
@@ -5,9 +5,9 @@ export declare const REACT_VERSION_17 = "17.0.2";
5
5
  export declare const REACT_VERSION_18_2 = "18.2.0";
6
6
  export declare const REACT_VERSION_18_3 = "18.3.1";
7
7
  export declare const REACT_VERSION_19_RC = "19.0.0-rc.0";
8
- export declare const REACT_VERSION_19 = "19.1.1";
8
+ export declare const REACT_VERSION_19 = "19.2.4";
9
9
  /** Shared React default version value. */
10
- export declare const REACT_DEFAULT_VERSION = "19.1.1";
10
+ export declare const REACT_DEFAULT_VERSION = "19.2.4";
11
11
  export declare function esmShReact(pkg: string, version: string, path?: string, external?: boolean): string;
12
12
  export declare function getReactUrls(version?: string): Record<string, string>;
13
13
  /** Return React import map. */
@@ -5,7 +5,7 @@ export const REACT_VERSION_17 = "17.0.2";
5
5
  export const REACT_VERSION_18_2 = "18.2.0";
6
6
  export const REACT_VERSION_18_3 = "18.3.1";
7
7
  export const REACT_VERSION_19_RC = "19.0.0-rc.0";
8
- export const REACT_VERSION_19 = "19.1.1";
8
+ export const REACT_VERSION_19 = "19.2.4";
9
9
  /** Shared React default version value. */
10
10
  export const REACT_DEFAULT_VERSION = REACT_VERSION_19;
11
11
  import { buildReactUrl, getReactImportMap as buildReactImportMap, TAILWIND_VERSION, } from "../../transforms/import-rewriter/url-builder.js";
@@ -1,3 +1,3 @@
1
1
  /** Shared version value. */
2
- export declare const VERSION = "0.1.604";
2
+ export declare const VERSION = "0.1.606";
3
3
  //# sourceMappingURL=version-constant.d.ts.map
@@ -1,4 +1,4 @@
1
1
  // Keep in sync with deno.json version.
2
2
  // scripts/release.ts updates this constant during releases.
3
3
  /** Shared version value. */
4
- export const VERSION = "0.1.604";
4
+ export const VERSION = "0.1.606";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "veryfront",
3
- "version": "0.1.604",
3
+ "version": "0.1.606",
4
4
  "description": "The simplest way to build AI-powered apps",
5
5
  "keywords": [
6
6
  "react",