veryfront 0.0.84 → 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/README.md +18 -44
- 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/app/components/list-select.js +2 -2
- package/esm/src/cli/app/index.d.ts +1 -1
- package/esm/src/cli/app/index.d.ts.map +1 -1
- package/esm/src/cli/app/index.js +26 -33
- package/esm/src/cli/app/state.d.ts +3 -0
- package/esm/src/cli/app/state.d.ts.map +1 -1
- package/esm/src/cli/app/state.js +4 -0
- package/esm/src/cli/app/views/dashboard.d.ts.map +1 -1
- package/esm/src/cli/app/views/dashboard.js +45 -57
- package/esm/src/cli/app/views/startup.d.ts +39 -0
- package/esm/src/cli/app/views/startup.d.ts.map +1 -0
- package/esm/src/cli/app/views/startup.js +103 -0
- 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/cli/ui/colors.d.ts +8 -0
- package/esm/src/cli/ui/colors.d.ts.map +1 -1
- package/esm/src/cli/ui/colors.js +34 -0
- package/esm/src/cli/ui/dot-matrix.d.ts +8 -0
- package/esm/src/cli/ui/dot-matrix.d.ts.map +1 -1
- package/esm/src/cli/ui/dot-matrix.js +67 -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 +68 -38
- 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 +51 -44
- 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/app/components/list-select.ts +2 -2
- package/src/src/cli/app/index.ts +34 -35
- package/src/src/cli/app/state.ts +7 -0
- package/src/src/cli/app/views/dashboard.ts +46 -60
- package/src/src/cli/app/views/startup.ts +132 -0
- 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/cli/ui/colors.ts +37 -0
- package/src/src/cli/ui/dot-matrix.ts +77 -1
- 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 +95 -68
- 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 +53 -45
- 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
|
@@ -156,47 +156,137 @@ export function createHTTPPlugin(): Plugin {
|
|
|
156
156
|
}
|
|
157
157
|
|
|
158
158
|
/**
|
|
159
|
-
* Ensure esm.sh URLs have
|
|
160
|
-
* This makes them import React as
|
|
159
|
+
* Ensure esm.sh URLs have external=react,react-dom for SSR.
|
|
160
|
+
* This makes them import React as bare specifiers, which the import map resolves.
|
|
161
161
|
*
|
|
162
162
|
* Uses two esm.sh features:
|
|
163
|
-
* - `external=react` - Don't bundle React, let import map resolve
|
|
163
|
+
* - `external=react,react-dom` - Don't bundle React/ReactDOM, let import map resolve them
|
|
164
164
|
* - `deps=react@X,react-dom@X` - Pin dependency versions to prevent mismatches
|
|
165
|
+
*
|
|
166
|
+
* Logic for external handling:
|
|
167
|
+
* 1. If no `external=` param → add `external=react,react-dom`
|
|
168
|
+
* 2. If `external=X` exists but no `react` → append `,react,react-dom`
|
|
169
|
+
* 3. If has `react` but no `react-dom` → append `,react-dom`
|
|
170
|
+
* 4. If has both `react` AND `react-dom` → leave alone
|
|
171
|
+
*
|
|
172
|
+
* @param code - Source code to process
|
|
173
|
+
* @param _cacheDir - Unused (kept for API compatibility)
|
|
174
|
+
* @param hash - Hash for logging
|
|
175
|
+
* @param reactVersion - React version for deps param (defaults to REACT_VERSION)
|
|
165
176
|
*/
|
|
166
177
|
export function bundleHttpImports(
|
|
167
178
|
code: string,
|
|
168
179
|
_cacheDir: string,
|
|
169
180
|
hash: string,
|
|
181
|
+
reactVersion?: string,
|
|
170
182
|
): string | Promise<string> {
|
|
171
183
|
const has = hasHttpImports(code);
|
|
172
184
|
logger.debug(`${LOG_PREFIX} Check: hasHttp=${has}, hash=${hash.slice(0, 8)}`);
|
|
173
185
|
if (!has) return code;
|
|
174
186
|
|
|
187
|
+
const version = reactVersion ?? REACT_VERSION;
|
|
188
|
+
|
|
175
189
|
return replaceSpecifiers(code, (specifier) => {
|
|
190
|
+
// Handle relative esm.sh paths like "/react-dom?target=es2022" or "/hoist-non-react-statics@..."
|
|
191
|
+
// These are returned by esm.sh stub modules and need to be converted to full URLs
|
|
192
|
+
if (specifier.startsWith("/") && !specifier.startsWith("//")) {
|
|
193
|
+
const fullUrl = `https://esm.sh${specifier}`;
|
|
194
|
+
// Recursively process as full URL (will add external params if needed)
|
|
195
|
+
const isReactPackage = /^\/react(-dom)?(@|\/|\?|$)/.test(specifier);
|
|
196
|
+
if (isReactPackage) {
|
|
197
|
+
// React packages - just ensure target and return full URL
|
|
198
|
+
if (!specifier.includes("target=")) {
|
|
199
|
+
const joiner = specifier.includes("?") ? "&" : "?";
|
|
200
|
+
return `${fullUrl}${joiner}target=es2022`;
|
|
201
|
+
}
|
|
202
|
+
return fullUrl;
|
|
203
|
+
}
|
|
204
|
+
// Non-React packages - add external params
|
|
205
|
+
const params: string[] = [];
|
|
206
|
+
if (!specifier.includes("target=")) params.push("target=es2022");
|
|
207
|
+
if (!specifier.includes("external=")) params.push("external=react,react-dom");
|
|
208
|
+
if (!specifier.includes("deps=")) params.push(`deps=react@${version},react-dom@${version}`);
|
|
209
|
+
if (params.length === 0) return fullUrl;
|
|
210
|
+
const joiner = specifier.includes("?") ? "&" : "?";
|
|
211
|
+
return `${fullUrl}${joiner}${params.join("&")}`;
|
|
212
|
+
}
|
|
213
|
+
|
|
176
214
|
const isEsmSh = specifier.startsWith("https://esm.sh/") ||
|
|
177
215
|
specifier.startsWith("http://esm.sh/");
|
|
178
216
|
const isVfEsm = specifier.startsWith("https://esm.veryfront.com/");
|
|
179
217
|
if (!isEsmSh && !isVfEsm) return null;
|
|
180
218
|
|
|
219
|
+
// Don't modify React/ReactDOM package URLs themselves
|
|
181
220
|
const isReactPackage = /\/react(-dom)?(@|\/|$)/.test(specifier);
|
|
221
|
+
if (isReactPackage) {
|
|
222
|
+
// Just ensure target is set for React packages
|
|
223
|
+
if (!specifier.includes("target=")) {
|
|
224
|
+
const joiner = specifier.includes("?") ? "&" : "?";
|
|
225
|
+
return `${specifier}${joiner}target=es2022`;
|
|
226
|
+
}
|
|
227
|
+
return null;
|
|
228
|
+
}
|
|
182
229
|
|
|
230
|
+
// For non-React packages: ensure external=react,react-dom and deps
|
|
183
231
|
const params: string[] = [];
|
|
184
232
|
|
|
185
233
|
if (!specifier.includes("target=")) {
|
|
186
234
|
params.push("target=es2022");
|
|
187
235
|
}
|
|
188
236
|
|
|
189
|
-
//
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
237
|
+
// Handle external param - ensure both react AND react-dom are externalized
|
|
238
|
+
const hasExternal = specifier.includes("external=");
|
|
239
|
+
const hasReactExternal = specifier.includes("external=react") ||
|
|
240
|
+
/external=[^&]*\breact\b/.test(specifier);
|
|
241
|
+
const hasReactDomExternal = /external=[^&]*react-dom/.test(specifier);
|
|
242
|
+
|
|
243
|
+
if (!hasExternal) {
|
|
244
|
+
// No external param - add both
|
|
245
|
+
params.push("external=react,react-dom");
|
|
246
|
+
} else if (!hasReactExternal) {
|
|
247
|
+
// Has external but no react - append react,react-dom
|
|
248
|
+
// This requires modifying existing param, so we'll use URL parsing
|
|
249
|
+
try {
|
|
250
|
+
const url = new URL(specifier);
|
|
251
|
+
const existing = url.searchParams.get("external") || "";
|
|
252
|
+
url.searchParams.set("external", `${existing},react,react-dom`);
|
|
253
|
+
// Return full modified URL and skip other param additions
|
|
254
|
+
if (!specifier.includes("target=")) {
|
|
255
|
+
url.searchParams.set("target", "es2022");
|
|
256
|
+
}
|
|
257
|
+
if (!specifier.includes("deps=")) {
|
|
258
|
+
url.searchParams.set("deps", `react@${version},react-dom@${version}`);
|
|
259
|
+
}
|
|
260
|
+
logger.debug(`${LOG_PREFIX} ${specifier} -> ${url.toString()}`);
|
|
261
|
+
return url.toString();
|
|
262
|
+
} catch {
|
|
263
|
+
// Fallback: just add as new param (may create duplicate)
|
|
264
|
+
params.push("external=react,react-dom");
|
|
195
265
|
}
|
|
196
|
-
|
|
197
|
-
|
|
266
|
+
} else if (!hasReactDomExternal) {
|
|
267
|
+
// Has react but not react-dom - append react-dom
|
|
268
|
+
try {
|
|
269
|
+
const url = new URL(specifier);
|
|
270
|
+
const existing = url.searchParams.get("external") || "";
|
|
271
|
+
url.searchParams.set("external", `${existing},react-dom`);
|
|
272
|
+
if (!specifier.includes("target=")) {
|
|
273
|
+
url.searchParams.set("target", "es2022");
|
|
274
|
+
}
|
|
275
|
+
if (!specifier.includes("deps=")) {
|
|
276
|
+
url.searchParams.set("deps", `react@${version},react-dom@${version}`);
|
|
277
|
+
}
|
|
278
|
+
logger.debug(`${LOG_PREFIX} ${specifier} -> ${url.toString()}`);
|
|
279
|
+
return url.toString();
|
|
280
|
+
} catch {
|
|
281
|
+
// Fallback
|
|
282
|
+
params.push("external=react-dom");
|
|
198
283
|
}
|
|
199
284
|
}
|
|
285
|
+
// else: has both react and react-dom - no external changes needed
|
|
286
|
+
|
|
287
|
+
if (!specifier.includes("deps=")) {
|
|
288
|
+
params.push(`deps=react@${version},react-dom@${version}`);
|
|
289
|
+
}
|
|
200
290
|
|
|
201
291
|
if (params.length === 0) return null;
|
|
202
292
|
|
|
@@ -12,6 +12,7 @@ import * as dntShim from "../../../_dnt.shims.js";
|
|
|
12
12
|
import { createFileSystem, exists } from "../../platform/compat/fs.js";
|
|
13
13
|
import { isAbsolute, join } from "../../platform/compat/path/index.js";
|
|
14
14
|
import { cwd } from "../../platform/compat/process.js";
|
|
15
|
+
import { isDeno } from "../../platform/compat/runtime.js";
|
|
15
16
|
import { rendererLogger as logger } from "../../utils/index.js";
|
|
16
17
|
import { simpleHash } from "../../utils/hash-utils.js";
|
|
17
18
|
import { LRUCache } from "../../utils/lru-wrapper.js";
|
|
@@ -19,8 +20,7 @@ import { withSpan } from "../../observability/tracing/otlp-setup.js";
|
|
|
19
20
|
import { SpanNames } from "../../observability/tracing/span-names.js";
|
|
20
21
|
import { resolveImport } from "../../modules/import-map/resolver.js";
|
|
21
22
|
import type { ImportMapConfig } from "../../modules/import-map/types.js";
|
|
22
|
-
import {
|
|
23
|
-
import { getDenoNpmReactMap, getReactImportMap, REACT_VERSION } from "./package-registry.js";
|
|
23
|
+
import { getReactImportMap, REACT_VERSION } from "./package-registry.js";
|
|
24
24
|
import { parseImports, replaceSpecifiers } from "./lexer.js";
|
|
25
25
|
import { CacheBackends, createDistributedCacheAccessor } from "../../cache/backend.js";
|
|
26
26
|
import {
|
|
@@ -34,9 +34,6 @@ const getDistributedCache = createDistributedCacheAccessor(
|
|
|
34
34
|
"HTTP-CACHE",
|
|
35
35
|
);
|
|
36
36
|
|
|
37
|
-
/** TTL for cached modules in distributed cache (uses centralized config) */
|
|
38
|
-
const DISTRIBUTED_CACHE_TTL_SECONDS = HTTP_MODULE_DISTRIBUTED_TTL_SEC;
|
|
39
|
-
|
|
40
37
|
type CacheOptions = {
|
|
41
38
|
cacheDir: string;
|
|
42
39
|
importMap: ImportMapConfig;
|
|
@@ -47,6 +44,12 @@ type CacheOptions = {
|
|
|
47
44
|
const cachedPaths = new LRUCache<string, string>({ maxEntries: HTTP_MODULE_CACHE_MAX_ENTRIES });
|
|
48
45
|
const processingStack = new Set<string>();
|
|
49
46
|
|
|
47
|
+
/** Tracks last TTL refresh per hash. Refresh every 4h to keep 20h+ remaining (24h total). */
|
|
48
|
+
const lastDistributedRefresh = new LRUCache<string, number>({
|
|
49
|
+
maxEntries: HTTP_MODULE_CACHE_MAX_ENTRIES,
|
|
50
|
+
});
|
|
51
|
+
const DISTRIBUTED_REFRESH_INTERVAL_MS = 4 * 60 * 60 * 1000;
|
|
52
|
+
|
|
50
53
|
function ensureAbsoluteDir(path: string): string {
|
|
51
54
|
return isAbsolute(path) ? path : join(cwd(), path);
|
|
52
55
|
}
|
|
@@ -58,13 +61,23 @@ function isHttpUrl(specifier: string): boolean {
|
|
|
58
61
|
/**
|
|
59
62
|
* Check if a URL is for React core packages.
|
|
60
63
|
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
* React instance.
|
|
64
|
+
* React core modules (react, react-dom) must NOT be cached/bundled.
|
|
65
|
+
* Instead, all packages use external=react and import from the same esm.sh URL.
|
|
66
|
+
* This prevents multiple React instances which causes "useContext is null" errors.
|
|
65
67
|
*/
|
|
66
|
-
function isReactCoreUrl(
|
|
67
|
-
|
|
68
|
+
function isReactCoreUrl(url: string): boolean {
|
|
69
|
+
try {
|
|
70
|
+
const parsed = new URL(url);
|
|
71
|
+
if (!parsed.hostname.includes("esm.sh")) return false;
|
|
72
|
+
|
|
73
|
+
// Extract package name from esm.sh pathname
|
|
74
|
+
// Formats: /react@version, /v150/react@version, /stable/react@version
|
|
75
|
+
const pathname = parsed.pathname.replace(/^\/(v\d+|stable)\//, "/");
|
|
76
|
+
const match = pathname.match(/^\/(react|react-dom)(@[\d.]+)?(?:\/|$|\?)/);
|
|
77
|
+
return match !== null;
|
|
78
|
+
} catch {
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
68
81
|
}
|
|
69
82
|
|
|
70
83
|
function isExternalScheme(specifier: string): boolean {
|
|
@@ -132,26 +145,8 @@ function resolveBareSpecifier(
|
|
|
132
145
|
importMap: ImportMapConfig,
|
|
133
146
|
reactVersion: string = REACT_VERSION,
|
|
134
147
|
): string {
|
|
135
|
-
//
|
|
136
|
-
//
|
|
137
|
-
// See: https://deno.com/blog/not-using-npm-specifiers-doing-it-wrong
|
|
138
|
-
if (isDeno) {
|
|
139
|
-
const denoReactMap = getDenoNpmReactMap(reactVersion);
|
|
140
|
-
const denoMatch = denoReactMap[specifier];
|
|
141
|
-
if (denoMatch) return denoMatch;
|
|
142
|
-
|
|
143
|
-
// For unknown react/* or react-dom/* subpaths, construct npm: specifiers
|
|
144
|
-
if (specifier.startsWith("react/") && !specifier.startsWith("react-dom")) {
|
|
145
|
-
const subpath = specifier.slice("react/".length);
|
|
146
|
-
return `npm:react@${reactVersion}/${subpath}`;
|
|
147
|
-
}
|
|
148
|
-
if (specifier.startsWith("react-dom/")) {
|
|
149
|
-
const subpath = specifier.slice("react-dom/".length);
|
|
150
|
-
return `npm:react-dom@${reactVersion}/${subpath}`;
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
// For non-Deno runtimes: Use esm.sh URLs with consistent versioning.
|
|
148
|
+
// Use esm.sh URLs for React - NO npm: specifiers per plan requirements.
|
|
149
|
+
// All packages use external=react to share the same React instance.
|
|
155
150
|
const reactMap = getReactImportMap(reactVersion);
|
|
156
151
|
const reactMapped = reactMap[specifier];
|
|
157
152
|
if (reactMapped) return reactMapped;
|
|
@@ -194,22 +189,28 @@ async function cacheHttpModule(url: string, options: CacheOptions): Promise<stri
|
|
|
194
189
|
if (await exists(cachePath)) {
|
|
195
190
|
cachedPaths.set(cacheKey, cachePath);
|
|
196
191
|
|
|
197
|
-
//
|
|
198
|
-
//
|
|
199
|
-
// Synchronous to guarantee data is stored before other pods need it
|
|
192
|
+
// Refresh distributed cache TTL so bundles outlive transforms that reference them.
|
|
193
|
+
// Without this, bundles expire (24h) while SSR transforms (6h) are still valid.
|
|
200
194
|
const distributed = await getDistributedCache();
|
|
201
195
|
if (distributed) {
|
|
202
196
|
const hash = simpleHash(normalizedUrl);
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
197
|
+
const hashStr = String(hash);
|
|
198
|
+
const now = Date.now();
|
|
199
|
+
const lastRefresh = lastDistributedRefresh.get(hashStr);
|
|
200
|
+
const needsRefresh = !lastRefresh || (now - lastRefresh > DISTRIBUTED_REFRESH_INTERVAL_MS);
|
|
201
|
+
|
|
202
|
+
if (needsRefresh) {
|
|
203
|
+
try {
|
|
206
204
|
const code = await fs.readTextFile(cachePath);
|
|
207
|
-
await
|
|
208
|
-
|
|
205
|
+
await Promise.all([
|
|
206
|
+
distributed.set(`code:${hash}`, code, HTTP_MODULE_DISTRIBUTED_TTL_SEC),
|
|
207
|
+
distributed.set(`hash:${hash}`, normalizedUrl, HTTP_MODULE_DISTRIBUTED_TTL_SEC),
|
|
208
|
+
]);
|
|
209
|
+
lastDistributedRefresh.set(hashStr, now);
|
|
210
|
+
logger.debug("[HTTP-CACHE] Refreshed distributed cache TTL", { hash });
|
|
211
|
+
} catch (error) {
|
|
212
|
+
logger.debug("[HTTP-CACHE] Distributed cache refresh failed", { hash, error });
|
|
209
213
|
}
|
|
210
|
-
} catch (error) {
|
|
211
|
-
// Log but don't fail - backfill is best-effort
|
|
212
|
-
logger.debug("[HTTP-CACHE] Backfill failed, continuing", { hash, error });
|
|
213
214
|
}
|
|
214
215
|
}
|
|
215
216
|
|
|
@@ -288,9 +289,9 @@ async function cacheHttpModule(url: string, options: CacheOptions): Promise<stri
|
|
|
288
289
|
const hash = simpleHash(normalizedUrl);
|
|
289
290
|
try {
|
|
290
291
|
await Promise.all([
|
|
291
|
-
distributed.set(normalizedUrl, code,
|
|
292
|
-
distributed.set(`code:${hash}`, code,
|
|
293
|
-
distributed.set(`hash:${hash}`, normalizedUrl,
|
|
292
|
+
distributed.set(normalizedUrl, code, HTTP_MODULE_DISTRIBUTED_TTL_SEC),
|
|
293
|
+
distributed.set(`code:${hash}`, code, HTTP_MODULE_DISTRIBUTED_TTL_SEC),
|
|
294
|
+
distributed.set(`hash:${hash}`, normalizedUrl, HTTP_MODULE_DISTRIBUTED_TTL_SEC),
|
|
294
295
|
]);
|
|
295
296
|
} catch (error) {
|
|
296
297
|
logger.debug("[HTTP-CACHE] Distributed cache set failed", { url: normalizedUrl, error });
|
|
@@ -327,6 +328,13 @@ async function resolveSpecifier(
|
|
|
327
328
|
if (!baseUrl || !isHttpUrl(baseUrl)) return null;
|
|
328
329
|
|
|
329
330
|
const resolved = new URL(specifier, baseUrl).toString();
|
|
331
|
+
|
|
332
|
+
// For React core URLs: return the full esm.sh URL (not cached, to prevent multiple instances)
|
|
333
|
+
// This transforms relative paths like "/react-dom?..." to "https://esm.sh/react-dom?..."
|
|
334
|
+
if (isReactCoreUrl(resolved)) {
|
|
335
|
+
return normalizeHttpUrl(resolved);
|
|
336
|
+
}
|
|
337
|
+
|
|
330
338
|
const cached = await cacheHttpModule(resolved, options);
|
|
331
339
|
return cached ? `file://${cached}` : null;
|
|
332
340
|
}
|
|
@@ -51,9 +51,11 @@ function normalizeVersionedSpecifier(specifier: string): string {
|
|
|
51
51
|
|
|
52
52
|
const REACT_IMPORT_MAP: Record<string, string> = {
|
|
53
53
|
react: `https://esm.sh/react@${REACT_DEFAULT_VERSION}?target=es2022`,
|
|
54
|
-
"react-dom": `https://esm.sh/react-dom@${REACT_DEFAULT_VERSION}?target=es2022`,
|
|
55
|
-
"react-dom/client":
|
|
56
|
-
|
|
54
|
+
"react-dom": `https://esm.sh/react-dom@${REACT_DEFAULT_VERSION}?external=react&target=es2022`,
|
|
55
|
+
"react-dom/client":
|
|
56
|
+
`https://esm.sh/react-dom@${REACT_DEFAULT_VERSION}/client?external=react&target=es2022`,
|
|
57
|
+
"react-dom/server":
|
|
58
|
+
`https://esm.sh/react-dom@${REACT_DEFAULT_VERSION}/server?external=react&target=es2022`,
|
|
57
59
|
"react/jsx-runtime": `https://esm.sh/react@${REACT_DEFAULT_VERSION}/jsx-runtime?target=es2022`,
|
|
58
60
|
"react/jsx-dev-runtime":
|
|
59
61
|
`https://esm.sh/react@${REACT_DEFAULT_VERSION}/jsx-dev-runtime?target=es2022`,
|
|
@@ -9,23 +9,35 @@
|
|
|
9
9
|
export const DEFAULT_REACT_VERSION = "19.1.1";
|
|
10
10
|
export const TAILWIND_VERSION = "4.1.8";
|
|
11
11
|
|
|
12
|
-
/**
|
|
13
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Validate React version format (semver: X.Y.Z).
|
|
14
|
+
* Returns true if valid, false otherwise.
|
|
15
|
+
*/
|
|
16
|
+
export function isValidReactVersion(version: string): boolean {
|
|
17
|
+
return /^\d+\.\d+\.\d+$/.test(version);
|
|
18
|
+
}
|
|
14
19
|
|
|
15
20
|
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
21
|
+
* Validate and normalize React version.
|
|
22
|
+
* Returns the version if valid, or DEFAULT_REACT_VERSION if invalid.
|
|
23
|
+
* Logs a warning if the version is invalid.
|
|
18
24
|
*/
|
|
19
|
-
export function
|
|
20
|
-
|
|
25
|
+
export function normalizeReactVersion(version: string | undefined): string {
|
|
26
|
+
if (!version) return DEFAULT_REACT_VERSION;
|
|
27
|
+
if (isValidReactVersion(version)) return version;
|
|
28
|
+
console.warn(
|
|
29
|
+
`[VERYFRONT] Invalid React version format "${version}" (expected X.Y.Z). Using default: ${DEFAULT_REACT_VERSION}`,
|
|
30
|
+
);
|
|
31
|
+
return DEFAULT_REACT_VERSION;
|
|
21
32
|
}
|
|
22
33
|
|
|
23
34
|
/**
|
|
24
|
-
*
|
|
25
|
-
*
|
|
35
|
+
* @deprecated Global React version is no longer supported.
|
|
36
|
+
* Use config.react.version passed through TransformOptions instead.
|
|
37
|
+
* This function now always returns DEFAULT_REACT_VERSION.
|
|
26
38
|
*/
|
|
27
39
|
export function getReactVersion(): string {
|
|
28
|
-
return
|
|
40
|
+
return DEFAULT_REACT_VERSION;
|
|
29
41
|
}
|
|
30
42
|
|
|
31
43
|
/** @deprecated Use DEFAULT_REACT_VERSION or getReactVersion() */
|
|
@@ -50,8 +62,15 @@ export const REACT_VERSION = DEFAULT_REACT_VERSION;
|
|
|
50
62
|
*/
|
|
51
63
|
export const TRANSFORM_CACHE_VERSION = 12;
|
|
52
64
|
|
|
53
|
-
|
|
54
|
-
|
|
65
|
+
/** csstype version - must match deno.json for type consistency */
|
|
66
|
+
const CSSTYPE_VERSION = "3.2.3";
|
|
67
|
+
|
|
68
|
+
/** Build esm.sh URL with deps=csstype for React packages (ensures type consistency) */
|
|
69
|
+
function esmShReact(pkg: string, version: string, path = "", external = false): string {
|
|
70
|
+
const params = external
|
|
71
|
+
? [`external=react`, `target=es2022`, `deps=csstype@${CSSTYPE_VERSION}`]
|
|
72
|
+
: [`target=es2022`, `deps=csstype@${CSSTYPE_VERSION}`];
|
|
73
|
+
return `https://esm.sh/${pkg}@${version}${path}?${params.join("&")}`;
|
|
55
74
|
}
|
|
56
75
|
|
|
57
76
|
/**
|
|
@@ -78,12 +97,12 @@ export function getEsmShUrl(pkg: string, version: string, external?: readonly st
|
|
|
78
97
|
export function getReactUrls(version?: string): Record<string, string> {
|
|
79
98
|
const v = version ?? getReactVersion();
|
|
80
99
|
return {
|
|
81
|
-
react:
|
|
82
|
-
"react-dom":
|
|
83
|
-
"react-dom/client":
|
|
84
|
-
"react-dom/server":
|
|
85
|
-
"react/jsx-runtime":
|
|
86
|
-
"react/jsx-dev-runtime":
|
|
100
|
+
react: esmShReact("react", v),
|
|
101
|
+
"react-dom": esmShReact("react-dom", v, "", true),
|
|
102
|
+
"react-dom/client": esmShReact("react-dom", v, "/client", true),
|
|
103
|
+
"react-dom/server": esmShReact("react-dom", v, "/server", true),
|
|
104
|
+
"react/jsx-runtime": esmShReact("react", v, "/jsx-runtime", true),
|
|
105
|
+
"react/jsx-dev-runtime": esmShReact("react", v, "/jsx-dev-runtime", true),
|
|
87
106
|
};
|
|
88
107
|
}
|
|
89
108
|
|
|
@@ -102,30 +121,25 @@ export function getReactImportMap(version?: string): Record<string, string> {
|
|
|
102
121
|
return {
|
|
103
122
|
...getReactUrls(v),
|
|
104
123
|
// Prefix match for any react/* subpath imports
|
|
105
|
-
"react/":
|
|
124
|
+
"react/": esmShReact("react", v, "/", true),
|
|
106
125
|
};
|
|
107
126
|
}
|
|
108
127
|
|
|
109
128
|
/**
|
|
110
|
-
* Get React
|
|
111
|
-
* Uses
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
* Benefits over esm.sh:
|
|
115
|
-
* - Automatic semantic version deduplication (like Node's node_modules)
|
|
116
|
-
* - No manual external= flags or shared-*.ts wrapper files needed
|
|
117
|
-
* - Native support in Deno 2+
|
|
129
|
+
* Get React esm.sh URLs for Deno SSR.
|
|
130
|
+
* Uses esm.sh for both SSR and browser to ensure identical React instances.
|
|
131
|
+
* All sub-packages use external=react to share the same React instance.
|
|
118
132
|
*
|
|
119
133
|
* @param version - React version to use (defaults to REACT_VERSION)
|
|
120
134
|
*/
|
|
121
135
|
export function getDenoNpmReactMap(version?: string): Record<string, string> {
|
|
122
136
|
const v = version ?? getReactVersion();
|
|
123
137
|
return {
|
|
124
|
-
"react":
|
|
125
|
-
"react-dom":
|
|
126
|
-
"react-dom/client":
|
|
127
|
-
"react-dom/server":
|
|
128
|
-
"react/jsx-runtime":
|
|
129
|
-
"react/jsx-dev-runtime":
|
|
138
|
+
"react": esmShReact("react", v),
|
|
139
|
+
"react-dom": esmShReact("react-dom", v, "", true),
|
|
140
|
+
"react-dom/client": esmShReact("react-dom", v, "/client", true),
|
|
141
|
+
"react-dom/server": esmShReact("react-dom", v, "/server", true),
|
|
142
|
+
"react/jsx-runtime": esmShReact("react", v, "/jsx-runtime", true),
|
|
143
|
+
"react/jsx-dev-runtime": esmShReact("react", v, "/jsx-dev-runtime", true),
|
|
130
144
|
};
|
|
131
145
|
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { replaceSpecifiers } from "./lexer.js";
|
|
2
|
-
import {
|
|
3
|
-
import { isDeno } from "../../platform/compat/runtime.js";
|
|
4
|
-
import { getLocalReactPaths } from "../../platform/compat/react-paths.js";
|
|
2
|
+
import { getReactImportMap, REACT_VERSION } from "./package-registry.js";
|
|
5
3
|
|
|
6
4
|
const srcDir = new URL(".", import.meta.url).pathname.replace(
|
|
7
5
|
/\/(build|src)\/transforms\/esm\/?$/,
|
|
@@ -28,12 +26,10 @@ export async function resolveReactImports(
|
|
|
28
26
|
return replaceSpecifiers(code, (specifier) => reactImports[specifier] ?? null);
|
|
29
27
|
}
|
|
30
28
|
|
|
31
|
-
// For
|
|
32
|
-
// For Node/Bun SSR: Use local node_modules paths (auto-deduplicated by Node)
|
|
33
|
-
// See: https://deno.com/blog/not-using-npm-specifiers-doing-it-wrong
|
|
29
|
+
// For SSR: Use esm.sh URLs consistently (NO npm: specifiers per plan requirements)
|
|
34
30
|
const ssrImports: Record<string, string> = {
|
|
35
31
|
...getVeryfrontModulePaths(),
|
|
36
|
-
...
|
|
32
|
+
...reactImports,
|
|
37
33
|
};
|
|
38
34
|
|
|
39
35
|
return replaceSpecifiers(code, (specifier) => ssrImports[specifier] ?? null);
|
|
@@ -9,6 +9,8 @@ export interface TransformOptions {
|
|
|
9
9
|
ssr?: boolean;
|
|
10
10
|
apiBaseUrl?: string;
|
|
11
11
|
studioEmbed?: boolean;
|
|
12
|
+
/** React version for transforms (from project config, defaults to DEFAULT_REACT_VERSION) */
|
|
13
|
+
reactVersion?: string;
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
export interface TransformContext {
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
type FileSystem,
|
|
15
15
|
isNotFoundError,
|
|
16
16
|
} from "../../../../platform/compat/fs.js";
|
|
17
|
+
import { TRANSFORM_CACHE_VERSION } from "../../../esm/package-registry.js";
|
|
17
18
|
import { LOG_PREFIX_MDX_LOADER } from "../constants.js";
|
|
18
19
|
|
|
19
20
|
// Local filesystem for cache operations (not project's FSAdapter which may be remote/read-only)
|
|
@@ -150,3 +151,86 @@ export async function clearESMDiskCache(): Promise<void> {
|
|
|
150
151
|
}
|
|
151
152
|
}
|
|
152
153
|
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Convert a project-relative file path to MDX-ESM cache key format.
|
|
157
|
+
*
|
|
158
|
+
* @param filePath - Project-relative path like "lib/ChatContext.tsx" or absolute path
|
|
159
|
+
* @param projectDir - Project directory to strip from absolute paths
|
|
160
|
+
* @returns Cache key like "v10:_vf_modules/lib/ChatContext.js"
|
|
161
|
+
*/
|
|
162
|
+
function toMdxEsmCacheKey(filePath: string, projectDir?: string): string {
|
|
163
|
+
// Strip project directory prefix if present
|
|
164
|
+
let relativePath = filePath;
|
|
165
|
+
if (projectDir && filePath.startsWith(projectDir)) {
|
|
166
|
+
relativePath = filePath.slice(projectDir.length).replace(/^\/+/, "");
|
|
167
|
+
}
|
|
168
|
+
// Strip leading slashes
|
|
169
|
+
relativePath = relativePath.replace(/^\/+/, "");
|
|
170
|
+
|
|
171
|
+
// Convert extension to .js
|
|
172
|
+
const jsPath = relativePath.replace(/\.(tsx?|jsx|mdx)$/, ".js");
|
|
173
|
+
|
|
174
|
+
// Build the versioned key in MDX-ESM format
|
|
175
|
+
return `v${TRANSFORM_CACHE_VERSION}:_vf_modules/${jsPath}`;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Look up a module in the MDX-ESM cache.
|
|
180
|
+
*
|
|
181
|
+
* This allows other loaders (like SSR loader) to reuse modules that
|
|
182
|
+
* MDX-ESM has already transformed and cached, preventing duplicate
|
|
183
|
+
* module instances (which breaks React context, etc.).
|
|
184
|
+
*
|
|
185
|
+
* @param filePath - Project-relative file path like "lib/ChatContext.tsx"
|
|
186
|
+
* @param cacheDir - The MDX-ESM cache directory for this project/contentSource
|
|
187
|
+
* @param projectDir - Project directory to strip from absolute paths
|
|
188
|
+
* @param contentHash - Optional content hash to validate cached file freshness
|
|
189
|
+
* @returns The cached file path if found and valid, null otherwise
|
|
190
|
+
*/
|
|
191
|
+
export async function lookupMdxEsmCache(
|
|
192
|
+
filePath: string,
|
|
193
|
+
cacheDir: string,
|
|
194
|
+
projectDir?: string,
|
|
195
|
+
contentHash?: string,
|
|
196
|
+
): Promise<string | null> {
|
|
197
|
+
const cache = await getModulePathCache(cacheDir);
|
|
198
|
+
const cacheKey = toMdxEsmCacheKey(filePath, projectDir);
|
|
199
|
+
|
|
200
|
+
const cachedPath = cache.get(cacheKey);
|
|
201
|
+
if (!cachedPath) {
|
|
202
|
+
return null;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
// Verify the cached file still exists
|
|
206
|
+
try {
|
|
207
|
+
const stat = await getLocalFs().stat(cachedPath);
|
|
208
|
+
if (!stat?.isFile) {
|
|
209
|
+
cache.delete(cacheKey);
|
|
210
|
+
return null;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
// If contentHash provided, validate the cached file contains matching hash
|
|
214
|
+
// The cached filename includes the content hash (e.g., module.abc123.js)
|
|
215
|
+
if (contentHash) {
|
|
216
|
+
const filename = cachedPath.split("/").pop() ?? "";
|
|
217
|
+
if (!filename.includes(contentHash.slice(0, 8))) {
|
|
218
|
+
logger.debug(
|
|
219
|
+
`${LOG_PREFIX_MDX_LOADER} Cache hash mismatch, invalidating: ${filePath}`,
|
|
220
|
+
);
|
|
221
|
+
cache.delete(cacheKey);
|
|
222
|
+
return null;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
logger.debug(
|
|
227
|
+
`${LOG_PREFIX_MDX_LOADER} SSR reusing MDX-ESM cache: ${filePath} -> ${cachedPath}`,
|
|
228
|
+
);
|
|
229
|
+
return cachedPath;
|
|
230
|
+
} catch {
|
|
231
|
+
// File no longer exists, remove stale entry
|
|
232
|
+
cache.delete(cacheKey);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
return null;
|
|
236
|
+
}
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import { join } from "../../../../deps/deno.land/std@0.220.0/path/mod.js";
|
|
11
|
-
import React from "react";
|
|
11
|
+
import React from "../../../../deps/esm.sh/react@19.1.1.js";
|
|
12
12
|
import { rendererLogger as logger } from "../../../utils/index.js";
|
|
13
13
|
import { withSpan } from "../../../observability/tracing/otlp-setup.js";
|
|
14
14
|
import { SpanNames } from "../../../observability/tracing/span-names.js";
|
|
@@ -201,6 +201,7 @@ async function processVfModuleImports(
|
|
|
201
201
|
adapter,
|
|
202
202
|
projectDir,
|
|
203
203
|
context.projectId,
|
|
204
|
+
{ reactVersion: context.reactVersion },
|
|
204
205
|
);
|
|
205
206
|
|
|
206
207
|
const fetchStart = performance.now();
|
|
@@ -568,6 +568,7 @@ async function doFetchAndCacheModule(
|
|
|
568
568
|
projectId,
|
|
569
569
|
dev: true,
|
|
570
570
|
ssr: true,
|
|
571
|
+
reactVersion: context.reactVersion,
|
|
571
572
|
});
|
|
572
573
|
} catch (transformError) {
|
|
573
574
|
logger.error(`${LOG_PREFIX_MDX_LOADER} Transform failed for module`, {
|
|
@@ -685,7 +686,7 @@ export function createModuleFetcherContext(
|
|
|
685
686
|
adapter: RuntimeAdapter,
|
|
686
687
|
projectDir: string,
|
|
687
688
|
projectId: string,
|
|
688
|
-
options?: { isLocalDev?: boolean; projectSlug?: string },
|
|
689
|
+
options?: { isLocalDev?: boolean; projectSlug?: string; reactVersion?: string },
|
|
689
690
|
): ModuleFetcherContext {
|
|
690
691
|
return {
|
|
691
692
|
esmCacheDir,
|
|
@@ -10,6 +10,8 @@ export interface ESMLoaderContext {
|
|
|
10
10
|
projectDir?: string;
|
|
11
11
|
projectSlug?: string;
|
|
12
12
|
contentSourceId?: string;
|
|
13
|
+
/** React version for transforms (from project config) */
|
|
14
|
+
reactVersion?: string;
|
|
13
15
|
}
|
|
14
16
|
|
|
15
17
|
export interface FSAdapter {
|
|
@@ -51,6 +53,8 @@ export interface ModuleFetcherContext {
|
|
|
51
53
|
* This prevents infinite recursion when A imports B which imports A.
|
|
52
54
|
*/
|
|
53
55
|
inFlightModules?: Map<string, Promise<string | null>>;
|
|
56
|
+
/** React version for transforms (from project config) */
|
|
57
|
+
reactVersion?: string;
|
|
54
58
|
}
|
|
55
59
|
|
|
56
60
|
export interface JSXTransform {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { rendererLogger as logger } from "../../utils/index.js";
|
|
2
2
|
import { LRUCache } from "../../utils/lru-wrapper.js";
|
|
3
3
|
import { MDX_RENDERER_MAX_ENTRIES, MDX_RENDERER_TTL_MS } from "../../utils/constants/cache.js";
|
|
4
|
-
import React from "react";
|
|
4
|
+
import React from "../../../deps/esm.sh/react@19.1.1.js";
|
|
5
5
|
import { type ESMLoaderContext, loadModuleESM } from "./esm-module-loader/index.js";
|
|
6
6
|
import { type ParsedMDX, parseMDXCode } from "./parser.js";
|
|
7
7
|
import type { MDXComponents, MDXFrontmatter, MDXGlobals, MDXModule } from "./types.js";
|