veryfront 0.1.811 → 0.1.813

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 (106) hide show
  1. package/esm/deno.js +1 -1
  2. package/esm/src/agent/conversation/durable-contracts.d.ts +204 -0
  3. package/esm/src/agent/conversation/durable-contracts.d.ts.map +1 -0
  4. package/esm/src/agent/conversation/durable-contracts.js +168 -0
  5. package/esm/src/agent/conversation/durable.d.ts +3 -198
  6. package/esm/src/agent/conversation/durable.d.ts.map +1 -1
  7. package/esm/src/agent/conversation/durable.js +2 -167
  8. package/esm/src/agent/runtime/agent-runtime-step.d.ts +44 -0
  9. package/esm/src/agent/runtime/agent-runtime-step.d.ts.map +1 -0
  10. package/esm/src/agent/runtime/agent-runtime-step.js +23 -0
  11. package/esm/src/agent/runtime/index.d.ts.map +1 -1
  12. package/esm/src/agent/runtime/index.js +40 -39
  13. package/esm/src/agent/runtime/model-transport.d.ts +23 -0
  14. package/esm/src/agent/runtime/model-transport.d.ts.map +1 -0
  15. package/esm/src/agent/runtime/model-transport.js +26 -0
  16. package/esm/src/cache/keys/builders/render.d.ts.map +1 -1
  17. package/esm/src/cache/keys/builders/render.js +3 -2
  18. package/esm/src/cache/request-cacheability.d.ts +3 -0
  19. package/esm/src/cache/request-cacheability.d.ts.map +1 -0
  20. package/esm/src/cache/request-cacheability.js +26 -0
  21. package/esm/src/html/hydration-script-builder/hydration-data-generator.d.ts.map +1 -1
  22. package/esm/src/html/hydration-script-builder/hydration-data-generator.js +1 -10
  23. package/esm/src/html/hydration-script-builder/templates/router.d.ts.map +1 -1
  24. package/esm/src/html/hydration-script-builder/templates/router.js +41 -10
  25. package/esm/src/modules/import-map/loader.d.ts.map +1 -1
  26. package/esm/src/modules/import-map/loader.js +2 -1
  27. package/esm/src/modules/manifest/route-module-manifest.d.ts.map +1 -1
  28. package/esm/src/modules/manifest/route-module-manifest.js +2 -0
  29. package/esm/src/modules/server/module-server.d.ts.map +1 -1
  30. package/esm/src/modules/server/module-server.js +27 -9
  31. package/esm/src/observability/request-profiler.d.ts.map +1 -1
  32. package/esm/src/observability/request-profiler.js +1 -0
  33. package/esm/src/observability/simple-metrics/index.d.ts +6 -3
  34. package/esm/src/observability/simple-metrics/index.d.ts.map +1 -1
  35. package/esm/src/observability/simple-metrics/index.js +5 -2
  36. package/esm/src/observability/simple-metrics/metrics-recorder.d.ts +4 -0
  37. package/esm/src/observability/simple-metrics/metrics-recorder.d.ts.map +1 -1
  38. package/esm/src/observability/simple-metrics/metrics-recorder.js +34 -0
  39. package/esm/src/observability/simple-metrics/metrics-state.d.ts.map +1 -1
  40. package/esm/src/observability/simple-metrics/metrics-state.js +24 -0
  41. package/esm/src/observability/simple-metrics/otel-instruments.d.ts.map +1 -1
  42. package/esm/src/observability/simple-metrics/otel-instruments.js +13 -0
  43. package/esm/src/observability/simple-metrics/types.d.ts +12 -0
  44. package/esm/src/observability/simple-metrics/types.d.ts.map +1 -1
  45. package/esm/src/platform/adapters/runtime/shared/shared-watcher.d.ts.map +1 -1
  46. package/esm/src/platform/adapters/runtime/shared/shared-watcher.js +1 -1
  47. package/esm/src/platform/compat/http/native-response.d.ts +10 -1
  48. package/esm/src/platform/compat/http/native-response.d.ts.map +1 -1
  49. package/esm/src/platform/compat/http/native-response.js +20 -14
  50. package/esm/src/proxy/handler.d.ts +1 -7
  51. package/esm/src/proxy/handler.d.ts.map +1 -1
  52. package/esm/src/proxy/handler.js +63 -189
  53. package/esm/src/proxy/main.js +21 -20
  54. package/esm/src/proxy/proxy-access-control.d.ts +41 -0
  55. package/esm/src/proxy/proxy-access-control.d.ts.map +1 -0
  56. package/esm/src/proxy/proxy-access-control.js +151 -0
  57. package/esm/src/proxy/proxy-error-context.d.ts +20 -0
  58. package/esm/src/proxy/proxy-error-context.d.ts.map +1 -0
  59. package/esm/src/proxy/proxy-error-context.js +35 -0
  60. package/esm/src/proxy/request-lifecycle.d.ts +19 -0
  61. package/esm/src/proxy/request-lifecycle.d.ts.map +1 -0
  62. package/esm/src/proxy/request-lifecycle.js +27 -0
  63. package/esm/src/proxy/upstream-error-response.d.ts +5 -0
  64. package/esm/src/proxy/upstream-error-response.d.ts.map +1 -0
  65. package/esm/src/proxy/upstream-error-response.js +15 -0
  66. package/esm/src/react/components/chat/chat/composition/chat-composer.d.ts.map +1 -1
  67. package/esm/src/react/components/chat/chat/composition/chat-composer.js +3 -1
  68. package/esm/src/release-assets/client-module-map.d.ts +3 -0
  69. package/esm/src/release-assets/client-module-map.d.ts.map +1 -0
  70. package/esm/src/release-assets/client-module-map.js +10 -0
  71. package/esm/src/rendering/cache/cache-coordinator.d.ts.map +1 -1
  72. package/esm/src/rendering/cache/cache-coordinator.js +1 -0
  73. package/esm/src/rendering/cache/stores/memory-store.d.ts +2 -0
  74. package/esm/src/rendering/cache/stores/memory-store.d.ts.map +1 -1
  75. package/esm/src/rendering/cache/stores/memory-store.js +2 -1
  76. package/esm/src/rendering/orchestrator/lifecycle.d.ts.map +1 -1
  77. package/esm/src/rendering/orchestrator/lifecycle.js +1 -0
  78. package/esm/src/rendering/orchestrator/module-loader/index.d.ts.map +1 -1
  79. package/esm/src/rendering/orchestrator/module-loader/index.js +13 -49
  80. package/esm/src/rendering/orchestrator/module-loader/module-cache-lookup.d.ts +25 -0
  81. package/esm/src/rendering/orchestrator/module-loader/module-cache-lookup.d.ts.map +1 -0
  82. package/esm/src/rendering/orchestrator/module-loader/module-cache-lookup.js +69 -0
  83. package/esm/src/rendering/orchestrator/pipeline.d.ts.map +1 -1
  84. package/esm/src/rendering/orchestrator/pipeline.js +22 -35
  85. package/esm/src/rendering/orchestrator/render-result-assembly.d.ts +27 -0
  86. package/esm/src/rendering/orchestrator/render-result-assembly.d.ts.map +1 -0
  87. package/esm/src/rendering/orchestrator/render-result-assembly.js +28 -0
  88. package/esm/src/rendering/orchestrator/types.d.ts +2 -0
  89. package/esm/src/rendering/orchestrator/types.d.ts.map +1 -1
  90. package/esm/src/rendering/renderer.d.ts.map +1 -1
  91. package/esm/src/rendering/renderer.js +24 -19
  92. package/esm/src/rendering/shared/context-aware-cache.d.ts.map +1 -1
  93. package/esm/src/rendering/shared/context-aware-cache.js +1 -0
  94. package/esm/src/server/handlers/dev/dashboard/api.d.ts +3 -0
  95. package/esm/src/server/handlers/dev/dashboard/api.d.ts.map +1 -1
  96. package/esm/src/server/handlers/dev/dashboard/api.js +41 -57
  97. package/esm/src/server/handlers/dev/framework-candidates.generated.d.ts.map +1 -1
  98. package/esm/src/server/handlers/dev/framework-candidates.generated.js +11 -1
  99. package/esm/src/server/handlers/request/module/page-data-endpoint-handler.d.ts +1 -0
  100. package/esm/src/server/handlers/request/module/page-data-endpoint-handler.d.ts.map +1 -1
  101. package/esm/src/server/handlers/request/module/page-data-endpoint-handler.js +98 -8
  102. package/esm/src/transforms/esm/specifier-resolver.d.ts.map +1 -1
  103. package/esm/src/transforms/esm/specifier-resolver.js +14 -0
  104. package/esm/src/utils/version-constant.d.ts +1 -1
  105. package/esm/src/utils/version-constant.js +1 -1
  106. package/package.json +1 -1
