veryfront 0.1.1237 → 0.1.1239
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/auth/login.d.ts +24 -2
- package/esm/cli/auth/login.d.ts.map +1 -1
- package/esm/cli/auth/login.js +444 -35
- package/esm/cli/commands/build/error-handler.d.ts.map +1 -1
- package/esm/cli/commands/build/error-handler.js +41 -3
- package/esm/cli/commands/build/handler.d.ts.map +1 -1
- package/esm/cli/commands/build/handler.js +1 -1
- package/esm/cli/commands/dev/command.d.ts.map +1 -1
- package/esm/cli/commands/dev/command.js +14 -1
- package/esm/cli/commands/dev/inference-status.d.ts +6 -0
- package/esm/cli/commands/dev/inference-status.d.ts.map +1 -1
- package/esm/cli/commands/dev/inference-status.js +14 -2
- package/esm/cli/commands/generate/command.d.ts.map +1 -1
- package/esm/cli/commands/generate/command.js +61 -0
- package/esm/cli/commands/init/init-command.d.ts.map +1 -1
- package/esm/cli/commands/init/init-command.js +23 -31
- package/esm/cli/commands/install/registry.d.ts.map +1 -1
- package/esm/cli/commands/install/registry.js +6 -9
- package/esm/cli/commands/login/command-help.d.ts.map +1 -1
- package/esm/cli/commands/login/command-help.js +3 -1
- package/esm/cli/commands/pull/command.d.ts +1 -0
- package/esm/cli/commands/pull/command.d.ts.map +1 -1
- package/esm/cli/commands/pull/command.js +49 -6
- package/esm/cli/commands/push/command-help.d.ts.map +1 -1
- package/esm/cli/commands/push/command-help.js +7 -0
- package/esm/cli/commands/push/command.d.ts +23 -12
- package/esm/cli/commands/push/command.d.ts.map +1 -1
- package/esm/cli/commands/push/command.js +461 -44
- package/esm/cli/commands/push/plan.d.ts +35 -0
- package/esm/cli/commands/push/plan.d.ts.map +1 -0
- package/esm/cli/commands/push/plan.js +96 -0
- package/esm/cli/commands/schedule/handler.d.ts +21 -2
- package/esm/cli/commands/schedule/handler.d.ts.map +1 -1
- package/esm/cli/commands/schedule/handler.js +74 -27
- package/esm/cli/commands/schema/command-help.js +1 -1
- package/esm/cli/commands/up/command.js +1 -1
- package/esm/cli/commands/webhook/handler.d.ts.map +1 -1
- package/esm/cli/commands/webhook/handler.js +3 -1
- package/esm/cli/router.d.ts.map +1 -1
- package/esm/cli/router.js +27 -5
- package/esm/cli/shared/args.d.ts +15 -1
- package/esm/cli/shared/args.d.ts.map +1 -1
- package/esm/cli/shared/args.js +56 -3
- package/esm/cli/shared/config.d.ts +11 -2
- package/esm/cli/shared/config.d.ts.map +1 -1
- package/esm/cli/shared/config.js +72 -27
- package/esm/cli/shared/project-creation.js +1 -1
- package/esm/cli/sync/state.d.ts +20 -0
- package/esm/cli/sync/state.d.ts.map +1 -0
- package/esm/cli/sync/state.js +193 -0
- package/esm/deno.js +2 -2
- package/esm/extensions/ext-llm-anthropic/src/anthropic-request-builder.d.ts.map +1 -1
- package/esm/extensions/ext-llm-anthropic/src/anthropic-request-builder.js +852 -21
- package/esm/extensions/ext-observability-sentry/src/policy.d.ts +2 -0
- package/esm/extensions/ext-observability-sentry/src/policy.d.ts.map +1 -1
- package/esm/extensions/ext-observability-sentry/src/policy.js +214 -3
- package/esm/src/agent/conversation/delegation-policy.d.ts +2 -0
- package/esm/src/agent/conversation/delegation-policy.d.ts.map +1 -1
- package/esm/src/agent/conversation/delegation-policy.js +13 -3
- package/esm/src/agent/conversation/hosted-terminal.d.ts.map +1 -1
- package/esm/src/agent/conversation/hosted-terminal.js +6 -2
- package/esm/src/agent/conversation/run-chunk-mirror.d.ts.map +1 -1
- package/esm/src/agent/conversation/run-chunk-mirror.js +14 -2
- package/esm/src/agent/factory.d.ts.map +1 -1
- package/esm/src/agent/factory.js +22 -11
- package/esm/src/agent/hosted/chat-runtime-tool-assembly.d.ts +2 -0
- package/esm/src/agent/hosted/chat-runtime-tool-assembly.d.ts.map +1 -1
- package/esm/src/agent/hosted/chat-runtime-tool-assembly.js +6 -1
- package/esm/src/agent/hosted/child-fork-execution-runner.d.ts +2 -1
- package/esm/src/agent/hosted/child-fork-execution-runner.d.ts.map +1 -1
- package/esm/src/agent/hosted/child-fork-execution-runner.js +6 -3
- package/esm/src/agent/hosted/child-fork-step-message-preparation.d.ts +12 -3
- package/esm/src/agent/hosted/child-fork-step-message-preparation.d.ts.map +1 -1
- package/esm/src/agent/hosted/child-fork-step-message-preparation.js +16 -3
- package/esm/src/agent/hosted/cloud-agent-chat-execution.d.ts +1 -1
- package/esm/src/agent/hosted/cloud-agent-chat-execution.d.ts.map +1 -1
- package/esm/src/agent/hosted/cloud-agent-chat-execution.js +3 -3
- package/esm/src/agent/hosted/cloud-agent-child-tools.d.ts +11 -0
- package/esm/src/agent/hosted/cloud-agent-child-tools.d.ts.map +1 -1
- package/esm/src/agent/hosted/cloud-agent-child-tools.js +2 -3
- package/esm/src/agent/hosted/cloud-agent-config.d.ts +1 -0
- package/esm/src/agent/hosted/cloud-agent-config.d.ts.map +1 -1
- package/esm/src/agent/hosted/cloud-runtime-system-messages.d.ts +16 -1
- package/esm/src/agent/hosted/cloud-runtime-system-messages.d.ts.map +1 -1
- package/esm/src/agent/hosted/cloud-runtime-system-messages.js +13 -3
- package/esm/src/agent/hosted/default-chat-runtime.d.ts +2 -1
- package/esm/src/agent/hosted/default-chat-runtime.d.ts.map +1 -1
- package/esm/src/agent/hosted/default-chat-runtime.js +18 -7
- package/esm/src/agent/hosted/default-invoke-agent-tool.d.ts +2 -1
- package/esm/src/agent/hosted/default-invoke-agent-tool.d.ts.map +1 -1
- package/esm/src/agent/hosted/default-invoke-agent-tool.js +11 -3
- package/esm/src/agent/hosted/default-project-steering-refresh.d.ts +2 -1
- package/esm/src/agent/hosted/default-project-steering-refresh.d.ts.map +1 -1
- package/esm/src/agent/hosted/default-project-steering-refresh.js +4 -1
- package/esm/src/agent/hosted/runtime-state-resolver.d.ts +6 -4
- package/esm/src/agent/hosted/runtime-state-resolver.d.ts.map +1 -1
- package/esm/src/agent/hosted/runtime-state-resolver.js +8 -11
- package/esm/src/agent/index.d.ts +3 -3
- package/esm/src/agent/index.d.ts.map +1 -1
- package/esm/src/agent/project/agent-runtime.d.ts.map +1 -1
- package/esm/src/agent/project/agent-runtime.js +6 -3
- package/esm/src/agent/runtime/agent-definition.d.ts +68 -66
- package/esm/src/agent/runtime/agent-definition.d.ts.map +1 -1
- package/esm/src/agent/runtime/agent-definition.js +15 -2
- package/esm/src/agent/runtime/agent-invocation-contract.d.ts +2 -0
- package/esm/src/agent/runtime/agent-invocation-contract.d.ts.map +1 -1
- package/esm/src/agent/runtime/agent-markdown-adapter.js +1 -1
- package/esm/src/agent/runtime/agent-runtime-step.d.ts +11 -5
- package/esm/src/agent/runtime/agent-runtime-step.d.ts.map +1 -1
- package/esm/src/agent/runtime/agent-runtime-step.js +23 -6
- package/esm/src/agent/runtime/call-context.d.ts +42 -11
- package/esm/src/agent/runtime/call-context.d.ts.map +1 -1
- package/esm/src/agent/runtime/call-context.js +480 -42
- package/esm/src/agent/runtime/chat-stream-handler.d.ts +18 -0
- package/esm/src/agent/runtime/chat-stream-handler.d.ts.map +1 -1
- package/esm/src/agent/runtime/chat-stream-handler.js +38 -18
- package/esm/src/agent/runtime/effective-agent-system.d.ts +13 -4
- package/esm/src/agent/runtime/effective-agent-system.d.ts.map +1 -1
- package/esm/src/agent/runtime/effective-agent-system.js +29 -0
- package/esm/src/agent/runtime/index.d.ts +1 -0
- package/esm/src/agent/runtime/index.d.ts.map +1 -1
- package/esm/src/agent/runtime/index.js +638 -53
- package/esm/src/agent/runtime/load-skill-tool.d.ts +33 -3
- package/esm/src/agent/runtime/load-skill-tool.d.ts.map +1 -1
- package/esm/src/agent/runtime/load-skill-tool.js +152 -21
- package/esm/src/agent/runtime/model-resolution.d.ts +3 -0
- package/esm/src/agent/runtime/model-resolution.d.ts.map +1 -1
- package/esm/src/agent/runtime/model-resolution.js +14 -0
- package/esm/src/agent/runtime/model-transport.d.ts +1 -0
- package/esm/src/agent/runtime/model-transport.d.ts.map +1 -1
- package/esm/src/agent/runtime/model-transport.js +5 -2
- package/esm/src/agent/runtime/run-runtime-context.d.ts +4 -0
- package/esm/src/agent/runtime/run-runtime-context.d.ts.map +1 -1
- package/esm/src/agent/runtime/run-runtime-context.js +9 -3
- package/esm/src/agent/runtime/runtime-tool-config.d.ts +1 -0
- package/esm/src/agent/runtime/runtime-tool-config.d.ts.map +1 -1
- package/esm/src/agent/runtime/skill-prompt.d.ts +3 -0
- package/esm/src/agent/runtime/skill-prompt.d.ts.map +1 -1
- package/esm/src/agent/runtime/skill-prompt.js +113 -25
- package/esm/src/agent/runtime/streamed-assistant-message.d.ts +22 -2
- package/esm/src/agent/runtime/streamed-assistant-message.d.ts.map +1 -1
- package/esm/src/agent/runtime/streamed-assistant-message.js +26 -5
- package/esm/src/agent/runtime/tool-inventory.d.ts.map +1 -1
- package/esm/src/agent/runtime/tool-inventory.js +13 -9
- package/esm/src/agent/runtime/tool-result-continuation.d.ts +4 -2
- package/esm/src/agent/runtime/tool-result-continuation.d.ts.map +1 -1
- package/esm/src/agent/runtime/tool-result-continuation.js +24 -20
- package/esm/src/agent/schemas/agent.schema.d.ts +2 -2
- package/esm/src/agent/service/runtime.js +1 -1
- package/esm/src/agent/streaming/fork-runtime-stream.d.ts +5 -4
- package/esm/src/agent/streaming/fork-runtime-stream.d.ts.map +1 -1
- package/esm/src/agent/types.d.ts +14 -1
- package/esm/src/agent/types.d.ts.map +1 -1
- package/esm/src/chat/chat-ui-message-helpers.d.ts.map +1 -1
- package/esm/src/chat/chat-ui-message-helpers.js +75 -16
- package/esm/src/config/loader.d.ts.map +1 -1
- package/esm/src/config/loader.js +37 -1
- package/esm/src/errors/catalog/build-errors.d.ts.map +1 -1
- package/esm/src/errors/catalog/build-errors.js +14 -0
- package/esm/src/errors/error-registry/build.d.ts +2 -0
- package/esm/src/errors/error-registry/build.d.ts.map +1 -1
- package/esm/src/errors/error-registry/build.js +8 -0
- package/esm/src/errors/error-registry/deploy.d.ts +4 -0
- package/esm/src/errors/error-registry/deploy.d.ts.map +1 -1
- package/esm/src/errors/error-registry/deploy.js +16 -0
- package/esm/src/errors/error-registry.d.ts +3 -0
- package/esm/src/errors/error-registry.d.ts.map +1 -1
- package/esm/src/errors/index.d.ts +2 -1
- package/esm/src/errors/index.d.ts.map +1 -1
- package/esm/src/errors/index.js +4 -3
- package/esm/src/errors/tenant-classification.d.ts +25 -0
- package/esm/src/errors/tenant-classification.d.ts.map +1 -0
- package/esm/src/errors/tenant-classification.js +61 -0
- package/esm/src/extensions/builtin-extensions.d.ts +10 -15
- package/esm/src/extensions/builtin-extensions.d.ts.map +1 -1
- package/esm/src/extensions/builtin-extensions.js +32 -26
- package/esm/src/extensions/deferred-extension.d.ts +4 -4
- package/esm/src/extensions/deferred-extension.js +4 -4
- package/esm/src/extensions/index.d.ts +1 -0
- package/esm/src/extensions/index.d.ts.map +1 -1
- package/esm/src/extensions/index.js +1 -0
- package/esm/src/html/hydration-script-builder/hydration-runtime.generated.js +1 -1
- package/esm/src/integrations/_data.d.ts.map +1 -1
- package/esm/src/integrations/_data.js +6 -0
- package/esm/src/integrations/schema.d.ts +8 -0
- package/esm/src/integrations/schema.d.ts.map +1 -1
- package/esm/src/integrations/schema.js +3 -0
- package/esm/src/integrations/types.d.ts +2 -0
- package/esm/src/integrations/types.d.ts.map +1 -1
- package/esm/src/internal-agents/run-stream.d.ts.map +1 -1
- package/esm/src/internal-agents/run-stream.js +35 -20
- package/esm/src/internal-agents/run-system-prompt.d.ts +7 -2
- package/esm/src/internal-agents/run-system-prompt.d.ts.map +1 -1
- package/esm/src/internal-agents/run-system-prompt.js +19 -13
- package/esm/src/internal-agents/schema.d.ts +2 -0
- package/esm/src/internal-agents/schema.d.ts.map +1 -1
- 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 +2 -18
- package/esm/src/modules/react-loader/ssr-module-loader/ssr-dependency-validator.d.ts +11 -0
- package/esm/src/modules/react-loader/ssr-module-loader/ssr-dependency-validator.d.ts.map +1 -1
- package/esm/src/modules/react-loader/ssr-module-loader/ssr-dependency-validator.js +53 -6
- package/esm/src/observability/application-error-contract.d.ts +4 -0
- package/esm/src/observability/application-error-contract.d.ts.map +1 -1
- package/esm/src/observability/application-errors.d.ts.map +1 -1
- package/esm/src/observability/application-errors.js +64 -3
- package/esm/src/platform/adapters/runtime/deno/http-server.d.ts.map +1 -1
- package/esm/src/platform/adapters/runtime/deno/http-server.js +2 -10
- package/esm/src/platform/adapters/runtime/shared/request-peer.d.ts +14 -0
- package/esm/src/platform/adapters/runtime/shared/request-peer.d.ts.map +1 -1
- package/esm/src/platform/adapters/runtime/shared/request-peer.js +82 -0
- package/esm/src/platform/compat/http/pinned-fetch.d.ts +1 -1
- package/esm/src/provider/runtime-loader/provider-http.d.ts +5 -1
- package/esm/src/provider/runtime-loader/provider-http.d.ts.map +1 -1
- package/esm/src/provider/runtime-loader/provider-http.js +55 -17
- package/esm/src/provider/shared/index.d.ts +1 -0
- package/esm/src/provider/shared/index.d.ts.map +1 -1
- package/esm/src/provider/shared/index.js +2 -0
- package/esm/src/provider/types.d.ts +1 -0
- package/esm/src/provider/types.d.ts.map +1 -1
- package/esm/src/react/components/ui/adapter/builtin/combobox.d.ts +3 -0
- package/esm/src/react/components/ui/adapter/builtin/combobox.d.ts.map +1 -0
- package/esm/src/react/components/ui/adapter/builtin/combobox.js +204 -0
- package/esm/src/react/components/ui/adapter/builtin/dialog.d.ts +3 -0
- package/esm/src/react/components/ui/adapter/builtin/dialog.d.ts.map +1 -0
- package/esm/src/react/components/ui/adapter/builtin/dialog.js +20 -0
- package/esm/src/react/components/ui/adapter/builtin/drawer.d.ts +3 -0
- package/esm/src/react/components/ui/adapter/builtin/drawer.d.ts.map +1 -0
- package/esm/src/react/components/ui/adapter/builtin/drawer.js +21 -0
- package/esm/src/react/components/ui/adapter/builtin/index.d.ts.map +1 -1
- package/esm/src/react/components/ui/adapter/builtin/index.js +10 -0
- package/esm/src/react/components/ui/adapter/builtin/popover.d.ts +3 -0
- package/esm/src/react/components/ui/adapter/builtin/popover.d.ts.map +1 -0
- package/esm/src/react/components/ui/adapter/builtin/popover.js +28 -0
- package/esm/src/react/components/ui/adapter/builtin/tabs.d.ts +3 -0
- package/esm/src/react/components/ui/adapter/builtin/tabs.d.ts.map +1 -0
- package/esm/src/react/components/ui/adapter/builtin/tabs.js +73 -0
- package/esm/src/react/components/ui/adapter/context.d.ts.map +1 -1
- package/esm/src/react/components/ui/adapter/context.js +10 -0
- package/esm/src/react/components/ui/adapter/contract.d.ts +212 -0
- package/esm/src/react/components/ui/adapter/contract.d.ts.map +1 -1
- package/esm/src/react/components/ui/adapter/token-scope.d.ts +24 -0
- package/esm/src/react/components/ui/adapter/token-scope.d.ts.map +1 -0
- package/esm/src/react/components/ui/adapter/token-scope.js +26 -0
- package/esm/src/react/components/ui/alert-dialog.d.ts +101 -0
- package/esm/src/react/components/ui/alert-dialog.d.ts.map +1 -0
- package/esm/src/react/components/ui/alert-dialog.js +181 -0
- package/esm/src/react/components/ui/aspect-ratio.d.ts +18 -0
- package/esm/src/react/components/ui/aspect-ratio.d.ts.map +1 -0
- package/esm/src/react/components/ui/aspect-ratio.js +13 -0
- package/esm/src/react/components/ui/autocomplete.d.ts +67 -0
- package/esm/src/react/components/ui/autocomplete.d.ts.map +1 -0
- package/esm/src/react/components/ui/autocomplete.js +59 -0
- package/esm/src/react/components/ui/breadcrumb.d.ts +86 -0
- package/esm/src/react/components/ui/breadcrumb.d.ts.map +1 -0
- package/esm/src/react/components/ui/breadcrumb.js +67 -0
- package/esm/src/react/components/ui/calendar.d.ts +40 -0
- package/esm/src/react/components/ui/calendar.d.ts.map +1 -0
- package/esm/src/react/components/ui/calendar.js +170 -0
- package/esm/src/react/components/ui/combobox.d.ts +74 -0
- package/esm/src/react/components/ui/combobox.d.ts.map +1 -0
- package/esm/src/react/components/ui/combobox.js +100 -0
- package/esm/src/react/components/ui/context-menu.d.ts +116 -0
- package/esm/src/react/components/ui/context-menu.d.ts.map +1 -0
- package/esm/src/react/components/ui/context-menu.js +168 -0
- package/esm/src/react/components/ui/date-picker.d.ts +69 -0
- package/esm/src/react/components/ui/date-picker.d.ts.map +1 -0
- package/esm/src/react/components/ui/date-picker.js +96 -0
- package/esm/src/react/components/ui/dialog.d.ts +41 -11
- package/esm/src/react/components/ui/dialog.d.ts.map +1 -1
- package/esm/src/react/components/ui/dialog.js +47 -28
- package/esm/src/react/components/ui/drawer.d.ts +31 -8
- package/esm/src/react/components/ui/drawer.d.ts.map +1 -1
- package/esm/src/react/components/ui/drawer.js +33 -22
- package/esm/src/react/components/ui/dropdown-menu.d.ts.map +1 -1
- package/esm/src/react/components/ui/dropdown-menu.js +7 -75
- package/esm/src/react/components/ui/field.d.ts +70 -0
- package/esm/src/react/components/ui/field.d.ts.map +1 -0
- package/esm/src/react/components/ui/field.js +161 -0
- package/esm/src/react/components/ui/file-type.d.ts +9 -8
- package/esm/src/react/components/ui/file-type.d.ts.map +1 -1
- package/esm/src/react/components/ui/file-type.js +8 -8
- package/esm/src/react/components/ui/hover-card.d.ts +82 -0
- package/esm/src/react/components/ui/hover-card.d.ts.map +1 -0
- package/esm/src/react/components/ui/hover-card.js +140 -0
- package/esm/src/react/components/ui/index.d.ts +23 -2
- package/esm/src/react/components/ui/index.d.ts.map +1 -1
- package/esm/src/react/components/ui/index.js +21 -0
- package/esm/src/react/components/ui/input-otp.d.ts +37 -0
- package/esm/src/react/components/ui/input-otp.d.ts.map +1 -0
- package/esm/src/react/components/ui/input-otp.js +42 -0
- package/esm/src/react/components/ui/menu-keyboard.d.ts +8 -0
- package/esm/src/react/components/ui/menu-keyboard.d.ts.map +1 -0
- package/esm/src/react/components/ui/menu-keyboard.js +76 -0
- package/esm/src/react/components/ui/menubar.d.ts +98 -0
- package/esm/src/react/components/ui/menubar.d.ts.map +1 -0
- package/esm/src/react/components/ui/menubar.js +173 -0
- package/esm/src/react/components/ui/meter.d.ts +45 -0
- package/esm/src/react/components/ui/meter.d.ts.map +1 -0
- package/esm/src/react/components/ui/meter.js +59 -0
- package/esm/src/react/components/ui/modal-surface.d.ts +7 -1
- package/esm/src/react/components/ui/modal-surface.d.ts.map +1 -1
- package/esm/src/react/components/ui/modal-surface.js +23 -6
- package/esm/src/react/components/ui/navigation-menu.d.ts +101 -0
- package/esm/src/react/components/ui/navigation-menu.d.ts.map +1 -0
- package/esm/src/react/components/ui/navigation-menu.js +195 -0
- package/esm/src/react/components/ui/number-field.d.ts +46 -0
- package/esm/src/react/components/ui/number-field.d.ts.map +1 -0
- package/esm/src/react/components/ui/number-field.js +121 -0
- package/esm/src/react/components/ui/pagination.d.ts +77 -0
- package/esm/src/react/components/ui/pagination.d.ts.map +1 -0
- package/esm/src/react/components/ui/pagination.js +62 -0
- package/esm/src/react/components/ui/popover.d.ts +42 -13
- package/esm/src/react/components/ui/popover.d.ts.map +1 -1
- package/esm/src/react/components/ui/popover.js +25 -12
- package/esm/src/react/components/ui/scroll-area.d.ts +38 -0
- package/esm/src/react/components/ui/scroll-area.d.ts.map +1 -0
- package/esm/src/react/components/ui/scroll-area.js +35 -0
- package/esm/src/react/components/ui/separator.d.ts +20 -0
- package/esm/src/react/components/ui/separator.d.ts.map +1 -0
- package/esm/src/react/components/ui/separator.js +13 -0
- package/esm/src/react/components/ui/slider.d.ts +44 -0
- package/esm/src/react/components/ui/slider.d.ts.map +1 -0
- package/esm/src/react/components/ui/slider.js +46 -0
- package/esm/src/react/components/ui/status.d.ts +6 -5
- package/esm/src/react/components/ui/status.d.ts.map +1 -1
- package/esm/src/react/components/ui/status.js +4 -4
- package/esm/src/react/components/ui/tabs.d.ts +32 -9
- package/esm/src/react/components/ui/tabs.d.ts.map +1 -1
- package/esm/src/react/components/ui/tabs.js +46 -22
- package/esm/src/react/components/ui/toggle.d.ts +26 -0
- package/esm/src/react/components/ui/toggle.d.ts.map +1 -0
- package/esm/src/react/components/ui/toggle.js +29 -0
- package/esm/src/react/components/ui/use-isomorphic-layout-effect.d.ts +2 -1
- package/esm/src/react/components/ui/use-isomorphic-layout-effect.d.ts.map +1 -1
- package/esm/src/react/components/ui/use-isomorphic-layout-effect.js +6 -3
- package/esm/src/rendering/chunk-optimizer/source-imports.d.ts.map +1 -1
- package/esm/src/rendering/chunk-optimizer/source-imports.js +4 -114
- package/esm/src/rendering/orchestrator/css-candidate-manifest.d.ts.map +1 -1
- package/esm/src/rendering/orchestrator/css-candidate-manifest.js +30 -1
- package/esm/src/rendering/orchestrator/module-loader/build-failure.d.ts +10 -0
- package/esm/src/rendering/orchestrator/module-loader/build-failure.d.ts.map +1 -1
- package/esm/src/rendering/orchestrator/module-loader/build-failure.js +50 -3
- package/esm/src/rendering/orchestrator/module-loader/dependency-resolver.d.ts +2 -0
- package/esm/src/rendering/orchestrator/module-loader/dependency-resolver.d.ts.map +1 -1
- package/esm/src/rendering/orchestrator/module-loader/dependency-resolver.js +21 -6
- package/esm/src/rendering/orchestrator/module-loader/index.d.ts +2 -1
- package/esm/src/rendering/orchestrator/module-loader/index.d.ts.map +1 -1
- package/esm/src/rendering/orchestrator/module-loader/index.js +190 -7
- package/esm/src/rendering/orchestrator/module-loader/module-persistence.d.ts +4 -0
- package/esm/src/rendering/orchestrator/module-loader/module-persistence.d.ts.map +1 -1
- package/esm/src/rendering/orchestrator/module-loader/module-persistence.js +374 -7
- package/esm/src/rendering/orchestrator/pipeline.d.ts.map +1 -1
- package/esm/src/rendering/orchestrator/pipeline.js +12 -1
- package/esm/src/runs/runs-client.d.ts +2 -4
- package/esm/src/runs/runs-client.d.ts.map +1 -1
- package/esm/src/runs/schemas.d.ts +18 -8
- package/esm/src/runs/schemas.d.ts.map +1 -1
- package/esm/src/runs/schemas.js +26 -0
- package/esm/src/runtime/model-call-context.d.ts +6 -1
- package/esm/src/runtime/model-call-context.d.ts.map +1 -1
- package/esm/src/runtime/runtime-bridge.d.ts.map +1 -1
- package/esm/src/runtime/runtime-bridge.js +133 -15
- package/esm/src/schedule/factory.d.ts +8 -2
- package/esm/src/schedule/factory.d.ts.map +1 -1
- package/esm/src/schedule/factory.js +0 -8
- package/esm/src/schedule/index.d.ts +10 -1
- package/esm/src/schedule/index.d.ts.map +1 -1
- package/esm/src/schedule/index.js +9 -0
- package/esm/src/schedule/types.d.ts +30 -11
- package/esm/src/schedule/types.d.ts.map +1 -1
- package/esm/src/schedule/validation.d.ts +17 -0
- package/esm/src/schedule/validation.d.ts.map +1 -1
- package/esm/src/schedule/validation.js +93 -5
- package/esm/src/security/sandbox/worker-pool.d.ts.map +1 -1
- package/esm/src/security/sandbox/worker-pool.js +6 -1
- package/esm/src/server/bootstrap.d.ts.map +1 -1
- package/esm/src/server/bootstrap.js +6 -0
- package/esm/src/server/dev-server/index.d.ts +1 -1
- package/esm/src/server/dev-server/index.d.ts.map +1 -1
- package/esm/src/server/dev-server/server.d.ts +7 -3
- package/esm/src/server/dev-server/server.d.ts.map +1 -1
- package/esm/src/server/dev-server/server.js +12 -3
- package/esm/src/server/dev-server/types.d.ts +7 -1
- package/esm/src/server/dev-server/types.d.ts.map +1 -1
- package/esm/src/server/dev-server.d.ts +1 -1
- package/esm/src/server/dev-server.d.ts.map +1 -1
- package/esm/src/server/handlers/dev/framework-candidates.generated.d.ts.map +1 -1
- package/esm/src/server/handlers/dev/framework-candidates.generated.js +2509 -34
- package/esm/src/server/handlers/dev/projects/index.d.ts.map +1 -1
- package/esm/src/server/handlers/dev/projects/index.js +3 -0
- package/esm/src/server/handlers/request/agent-stream.handler.d.ts.map +1 -1
- package/esm/src/server/handlers/request/agent-stream.handler.js +29 -24
- package/esm/src/server/index.d.ts +3 -3
- package/esm/src/server/index.d.ts.map +1 -1
- package/esm/src/server/index.js +10 -5
- package/esm/src/server/node-handler.d.ts.map +1 -1
- package/esm/src/server/node-handler.js +4 -1
- package/esm/src/server/production-server.d.ts.map +1 -1
- package/esm/src/server/production-server.js +2 -1
- package/esm/src/server/project-env/cache.d.ts +17 -0
- package/esm/src/server/project-env/cache.d.ts.map +1 -1
- package/esm/src/server/project-env/cache.js +78 -2
- package/esm/src/server/project-env/fetcher.d.ts.map +1 -1
- package/esm/src/server/project-env/fetcher.js +24 -14
- package/esm/src/server/project-env/index.d.ts +1 -1
- package/esm/src/server/project-env/index.d.ts.map +1 -1
- package/esm/src/server/project-env/index.js +1 -1
- package/esm/src/server/project-env/internal-authorization.d.ts +7 -0
- package/esm/src/server/project-env/internal-authorization.d.ts.map +1 -0
- package/esm/src/server/project-env/internal-authorization.js +32 -0
- package/esm/src/server/runtime-handler/index.d.ts.map +1 -1
- package/esm/src/server/runtime-handler/index.js +1 -1
- package/esm/src/server/runtime-handler/projects-handler.d.ts +1 -1
- package/esm/src/server/runtime-handler/projects-handler.d.ts.map +1 -1
- package/esm/src/server/runtime-handler/projects-handler.js +4 -2
- package/esm/src/transforms/esm/http-bundler.d.ts.map +1 -1
- package/esm/src/transforms/esm/http-bundler.js +6 -5
- package/esm/src/transforms/esm/http-cache-helpers.d.ts +11 -0
- package/esm/src/transforms/esm/http-cache-helpers.d.ts.map +1 -1
- package/esm/src/transforms/esm/http-cache-helpers.js +35 -0
- package/esm/src/transforms/esm/http-cache.d.ts.map +1 -1
- package/esm/src/transforms/esm/http-cache.js +16 -10
- package/esm/src/transforms/esm/specifier-resolver.d.ts.map +1 -1
- package/esm/src/transforms/esm/specifier-resolver.js +87 -7
- package/esm/src/transforms/import-rewriter/strategies/alias-strategy.d.ts +2 -0
- package/esm/src/transforms/import-rewriter/strategies/alias-strategy.d.ts.map +1 -1
- package/esm/src/transforms/import-rewriter/strategies/alias-strategy.js +11 -6
- package/esm/src/transforms/md/compiler/md-compiler.d.ts.map +1 -1
- package/esm/src/transforms/md/compiler/md-compiler.js +12 -5
- package/esm/src/transforms/mdx/compiler/frontmatter-extractor.d.ts +2 -0
- package/esm/src/transforms/mdx/compiler/frontmatter-extractor.d.ts.map +1 -1
- package/esm/src/transforms/mdx/compiler/frontmatter-extractor.js +33 -1
- package/esm/src/transforms/mdx/compiler/mdx-compiler.d.ts.map +1 -1
- package/esm/src/transforms/mdx/compiler/mdx-compiler.js +46 -7
- 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 +8 -2
- package/esm/src/transforms/mdx/esm-module-loader/cache-format.d.ts +1 -0
- 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 +3 -0
- package/esm/src/transforms/mdx/esm-module-loader/loader-helpers.d.ts +4 -0
- package/esm/src/transforms/mdx/esm-module-loader/loader-helpers.d.ts.map +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/loader-helpers.js +44 -8
- package/esm/src/transforms/mdx/esm-module-loader/missing-module.d.ts +2 -0
- package/esm/src/transforms/mdx/esm-module-loader/missing-module.d.ts.map +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/missing-module.js +4 -0
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/http-fallback.d.ts.map +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/http-fallback.js +5 -1
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/http-fetcher.d.ts +2 -0
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/http-fetcher.d.ts.map +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/http-fetcher.js +50 -11
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/nested-imports.d.ts +24 -12
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/nested-imports.d.ts.map +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/module-fetcher/nested-imports.js +201 -18
- package/esm/src/transforms/mdx/esm-module-loader/types.d.ts +5 -0
- package/esm/src/transforms/mdx/esm-module-loader/types.d.ts.map +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/utils/source-spans.d.ts +22 -2
- package/esm/src/transforms/mdx/esm-module-loader/utils/source-spans.d.ts.map +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/utils/source-spans.js +2080 -129
- package/esm/src/transforms/mdx/esm-module-loader/utils/stub-module.d.ts +11 -1
- package/esm/src/transforms/mdx/esm-module-loader/utils/stub-module.d.ts.map +1 -1
- package/esm/src/transforms/mdx/esm-module-loader/utils/stub-module.js +32 -15
- package/esm/src/transforms/pipeline/stages/compile.d.ts.map +1 -1
- package/esm/src/transforms/pipeline/stages/compile.js +44 -0
- package/esm/src/transforms/shared/specifier-suffix.d.ts +25 -0
- package/esm/src/transforms/shared/specifier-suffix.d.ts.map +1 -0
- package/esm/src/transforms/shared/specifier-suffix.js +43 -0
- package/esm/src/trigger/index.d.ts +2 -2
- package/esm/src/trigger/index.d.ts.map +1 -1
- package/esm/src/trigger/index.js +1 -1
- package/esm/src/trigger/local-runner.d.ts +2 -2
- package/esm/src/trigger/local-runner.d.ts.map +1 -1
- package/esm/src/trigger/local-runner.js +11 -4
- package/esm/src/trigger/target.d.ts +97 -5
- package/esm/src/trigger/target.d.ts.map +1 -1
- package/esm/src/trigger/target.js +175 -5
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/esm/src/webhook/types.d.ts +21 -6
- package/esm/src/webhook/types.d.ts.map +1 -1
- package/esm/src/webhook/validation.d.ts.map +1 -1
- package/esm/src/webhook/validation.js +27 -39
- package/esm/templates/index.d.ts +1 -1
- package/esm/templates/index.d.ts.map +1 -1
- package/esm/templates/loader.d.ts +6 -6
- package/esm/templates/loader.d.ts.map +1 -1
- package/esm/templates/loader.js +34 -18
- package/esm/templates/manifest.generated.d.ts +3 -0
- package/esm/templates/manifest.generated.d.ts.map +1 -0
- package/esm/templates/manifest.generated.js +2 -0
- package/package.json +8 -8
- package/esm/templates/manifest.d.ts +0 -664
- package/esm/templates/manifest.d.ts.map +0 -1
- package/esm/templates/manifest.js +0 -662
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { getHostEnv } from "../../platform/compat/process.js";
|
|
2
|
+
import { encodeBase64 } from "../../utils/index.js";
|
|
3
|
+
import { getEnvSource } from "../../utils/env-loader.js";
|
|
4
|
+
const INTERNAL_USER_ENV = "VERYFRONT_API_INTERNAL_USER";
|
|
5
|
+
const INTERNAL_PASS_ENV = "VERYFRONT_API_INTERNAL_PASS";
|
|
6
|
+
const LOCAL_CLI_PROXY_MODE_ENV = "VERYFRONT_CLI_LOCAL_PROXY_MODE";
|
|
7
|
+
/** Whether project env reads require the hosted runtime's internal API credential. */
|
|
8
|
+
export function requiresProjectEnvInternalAuthorization() {
|
|
9
|
+
if (getHostEnv("PROXY_MODE") !== "1")
|
|
10
|
+
return false;
|
|
11
|
+
const isLocalCliProxyMode = getHostEnv(LOCAL_CLI_PROXY_MODE_ENV) === "1" &&
|
|
12
|
+
getEnvSource(LOCAL_CLI_PROXY_MODE_ENV).source === "process";
|
|
13
|
+
return !isLocalCliProxyMode;
|
|
14
|
+
}
|
|
15
|
+
/** Name the missing hosted runtime credentials without exposing their values. */
|
|
16
|
+
export function getMissingProjectEnvInternalCredentialDetail() {
|
|
17
|
+
const missing = [
|
|
18
|
+
getHostEnv(INTERNAL_USER_ENV) ? undefined : INTERNAL_USER_ENV,
|
|
19
|
+
getHostEnv(INTERNAL_PASS_ENV) ? undefined : INTERNAL_PASS_ENV,
|
|
20
|
+
].filter((name) => name !== undefined);
|
|
21
|
+
return missing.length > 0
|
|
22
|
+
? `${missing.join(" and ")} must be set in hosted proxy mode`
|
|
23
|
+
: undefined;
|
|
24
|
+
}
|
|
25
|
+
/** Build the internal API authorization header when both credentials are present. */
|
|
26
|
+
export function getProjectEnvInternalAuthorization() {
|
|
27
|
+
const username = getHostEnv(INTERNAL_USER_ENV);
|
|
28
|
+
const password = getHostEnv(INTERNAL_PASS_ENV);
|
|
29
|
+
if (!username || !password)
|
|
30
|
+
return undefined;
|
|
31
|
+
return `Basic ${encodeBase64(`${username}:${password}`)}`;
|
|
32
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/src/server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MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC"}
|
|
@@ -376,7 +376,7 @@ export function createVeryfrontHandler(projectDir, adapter, opts = { projectDir
|
|
|
376
376
|
updateRequestProfileContext({ projectSlug: projectRes.projectSlug });
|
|
377
377
|
setProjectAttributes(spanInfo.span, projectRes.projectSlug, projectRes.proxyEnv);
|
|
378
378
|
// Handle projects discovery UI
|
|
379
|
-
if (shouldHandleProjectsUI(url.pathname, projectRes.projectSlug, projectRes.parsedDomain)) {
|
|
379
|
+
if (shouldHandleProjectsUI(request, url.pathname, projectRes.projectSlug, projectRes.parsedDomain)) {
|
|
380
380
|
const response = await handleProjectsRequest(request, url, buildMinimalContext(projectDir, adapter, securityLoader.getSecurityConfig(), isDebugEnabled(), config));
|
|
381
381
|
if (response)
|
|
382
382
|
return response;
|
|
@@ -11,7 +11,7 @@ import type { ParsedDomain } from "../utils/domain-parser.js";
|
|
|
11
11
|
/**
|
|
12
12
|
* Check if the request should be handled by the projects discovery UI.
|
|
13
13
|
*/
|
|
14
|
-
export declare function shouldHandleProjectsUI(pathname: string, projectSlug: string | undefined, parsedDomain: ParsedDomain): boolean;
|
|
14
|
+
export declare function shouldHandleProjectsUI(req: Request, pathname: string, projectSlug: string | undefined, parsedDomain: ParsedDomain): boolean;
|
|
15
15
|
/**
|
|
16
16
|
* Handle the projects discovery UI requests.
|
|
17
17
|
* Returns a response or null if not handled.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"projects-handler.d.ts","sourceRoot":"","sources":["../../../../src/src/server/runtime-handler/projects-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"projects-handler.d.ts","sourceRoot":"","sources":["../../../../src/src/server/runtime-handler/projects-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAI9D;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,OAAO,EACZ,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,GAAG,SAAS,EAC/B,YAAY,EAAE,YAAY,GACzB,OAAO,CAYT;AAED;;;GAGG;AACH,wBAAsB,qBAAqB,CACzC,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,cAAc,GAClB,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAgC1B"}
|
|
@@ -9,16 +9,18 @@
|
|
|
9
9
|
import { createFileSystem } from "../../platform/compat/fs.js";
|
|
10
10
|
import { cwd } from "../../platform/compat/process.js";
|
|
11
11
|
import { serverLogger } from "../../utils/index.js";
|
|
12
|
+
import { isTrustedLocalControlRequest } from "../../security/http/local-control-request.js";
|
|
12
13
|
import { defaultDiscoveryCache, standardProjectDirs } from "./local-project-discovery.js";
|
|
13
14
|
const logger = serverLogger.component("projects-handler");
|
|
14
15
|
/**
|
|
15
16
|
* Check if the request should be handled by the projects discovery UI.
|
|
16
17
|
*/
|
|
17
|
-
export function shouldHandleProjectsUI(pathname, projectSlug, parsedDomain) {
|
|
18
|
+
export function shouldHandleProjectsUI(req, pathname, projectSlug, parsedDomain) {
|
|
18
19
|
const isProjectsPath = pathname === "/" ||
|
|
19
20
|
pathname.startsWith("/_projects") ||
|
|
20
21
|
pathname === "/_vf/api/projects";
|
|
21
|
-
return (
|
|
22
|
+
return (isTrustedLocalControlRequest(req) &&
|
|
23
|
+
!projectSlug &&
|
|
22
24
|
!parsedDomain.slug &&
|
|
23
25
|
parsedDomain.isVeryfrontDomain &&
|
|
24
26
|
isProjectsPath);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-bundler.d.ts","sourceRoot":"","sources":["../../../../src/src/transforms/esm/http-bundler.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAEhE,OAAO,EAAyB,YAAY,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"http-bundler.d.ts","sourceRoot":"","sources":["../../../../src/src/transforms/esm/http-bundler.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAEhE,OAAO,EAAyB,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAgCrE,qCAAqC;AACrC,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED,yDAAyD;AACzD,OAAO,EAAE,YAAY,EAAE,CAAC;AAExB,MAAM,WAAW,iBAAiB;IAChC,OAAO,CAAC,EAAE,OAAO,KAAK,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAeD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,GAAE,iBAAsB,GAAG,MAAM,CA4HxE;AA4DD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,EACZ,YAAY,CAAC,EAAE,MAAM,GACpB,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAyD1B"}
|
|
@@ -15,6 +15,7 @@ import { readHttpModuleText } from "../shared/http-module-response.js";
|
|
|
15
15
|
import { sanitizeUrlForSpan } from "../../utils/logger/redact.js";
|
|
16
16
|
import { snapshotThrowableDiagnostic } from "../../errors/safe-diagnostics.js";
|
|
17
17
|
import { MAX_TIMER_DELAY_MS } from "../../utils/constants/limits.js";
|
|
18
|
+
import { describeHtmlModuleResponse } from "./http-cache-helpers.js";
|
|
18
19
|
const LOG_PREFIX = "[HTTP-HANDLER]";
|
|
19
20
|
/**
|
|
20
21
|
* User agent string for HTTP fetches.
|
|
@@ -141,11 +142,11 @@ export function createHTTPPlugin(options = {}) {
|
|
|
141
142
|
/<title>ESM[^<]*<\/title>/i.test(contents.slice(0, 500));
|
|
142
143
|
if (isHtmlContent) {
|
|
143
144
|
logger.warn(`${LOG_PREFIX} Received HTML instead of JS for ${safeUrl}`);
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
};
|
|
145
|
+
// Blaming esm.sh for every host that answers HTML sends the reader
|
|
146
|
+
// to a registry that was never involved. The shared helper reports
|
|
147
|
+
// the real cause, including an unresolved "@/" alias that fell
|
|
148
|
+
// through to the site origin (VERYFRONT-SERVER-G).
|
|
149
|
+
return { errors: [{ text: describeHtmlModuleResponse(safeUrl) }] };
|
|
149
150
|
}
|
|
150
151
|
return { contents, loader: "js" };
|
|
151
152
|
}
|
|
@@ -79,6 +79,15 @@ export declare function getEffectiveHttpCacheRequest<T extends HttpCacheIdentity
|
|
|
79
79
|
* separate local files.
|
|
80
80
|
*/
|
|
81
81
|
export declare function isCanonicalReactEsmUrl(rawUrl: string): boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Diagnostic for an HTTP module fetch that answered with HTML.
|
|
84
|
+
*
|
|
85
|
+
* Only esm.sh gets the "package failed to build" explanation. For any other
|
|
86
|
+
* host, direct the reader to verify that the import resolves to JavaScript.
|
|
87
|
+
* A path starting with "/@/" is the "@/" project alias in absolute form, so it
|
|
88
|
+
* gets a specific alias-resolution instruction.
|
|
89
|
+
*/
|
|
90
|
+
export declare function describeHtmlModuleResponse(rawUrl: string): string;
|
|
82
91
|
export declare function isExternalScheme(specifier: string): boolean;
|
|
83
92
|
export declare function isRelative(specifier: string): boolean;
|
|
84
93
|
/**
|
|
@@ -101,6 +110,8 @@ export declare function isInternalBare(specifier: string): boolean;
|
|
|
101
110
|
export declare const SERVER_ESM_TARGET = "node";
|
|
102
111
|
export declare function normalizeEsmShUrl(url: URL): void;
|
|
103
112
|
export declare function normalizeHttpUrl(raw: string): string;
|
|
113
|
+
/** Build an opaque identity for correlating one exact HTTP module request. */
|
|
114
|
+
export declare function fingerprintHttpModuleRequest(rawUrl: string): Promise<string>;
|
|
104
115
|
export declare function resolveBareSpecifier(specifier: string, importMap: ImportMapConfig, reactVersion?: string): string;
|
|
105
116
|
/**
|
|
106
117
|
* Check if cached HTTP bundle code has file:// paths from a different environment.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-cache-helpers.d.ts","sourceRoot":"","sources":["../../../../src/src/transforms/esm/http-cache-helpers.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAaH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAsNhE;;GAEG;AACH,MAAM,WAAW,aAAa,CAAC,CAAC,EAAE,CAAC;IACjC,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC;IAC3B,GAAG,CAAC,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;IAC5B,MAAM,CAAC,GAAG,EAAE,CAAC,GAAG,IAAI,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,OAAO,CAAC,CAAC;IACxB,GAAG,CAAC,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC;IACvB,GAAG,CAAC,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;IACpB,MAAM,CAAC,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC;CAC3B;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,eAAe,CAAC;IAC3B,+EAA+E;IAC/E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,+EAA+E;IAC/E,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,kFAAkF;IAClF,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,6DAA6D;IAC7D,WAAW,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,EAAE,MAAM,GAAG,MAAM,CAiCpD;AAED,8EAA8E;AAC9E,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAE5E;AAED,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,eAAe,EAC1B,YAAY,GAAE,MAA8B,GAC3C,MAAM,CA6BR;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAoBrF"}
|
|
@@ -182,6 +182,7 @@ function decodeEncodedCommas(value) {
|
|
|
182
182
|
return decoded;
|
|
183
183
|
}
|
|
184
184
|
const HTTP_CACHE_REQUEST_IDENTITY_CONTEXT = Symbol("http-cache-request-identity-context");
|
|
185
|
+
const HTTP_MODULE_REQUEST_FINGERPRINT_NAMESPACE = "veryfront:http-module-request:v1";
|
|
185
186
|
function compareImportMapKeys(left, right) {
|
|
186
187
|
return left[0] < right[0] ? -1 : left[0] > right[0] ? 1 : 0;
|
|
187
188
|
}
|
|
@@ -358,6 +359,36 @@ export function getEffectiveHttpCacheRequest(rawUrl, options) {
|
|
|
358
359
|
export function isCanonicalReactEsmUrl(rawUrl) {
|
|
359
360
|
return getCanonicalReactEsmVersion(rawUrl) !== null;
|
|
360
361
|
}
|
|
362
|
+
/**
|
|
363
|
+
* Diagnostic for an HTTP module fetch that answered with HTML.
|
|
364
|
+
*
|
|
365
|
+
* Only esm.sh gets the "package failed to build" explanation. For any other
|
|
366
|
+
* host, direct the reader to verify that the import resolves to JavaScript.
|
|
367
|
+
* A path starting with "/@/" is the "@/" project alias in absolute form, so it
|
|
368
|
+
* gets a specific alias-resolution instruction.
|
|
369
|
+
*/
|
|
370
|
+
export function describeHtmlModuleResponse(rawUrl) {
|
|
371
|
+
let hostname = "";
|
|
372
|
+
let pathname = "";
|
|
373
|
+
try {
|
|
374
|
+
const url = new IntrinsicURL(rawUrl);
|
|
375
|
+
hostname = getURLHostname(url);
|
|
376
|
+
pathname = getURLPathname(url);
|
|
377
|
+
}
|
|
378
|
+
catch (_) {
|
|
379
|
+
/* expected: URL may be malformed */
|
|
380
|
+
}
|
|
381
|
+
const received = `Received HTML instead of JavaScript from ${rawUrl}.`;
|
|
382
|
+
if (hostname === "esm.sh") {
|
|
383
|
+
return `${received} The package may not exist or failed to build on esm.sh.`;
|
|
384
|
+
}
|
|
385
|
+
const resolutionInstruction = stringStartsWith(pathname, "/@/")
|
|
386
|
+
? 'Verify that the "@/" alias import resolves to a project module and does not fall ' +
|
|
387
|
+
"through to the site origin."
|
|
388
|
+
: "Verify that the import resolves to a JavaScript module and does not fall through " +
|
|
389
|
+
"to the site origin.";
|
|
390
|
+
return `${received} ${resolutionInstruction}`;
|
|
391
|
+
}
|
|
361
392
|
export function isExternalScheme(specifier) {
|
|
362
393
|
return stringStartsWith(specifier, "node:") ||
|
|
363
394
|
stringStartsWith(specifier, "data:") ||
|
|
@@ -455,6 +486,10 @@ export function normalizeHttpUrl(raw) {
|
|
|
455
486
|
return raw;
|
|
456
487
|
}
|
|
457
488
|
}
|
|
489
|
+
/** Build an opaque identity for correlating one exact HTTP module request. */
|
|
490
|
+
export function fingerprintHttpModuleRequest(rawUrl) {
|
|
491
|
+
return computeHash(`${HTTP_MODULE_REQUEST_FINGERPRINT_NAMESPACE}\0${normalizeHttpUrl(rawUrl)}`);
|
|
492
|
+
}
|
|
458
493
|
export function resolveBareSpecifier(specifier, importMap, reactVersion = DEFAULT_REACT_VERSION) {
|
|
459
494
|
const reactMap = getReactImportMap(reactVersion);
|
|
460
495
|
const reactMapped = reactMap[specifier];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-cache.d.ts","sourceRoot":"","sources":["../../../../src/src/transforms/esm/http-cache.ts"],"names":[],"mappings":"AA8BA,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,oBAAoB,EACpB,qBAAqB,EACrB,kBAAkB,EACnB,MA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,uBAAuB,CACrC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,YAAY,GACpB,OAAO,CAAC,sBAAsB,CAAC,CA0CjC;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CACtC,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,MAAM,EAChB,YAAY,CAAC,EAAE,MAAM,GACpB,OAAO,CAAC,MAAM,CAAC,CAOjB;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,UAAU,CAAC,EAAE,MAAM,EACnB,QAAQ,CAAC,EAAE,wBAAwB,GAClC,OAAO,CAAC,OAAO,CAAC,CAElB;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACpC,WAAW,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,EAClD,QAAQ,EAAE,MAAM,EAChB,QAAQ,CAAC,EAAE,wBAAwB,GAClC,OAAO,CAAC,MAAM,EAAE,CAAC,CAEnB;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAErF;AAGD,eAAO,MAAM,wBAAwB,0BAAoB,CAAC"}
|
|
@@ -29,7 +29,7 @@ import { guardedOutboundFetch, OutboundRequestBlockedError, } from "../../securi
|
|
|
29
29
|
// Extracted modules
|
|
30
30
|
import { embedSourceUrl, extractSourceUrl } from "./source-url-embed.js";
|
|
31
31
|
import { isDegradedArtifact } from "./degraded-artifact.js";
|
|
32
|
-
import { buildHttpCacheIdentity, buildHttpCacheIdentityMetadata, deriveHttpCacheRequestOptions, ensureAbsoluteDir, ensurePreparedHttpCacheRequestOptions, getEffectiveHttpCacheRequest, hashHttpCacheIdentity, hasIncompatibleFilePaths, isHttpUrl, normalizeHttpUrl, prepareHttpCacheRequestOptions, } from "./http-cache-helpers.js";
|
|
32
|
+
import { buildHttpCacheIdentity, buildHttpCacheIdentityMetadata, deriveHttpCacheRequestOptions, describeHtmlModuleResponse, ensureAbsoluteDir, ensurePreparedHttpCacheRequestOptions, fingerprintHttpModuleRequest, getEffectiveHttpCacheRequest, hashHttpCacheIdentity, hasIncompatibleFilePaths, isHttpUrl, normalizeHttpUrl, prepareHttpCacheRequestOptions, } from "./http-cache-helpers.js";
|
|
33
33
|
import { extractBundleDeps, validateBundleDepsExist } from "./bundle-deps-validator.js";
|
|
34
34
|
import { bundleAccumulatorStorage, createBundleAccumulator, trackCachedBundleGraph, trackWrittenBundle, } from "./bundle-accumulator.js";
|
|
35
35
|
import { isHttpBundleCodeWithinLimit, MAX_CACHED_HTTP_BUNDLE_BYTES, readCachedHttpBundleFile, } from "./http-bundle-file.js";
|
|
@@ -97,6 +97,12 @@ async function publishHttpBundleGeneration(cacheKey, cachePath, code, fs, abortS
|
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
|
+
function terminalHttpModuleFetchError(detail, context = {}) {
|
|
101
|
+
return BUILD_FAILED.create({
|
|
102
|
+
detail,
|
|
103
|
+
context: { phase: "http-module-fetch", ...context },
|
|
104
|
+
});
|
|
105
|
+
}
|
|
100
106
|
class HttpModuleResponseError extends Error {
|
|
101
107
|
status;
|
|
102
108
|
constructor(status) {
|
|
@@ -198,17 +204,17 @@ async function fetchHttpModule(url, abortSignal) {
|
|
|
198
204
|
}
|
|
199
205
|
catch (error) {
|
|
200
206
|
if (error instanceof HttpModuleResponseError) {
|
|
201
|
-
throw
|
|
207
|
+
throw terminalHttpModuleFetchError(`Failed to fetch ${safeUrl}: ${error.status}`, {
|
|
208
|
+
httpStatus: error.status,
|
|
209
|
+
httpModuleUrl: safeUrl,
|
|
210
|
+
httpModuleRequestFingerprint: await fingerprintHttpModuleRequest(url),
|
|
211
|
+
});
|
|
202
212
|
}
|
|
203
213
|
if (error instanceof HttpModuleRequestError) {
|
|
204
|
-
throw
|
|
205
|
-
detail: `Failed to fetch ${safeUrl}: ${error.requestErrorType}`,
|
|
206
|
-
});
|
|
214
|
+
throw terminalHttpModuleFetchError(`Failed to fetch ${safeUrl}: ${error.requestErrorType}`);
|
|
207
215
|
}
|
|
208
216
|
if (error instanceof HttpModuleBodyError) {
|
|
209
|
-
throw
|
|
210
|
-
detail: `Failed to fetch ${safeUrl}: ${error.message}`,
|
|
211
|
-
});
|
|
217
|
+
throw terminalHttpModuleFetchError(`Failed to fetch ${safeUrl}: ${error.message}`);
|
|
212
218
|
}
|
|
213
219
|
if (error instanceof OutboundRequestBlockedError) {
|
|
214
220
|
// Preserve the policy-denial type so downstream specifier resolution can
|
|
@@ -396,12 +402,12 @@ async function cacheHttpModuleInternal(url, options) {
|
|
|
396
402
|
const contentType = fetchedModule.contentType;
|
|
397
403
|
const isHtmlContent = contentType.includes("text/html") || looksLikeHtmlNotJs(code);
|
|
398
404
|
if (isHtmlContent) {
|
|
399
|
-
logger.error("[HTTP-CACHE] Received HTML instead of JavaScript
|
|
405
|
+
logger.error("[HTTP-CACHE] Received HTML instead of JavaScript", {
|
|
400
406
|
url: safeUrl,
|
|
401
407
|
contentType,
|
|
402
408
|
});
|
|
403
409
|
throw BUNDLE_ERROR.create({
|
|
404
|
-
detail:
|
|
410
|
+
detail: describeHtmlModuleResponse(safeUrl),
|
|
405
411
|
});
|
|
406
412
|
}
|
|
407
413
|
reportProgress({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"specifier-resolver.d.ts","sourceRoot":"","sources":["../../../../src/src/transforms/esm/specifier-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"specifier-resolver.d.ts","sourceRoot":"","sources":["../../../../src/src/transforms/esm/specifier-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAgBH,OAAO,EACL,KAAK,YAAY,EAWlB,MAAM,yBAAyB,CAAC;AAgDjC,kFAAkF;AAClF,MAAM,MAAM,iBAAiB,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;AAoM/F,sDAAsD;AACtD,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,YAAY,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACpD;AAED,gEAAgE;AAChE,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,OAAO,EAAE,YAAY,EACrB,eAAe,EAAE,iBAAiB,GACjC,OAAO,CAAC,qBAAqB,CAAC,CAoChC;AAED;;;;;GAKG;AACH,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,YAAY,EACrB,eAAe,EAAE,iBAAiB,GACjC,OAAO,CAAC,eAAe,CAAC,CAY1B"}
|
|
@@ -7,24 +7,53 @@
|
|
|
7
7
|
* @module transforms/esm/specifier-resolver
|
|
8
8
|
*/
|
|
9
9
|
import { basename } from "../../platform/compat/path/index.js";
|
|
10
|
+
import { BUILD_FAILED } from "../../errors/index.js";
|
|
11
|
+
import { snapshotVeryfrontError } from "../../errors/types.js";
|
|
10
12
|
import { resolveImport } from "../../modules/import-map/resolver.js";
|
|
11
13
|
import { OutboundRequestBlockedError } from "../../security/http/outbound-fetch.js";
|
|
12
|
-
import { appendSameOriginSSRDependencyPinningKey } from "../import-rewriter/url-builder.js";
|
|
14
|
+
import { appendSameOriginSSRDependencyPinningKey, normalizeExtension, } from "../import-rewriter/url-builder.js";
|
|
15
|
+
import { splitSpecifierSuffix } from "../shared/specifier-suffix.js";
|
|
13
16
|
import { parseBarePackageSpecifier } from "../shared/package-specifier.js";
|
|
14
17
|
import { isServerOnlyPackage } from "../shared/server-only-packages.js";
|
|
15
18
|
import { parseImports, replaceSpecifiers } from "./lexer.js";
|
|
16
|
-
import { isCanonicalReactEsmUrl, isExternalScheme, isHttpUrl, isInternalBare, isParentHttpModule, isRelative, resolveBareSpecifier, } from "./http-cache-helpers.js";
|
|
19
|
+
import { fingerprintHttpModuleRequest, getEffectiveHttpCacheRequest, isCanonicalReactEsmUrl, isExternalScheme, isHttpUrl, isInternalBare, isParentHttpModule, isRelative, normalizeHttpUrl, resolveBareSpecifier, } from "./http-cache-helpers.js";
|
|
17
20
|
const ReflectApply = Reflect.apply;
|
|
21
|
+
const RegExpTest = RegExp.prototype.test;
|
|
18
22
|
const StringSlice = String.prototype.slice;
|
|
19
23
|
const StringStartsWith = String.prototype.startsWith;
|
|
24
|
+
function regexpTest(pattern, value) {
|
|
25
|
+
return ReflectApply(RegExpTest, pattern, [value]);
|
|
26
|
+
}
|
|
20
27
|
function stringSlice(value, start, end) {
|
|
21
28
|
return ReflectApply(StringSlice, value, end === undefined ? [start] : [start, end]);
|
|
22
29
|
}
|
|
23
30
|
function stringStartsWith(value, search) {
|
|
24
31
|
return ReflectApply(StringStartsWith, value, [search]);
|
|
25
32
|
}
|
|
33
|
+
function classifyAuthoredPackageFetchError(error, requestedPackageFingerprint) {
|
|
34
|
+
const snapshot = snapshotVeryfrontError(error);
|
|
35
|
+
const context = snapshot?.context;
|
|
36
|
+
if (snapshot?.slug !== BUILD_FAILED.slug ||
|
|
37
|
+
typeof context !== "object" || context === null ||
|
|
38
|
+
typeof requestedPackageFingerprint !== "string" ||
|
|
39
|
+
context.httpStatus !== 404 ||
|
|
40
|
+
context.httpModuleRequestFingerprint !==
|
|
41
|
+
requestedPackageFingerprint) {
|
|
42
|
+
return error;
|
|
43
|
+
}
|
|
44
|
+
return BUILD_FAILED.create({
|
|
45
|
+
message: snapshot.message,
|
|
46
|
+
detail: snapshot.detail,
|
|
47
|
+
cause: error,
|
|
48
|
+
context: {
|
|
49
|
+
httpStatus: 404,
|
|
50
|
+
httpModuleRequestFingerprint: requestedPackageFingerprint,
|
|
51
|
+
tenantBuildFailure: true,
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
}
|
|
26
55
|
function parseHttpBase(value) {
|
|
27
|
-
if (!value ||
|
|
56
|
+
if (!value || !regexpTest(/^https?:\/\//i, value))
|
|
28
57
|
return undefined;
|
|
29
58
|
try {
|
|
30
59
|
return new URL(value);
|
|
@@ -34,7 +63,7 @@ function parseHttpBase(value) {
|
|
|
34
63
|
}
|
|
35
64
|
}
|
|
36
65
|
function canonicalizeHttpSpecifier(specifier, baseUrl, moduleServerOrigin) {
|
|
37
|
-
if (/^https?:\/\//i
|
|
66
|
+
if (regexpTest(/^https?:\/\//i, specifier))
|
|
38
67
|
return new URL(specifier).toString();
|
|
39
68
|
if (!stringStartsWith(specifier, "//"))
|
|
40
69
|
return specifier;
|
|
@@ -67,13 +96,41 @@ async function resolveSpecifier(specifier, baseUrl, options, cacheHttpModule) {
|
|
|
67
96
|
specifier = canonicalizeHttpSpecifier(specifier, baseUrl, options.moduleServerOrigin);
|
|
68
97
|
if (isExternalScheme(specifier))
|
|
69
98
|
return null;
|
|
99
|
+
// The "@/" project alias always denotes the project's own module transport.
|
|
100
|
+
// An alias that escaped every upstream rewrite must land there too: treating
|
|
101
|
+
// it as a bare specifier would route it to esm.sh as a bogus scoped package,
|
|
102
|
+
// and a project import map that maps "@/" to a relative prefix would resolve
|
|
103
|
+
// it against the page's public origin, which answers with HTML
|
|
104
|
+
// (VERYFRONT-SERVER-G).
|
|
105
|
+
//
|
|
106
|
+
// The URL shape is not invented here. It reproduces `AliasStrategy.rewrite`
|
|
107
|
+
// (transforms/import-rewriter/strategies/alias-strategy.ts), the framework's
|
|
108
|
+
// canonical "@/" rewriter, which emits this same shape for both its `ssr` and
|
|
109
|
+
// its browser target: `normalizeExtension`, then append `.js` unless the
|
|
110
|
+
// result already ends in a JS-like or CSS extension. A different shape here
|
|
111
|
+
// would resolve one specifier to two different module URLs.
|
|
112
|
+
if (stringStartsWith(specifier, "@/")) {
|
|
113
|
+
const mappedAlias = resolveImport(specifier, options.importMap);
|
|
114
|
+
if (mappedAlias !== specifier && isLocalMappedSpecifier(mappedAlias))
|
|
115
|
+
return mappedAlias;
|
|
116
|
+
const { path: pathOnly, suffix } = splitSpecifierSuffix(stringSlice(specifier, 2));
|
|
117
|
+
const normalizedPath = normalizeExtension(pathOnly);
|
|
118
|
+
const jsPath = regexpTest(/\.(js|mjs|cjs|css)$/, normalizedPath)
|
|
119
|
+
? normalizedPath
|
|
120
|
+
: `${normalizedPath}.js`;
|
|
121
|
+
const projectModulePath = `/_vf_modules/${jsPath}${suffix}`;
|
|
122
|
+
const moduleServerOrigin = parseHttpBase(options.moduleServerOrigin);
|
|
123
|
+
if (!moduleServerOrigin)
|
|
124
|
+
return projectModulePath;
|
|
125
|
+
return resolveSpecifier(new URL(projectModulePath, moduleServerOrigin).toString(), baseUrl, options, cacheHttpModule);
|
|
126
|
+
}
|
|
70
127
|
// Server-only packages (`redis`, `pg`, …), including their explicit `npm:`
|
|
71
128
|
// form, must never be routed through esm.sh. esm.sh either 500s building them
|
|
72
129
|
// or emits a browser bundle with Node built-ins stubbed that can never
|
|
73
130
|
// connect. The framework's adapters only `import()` them behind a lazy,
|
|
74
131
|
// configured code path, so leaving the specifier external lets the runtime
|
|
75
132
|
// resolve the real package (node_modules on Node, npm: on Deno) if and when
|
|
76
|
-
// the backend is actually used
|
|
133
|
+
// the backend is actually used, and costs nothing when it is not.
|
|
77
134
|
const serverOnlyCandidate = stringStartsWith(specifier, "npm:")
|
|
78
135
|
? stringSlice(specifier, 4)
|
|
79
136
|
: specifier;
|
|
@@ -90,7 +147,16 @@ async function resolveSpecifier(specifier, baseUrl, options, cacheHttpModule) {
|
|
|
90
147
|
}
|
|
91
148
|
if (stringStartsWith(specifier, "npm:")) {
|
|
92
149
|
const bareSpecifier = stringSlice(specifier, 4);
|
|
93
|
-
const
|
|
150
|
+
const requestedPackageUrl = `https://esm.sh/${bareSpecifier}`;
|
|
151
|
+
let cached;
|
|
152
|
+
try {
|
|
153
|
+
cached = await cacheHttpModule(requestedPackageUrl, options);
|
|
154
|
+
}
|
|
155
|
+
catch (error) {
|
|
156
|
+
const effective = getEffectiveHttpCacheRequest(requestedPackageUrl, options);
|
|
157
|
+
const requestedPackageFingerprint = await fingerprintHttpModuleRequest(normalizeHttpUrl(effective.url));
|
|
158
|
+
throw classifyAuthoredPackageFetchError(error, requestedPackageFingerprint);
|
|
159
|
+
}
|
|
94
160
|
if (!cached)
|
|
95
161
|
return bareSpecifier;
|
|
96
162
|
if (isParentHttpModule(baseUrl)) {
|
|
@@ -136,7 +202,21 @@ async function resolveSpecifier(specifier, baseUrl, options, cacheHttpModule) {
|
|
|
136
202
|
return null;
|
|
137
203
|
if (isLocalMappedSpecifier(mapped))
|
|
138
204
|
return mapped;
|
|
139
|
-
|
|
205
|
+
let requestedPackageUrl;
|
|
206
|
+
const cacheAuthoredPackage = async (url, cacheOptions) => {
|
|
207
|
+
const effective = getEffectiveHttpCacheRequest(url, cacheOptions);
|
|
208
|
+
requestedPackageUrl ??= normalizeHttpUrl(effective.url);
|
|
209
|
+
return await cacheHttpModule(url, cacheOptions);
|
|
210
|
+
};
|
|
211
|
+
try {
|
|
212
|
+
return await resolveSpecifier(mapped, baseUrl, options, cacheAuthoredPackage);
|
|
213
|
+
}
|
|
214
|
+
catch (error) {
|
|
215
|
+
const requestedPackageFingerprint = requestedPackageUrl === undefined
|
|
216
|
+
? undefined
|
|
217
|
+
: await fingerprintHttpModuleRequest(requestedPackageUrl);
|
|
218
|
+
throw classifyAuthoredPackageFetchError(error, requestedPackageFingerprint);
|
|
219
|
+
}
|
|
140
220
|
}
|
|
141
221
|
/**
|
|
142
222
|
* Build a map of specifier replacements by resolving all imports in the code.
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { ImportRewriteStrategy, ImportSpecifierInfo, RewriteContext, RewriteResult } from "../types.js";
|
|
2
|
+
/** Rewrite a project alias through the canonical SSR module-path rule. */
|
|
3
|
+
export declare function rewriteSsrProjectAliasSpecifier(specifier: string): string | null;
|
|
2
4
|
export declare class AliasStrategy implements ImportRewriteStrategy {
|
|
3
5
|
readonly name = "alias";
|
|
4
6
|
readonly priority = 1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alias-strategy.d.ts","sourceRoot":"","sources":["../../../../../src/src/transforms/import-rewriter/strategies/alias-strategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,mBAAmB,EACnB,cAAc,EACd,aAAa,EACd,MAAM,aAAa,CAAC;AAIrB,qBAAa,aAAc,YAAW,qBAAqB;IACzD,QAAQ,CAAC,IAAI,WAAW;IACxB,QAAQ,CAAC,QAAQ,KAAK;IAEtB,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,GAAG,OAAO;IAIzD,OAAO,CAAC,IAAI,EAAE,mBAAmB,EAAE,GAAG,EAAE,cAAc,GAAG,aAAa;
|
|
1
|
+
{"version":3,"file":"alias-strategy.d.ts","sourceRoot":"","sources":["../../../../../src/src/transforms/import-rewriter/strategies/alias-strategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,mBAAmB,EACnB,cAAc,EACd,aAAa,EACd,MAAM,aAAa,CAAC;AAIrB,0EAA0E;AAC1E,wBAAgB,+BAA+B,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAOhF;AAED,qBAAa,aAAc,YAAW,qBAAqB;IACzD,QAAQ,CAAC,IAAI,WAAW;IACxB,QAAQ,CAAC,QAAQ,KAAK;IAEtB,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,GAAG,OAAO;IAIzD,OAAO,CAAC,IAAI,EAAE,mBAAmB,EAAE,GAAG,EAAE,cAAc,GAAG,aAAa;CA8CvE;AAED,eAAO,MAAM,aAAa,eAAsB,CAAC"}
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import { appendDependencyPinningPathKey, normalizeExtension } from "../url-builder.js";
|
|
2
2
|
import { getProjectRelativePath } from "../project-paths.js";
|
|
3
|
+
/** Rewrite a project alias through the canonical SSR module-path rule. */
|
|
4
|
+
export function rewriteSsrProjectAliasSpecifier(specifier) {
|
|
5
|
+
if (!specifier.startsWith("@/"))
|
|
6
|
+
return null;
|
|
7
|
+
let normalizedPath = normalizeExtension(specifier.slice(2));
|
|
8
|
+
if (!/\.(tsx?|jsx?|mjs|cjs|mdx|css)$/.test(normalizedPath)) {
|
|
9
|
+
normalizedPath = `${normalizedPath}.js`;
|
|
10
|
+
}
|
|
11
|
+
return `/_vf_modules/${normalizedPath}`;
|
|
12
|
+
}
|
|
3
13
|
export class AliasStrategy {
|
|
4
14
|
name = "alias";
|
|
5
15
|
priority = 1;
|
|
@@ -10,15 +20,10 @@ export class AliasStrategy {
|
|
|
10
20
|
const path = info.specifier.slice(2);
|
|
11
21
|
// SSR uses /_vf_modules/ paths for HTTP module resolution
|
|
12
22
|
if (ctx.target === "ssr") {
|
|
13
|
-
let normalizedPath = normalizeExtension(path);
|
|
14
|
-
// Add .js if no extension present
|
|
15
|
-
if (!/\.(tsx?|jsx?|mjs|cjs|mdx|css)$/.test(normalizedPath)) {
|
|
16
|
-
normalizedPath = `${normalizedPath}.js`;
|
|
17
|
-
}
|
|
18
23
|
// The SSR adapter adds `ssr`, routing, cache-buster, and dependency
|
|
19
24
|
// snapshot params together after this strategy runs. Keeping this URL
|
|
20
25
|
// query-free ensures its `.js` matcher still sees the edge.
|
|
21
|
-
return { specifier:
|
|
26
|
+
return { specifier: rewriteSsrProjectAliasSpecifier(info.specifier) ?? info.specifier };
|
|
22
27
|
}
|
|
23
28
|
// Browser: Use /_vf_modules/ absolute paths when moduleServerUrl is configured.
|
|
24
29
|
// This avoids relative path calculation issues when the file index path structure
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"md-compiler.d.ts","sourceRoot":"","sources":["../../../../../src/src/transforms/md/compiler/md-compiler.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,eAAe,EACf,iBAAiB,EACjB,uBAAuB,EAExB,MAAM,sCAAsC,CAAC;
|
|
1
|
+
{"version":3,"file":"md-compiler.d.ts","sourceRoot":"","sources":["../../../../../src/src/transforms/md/compiler/md-compiler.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,eAAe,EACf,iBAAiB,EACjB,uBAAuB,EAExB,MAAM,sCAAsC,CAAC;AAW9C,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,eAAe,EACrB,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,EACf,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACrC,QAAQ,CAAC,EAAE,MAAM,EACjB,MAAM,GAAE,iBAA4B,EACpC,OAAO,CAAC,EAAE,MAAM,EAChB,WAAW,CAAC,EAAE,OAAO,GACpB,OAAO,CAAC,uBAAuB,CAAC,CAwClC"}
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { rendererLogger } from "../../../utils/index.js";
|
|
2
2
|
import { resolve as resolveContract } from "../../../extensions/contracts.js";
|
|
3
|
-
import {
|
|
3
|
+
import { MARKDOWN_COMPILE_ERROR, VeryfrontError } from "../../../errors/index.js";
|
|
4
4
|
import { withSpan } from "../../../observability/tracing/otlp-setup.js";
|
|
5
|
+
import { isFrontmatterSyntaxError } from "../../mdx/compiler/frontmatter-extractor.js";
|
|
5
6
|
const logger = rendererLogger.component("md-compiler");
|
|
7
|
+
function isMarkdownSourceCompileError(error) {
|
|
8
|
+
return isFrontmatterSyntaxError(error);
|
|
9
|
+
}
|
|
6
10
|
export function compileMarkdownRuntime(mode, projectDir, content, frontmatter, filePath, target = "server", baseUrl, studioEmbed) {
|
|
7
11
|
return withSpan("transforms.compileMarkdownRuntime", async () => {
|
|
8
12
|
try {
|
|
@@ -25,10 +29,13 @@ export function compileMarkdownRuntime(mode, projectDir, content, frontmatter, f
|
|
|
25
29
|
error: err.message,
|
|
26
30
|
stack: err.stack,
|
|
27
31
|
});
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
if (err instanceof VeryfrontError || !isMarkdownSourceCompileError(err)) {
|
|
33
|
+
throw err;
|
|
34
|
+
}
|
|
35
|
+
throw MARKDOWN_COMPILE_ERROR.create({
|
|
36
|
+
detail: `Markdown compilation error: ${err.message} | file: ${filePath ?? "<memory>"}`,
|
|
37
|
+
cause: err,
|
|
38
|
+
});
|
|
32
39
|
}
|
|
33
40
|
}, {
|
|
34
41
|
"md.filePath": filePath ?? "memory",
|
|
@@ -2,5 +2,7 @@ export interface FrontmatterExtractionResult {
|
|
|
2
2
|
body: string;
|
|
3
3
|
frontmatter: Record<string, unknown>;
|
|
4
4
|
}
|
|
5
|
+
/** Return true when an error came from MDX or Markdown YAML frontmatter parsing. */
|
|
6
|
+
export declare function isFrontmatterSyntaxError(error: unknown): error is SyntaxError;
|
|
5
7
|
export declare function extractFrontmatter(content: string, providedFrontmatter?: Record<string, unknown>): FrontmatterExtractionResult;
|
|
6
8
|
//# sourceMappingURL=frontmatter-extractor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frontmatter-extractor.d.ts","sourceRoot":"","sources":["../../../../../src/src/transforms/mdx/compiler/frontmatter-extractor.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,2BAA2B;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC;
|
|
1
|
+
{"version":3,"file":"frontmatter-extractor.d.ts","sourceRoot":"","sources":["../../../../../src/src/transforms/mdx/compiler/frontmatter-extractor.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,2BAA2B;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC;AAQD,oFAAoF;AACpF,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,WAAW,CAU7E;AAsDD,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,MAAM,EACf,mBAAmB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5C,2BAA2B,CAc7B"}
|
|
@@ -1,9 +1,41 @@
|
|
|
1
1
|
import { rendererLogger as logger } from "../../../utils/logger/logger.js";
|
|
2
2
|
import { extract } from "../../../platform/compat/std/front-matter-yaml.js";
|
|
3
|
+
const FRONTMATTER_SYNTAX_ERROR = Symbol.for("veryfront.transforms.mdx.frontmatter-syntax-error");
|
|
4
|
+
const ObjectDefineProperty = Object.defineProperty;
|
|
5
|
+
const ObjectPrototypeHasOwnProperty = Object.prototype.hasOwnProperty;
|
|
6
|
+
const ReflectApply = Reflect.apply;
|
|
7
|
+
const ReflectGetOwnPropertyDescriptor = Reflect.getOwnPropertyDescriptor;
|
|
8
|
+
/** Return true when an error came from MDX or Markdown YAML frontmatter parsing. */
|
|
9
|
+
export function isFrontmatterSyntaxError(error) {
|
|
10
|
+
try {
|
|
11
|
+
if (!(error instanceof SyntaxError))
|
|
12
|
+
return false;
|
|
13
|
+
const descriptor = ReflectGetOwnPropertyDescriptor(error, FRONTMATTER_SYNTAX_ERROR);
|
|
14
|
+
return descriptor !== undefined &&
|
|
15
|
+
ReflectApply(ObjectPrototypeHasOwnProperty, descriptor, ["value"]) === true &&
|
|
16
|
+
descriptor.value === true;
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function createFrontmatterSyntaxError(cause) {
|
|
23
|
+
const error = new SyntaxError(`Invalid YAML frontmatter: ${cause.message}`, { cause });
|
|
24
|
+
ObjectDefineProperty(error, FRONTMATTER_SYNTAX_ERROR, { value: true });
|
|
25
|
+
return error;
|
|
26
|
+
}
|
|
3
27
|
function extractYamlFrontmatter(content) {
|
|
4
28
|
if (!content.trim().startsWith("---"))
|
|
5
29
|
return { body: content, frontmatter: {} };
|
|
6
|
-
|
|
30
|
+
let extracted;
|
|
31
|
+
try {
|
|
32
|
+
extracted = extract(content);
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
if (error instanceof SyntaxError)
|
|
36
|
+
throw createFrontmatterSyntaxError(error);
|
|
37
|
+
throw error;
|
|
38
|
+
}
|
|
7
39
|
return {
|
|
8
40
|
body: extracted.body,
|
|
9
41
|
frontmatter: extracted.attrs,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mdx-compiler.d.ts","sourceRoot":"","sources":["../../../../../src/src/transforms/mdx/compiler/mdx-compiler.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,eAAe,EACf,iBAAiB,EACjB,uBAAuB,EAExB,MAAM,sCAAsC,CAAC;
|
|
1
|
+
{"version":3,"file":"mdx-compiler.d.ts","sourceRoot":"","sources":["../../../../../src/src/transforms/mdx/compiler/mdx-compiler.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,eAAe,EACf,iBAAiB,EACjB,uBAAuB,EAExB,MAAM,sCAAsC,CAAC;AA4C9C,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,eAAe,EACrB,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,EACf,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACrC,QAAQ,CAAC,EAAE,MAAM,EACjB,MAAM,GAAE,iBAA4B,EACpC,OAAO,CAAC,EAAE,MAAM,EAChB,WAAW,CAAC,EAAE,OAAO,GACpB,OAAO,CAAC,uBAAuB,CAAC,CAwClC"}
|