veryfront 0.0.86 → 0.0.88
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/deno.d.ts +0 -1
- package/esm/deno.js +8 -9
- package/esm/deps/esm.sh/react-dom@19.1.1/client.d.ts +2 -0
- package/esm/deps/esm.sh/react-dom@19.1.1/client.d.ts.map +1 -0
- package/esm/deps/esm.sh/react-dom@19.1.1/client.js +5 -0
- package/esm/deps/esm.sh/react-dom@19.1.1/server.d.ts +2 -0
- package/esm/deps/esm.sh/react-dom@19.1.1/server.d.ts.map +1 -0
- package/esm/deps/esm.sh/react-dom@19.1.1/server.js +5 -0
- package/esm/deps/esm.sh/react@19.1.1/jsx-runtime.d.ts +2 -0
- package/esm/deps/esm.sh/react@19.1.1/jsx-runtime.d.ts.map +1 -0
- package/esm/deps/esm.sh/react@19.1.1/jsx-runtime.js +3 -0
- package/esm/deps/esm.sh/react@19.1.1.d.ts +2 -0
- package/esm/deps/esm.sh/react@19.1.1.d.ts.map +1 -0
- package/esm/deps/esm.sh/react@19.1.1.js +3 -0
- package/esm/deps/esm.sh/scheduler@^0.26.0.d.ts +2 -0
- package/esm/deps/esm.sh/scheduler@^0.26.0.d.ts.map +1 -0
- package/esm/deps/esm.sh/scheduler@^0.26.0.js +3 -0
- package/esm/proxy/main.d.ts +2 -0
- package/esm/proxy/main.d.ts.map +1 -0
- package/esm/proxy/main.js +400 -0
- package/esm/src/agent/react/use-agent.js +1 -1
- package/esm/src/agent/react/use-chat/use-chat.js +1 -1
- package/esm/src/agent/react/use-completion.js +1 -1
- package/esm/src/agent/react/use-streaming.js +1 -1
- package/esm/src/agent/react/use-voice-input.js +1 -1
- package/esm/src/cli/commands/init/config-generator.js +1 -1
- package/esm/src/cli/index/arg-parser.d.ts.map +1 -1
- package/esm/src/cli/index/arg-parser.js +1 -0
- package/esm/src/cli/index/command-router.d.ts.map +1 -1
- package/esm/src/cli/index/command-router.js +54 -39
- package/esm/src/cli/index/types.d.ts +4 -0
- package/esm/src/cli/index/types.d.ts.map +1 -1
- package/esm/src/cli/mcp/advanced-tools.d.ts +2 -2
- package/esm/src/config/loader.d.ts.map +1 -1
- package/esm/src/config/loader.js +5 -4
- package/esm/src/html/utils.js +2 -2
- package/esm/src/modules/component-registry/registry.d.ts +1 -1
- package/esm/src/modules/component-registry/registry.d.ts.map +1 -1
- package/esm/src/modules/import-map/default-import-map.d.ts +1 -11
- package/esm/src/modules/import-map/default-import-map.d.ts.map +1 -1
- package/esm/src/modules/import-map/default-import-map.js +3 -20
- package/esm/src/modules/import-map/loader.d.ts.map +1 -1
- package/esm/src/modules/import-map/loader.js +7 -22
- package/esm/src/modules/import-map/resolver.d.ts.map +1 -1
- package/esm/src/modules/import-map/resolver.js +12 -8
- package/esm/src/modules/react-loader/component-loader.d.ts +1 -1
- package/esm/src/modules/react-loader/component-loader.d.ts.map +1 -1
- package/esm/src/modules/react-loader/component-loader.js +2 -0
- package/esm/src/modules/react-loader/extract-component.d.ts +1 -1
- package/esm/src/modules/react-loader/extract-component.d.ts.map +1 -1
- package/esm/src/modules/react-loader/ssr-module-loader/loader.d.ts +2 -7
- package/esm/src/modules/react-loader/ssr-module-loader/loader.d.ts.map +1 -1
- package/esm/src/modules/react-loader/ssr-module-loader/loader.js +40 -32
- package/esm/src/modules/react-loader/ssr-module-loader/types.d.ts +2 -0
- package/esm/src/modules/react-loader/ssr-module-loader/types.d.ts.map +1 -1
- package/esm/src/modules/react-loader/types.d.ts +3 -1
- package/esm/src/modules/react-loader/types.d.ts.map +1 -1
- package/esm/src/modules/react-loader/unified-loader.d.ts.map +1 -1
- package/esm/src/modules/react-loader/unified-loader.js +7 -4
- package/esm/src/modules/server/module-batch-handler.d.ts +2 -0
- package/esm/src/modules/server/module-batch-handler.d.ts.map +1 -1
- package/esm/src/modules/server/module-batch-handler.js +3 -1
- package/esm/src/modules/server/module-server.d.ts +2 -0
- package/esm/src/modules/server/module-server.d.ts.map +1 -1
- package/esm/src/modules/server/module-server.js +4 -2
- package/esm/src/modules/server/ssr-import-rewriter.d.ts.map +1 -1
- package/esm/src/modules/server/ssr-import-rewriter.js +9 -17
- package/esm/src/react/compat/hooks-adapter.d.ts +1 -1
- package/esm/src/react/compat/hooks-adapter.d.ts.map +1 -1
- package/esm/src/react/compat/hooks-adapter.js +1 -1
- package/esm/src/react/compat/ssr-adapter/response-builder.d.ts +1 -1
- package/esm/src/react/compat/ssr-adapter/response-builder.d.ts.map +1 -1
- package/esm/src/react/compat/ssr-adapter/server-loader.d.ts +5 -5
- package/esm/src/react/compat/ssr-adapter/server-loader.d.ts.map +1 -1
- package/esm/src/react/compat/ssr-adapter/server-loader.js +2 -2
- package/esm/src/react/compat/ssr-adapter/stream-renderer.d.ts +1 -1
- package/esm/src/react/compat/ssr-adapter/stream-renderer.d.ts.map +1 -1
- package/esm/src/react/compat/ssr-adapter/string-renderer.d.ts +1 -1
- package/esm/src/react/compat/ssr-adapter/string-renderer.d.ts.map +1 -1
- package/esm/src/react/compat/ssr-adapter/string-renderer.js +1 -1
- package/esm/src/react/compat/version-detector/feature-detector.js +1 -1
- package/esm/src/react/components/AppWrapper.d.ts +1 -1
- package/esm/src/react/components/AppWrapper.d.ts.map +1 -1
- package/esm/src/react/components/AppWrapper.js +1 -1
- package/esm/src/react/components/Head.d.ts +1 -1
- package/esm/src/react/components/Head.d.ts.map +1 -1
- package/esm/src/react/components/Head.js +7 -3
- package/esm/src/react/components/LayoutComponent.d.ts +1 -1
- package/esm/src/react/components/LayoutComponent.d.ts.map +1 -1
- package/esm/src/react/components/LayoutComponent.js +1 -1
- package/esm/src/react/components/Link.d.ts +1 -1
- package/esm/src/react/components/Link.d.ts.map +1 -1
- package/esm/src/react/components/Link.js +1 -1
- package/esm/src/react/components/MDXProvider.d.ts +1 -1
- package/esm/src/react/components/MDXProvider.d.ts.map +1 -1
- package/esm/src/react/components/MDXProvider.js +2 -2
- package/esm/src/react/components/ProviderComponent.d.ts +1 -1
- package/esm/src/react/components/ProviderComponent.d.ts.map +1 -1
- package/esm/src/react/components/ProviderComponent.js +1 -1
- package/esm/src/react/components/ai/agent-card.d.ts +2 -2
- package/esm/src/react/components/ai/agent-card.d.ts.map +1 -1
- package/esm/src/react/components/ai/agent-card.js +1 -1
- package/esm/src/react/components/ai/chat/components/animations.d.ts +1 -1
- package/esm/src/react/components/ai/chat/components/animations.d.ts.map +1 -1
- package/esm/src/react/components/ai/chat/components/animations.js +1 -1
- package/esm/src/react/components/ai/chat/components/empty-state.d.ts +1 -1
- package/esm/src/react/components/ai/chat/components/empty-state.d.ts.map +1 -1
- package/esm/src/react/components/ai/chat/components/empty-state.js +1 -1
- package/esm/src/react/components/ai/chat/components/message-actions.d.ts +1 -1
- package/esm/src/react/components/ai/chat/components/message-actions.d.ts.map +1 -1
- package/esm/src/react/components/ai/chat/components/message-actions.js +1 -1
- package/esm/src/react/components/ai/chat/components/reasoning.d.ts +1 -1
- package/esm/src/react/components/ai/chat/components/reasoning.d.ts.map +1 -1
- package/esm/src/react/components/ai/chat/components/reasoning.js +1 -1
- package/esm/src/react/components/ai/chat/components/tool-ui.d.ts +1 -1
- package/esm/src/react/components/ai/chat/components/tool-ui.d.ts.map +1 -1
- package/esm/src/react/components/ai/chat/components/tool-ui.js +1 -1
- package/esm/src/react/components/ai/chat/composition/api.d.ts +5 -4
- package/esm/src/react/components/ai/chat/composition/api.d.ts.map +1 -1
- package/esm/src/react/components/ai/chat/composition/api.js +1 -1
- package/esm/src/react/components/ai/chat/index.d.ts +8 -3
- package/esm/src/react/components/ai/chat/index.d.ts.map +1 -1
- package/esm/src/react/components/ai/chat/index.js +1 -1
- package/esm/src/react/components/ai/error-boundary.d.ts +1 -1
- package/esm/src/react/components/ai/error-boundary.d.ts.map +1 -1
- package/esm/src/react/components/ai/error-boundary.js +1 -1
- package/esm/src/react/components/ai/icons/index.d.ts +1 -1
- package/esm/src/react/components/ai/icons/index.d.ts.map +1 -1
- package/esm/src/react/components/ai/icons/index.js +1 -1
- package/esm/src/react/components/ai/markdown.d.ts +1 -1
- package/esm/src/react/components/ai/markdown.d.ts.map +1 -1
- package/esm/src/react/components/ai/markdown.js +1 -1
- package/esm/src/react/components/ai/message.d.ts +3 -3
- package/esm/src/react/components/ai/message.d.ts.map +1 -1
- package/esm/src/react/components/ai/message.js +1 -1
- package/esm/src/react/components/optimized-image/OptimizedBackgroundImage.d.ts +1 -1
- package/esm/src/react/components/optimized-image/OptimizedBackgroundImage.d.ts.map +1 -1
- package/esm/src/react/components/optimized-image/OptimizedBackgroundImage.js +1 -1
- package/esm/src/react/components/optimized-image/OptimizedImage.d.ts +1 -1
- package/esm/src/react/components/optimized-image/OptimizedImage.d.ts.map +1 -1
- package/esm/src/react/components/optimized-image/OptimizedImage.js +1 -1
- package/esm/src/react/components/optimized-image/SimpleOptimizedImage.d.ts +1 -1
- package/esm/src/react/components/optimized-image/SimpleOptimizedImage.d.ts.map +1 -1
- package/esm/src/react/components/optimized-image/utils.d.ts +1 -1
- package/esm/src/react/components/optimized-image/utils.d.ts.map +1 -1
- package/esm/src/react/components/optimized-image/utils.js +1 -1
- package/esm/src/react/context/index.d.ts +1 -1
- package/esm/src/react/context/index.d.ts.map +1 -1
- package/esm/src/react/context/index.js +1 -1
- package/esm/src/react/fonts/index.d.ts +1 -1
- package/esm/src/react/fonts/index.d.ts.map +1 -1
- package/esm/src/react/fonts/index.js +1 -1
- package/esm/src/react/primitives/agent-primitives.d.ts +4 -4
- package/esm/src/react/primitives/agent-primitives.d.ts.map +1 -1
- package/esm/src/react/primitives/agent-primitives.js +1 -1
- package/esm/src/react/primitives/chat-container.d.ts +2 -2
- package/esm/src/react/primitives/chat-container.d.ts.map +1 -1
- package/esm/src/react/primitives/chat-container.js +1 -1
- package/esm/src/react/primitives/input-box.d.ts +4 -4
- package/esm/src/react/primitives/input-box.d.ts.map +1 -1
- package/esm/src/react/primitives/input-box.js +7 -3
- package/esm/src/react/primitives/message-list.d.ts +5 -5
- package/esm/src/react/primitives/message-list.d.ts.map +1 -1
- package/esm/src/react/primitives/message-list.js +1 -1
- package/esm/src/react/primitives/tool-primitives.d.ts +4 -4
- package/esm/src/react/primitives/tool-primitives.d.ts.map +1 -1
- package/esm/src/react/primitives/tool-primitives.js +1 -1
- package/esm/src/react/router/index.d.ts +1 -1
- package/esm/src/react/router/index.d.ts.map +1 -1
- package/esm/src/react/router/index.js +1 -1
- package/esm/src/rendering/app-reserved.d.ts +1 -1
- package/esm/src/rendering/app-reserved.d.ts.map +1 -1
- package/esm/src/rendering/app-reserved.js +1 -1
- package/esm/src/rendering/client/router.js +1 -1
- package/esm/src/rendering/client/state-bridge.d.ts +1 -1
- package/esm/src/rendering/client/state-bridge.d.ts.map +1 -1
- package/esm/src/rendering/client/state-bridge.js +1 -1
- package/esm/src/rendering/component-handling.d.ts +3 -1
- package/esm/src/rendering/component-handling.d.ts.map +1 -1
- package/esm/src/rendering/component-handling.js +4 -2
- package/esm/src/rendering/element-validator/element-normalizer.d.ts +1 -1
- package/esm/src/rendering/element-validator/element-normalizer.d.ts.map +1 -1
- package/esm/src/rendering/element-validator/element-normalizer.js +1 -1
- package/esm/src/rendering/element-validator/primitive-checks.d.ts +1 -1
- package/esm/src/rendering/element-validator/primitive-checks.d.ts.map +1 -1
- package/esm/src/rendering/element-validator/primitive-checks.js +1 -1
- package/esm/src/rendering/element-validator/validator-core.d.ts +1 -1
- package/esm/src/rendering/element-validator/validator-core.d.ts.map +1 -1
- package/esm/src/rendering/layouts/layout-applicator.d.ts +1 -1
- package/esm/src/rendering/layouts/layout-applicator.d.ts.map +1 -1
- package/esm/src/rendering/layouts/layout-applicator.js +2 -0
- package/esm/src/rendering/layouts/utils/applicator.d.ts +1 -1
- package/esm/src/rendering/layouts/utils/applicator.d.ts.map +1 -1
- package/esm/src/rendering/layouts/utils/component-loader.d.ts +1 -1
- package/esm/src/rendering/layouts/utils/component-loader.d.ts.map +1 -1
- package/esm/src/rendering/layouts/utils/ensure-valid-child.d.ts +1 -1
- package/esm/src/rendering/layouts/utils/ensure-valid-child.d.ts.map +1 -1
- package/esm/src/rendering/orchestrator/layout.d.ts +1 -1
- package/esm/src/rendering/orchestrator/layout.d.ts.map +1 -1
- package/esm/src/rendering/orchestrator/module-loader/index.d.ts +3 -0
- package/esm/src/rendering/orchestrator/module-loader/index.d.ts.map +1 -1
- package/esm/src/rendering/orchestrator/module-loader/index.js +74 -19
- package/esm/src/rendering/orchestrator/pipeline.d.ts.map +1 -1
- package/esm/src/rendering/orchestrator/pipeline.js +2 -0
- package/esm/src/rendering/orchestrator/ssr-orchestrator.d.ts +1 -1
- package/esm/src/rendering/orchestrator/ssr-orchestrator.d.ts.map +1 -1
- package/esm/src/rendering/page-renderer.d.ts +1 -1
- package/esm/src/rendering/page-renderer.d.ts.map +1 -1
- package/esm/src/rendering/page-rendering.d.ts +1 -1
- package/esm/src/rendering/page-rendering.d.ts.map +1 -1
- package/esm/src/rendering/rsc/server-renderer/component-detector.d.ts +1 -1
- package/esm/src/rendering/rsc/server-renderer/component-detector.d.ts.map +1 -1
- package/esm/src/rendering/rsc/server-renderer/rsc-renderer.d.ts +1 -1
- package/esm/src/rendering/rsc/server-renderer/rsc-renderer.d.ts.map +1 -1
- package/esm/src/rendering/rsc/server-renderer/tree-processor.d.ts +1 -1
- package/esm/src/rendering/rsc/server-renderer/tree-processor.d.ts.map +1 -1
- package/esm/src/rendering/rsc/server-renderer/tree-processor.js +4 -2
- package/esm/src/rendering/snippet-renderer.js +2 -2
- package/esm/src/rendering/ssr/component-registry.d.ts +1 -1
- package/esm/src/rendering/ssr/component-registry.d.ts.map +1 -1
- package/esm/src/rendering/ssr/component-registry.js +1 -1
- package/esm/src/rendering/ssr-renderer.d.ts +1 -1
- package/esm/src/rendering/ssr-renderer.d.ts.map +1 -1
- package/esm/src/rendering/utils/react-helpers.d.ts +1 -1
- package/esm/src/rendering/utils/react-helpers.d.ts.map +1 -1
- package/esm/src/rendering/utils/react-helpers.js +1 -1
- package/esm/src/server/handlers/request/ssr/error-page-fallback.js +1 -1
- package/esm/src/server/handlers/request/ssr/not-found-fallback.js +1 -1
- package/esm/src/transforms/esm/http-bundler.d.ts +15 -4
- package/esm/src/transforms/esm/http-bundler.d.ts.map +1 -1
- package/esm/src/transforms/esm/http-bundler.js +105 -12
- package/esm/src/transforms/esm/http-cache.d.ts.map +1 -1
- package/esm/src/transforms/esm/http-cache.js +26 -27
- package/esm/src/transforms/esm/import-rewriter.d.ts.map +1 -1
- package/esm/src/transforms/esm/import-rewriter.js +3 -3
- package/esm/src/transforms/esm/package-registry.d.ts +15 -13
- package/esm/src/transforms/esm/package-registry.d.ts.map +1 -1
- package/esm/src/transforms/esm/package-registry.js +45 -32
- package/esm/src/transforms/esm/react-imports.d.ts.map +1 -1
- package/esm/src/transforms/esm/react-imports.js +3 -7
- package/esm/src/transforms/esm/types.d.ts +2 -0
- package/esm/src/transforms/esm/types.d.ts.map +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/cache/index.d.ts +14 -0
- package/esm/src/transforms/mdx/esm-module-loader/cache/index.d.ts.map +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/cache/index.js +67 -0
- package/esm/src/transforms/mdx/esm-module-loader/loader.d.ts.map +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/loader.js +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/index.d.ts +1 -0
- 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 -0
- package/esm/src/transforms/mdx/esm-module-loader/types.d.ts +4 -0
- package/esm/src/transforms/mdx/esm-module-loader/types.d.ts.map +1 -1
- package/esm/src/transforms/mdx/index.d.ts +1 -1
- package/esm/src/transforms/mdx/index.d.ts.map +1 -1
- package/esm/src/transforms/mdx/index.js +1 -1
- package/esm/src/transforms/mdx/mdx-cache-adapter.js +1 -1
- package/esm/src/transforms/mdx/module-loader/types.d.ts +1 -1
- package/esm/src/transforms/mdx/module-loader/types.d.ts.map +1 -1
- package/esm/src/transforms/mdx/types.d.ts +2 -2
- package/esm/src/transforms/mdx/types.d.ts.map +1 -1
- package/esm/src/transforms/pipeline/context.d.ts.map +1 -1
- package/esm/src/transforms/pipeline/context.js +7 -15
- package/esm/src/transforms/pipeline/stages/finalize.d.ts.map +1 -1
- package/esm/src/transforms/pipeline/stages/finalize.js +1 -1
- package/esm/src/types/app.d.ts +1 -1
- package/esm/src/types/app.d.ts.map +1 -1
- package/esm/src/types/global-guards.d.ts +1 -1
- package/esm/src/types/global-guards.d.ts.map +1 -1
- package/esm/src/types/index.d.ts +1 -1
- package/esm/src/types/index.d.ts.map +1 -1
- package/esm/src/utils/constants/cdn.d.ts.map +1 -1
- package/esm/src/utils/constants/cdn.js +22 -11
- package/esm/src/utils/hash-utils.d.ts +2 -0
- package/esm/src/utils/hash-utils.d.ts.map +1 -1
- package/esm/src/utils/hash-utils.js +4 -0
- package/esm/src/workflow/react/use-approval.js +1 -1
- package/esm/src/workflow/react/use-workflow-list.js +1 -1
- package/esm/src/workflow/react/use-workflow-start.js +1 -1
- package/esm/src/workflow/react/use-workflow.js +1 -1
- package/package.json +2 -1
- package/src/deno.js +8 -9
- package/src/deps/esm.sh/@types/react-dom@19.1.11/X-ZGNzc3R5cGVAMy4yLjMKZXJlYWN0/client.d.ts +105 -0
- package/src/deps/esm.sh/@types/react-dom@19.1.11/X-ZGNzc3R5cGVAMy4yLjMKZXJlYWN0/server.d.ts +162 -0
- package/src/deps/esm.sh/@types/react@19.1.17/X-ZGNzc3R5cGVAMy4yLjM/global.d.ts +165 -0
- package/src/deps/esm.sh/@types/react@19.1.17/X-ZGNzc3R5cGVAMy4yLjM/index.d.ts +4267 -0
- package/src/deps/esm.sh/@types/react@19.1.17/X-ZGNzc3R5cGVAMy4yLjMKZXJlYWN0/global.d.ts +165 -0
- package/src/deps/esm.sh/@types/react@19.1.17/X-ZGNzc3R5cGVAMy4yLjMKZXJlYWN0/index.d.ts +4267 -0
- package/src/deps/esm.sh/@types/react@19.1.17/X-ZGNzc3R5cGVAMy4yLjMKZXJlYWN0/jsx-runtime.d.ts +36 -0
- package/src/deps/esm.sh/@types/scheduler@0.26.0/index.d.ts +30 -0
- package/src/deps/esm.sh/csstype@3.2.3/index.d.ts +22569 -0
- package/src/deps/esm.sh/react-dom@19.1.1/client.d.ts +105 -0
- package/src/deps/esm.sh/react-dom@19.1.1/client.js +5 -0
- package/src/deps/esm.sh/react-dom@19.1.1/server.d.ts +162 -0
- package/src/deps/esm.sh/react-dom@19.1.1/server.js +5 -0
- package/src/deps/esm.sh/react@19.1.1/jsx-runtime.d.ts +36 -0
- package/src/deps/esm.sh/react@19.1.1/jsx-runtime.js +3 -0
- package/src/deps/esm.sh/react@19.1.1.d.ts +4267 -0
- package/src/deps/esm.sh/react@19.1.1.js +3 -0
- package/src/deps/esm.sh/scheduler@^0.26.0.d.ts +30 -0
- package/src/deps/esm.sh/scheduler@^0.26.0.js +3 -0
- package/src/proxy/main.ts +471 -0
- package/src/src/agent/react/use-agent.ts +1 -1
- package/src/src/agent/react/use-chat/use-chat.ts +1 -1
- package/src/src/agent/react/use-completion.ts +1 -1
- package/src/src/agent/react/use-streaming.ts +1 -1
- package/src/src/agent/react/use-voice-input.ts +1 -1
- package/src/src/cli/commands/init/config-generator.ts +1 -1
- package/src/src/cli/index/arg-parser.ts +1 -0
- package/src/src/cli/index/command-router.ts +57 -40
- package/src/src/cli/index/types.ts +5 -0
- package/src/src/config/loader.ts +5 -4
- package/src/src/html/utils.ts +2 -2
- package/src/src/modules/component-registry/registry.ts +1 -1
- package/src/src/modules/import-map/default-import-map.ts +3 -25
- package/src/src/modules/import-map/loader.ts +7 -23
- package/src/src/modules/import-map/resolver.ts +13 -8
- package/src/src/modules/react-loader/component-loader.ts +3 -1
- package/src/src/modules/react-loader/extract-component.ts +1 -1
- package/src/src/modules/react-loader/ssr-module-loader/loader.ts +52 -38
- package/src/src/modules/react-loader/ssr-module-loader/types.ts +2 -0
- package/src/src/modules/react-loader/types.ts +3 -1
- package/src/src/modules/react-loader/unified-loader.ts +7 -4
- package/src/src/modules/server/module-batch-handler.ts +7 -0
- package/src/src/modules/server/module-server.ts +6 -1
- package/src/src/modules/server/ssr-import-rewriter.ts +9 -17
- package/src/src/react/compat/hooks-adapter.ts +1 -1
- package/src/src/react/compat/ssr-adapter/response-builder.ts +1 -1
- package/src/src/react/compat/ssr-adapter/server-loader.ts +10 -10
- package/src/src/react/compat/ssr-adapter/stream-renderer.ts +2 -2
- package/src/src/react/compat/ssr-adapter/string-renderer.ts +3 -3
- package/src/src/react/compat/version-detector/feature-detector.ts +1 -1
- package/src/src/react/components/AppWrapper.tsx +1 -1
- package/src/src/react/components/Head.tsx +7 -3
- package/src/src/react/components/LayoutComponent.tsx +2 -2
- package/src/src/react/components/Link.tsx +1 -1
- package/src/src/react/components/MDXProvider.tsx +2 -2
- package/src/src/react/components/ProviderComponent.tsx +2 -2
- package/src/src/react/components/ai/agent-card.tsx +1 -1
- package/src/src/react/components/ai/chat/components/animations.tsx +1 -1
- package/src/src/react/components/ai/chat/components/empty-state.tsx +1 -1
- package/src/src/react/components/ai/chat/components/message-actions.tsx +1 -1
- package/src/src/react/components/ai/chat/components/reasoning.tsx +1 -1
- package/src/src/react/components/ai/chat/components/tool-ui.tsx +1 -1
- package/src/src/react/components/ai/chat/composition/api.tsx +1 -1
- package/src/src/react/components/ai/chat/index.tsx +1 -1
- package/src/src/react/components/ai/error-boundary.tsx +1 -1
- package/src/src/react/components/ai/icons/index.ts +1 -1
- package/src/src/react/components/ai/markdown.tsx +1 -1
- package/src/src/react/components/ai/message.tsx +1 -1
- package/src/src/react/components/optimized-image/OptimizedBackgroundImage.tsx +1 -1
- package/src/src/react/components/optimized-image/OptimizedImage.tsx +1 -1
- package/src/src/react/components/optimized-image/SimpleOptimizedImage.tsx +1 -1
- package/src/src/react/components/optimized-image/utils.tsx +1 -1
- package/src/src/react/context/index.ts +1 -1
- package/src/src/react/fonts/index.ts +1 -1
- package/src/src/react/primitives/agent-primitives.tsx +1 -1
- package/src/src/react/primitives/chat-container.tsx +1 -1
- package/src/src/react/primitives/input-box.tsx +5 -3
- package/src/src/react/primitives/message-list.tsx +1 -1
- package/src/src/react/primitives/tool-primitives.tsx +1 -1
- package/src/src/react/router/index.ts +1 -1
- package/src/src/rendering/app-reserved.ts +1 -1
- package/src/src/rendering/client/router.ts +2 -2
- package/src/src/rendering/client/state-bridge.ts +2 -2
- package/src/src/rendering/component-handling.ts +7 -1
- package/src/src/rendering/element-validator/element-inspector.ts +1 -1
- package/src/src/rendering/element-validator/element-normalizer.ts +1 -1
- package/src/src/rendering/element-validator/primitive-checks.ts +1 -1
- package/src/src/rendering/element-validator/validator-core.ts +1 -1
- package/src/src/rendering/layouts/layout-applicator.ts +5 -6
- package/src/src/rendering/layouts/utils/applicator.ts +1 -1
- package/src/src/rendering/layouts/utils/component-loader.ts +1 -1
- package/src/src/rendering/layouts/utils/ensure-valid-child.ts +1 -1
- package/src/src/rendering/orchestrator/layout.ts +1 -1
- package/src/src/rendering/orchestrator/module-loader/index.ts +91 -20
- package/src/src/rendering/orchestrator/pipeline.ts +2 -0
- package/src/src/rendering/orchestrator/ssr-orchestrator.ts +2 -2
- package/src/src/rendering/page-renderer.ts +1 -1
- package/src/src/rendering/page-rendering.ts +1 -1
- package/src/src/rendering/rsc/server-renderer/component-detector.ts +1 -1
- package/src/src/rendering/rsc/server-renderer/rsc-renderer.ts +1 -1
- package/src/src/rendering/rsc/server-renderer/tree-processor.ts +14 -4
- package/src/src/rendering/snippet-renderer.ts +2 -2
- package/src/src/rendering/ssr/component-registry.ts +1 -1
- package/src/src/rendering/ssr-renderer.ts +1 -1
- package/src/src/rendering/utils/react-helpers.ts +1 -1
- package/src/src/server/build-app-route-renderer.ts +2 -2
- package/src/src/server/handlers/request/rsc/handlers/render-handler.ts +1 -1
- package/src/src/server/handlers/request/ssr/error-page-fallback.ts +2 -2
- package/src/src/server/handlers/request/ssr/not-found-fallback.ts +1 -1
- package/src/src/transforms/esm/http-bundler.ts +101 -11
- package/src/src/transforms/esm/http-cache.ts +27 -28
- package/src/src/transforms/esm/import-rewriter.ts +5 -3
- package/src/src/transforms/esm/package-registry.ts +46 -32
- package/src/src/transforms/esm/react-imports.ts +3 -7
- package/src/src/transforms/esm/types.ts +2 -0
- package/src/src/transforms/mdx/esm-module-loader/cache/index.ts +84 -0
- package/src/src/transforms/mdx/esm-module-loader/loader.ts +2 -1
- package/src/src/transforms/mdx/esm-module-loader/module-fetcher/index.ts +2 -1
- package/src/src/transforms/mdx/esm-module-loader/types.ts +4 -0
- package/src/src/transforms/mdx/index.ts +1 -1
- package/src/src/transforms/mdx/mdx-cache-adapter.ts +1 -1
- package/src/src/transforms/mdx/module-loader/types.ts +1 -1
- package/src/src/transforms/mdx/types.ts +2 -2
- package/src/src/transforms/pipeline/context.ts +7 -18
- package/src/src/transforms/pipeline/stages/finalize.ts +6 -1
- package/src/src/transforms/plugins/babel-node-positions.ts +2 -2
- package/src/src/types/app.ts +1 -1
- package/src/src/types/global-guards.ts +1 -1
- package/src/src/types/index.ts +1 -1
- package/src/src/utils/constants/cdn.ts +21 -12
- package/src/src/utils/hash-utils.ts +5 -0
- package/src/src/workflow/react/use-approval.ts +1 -1
- package/src/src/workflow/react/use-workflow-list.ts +1 -1
- package/src/src/workflow/react/use-workflow-start.ts +1 -1
- package/src/src/workflow/react/use-workflow.ts +1 -1
|
@@ -18,6 +18,8 @@ export interface GenerateCommandArgs {
|
|
|
18
18
|
_: (string | number)[];
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
export type ServerMode = "combined" | "proxy" | "renderer";
|
|
22
|
+
|
|
21
23
|
export interface ParsedArgs {
|
|
22
24
|
_: (string | number)[];
|
|
23
25
|
port?: number;
|
|
@@ -41,5 +43,8 @@ export interface ParsedArgs {
|
|
|
41
43
|
j?: boolean;
|
|
42
44
|
with?: string[];
|
|
43
45
|
w?: string[];
|
|
46
|
+
/** Server mode: combined (default), proxy, or renderer */
|
|
47
|
+
mode?: ServerMode;
|
|
48
|
+
m?: ServerMode;
|
|
44
49
|
[key: string]: unknown;
|
|
45
50
|
}
|
package/src/src/config/loader.ts
CHANGED
|
@@ -8,7 +8,8 @@ import { isBun } from "../platform/compat/runtime.js";
|
|
|
8
8
|
import { serverLogger } from "../utils/logger/logger.js";
|
|
9
9
|
import { getReactImportMap, REACT_DEFAULT_VERSION } from "../utils/constants/cdn.js";
|
|
10
10
|
import { DEFAULT_CACHE_DIR } from "../utils/constants/server.js";
|
|
11
|
-
|
|
11
|
+
// React version is now passed per-request via TransformOptions.reactVersion
|
|
12
|
+
// No longer using global singleton: import { setReactVersion } from "#veryfront/transforms/esm/package-registry.ts";
|
|
12
13
|
import { buildConfigCacheKey } from "../cache/keys.js";
|
|
13
14
|
import { DEFAULT_PORT } from "./defaults.js";
|
|
14
15
|
import { createFileSystem } from "../platform/compat/fs.js";
|
|
@@ -198,10 +199,10 @@ function validateAndCacheConfig(userConfig: unknown, cacheKey: string): Veryfron
|
|
|
198
199
|
|
|
199
200
|
const merged = mergeConfigs(userConfig as Partial<VeryfrontConfig>);
|
|
200
201
|
|
|
201
|
-
//
|
|
202
|
+
// React version is now passed per-request via TransformOptions.reactVersion
|
|
203
|
+
// Config stores it at merged.react.version, accessed wherever needed
|
|
202
204
|
if (merged.react?.version) {
|
|
203
|
-
|
|
204
|
-
serverLogger.debug("[CONFIG] React version set from config", { version: merged.react.version });
|
|
205
|
+
serverLogger.debug("[CONFIG] React version from config", { version: merged.react.version });
|
|
205
206
|
}
|
|
206
207
|
|
|
207
208
|
configCacheByProject.set(cacheKey, { revision: cacheRevision, config: merged });
|
package/src/src/html/utils.ts
CHANGED
|
@@ -97,8 +97,8 @@ interface CdnUrlTemplates {
|
|
|
97
97
|
const CDN_URL_TEMPLATES: Record<CdnProvider, CdnUrlTemplates> = {
|
|
98
98
|
"esm.sh": {
|
|
99
99
|
react: (v) => `https://esm.sh/react@${v}?target=es2022`,
|
|
100
|
-
reactDom: (v) => `https://esm.sh/react-dom@${v}?target=es2022`,
|
|
101
|
-
reactDomClient: (v) => `https://esm.sh/react-dom@${v}/client?target=es2022`,
|
|
100
|
+
reactDom: (v) => `https://esm.sh/react-dom@${v}?external=react&target=es2022`,
|
|
101
|
+
reactDomClient: (v) => `https://esm.sh/react-dom@${v}/client?external=react&target=es2022`,
|
|
102
102
|
jsxRuntime: (v) => `https://esm.sh/react@${v}/jsx-runtime?target=es2022`,
|
|
103
103
|
jsxDevRuntime: (v) => `https://esm.sh/react@${v}/jsx-dev-runtime?target=es2022`,
|
|
104
104
|
veryfrontAgentReact: (v) =>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { serverLogger as logger } from "../../utils/index.js";
|
|
2
2
|
import { basename, join } from "../../platform/compat/path/index.js";
|
|
3
3
|
import type { RuntimeAdapter } from "../../platform/adapters/base.js";
|
|
4
|
-
import type * as React from "react";
|
|
4
|
+
import type * as React from "../../../deps/esm.sh/react@19.1.1.js";
|
|
5
5
|
import { withSpan } from "../../observability/tracing/otlp-setup.js";
|
|
6
6
|
|
|
7
7
|
export interface ComponentExports {
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import * as dntShim from "../../../_dnt.shims.js";
|
|
2
2
|
import type { ImportMapConfig } from "./types.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
getDenoNpmReactMap,
|
|
6
|
-
getReactImportMap,
|
|
7
|
-
} from "../../transforms/esm/package-registry.js";
|
|
3
|
+
import { getReactImportMap } from "../../transforms/esm/package-registry.js";
|
|
8
4
|
|
|
9
5
|
function ensureTrailingSlash(path: string): string {
|
|
10
6
|
return path.endsWith("/") ? path : `${path}/`;
|
|
@@ -45,33 +41,15 @@ function getVeryfrontSsrImportMap(): Record<string, string> {
|
|
|
45
41
|
};
|
|
46
42
|
}
|
|
47
43
|
|
|
48
|
-
/**
|
|
49
|
-
* Get React import map for SSR in Deno.
|
|
50
|
-
* Uses npm: specifiers which Deno handles natively with automatic deduplication.
|
|
51
|
-
* See: https://deno.com/blog/not-using-npm-specifiers-doing-it-wrong
|
|
52
|
-
*
|
|
53
|
-
* This replaces the previous shared-*.ts approach which required manual re-exports.
|
|
54
|
-
*/
|
|
55
|
-
export function getDenoReactImportMap(): Record<string, string> {
|
|
56
|
-
return getDenoNpmReactMap();
|
|
57
|
-
}
|
|
58
|
-
|
|
59
44
|
/**
|
|
60
45
|
* Get the default import map for SSR transforms.
|
|
61
|
-
*
|
|
62
|
-
* For Deno SSR: Uses npm: specifiers with automatic deduplication.
|
|
63
|
-
* For other runtimes: Uses esm.sh URLs with external=react.
|
|
46
|
+
* Uses esm.sh URLs consistently (NO npm: specifiers per plan requirements).
|
|
64
47
|
*/
|
|
65
48
|
export function getDefaultImportMap(): ImportMapConfig {
|
|
66
|
-
const reactMap =
|
|
49
|
+
const reactMap = getReactImportMap();
|
|
67
50
|
const veryfrontMap = getVeryfrontSsrImportMap();
|
|
68
51
|
|
|
69
|
-
// For Deno SSR, add scopes so that esm.sh modules with external=react
|
|
70
|
-
// resolve their bare `react` imports to npm: specifiers.
|
|
71
|
-
const scopes = isDeno ? { "https://esm.sh/": getDenoReactImportMap() } : undefined;
|
|
72
|
-
|
|
73
52
|
return {
|
|
74
53
|
imports: { ...veryfrontMap, ...reactMap },
|
|
75
|
-
scopes,
|
|
76
54
|
};
|
|
77
55
|
}
|
|
@@ -3,15 +3,16 @@ import { dirname, join } from "../../platform/compat/path/index.js";
|
|
|
3
3
|
import type { RuntimeAdapter } from "../../platform/adapters/base.js";
|
|
4
4
|
import { getConfig } from "../../config/index.js";
|
|
5
5
|
import type { ImportMapConfig } from "./types.js";
|
|
6
|
-
import { getDefaultImportMap
|
|
6
|
+
import { getDefaultImportMap } from "./default-import-map.js";
|
|
7
7
|
import { mergeImportMaps } from "./merger.js";
|
|
8
8
|
import { withSpan } from "../../observability/tracing/otlp-setup.js";
|
|
9
|
-
import {
|
|
9
|
+
import { getReactImportMap } from "../../transforms/esm/package-registry.js";
|
|
10
10
|
|
|
11
11
|
function normalizeImportMapForRuntime(importMap: ImportMapConfig): ImportMapConfig {
|
|
12
12
|
const normalizeValue = (value: string): string => {
|
|
13
13
|
if (!value.startsWith("npm:")) return value;
|
|
14
14
|
|
|
15
|
+
// Convert npm: specifiers to esm.sh URLs (should not happen with new code)
|
|
15
16
|
const spec = value.slice(4);
|
|
16
17
|
const [base, query] = spec.split("?");
|
|
17
18
|
const url = `https://esm.sh/${base}`;
|
|
@@ -23,7 +24,7 @@ function normalizeImportMapForRuntime(importMap: ImportMapConfig): ImportMapConf
|
|
|
23
24
|
? Object.fromEntries(Object.entries(importMap.imports).map(([k, v]) => [k, normalizeValue(v)]))
|
|
24
25
|
: undefined;
|
|
25
26
|
|
|
26
|
-
|
|
27
|
+
const scopes = importMap.scopes
|
|
27
28
|
? Object.fromEntries(
|
|
28
29
|
Object.entries(importMap.scopes).map(([scope, mappings]) => [
|
|
29
30
|
scope,
|
|
@@ -34,31 +35,14 @@ function normalizeImportMapForRuntime(importMap: ImportMapConfig): ImportMapConf
|
|
|
34
35
|
)
|
|
35
36
|
: undefined;
|
|
36
37
|
|
|
37
|
-
// CRITICAL: For Deno SSR, always use shared-*.ts files for React.
|
|
38
|
-
// Project configs may have esm.sh URLs which would create multiple React instances.
|
|
39
38
|
// Override React mappings AFTER all other processing to ensure single instance.
|
|
40
|
-
//
|
|
41
|
-
if (
|
|
42
|
-
const reactMap =
|
|
43
|
-
// Remove any esm.sh "react/" prefix mapping that would break subpath resolution
|
|
39
|
+
// Remove any "react/" prefix match since we have explicit mappings.
|
|
40
|
+
if (imports) {
|
|
41
|
+
const reactMap = getReactImportMap();
|
|
44
42
|
delete imports["react/"];
|
|
45
43
|
imports = { ...imports, ...reactMap };
|
|
46
44
|
}
|
|
47
45
|
|
|
48
|
-
// For Deno SSR, ensure esm.sh scope has React mappings to shared-*.ts files.
|
|
49
|
-
// This is critical because esm.sh modules with external=react have bare `react`
|
|
50
|
-
// imports that need to resolve to our shared React instance.
|
|
51
|
-
if (isDeno) {
|
|
52
|
-
const reactMap = getDenoReactImportMap();
|
|
53
|
-
const esmShScope = scopes?.["https://esm.sh/"] ?? {};
|
|
54
|
-
// Remove any "react/" prefix match from scope as well
|
|
55
|
-
delete esmShScope["react/"];
|
|
56
|
-
scopes = {
|
|
57
|
-
...scopes,
|
|
58
|
-
"https://esm.sh/": { ...esmShScope, ...reactMap },
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
|
|
62
46
|
return { imports, scopes };
|
|
63
47
|
}
|
|
64
48
|
|
|
@@ -60,21 +60,26 @@ export function resolveImport(
|
|
|
60
60
|
if (isEsmShUrl(specifier)) {
|
|
61
61
|
const esmShPackage = extractEsmShPackage(specifier);
|
|
62
62
|
if (esmShPackage) {
|
|
63
|
+
const subpath = extractEsmShSubpath(specifier);
|
|
64
|
+
|
|
65
|
+
// Always check for explicit subpath mapping first (e.g., "react/jsx-runtime")
|
|
66
|
+
// This takes priority over appending subpath to base package mapping
|
|
67
|
+
if (subpath) {
|
|
68
|
+
const fullKey = esmShPackage + subpath; // e.g., "react/jsx-runtime"
|
|
69
|
+
const subpathMapping = scopedImports?.[fullKey] ?? importMap.imports?.[fullKey];
|
|
70
|
+
if (subpathMapping) return subpathMapping;
|
|
71
|
+
}
|
|
72
|
+
|
|
63
73
|
const mapping = scopedImports?.[esmShPackage] ?? importMap.imports?.[esmShPackage];
|
|
64
74
|
if (mapping) {
|
|
65
|
-
const subpath = extractEsmShSubpath(specifier);
|
|
66
75
|
if (!subpath) return mapping;
|
|
67
76
|
|
|
68
|
-
// If mapping target is a file path (not HTTP URL or npm: specifier),
|
|
69
|
-
//
|
|
70
|
-
// npm: specifiers are URL-like and should have subpaths appended
|
|
77
|
+
// If mapping target is a file path (not HTTP URL or npm: specifier),
|
|
78
|
+
// fall back to base mapping since explicit subpath wasn't found above
|
|
71
79
|
const isFilePath = !mapping.startsWith("http://") && !mapping.startsWith("https://") &&
|
|
72
80
|
!mapping.startsWith("npm:");
|
|
73
81
|
if (isFilePath) {
|
|
74
|
-
|
|
75
|
-
const subpathMapping = scopedImports?.[fullKey] ?? importMap.imports?.[fullKey];
|
|
76
|
-
// Use explicit subpath mapping if available, otherwise fall back to base mapping
|
|
77
|
-
return subpathMapping ?? mapping;
|
|
82
|
+
return mapping;
|
|
78
83
|
}
|
|
79
84
|
|
|
80
85
|
return mapping + subpath;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { join } from "../../platform/compat/path/index.js";
|
|
2
|
-
import type * as React from "react";
|
|
2
|
+
import type * as React from "../../../deps/esm.sh/react@19.1.1.js";
|
|
3
3
|
import type { RuntimeAdapter } from "../../platform/adapters/base.js";
|
|
4
4
|
import { transformToESM } from "../../transforms/esm/index.js";
|
|
5
5
|
import type { TransformOptions } from "../../transforms/esm/types.js";
|
|
@@ -34,6 +34,7 @@ export function loadComponentFromSource(
|
|
|
34
34
|
adapter,
|
|
35
35
|
dev,
|
|
36
36
|
contentSourceId: options?.contentSourceId,
|
|
37
|
+
reactVersion: options?.reactVersion,
|
|
37
38
|
});
|
|
38
39
|
return loader.loadModule(filePath, source);
|
|
39
40
|
}
|
|
@@ -44,6 +45,7 @@ export function loadComponentFromSource(
|
|
|
44
45
|
moduleServerUrl: options?.moduleServerUrl ?? "/_vf_modules",
|
|
45
46
|
vendorBundleHash: options?.vendorBundleHash,
|
|
46
47
|
ssr: false,
|
|
48
|
+
reactVersion: options?.reactVersion,
|
|
47
49
|
};
|
|
48
50
|
|
|
49
51
|
const transformedCode = await transformToESM(
|
|
@@ -8,13 +8,12 @@
|
|
|
8
8
|
import * as dntShim from "../../../../_dnt.shims.js";
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
13
|
-
import type * as React from "react";
|
|
11
|
+
import { join } from "../../../platform/compat/path/index.js";
|
|
12
|
+
import type * as React from "../../../../deps/esm.sh/react@19.1.1.js";
|
|
14
13
|
import { transformToESM } from "../../../transforms/esm/index.js";
|
|
15
14
|
import type { TransformOptions } from "../../../transforms/esm/types.js";
|
|
16
15
|
import { TRANSFORM_CACHE_VERSION } from "../../../transforms/esm/package-registry.js";
|
|
17
|
-
import { buildSSRModuleCacheKey
|
|
16
|
+
import { buildSSRModuleCacheKey } from "../../../cache/keys.js";
|
|
18
17
|
import {
|
|
19
18
|
type CrossProjectImport,
|
|
20
19
|
type MissingImport,
|
|
@@ -23,6 +22,7 @@ import {
|
|
|
23
22
|
import { createFileSystem } from "../../../platform/compat/fs.js";
|
|
24
23
|
import { createError, toError } from "../../../errors/veryfront-error.js";
|
|
25
24
|
import { rendererLogger as logger } from "../../../utils/index.js";
|
|
25
|
+
import { hashCodeHex } from "../../../utils/hash-utils.js";
|
|
26
26
|
import { getApiBaseUrlEnv } from "../../../config/env.js";
|
|
27
27
|
import { injectContext, withSpan } from "../../../observability/tracing/otlp-setup.js";
|
|
28
28
|
import { SpanNames } from "../../../observability/tracing/span-names.js";
|
|
@@ -49,7 +49,8 @@ import {
|
|
|
49
49
|
transformSemaphore,
|
|
50
50
|
} from "./cache/index.js";
|
|
51
51
|
import type { ModuleCacheEntry, SSRModuleLoaderOptions } from "./types.js";
|
|
52
|
-
import {
|
|
52
|
+
import { getHttpBundleCacheDir, getMdxEsmCacheDir } from "../../../utils/cache-dir.js";
|
|
53
|
+
import { lookupMdxEsmCache } from "../../../transforms/mdx/esm-module-loader/cache/index.js";
|
|
53
54
|
import { ensureHttpBundlesExist } from "../../../transforms/esm/http-cache.js";
|
|
54
55
|
import { LRUCache } from "../../../utils/lru-wrapper.js";
|
|
55
56
|
|
|
@@ -263,10 +264,12 @@ export class SSRModuleLoader {
|
|
|
263
264
|
`Missing contentSourceId for SSR module cache (project: ${this.options.projectId}, file: ${filePath})`,
|
|
264
265
|
);
|
|
265
266
|
}
|
|
267
|
+
// Include reactVersion in cache key to ensure different versions don't share cached modules
|
|
268
|
+
const reactVersion = this.options.reactVersion ?? "default";
|
|
266
269
|
return buildSSRModuleCacheKey(
|
|
267
270
|
TRANSFORM_CACHE_VERSION,
|
|
268
271
|
this.options.projectId,
|
|
269
|
-
`${this.options.contentSourceId}:${filePath}`,
|
|
272
|
+
`${this.options.contentSourceId}:${reactVersion}:${filePath}`,
|
|
270
273
|
);
|
|
271
274
|
}
|
|
272
275
|
|
|
@@ -361,6 +364,7 @@ export class SSRModuleLoader {
|
|
|
361
364
|
dev: this.options.dev,
|
|
362
365
|
ssr: true,
|
|
363
366
|
apiBaseUrl: this.options.apiBaseUrl,
|
|
367
|
+
reactVersion: this.options.reactVersion,
|
|
364
368
|
};
|
|
365
369
|
|
|
366
370
|
const filePathWithExt = syntheticFilePath.endsWith(ext)
|
|
@@ -532,6 +536,34 @@ export class SSRModuleLoader {
|
|
|
532
536
|
}
|
|
533
537
|
}
|
|
534
538
|
|
|
539
|
+
// Check MDX-ESM cache to share modules with MDX loader and avoid duplicate React contexts
|
|
540
|
+
if (this.options.projectId && this.options.contentSourceId) {
|
|
541
|
+
const baseCacheDir = getMdxEsmCacheDir();
|
|
542
|
+
const projectKey = hashCodeHex(this.options.projectId);
|
|
543
|
+
const sourceKey = hashCodeHex(this.options.contentSourceId);
|
|
544
|
+
const mdxCacheDir = join(baseCacheDir, projectKey, sourceKey);
|
|
545
|
+
|
|
546
|
+
const mdxCachedPath = await lookupMdxEsmCache(
|
|
547
|
+
filePath,
|
|
548
|
+
mdxCacheDir,
|
|
549
|
+
this.options.projectDir,
|
|
550
|
+
contentHash,
|
|
551
|
+
);
|
|
552
|
+
if (mdxCachedPath) {
|
|
553
|
+
const entry: ModuleCacheEntry = { tempPath: mdxCachedPath, contentHash };
|
|
554
|
+
globalModuleCache.set(contentCacheKey, entry);
|
|
555
|
+
globalModuleCache.set(filePathCacheKey, entry);
|
|
556
|
+
|
|
557
|
+
logger.debug("[SSR-MODULE-LOADER] Reusing MDX-ESM cache", {
|
|
558
|
+
file: filePath.slice(-40),
|
|
559
|
+
cachedPath: mdxCachedPath.slice(-60),
|
|
560
|
+
});
|
|
561
|
+
|
|
562
|
+
await this.ensureDependenciesExist(code, filePath, depth);
|
|
563
|
+
return;
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
|
|
535
567
|
const existingTransform = globalInProgress.get(inProgressKey);
|
|
536
568
|
if (existingTransform) {
|
|
537
569
|
try {
|
|
@@ -626,6 +658,7 @@ export class SSRModuleLoader {
|
|
|
626
658
|
dev: this.options.dev,
|
|
627
659
|
ssr: true,
|
|
628
660
|
apiBaseUrl: this.options.apiBaseUrl,
|
|
661
|
+
reactVersion: this.options.reactVersion,
|
|
629
662
|
};
|
|
630
663
|
|
|
631
664
|
let transformed = await withSpan(
|
|
@@ -940,26 +973,12 @@ export class SSRModuleLoader {
|
|
|
940
973
|
}
|
|
941
974
|
}
|
|
942
975
|
|
|
943
|
-
/**
|
|
944
|
-
* Fast sync hash for small strings (project IDs, etc.)
|
|
945
|
-
* Use hashContentAsync for large file content.
|
|
946
|
-
*/
|
|
947
|
-
private hashCode(str: string): string {
|
|
948
|
-
let hash = 0;
|
|
949
|
-
for (let i = 0; i < str.length; i++) {
|
|
950
|
-
const char = str.charCodeAt(i);
|
|
951
|
-
hash = (hash << 5) - hash + char;
|
|
952
|
-
hash = hash & hash;
|
|
953
|
-
}
|
|
954
|
-
return Math.abs(hash).toString(16);
|
|
955
|
-
}
|
|
956
|
-
|
|
957
976
|
/**
|
|
958
977
|
* Async hash for large content using Web Crypto API.
|
|
959
|
-
*
|
|
978
|
+
* Falls back to sync hash for small files.
|
|
960
979
|
*/
|
|
961
980
|
private async hashContentAsync(content: string): Promise<string> {
|
|
962
|
-
if (content.length < 10000) return
|
|
981
|
+
if (content.length < 10000) return hashCodeHex(content);
|
|
963
982
|
|
|
964
983
|
try {
|
|
965
984
|
const data = new TextEncoder().encode(content);
|
|
@@ -970,7 +989,7 @@ export class SSRModuleLoader {
|
|
|
970
989
|
.map((b) => b.toString(16).padStart(2, "0"))
|
|
971
990
|
.join("");
|
|
972
991
|
} catch {
|
|
973
|
-
return
|
|
992
|
+
return hashCodeHex(content);
|
|
974
993
|
}
|
|
975
994
|
}
|
|
976
995
|
|
|
@@ -990,33 +1009,28 @@ export class SSRModuleLoader {
|
|
|
990
1009
|
}
|
|
991
1010
|
|
|
992
1011
|
private async ensureTmpDir(): Promise<string> {
|
|
993
|
-
let projectDir = this.options.projectDir;
|
|
994
1012
|
const { projectId, contentSourceId } = this.options;
|
|
995
1013
|
|
|
996
1014
|
if (!projectId) {
|
|
997
|
-
throw new Error(
|
|
1015
|
+
throw new Error(
|
|
1016
|
+
`Missing projectId for SSR temp directory (projectDir: ${this.options.projectDir})`,
|
|
1017
|
+
);
|
|
998
1018
|
}
|
|
999
1019
|
if (!contentSourceId) {
|
|
1000
1020
|
throw new Error(`Missing contentSourceId for SSR temp directory (project: ${projectId})`);
|
|
1001
1021
|
}
|
|
1002
1022
|
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
const
|
|
1008
|
-
const
|
|
1009
|
-
|
|
1010
|
-
const cacheKey = `${baseDir}|${
|
|
1011
|
-
buildSSRModuleProjectKey(projectDir, projectId)
|
|
1012
|
-
}|${contentSourceId}`;
|
|
1023
|
+
// Use the same cache directory as MDX-ESM loader to share module instances.
|
|
1024
|
+
// This prevents issues like React context being created twice in separate files.
|
|
1025
|
+
const baseCacheDir = getMdxEsmCacheDir();
|
|
1026
|
+
const projectKey = hashCodeHex(projectId);
|
|
1027
|
+
const sourceKey = hashCodeHex(contentSourceId);
|
|
1028
|
+
const cacheKey = `${baseCacheDir}|${projectKey}|${sourceKey}`;
|
|
1013
1029
|
|
|
1014
1030
|
const existingDir = globalTmpDirs.get(cacheKey);
|
|
1015
1031
|
if (existingDir) return existingDir;
|
|
1016
1032
|
|
|
1017
|
-
const
|
|
1018
|
-
const sourceKey = this.hashCode(contentSourceId);
|
|
1019
|
-
const tmpDir = join(baseDir, "veryfront-ssr", projectKey, sourceKey);
|
|
1033
|
+
const tmpDir = join(baseCacheDir, projectKey, sourceKey);
|
|
1020
1034
|
|
|
1021
1035
|
await this.fs.mkdir(tmpDir, { recursive: true });
|
|
1022
1036
|
globalTmpDirs.set(cacheKey, tmpDir);
|
|
@@ -16,6 +16,8 @@ export interface SSRModuleLoaderOptions {
|
|
|
16
16
|
apiBaseUrl?: string;
|
|
17
17
|
/** Content source ID for cache isolation (branch name or release ID) */
|
|
18
18
|
contentSourceId?: string;
|
|
19
|
+
/** React version for transforms (defaults to DEFAULT_REACT_VERSION) */
|
|
20
|
+
reactVersion?: string;
|
|
19
21
|
}
|
|
20
22
|
|
|
21
23
|
export interface ModuleCacheEntry {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type * as React from "react";
|
|
1
|
+
import type * as React from "../../../deps/esm.sh/react@19.1.1.js";
|
|
2
2
|
|
|
3
3
|
export interface LoadComponentOptions {
|
|
4
4
|
projectId?: string;
|
|
@@ -9,6 +9,8 @@ export interface LoadComponentOptions {
|
|
|
9
9
|
ssr?: boolean;
|
|
10
10
|
/** Content source ID for cache isolation (branch name or release ID) */
|
|
11
11
|
contentSourceId?: string;
|
|
12
|
+
/** React version for transforms (from project config) */
|
|
13
|
+
reactVersion?: string;
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
export interface ComponentSource {
|
|
@@ -6,6 +6,7 @@ import { rendererLogger as logger } from "../../utils/index.js";
|
|
|
6
6
|
import { withSpan } from "../../observability/tracing/otlp-setup.js";
|
|
7
7
|
import { getProjectTmpDir } from "./temp-directory.js";
|
|
8
8
|
import type { ComponentMap, ComponentSource, LoadComponentOptions } from "./types.js";
|
|
9
|
+
import { DEFAULT_REACT_VERSION } from "../../transforms/esm/package-registry.js";
|
|
9
10
|
|
|
10
11
|
type TransformedComponent = { name: string; code: string };
|
|
11
12
|
|
|
@@ -21,8 +22,9 @@ export function loadComponentsUnified(
|
|
|
21
22
|
const projectId = options?.projectId ?? projectDir;
|
|
22
23
|
const dev = options?.dev ?? true;
|
|
23
24
|
const moduleServerUrl = options?.moduleServerUrl;
|
|
25
|
+
const reactVersion = options?.reactVersion;
|
|
24
26
|
|
|
25
|
-
const transformOpts: TransformOptions = { projectId, dev, moduleServerUrl };
|
|
27
|
+
const transformOpts: TransformOptions = { projectId, dev, moduleServerUrl, reactVersion };
|
|
26
28
|
const transformedComponents = await transformAllComponents(
|
|
27
29
|
components,
|
|
28
30
|
projectDir,
|
|
@@ -38,7 +40,7 @@ export function loadComponentsUnified(
|
|
|
38
40
|
try {
|
|
39
41
|
await writeComponentFiles(tmpDir, transformedComponents, adapter);
|
|
40
42
|
|
|
41
|
-
const entryCode = generateEntryPoint(transformedComponents);
|
|
43
|
+
const entryCode = generateEntryPoint(transformedComponents, reactVersion);
|
|
42
44
|
await adapter.fs.writeFile(join(tmpDir, "entry.js"), entryCode);
|
|
43
45
|
|
|
44
46
|
return await importUnifiedComponents(tmpDir, transformedComponents);
|
|
@@ -74,7 +76,8 @@ async function writeComponentFiles(
|
|
|
74
76
|
);
|
|
75
77
|
}
|
|
76
78
|
|
|
77
|
-
function generateEntryPoint(components: TransformedComponent[]): string {
|
|
79
|
+
function generateEntryPoint(components: TransformedComponent[], reactVersion?: string): string {
|
|
80
|
+
const version = reactVersion ?? DEFAULT_REACT_VERSION;
|
|
78
81
|
const imports = components
|
|
79
82
|
.map((comp) => `import { default as ${comp.name} } from './${comp.name}.js'`)
|
|
80
83
|
.join("\n");
|
|
@@ -82,7 +85,7 @@ function generateEntryPoint(components: TransformedComponent[]): string {
|
|
|
82
85
|
const exports = components.map((comp) => comp.name).join(", ");
|
|
83
86
|
|
|
84
87
|
return `
|
|
85
|
-
import * as React from 'https://esm.sh/react
|
|
88
|
+
import * as React from 'https://esm.sh/react@${version}?target=es2022'
|
|
86
89
|
${imports}
|
|
87
90
|
|
|
88
91
|
export { ${exports} }
|
|
@@ -50,6 +50,8 @@ export interface BatchHandlerOptions {
|
|
|
50
50
|
* When not set, users can import from any directory in the project.
|
|
51
51
|
*/
|
|
52
52
|
allowedImportDirs?: string[];
|
|
53
|
+
/** React version for transforms (from project config) */
|
|
54
|
+
reactVersion?: string;
|
|
53
55
|
}
|
|
54
56
|
|
|
55
57
|
/** Maximum number of modules that can be batched in one request */
|
|
@@ -103,6 +105,7 @@ export function handleModuleBatch(req: dntShim.Request, options: BatchHandlerOpt
|
|
|
103
105
|
branch,
|
|
104
106
|
dev = false,
|
|
105
107
|
allowedImportDirs,
|
|
108
|
+
reactVersion,
|
|
106
109
|
} = options;
|
|
107
110
|
|
|
108
111
|
const projectKey = projectId || projectSlug || "default";
|
|
@@ -148,6 +151,7 @@ export function handleModuleBatch(req: dntShim.Request, options: BatchHandlerOpt
|
|
|
148
151
|
projectSlug,
|
|
149
152
|
branch,
|
|
150
153
|
projectId,
|
|
154
|
+
reactVersion,
|
|
151
155
|
});
|
|
152
156
|
|
|
153
157
|
const transformDurationMs = performance.now() - moduleStart;
|
|
@@ -247,6 +251,7 @@ async function loadAndTransformModule(
|
|
|
247
251
|
projectSlug?: string;
|
|
248
252
|
branch?: string | null;
|
|
249
253
|
projectId?: string;
|
|
254
|
+
reactVersion?: string;
|
|
250
255
|
},
|
|
251
256
|
): Promise<string | null> {
|
|
252
257
|
const basePath = modulePath.replace(/\.js$/, "");
|
|
@@ -295,12 +300,14 @@ async function transformModule(
|
|
|
295
300
|
projectSlug?: string;
|
|
296
301
|
branch?: string | null;
|
|
297
302
|
projectId?: string;
|
|
303
|
+
reactVersion?: string;
|
|
298
304
|
},
|
|
299
305
|
): Promise<string> {
|
|
300
306
|
let code = await transformToESM(source, sourceFile, projectDir, adapter, {
|
|
301
307
|
projectId: options.projectId ?? projectDir,
|
|
302
308
|
dev: options.dev,
|
|
303
309
|
ssr: options.ssr,
|
|
310
|
+
reactVersion: options.reactVersion,
|
|
304
311
|
});
|
|
305
312
|
|
|
306
313
|
if (options.ssr) {
|
|
@@ -47,6 +47,8 @@ export interface ModuleServerOptions {
|
|
|
47
47
|
* When not set, users can import from any directory in the project.
|
|
48
48
|
*/
|
|
49
49
|
allowedImportDirs?: string[];
|
|
50
|
+
/** React version for transforms (from project config) */
|
|
51
|
+
reactVersion?: string;
|
|
50
52
|
}
|
|
51
53
|
|
|
52
54
|
/** Serve transformed module at /_vf_modules/* path */
|
|
@@ -65,6 +67,7 @@ export function serveModule(req: dntShim.Request, options: ModuleServerOptions):
|
|
|
65
67
|
dev = true,
|
|
66
68
|
projectUUID,
|
|
67
69
|
allowedImportDirs,
|
|
70
|
+
reactVersion,
|
|
68
71
|
} = options;
|
|
69
72
|
|
|
70
73
|
const effectiveProjectId = projectUUID ?? projectId;
|
|
@@ -141,7 +144,7 @@ export function serveModule(req: dntShim.Request, options: ModuleServerOptions):
|
|
|
141
144
|
`_snippets/${hash}.tsx`,
|
|
142
145
|
projectDir,
|
|
143
146
|
adapter,
|
|
144
|
-
{ projectId: effectiveProjectId, dev, ssr: isSSR },
|
|
147
|
+
{ projectId: effectiveProjectId, dev, ssr: isSSR, reactVersion },
|
|
145
148
|
);
|
|
146
149
|
|
|
147
150
|
if (isSSR && transformedCode) {
|
|
@@ -230,6 +233,7 @@ export function serveModule(req: dntShim.Request, options: ModuleServerOptions):
|
|
|
230
233
|
dev,
|
|
231
234
|
ssr: isSSR,
|
|
232
235
|
moduleServerUrl: `http://${url.host}`,
|
|
236
|
+
reactVersion,
|
|
233
237
|
});
|
|
234
238
|
|
|
235
239
|
if (isSSR && code) {
|
|
@@ -308,6 +312,7 @@ export function serveModule(req: dntShim.Request, options: ModuleServerOptions):
|
|
|
308
312
|
dev,
|
|
309
313
|
ssr: isSSR,
|
|
310
314
|
studioEmbed,
|
|
315
|
+
reactVersion,
|
|
311
316
|
};
|
|
312
317
|
|
|
313
318
|
code = await transformToESM(source, sourceFile, projectDir, adapter, transformOpts);
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { isDeno } from "../../platform/compat/runtime.js";
|
|
3
|
-
import { getLocalReactPaths } from "../../platform/compat/react-paths.js";
|
|
1
|
+
import { getReactImportMap, getReactVersion } from "../../transforms/esm/package-registry.js";
|
|
4
2
|
|
|
5
3
|
export interface SSRRewriteOptions {
|
|
6
4
|
/** Project slug for multi-project routing */
|
|
@@ -37,26 +35,23 @@ function shouldKeepBareSpecifier(specifier: string): boolean {
|
|
|
37
35
|
}
|
|
38
36
|
|
|
39
37
|
function resolveReactForRuntime(specifier: string, version?: string): string | null {
|
|
40
|
-
// Always rewrite React imports to
|
|
41
|
-
//
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
// For Node/Bun: use local node_modules paths
|
|
45
|
-
const reactMap = isDeno ? getDenoNpmReactMap(version) : getLocalReactPaths();
|
|
38
|
+
// Always rewrite React imports to esm.sh URLs for SSR modules.
|
|
39
|
+
// NO npm: specifiers - use esm.sh URLs only for consistent React instance.
|
|
40
|
+
const v = version ?? getReactVersion();
|
|
41
|
+
const reactMap = getReactImportMap(v);
|
|
46
42
|
|
|
47
43
|
const mapped = reactMap[specifier];
|
|
48
44
|
if (mapped) return mapped;
|
|
49
45
|
|
|
50
46
|
// Handle React subpath imports not in the map
|
|
51
|
-
const v = version ?? getReactVersion();
|
|
52
47
|
if (specifier.startsWith("react/")) {
|
|
53
48
|
const subpath = specifier.slice("react/".length);
|
|
54
|
-
return
|
|
49
|
+
return `https://esm.sh/react@${v}/${subpath}?external=react&target=es2022`;
|
|
55
50
|
}
|
|
56
51
|
|
|
57
52
|
if (specifier.startsWith("react-dom/")) {
|
|
58
53
|
const subpath = specifier.slice("react-dom/".length);
|
|
59
|
-
return
|
|
54
|
+
return `https://esm.sh/react-dom@${v}/${subpath}?external=react&target=es2022`;
|
|
60
55
|
}
|
|
61
56
|
|
|
62
57
|
return null;
|
|
@@ -69,11 +64,8 @@ function rewriteBareImports(code: string, version?: string): string {
|
|
|
69
64
|
if (reactUrl) return `from "${reactUrl}"`;
|
|
70
65
|
if (shouldKeepBareSpecifier(specifier)) return `from "${specifier}"`;
|
|
71
66
|
|
|
72
|
-
// For third-party packages:
|
|
73
|
-
|
|
74
|
-
return `from "npm:${specifier}"`;
|
|
75
|
-
}
|
|
76
|
-
return `from "https://esm.sh/${specifier}?deps=react@${v},react-dom@${v}&target=es2022"`;
|
|
67
|
+
// For third-party packages: Use esm.sh with external=react
|
|
68
|
+
return `from "https://esm.sh/${specifier}?external=react&target=es2022"`;
|
|
77
69
|
});
|
|
78
70
|
}
|
|
79
71
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as dntShim from "../../../_dnt.shims.js";
|
|
2
2
|
import { rendererLogger as logger } from "../../utils/index.js";
|
|
3
|
-
import * as React from "react";
|
|
3
|
+
import * as React from "../../../deps/esm.sh/react@19.1.1.js";
|
|
4
4
|
import { getReactVersionInfo, hasFeature } from "./version-detector/index.js";
|
|
5
5
|
|
|
6
6
|
export interface FormStatus {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as dntShim from "../../../../_dnt.shims.js";
|
|
2
|
-
import * as React from "react";
|
|
2
|
+
import * as React from "../../../../deps/esm.sh/react@19.1.1.js";
|
|
3
3
|
import { getReactVersionInfo } from "../version-detector/index.js";
|
|
4
4
|
import { wrapInHTML } from "./html-wrapper.js";
|
|
5
5
|
import { renderToStreamAdapter } from "./stream-renderer.js";
|