@@ -28,9 +28,10 @@ function normalizeImportMapForRuntime(importMap) {
28
28
  // Override React mappings AFTER all other processing to ensure single instance.
29
29
  // Remove any "react/" prefix match since we have explicit mappings.
30
30
  if (imports) {
31
+ const veryfrontSsrMap = Object.fromEntries(Object.entries(getDefaultImportMap().imports ?? {}).filter(([key]) => key.startsWith("veryfront/")));
31
32
  const reactMap = getReactImportMap();
32
33
  delete imports["react/"];
33
- imports = { ...imports, ...reactMap };
34
+ imports = { ...imports, ...veryfrontSsrMap, ...reactMap };
34
35
  }
35
36
  return { imports, scopes };
36
37
  }
@@ -1 +1 @@
1
- {"version":3,"file":"route-module-manifest.d.ts","sourceRoot":"","sources":["../../../../src/src/modules/manifest/route-module-manifest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAYH,UAAU,WAAW;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;IAClB,SA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AAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC5E,CAcA;AAED,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAU/D;AAED,wBAAgB,iBAAiB,IAAI,IAAI,CAIxC"}
1
+ {"version":3,"file":"route-module-manifest.d.ts","sourceRoot":"","sources":["../../../../src/src/modules/manifest/route-module-manifest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAaH,UAAU,WAAW;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,UAAU,aAAa;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB;AAyBD,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAE7D;AAED,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,SAAS,UAAQ,GAChB,IAAI,CAEN;AAED,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,GAAG,SAAS,EAC/B,KAAK,EAAE,MAAM,EACb,eAAe,GAAE,MAAM,EAAO,GAC7B,IAAI,CAwCN;AAED,wBAAgB,gBAAgB,CAC9B,WAAW,EAAE,MAAM,GAAG,SAAS,EAC/B,KAAK,EAAE,MAAM,GACZ,aAAa,GAAG,IAAI,CAatB;AAED,wBAAgB,mBAAmB,CACjC,WAAW,EAAE,MAAM,GAAG,SAAS,EAC/B,KAAK,EAAE,MAAM,GACZ,MAAM,EAAE,CAOV;AAED,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,MAAM,GAAG,SAAS,EAC/B,KAAK,EAAE,MAAM,GACZ,MAAM,EAAE,CAQV;AAED,wBAAgB,gBAAgB,CAC9B,WAAW,EAAE,MAAM,GAAG,SAAS,EAC/B,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EAAE,GAChB,IAAI,CA2BN;AAED,wBAAgB,sCAAsC,CACpD,WAAW,EAAE,MAAM,GAAG,SAAS,EAC/B,KAAK,EAAE,MAAM,EACb,QAAQ,SAAK,GACZ,MAAM,EAAE,CAQV;AAED,wBAAgB,gBAAgB,IAAI;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC5E,CAcA;AAED,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAU/D;AAED,wBAAgB,iBAAiB,IAAI,IAAI,CAIxC"}
@@ -11,6 +11,7 @@
11
11
  */
12
12
  import { serverLogger } from "../../utils/index.js";
13
13
  import { LRUCache } from "../../utils/lru-wrapper.js";
14
+ import { metrics } from "../../observability/simple-metrics/index.js";
14
15
  const logger = serverLogger.component("route-module-manifest");
15
16
  /** Bound on tracked routes; manifests are a regenerable preload optimization. */
16
17
  const MAX_TRACKED_ROUTES = 2_000;
@@ -77,6 +78,7 @@ export function finishModuleCollection(requestId, projectSlug, route, criticalMo
77
78
  export function getRouteManifest(projectSlug, route) {
78
79
  const key = buildKey(projectSlug, route);
79
80
  const manifest = manifestStore.get(key);
81
+ metrics.recordRouteManifestLookup(!!manifest);
80
82
  logger.debug("Get manifest", {
81
83
  key,
82
84
  found: !!manifest,
@@ -1 +1 @@
1
- {"version":3,"file":"module-server.d.ts","sourceRoot":"","sources":["../../../../src/src/modules/server/module-server.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAG5E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAoCtE;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAwDrD,CAAC;AAiBF,MAAM,WAAW,mBAAmB;IAClC,yDAAyD;IACzD,SAAS,EAAE,MAAM,CAAC;IAClB,6BAA6B;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,sBAAsB;IACtB,OAAO,EAAE,cAAc,CAAC;IACxB,uBAAuB;IACvB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,+DAA+D;IAC/D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gFAAgF;IAChF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mDAAmD;IACnD,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,uDAAuD;IACvD,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,yDAAyD;IACzD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,sFAAsF;IACtF,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,sDAAsD;AACtD,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,QAAQ,CAAC,CAoXzF;AAwWD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAGrD"}
1
+ {"version":3,"file":"module-server.d.ts","sourceRoot":"","sources":["../../../../src/src/modules/server/module-server.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAG5E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAsCtE;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAwDrD,CAAC;AAiBF,MAAM,WAAW,mBAAmB;IAClC,yDAAyD;IACzD,SAAS,EAAE,MAAM,CAAC;IAClB,6BAA6B;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,sBAAsB;IACtB,OAAO,EAAE,cAAc,CAAC;IACxB,uBAAuB;IACvB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,+DAA+D;IAC/D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gFAAgF;IAChF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mDAAmD;IACnD,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,uDAAuD;IACvD,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,yDAAyD;IACzD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,sFAAsF;IACtF,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,sDAAsD;AACtD,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,QAAQ,CAAC,CA6XzF;AAwWD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAGrD"}
@@ -8,6 +8,8 @@ import { getContentTypeForPath } from "../../server/handlers/utils/content-types
8
8
  import { createSecureFs } from "../../security/index.js";
9
9
  import { getErrorMessage } from "../../errors/veryfront-error.js";
10
10
  import { getApiBaseUrlEnv } from "../../config/env.js";
11
+ import { profilePhase } from "../../observability/request-profiler.js";
12
+ import { metrics } from "../../observability/simple-metrics/index.js";
11
13
  import { injectContext, withSpan } from "../../observability/tracing/otlp-setup.js";
12
14
  import { injectNodePositions } from "../../transforms/plugins/babel-node-positions.js";
13
15
  import { parseProjectDomain } from "../../server/utils/domain-parser.js";
@@ -158,7 +160,7 @@ export function serveModule(req, options) {
158
160
  codeLength: snippetCode.length,
159
161
  });
160
162
  try {
161
- let transformedCode = await transformToESM(snippetCode, `_snippets/${hash}.tsx`, projectDir, adapter, { projectId: effectiveProjectId, dev, ssr: isSSR, reactVersion });
163
+ let transformedCode = await profileModuleTransform(() => transformToESM(snippetCode, `_snippets/${hash}.tsx`, projectDir, adapter, { projectId: effectiveProjectId, dev, ssr: isSSR, reactVersion }));
162
164
  if (isSSR) {
163
165
  transformedCode = await applySSRImportRewritesAsync(transformedCode, {
164
166
  projectSlug: snippetProjectSlug,
@@ -230,13 +232,13 @@ export function serveModule(req, options) {
230
232
  }
231
233
  const userAgent = req.headers.get("user-agent") ?? "";
232
234
  const isSSR = url.searchParams.get("ssr") === "true" || userAgent.startsWith("Deno/");
233
- let code = await transformToESM(source, crossPath, projectDir, adapter, {
235
+ let code = await profileModuleTransform(() => transformToESM(source, crossPath, projectDir, adapter, {
234
236
  projectId: effectiveProjectId,
235
237
  dev,
236
238
  ssr: isSSR,
237
239
  moduleServerUrl: `http://${url.host}`,
238
240
  reactVersion,
239
- });
241
+ }));
240
242
  if (isSSR) {
241
243
  code = await applySSRImportRewritesAsync(code, {
242
244
  crossProjectRef: projectRef,
@@ -286,13 +288,13 @@ export function serveModule(req, options) {
286
288
  branch ??= parsedHost.branch;
287
289
  }
288
290
  try {
289
- const findResult = await findSourceFile(secureFs, projectDir, filePathWithoutExt, {
291
+ const findResult = await profilePhase("module.source_lookup", () => findSourceFile(secureFs, projectDir, filePathWithoutExt, {
290
292
  projectId: effectiveProjectId,
291
293
  projectSlug,
292
294
  branch,
293
295
  releaseId: options.releaseId,
294
296
  reactVersion,
295
- }, modulePath);
297
+ }, modulePath));
296
298
  if (!findResult) {
297
299
  logger.warn("Module not found", {
298
300
  modulePath,
@@ -300,9 +302,8 @@ export function serveModule(req, options) {
300
302
  projectSlug,
301
303
  projectDir,
302
304
  });
303
- return new Response("Module not found", {
304
- status: HTTP_NOT_FOUND,
305
- headers: { "Content-Type": "text/plain" },
305
+ return createModuleResponse(method, "Module not found", HTTP_NOT_FOUND, {
306
+ "Content-Type": "text/plain",
306
307
  });
307
308
  }
308
309
  const { path: sourceFile, isFrameworkFile, embeddedContent } = findResult;
@@ -346,7 +347,7 @@ export function serveModule(req, options) {
346
347
  studioEmbed,
347
348
  reactVersion,
348
349
  };
349
- code = await transformToESM(source, sourceFile, projectDir, adapter, transformOpts);
350
+ code = await profileModuleTransform(() => transformToESM(source, sourceFile, projectDir, adapter, transformOpts));
350
351
  if (isSSR) {
351
352
  code = await applySSRImportRewritesAsync(code, {
352
353
  projectSlug,
@@ -699,7 +700,24 @@ function createDevModuleErrorBody(modulePath, errorMessage) {
699
700
  }
700
701
  return `// Transform Error\nthrow new Error(${JSON.stringify(errorMessage)});`;
701
702
  }
703
+ async function profileModuleTransform(fn) {
704
+ const startedAt = performance.now();
705
+ try {
706
+ return await profilePhase("module.transform", fn);
707
+ }
708
+ finally {
709
+ metrics.recordModuleTransform(performance.now() - startedAt);
710
+ }
711
+ }
712
+ function classifyModuleServeStatus(status) {
713
+ if (status >= 200 && status < 300)
714
+ return "ok";
715
+ if (status === HTTP_NOT_FOUND)
716
+ return "not_found";
717
+ return "error";
718
+ }
702
719
  function createModuleResponse(method, body, status, headers) {
720
+ metrics.recordModuleServe(classifyModuleServeStatus(status));
703
721
  return new Response(method === "HEAD" ? null : body, { status, headers });
704
722
  }
705
723
  async function fetchCrossProjectSource(projectRef, filePath) {
@@ -1 +1 @@
1
- {"version":3,"file":"request-profiler.d.ts","sourceRoot":"","sources":["../../../src/src/observability/request-profiler.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;I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G,oBAAoB,GAAG,IAAI,CAsBrF;AAUD,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,oBAAoB,GAAG,MAAM,CAQ5E;AAED,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,oBAAoB,GAAG,IAAI,GAClC,QAAQ,CAiBV;AAED,wBAAgB,uBAAuB,IAAI;IACzC,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,oBAAoB,EAAE,CAAC;CACjC,CAMA;AAED,wBAAgB,oBAAoB,IAAI,IAAI,CAG3C"}
1
+ {"version":3,"file":"request-profiler.d.ts","sourceRoot":"","sources":["../../../src/src/observability/request-profiler.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAChC;AAED,MAAM,WAAW,2BAA2B;IAC1C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AA2CD,wBAAgB,yBAAyB,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAIpE;AAED,wBAAsB,uBAAuB,CAAC,CAAC,EAC7C,OAAO,EAAE;IACP,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,EACD,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GACnB,OAAO,CAAC,CAAC,CAAC,CAYZ;AAED,wBAAsB,YAAY,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAWpF;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,SAAI,GAAG,IAAI,CAK1E;AAED,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAWhE;AAED,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,2BAA2B,GAAG,IAAI,CAMrF;AAED,wBAAgB,wBAAwB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,oBAAoB,GAAG,IAAI,CAsBrF;AAUD,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,oBAAoB,GAAG,MAAM,CAQ5E;AAED,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,oBAAoB,GAAG,IAAI,GAClC,QAAQ,CAiBV;AAED,wBAAgB,uBAAuB,IAAI;IACzC,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,oBAAoB,EAAE,CAAC;CACjC,CAMA;AAED,wBAAgB,oBAAoB,IAAI,IAAI,CAG3C"}
@@ -22,6 +22,7 @@ function shouldProfilePath(pathname) {
22
22
  pathname.startsWith("/api/bench/") ||
23
23
  pathname.startsWith("/_vf_styles/") ||
24
24
  pathname.startsWith("/_vf_modules/") ||
25
+ (shouldEnableServerTiming() && pathname.startsWith("/_veryfront/page-data/")) ||
25
26
  (shouldEnableServerTiming() && isHtmlPath(pathname));
26
27
  }
27
28
  export function isRequestProfilingEnabled(pathname) {
@@ -7,9 +7,9 @@ export type { MetricsState, ObservabilityMetrics, OtelInstruments, RSCRequestKin
7
7
  export { getObservabilityMetrics, resetObservabilityLoader } from "./observability-loader.js";
8
8
  export { ensureOtelInstruments, getOtelInstruments, resetOtelInstruments, safeLogWarn, safeOtelOperation, } from "./otel-instruments.js";
9
9
  export { createSnapshot, getRequestCount, getSSRBoundaries, resetMetrics, state, } from "./metrics-state.js";
10
- export { incRequest, recordApiRequest, recordApiRetry, recordCacheGet, recordCacheInvalidate, recordCacheSet, recordContentCacheHit, recordContentNetworkFetch, recordCorsRejection, recordHttp, recordRSC, recordRSCStreamDuration, recordSecurityHeaders, recordSSR, } from "./metrics-recorder.js";
11
- export type { ContentCacheLayer } from "./metrics-recorder.js";
12
- import { incRequest, recordApiRequest, recordApiRetry, recordCacheGet, recordCacheInvalidate, recordCacheSet, recordContentCacheHit, recordContentNetworkFetch, recordCorsRejection, recordHttp, recordRSC, recordRSCStreamDuration, recordSecurityHeaders, recordSSR } from "./metrics-recorder.js";
10
+ export { incRequest, recordApiRequest, recordApiRetry, recordCacheGet, recordCacheInvalidate, recordCacheSet, recordContentCacheHit, recordContentNetworkFetch, recordCorsRejection, recordHttp, recordModuleServe, recordModuleTransform, recordRouteManifestLookup, recordRSC, recordRSCStreamDuration, recordSecurityHeaders, recordSSR, } from "./metrics-recorder.js";
11
+ export type { ContentCacheLayer, ModuleServeStatus } from "./metrics-recorder.js";
12
+ import { incRequest, recordApiRequest, recordApiRetry, recordCacheGet, recordCacheInvalidate, recordCacheSet, recordContentCacheHit, recordContentNetworkFetch, recordCorsRejection, recordHttp, recordModuleServe, recordModuleTransform, recordRouteManifestLookup, recordRSC, recordRSCStreamDuration, recordSecurityHeaders, recordSSR } from "./metrics-recorder.js";
13
13
  import { createSnapshot, getRequestCount, resetMetrics } from "./metrics-state.js";
14
14
  export declare const metrics: {
15
15
  incRequest: typeof incRequest;
@@ -26,6 +26,9 @@ export declare const metrics: {
26
26
  recordApiRetry: typeof recordApiRetry;
27
27
  recordContentCacheHit: typeof recordContentCacheHit;
28
28
  recordContentNetworkFetch: typeof recordContentNetworkFetch;
29
+ recordModuleServe: typeof recordModuleServe;
30
+ recordModuleTransform: typeof recordModuleTransform;
31
+ recordRouteManifestLookup: typeof recordRouteManifestLookup;
29
32
  snapshot: typeof createSnapshot;
30
33
  reset: typeof resetMetrics;
31
34
  getRequestCount: typeof getRequestCount;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/src/observability/simple-metrics/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,YAAY,EACV,YAAY,EACZ,oBAAoB,EACpB,eAAe,EACf,cAAc,EACd,gBAAgB,GACjB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAE9F,OAAO,EACL,qBAAqB,EACrB,kBAAkB,EAClB,oBAAoB,EACpB,WAAW,EACX,iBAAiB,GAClB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,KAAK,GACN,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,qBAAqB,EACrB,cAAc,EACd,qBAAqB,EACrB,yBAAyB,EACzB,mBAAmB,EACnB,UAAU,EACV,SAAS,EACT,uBAAuB,EACvB,qBAAqB,EACrB,SAAS,GACV,MAAM,uBAAuB,CAAC;AAE/B,YAAY,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,qBAAqB,EACrB,cAAc,EACd,qBAAqB,EACrB,yBAAyB,EACzB,mBAAmB,EACnB,UAAU,EACV,SAAS,EACT,uBAAuB,EACvB,qBAAqB,EACrB,SAAS,EACV,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEnF,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;CAkBnB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/src/observability/simple-metrics/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,YAAY,EACV,YAAY,EACZ,oBAAoB,EACpB,eAAe,EACf,cAAc,EACd,gBAAgB,GACjB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAE9F,OAAO,EACL,qBAAqB,EACrB,kBAAkB,EAClB,oBAAoB,EACpB,WAAW,EACX,iBAAiB,GAClB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,KAAK,GACN,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,qBAAqB,EACrB,cAAc,EACd,qBAAqB,EACrB,yBAAyB,EACzB,mBAAmB,EACnB,UAAU,EACV,iBAAiB,EACjB,qBAAqB,EACrB,yBAAyB,EACzB,SAAS,EACT,uBAAuB,EACvB,qBAAqB,EACrB,SAAS,GACV,MAAM,uBAAuB,CAAC;AAE/B,YAAY,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAElF,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,qBAAqB,EACrB,cAAc,EACd,qBAAqB,EACrB,yBAAyB,EACzB,mBAAmB,EACnB,UAAU,EACV,iBAAiB,EACjB,qBAAqB,EACrB,yBAAyB,EACzB,SAAS,EACT,uBAAuB,EACvB,qBAAqB,EACrB,SAAS,EACV,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEnF,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;CAqBnB,CAAC"}
@@ -6,8 +6,8 @@
6
6
  export { getObservabilityMetrics, resetObservabilityLoader } from "./observability-loader.js";
7
7
  export { ensureOtelInstruments, getOtelInstruments, resetOtelInstruments, safeLogWarn, safeOtelOperation, } from "./otel-instruments.js";
8
8
  export { createSnapshot, getRequestCount, getSSRBoundaries, resetMetrics, state, } from "./metrics-state.js";
9
- export { incRequest, recordApiRequest, recordApiRetry, recordCacheGet, recordCacheInvalidate, recordCacheSet, recordContentCacheHit, recordContentNetworkFetch, recordCorsRejection, recordHttp, recordRSC, recordRSCStreamDuration, recordSecurityHeaders, recordSSR, } from "./metrics-recorder.js";
10
- import { incRequest, recordApiRequest, recordApiRetry, recordCacheGet, recordCacheInvalidate, recordCacheSet, recordContentCacheHit, recordContentNetworkFetch, recordCorsRejection, recordHttp, recordRSC, recordRSCStreamDuration, recordSecurityHeaders, recordSSR, } from "./metrics-recorder.js";
9
+ export { incRequest, recordApiRequest, recordApiRetry, recordCacheGet, recordCacheInvalidate, recordCacheSet, recordContentCacheHit, recordContentNetworkFetch, recordCorsRejection, recordHttp, recordModuleServe, recordModuleTransform, recordRouteManifestLookup, recordRSC, recordRSCStreamDuration, recordSecurityHeaders, recordSSR, } from "./metrics-recorder.js";
10
+ import { incRequest, recordApiRequest, recordApiRetry, recordCacheGet, recordCacheInvalidate, recordCacheSet, recordContentCacheHit, recordContentNetworkFetch, recordCorsRejection, recordHttp, recordModuleServe, recordModuleTransform, recordRouteManifestLookup, recordRSC, recordRSCStreamDuration, recordSecurityHeaders, recordSSR, } from "./metrics-recorder.js";
11
11
  import { createSnapshot, getRequestCount, resetMetrics } from "./metrics-state.js";
12
12
  export const metrics = {
13
13
  incRequest,
@@ -24,6 +24,9 @@ export const metrics = {
24
24
  recordApiRetry,
25
25
  recordContentCacheHit,
26
26
  recordContentNetworkFetch,
27
+ recordModuleServe,
28
+ recordModuleTransform,
29
+ recordRouteManifestLookup,
27
30
  snapshot: createSnapshot,
28
31
  reset: resetMetrics,
29
32
  getRequestCount,
@@ -57,6 +57,10 @@ export declare function recordCacheSet(): void;
57
57
  * ```
58
58
  */
59
59
  export declare function recordCacheInvalidate(n: number): void;
60
+ export type ModuleServeStatus = "ok" | "not_found" | "error";
61
+ export declare function recordModuleServe(status: ModuleServeStatus): void;
62
+ export declare function recordModuleTransform(durationMs: number): void;
63
+ export declare function recordRouteManifestLookup(hit: boolean): void;
60
64
  /**
61
65
  * Record SSR render duration
62
66
  *
@@ -1 +1 @@
1
- {"version":3,"file":"metrics-recorder.d.ts","sourceRoot":"","sources":["../../../../src/src/observability/simple-metrics/metrics-recorder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAejD;;;;;;;GAOG;AACH,wBAAsB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAQhD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI,CAUxF;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAajD;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,IAAI,IAAI,CAOrC;AAED;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,CAWrD;AAED;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAalD;AAED;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAehE;AAqBD;;;;;;;;;;GAUG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI,CAIpD;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,IAAI,IAAI,CAE1C;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,IAAI,IAAI,CAE5C;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAYrD;AAED,wBAAgB,cAAc,IAAI,IAAI,CAErC;AAQD,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,YAAY,GAAG,UAAU,CAAC;AAEtE;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI,CAYpE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,GAAG,IAAI,CAmBtF"}
1
+ {"version":3,"file":"metrics-recorder.d.ts","sourceRoot":"","sources":["../../../../src/src/observability/simple-metrics/metrics-recorder.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAejD;;;;;;;GAOG;AACH,wBAAsB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAQhD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI,CAUxF;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAajD;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,IAAI,IAAI,CAOrC;AAED;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,CAWrD;AAED,MAAM,MAAM,iBAAiB,GAAG,IAAI,GAAG,WAAW,GAAG,OAAO,CAAC;AAE7D,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI,CAoBjE;AAED,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAU9D;AAED,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAS5D;AAED;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAalD;AAED;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAehE;AAqBD;;;;;;;;;;GAUG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI,CAIpD;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,IAAI,IAAI,CAE1C;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,IAAI,IAAI,CAE5C;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAYrD;AAED,wBAAgB,cAAc,IAAI,IAAI,CAErC;AAQD,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,YAAY,GAAG,UAAU,CAAC;AAEtE;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI,CAYpE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,GAAG,IAAI,CAmBtF"}
@@ -113,6 +113,40 @@ export function recordCacheInvalidate(n) {
113
113
  const otel = getOtelInstruments();
114
114
  void safeOtelOperation(() => otel.cacheInvalidateCounter?.add(count), "cache invalidate counter add failed");
115
115
  }
116
+ export function recordModuleServe(status) {
117
+ state.moduleServeTotal++;
118
+ switch (status) {
119
+ case "ok":
120
+ state.moduleServeOk++;
121
+ break;
122
+ case "not_found":
123
+ state.moduleServeNotFound++;
124
+ break;
125
+ case "error":
126
+ state.moduleServeError++;
127
+ break;
128
+ }
129
+ const otel = getOtelInstruments();
130
+ void safeOtelOperation(() => otel.moduleServeCounter?.add(1, { status }), "module serve counter add failed");
131
+ }
132
+ export function recordModuleTransform(durationMs) {
133
+ const duration = Math.max(0, Math.floor(durationMs));
134
+ state.moduleTransformTotal++;
135
+ state.moduleTransformDurationMsTotal += duration;
136
+ const otel = getOtelInstruments();
137
+ void safeOtelOperation(() => {
138
+ otel.moduleTransformCounter?.add(1);
139
+ otel.moduleTransformDurationHistogram?.record(duration);
140
+ }, "module transform metrics record failed");
141
+ }
142
+ export function recordRouteManifestLookup(hit) {
143
+ if (hit)
144
+ state.routeManifestLruHits++;
145
+ else
146
+ state.routeManifestLruMisses++;
147
+ const otel = getOtelInstruments();
148
+ void safeOtelOperation(() => otel.routeManifestLookupCounter?.add(1, { hit: hit ? "true" : "false" }), "route manifest lookup counter add failed");
149
+ }
116
150
  /**
117
151
  * Record SSR render duration
118
152
  *
@@ -1 +1 @@
1
- {"version":3,"file":"metrics-state.d.ts","sourceRoot":"","sources":["../../../../src/src/observability/simple-metrics/metrics-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAMjE,eAAO,MAAM,KAAK,EAAE,YAkCnB,CAAC;AAEF,wBAAgB,gBAAgB,IAAI,MAAM,EAAE,CAE3C;AAED,wBAAgB,2BAA2B,IAAI,MAAM,EAAE,CAEtD;AAED,wBAAgB,cAAc,IAAI,gBAAgB,CA6CjD;AAED,wBAAgB,YAAY,IAAI,IAAI,CAiCnC;AAED,wBAAgB,eAAe,IAAI,MAAM,CAExC"}
1
+ {"version":3,"file":"metrics-state.d.ts","sourceRoot":"","sources":["../../../../src/src/observability/simple-metrics/metrics-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAMjE,eAAO,MAAM,KAAK,EAAE,YA0CnB,CAAC;AAEF,wBAAgB,gBAAgB,IAAI,MAAM,EAAE,CAE3C;AAED,wBAAgB,2BAA2B,IAAI,MAAM,EAAE,CAEtD;AAED,wBAAgB,cAAc,IAAI,gBAAgB,CAqDjD;AAED,wBAAgB,YAAY,IAAI,IAAI,CAyCnC;AAED,wBAAgB,eAAe,IAAI,MAAM,CAExC"}
@@ -16,6 +16,14 @@ export const state = {
16
16
  cacheMisses: 0,
17
17
  cacheSets: 0,
18
18
  cacheInvalidations: 0,
19
+ moduleServeTotal: 0,
20
+ moduleServeOk: 0,
21
+ moduleServeNotFound: 0,
22
+ moduleServeError: 0,
23
+ moduleTransformTotal: 0,
24
+ moduleTransformDurationMsTotal: 0,
25
+ routeManifestLruHits: 0,
26
+ routeManifestLruMisses: 0,
19
27
  ssrHistogram: undefined,
20
28
  rscStreamHistogram: undefined,
21
29
  corsRejections: 0,
@@ -58,6 +66,14 @@ export function createSnapshot() {
58
66
  cacheMisses: state.cacheMisses,
59
67
  cacheSets: state.cacheSets,
60
68
  cacheInvalidations: state.cacheInvalidations,
69
+ moduleServeTotal: state.moduleServeTotal,
70
+ moduleServeOk: state.moduleServeOk,
71
+ moduleServeNotFound: state.moduleServeNotFound,
72
+ moduleServeError: state.moduleServeError,
73
+ moduleTransformTotal: state.moduleTransformTotal,
74
+ moduleTransformDurationMsTotal: state.moduleTransformDurationMsTotal,
75
+ routeManifestLruHits: state.routeManifestLruHits,
76
+ routeManifestLruMisses: state.routeManifestLruMisses,
61
77
  corsRejections: state.corsRejections,
62
78
  securityHeadersApplied: state.securityHeadersApplied,
63
79
  apiRequests2xx: state.apiRequests2xx,
@@ -103,6 +119,14 @@ export function resetMetrics() {
103
119
  state.cacheMisses = 0;
104
120
  state.cacheSets = 0;
105
121
  state.cacheInvalidations = 0;
122
+ state.moduleServeTotal = 0;
123
+ state.moduleServeOk = 0;
124
+ state.moduleServeNotFound = 0;
125
+ state.moduleServeError = 0;
126
+ state.moduleTransformTotal = 0;
127
+ state.moduleTransformDurationMsTotal = 0;
128
+ state.routeManifestLruHits = 0;
129
+ state.routeManifestLruMisses = 0;
106
130
  state.corsRejections = 0;
107
131
  state.securityHeadersApplied = 0;
108
132
  state.apiRequests2xx = 0;
@@ -1 +1 @@
1
- {"version":3,"file":"otel-instruments.d.ts","sourceRoot":"","sources":["../../../../src/src/observability/simple-metrics/otel-instruments.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAKlD,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,IAAI,CAMlE;AAED,wBAAsB,qBAAqB,IAAI,OAAO,CAAC,IAAI,CAAC,CA8C3D;AAED,wBAAsB,iBAAiB,CACrC,SAAS,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,EACrC,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,IAAI,CAAC,CAOf;AAED,wBAAgB,kBAAkB,IAAI,eAAe,CAEpD;AAED,wBAAgB,oBAAoB,IAAI,IAAI,CAM3C"}
1
+ {"version":3,"file":"otel-instruments.d.ts","sourceRoot":"","sources":["../../../../src/src/observability/simple-metrics/otel-instruments.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAKlD,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,IAAI,CAMlE;AAED,wBAAsB,qBAAqB,IAAI,OAAO,CAAC,IAAI,CAAC,CA8D3D;AAED,wBAAsB,iBAAiB,CACrC,SAAS,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,EACrC,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,IAAI,CAAC,CAOf;AAED,wBAAgB,kBAAkB,IAAI,eAAe,CAEpD;AAED,wBAAgB,oBAAoB,IAAI,IAAI,CAM3C"}
@@ -58,6 +58,19 @@ export async function ensureOtelInstruments() {
58
58
  otel.cacheInvalidateCounter = meter.createCounter("veryfront.cache.invalidations", {
59
59
  description: "Cache invalidations",
60
60
  });
61
+ otel.moduleServeCounter = meter.createCounter("veryfront.module.serve.total", {
62
+ description: "Module server responses by status",
63
+ });
64
+ otel.moduleTransformCounter = meter.createCounter("veryfront.module.transform.total", {
65
+ description: "Module transforms",
66
+ });
67
+ otel.moduleTransformDurationHistogram = meter.createHistogram("veryfront.module.transform.duration", {
68
+ description: "Module transform duration (ms)",
69
+ unit: "ms",
70
+ });
71
+ otel.routeManifestLookupCounter = meter.createCounter("veryfront.route_manifest.lookup.total", {
72
+ description: "Route module manifest LRU lookups by hit status",
73
+ });
61
74
  }
62
75
  catch (e) {
63
76
  safeLogWarn("[metrics] OpenTelemetry init failed", e);
@@ -32,6 +32,14 @@ export interface VeryfrontMetrics {
32
32
  cacheMisses: number;
33
33
  cacheSets: number;
34
34
  cacheInvalidations: number;
35
+ moduleServeTotal: number;
36
+ moduleServeOk: number;
37
+ moduleServeNotFound: number;
38
+ moduleServeError: number;
39
+ moduleTransformTotal: number;
40
+ moduleTransformDurationMsTotal: number;
41
+ routeManifestLruHits: number;
42
+ routeManifestLruMisses: number;
35
43
  ssrHistogram?: {
36
44
  boundaries: number[];
37
45
  counts: number[];
@@ -69,5 +77,9 @@ export interface OtelInstruments {
69
77
  cacheMissCounter?: Counter;
70
78
  cacheSetCounter?: Counter;
71
79
  cacheInvalidateCounter?: Counter;
80
+ moduleServeCounter?: Counter;
81
+ moduleTransformCounter?: Counter;
82
+ moduleTransformDurationHistogram?: Histogram;
83
+ routeManifestLookupCounter?: Counter;
72
84
  }
73
85
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/src/observability/simple-metrics/types.ts"],"names":[],"mappings":"AAAA;;;oDAGoD;AAEpD,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAExE,MAA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,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/C,GACA,OAAO,CAAC,IAAI,CAAC,CAwCf"}
1
+ {"version":3,"file":"shared-watcher.d.ts","sourceRoot":"","sources":["../../../../../../src/src/platform/adapters/runtime/shared/shared-watcher.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAkB,MAAM,eAAe,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEjG,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,CAAC;AAEvE,wBAAsB,kBAAkB,CACtC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE;IACP,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,MAAM,OAAO,CAAC;IACtB,MAAM,EAAE,WAAW,GAAG,SAAS,CAAC;IAChC,UAAU,EAAE,eAAe,EAAE,CAAC;IAC9B,WAAW,EAAE,MAAM,CAAC,CAAC,KAAK,EAAE,cAAc,CAAC,eAAe,CAAC,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC;IAC7E,WAAW,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC,KAAK,EAAE,cAAc,CAAC,eAAe,CAAC,KAAK,IAAI,CAAC,GAAG,IAAI,KAAK,IAAI,CAAC;IAC3F,QAAQ,EAAE,KAAK,CAAC,OAAO,SAAS,EAAE,SAAS,CAAC,CAAC;IAC7C,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/C,GACA,OAAO,CAAC,IAAI,CAAC,CAyCf"}
@@ -1,10 +1,10 @@
1
- import { join } from "node:path";
2
1
  import { createFileWatcher, createWatcherIterator, enqueueWatchEvent } from "./watcher-queue.js";
3
2
  export { createFileWatcher, createWatcherIterator, enqueueWatchEvent };
4
3
  export async function setupNodeFsWatcher(path, options) {
5
4
  try {
6
5
  const fs = await import("node:fs");
7
6
  const fsPromises = await import("node:fs/promises");
7
+ const { join } = await import("node:path");
8
8
  let exists;
9
9
  try {
10
10
  await fsPromises.access(path);
@@ -12,11 +12,19 @@
12
12
  *
13
13
  * @module platform/compat/http/native-response
14
14
  */
15
+ import * as dntShim from "../../../../_dnt.shims.js";
16
+ type NativeResponseHost = {
17
+ Response: typeof Response;
18
+ };
19
+ type NativeDenoHost = {
20
+ Deno?: unknown;
21
+ };
22
+ export declare function getNativeResponseFromHost(host: NativeResponseHost): typeof Response;
23
+ export declare function getNativeDenoFromHost(host: NativeDenoHost): typeof dntShim.Deno | undefined;
15
24
  /**
16
25
  * The native `Response` constructor, accessed via `self` to bypass the dnt
17
26
  * shim transform (dnt rewrites bare `Response` to undici's polyfill).
18
27
  */
19
- import * as dntShim from "../../../../_dnt.shims.js";
20
28
  export declare function getNativeResponse(): typeof Response;
21
29
  /**
22
30
  * The native `Deno` namespace, accessed via `self` to bypass the dnt shim
@@ -41,4 +49,5 @@ export declare function getNativeDeno(): typeof dntShim.Deno | undefined;
41
49
  * into a fresh native `Response`.
42
50
  */
43
51
  export declare function toNativeResponse(response: Response, NativeResponse: typeof Response): Response;
52
+ export {};
44
53
  //# sourceMappingURL=native-response.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"native-response.d.ts","sourceRoot":"","sources":["../../../../../src/src/platform/compat/http/native-response.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;;GAGG;AACH,OAAO,KAAK,OAAO,MAAM,2BAA2B,CAAC;AAErD,wBAAgB,iBAAiB,IAAI,OAAO,QAAQ,CAEnD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,IAAI,OAAO,OAAO,CAAC,IAAI,GAAG,SAAS,CAE/D;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,QAAQ,EAClB,cAAc,EAAE,OAAO,QAAQ,GAC9B,QAAQ,CAYV"}
1
+ {"version":3,"file":"native-response.d.ts","sourceRoot":"","sources":["../../../../../src/src/platform/compat/http/native-response.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,OAAO,MAAM,2BAA2B,CAAC;AAGrD,KAAK,kBAAkB,GAAG;IACxB,QAAQ,EAAE,OAAO,QAAQ,CAAC;CAC3B,CAAC;AAEF,KAAK,cAAc,GAAG;IACpB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC;AAWF,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,kBAAkB,GAAG,OAAO,QAAQ,CAEnF;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,OAAO,CAAC,IAAI,GAAG,SAAS,CAG3F;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,QAAQ,CAEnD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,aAAa,IAAI,OAAO,OAAO,CAAC,IAAI,GAAG,SAAS,CAE/D;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,QAAQ,EAClB,cAAc,EAAE,OAAO,QAAQ,GAC9B,QAAQ,CAYV"}
@@ -1,19 +1,25 @@
1
+ function isRecord(value) {
2
+ return typeof value === "object" && value !== null;
3
+ }
4
+ function isNativeDeno(value) {
5
+ if (!isRecord(value))
6
+ return false;
7
+ return typeof value.serve === "function" && typeof value.upgradeWebSocket === "function";
8
+ }
9
+ export function getNativeResponseFromHost(host) {
10
+ return host.Response;
11
+ }
12
+ export function getNativeDenoFromHost(host) {
13
+ if (!isNativeDeno(host.Deno))
14
+ return undefined;
15
+ return host.Deno;
16
+ }
1
17
  /**
2
- * Shared helpers for bridging polyfilled `Response` objects to native ones
3
- * required by `Deno.serve`.
4
- *
5
- * In npm packages, dnt replaces the global `Response` with undici's polyfill,
6
- * but `Deno.serve` requires native `Response` instances. These helpers access
7
- * the native constructor via `self` (which dnt does not shim) and re-wrap
8
- * polyfilled responses as needed.
9
- *
10
- * IMPORTANT: this module must remain importable without `--allow-env`. It must
11
- * NOT read environment variables or import a logger at module load time.
12
- *
13
- * @module platform/compat/http/native-response
18
+ * The native `Response` constructor, accessed via `self` to bypass the dnt
19
+ * shim transform (dnt rewrites bare `Response` to undici's polyfill).
14
20
  */
15
21
  export function getNativeResponse() {
16
- return self.Response;
22
+ return getNativeResponseFromHost(self);
17
23
  }
18
24
  /**
19
25
  * The native `Deno` namespace, accessed via `self` to bypass the dnt shim
@@ -29,7 +35,7 @@ export function getNativeResponse() {
29
35
  * Deno runtime can use a non-null assertion on the result.
30
36
  */
31
37
  export function getNativeDeno() {
32
- return self["Deno"];
38
+ return getNativeDenoFromHost(self);
33
39
  }
34
40
  /**
35
41
  * Re-wrap a (possibly polyfilled) `Response` as a native `Response` so it can be
@@ -1,12 +1,6 @@
1
1
  import { type ParsedDomain } from "../server/utils/domain-parser.js";
2
2
  import type { TokenCache } from "./cache/types.js";
3
- /**
4
- * Reset the cached AuthProvider. Intended for tests that `register()` a mock
5
- * after the handler module has been imported.
6
- *
7
- * @internal
8
- */
9
- export declare function __resetCachedAuthProviderForTests(): void;
3
+ export { __resetCachedAuthProviderForTests } from "./proxy-access-control.js";
10
4
  export declare const INTERNAL_PROXY_HEADERS: readonly ["x-token", "x-project-slug", "x-environment", "x-environment-id", "x-content-source-id", "x-forwarded-host", "x-project-path", "x-project-id", "x-release-id", "x-branch-id", "x-branch-name"];
11
5
  export interface ProxyConfig {
12
6
  apiBaseUrl: string;
@@ -1 +1 @@
1
- {"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../../src/src/proxy/handler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,YAAY,EAAsB,MAAM,kCAAkC,CAAC;AACzF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AA0CnD;;;;;GAKG;AACH,wBAAgB,iCAAiC,IAAI,IAAI,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