veryfront 0.1.128 → 0.1.129
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/cli/router.d.ts +0 -5
- package/esm/cli/router.d.ts.map +1 -1
- package/esm/cli/router.js +30 -2
- package/esm/cli/shared/update-check.d.ts +4 -0
- package/esm/cli/shared/update-check.d.ts.map +1 -0
- package/esm/cli/shared/update-check.js +97 -0
- package/esm/deno.d.ts +5 -0
- package/esm/deno.js +13 -8
- package/esm/src/channels/control-plane.d.ts.map +1 -1
- package/esm/src/channels/control-plane.js +5 -5
- package/esm/src/channels/invoke.d.ts +1 -1
- package/esm/src/channels/invoke.d.ts.map +1 -1
- package/esm/src/channels/invoke.js +6 -6
- package/esm/src/chat/index.d.ts +12 -24
- package/esm/src/chat/index.d.ts.map +1 -1
- package/esm/src/chat/index.js +5 -25
- package/esm/src/config/env.d.ts.map +1 -1
- package/esm/src/config/env.js +18 -10
- package/esm/src/data/static-data-fetcher.d.ts +3 -0
- package/esm/src/data/static-data-fetcher.d.ts.map +1 -1
- package/esm/src/data/static-data-fetcher.js +29 -25
- package/esm/src/data/static-paths-fetcher.d.ts.map +1 -1
- package/esm/src/data/static-paths-fetcher.js +3 -2
- package/esm/src/errors/logging.d.ts.map +1 -1
- package/esm/src/errors/logging.js +16 -7
- package/esm/src/errors/user-friendly/error-formatter.d.ts.map +1 -1
- package/esm/src/errors/user-friendly/error-formatter.js +9 -25
- package/esm/src/fs/index.d.ts +11 -12
- package/esm/src/fs/index.d.ts.map +1 -1
- package/esm/src/fs/index.js +11 -24
- package/esm/src/html/dev-scripts.d.ts.map +1 -1
- package/esm/src/html/dev-scripts.js +5 -8
- package/esm/src/html/html-escape.d.ts +1 -0
- package/esm/src/html/html-escape.d.ts.map +1 -1
- package/esm/src/html/html-escape.js +3 -0
- package/esm/src/html/html-injection.js +2 -2
- package/esm/src/html/html-shell-generator.d.ts +5 -2
- package/esm/src/html/html-shell-generator.d.ts.map +1 -1
- package/esm/src/html/html-shell-generator.js +41 -30
- package/esm/src/html/hydration-script-builder/dev-client-renderer.js +2 -2
- package/esm/src/html/hydration-script-builder/dev-component-manifest.js +2 -2
- package/esm/src/html/hydration-script-builder/dev-error-logger.d.ts.map +1 -1
- package/esm/src/html/hydration-script-builder/dev-error-logger.js +2 -6
- package/esm/src/html/hydration-script-builder/dev-scripts.js +2 -2
- package/esm/src/html/hydration-script-builder/hydration-data-generator.d.ts +3 -1
- package/esm/src/html/hydration-script-builder/hydration-data-generator.d.ts.map +1 -1
- package/esm/src/html/hydration-script-builder/hydration-data-generator.js +2 -2
- package/esm/src/html/hydration-script-builder/index.d.ts +1 -1
- package/esm/src/html/hydration-script-builder/index.d.ts.map +1 -1
- package/esm/src/html/hydration-script-builder/index.js +1 -1
- package/esm/src/html/hydration-script-builder/prod-hydration.js +2 -2
- package/esm/src/html/hydration-script-builder/prod-scripts.d.ts +2 -0
- package/esm/src/html/hydration-script-builder/prod-scripts.d.ts.map +1 -1
- package/esm/src/html/hydration-script-builder/prod-scripts.js +14 -14
- package/esm/src/html/schemas/html.schema.d.ts +2 -0
- package/esm/src/html/schemas/html.schema.d.ts.map +1 -1
- package/esm/src/html/schemas/html.schema.js +2 -0
- package/esm/src/html/styles-builder/css-pregeneration.d.ts +17 -1
- package/esm/src/html/styles-builder/css-pregeneration.d.ts.map +1 -1
- package/esm/src/html/styles-builder/css-pregeneration.js +103 -1
- package/esm/src/html/styles-builder/dev-styles.js +2 -2
- package/esm/src/html/utils.d.ts +2 -0
- package/esm/src/html/utils.d.ts.map +1 -1
- package/esm/src/html/utils.js +49 -28
- package/esm/src/integrations/remote-tools.d.ts.map +1 -1
- package/esm/src/integrations/remote-tools.js +32 -39
- package/esm/src/internal-agents/ag-ui-sse.d.ts +0 -1
- package/esm/src/internal-agents/ag-ui-sse.d.ts.map +1 -1
- package/esm/src/internal-agents/ag-ui-sse.js +2 -16
- package/esm/src/internal-agents/control-plane-auth.d.ts.map +1 -1
- package/esm/src/internal-agents/control-plane-auth.js +5 -3
- package/esm/src/internal-agents/request-body.d.ts.map +1 -1
- package/esm/src/internal-agents/request-body.js +6 -3
- package/esm/src/internal-agents/session-manager.d.ts +1 -0
- package/esm/src/internal-agents/session-manager.d.ts.map +1 -1
- package/esm/src/internal-agents/session-manager.js +12 -18
- package/esm/src/issues/core.d.ts.map +1 -1
- package/esm/src/issues/core.js +24 -23
- package/esm/src/issues/schemas/issue.schema.d.ts.map +1 -1
- package/esm/src/issues/schemas/issue.schema.js +2 -1
- package/esm/src/jobs/runtime-env.d.ts.map +1 -1
- package/esm/src/jobs/runtime-env.js +21 -44
- package/esm/src/markdown/index.d.ts +1 -2
- package/esm/src/markdown/index.d.ts.map +1 -1
- package/esm/src/markdown/index.js +1 -6
- package/esm/src/mcp/server.d.ts +0 -1
- package/esm/src/mcp/server.d.ts.map +1 -1
- package/esm/src/mcp/server.js +40 -41
- package/esm/src/mdx/index.d.ts +3 -2
- package/esm/src/mdx/index.d.ts.map +1 -1
- package/esm/src/mdx/index.js +3 -5
- package/esm/src/middleware/builtin/logger.d.ts.map +1 -1
- package/esm/src/middleware/builtin/logger.js +31 -28
- package/esm/src/middleware/builtin/security/rate-limit.d.ts.map +1 -1
- package/esm/src/middleware/builtin/security/rate-limit.js +17 -12
- package/esm/src/middleware/builtin/timeout.d.ts.map +1 -1
- package/esm/src/middleware/builtin/timeout.js +17 -10
- package/esm/src/modules/import-map/default-import-map.d.ts.map +1 -1
- package/esm/src/modules/import-map/default-import-map.js +4 -3
- package/esm/src/oauth/handlers/callback-handler.d.ts +0 -5
- package/esm/src/oauth/handlers/callback-handler.d.ts.map +1 -1
- package/esm/src/oauth/handlers/callback-handler.js +9 -14
- package/esm/src/oauth/handlers/index.d.ts +1 -1
- package/esm/src/oauth/handlers/index.js +1 -1
- package/esm/src/oauth/handlers/init-handler.d.ts.map +1 -1
- package/esm/src/oauth/handlers/init-handler.js +32 -20
- package/esm/src/oauth/providers/index.d.ts +1 -1
- package/esm/src/oauth/providers/index.js +1 -1
- package/esm/src/oauth/schemas/index.d.ts +1 -1
- package/esm/src/oauth/schemas/index.js +1 -1
- package/esm/src/oauth/token-store/index.d.ts +1 -1
- package/esm/src/oauth/token-store/index.js +1 -1
- package/esm/src/oauth/token-store/memory.d.ts +1 -1
- package/esm/src/oauth/token-store/memory.d.ts.map +1 -1
- package/esm/src/oauth/token-store/memory.js +8 -8
- package/esm/src/observability/request-profiler.d.ts +31 -0
- package/esm/src/observability/request-profiler.d.ts.map +1 -0
- package/esm/src/observability/request-profiler.js +94 -0
- package/esm/src/observability/tracing/otlp-setup.d.ts.map +1 -1
- package/esm/src/observability/tracing/otlp-setup.js +16 -21
- package/esm/src/prompt/factory.d.ts.map +1 -1
- package/esm/src/prompt/factory.js +10 -12
- package/esm/src/prompt/registry.d.ts.map +1 -1
- package/esm/src/prompt/registry.js +12 -10
- package/esm/src/prompt/schemas/prompt.schema.d.ts.map +1 -1
- package/esm/src/prompt/schemas/prompt.schema.js +0 -2
- package/esm/src/prompt/types.d.ts +1 -1
- package/esm/src/prompt/types.d.ts.map +1 -1
- package/esm/src/provider/local/ai-sdk-adapter.d.ts.map +1 -1
- package/esm/src/provider/local/ai-sdk-adapter.js +3 -8
- package/esm/src/provider/local/env.d.ts +4 -6
- package/esm/src/provider/local/env.d.ts.map +1 -1
- package/esm/src/provider/local/env.js +14 -1
- package/esm/src/provider/local/local-engine.d.ts.map +1 -1
- package/esm/src/provider/local/local-engine.js +2 -7
- package/esm/src/provider/model-registry.d.ts.map +1 -1
- package/esm/src/provider/model-registry.js +2 -7
- package/esm/src/provider/veryfront-cloud/provider.d.ts.map +1 -1
- package/esm/src/provider/veryfront-cloud/provider.js +1 -7
- package/esm/src/provider/veryfront-cloud/shared.d.ts.map +1 -1
- package/esm/src/provider/veryfront-cloud/shared.js +9 -11
- package/esm/src/proxy/handler.d.ts.map +1 -1
- package/esm/src/proxy/handler.js +56 -57
- package/esm/src/react/compat/hooks-adapter.d.ts +1 -7
- package/esm/src/react/compat/hooks-adapter.d.ts.map +1 -1
- package/esm/src/react/compat/hooks-adapter.js +35 -40
- package/esm/src/react/components/Head.d.ts +1 -26
- package/esm/src/react/components/Head.d.ts.map +1 -1
- package/esm/src/react/components/Head.js +1 -172
- package/esm/src/react/context/index.d.ts +2 -46
- package/esm/src/react/context/index.d.ts.map +1 -1
- package/esm/src/react/context/index.js +1 -44
- package/esm/src/react/head-collector.d.ts +1 -10
- package/esm/src/react/head-collector.d.ts.map +1 -1
- package/esm/src/react/head-collector.js +4 -0
- package/esm/src/react/router/index.d.ts +2 -45
- package/esm/src/react/router/index.d.ts.map +1 -1
- package/esm/src/react/router/index.js +1 -49
- package/esm/src/react/runtime/core.d.ts +49 -0
- package/esm/src/react/runtime/core.d.ts.map +1 -0
- package/esm/src/react/runtime/core.js +200 -0
- package/esm/src/rendering/orchestrator/html.d.ts +2 -0
- package/esm/src/rendering/orchestrator/html.d.ts.map +1 -1
- package/esm/src/rendering/orchestrator/html.js +69 -12
- package/esm/src/rendering/orchestrator/ssr-orchestrator.d.ts.map +1 -1
- package/esm/src/rendering/orchestrator/ssr-orchestrator.js +4 -0
- package/esm/src/rendering/orchestrator/types.d.ts +4 -0
- package/esm/src/rendering/orchestrator/types.d.ts.map +1 -1
- package/esm/src/repositories/types.d.ts.map +1 -1
- package/esm/src/resource/factory.d.ts.map +1 -1
- package/esm/src/resource/factory.js +12 -9
- package/esm/src/resource/registry.d.ts +3 -3
- package/esm/src/resource/registry.d.ts.map +1 -1
- package/esm/src/resource/registry.js +7 -7
- package/esm/src/schemas/common.d.ts.map +1 -1
- package/esm/src/schemas/common.js +7 -4
- package/esm/src/security/http/config.d.ts +0 -1
- package/esm/src/security/http/config.d.ts.map +1 -1
- package/esm/src/security/http/config.js +3 -16
- package/esm/src/security/http/response/security-handler.d.ts +1 -0
- package/esm/src/security/http/response/security-handler.d.ts.map +1 -1
- package/esm/src/security/http/response/security-handler.js +17 -12
- package/esm/src/security/index.d.ts +4 -2
- package/esm/src/security/index.d.ts.map +1 -1
- package/esm/src/security/index.js +3 -1
- package/esm/src/server/handlers/dev/styles-css.handler.d.ts.map +1 -1
- package/esm/src/server/handlers/dev/styles-css.handler.js +8 -7
- package/esm/src/server/handlers/monitoring/metrics.handler.d.ts.map +1 -1
- package/esm/src/server/handlers/monitoring/metrics.handler.js +3 -1
- package/esm/src/server/handlers/request/module/module-server-handler.d.ts.map +1 -1
- package/esm/src/server/handlers/request/module/module-server-handler.js +18 -15
- package/esm/src/server/handlers/request/prod-hydration-module.handler.d.ts +8 -0
- package/esm/src/server/handlers/request/prod-hydration-module.handler.d.ts.map +1 -0
- package/esm/src/server/handlers/request/prod-hydration-module.handler.js +41 -0
- package/esm/src/server/handlers/request/ssr/ssr.handler.d.ts.map +1 -1
- package/esm/src/server/handlers/request/ssr/ssr.handler.js +3 -0
- package/esm/src/server/production-server.d.ts.map +1 -1
- package/esm/src/server/production-server.js +65 -0
- package/esm/src/server/runtime-handler/handler-context-builder.d.ts +1 -1
- package/esm/src/server/runtime-handler/handler-context-builder.d.ts.map +1 -1
- package/esm/src/server/runtime-handler/index.d.ts +1 -1
- package/esm/src/server/runtime-handler/index.d.ts.map +1 -1
- package/esm/src/server/runtime-handler/index.js +36 -11
- package/esm/src/server/runtime-handler/request-utils.d.ts +7 -0
- package/esm/src/server/runtime-handler/request-utils.d.ts.map +1 -1
- package/esm/src/server/runtime-handler/request-utils.js +10 -0
- package/esm/src/server/services/rendering/ssr.service.d.ts +1 -0
- package/esm/src/server/services/rendering/ssr.service.d.ts.map +1 -1
- package/esm/src/server/services/rendering/ssr.service.js +12 -5
- package/esm/src/server/services/rsc/endpoints/rsc-bundles.generated.js +1 -1
- package/esm/src/skill/allowed-tools.d.ts +3 -8
- package/esm/src/skill/allowed-tools.d.ts.map +1 -1
- package/esm/src/skill/executor.js +2 -2
- package/esm/src/skill/parser.d.ts.map +1 -1
- package/esm/src/skill/parser.js +12 -12
- package/esm/src/skill/path-safety.js +1 -1
- package/esm/src/skill/tools.d.ts.map +1 -1
- package/esm/src/skill/tools.js +18 -11
- package/esm/src/studio/bridge/bridge-bundle.generated.d.ts.map +1 -1
- package/esm/src/studio/bridge/bridge-bundle.generated.js +1 -1
- package/esm/src/task/discovery.d.ts.map +1 -1
- package/esm/src/task/discovery.js +73 -95
- package/esm/src/tool/executor.d.ts.map +1 -1
- package/esm/src/tool/executor.js +8 -7
- package/esm/src/tool/factory.d.ts.map +1 -1
- package/esm/src/tool/factory.js +13 -16
- package/esm/src/transforms/esm/package-registry.d.ts +4 -0
- package/esm/src/transforms/esm/package-registry.d.ts.map +1 -1
- package/esm/src/transforms/esm/package-registry.js +34 -17
- package/esm/src/transforms/import-rewriter/strategies/veryfront-strategy.d.ts.map +1 -1
- package/esm/src/transforms/import-rewriter/strategies/veryfront-strategy.js +2 -1
- package/esm/src/transforms/mdx/esm-module-loader/cache-format.d.ts.map +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/cache-format.js +26 -1
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/index.d.ts +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/index.d.ts.map +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/index.js +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/render-sessions.d.ts +1 -0
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/render-sessions.d.ts.map +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/render-sessions.js +3 -0
- package/esm/src/transforms/pipeline/stages/ssr-vf-modules/index.d.ts +1 -1
- package/esm/src/transforms/pipeline/stages/ssr-vf-modules/index.js +1 -1
- package/esm/src/transforms/veryfront-module-urls.d.ts.map +1 -1
- package/esm/src/transforms/veryfront-module-urls.js +7 -3
- package/esm/src/types/entities/getEntityInfo.d.ts.map +1 -1
- package/esm/src/types/entities/getEntityInfo.js +79 -127
- package/esm/src/utils/path-utils.d.ts +1 -1
- package/esm/src/utils/path-utils.d.ts.map +1 -1
- package/esm/src/utils/path-utils.js +16 -7
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/esm/src/utils/version.d.ts.map +1 -1
- package/esm/src/utils/version.js +0 -1
- package/esm/src/workflow/worker/dynamic-job-entrypoint.d.ts.map +1 -1
- package/esm/src/workflow/worker/dynamic-job-entrypoint.js +5 -72
- package/esm/src/workflow/worker/job-entrypoint.d.ts.map +1 -1
- package/esm/src/workflow/worker/job-entrypoint.js +5 -72
- package/esm/src/workflow/worker/shared.d.ts +18 -0
- package/esm/src/workflow/worker/shared.d.ts.map +1 -0
- package/esm/src/workflow/worker/shared.js +77 -0
- package/package.json +1 -1
- package/src/cli/router.ts +41 -2
- package/src/cli/shared/update-check.ts +110 -0
- package/src/deno.js +13 -8
- package/src/src/channels/control-plane.ts +6 -10
- package/src/src/channels/invoke.ts +7 -7
- package/src/src/chat/index.ts +96 -132
- package/src/src/config/env.ts +24 -11
- package/src/src/data/static-data-fetcher.ts +59 -34
- package/src/src/data/static-paths-fetcher.ts +4 -2
- package/src/src/errors/logging.ts +21 -7
- package/src/src/errors/user-friendly/error-formatter.ts +14 -29
- package/src/src/fs/index.ts +21 -30
- package/src/src/html/dev-scripts.ts +5 -9
- package/src/src/html/html-escape.ts +4 -0
- package/src/src/html/html-injection.ts +2 -2
- package/src/src/html/html-shell-generator.ts +60 -26
- package/src/src/html/hydration-script-builder/dev-client-renderer.ts +2 -2
- package/src/src/html/hydration-script-builder/dev-component-manifest.ts +2 -2
- package/src/src/html/hydration-script-builder/dev-error-logger.ts +2 -8
- package/src/src/html/hydration-script-builder/dev-scripts.ts +2 -2
- package/src/src/html/hydration-script-builder/hydration-data-generator.ts +2 -1
- package/src/src/html/hydration-script-builder/index.ts +5 -1
- package/src/src/html/hydration-script-builder/prod-hydration.ts +2 -2
- package/src/src/html/hydration-script-builder/prod-scripts.ts +16 -15
- package/src/src/html/schemas/html.schema.ts +2 -0
- package/src/src/html/styles-builder/css-pregeneration.ts +133 -1
- package/src/src/html/styles-builder/dev-styles.ts +2 -2
- package/src/src/html/utils.ts +62 -29
- package/src/src/integrations/remote-tools.ts +39 -37
- package/src/src/internal-agents/ag-ui-sse.ts +2 -17
- package/src/src/internal-agents/control-plane-auth.ts +8 -6
- package/src/src/internal-agents/request-body.ts +7 -5
- package/src/src/internal-agents/session-manager.ts +16 -20
- package/src/src/issues/core.ts +24 -27
- package/src/src/issues/schemas/issue.schema.ts +3 -1
- package/src/src/jobs/runtime-env.ts +24 -50
- package/src/src/markdown/index.ts +5 -8
- package/src/src/mcp/server.ts +50 -53
- package/src/src/mdx/index.ts +7 -8
- package/src/src/middleware/builtin/logger.ts +44 -29
- package/src/src/middleware/builtin/security/rate-limit.ts +20 -11
- package/src/src/middleware/builtin/timeout.ts +22 -13
- package/src/src/modules/import-map/default-import-map.ts +4 -3
- package/src/src/oauth/handlers/callback-handler.ts +9 -16
- package/src/src/oauth/handlers/index.ts +1 -1
- package/src/src/oauth/handlers/init-handler.ts +56 -27
- package/src/src/oauth/providers/index.ts +1 -1
- package/src/src/oauth/schemas/index.ts +1 -1
- package/src/src/oauth/token-store/index.ts +1 -1
- package/src/src/oauth/token-store/memory.ts +8 -8
- package/src/src/observability/request-profiler.ts +140 -0
- package/src/src/observability/tracing/otlp-setup.ts +16 -22
- package/src/src/prompt/factory.ts +16 -14
- package/src/src/prompt/registry.ts +14 -13
- package/src/src/prompt/schemas/prompt.schema.ts +0 -4
- package/src/src/prompt/types.ts +1 -2
- package/src/src/provider/local/ai-sdk-adapter.ts +3 -10
- package/src/src/provider/local/env.ts +22 -2
- package/src/src/provider/local/local-engine.ts +2 -9
- package/src/src/provider/model-registry.ts +2 -9
- package/src/src/provider/veryfront-cloud/provider.ts +1 -8
- package/src/src/provider/veryfront-cloud/shared.ts +12 -15
- package/src/src/proxy/handler.ts +90 -74
- package/src/src/react/compat/hooks-adapter.ts +43 -44
- package/src/src/react/components/Head.tsx +1 -181
- package/src/src/react/context/index.tsx +2 -83
- package/src/src/react/head-collector.ts +9 -0
- package/src/src/react/router/index.tsx +2 -100
- package/src/src/react/runtime/core.ts +303 -0
- package/src/src/rendering/orchestrator/html.ts +122 -18
- package/src/src/rendering/orchestrator/ssr-orchestrator.ts +8 -0
- package/src/src/rendering/orchestrator/types.ts +4 -0
- package/src/src/repositories/types.ts +0 -4
- package/src/src/resource/factory.ts +15 -11
- package/src/src/resource/registry.ts +7 -7
- package/src/src/schemas/common.ts +8 -5
- package/src/src/security/http/config.ts +3 -19
- package/src/src/security/http/response/security-handler.ts +22 -13
- package/src/src/security/index.ts +4 -7
- package/src/src/server/handlers/dev/styles-css.handler.ts +32 -14
- package/src/src/server/handlers/monitoring/metrics.handler.ts +3 -1
- package/src/src/server/handlers/request/module/module-server-handler.ts +24 -17
- package/src/src/server/handlers/request/prod-hydration-module.handler.ts +61 -0
- package/src/src/server/handlers/request/ssr/ssr.handler.ts +3 -0
- package/src/src/server/production-server.ts +84 -0
- package/src/src/server/runtime-handler/handler-context-builder.ts +1 -1
- package/src/src/server/runtime-handler/index.ts +44 -13
- package/src/src/server/runtime-handler/request-utils.ts +11 -0
- package/src/src/server/services/rendering/ssr.service.ts +31 -18
- package/src/src/server/services/rsc/endpoints/rsc-bundles.generated.ts +1 -1
- package/src/src/skill/allowed-tools.ts +1 -8
- package/src/src/skill/executor.ts +2 -2
- package/src/src/skill/parser.ts +13 -20
- package/src/src/skill/path-safety.ts +1 -1
- package/src/src/skill/tools.ts +27 -20
- package/src/src/studio/bridge/bridge-bundle.generated.ts +1 -1
- package/src/src/task/discovery.ts +97 -97
- package/src/src/tool/executor.ts +10 -8
- package/src/src/tool/factory.ts +21 -22
- package/src/src/tool/types.ts +0 -17
- package/src/src/transforms/esm/package-registry.ts +52 -20
- package/src/src/transforms/import-rewriter/strategies/veryfront-strategy.ts +2 -1
- package/src/src/transforms/mdx/esm-module-loader/cache-format.ts +34 -1
- package/src/src/transforms/mdx/esm-module-loader/module-fetcher/index.ts +1 -1
- package/src/src/transforms/mdx/esm-module-loader/module-fetcher/render-sessions.ts +4 -0
- package/src/src/transforms/pipeline/stages/ssr-vf-modules/index.ts +1 -1
- package/src/src/transforms/veryfront-module-urls.ts +6 -2
- package/src/src/types/entities/getEntityInfo.ts +131 -152
- package/src/src/utils/path-utils.ts +16 -7
- package/src/src/utils/version-constant.ts +1 -1
- package/src/src/utils/version.ts +0 -1
- package/src/src/workflow/worker/dynamic-job-entrypoint.ts +18 -84
- package/src/src/workflow/worker/job-entrypoint.ts +18 -85
- package/src/src/workflow/worker/shared.ts +127 -0
- package/esm/src/prompt/schemas/index.d.ts +0 -7
- package/esm/src/prompt/schemas/index.d.ts.map +0 -1
- package/esm/src/prompt/schemas/index.js +0 -6
- package/esm/src/security/http/handlers-index.d.ts +0 -5
- package/esm/src/security/http/handlers-index.d.ts.map +0 -1
- package/esm/src/security/http/handlers-index.js +0 -3
- package/src/src/prompt/schemas/index.ts +0 -7
- package/src/src/security/http/handlers-index.ts +0 -4
|
@@ -1,173 +1,2 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Declarative `<head>` metadata management.
|
|
3
|
-
*
|
|
4
|
-
* @module head
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
* ```tsx
|
|
8
|
-
* import { Head } from "veryfront/head";
|
|
9
|
-
*
|
|
10
|
-
* export default function Page() {
|
|
11
|
-
* return (
|
|
12
|
-
* <>
|
|
13
|
-
* <Head>
|
|
14
|
-
* <title>My Page</title>
|
|
15
|
-
* <meta name="description" content="Page description" />
|
|
16
|
-
* </Head>
|
|
17
|
-
* <main>Content</main>
|
|
18
|
-
* </>
|
|
19
|
-
* );
|
|
20
|
-
* }
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
23
1
|
import "../../../_dnt.polyfills.js";
|
|
24
|
-
|
|
25
|
-
import { collectHead } from "../head-collector.js";
|
|
26
|
-
import { isServerEnvironment } from "../../platform/compat/runtime.js";
|
|
27
|
-
import { getDocumentNonce } from "./ai/csp-nonce.js";
|
|
28
|
-
export function Head({ children }) {
|
|
29
|
-
const mountedRef = useRef(false);
|
|
30
|
-
const isSSR = isServerEnvironment();
|
|
31
|
-
if (isSSR && children) {
|
|
32
|
-
React.Children.forEach(children, (child) => {
|
|
33
|
-
if (!React.isValidElement(child))
|
|
34
|
-
return;
|
|
35
|
-
const { type } = child;
|
|
36
|
-
// Cast props to Record for React 19 compatibility (props is unknown in R19 types)
|
|
37
|
-
const props = child.props;
|
|
38
|
-
if (typeof type !== "string" || type === "body")
|
|
39
|
-
return;
|
|
40
|
-
if (type === "title") {
|
|
41
|
-
collectHead({ title: String(props.children ?? "") });
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
if (type === "meta") {
|
|
45
|
-
collectHead({
|
|
46
|
-
metas: [
|
|
47
|
-
{
|
|
48
|
-
name: props.name,
|
|
49
|
-
property: props.property,
|
|
50
|
-
content: String(props.content ?? ""),
|
|
51
|
-
},
|
|
52
|
-
],
|
|
53
|
-
});
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
if (type === "link") {
|
|
57
|
-
const link = {};
|
|
58
|
-
for (const [key, value] of Object.entries(props)) {
|
|
59
|
-
if (value != null)
|
|
60
|
-
link[key] = String(value);
|
|
61
|
-
}
|
|
62
|
-
collectHead({ links: [link] });
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
if (type === "style") {
|
|
66
|
-
collectHead({ styles: [String(props.children ?? "")] });
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
if (type === "script") {
|
|
70
|
-
const script = {};
|
|
71
|
-
for (const [key, value] of Object.entries(props)) {
|
|
72
|
-
if (key === "children" || key === "dangerouslySetInnerHTML")
|
|
73
|
-
continue;
|
|
74
|
-
if (value != null)
|
|
75
|
-
script[key] = String(value);
|
|
76
|
-
}
|
|
77
|
-
// Handle inline script content
|
|
78
|
-
if (props.dangerouslySetInnerHTML) {
|
|
79
|
-
const html = props.dangerouslySetInnerHTML;
|
|
80
|
-
if (html.__html)
|
|
81
|
-
script.content = html.__html;
|
|
82
|
-
}
|
|
83
|
-
else if (typeof props.children === "string") {
|
|
84
|
-
script.content = props.children;
|
|
85
|
-
}
|
|
86
|
-
collectHead({ scripts: [script] });
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
useEffect(() => {
|
|
91
|
-
mountedRef.current = true;
|
|
92
|
-
if (!children)
|
|
93
|
-
return;
|
|
94
|
-
const addedElements = [];
|
|
95
|
-
const nonce = getDocumentNonce();
|
|
96
|
-
React.Children.forEach(children, (child) => {
|
|
97
|
-
if (!React.isValidElement(child))
|
|
98
|
-
return;
|
|
99
|
-
const { type } = child;
|
|
100
|
-
// Cast props to Record for React 19 compatibility (props is unknown in R19 types)
|
|
101
|
-
const props = child.props;
|
|
102
|
-
if (typeof type !== "string" || type === "body")
|
|
103
|
-
return;
|
|
104
|
-
if (type === "title") {
|
|
105
|
-
document.title = String(props.children ?? "");
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
108
|
-
const element = document.createElement(type);
|
|
109
|
-
if ((type === "style" || type === "script") && !props.nonce && nonce) {
|
|
110
|
-
element.setAttribute("nonce", nonce);
|
|
111
|
-
}
|
|
112
|
-
// For scripts, check if already SSR'd via <Head> to avoid double execution
|
|
113
|
-
if (type === "script") {
|
|
114
|
-
const src = props.src;
|
|
115
|
-
const id = props.id;
|
|
116
|
-
// Check by id (look for SSR'd script with data-vf-head marker)
|
|
117
|
-
if (id && document.querySelector(`script[data-vf-head][id="${id}"]`)) {
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
// Check by src for external scripts
|
|
121
|
-
if (src && document.querySelector(`script[data-vf-head][src="${src}"]`)) {
|
|
122
|
-
return;
|
|
123
|
-
}
|
|
124
|
-
// For inline scripts without id, check by content hash
|
|
125
|
-
const content = typeof props.children === "string"
|
|
126
|
-
? props.children
|
|
127
|
-
: props.dangerouslySetInnerHTML?.__html;
|
|
128
|
-
if (content && !id) {
|
|
129
|
-
let sum = 0;
|
|
130
|
-
for (let i = 0; i < Math.min(content.length, 200); i++) {
|
|
131
|
-
sum = ((sum << 5) - sum + content.charCodeAt(i)) | 0;
|
|
132
|
-
}
|
|
133
|
-
const hash = "vf" + Math.abs(sum).toString(36);
|
|
134
|
-
if (document.querySelector(`script[data-vf-head][data-vf-hash="${hash}"]`)) {
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
element.setAttribute("data-vf-hash", hash);
|
|
138
|
-
}
|
|
139
|
-
element.setAttribute("data-vf-head", "true");
|
|
140
|
-
}
|
|
141
|
-
for (const [key, value] of Object.entries(props)) {
|
|
142
|
-
if (key === "children")
|
|
143
|
-
continue;
|
|
144
|
-
let attrName = key;
|
|
145
|
-
if (key === "className")
|
|
146
|
-
attrName = "class";
|
|
147
|
-
else if (key === "htmlFor")
|
|
148
|
-
attrName = "for";
|
|
149
|
-
if (typeof value === "boolean") {
|
|
150
|
-
if (value)
|
|
151
|
-
element.setAttribute(attrName, "");
|
|
152
|
-
continue;
|
|
153
|
-
}
|
|
154
|
-
if (value != null)
|
|
155
|
-
element.setAttribute(attrName, String(value));
|
|
156
|
-
}
|
|
157
|
-
if (typeof props.children === "string") {
|
|
158
|
-
element.textContent = props.children;
|
|
159
|
-
}
|
|
160
|
-
element.setAttribute("data-veryfront-managed", "1");
|
|
161
|
-
document.head.appendChild(element);
|
|
162
|
-
addedElements.push(element);
|
|
163
|
-
});
|
|
164
|
-
return () => {
|
|
165
|
-
for (const el of addedElements)
|
|
166
|
-
el.remove();
|
|
167
|
-
};
|
|
168
|
-
}, [children]);
|
|
169
|
-
return React.createElement("div", {
|
|
170
|
-
"data-veryfront-head": "1",
|
|
171
|
-
style: { display: "none" },
|
|
172
|
-
});
|
|
173
|
-
}
|
|
2
|
+
export { Head } from "../runtime/core.js";
|
|
@@ -1,48 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Access route params, page data, and MDX frontmatter.
|
|
3
|
-
*
|
|
4
|
-
* @module context
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
* ```tsx
|
|
8
|
-
* import { usePageContext } from "veryfront/context";
|
|
9
|
-
*
|
|
10
|
-
* function TableOfContents() {
|
|
11
|
-
* const { headings, frontmatter } = usePageContext();
|
|
12
|
-
* return (
|
|
13
|
-
* <ul>
|
|
14
|
-
* {headings.map((h) => (
|
|
15
|
-
* <li key={h.id}>
|
|
16
|
-
* <a href={`#${h.id}`}>{h.text}</a>
|
|
17
|
-
* </li>
|
|
18
|
-
* ))}
|
|
19
|
-
* </ul>
|
|
20
|
-
* );
|
|
21
|
-
* }
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
1
|
import "../../../_dnt.polyfills.js";
|
|
25
|
-
|
|
26
|
-
export
|
|
27
|
-
text: string;
|
|
28
|
-
id: string;
|
|
29
|
-
level: number;
|
|
30
|
-
}
|
|
31
|
-
export interface PageContextValue {
|
|
32
|
-
slug: string;
|
|
33
|
-
path: string;
|
|
34
|
-
params: Record<string, string>;
|
|
35
|
-
query: Record<string, string>;
|
|
36
|
-
frontmatter: Record<string, unknown>;
|
|
37
|
-
/** Headings extracted from MDX content for table of contents/sidebar navigation */
|
|
38
|
-
headings: MdxHeading[];
|
|
39
|
-
/** @deprecated Use `headings` instead. Alias for backwards compatibility. */
|
|
40
|
-
mdxHeadings: MdxHeading[];
|
|
41
|
-
}
|
|
42
|
-
export interface PageContextProviderProps {
|
|
43
|
-
children: React.ReactNode;
|
|
44
|
-
pageContext?: PageContextValue;
|
|
45
|
-
}
|
|
46
|
-
export declare function PageContextProvider({ children, pageContext, }: PageContextProviderProps): React.ReactElement;
|
|
47
|
-
export declare function usePageContext(): PageContextValue;
|
|
2
|
+
export { PageContextProvider, usePageContext } from "../runtime/core.js";
|
|
3
|
+
export type { MdxHeading, PageContextProviderProps, PageContextValue } from "../runtime/core.js";
|
|
48
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/src/react/context/index.tsx"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/src/react/context/index.tsx"],"names":[],"mappings":"AAAA,OAAO,4BAA4B,CAAC;AACpC,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACzE,YAAY,EAAE,UAAU,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -1,45 +1,2 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Access route params, page data, and MDX frontmatter.
|
|
3
|
-
*
|
|
4
|
-
* @module context
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
* ```tsx
|
|
8
|
-
* import { usePageContext } from "veryfront/context";
|
|
9
|
-
*
|
|
10
|
-
* function TableOfContents() {
|
|
11
|
-
* const { headings, frontmatter } = usePageContext();
|
|
12
|
-
* return (
|
|
13
|
-
* <ul>
|
|
14
|
-
* {headings.map((h) => (
|
|
15
|
-
* <li key={h.id}>
|
|
16
|
-
* <a href={`#${h.id}`}>{h.text}</a>
|
|
17
|
-
* </li>
|
|
18
|
-
* ))}
|
|
19
|
-
* </ul>
|
|
20
|
-
* );
|
|
21
|
-
* }
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
1
|
import "../../../_dnt.polyfills.js";
|
|
25
|
-
|
|
26
|
-
import React from "react";
|
|
27
|
-
const defaultPageContext = {
|
|
28
|
-
slug: "/",
|
|
29
|
-
path: "/",
|
|
30
|
-
params: {},
|
|
31
|
-
query: {},
|
|
32
|
-
frontmatter: {},
|
|
33
|
-
headings: [],
|
|
34
|
-
mdxHeadings: [],
|
|
35
|
-
};
|
|
36
|
-
const PAGE_CONTEXT_SYMBOL = Symbol.for("veryfront.react.page-context");
|
|
37
|
-
const globalPageContext = dntShim.dntGlobalThis;
|
|
38
|
-
const PageContextContext = globalPageContext[PAGE_CONTEXT_SYMBOL] ??
|
|
39
|
-
(globalPageContext[PAGE_CONTEXT_SYMBOL] = React.createContext(defaultPageContext));
|
|
40
|
-
export function PageContextProvider({ children, pageContext, }) {
|
|
41
|
-
return (React.createElement(PageContextContext.Provider, { value: pageContext ?? defaultPageContext }, children));
|
|
42
|
-
}
|
|
43
|
-
export function usePageContext() {
|
|
44
|
-
return React.useContext(PageContextContext);
|
|
45
|
-
}
|
|
2
|
+
export { PageContextProvider, usePageContext } from "../runtime/core.js";
|
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Head Collector - Request-scoped metadata collection for SSR
|
|
3
|
-
*
|
|
4
|
-
* Collects head metadata during React SSR render using AsyncLocalStorage
|
|
5
|
-
* for proper isolation between concurrent requests.
|
|
6
|
-
*
|
|
7
|
-
* Usage:
|
|
8
|
-
* const { result, head } = await runWithHeadCollector(() => renderToString(element));
|
|
9
|
-
* // head.title, head.description, head.metas are now available
|
|
10
|
-
*/
|
|
11
1
|
export interface HeadMeta {
|
|
12
2
|
name?: string;
|
|
13
3
|
property?: string;
|
|
@@ -37,6 +27,7 @@ export interface CollectedHead {
|
|
|
37
27
|
/** Blocking scripts - injected at top of <head> before CSS */
|
|
38
28
|
scripts: HeadScript[];
|
|
39
29
|
}
|
|
30
|
+
export declare const HEAD_COLLECTOR_SYMBOL: unique symbol;
|
|
40
31
|
export declare function runWithHeadCollector<T>(fn: () => T | Promise<T>): Promise<{
|
|
41
32
|
result: T;
|
|
42
33
|
head: CollectedHead;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"head-collector.d.ts","sourceRoot":"","sources":["../../../src/src/react/head-collector.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"head-collector.d.ts","sourceRoot":"","sources":["../../../src/src/react/head-collector.ts"],"names":[],"mappings":"AAeA,MAAM,WAAW,QAAQ;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,QAAQ;IACvB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;CACnC;AAED,UAAU,UAAU;IAClB,4BAA4B;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,qBAAqB;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,6CAA6C;IAC7C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,4BAA4B;IAC5B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;CACnC;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,8DAA8D;IAC9D,OAAO,EAAE,UAAU,EAAE,CAAC;CACvB;AAED,eAAO,MAAM,qBAAqB,eAA6C,CAAC;AAWhF,wBAAsB,oBAAoB,CAAC,CAAC,EAC1C,EAAE,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GACvB,OAAO,CAAC;IAAE,MAAM,EAAE,CAAC,CAAC;IAAC,IAAI,EAAE,aAAa,CAAA;CAAE,CAAC,CAI7C;AAED,wBAAgB,uBAAuB,IAAI,aAAa,GAAG,IAAI,CAE9D;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,aAAa,CAAC,GAAG,IAAI,CAwB9D;AAID,wBAAgB,gBAAgB,IAAI,OAAO,CAY1C;AAWD,wBAAgB,kBAAkB,IAAI,IAAI,CAIzC;AAED,wBAAgB,kBAAkB,IAAI,aAAa,CAclD"}
|
|
@@ -8,11 +8,14 @@
|
|
|
8
8
|
* const { result, head } = await runWithHeadCollector(() => renderToString(element));
|
|
9
9
|
* // head.title, head.description, head.metas are now available
|
|
10
10
|
*/
|
|
11
|
+
import * as dntShim from "../../_dnt.shims.js";
|
|
11
12
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
13
|
+
export const HEAD_COLLECTOR_SYMBOL = Symbol.for("veryfront.react.collect-head");
|
|
12
14
|
function createEmpty() {
|
|
13
15
|
return { metas: [], links: [], styles: [], scripts: [] };
|
|
14
16
|
}
|
|
15
17
|
const headStorage = new AsyncLocalStorage();
|
|
18
|
+
const globalHeadCollector = dntShim.dntGlobalThis;
|
|
16
19
|
export async function runWithHeadCollector(fn) {
|
|
17
20
|
const head = createEmpty();
|
|
18
21
|
const result = await headStorage.run(head, fn);
|
|
@@ -47,6 +50,7 @@ export function collectHead(data) {
|
|
|
47
50
|
collected.scripts.push(script);
|
|
48
51
|
}
|
|
49
52
|
}
|
|
53
|
+
globalHeadCollector[HEAD_COLLECTOR_SYMBOL] = collectHead;
|
|
50
54
|
export function hasCollectedHead() {
|
|
51
55
|
const collected = headStorage.getStore();
|
|
52
56
|
if (!collected)
|
|
@@ -1,47 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Client-side routing, navigation, and links.
|
|
3
|
-
*
|
|
4
|
-
* @module router
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
* ```tsx
|
|
8
|
-
* import { useRouter, Link } from "veryfront/router";
|
|
9
|
-
*
|
|
10
|
-
* function Nav() {
|
|
11
|
-
* const router = useRouter();
|
|
12
|
-
* return (
|
|
13
|
-
* <nav>
|
|
14
|
-
* <Link href="/about">About</Link>
|
|
15
|
-
* <p>Current path: {router.pathname}</p>
|
|
16
|
-
* </nav>
|
|
17
|
-
* );
|
|
18
|
-
* }
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
1
|
import "../../../_dnt.polyfills.js";
|
|
22
|
-
|
|
23
|
-
export
|
|
24
|
-
domain: string;
|
|
25
|
-
path: string;
|
|
26
|
-
pathname: string;
|
|
27
|
-
params: Record<string, string>;
|
|
28
|
-
query: Record<string, string>;
|
|
29
|
-
isPreview: boolean;
|
|
30
|
-
isMounted: boolean;
|
|
31
|
-
navigate: (url: string) => Promise<void>;
|
|
32
|
-
push: (url: string) => Promise<void>;
|
|
33
|
-
replace: (url: string) => Promise<void>;
|
|
34
|
-
reload: () => Promise<void>;
|
|
35
|
-
}
|
|
36
|
-
export interface RouterProviderProps {
|
|
37
|
-
children: React.ReactNode;
|
|
38
|
-
router?: RouterValue;
|
|
39
|
-
}
|
|
40
|
-
export declare function RouterProvider({ children, router, }: RouterProviderProps): React.ReactElement;
|
|
41
|
-
export declare function useRouter(): RouterValue;
|
|
42
|
-
export { RouterProvider as Router };
|
|
43
|
-
export type LinkProps = React.AnchorHTMLAttributes<HTMLAnchorElement> & {
|
|
44
|
-
prefetch?: boolean;
|
|
45
|
-
};
|
|
46
|
-
export declare function Link({ prefetch, children, ...rest }: LinkProps): React.ReactElement;
|
|
2
|
+
export { Link, Router, RouterProvider, useRouter } from "../runtime/core.js";
|
|
3
|
+
export type { LinkProps, RouterProviderProps, RouterValue } from "../runtime/core.js";
|
|
47
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/src/react/router/index.tsx"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/src/react/router/index.tsx"],"names":[],"mappings":"AAAA,OAAO,4BAA4B,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC7E,YAAY,EAAE,SAAS,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -1,50 +1,2 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Client-side routing, navigation, and links.
|
|
3
|
-
*
|
|
4
|
-
* @module router
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
* ```tsx
|
|
8
|
-
* import { useRouter, Link } from "veryfront/router";
|
|
9
|
-
*
|
|
10
|
-
* function Nav() {
|
|
11
|
-
* const router = useRouter();
|
|
12
|
-
* return (
|
|
13
|
-
* <nav>
|
|
14
|
-
* <Link href="/about">About</Link>
|
|
15
|
-
* <p>Current path: {router.pathname}</p>
|
|
16
|
-
* </nav>
|
|
17
|
-
* );
|
|
18
|
-
* }
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
1
|
import "../../../_dnt.polyfills.js";
|
|
22
|
-
|
|
23
|
-
import React from "react";
|
|
24
|
-
const defaultRouter = {
|
|
25
|
-
domain: "",
|
|
26
|
-
path: "/",
|
|
27
|
-
pathname: "/",
|
|
28
|
-
params: {},
|
|
29
|
-
query: {},
|
|
30
|
-
isPreview: false,
|
|
31
|
-
isMounted: false,
|
|
32
|
-
navigate: async () => { },
|
|
33
|
-
push: async () => { },
|
|
34
|
-
replace: async () => { },
|
|
35
|
-
reload: async () => { },
|
|
36
|
-
};
|
|
37
|
-
const ROUTER_CONTEXT_SYMBOL = Symbol.for("veryfront.react.router-context");
|
|
38
|
-
const globalRouterContext = dntShim.dntGlobalThis;
|
|
39
|
-
const RouterContext = globalRouterContext[ROUTER_CONTEXT_SYMBOL] ??
|
|
40
|
-
(globalRouterContext[ROUTER_CONTEXT_SYMBOL] = React.createContext(defaultRouter));
|
|
41
|
-
export function RouterProvider({ children, router, }) {
|
|
42
|
-
return (React.createElement(RouterContext.Provider, { value: router ?? defaultRouter }, children));
|
|
43
|
-
}
|
|
44
|
-
export function useRouter() {
|
|
45
|
-
return React.useContext(RouterContext);
|
|
46
|
-
}
|
|
47
|
-
export { RouterProvider as Router };
|
|
48
|
-
export function Link({ prefetch = true, children, ...rest }) {
|
|
49
|
-
return (React.createElement("a", { ...rest, "data-prefetch": prefetch ? "true" : undefined }, children));
|
|
50
|
-
}
|
|
2
|
+
export { Link, Router, RouterProvider, useRouter } from "../runtime/core.js";
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface RouterValue {
|
|
3
|
+
domain: string;
|
|
4
|
+
path: string;
|
|
5
|
+
pathname: string;
|
|
6
|
+
params: Record<string, string>;
|
|
7
|
+
query: Record<string, string>;
|
|
8
|
+
isPreview: boolean;
|
|
9
|
+
isMounted: boolean;
|
|
10
|
+
navigate: (url: string) => Promise<void>;
|
|
11
|
+
push: (url: string) => Promise<void>;
|
|
12
|
+
replace: (url: string) => Promise<void>;
|
|
13
|
+
reload: () => Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
export type LinkProps = React.AnchorHTMLAttributes<HTMLAnchorElement> & {
|
|
16
|
+
prefetch?: boolean;
|
|
17
|
+
};
|
|
18
|
+
export interface RouterProviderProps {
|
|
19
|
+
children: React.ReactNode;
|
|
20
|
+
router?: RouterValue;
|
|
21
|
+
}
|
|
22
|
+
export interface MdxHeading {
|
|
23
|
+
text: string;
|
|
24
|
+
id: string;
|
|
25
|
+
level: number;
|
|
26
|
+
}
|
|
27
|
+
export interface PageContextValue {
|
|
28
|
+
slug: string;
|
|
29
|
+
path: string;
|
|
30
|
+
params: Record<string, string>;
|
|
31
|
+
query: Record<string, string>;
|
|
32
|
+
frontmatter: Record<string, unknown>;
|
|
33
|
+
headings: MdxHeading[];
|
|
34
|
+
mdxHeadings: MdxHeading[];
|
|
35
|
+
}
|
|
36
|
+
export interface PageContextProviderProps {
|
|
37
|
+
children: React.ReactNode;
|
|
38
|
+
pageContext?: PageContextValue;
|
|
39
|
+
}
|
|
40
|
+
export declare function RouterProvider({ children, router, }: RouterProviderProps): React.ReactElement;
|
|
41
|
+
export declare function useRouter(): RouterValue;
|
|
42
|
+
export declare function Link({ prefetch, children, ...rest }: LinkProps): React.ReactElement;
|
|
43
|
+
export declare function PageContextProvider({ children, pageContext, }: PageContextProviderProps): React.ReactElement;
|
|
44
|
+
export declare function usePageContext(): PageContextValue;
|
|
45
|
+
export declare function Head({ children }: {
|
|
46
|
+
children: React.ReactNode;
|
|
47
|
+
}): React.ReactElement;
|
|
48
|
+
export { RouterProvider as Router };
|
|
49
|
+
//# sourceMappingURL=core.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../../src/src/react/runtime/core.ts"],"names":[],"mappings":"AACA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAEzC,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACzC,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACrC,OAAO,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACxC,MAAM,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7B;AAED,MAAM,MAAM,SAAS,GAAG,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,GAAG;IACtE,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,QAAQ,EAAE,UAAU,EAAE,CAAC;IACvB,WAAW,EAAE,UAAU,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,wBAAwB;IACvC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,WAAW,CAAC,EAAE,gBAAgB,CAAC;CAChC;AA6ED,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,MAAM,GACP,EAAE,mBAAmB,GAAG,KAAK,CAAC,YAAY,CAM1C;AAED,wBAAgB,SAAS,IAAI,WAAW,CAEvC;AAED,wBAAgB,IAAI,CAAC,EACnB,QAAe,EACf,QAAQ,EACR,GAAG,IAAI,EACR,EAAE,SAAS,GAAG,KAAK,CAAC,YAAY,CAMhC;AAED,wBAAgB,mBAAmB,CAAC,EAClC,QAAQ,EACR,WAAW,GACZ,EAAE,wBAAwB,GAAG,KAAK,CAAC,YAAY,CAM/C;AAED,wBAAgB,cAAc,IAAI,gBAAgB,CAEjD;AAED,wBAAgB,IAAI,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,GAAG,KAAK,CAAC,YAAY,CAwIpF;AAED,OAAO,EAAE,cAAc,IAAI,MAAM,EAAE,CAAC"}
|