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
|
@@ -22,6 +22,24 @@ export interface ErrorLogEntry {
|
|
|
22
22
|
context?: Record<string, unknown>;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
function toContextRecord(value: unknown): Record<string, unknown> | undefined {
|
|
26
|
+
return value && typeof value === "object" && !Array.isArray(value)
|
|
27
|
+
? value as Record<string, unknown>
|
|
28
|
+
: undefined;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function mergeContext(
|
|
32
|
+
errorContext: unknown,
|
|
33
|
+
extraContext?: Record<string, unknown>,
|
|
34
|
+
): Record<string, unknown> | undefined {
|
|
35
|
+
const baseContext = toContextRecord(errorContext);
|
|
36
|
+
|
|
37
|
+
if (!baseContext) return extraContext;
|
|
38
|
+
if (!extraContext) return baseContext;
|
|
39
|
+
|
|
40
|
+
return { ...baseContext, ...extraContext };
|
|
41
|
+
}
|
|
42
|
+
|
|
25
43
|
/**
|
|
26
44
|
* Log a VeryfrontError with structured formatting
|
|
27
45
|
*
|
|
@@ -35,6 +53,7 @@ export function logError(
|
|
|
35
53
|
error: VeryfrontError,
|
|
36
54
|
context?: Record<string, unknown>,
|
|
37
55
|
): void {
|
|
56
|
+
const mergedContext = mergeContext(error.context, context);
|
|
38
57
|
const entry: ErrorLogEntry = {
|
|
39
58
|
level: "error",
|
|
40
59
|
slug: error.slug,
|
|
@@ -43,11 +62,9 @@ export function logError(
|
|
|
43
62
|
detail: error.detail,
|
|
44
63
|
suggestion: error.suggestion,
|
|
45
64
|
status: error.status,
|
|
46
|
-
docs:
|
|
65
|
+
docs: error.getDocsUrl(),
|
|
47
66
|
timestamp: new Date().toISOString(),
|
|
48
|
-
context:
|
|
49
|
-
? { ...(error.context as Record<string, unknown> ?? {}), ...context }
|
|
50
|
-
: error.context as Record<string, unknown> | undefined,
|
|
67
|
+
context: mergedContext,
|
|
51
68
|
};
|
|
52
69
|
|
|
53
70
|
if (isProduction()) {
|
|
@@ -64,9 +81,6 @@ export function logError(
|
|
|
64
81
|
serverLogger.error(` 💡 Suggestion: ${error.suggestion}`);
|
|
65
82
|
}
|
|
66
83
|
serverLogger.error(` 📚 Docs: ${entry.docs}`);
|
|
67
|
-
const mergedContext = context
|
|
68
|
-
? { ...(error.context as Record<string, unknown> ?? {}), ...context }
|
|
69
|
-
: error.context;
|
|
70
84
|
if (mergedContext) {
|
|
71
85
|
serverLogger.error(` Context: ${JSON.stringify(mergedContext, null, 2)}`);
|
|
72
86
|
}
|
|
@@ -5,31 +5,30 @@ import { identifyError } from "./error-identifier.js";
|
|
|
5
5
|
|
|
6
6
|
const errorColor = "\x1b[38;2;239;68;68m"; // Red
|
|
7
7
|
|
|
8
|
-
function
|
|
8
|
+
function buildSolutionDetailsLines(
|
|
9
|
+
solution: (typeof ERROR_SOLUTIONS)[string],
|
|
10
|
+
options?: {
|
|
11
|
+
exampleLabel?: string;
|
|
12
|
+
},
|
|
13
|
+
): string[] {
|
|
9
14
|
const lines: string[] = [];
|
|
10
15
|
|
|
11
|
-
if (solution.message) {
|
|
12
|
-
lines.push(yellow("Problem: ") + solution.message, "");
|
|
13
|
-
}
|
|
14
|
-
|
|
15
16
|
if (solution.steps?.length) {
|
|
16
|
-
lines.push(cyan("How to fix:"));
|
|
17
|
+
lines.push("", cyan("How to fix:"));
|
|
17
18
|
for (const [i, step] of solution.steps.entries()) {
|
|
18
19
|
lines.push(` ${dim(`${i + 1}.`)} ${step}`);
|
|
19
20
|
}
|
|
20
|
-
lines.push("");
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
if (solution.example) {
|
|
24
|
-
lines.push(cyan("Example:")
|
|
24
|
+
lines.push("", options?.exampleLabel ?? cyan("Example:"));
|
|
25
25
|
for (const line of solution.example.split("\n")) {
|
|
26
26
|
lines.push(` ${dim(line)}`);
|
|
27
27
|
}
|
|
28
|
-
lines.push("");
|
|
29
28
|
}
|
|
30
29
|
|
|
31
30
|
if (solution.docs) {
|
|
32
|
-
lines.push(dim("Learn more: ") + cyan(solution.docs)
|
|
31
|
+
lines.push("", dim("Learn more: ") + cyan(solution.docs));
|
|
33
32
|
}
|
|
34
33
|
|
|
35
34
|
return lines;
|
|
@@ -50,24 +49,7 @@ export function formatErrorBox(error: Error): string {
|
|
|
50
49
|
if (solution.message) {
|
|
51
50
|
content.push("", dim(solution.message));
|
|
52
51
|
}
|
|
53
|
-
|
|
54
|
-
if (solution.steps?.length) {
|
|
55
|
-
content.push("", cyan("How to fix:"));
|
|
56
|
-
for (const [i, step] of solution.steps.entries()) {
|
|
57
|
-
content.push(` ${dim(`${i + 1}.`)} ${step}`);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
if (solution.example) {
|
|
62
|
-
content.push("", dim("Example:"));
|
|
63
|
-
for (const line of solution.example.split("\n")) {
|
|
64
|
-
content.push(` ${dim(line)}`);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
if (solution.docs) {
|
|
69
|
-
content.push("", dim("Learn more: ") + cyan(solution.docs));
|
|
70
|
-
}
|
|
52
|
+
content.push(...buildSolutionDetailsLines(solution, { exampleLabel: dim("Example:") }));
|
|
71
53
|
}
|
|
72
54
|
|
|
73
55
|
return box(content.join("\n"), {
|
|
@@ -90,7 +72,10 @@ export function formatUserError(error: Error): string {
|
|
|
90
72
|
const solution = ERROR_SOLUTIONS[errorKey];
|
|
91
73
|
|
|
92
74
|
if (solution) {
|
|
93
|
-
|
|
75
|
+
if (solution.message) {
|
|
76
|
+
output.push(yellow("Problem: ") + solution.message);
|
|
77
|
+
}
|
|
78
|
+
output.push(...buildSolutionDetailsLines(solution), "");
|
|
94
79
|
return output.join("\n");
|
|
95
80
|
}
|
|
96
81
|
|
package/src/src/fs/index.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Public filesystem, path, and cwd utilities.
|
|
3
3
|
*
|
|
4
4
|
* @module fs
|
|
5
5
|
*
|
|
6
6
|
* @example File operations
|
|
7
7
|
* ```ts
|
|
8
|
-
* import {
|
|
8
|
+
* import { exists, mkdir, readTextFile, writeTextFile } from "veryfront/fs";
|
|
9
9
|
*
|
|
10
10
|
* const content = await readTextFile("./data/config.json");
|
|
11
11
|
* await writeTextFile("./output/result.json", JSON.stringify(data));
|
|
@@ -19,42 +19,33 @@
|
|
|
19
19
|
* const filePath = join("src", "pages", "index.tsx");
|
|
20
20
|
* const dir = dirname(filePath); // "src/pages"
|
|
21
21
|
* ```
|
|
22
|
+
*
|
|
23
|
+
* @example Working directory
|
|
24
|
+
* ```ts
|
|
25
|
+
* import { cwd, resolve } from "veryfront/fs";
|
|
26
|
+
*
|
|
27
|
+
* const configPath = resolve(cwd(), "veryfront.config.ts");
|
|
28
|
+
* ```
|
|
22
29
|
*/
|
|
23
|
-
|
|
24
|
-
// veryfront/fs — Filesystem operations + path utilities
|
|
25
|
-
//
|
|
26
|
-
// Slim public surface for file I/O, path manipulation, and
|
|
27
|
-
// project context (cwd). Re-exports from the platform compat layer.
|
|
28
|
-
|
|
29
|
-
// ---------------------------------------------------------------------------
|
|
30
|
-
// Filesystem
|
|
31
|
-
// ---------------------------------------------------------------------------
|
|
32
30
|
import "../../_dnt.polyfills.js";
|
|
33
31
|
|
|
34
32
|
|
|
35
|
-
export {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
// Path utilities
|
|
46
|
-
// ---------------------------------------------------------------------------
|
|
47
|
-
|
|
33
|
+
export {
|
|
34
|
+
createFileSystem,
|
|
35
|
+
exists,
|
|
36
|
+
type FileSystem,
|
|
37
|
+
mkdir,
|
|
38
|
+
readDir,
|
|
39
|
+
readTextFile,
|
|
40
|
+
remove,
|
|
41
|
+
writeTextFile,
|
|
42
|
+
} from "../platform/compat/fs.js";
|
|
48
43
|
export {
|
|
49
44
|
basename,
|
|
50
45
|
dirname,
|
|
51
46
|
extname,
|
|
52
47
|
join,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
// ---------------------------------------------------------------------------
|
|
57
|
-
// Project context
|
|
58
|
-
// ---------------------------------------------------------------------------
|
|
48
|
+
resolve,
|
|
49
|
+
} from "../platform/compat/path/index.js";
|
|
59
50
|
|
|
60
51
|
export { cwd } from "../platform/compat/process.js";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { buildNonceAttribute } from "./html-escape.js";
|
|
2
2
|
|
|
3
3
|
export function getPreviewStylesheetLink(): string {
|
|
4
4
|
return `<link id="vf-tailwind-css" rel="stylesheet" href="/_vf_styles/styles.css?t=${Date.now()}">`;
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
export function getDevStyles(nonce?: string): string {
|
|
8
|
-
const nonceAttr =
|
|
8
|
+
const nonceAttr = buildNonceAttribute(nonce);
|
|
9
9
|
|
|
10
10
|
return `
|
|
11
11
|
<style${nonceAttr}>
|
|
@@ -37,12 +37,8 @@ export function getDevStyles(nonce?: string): string {
|
|
|
37
37
|
</style>`;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
function getNonceAttr(nonce?: string): string {
|
|
41
|
-
return nonce ? ` nonce="${escapeHtml(nonce)}"` : "";
|
|
42
|
-
}
|
|
43
|
-
|
|
44
40
|
export function getDevScripts(_hmrPort?: number, nonce?: string): string {
|
|
45
|
-
const nonceAttr =
|
|
41
|
+
const nonceAttr = buildNonceAttribute(nonce);
|
|
46
42
|
|
|
47
43
|
return `
|
|
48
44
|
<script type="module" src="/_veryfront/rsc/client.js"${nonceAttr}></script>
|
|
@@ -50,7 +46,7 @@ export function getDevScripts(_hmrPort?: number, nonce?: string): string {
|
|
|
50
46
|
}
|
|
51
47
|
|
|
52
48
|
export function getProdScripts(slug: string, nonce?: string): string {
|
|
53
|
-
const nonceAttr =
|
|
49
|
+
const nonceAttr = buildNonceAttribute(nonce);
|
|
54
50
|
const encodedSlug = encodeURIComponent(slug);
|
|
55
51
|
|
|
56
52
|
return `
|
|
@@ -72,7 +68,7 @@ interface StudioScriptOptions {
|
|
|
72
68
|
}
|
|
73
69
|
|
|
74
70
|
export function getStudioScripts(options: StudioScriptOptions): string {
|
|
75
|
-
const nonceAttr =
|
|
71
|
+
const nonceAttr = buildNonceAttribute(options.nonce);
|
|
76
72
|
|
|
77
73
|
const bridgeConfig: Record<string, unknown> = {
|
|
78
74
|
projectId: options.projectId,
|
|
@@ -14,3 +14,7 @@ export function buildAttributes(attrs: Record<string, string>): string {
|
|
|
14
14
|
.map(([key, value]) => `${key}="${escapeHTML(value)}"`)
|
|
15
15
|
.join(" ");
|
|
16
16
|
}
|
|
17
|
+
|
|
18
|
+
export function buildNonceAttribute(nonce?: string): string {
|
|
19
|
+
return nonce ? ` nonce="${escapeHTML(nonce)}"` : "";
|
|
20
|
+
}
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
generateScriptTags,
|
|
8
8
|
generateStyleTags,
|
|
9
9
|
} from "./tag-generators.js";
|
|
10
|
-
import {
|
|
10
|
+
import { buildNonceAttribute } from "./html-escape.js";
|
|
11
11
|
import {
|
|
12
12
|
getDevScripts,
|
|
13
13
|
getDevStyles,
|
|
@@ -90,7 +90,7 @@ export function injectHTMLContent(
|
|
|
90
90
|
|
|
91
91
|
// Inject import map into <head> for ESM module resolution (must be before any module scripts)
|
|
92
92
|
if (options.importMapJson && /<\/head>/i.test(html)) {
|
|
93
|
-
const nonceAttr =
|
|
93
|
+
const nonceAttr = buildNonceAttribute(options.nonce);
|
|
94
94
|
const importMapTag =
|
|
95
95
|
`<script type="importmap"${nonceAttr}>\n${options.importMapJson}\n</script>`;
|
|
96
96
|
html = html.replace(/<\/head>/i, `${importMapTag}\n</head>`);
|
|
@@ -2,21 +2,27 @@ import type { ComponentProps, RenderMetadata } from "../types/index.js";
|
|
|
2
2
|
import { resolveRelativePath } from "../modules/react-loader/path-resolver.js";
|
|
3
3
|
import { withSpan } from "../observability/tracing/otlp-setup.js";
|
|
4
4
|
import { SpanNames } from "../observability/tracing/span-names.js";
|
|
5
|
+
import { profilePhase } from "../observability/request-profiler.js";
|
|
5
6
|
import { serverLogger } from "../utils/logger/logger.js";
|
|
6
7
|
import { isMarkdownPreview as checkMarkdownPreview } from "../transforms/md/utils.js";
|
|
7
8
|
import {
|
|
8
9
|
generateModulePreloadHintsFromManifest,
|
|
9
10
|
getRouteManifest,
|
|
10
11
|
} from "../modules/manifest/route-module-manifest.js";
|
|
11
|
-
import { escapeHTML } from "./html-escape.js";
|
|
12
|
+
import { buildNonceAttribute, escapeHTML } from "./html-escape.js";
|
|
12
13
|
import {
|
|
13
14
|
generateHydrationData,
|
|
14
15
|
getDevScripts,
|
|
15
16
|
getProdScripts,
|
|
17
|
+
PROD_HYDRATION_MODULE_PATH,
|
|
16
18
|
} from "./hydration-script-builder/index.js";
|
|
17
19
|
import { getPreviewStylesheetLink, getStudioScripts } from "./dev-scripts.js";
|
|
18
20
|
import { processMetadata } from "./metadata-builder.js";
|
|
19
|
-
import {
|
|
21
|
+
import {
|
|
22
|
+
extractCandidates,
|
|
23
|
+
getDevStyles as getErrorOverlayStyles,
|
|
24
|
+
getProjectCSS,
|
|
25
|
+
} from "./styles-builder/index.js";
|
|
20
26
|
import type { HTMLGenerationOptions } from "./types.js";
|
|
21
27
|
import { buildImportMapJson, buildRootAttributes, shouldDisableLayout } from "./utils.js";
|
|
22
28
|
|
|
@@ -43,6 +49,15 @@ function getRelativePagePath(
|
|
|
43
49
|
return resolveRelativePath(normalized, projectDir);
|
|
44
50
|
}
|
|
45
51
|
|
|
52
|
+
type ProjectCSSResult = Awaited<ReturnType<typeof getProjectCSS>> | null;
|
|
53
|
+
|
|
54
|
+
function resolveProjectCSSScope(
|
|
55
|
+
options: HTMLGenerationOptions,
|
|
56
|
+
metaSlug?: string,
|
|
57
|
+
): string {
|
|
58
|
+
return options.projectSlug || options.projectId || metaSlug || "default";
|
|
59
|
+
}
|
|
60
|
+
|
|
46
61
|
function generateModulePreloadHints(options: HTMLGenerationOptions): string {
|
|
47
62
|
const hints: string[] = [];
|
|
48
63
|
const addedUrls = new Set<string>();
|
|
@@ -75,7 +90,7 @@ function generateModulePreloadHints(options: HTMLGenerationOptions): string {
|
|
|
75
90
|
return hints.join("\n ");
|
|
76
91
|
}
|
|
77
92
|
|
|
78
|
-
const projectSlug = options.projectId;
|
|
93
|
+
const projectSlug = options.projectSlug ?? options.projectId;
|
|
79
94
|
const route = options.pagePath
|
|
80
95
|
? getRelativePagePath(options.pagePath, projectDir)
|
|
81
96
|
.replace(/\.(tsx|ts|jsx|mdx)$/, "")
|
|
@@ -102,10 +117,19 @@ export function generateHTMLShellParts(
|
|
|
102
117
|
params?: Record<string, string | string[]>,
|
|
103
118
|
props?: ComponentProps,
|
|
104
119
|
contentForTailwind?: string,
|
|
120
|
+
projectCSSPromise?: Promise<ProjectCSSResult>,
|
|
105
121
|
): Promise<{ start: string; end: string }> {
|
|
106
122
|
return withSpan(
|
|
107
123
|
SpanNames.HTML_GENERATE_SHELL_PARTS,
|
|
108
|
-
() =>
|
|
124
|
+
() =>
|
|
125
|
+
generateHTMLShellPartsImpl(
|
|
126
|
+
meta,
|
|
127
|
+
options,
|
|
128
|
+
params,
|
|
129
|
+
props,
|
|
130
|
+
contentForTailwind,
|
|
131
|
+
projectCSSPromise,
|
|
132
|
+
),
|
|
109
133
|
{
|
|
110
134
|
"html.slug": meta.slug || "",
|
|
111
135
|
"html.has_content": !!contentForTailwind,
|
|
@@ -121,6 +145,7 @@ async function generateHTMLShellPartsImpl(
|
|
|
121
145
|
params?: Record<string, string | string[]>,
|
|
122
146
|
props?: ComponentProps,
|
|
123
147
|
contentForTailwind?: string,
|
|
148
|
+
prefetchedProjectCSSPromise?: Promise<ProjectCSSResult>,
|
|
124
149
|
): Promise<{ start: string; end: string }> {
|
|
125
150
|
const stylesheetContent = options.globalCSS;
|
|
126
151
|
|
|
@@ -134,18 +159,15 @@ async function generateHTMLShellPartsImpl(
|
|
|
134
159
|
for (const cls of extractCandidates(contentForTailwind)) candidates.add(cls);
|
|
135
160
|
}
|
|
136
161
|
|
|
137
|
-
const projectSlug = options
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
});
|
|
147
|
-
cssHash = projectCSS.hash;
|
|
148
|
-
}
|
|
162
|
+
const projectSlug = resolveProjectCSSScope(options, meta.slug);
|
|
163
|
+
const projectCSSPromise = prefetchedProjectCSSPromise ??
|
|
164
|
+
(useProductionCSS && projectSlug !== "default"
|
|
165
|
+
? getProjectCSS(projectSlug, stylesheetContent, candidates, {
|
|
166
|
+
minify: true,
|
|
167
|
+
environment: options.environment,
|
|
168
|
+
buildMode: options.mode,
|
|
169
|
+
})
|
|
170
|
+
: Promise.resolve(null));
|
|
149
171
|
|
|
150
172
|
const {
|
|
151
173
|
effectiveTitle,
|
|
@@ -166,10 +188,18 @@ async function generateHTMLShellPartsImpl(
|
|
|
166
188
|
meta.ssrHash,
|
|
167
189
|
);
|
|
168
190
|
|
|
169
|
-
const
|
|
191
|
+
const skipDevHMR = isPreviewMode || options.noHmr;
|
|
192
|
+
// Error logger endpoint only enabled in local dev (returns 404 in preview/prod)
|
|
193
|
+
const skipErrorLogger = isPreviewMode;
|
|
194
|
+
// Enable dev scripts for local dev OR preview mode (for HMR support in Studio),
|
|
195
|
+
// unless a caller explicitly forces production client scripts for fair benchmarking.
|
|
196
|
+
const useDevScripts = !options.forceProductionScripts && (isLocalProject || isPreviewMode);
|
|
197
|
+
|
|
198
|
+
const importMapJsonPromise = buildImportMapJson({
|
|
170
199
|
projectDir: options.projectDir,
|
|
171
200
|
config: options.config,
|
|
172
201
|
customImports: options.importMap,
|
|
202
|
+
pretty: useDevScripts,
|
|
173
203
|
});
|
|
174
204
|
|
|
175
205
|
const hydrationDataJson = generateHydrationData(
|
|
@@ -177,16 +207,11 @@ async function generateHTMLShellPartsImpl(
|
|
|
177
207
|
params ?? {},
|
|
178
208
|
props ?? {},
|
|
179
209
|
options,
|
|
210
|
+
{ pretty: useDevScripts },
|
|
180
211
|
);
|
|
181
212
|
|
|
182
213
|
const nonce = options.nonce ?? "";
|
|
183
214
|
|
|
184
|
-
const skipDevHMR = isPreviewMode || options.noHmr;
|
|
185
|
-
// Error logger endpoint only enabled in local dev (returns 404 in preview/prod)
|
|
186
|
-
const skipErrorLogger = isPreviewMode;
|
|
187
|
-
// Enable dev scripts for local dev OR preview mode (for HMR support in Studio)
|
|
188
|
-
const useDevScripts = isLocalProject || isPreviewMode;
|
|
189
|
-
|
|
190
215
|
const modeScripts = useDevScripts
|
|
191
216
|
? getDevScripts(meta.slug || "", options.config, params, props, nonce, {
|
|
192
217
|
skipDevHMR,
|
|
@@ -194,9 +219,10 @@ async function generateHTMLShellPartsImpl(
|
|
|
194
219
|
})
|
|
195
220
|
: getProdScripts(meta.slug || "", params, props, nonce);
|
|
196
221
|
|
|
197
|
-
const modeStyles = useDevScripts ?
|
|
222
|
+
const modeStyles = useDevScripts ? getErrorOverlayStyles(nonce) : "";
|
|
198
223
|
|
|
199
224
|
const modulePreloadHints = generateModulePreloadHints(options);
|
|
225
|
+
const importMapJson = await profilePhase("html.import_map", () => importMapJsonPromise);
|
|
200
226
|
|
|
201
227
|
// Preload critical React dependencies to avoid waterfall delays.
|
|
202
228
|
// jsx-runtime is discovered late (only when modules execute), adding ~500ms latency.
|
|
@@ -205,8 +231,11 @@ async function generateHTMLShellPartsImpl(
|
|
|
205
231
|
const criticalDepsPreload = jsxRuntimeUrl
|
|
206
232
|
? `<link rel="modulepreload" href="${jsxRuntimeUrl}">`
|
|
207
233
|
: "";
|
|
234
|
+
const prodHydrationModulePreload = useDevScripts
|
|
235
|
+
? ""
|
|
236
|
+
: `<link rel="modulepreload" href="${PROD_HYDRATION_MODULE_PATH}">`;
|
|
208
237
|
|
|
209
|
-
const nonceAttr =
|
|
238
|
+
const nonceAttr = buildNonceAttribute(nonce);
|
|
210
239
|
|
|
211
240
|
// Expose project slug for runtime error overlay "Fix in Veryfront" button
|
|
212
241
|
const overlaySlug = options.projectId || meta.slug;
|
|
@@ -256,6 +285,8 @@ async function generateHTMLShellPartsImpl(
|
|
|
256
285
|
|
|
257
286
|
let tailwindCSSBlock = "";
|
|
258
287
|
if (useProductionCSS) {
|
|
288
|
+
const projectCSS = await profilePhase("html.project_css", () => projectCSSPromise);
|
|
289
|
+
const cssHash = projectCSS?.hash ?? "";
|
|
259
290
|
if (cssHash) {
|
|
260
291
|
tailwindCSSBlock = `<link rel="stylesheet" href="/_vf/css/${cssHash}.css">`;
|
|
261
292
|
} else {
|
|
@@ -300,6 +331,7 @@ async function generateHTMLShellPartsImpl(
|
|
|
300
331
|
<!-- Modulepreload hints for faster cold start -->
|
|
301
332
|
${modulePreloadHints}
|
|
302
333
|
${criticalDepsPreload}
|
|
334
|
+
${prodHydrationModulePreload}
|
|
303
335
|
|
|
304
336
|
<!-- Tailwind CSS: Server-side JIT compiled -->
|
|
305
337
|
${tailwindCSSBlock}
|
|
@@ -324,7 +356,7 @@ async function generateHTMLShellPartsImpl(
|
|
|
324
356
|
})
|
|
325
357
|
: "";
|
|
326
358
|
|
|
327
|
-
const previewHMRScript = isPreviewMode
|
|
359
|
+
const previewHMRScript = isPreviewMode && !options.forceProductionScripts
|
|
328
360
|
? `<script src="/_veryfront/preview-hmr.js"${nonceAttr}></script>`
|
|
329
361
|
: "";
|
|
330
362
|
|
|
@@ -371,6 +403,7 @@ export function wrapInHTMLShell(
|
|
|
371
403
|
options: HTMLGenerationOptions,
|
|
372
404
|
params?: Record<string, string | string[]>,
|
|
373
405
|
props?: ComponentProps,
|
|
406
|
+
projectCSSPromise?: Promise<ProjectCSSResult>,
|
|
374
407
|
): Promise<string> {
|
|
375
408
|
return withSpan(
|
|
376
409
|
SpanNames.HTML_WRAP_IN_SHELL,
|
|
@@ -382,6 +415,7 @@ export function wrapInHTMLShell(
|
|
|
382
415
|
params,
|
|
383
416
|
props,
|
|
384
417
|
cleanedContent,
|
|
418
|
+
projectCSSPromise,
|
|
385
419
|
);
|
|
386
420
|
return `${start}${cleanedContent}${end}`;
|
|
387
421
|
},
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { getLoaderScript, getRendererScript, getRouterScript } from "./templates/index.js";
|
|
2
|
-
import {
|
|
2
|
+
import { buildNonceAttribute } from "../html-escape.js";
|
|
3
3
|
|
|
4
4
|
export function generateDevClientRendererScript(nonce?: string): string {
|
|
5
|
-
const nonceAttr =
|
|
5
|
+
const nonceAttr = buildNonceAttribute(nonce);
|
|
6
6
|
|
|
7
7
|
return `
|
|
8
8
|
<script type="module"${nonceAttr}>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { VeryfrontConfig } from "../../config/index.js";
|
|
2
|
-
import {
|
|
2
|
+
import { buildNonceAttribute } from "../html-escape.js";
|
|
3
3
|
|
|
4
4
|
export function generateDevComponentManifestScript(
|
|
5
5
|
config: VeryfrontConfig,
|
|
6
6
|
nonce?: string,
|
|
7
7
|
): string {
|
|
8
|
-
const nonceAttr =
|
|
8
|
+
const nonceAttr = buildNonceAttribute(nonce);
|
|
9
9
|
const components = config.dev?.components ?? [];
|
|
10
10
|
|
|
11
11
|
return `
|
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
function getOpenScriptTag(nonce?: string): string {
|
|
4
|
-
return nonce ? `<script nonce="${escapeHtml(nonce)}">` : "<script>";
|
|
5
|
-
}
|
|
1
|
+
import { buildNonceAttribute } from "../html-escape.js";
|
|
6
2
|
|
|
7
3
|
export function generateDevErrorLoggerScript(nonce?: string): string {
|
|
8
|
-
const openScriptTag = getOpenScriptTag(nonce);
|
|
9
|
-
|
|
10
4
|
return `
|
|
11
5
|
<!-- Client-side error logger -->
|
|
12
|
-
${
|
|
6
|
+
<script${buildNonceAttribute(nonce)}>
|
|
13
7
|
(function() {
|
|
14
8
|
const logToServer = (level, message, details) => {
|
|
15
9
|
try {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ComponentProps } from "../../types/index.js";
|
|
2
2
|
import type { VeryfrontConfig } from "../../config/index.js";
|
|
3
|
-
import {
|
|
3
|
+
import { buildNonceAttribute } from "../html-escape.js";
|
|
4
4
|
import { generateDevErrorLoggerScript } from "./dev-error-logger.js";
|
|
5
5
|
import { generateDevComponentManifestScript } from "./dev-component-manifest.js";
|
|
6
6
|
import { generateDevClientRendererScript } from "./dev-client-renderer.js";
|
|
@@ -13,7 +13,7 @@ function generateHMRScript(
|
|
|
13
13
|
// Skip dev HMR script when preview-hmr.js will be used instead
|
|
14
14
|
if (skipDevHMR || !config.dev?.hmr) return "";
|
|
15
15
|
|
|
16
|
-
const nonceAttr =
|
|
16
|
+
const nonceAttr = buildNonceAttribute(nonce);
|
|
17
17
|
return `<script type="module" src="/_veryfront/hmr.js"${nonceAttr}></script>`;
|
|
18
18
|
}
|
|
19
19
|
|
|
@@ -32,6 +32,7 @@ export function generateHydrationData(
|
|
|
32
32
|
params: Record<string, string | string[]>,
|
|
33
33
|
props: ComponentProps,
|
|
34
34
|
options: HTMLGenerationOptions,
|
|
35
|
+
serializeOptions?: { pretty?: boolean },
|
|
35
36
|
): string {
|
|
36
37
|
const layouts = (options.nestedLayouts ?? [])
|
|
37
38
|
.map((layout) => {
|
|
@@ -74,5 +75,5 @@ export function generateHydrationData(
|
|
|
74
75
|
studioEmbed: options.studioEmbed,
|
|
75
76
|
};
|
|
76
77
|
|
|
77
|
-
return JSON.stringify(data, null, 2);
|
|
78
|
+
return JSON.stringify(data, null, serializeOptions?.pretty ?? true ? 2 : undefined);
|
|
78
79
|
}
|
|
@@ -13,5 +13,9 @@ export { generateDevErrorLoggerScript } from "./dev-error-logger.js";
|
|
|
13
13
|
export { generateDevComponentManifestScript } from "./dev-component-manifest.js";
|
|
14
14
|
export { generateDevClientRendererScript } from "./dev-client-renderer.js";
|
|
15
15
|
|
|
16
|
-
export {
|
|
16
|
+
export {
|
|
17
|
+
generateProdHydrationModule,
|
|
18
|
+
getProdScripts,
|
|
19
|
+
PROD_HYDRATION_MODULE_PATH,
|
|
20
|
+
} from "./prod-scripts.js";
|
|
17
21
|
export { generateProdHydrationScript } from "./prod-hydration.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ComponentProps } from "../../types/index.js";
|
|
2
|
-
import {
|
|
2
|
+
import { buildNonceAttribute } from "../html-escape.js";
|
|
3
3
|
|
|
4
4
|
export function generateProdHydrationScript(
|
|
5
5
|
slug: string,
|
|
@@ -7,7 +7,7 @@ export function generateProdHydrationScript(
|
|
|
7
7
|
props?: ComponentProps,
|
|
8
8
|
nonce?: string,
|
|
9
9
|
): string {
|
|
10
|
-
const nonceAttr =
|
|
10
|
+
const nonceAttr = buildNonceAttribute(nonce);
|
|
11
11
|
const pageProps = JSON.stringify(props ?? {});
|
|
12
12
|
|
|
13
13
|
return `
|
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
import { getLoaderScript, getRendererScript, getRouterScript } from "./templates/index.js";
|
|
2
|
-
import {
|
|
2
|
+
import { buildNonceAttribute } from "../html-escape.js";
|
|
3
|
+
|
|
4
|
+
export const PROD_HYDRATION_MODULE_PATH = "/_veryfront/hydration-runtime.js";
|
|
5
|
+
|
|
6
|
+
export function generateProdHydrationModule(): string {
|
|
7
|
+
return [
|
|
8
|
+
`import * as React from 'react';`,
|
|
9
|
+
`import { RouterProvider, useRouter as useRouterFromModule } from 'veryfront/router';`,
|
|
10
|
+
`import { PageContextProvider } from 'veryfront/context';`,
|
|
11
|
+
getRouterScript().trim(),
|
|
12
|
+
getLoaderScript().trim(),
|
|
13
|
+
getRendererScript().trim(),
|
|
14
|
+
].join("\n\n");
|
|
15
|
+
}
|
|
3
16
|
|
|
4
17
|
export function getProdScripts(
|
|
5
18
|
_slug: string,
|
|
@@ -7,18 +20,6 @@ export function getProdScripts(
|
|
|
7
20
|
_props?: Record<string, unknown>,
|
|
8
21
|
nonce?: string,
|
|
9
22
|
): string {
|
|
10
|
-
const nonceAttr =
|
|
11
|
-
|
|
12
|
-
return `
|
|
13
|
-
<script type="module"${nonceAttr}>
|
|
14
|
-
import * as React from 'react';
|
|
15
|
-
import { RouterProvider, useRouter as useRouterFromModule } from 'veryfront/router';
|
|
16
|
-
import { PageContextProvider } from 'veryfront/context';
|
|
17
|
-
|
|
18
|
-
${getRouterScript()}
|
|
19
|
-
|
|
20
|
-
${getLoaderScript()}
|
|
21
|
-
|
|
22
|
-
${getRendererScript()}
|
|
23
|
-
</script>`;
|
|
23
|
+
const nonceAttr = buildNonceAttribute(nonce);
|
|
24
|
+
return `\n <script type="module" src="${PROD_HYDRATION_MODULE_PATH}"${nonceAttr}></script>`;
|
|
24
25
|
}
|
|
@@ -30,6 +30,7 @@ export const HTMLGenerationOptionsSchema = z.object({
|
|
|
30
30
|
layoutProps: z.record(z.string(), z.record(z.string(), z.unknown())).optional(),
|
|
31
31
|
studioEmbed: z.boolean().optional(),
|
|
32
32
|
projectId: z.string().optional(),
|
|
33
|
+
projectSlug: z.string().optional(),
|
|
33
34
|
pageId: z.string().optional(),
|
|
34
35
|
sourceHash: z.string().optional(),
|
|
35
36
|
colorScheme: colorSchemeSchema.optional(),
|
|
@@ -48,6 +49,7 @@ export const HTMLGenerationOptionsSchema = z.object({
|
|
|
48
49
|
projectClasses: z.set(z.string()).optional(),
|
|
49
50
|
isLocalProject: z.boolean().optional(),
|
|
50
51
|
noHmr: z.boolean().optional(),
|
|
52
|
+
forceProductionScripts: z.boolean().optional(),
|
|
51
53
|
});
|
|
52
54
|
|
|
53
55
|
export const HydrationDataSchema = z.object({
|