veryfront 0.1.128 → 0.1.129
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/cli/router.d.ts +0 -5
- package/esm/cli/router.d.ts.map +1 -1
- package/esm/cli/router.js +30 -2
- package/esm/cli/shared/update-check.d.ts +4 -0
- package/esm/cli/shared/update-check.d.ts.map +1 -0
- package/esm/cli/shared/update-check.js +97 -0
- package/esm/deno.d.ts +5 -0
- package/esm/deno.js +13 -8
- package/esm/src/channels/control-plane.d.ts.map +1 -1
- package/esm/src/channels/control-plane.js +5 -5
- package/esm/src/channels/invoke.d.ts +1 -1
- package/esm/src/channels/invoke.d.ts.map +1 -1
- package/esm/src/channels/invoke.js +6 -6
- package/esm/src/chat/index.d.ts +12 -24
- package/esm/src/chat/index.d.ts.map +1 -1
- package/esm/src/chat/index.js +5 -25
- package/esm/src/config/env.d.ts.map +1 -1
- package/esm/src/config/env.js +18 -10
- package/esm/src/data/static-data-fetcher.d.ts +3 -0
- package/esm/src/data/static-data-fetcher.d.ts.map +1 -1
- package/esm/src/data/static-data-fetcher.js +29 -25
- package/esm/src/data/static-paths-fetcher.d.ts.map +1 -1
- package/esm/src/data/static-paths-fetcher.js +3 -2
- package/esm/src/errors/logging.d.ts.map +1 -1
- package/esm/src/errors/logging.js +16 -7
- package/esm/src/errors/user-friendly/error-formatter.d.ts.map +1 -1
- package/esm/src/errors/user-friendly/error-formatter.js +9 -25
- package/esm/src/fs/index.d.ts +11 -12
- package/esm/src/fs/index.d.ts.map +1 -1
- package/esm/src/fs/index.js +11 -24
- package/esm/src/html/dev-scripts.d.ts.map +1 -1
- package/esm/src/html/dev-scripts.js +5 -8
- package/esm/src/html/html-escape.d.ts +1 -0
- package/esm/src/html/html-escape.d.ts.map +1 -1
- package/esm/src/html/html-escape.js +3 -0
- package/esm/src/html/html-injection.js +2 -2
- package/esm/src/html/html-shell-generator.d.ts +5 -2
- package/esm/src/html/html-shell-generator.d.ts.map +1 -1
- package/esm/src/html/html-shell-generator.js +41 -30
- package/esm/src/html/hydration-script-builder/dev-client-renderer.js +2 -2
- package/esm/src/html/hydration-script-builder/dev-component-manifest.js +2 -2
- package/esm/src/html/hydration-script-builder/dev-error-logger.d.ts.map +1 -1
- package/esm/src/html/hydration-script-builder/dev-error-logger.js +2 -6
- package/esm/src/html/hydration-script-builder/dev-scripts.js +2 -2
- package/esm/src/html/hydration-script-builder/hydration-data-generator.d.ts +3 -1
- package/esm/src/html/hydration-script-builder/hydration-data-generator.d.ts.map +1 -1
- package/esm/src/html/hydration-script-builder/hydration-data-generator.js +2 -2
- package/esm/src/html/hydration-script-builder/index.d.ts +1 -1
- package/esm/src/html/hydration-script-builder/index.d.ts.map +1 -1
- package/esm/src/html/hydration-script-builder/index.js +1 -1
- package/esm/src/html/hydration-script-builder/prod-hydration.js +2 -2
- package/esm/src/html/hydration-script-builder/prod-scripts.d.ts +2 -0
- package/esm/src/html/hydration-script-builder/prod-scripts.d.ts.map +1 -1
- package/esm/src/html/hydration-script-builder/prod-scripts.js +14 -14
- package/esm/src/html/schemas/html.schema.d.ts +2 -0
- package/esm/src/html/schemas/html.schema.d.ts.map +1 -1
- package/esm/src/html/schemas/html.schema.js +2 -0
- package/esm/src/html/styles-builder/css-pregeneration.d.ts +17 -1
- package/esm/src/html/styles-builder/css-pregeneration.d.ts.map +1 -1
- package/esm/src/html/styles-builder/css-pregeneration.js +103 -1
- package/esm/src/html/styles-builder/dev-styles.js +2 -2
- package/esm/src/html/utils.d.ts +2 -0
- package/esm/src/html/utils.d.ts.map +1 -1
- package/esm/src/html/utils.js +49 -28
- package/esm/src/integrations/remote-tools.d.ts.map +1 -1
- package/esm/src/integrations/remote-tools.js +32 -39
- package/esm/src/internal-agents/ag-ui-sse.d.ts +0 -1
- package/esm/src/internal-agents/ag-ui-sse.d.ts.map +1 -1
- package/esm/src/internal-agents/ag-ui-sse.js +2 -16
- package/esm/src/internal-agents/control-plane-auth.d.ts.map +1 -1
- package/esm/src/internal-agents/control-plane-auth.js +5 -3
- package/esm/src/internal-agents/request-body.d.ts.map +1 -1
- package/esm/src/internal-agents/request-body.js +6 -3
- package/esm/src/internal-agents/session-manager.d.ts +1 -0
- package/esm/src/internal-agents/session-manager.d.ts.map +1 -1
- package/esm/src/internal-agents/session-manager.js +12 -18
- package/esm/src/issues/core.d.ts.map +1 -1
- package/esm/src/issues/core.js +24 -23
- package/esm/src/issues/schemas/issue.schema.d.ts.map +1 -1
- package/esm/src/issues/schemas/issue.schema.js +2 -1
- package/esm/src/jobs/runtime-env.d.ts.map +1 -1
- package/esm/src/jobs/runtime-env.js +21 -44
- package/esm/src/markdown/index.d.ts +1 -2
- package/esm/src/markdown/index.d.ts.map +1 -1
- package/esm/src/markdown/index.js +1 -6
- package/esm/src/mcp/server.d.ts +0 -1
- package/esm/src/mcp/server.d.ts.map +1 -1
- package/esm/src/mcp/server.js +40 -41
- package/esm/src/mdx/index.d.ts +3 -2
- package/esm/src/mdx/index.d.ts.map +1 -1
- package/esm/src/mdx/index.js +3 -5
- package/esm/src/middleware/builtin/logger.d.ts.map +1 -1
- package/esm/src/middleware/builtin/logger.js +31 -28
- package/esm/src/middleware/builtin/security/rate-limit.d.ts.map +1 -1
- package/esm/src/middleware/builtin/security/rate-limit.js +17 -12
- package/esm/src/middleware/builtin/timeout.d.ts.map +1 -1
- package/esm/src/middleware/builtin/timeout.js +17 -10
- package/esm/src/modules/import-map/default-import-map.d.ts.map +1 -1
- package/esm/src/modules/import-map/default-import-map.js +4 -3
- package/esm/src/oauth/handlers/callback-handler.d.ts +0 -5
- package/esm/src/oauth/handlers/callback-handler.d.ts.map +1 -1
- package/esm/src/oauth/handlers/callback-handler.js +9 -14
- package/esm/src/oauth/handlers/index.d.ts +1 -1
- package/esm/src/oauth/handlers/index.js +1 -1
- package/esm/src/oauth/handlers/init-handler.d.ts.map +1 -1
- package/esm/src/oauth/handlers/init-handler.js +32 -20
- package/esm/src/oauth/providers/index.d.ts +1 -1
- package/esm/src/oauth/providers/index.js +1 -1
- package/esm/src/oauth/schemas/index.d.ts +1 -1
- package/esm/src/oauth/schemas/index.js +1 -1
- package/esm/src/oauth/token-store/index.d.ts +1 -1
- package/esm/src/oauth/token-store/index.js +1 -1
- package/esm/src/oauth/token-store/memory.d.ts +1 -1
- package/esm/src/oauth/token-store/memory.d.ts.map +1 -1
- package/esm/src/oauth/token-store/memory.js +8 -8
- package/esm/src/observability/request-profiler.d.ts +31 -0
- package/esm/src/observability/request-profiler.d.ts.map +1 -0
- package/esm/src/observability/request-profiler.js +94 -0
- package/esm/src/observability/tracing/otlp-setup.d.ts.map +1 -1
- package/esm/src/observability/tracing/otlp-setup.js +16 -21
- package/esm/src/prompt/factory.d.ts.map +1 -1
- package/esm/src/prompt/factory.js +10 -12
- package/esm/src/prompt/registry.d.ts.map +1 -1
- package/esm/src/prompt/registry.js +12 -10
- package/esm/src/prompt/schemas/prompt.schema.d.ts.map +1 -1
- package/esm/src/prompt/schemas/prompt.schema.js +0 -2
- package/esm/src/prompt/types.d.ts +1 -1
- package/esm/src/prompt/types.d.ts.map +1 -1
- package/esm/src/provider/local/ai-sdk-adapter.d.ts.map +1 -1
- package/esm/src/provider/local/ai-sdk-adapter.js +3 -8
- package/esm/src/provider/local/env.d.ts +4 -6
- package/esm/src/provider/local/env.d.ts.map +1 -1
- package/esm/src/provider/local/env.js +14 -1
- package/esm/src/provider/local/local-engine.d.ts.map +1 -1
- package/esm/src/provider/local/local-engine.js +2 -7
- package/esm/src/provider/model-registry.d.ts.map +1 -1
- package/esm/src/provider/model-registry.js +2 -7
- package/esm/src/provider/veryfront-cloud/provider.d.ts.map +1 -1
- package/esm/src/provider/veryfront-cloud/provider.js +1 -7
- package/esm/src/provider/veryfront-cloud/shared.d.ts.map +1 -1
- package/esm/src/provider/veryfront-cloud/shared.js +9 -11
- package/esm/src/proxy/handler.d.ts.map +1 -1
- package/esm/src/proxy/handler.js +56 -57
- package/esm/src/react/compat/hooks-adapter.d.ts +1 -7
- package/esm/src/react/compat/hooks-adapter.d.ts.map +1 -1
- package/esm/src/react/compat/hooks-adapter.js +35 -40
- package/esm/src/react/components/Head.d.ts +1 -26
- package/esm/src/react/components/Head.d.ts.map +1 -1
- package/esm/src/react/components/Head.js +1 -172
- package/esm/src/react/context/index.d.ts +2 -46
- package/esm/src/react/context/index.d.ts.map +1 -1
- package/esm/src/react/context/index.js +1 -44
- package/esm/src/react/head-collector.d.ts +1 -10
- package/esm/src/react/head-collector.d.ts.map +1 -1
- package/esm/src/react/head-collector.js +4 -0
- package/esm/src/react/router/index.d.ts +2 -45
- package/esm/src/react/router/index.d.ts.map +1 -1
- package/esm/src/react/router/index.js +1 -49
- package/esm/src/react/runtime/core.d.ts +49 -0
- package/esm/src/react/runtime/core.d.ts.map +1 -0
- package/esm/src/react/runtime/core.js +200 -0
- package/esm/src/rendering/orchestrator/html.d.ts +2 -0
- package/esm/src/rendering/orchestrator/html.d.ts.map +1 -1
- package/esm/src/rendering/orchestrator/html.js +69 -12
- package/esm/src/rendering/orchestrator/ssr-orchestrator.d.ts.map +1 -1
- package/esm/src/rendering/orchestrator/ssr-orchestrator.js +4 -0
- package/esm/src/rendering/orchestrator/types.d.ts +4 -0
- package/esm/src/rendering/orchestrator/types.d.ts.map +1 -1
- package/esm/src/repositories/types.d.ts.map +1 -1
- package/esm/src/resource/factory.d.ts.map +1 -1
- package/esm/src/resource/factory.js +12 -9
- package/esm/src/resource/registry.d.ts +3 -3
- package/esm/src/resource/registry.d.ts.map +1 -1
- package/esm/src/resource/registry.js +7 -7
- package/esm/src/schemas/common.d.ts.map +1 -1
- package/esm/src/schemas/common.js +7 -4
- package/esm/src/security/http/config.d.ts +0 -1
- package/esm/src/security/http/config.d.ts.map +1 -1
- package/esm/src/security/http/config.js +3 -16
- package/esm/src/security/http/response/security-handler.d.ts +1 -0
- package/esm/src/security/http/response/security-handler.d.ts.map +1 -1
- package/esm/src/security/http/response/security-handler.js +17 -12
- package/esm/src/security/index.d.ts +4 -2
- package/esm/src/security/index.d.ts.map +1 -1
- package/esm/src/security/index.js +3 -1
- package/esm/src/server/handlers/dev/styles-css.handler.d.ts.map +1 -1
- package/esm/src/server/handlers/dev/styles-css.handler.js +8 -7
- package/esm/src/server/handlers/monitoring/metrics.handler.d.ts.map +1 -1
- package/esm/src/server/handlers/monitoring/metrics.handler.js +3 -1
- package/esm/src/server/handlers/request/module/module-server-handler.d.ts.map +1 -1
- package/esm/src/server/handlers/request/module/module-server-handler.js +18 -15
- package/esm/src/server/handlers/request/prod-hydration-module.handler.d.ts +8 -0
- package/esm/src/server/handlers/request/prod-hydration-module.handler.d.ts.map +1 -0
- package/esm/src/server/handlers/request/prod-hydration-module.handler.js +41 -0
- package/esm/src/server/handlers/request/ssr/ssr.handler.d.ts.map +1 -1
- package/esm/src/server/handlers/request/ssr/ssr.handler.js +3 -0
- package/esm/src/server/production-server.d.ts.map +1 -1
- package/esm/src/server/production-server.js +65 -0
- package/esm/src/server/runtime-handler/handler-context-builder.d.ts +1 -1
- package/esm/src/server/runtime-handler/handler-context-builder.d.ts.map +1 -1
- package/esm/src/server/runtime-handler/index.d.ts +1 -1
- package/esm/src/server/runtime-handler/index.d.ts.map +1 -1
- package/esm/src/server/runtime-handler/index.js +36 -11
- package/esm/src/server/runtime-handler/request-utils.d.ts +7 -0
- package/esm/src/server/runtime-handler/request-utils.d.ts.map +1 -1
- package/esm/src/server/runtime-handler/request-utils.js +10 -0
- package/esm/src/server/services/rendering/ssr.service.d.ts +1 -0
- package/esm/src/server/services/rendering/ssr.service.d.ts.map +1 -1
- package/esm/src/server/services/rendering/ssr.service.js +12 -5
- package/esm/src/server/services/rsc/endpoints/rsc-bundles.generated.js +1 -1
- package/esm/src/skill/allowed-tools.d.ts +3 -8
- package/esm/src/skill/allowed-tools.d.ts.map +1 -1
- package/esm/src/skill/executor.js +2 -2
- package/esm/src/skill/parser.d.ts.map +1 -1
- package/esm/src/skill/parser.js +12 -12
- package/esm/src/skill/path-safety.js +1 -1
- package/esm/src/skill/tools.d.ts.map +1 -1
- package/esm/src/skill/tools.js +18 -11
- package/esm/src/studio/bridge/bridge-bundle.generated.d.ts.map +1 -1
- package/esm/src/studio/bridge/bridge-bundle.generated.js +1 -1
- package/esm/src/task/discovery.d.ts.map +1 -1
- package/esm/src/task/discovery.js +73 -95
- package/esm/src/tool/executor.d.ts.map +1 -1
- package/esm/src/tool/executor.js +8 -7
- package/esm/src/tool/factory.d.ts.map +1 -1
- package/esm/src/tool/factory.js +13 -16
- package/esm/src/transforms/esm/package-registry.d.ts +4 -0
- package/esm/src/transforms/esm/package-registry.d.ts.map +1 -1
- package/esm/src/transforms/esm/package-registry.js +34 -17
- package/esm/src/transforms/import-rewriter/strategies/veryfront-strategy.d.ts.map +1 -1
- package/esm/src/transforms/import-rewriter/strategies/veryfront-strategy.js +2 -1
- package/esm/src/transforms/mdx/esm-module-loader/cache-format.d.ts.map +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/cache-format.js +26 -1
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/index.d.ts +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/index.d.ts.map +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/index.js +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/render-sessions.d.ts +1 -0
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/render-sessions.d.ts.map +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/render-sessions.js +3 -0
- package/esm/src/transforms/pipeline/stages/ssr-vf-modules/index.d.ts +1 -1
- package/esm/src/transforms/pipeline/stages/ssr-vf-modules/index.js +1 -1
- package/esm/src/transforms/veryfront-module-urls.d.ts.map +1 -1
- package/esm/src/transforms/veryfront-module-urls.js +7 -3
- package/esm/src/types/entities/getEntityInfo.d.ts.map +1 -1
- package/esm/src/types/entities/getEntityInfo.js +79 -127
- package/esm/src/utils/path-utils.d.ts +1 -1
- package/esm/src/utils/path-utils.d.ts.map +1 -1
- package/esm/src/utils/path-utils.js +16 -7
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/esm/src/utils/version.d.ts.map +1 -1
- package/esm/src/utils/version.js +0 -1
- package/esm/src/workflow/worker/dynamic-job-entrypoint.d.ts.map +1 -1
- package/esm/src/workflow/worker/dynamic-job-entrypoint.js +5 -72
- package/esm/src/workflow/worker/job-entrypoint.d.ts.map +1 -1
- package/esm/src/workflow/worker/job-entrypoint.js +5 -72
- package/esm/src/workflow/worker/shared.d.ts +18 -0
- package/esm/src/workflow/worker/shared.d.ts.map +1 -0
- package/esm/src/workflow/worker/shared.js +77 -0
- package/package.json +1 -1
- package/src/cli/router.ts +41 -2
- package/src/cli/shared/update-check.ts +110 -0
- package/src/deno.js +13 -8
- package/src/src/channels/control-plane.ts +6 -10
- package/src/src/channels/invoke.ts +7 -7
- package/src/src/chat/index.ts +96 -132
- package/src/src/config/env.ts +24 -11
- package/src/src/data/static-data-fetcher.ts +59 -34
- package/src/src/data/static-paths-fetcher.ts +4 -2
- package/src/src/errors/logging.ts +21 -7
- package/src/src/errors/user-friendly/error-formatter.ts +14 -29
- package/src/src/fs/index.ts +21 -30
- package/src/src/html/dev-scripts.ts +5 -9
- package/src/src/html/html-escape.ts +4 -0
- package/src/src/html/html-injection.ts +2 -2
- package/src/src/html/html-shell-generator.ts +60 -26
- package/src/src/html/hydration-script-builder/dev-client-renderer.ts +2 -2
- package/src/src/html/hydration-script-builder/dev-component-manifest.ts +2 -2
- package/src/src/html/hydration-script-builder/dev-error-logger.ts +2 -8
- package/src/src/html/hydration-script-builder/dev-scripts.ts +2 -2
- package/src/src/html/hydration-script-builder/hydration-data-generator.ts +2 -1
- package/src/src/html/hydration-script-builder/index.ts +5 -1
- package/src/src/html/hydration-script-builder/prod-hydration.ts +2 -2
- package/src/src/html/hydration-script-builder/prod-scripts.ts +16 -15
- package/src/src/html/schemas/html.schema.ts +2 -0
- package/src/src/html/styles-builder/css-pregeneration.ts +133 -1
- package/src/src/html/styles-builder/dev-styles.ts +2 -2
- package/src/src/html/utils.ts +62 -29
- package/src/src/integrations/remote-tools.ts +39 -37
- package/src/src/internal-agents/ag-ui-sse.ts +2 -17
- package/src/src/internal-agents/control-plane-auth.ts +8 -6
- package/src/src/internal-agents/request-body.ts +7 -5
- package/src/src/internal-agents/session-manager.ts +16 -20
- package/src/src/issues/core.ts +24 -27
- package/src/src/issues/schemas/issue.schema.ts +3 -1
- package/src/src/jobs/runtime-env.ts +24 -50
- package/src/src/markdown/index.ts +5 -8
- package/src/src/mcp/server.ts +50 -53
- package/src/src/mdx/index.ts +7 -8
- package/src/src/middleware/builtin/logger.ts +44 -29
- package/src/src/middleware/builtin/security/rate-limit.ts +20 -11
- package/src/src/middleware/builtin/timeout.ts +22 -13
- package/src/src/modules/import-map/default-import-map.ts +4 -3
- package/src/src/oauth/handlers/callback-handler.ts +9 -16
- package/src/src/oauth/handlers/index.ts +1 -1
- package/src/src/oauth/handlers/init-handler.ts +56 -27
- package/src/src/oauth/providers/index.ts +1 -1
- package/src/src/oauth/schemas/index.ts +1 -1
- package/src/src/oauth/token-store/index.ts +1 -1
- package/src/src/oauth/token-store/memory.ts +8 -8
- package/src/src/observability/request-profiler.ts +140 -0
- package/src/src/observability/tracing/otlp-setup.ts +16 -22
- package/src/src/prompt/factory.ts +16 -14
- package/src/src/prompt/registry.ts +14 -13
- package/src/src/prompt/schemas/prompt.schema.ts +0 -4
- package/src/src/prompt/types.ts +1 -2
- package/src/src/provider/local/ai-sdk-adapter.ts +3 -10
- package/src/src/provider/local/env.ts +22 -2
- package/src/src/provider/local/local-engine.ts +2 -9
- package/src/src/provider/model-registry.ts +2 -9
- package/src/src/provider/veryfront-cloud/provider.ts +1 -8
- package/src/src/provider/veryfront-cloud/shared.ts +12 -15
- package/src/src/proxy/handler.ts +90 -74
- package/src/src/react/compat/hooks-adapter.ts +43 -44
- package/src/src/react/components/Head.tsx +1 -181
- package/src/src/react/context/index.tsx +2 -83
- package/src/src/react/head-collector.ts +9 -0
- package/src/src/react/router/index.tsx +2 -100
- package/src/src/react/runtime/core.ts +303 -0
- package/src/src/rendering/orchestrator/html.ts +122 -18
- package/src/src/rendering/orchestrator/ssr-orchestrator.ts +8 -0
- package/src/src/rendering/orchestrator/types.ts +4 -0
- package/src/src/repositories/types.ts +0 -4
- package/src/src/resource/factory.ts +15 -11
- package/src/src/resource/registry.ts +7 -7
- package/src/src/schemas/common.ts +8 -5
- package/src/src/security/http/config.ts +3 -19
- package/src/src/security/http/response/security-handler.ts +22 -13
- package/src/src/security/index.ts +4 -7
- package/src/src/server/handlers/dev/styles-css.handler.ts +32 -14
- package/src/src/server/handlers/monitoring/metrics.handler.ts +3 -1
- package/src/src/server/handlers/request/module/module-server-handler.ts +24 -17
- package/src/src/server/handlers/request/prod-hydration-module.handler.ts +61 -0
- package/src/src/server/handlers/request/ssr/ssr.handler.ts +3 -0
- package/src/src/server/production-server.ts +84 -0
- package/src/src/server/runtime-handler/handler-context-builder.ts +1 -1
- package/src/src/server/runtime-handler/index.ts +44 -13
- package/src/src/server/runtime-handler/request-utils.ts +11 -0
- package/src/src/server/services/rendering/ssr.service.ts +31 -18
- package/src/src/server/services/rsc/endpoints/rsc-bundles.generated.ts +1 -1
- package/src/src/skill/allowed-tools.ts +1 -8
- package/src/src/skill/executor.ts +2 -2
- package/src/src/skill/parser.ts +13 -20
- package/src/src/skill/path-safety.ts +1 -1
- package/src/src/skill/tools.ts +27 -20
- package/src/src/studio/bridge/bridge-bundle.generated.ts +1 -1
- package/src/src/task/discovery.ts +97 -97
- package/src/src/tool/executor.ts +10 -8
- package/src/src/tool/factory.ts +21 -22
- package/src/src/tool/types.ts +0 -17
- package/src/src/transforms/esm/package-registry.ts +52 -20
- package/src/src/transforms/import-rewriter/strategies/veryfront-strategy.ts +2 -1
- package/src/src/transforms/mdx/esm-module-loader/cache-format.ts +34 -1
- package/src/src/transforms/mdx/esm-module-loader/module-fetcher/index.ts +1 -1
- package/src/src/transforms/mdx/esm-module-loader/module-fetcher/render-sessions.ts +4 -0
- package/src/src/transforms/pipeline/stages/ssr-vf-modules/index.ts +1 -1
- package/src/src/transforms/veryfront-module-urls.ts +6 -2
- package/src/src/types/entities/getEntityInfo.ts +131 -152
- package/src/src/utils/path-utils.ts +16 -7
- package/src/src/utils/version-constant.ts +1 -1
- package/src/src/utils/version.ts +0 -1
- package/src/src/workflow/worker/dynamic-job-entrypoint.ts +18 -84
- package/src/src/workflow/worker/job-entrypoint.ts +18 -85
- package/src/src/workflow/worker/shared.ts +127 -0
- package/esm/src/prompt/schemas/index.d.ts +0 -7
- package/esm/src/prompt/schemas/index.d.ts.map +0 -1
- package/esm/src/prompt/schemas/index.js +0 -6
- package/esm/src/security/http/handlers-index.d.ts +0 -5
- package/esm/src/security/http/handlers-index.d.ts.map +0 -1
- package/esm/src/security/http/handlers-index.js +0 -3
- package/src/src/prompt/schemas/index.ts +0 -7
- package/src/src/security/http/handlers-index.ts +0 -4
|
@@ -3,6 +3,7 @@ import type { HandlerContext, HandlerResult } from "../../types.js";
|
|
|
3
3
|
import { ResponseBuilder } from "../../../../security/index.js";
|
|
4
4
|
import { withSpan } from "../../../../observability/tracing/otlp-setup.js";
|
|
5
5
|
import { resolveProjectReactVersion } from "../../../../transforms/esm/package-registry.js";
|
|
6
|
+
import { profilePhase } from "../../../../observability/request-profiler.js";
|
|
6
7
|
|
|
7
8
|
export function handleModuleServer(
|
|
8
9
|
req: dntShim.Request,
|
|
@@ -18,24 +19,30 @@ export function handleModuleServer(
|
|
|
18
19
|
"module.server.handle",
|
|
19
20
|
async () => {
|
|
20
21
|
try {
|
|
21
|
-
const reactVersion = await
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
const reactVersion = await profilePhase(
|
|
23
|
+
"module.resolve_react_version",
|
|
24
|
+
() =>
|
|
25
|
+
resolveProjectReactVersion({
|
|
26
|
+
projectDir: ctx.projectDir,
|
|
27
|
+
config: ctx.config,
|
|
28
|
+
}),
|
|
29
|
+
);
|
|
25
30
|
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
31
|
+
const moduleResponse = await profilePhase("module.serve", async () => {
|
|
32
|
+
const { serveModule } = await import("../../../../modules/server/index.js");
|
|
33
|
+
return await serveModule(req, {
|
|
34
|
+
projectId: ctx.projectId ?? ctx.projectDir,
|
|
35
|
+
projectDir: ctx.projectDir,
|
|
36
|
+
adapter: ctx.adapter,
|
|
37
|
+
dev: !!ctx.isLocalProject,
|
|
38
|
+
projectUUID: ctx.projectId,
|
|
39
|
+
projectSlug: ctx.projectSlug,
|
|
40
|
+
branch: ctx.parsedDomain?.branch ?? null,
|
|
41
|
+
releaseId: ctx.releaseId ?? null,
|
|
42
|
+
allowedImportDirs: ctx.config?.security?.allowedImportDirs,
|
|
43
|
+
reactVersion,
|
|
44
|
+
mode: ctx.requestContext?.mode,
|
|
45
|
+
});
|
|
39
46
|
});
|
|
40
47
|
|
|
41
48
|
const response = createResponseBuilder(ctx)
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import * as dntShim from "../../../../_dnt.shims.js";
|
|
2
|
+
import { BaseHandler } from "../response/base.js";
|
|
3
|
+
import type { HandlerContext, HandlerMetadata, HandlerPriority, HandlerResult } from "../types.js";
|
|
4
|
+
import {
|
|
5
|
+
generateProdHydrationModule,
|
|
6
|
+
PROD_HYDRATION_MODULE_PATH,
|
|
7
|
+
} from "../../../html/hydration-script-builder/prod-scripts.js";
|
|
8
|
+
import { computeStrongEtag, hasMatchingEtag } from "../utils/etag.js";
|
|
9
|
+
import { HTTP_OK, PRIORITY_HIGH_DEV } from "../../../utils/constants/index.js";
|
|
10
|
+
|
|
11
|
+
let cachedModule: { js: string; etag: string } | null = null;
|
|
12
|
+
|
|
13
|
+
function getProdHydrationModuleBundle(): { js: string; etag: string } {
|
|
14
|
+
if (cachedModule) return cachedModule;
|
|
15
|
+
|
|
16
|
+
const js = generateProdHydrationModule();
|
|
17
|
+
cachedModule = {
|
|
18
|
+
js,
|
|
19
|
+
etag: computeStrongEtag(js),
|
|
20
|
+
};
|
|
21
|
+
return cachedModule;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export class ProdHydrationModuleHandler extends BaseHandler {
|
|
25
|
+
metadata: HandlerMetadata = {
|
|
26
|
+
name: "ProdHydrationModuleHandler",
|
|
27
|
+
priority: PRIORITY_HIGH_DEV as HandlerPriority,
|
|
28
|
+
patterns: [
|
|
29
|
+
{ pattern: PROD_HYDRATION_MODULE_PATH, exact: true, method: "GET" },
|
|
30
|
+
{ pattern: PROD_HYDRATION_MODULE_PATH, exact: true, method: "HEAD" },
|
|
31
|
+
],
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
async handle(req: dntShim.Request, ctx: HandlerContext): Promise<HandlerResult> {
|
|
35
|
+
if (!this.shouldHandle(req, ctx)) {
|
|
36
|
+
return this.continue();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const method = req.method.toUpperCase();
|
|
40
|
+
const { js, etag } = getProdHydrationModuleBundle();
|
|
41
|
+
const builder = this.createResponseBuilder(ctx).withCORS(req, ctx.securityConfig?.cors);
|
|
42
|
+
|
|
43
|
+
if (hasMatchingEtag(req, etag)) {
|
|
44
|
+
return this.respond(
|
|
45
|
+
builder.withSecurity(ctx.securityConfig ?? undefined, req).notModified(etag),
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return this.respond(
|
|
50
|
+
builder
|
|
51
|
+
.withSecurity(ctx.securityConfig ?? undefined, req)
|
|
52
|
+
.withCache("no-cache")
|
|
53
|
+
.withETag(etag)
|
|
54
|
+
.withContentType(
|
|
55
|
+
"application/javascript; charset=utf-8",
|
|
56
|
+
method === "HEAD" ? null : js,
|
|
57
|
+
HTTP_OK,
|
|
58
|
+
),
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -193,6 +193,8 @@ export class SSRHandler extends BaseHandler {
|
|
|
193
193
|
const pageId = url.searchParams.get("page_id") || undefined;
|
|
194
194
|
const noHmr = url.searchParams.get("noHmr") === "1" ||
|
|
195
195
|
url.searchParams.get("no_hmr") === "1";
|
|
196
|
+
const forceProductionScripts = url.searchParams.get("forceProductionScripts") === "1" ||
|
|
197
|
+
url.searchParams.get("force_production_scripts") === "1";
|
|
196
198
|
const useNoCache = shouldUseNoCacheHeadersFromHandler(ctx);
|
|
197
199
|
|
|
198
200
|
const result = await this.ssrService.renderPage(ctx, {
|
|
@@ -204,6 +206,7 @@ export class SSRHandler extends BaseHandler {
|
|
|
204
206
|
projectId,
|
|
205
207
|
pageId,
|
|
206
208
|
noHmr,
|
|
209
|
+
forceProductionScripts,
|
|
207
210
|
useNoCache,
|
|
208
211
|
});
|
|
209
212
|
|
|
@@ -18,6 +18,14 @@ import {
|
|
|
18
18
|
stopMemoryMonitoring,
|
|
19
19
|
} from "../utils/memory/index.js";
|
|
20
20
|
import { initializeDistributedCaches } from "../cache/distributed-cache-init.js";
|
|
21
|
+
import { getConfig } from "../config/index.js";
|
|
22
|
+
import { resolveStyleContentVersion } from "../html/styles-builder/content-version.js";
|
|
23
|
+
import {
|
|
24
|
+
buildPreparedCSSArtifactFromFiles,
|
|
25
|
+
collectLocalProjectSourceFiles,
|
|
26
|
+
readLocalProjectStylesheet,
|
|
27
|
+
} from "../html/styles-builder/css-pregeneration.js";
|
|
28
|
+
import { createStyleScopeProfile } from "../html/styles-builder/style-scope-profile.js";
|
|
21
29
|
import { setServerInitialized } from "./handlers/monitoring/health.handler.js";
|
|
22
30
|
import {
|
|
23
31
|
enableSSRClientOnlyFetching,
|
|
@@ -39,6 +47,74 @@ const DEFAULT_SHUTDOWN_DRAIN_TIMEOUT_MS = 25_000;
|
|
|
39
47
|
/** Default port when PORT / VERYFRONT_PORT env vars are not set */
|
|
40
48
|
const DEFAULT_SERVER_PORT = 3_000;
|
|
41
49
|
|
|
50
|
+
async function prewarmLocalProductionCSSArtifacts(
|
|
51
|
+
adapter: RuntimeAdapter,
|
|
52
|
+
options: Pick<
|
|
53
|
+
StartProductionServerOptions,
|
|
54
|
+
| "projectDir"
|
|
55
|
+
| "defaultProjectSlug"
|
|
56
|
+
| "defaultProjectId"
|
|
57
|
+
| "defaultEnvironment"
|
|
58
|
+
| "localProjects"
|
|
59
|
+
>,
|
|
60
|
+
): Promise<void> {
|
|
61
|
+
if (options.defaultEnvironment !== "production") return;
|
|
62
|
+
|
|
63
|
+
const projectsToWarm = new Map<string, string>();
|
|
64
|
+
|
|
65
|
+
if (options.localProjects) {
|
|
66
|
+
for (const [projectSlug, projectDir] of Object.entries(options.localProjects)) {
|
|
67
|
+
projectsToWarm.set(projectSlug, projectDir);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (options.defaultProjectSlug && options.projectDir) {
|
|
72
|
+
projectsToWarm.set(options.defaultProjectSlug, options.projectDir);
|
|
73
|
+
} else if (projectsToWarm.size === 0 && options.defaultProjectId && options.projectDir) {
|
|
74
|
+
projectsToWarm.set(options.defaultProjectId, options.projectDir);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (projectsToWarm.size === 0) return;
|
|
78
|
+
|
|
79
|
+
await Promise.all([...projectsToWarm.entries()].map(async ([projectSlug, projectDir]) => {
|
|
80
|
+
try {
|
|
81
|
+
const config = await getConfig(projectDir, adapter, { cacheKey: projectSlug });
|
|
82
|
+
const styleProfile = createStyleScopeProfile(config);
|
|
83
|
+
const files = await collectLocalProjectSourceFiles({
|
|
84
|
+
projectDir,
|
|
85
|
+
styleProfile,
|
|
86
|
+
});
|
|
87
|
+
const stylesheet = await readLocalProjectStylesheet(projectDir, config?.tailwind?.stylesheet);
|
|
88
|
+
|
|
89
|
+
const result = await buildPreparedCSSArtifactFromFiles({
|
|
90
|
+
projectSlug,
|
|
91
|
+
projectVersion: resolveStyleContentVersion(null),
|
|
92
|
+
projectDir,
|
|
93
|
+
files,
|
|
94
|
+
styleProfile,
|
|
95
|
+
stylesheet,
|
|
96
|
+
stylesheetPath: config?.tailwind?.stylesheet,
|
|
97
|
+
minify: true,
|
|
98
|
+
environment: "preview",
|
|
99
|
+
buildMode: "production",
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
serverLog.debug("Prewarmed local production CSS artifact", {
|
|
103
|
+
projectSlug,
|
|
104
|
+
projectDir,
|
|
105
|
+
fileCount: files.length,
|
|
106
|
+
fromCache: result.fromCache,
|
|
107
|
+
});
|
|
108
|
+
} catch (error) {
|
|
109
|
+
serverLog.debug("Skipping local production CSS prewarm", {
|
|
110
|
+
projectSlug,
|
|
111
|
+
projectDir,
|
|
112
|
+
error: error instanceof Error ? error.message : String(error),
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
}));
|
|
116
|
+
}
|
|
117
|
+
|
|
42
118
|
/** Configuration for AI primitives discovery during server startup */
|
|
43
119
|
export interface DiscoveryOptions {
|
|
44
120
|
baseDir: string;
|
|
@@ -117,6 +193,14 @@ export function startProductionServer(
|
|
|
117
193
|
logger.debug("FSAdapter initialized", { type: bootstrap.fsAdapterType });
|
|
118
194
|
}
|
|
119
195
|
|
|
196
|
+
await prewarmLocalProductionCSSArtifacts(bootstrap.adapter, {
|
|
197
|
+
projectDir,
|
|
198
|
+
defaultProjectSlug,
|
|
199
|
+
defaultProjectId,
|
|
200
|
+
defaultEnvironment,
|
|
201
|
+
localProjects,
|
|
202
|
+
});
|
|
203
|
+
|
|
120
204
|
// Enable SSR fetch interception to handle relative URLs during SSR
|
|
121
205
|
setSSRServerPort(port);
|
|
122
206
|
enableSSRFetchInterception();
|
|
@@ -19,7 +19,7 @@ import type { RouteRegistry } from "../../routing/registry/index.js";
|
|
|
19
19
|
import { buildEnrichedContext } from "../context/enriched-context.js";
|
|
20
20
|
import { computeContentSourceId } from "../../cache/keys.js";
|
|
21
21
|
|
|
22
|
-
interface HandlerContextOptions {
|
|
22
|
+
export interface HandlerContextOptions {
|
|
23
23
|
/** Project directory */
|
|
24
24
|
projectDir: string;
|
|
25
25
|
/** Runtime adapter */
|
|
@@ -34,6 +34,10 @@ import { CsrfHandler } from "../../security/http/csrf/csrf-handler.js";
|
|
|
34
34
|
import { CorsHandler } from "../handlers/response/cors.js";
|
|
35
35
|
import { HealthHandler } from "../handlers/monitoring/health.handler.js";
|
|
36
36
|
import { MetricsHandler } from "../handlers/monitoring/metrics.handler.js";
|
|
37
|
+
import {
|
|
38
|
+
finalizeRequestProfiling,
|
|
39
|
+
runWithRequestProfiling,
|
|
40
|
+
} from "../../observability/request-profiler.js";
|
|
37
41
|
import { ClientLogHandler } from "../handlers/monitoring/client-log.handler.js";
|
|
38
42
|
import { MemoryDebugHandler } from "../handlers/monitoring/memory.handler.js";
|
|
39
43
|
import { DevEndpointsHandler } from "../handlers/dev/endpoints.handler.js";
|
|
@@ -44,6 +48,7 @@ import { StudioBridgeModulesHandler } from "../handlers/studio/bridge-modules.ha
|
|
|
44
48
|
import { StaticHandler } from "../handlers/request/static.handler.js";
|
|
45
49
|
import { SnippetHandler } from "../handlers/request/snippet.handler.js";
|
|
46
50
|
import { LibModulesHandler } from "../handlers/request/lib-modules.handler.js";
|
|
51
|
+
import { ProdHydrationModuleHandler } from "../handlers/request/prod-hydration-module.handler.js";
|
|
47
52
|
import { CSSHandler } from "../handlers/request/css.handler.js";
|
|
48
53
|
import { RSCHandler } from "../handlers/request/rsc/index.js";
|
|
49
54
|
import { ModuleHandler } from "../handlers/request/module/index.js";
|
|
@@ -99,6 +104,7 @@ import {
|
|
|
99
104
|
isLightweightPath,
|
|
100
105
|
isMonitoringPath,
|
|
101
106
|
isWebSocketPath,
|
|
107
|
+
shouldSkipEnrichedContext,
|
|
102
108
|
} from "./request-utils.js";
|
|
103
109
|
import { withRequestTimeout } from "./timeout-manager.js";
|
|
104
110
|
import {
|
|
@@ -138,6 +144,7 @@ export const HANDLER_NAMES = [
|
|
|
138
144
|
"DevDashboardHandler",
|
|
139
145
|
"ProjectsHandler",
|
|
140
146
|
"StudioBridgeModulesHandler",
|
|
147
|
+
"ProdHydrationModuleHandler",
|
|
141
148
|
"CSSHandler",
|
|
142
149
|
"DevFileHandler",
|
|
143
150
|
"SnippetHandler",
|
|
@@ -192,6 +199,7 @@ const handlerFactories: Record<
|
|
|
192
199
|
DevDashboardHandler: () => new DevDashboardHandler(),
|
|
193
200
|
ProjectsHandler: () => new ProjectsHandler(),
|
|
194
201
|
StudioBridgeModulesHandler: () => new StudioBridgeModulesHandler(),
|
|
202
|
+
ProdHydrationModuleHandler: () => new ProdHydrationModuleHandler(),
|
|
195
203
|
CSSHandler: () => new CSSHandler(),
|
|
196
204
|
DevFileHandler: () => new DevFileHandler(),
|
|
197
205
|
SnippetHandler: () => new SnippetHandler(),
|
|
@@ -551,7 +559,7 @@ export function createVeryfrontHandler(
|
|
|
551
559
|
return envRes.errorResponse;
|
|
552
560
|
}
|
|
553
561
|
|
|
554
|
-
const
|
|
562
|
+
const skipRenderEnrichedContext = shouldSkipEnrichedContext(url.pathname);
|
|
555
563
|
|
|
556
564
|
// Build handler context
|
|
557
565
|
const ctx = buildHandlerContext({
|
|
@@ -573,7 +581,7 @@ export function createVeryfrontHandler(
|
|
|
573
581
|
isLocalProject: adapterRes.isLocalProject,
|
|
574
582
|
moduleServerUrl: opts.moduleServerUrl,
|
|
575
583
|
environmentId: headers.environmentId,
|
|
576
|
-
skipEnrichedContext:
|
|
584
|
+
skipEnrichedContext: skipRenderEnrichedContext,
|
|
577
585
|
});
|
|
578
586
|
|
|
579
587
|
// Fetch per-project env vars for remote projects
|
|
@@ -604,18 +612,41 @@ export function createVeryfrontHandler(
|
|
|
604
612
|
// reqCtx.token indicates the request came through the proxy with auth.
|
|
605
613
|
// Without it (standalone / test), host env must remain accessible.
|
|
606
614
|
const shouldIsolateEnv = !adapterRes.isLocalProject && !!reqCtx.token;
|
|
607
|
-
const response = await
|
|
608
|
-
SpanNames.HANDLER_EXECUTE,
|
|
609
|
-
() => {
|
|
610
|
-
if (shouldIsolateEnv) {
|
|
611
|
-
return runWithProjectEnv(envVarsForRequest, executeRoute);
|
|
612
|
-
}
|
|
613
|
-
return executeRoute();
|
|
614
|
-
},
|
|
615
|
+
const response = await runWithRequestProfiling(
|
|
615
616
|
{
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
617
|
+
category: url.pathname.startsWith("/_vf_styles/")
|
|
618
|
+
? "css"
|
|
619
|
+
: url.pathname.startsWith("/_vf_modules/")
|
|
620
|
+
? "module"
|
|
621
|
+
: url.pathname.startsWith("/api/")
|
|
622
|
+
? "api"
|
|
623
|
+
: "html",
|
|
624
|
+
method: req.method,
|
|
625
|
+
pathname: url.pathname,
|
|
626
|
+
projectSlug: projectRes.projectSlug,
|
|
627
|
+
requestMode: envRes.resolvedEnvironment,
|
|
628
|
+
},
|
|
629
|
+
async () => {
|
|
630
|
+
let routedResponse: dntShim.Response | null | undefined;
|
|
631
|
+
try {
|
|
632
|
+
routedResponse = await withSpan(
|
|
633
|
+
SpanNames.HANDLER_EXECUTE,
|
|
634
|
+
() => {
|
|
635
|
+
if (shouldIsolateEnv) {
|
|
636
|
+
return runWithProjectEnv(envVarsForRequest, executeRoute);
|
|
637
|
+
}
|
|
638
|
+
return executeRoute();
|
|
639
|
+
},
|
|
640
|
+
{
|
|
641
|
+
"handler.project_slug": projectRes.projectSlug || "unknown",
|
|
642
|
+
"handler.path": url.pathname,
|
|
643
|
+
"handler.method": req.method,
|
|
644
|
+
},
|
|
645
|
+
);
|
|
646
|
+
return routedResponse;
|
|
647
|
+
} finally {
|
|
648
|
+
finalizeRequestProfiling(routedResponse?.status);
|
|
649
|
+
}
|
|
619
650
|
},
|
|
620
651
|
);
|
|
621
652
|
|
|
@@ -59,6 +59,7 @@ export function isMonitoringPath(pathname: string): boolean {
|
|
|
59
59
|
export const LIGHTWEIGHT_PATH_PREFIXES = [
|
|
60
60
|
"/_vf_modules/",
|
|
61
61
|
"/_veryfront/modules/",
|
|
62
|
+
"/_veryfront/hydration-runtime.js",
|
|
62
63
|
"/_veryfront/preview-hmr.js",
|
|
63
64
|
"/_veryfront/studio-bridge.js",
|
|
64
65
|
"/_vf/css/",
|
|
@@ -74,3 +75,13 @@ export function isLightweightPath(pathname: string): boolean {
|
|
|
74
75
|
export function isWebSocketPath(pathname: string): boolean {
|
|
75
76
|
return pathname === "/_ws";
|
|
76
77
|
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Requests that do not need render-specific enriched context.
|
|
81
|
+
*
|
|
82
|
+
* These routes still receive the normal handler context, but they can skip
|
|
83
|
+
* render cache prefix/content-source derivation and the enriched render payload.
|
|
84
|
+
*/
|
|
85
|
+
export function shouldSkipEnrichedContext(pathname: string): boolean {
|
|
86
|
+
return pathname.startsWith("/api/") || pathname.startsWith("/internal/agents/");
|
|
87
|
+
}
|
|
@@ -12,9 +12,11 @@ import { VeryfrontError } from "../../../errors/index.js";
|
|
|
12
12
|
import { getColorSchemeFromRequest } from "../../../security/http/client-hints.js";
|
|
13
13
|
import {
|
|
14
14
|
endRenderSession,
|
|
15
|
+
hasRenderSession,
|
|
15
16
|
startRenderSession,
|
|
16
17
|
} from "../../../transforms/mdx/esm-module-loader/module-fetcher/index.js";
|
|
17
18
|
import { getErrorCollector } from "../../../observability/error-collector.js";
|
|
19
|
+
import { profilePhase } from "../../../observability/request-profiler.js";
|
|
18
20
|
import { ErrorOverlay, parseErrorLocation } from "../../dev-server/error-overlay/index.js";
|
|
19
21
|
import { ErrorPages } from "../../utils/error-html.js";
|
|
20
22
|
import {
|
|
@@ -77,6 +79,7 @@ export interface SSRRenderOptions {
|
|
|
77
79
|
projectId?: string;
|
|
78
80
|
pageId?: string;
|
|
79
81
|
noHmr: boolean;
|
|
82
|
+
forceProductionScripts?: boolean;
|
|
80
83
|
useNoCache: boolean;
|
|
81
84
|
}
|
|
82
85
|
|
|
@@ -170,22 +173,28 @@ export class SSRService implements SSRServiceLike {
|
|
|
170
173
|
});
|
|
171
174
|
|
|
172
175
|
const renderStartTime = performance.now();
|
|
173
|
-
const result = await
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
176
|
+
const result = await profilePhase(
|
|
177
|
+
"ssr.render_page",
|
|
178
|
+
() =>
|
|
179
|
+
timeAsync("render-page", () =>
|
|
180
|
+
renderer.renderPage(slug, {
|
|
181
|
+
delivery: "stream",
|
|
182
|
+
request,
|
|
183
|
+
url,
|
|
184
|
+
nonce,
|
|
185
|
+
studioEmbed,
|
|
186
|
+
projectId,
|
|
187
|
+
pageId,
|
|
188
|
+
colorScheme,
|
|
189
|
+
colorSchemeFromParam,
|
|
190
|
+
colorSchemeFromHeader,
|
|
191
|
+
environment: ctx.requestContext?.mode,
|
|
192
|
+
projectSlug: ctx.projectSlug,
|
|
193
|
+
noHmr,
|
|
194
|
+
forceProductionScripts: options.forceProductionScripts,
|
|
195
|
+
renderSessionId,
|
|
196
|
+
})),
|
|
197
|
+
);
|
|
189
198
|
|
|
190
199
|
logger.debug("renderPage DONE", {
|
|
191
200
|
projectSlug: ctx.projectSlug,
|
|
@@ -195,7 +204,9 @@ export class SSRService implements SSRServiceLike {
|
|
|
195
204
|
hasStream: !!result.stream,
|
|
196
205
|
});
|
|
197
206
|
|
|
198
|
-
|
|
207
|
+
if (hasRenderSession(renderSessionId)) {
|
|
208
|
+
endRenderSession(renderSessionId);
|
|
209
|
+
}
|
|
199
210
|
|
|
200
211
|
const postRenderHeap = getHeapStats();
|
|
201
212
|
const heapGrowthMB = postRenderHeap.usedHeapSizeMB - preRenderHeap.usedHeapSizeMB;
|
|
@@ -225,7 +236,9 @@ export class SSRService implements SSRServiceLike {
|
|
|
225
236
|
slug,
|
|
226
237
|
};
|
|
227
238
|
} catch (error) {
|
|
228
|
-
|
|
239
|
+
if (hasRenderSession(renderSessionId)) {
|
|
240
|
+
endRenderSession(renderSessionId);
|
|
241
|
+
}
|
|
229
242
|
return this.handleRenderError(error, ctx, slug, request, nonce);
|
|
230
243
|
}
|
|
231
244
|
}
|