veryfront 0.0.49 → 0.0.51
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/dist/ai/components.js +260 -56
- package/dist/ai/components.js.map +4 -4
- package/dist/ai/index.d.ts +1 -0
- package/dist/ai/index.js +12 -4
- package/dist/ai/index.js.map +2 -2
- package/dist/ai/primitives.js +55 -10
- package/dist/ai/primitives.js.map +3 -3
- package/dist/ai/react.js +140 -1
- package/dist/ai/react.js.map +3 -3
- package/dist/ai/workflow-react.js +458 -0
- package/dist/ai/workflow-react.js.map +7 -0
- package/dist/ai/workflow.js +5422 -0
- package/dist/ai/workflow.js.map +7 -0
- package/dist/cli.js +957 -215
- package/dist/components.js +12 -4
- package/dist/components.js.map +2 -2
- package/dist/config.js +12 -4
- package/dist/config.js.map +2 -2
- package/dist/data.js +12 -4
- package/dist/data.js.map +2 -2
- package/dist/index.js +12 -4
- package/dist/index.js.map +2 -2
- package/dist/integrations/_base/files/SETUP.md +667 -98
- package/dist/integrations/_base/files/app/api/integrations/status/route.ts +3 -3
- package/dist/integrations/_base/files/app/api/integrations/token-storage/route.ts +26 -0
- package/dist/integrations/_base/files/app/components/ServiceConnections.tsx +2 -1
- package/dist/integrations/_base/files/app/setup/page.tsx +869 -55
- package/dist/integrations/_base/files/lib/token-store-examples.ts +435 -0
- package/dist/integrations/_base/files/lib/token-store.ts +273 -23
- package/dist/integrations/airtable/connector.json +99 -0
- package/dist/integrations/airtable/files/ai/tools/create-record.ts +25 -0
- package/dist/integrations/airtable/files/ai/tools/get-base.ts +34 -0
- package/dist/integrations/airtable/files/ai/tools/get-record.ts +23 -0
- package/dist/integrations/airtable/files/ai/tools/list-bases.ts +19 -0
- package/dist/integrations/airtable/files/ai/tools/list-records.ts +47 -0
- package/dist/integrations/airtable/files/app/api/auth/airtable/callback/route.ts +11 -0
- package/dist/integrations/airtable/files/app/api/auth/airtable/route.ts +9 -0
- package/dist/integrations/airtable/files/lib/airtable-client.ts +244 -0
- package/dist/integrations/anthropic/README.md +181 -0
- package/dist/integrations/anthropic/connector.json +88 -0
- package/dist/integrations/anthropic/files/_env.example +4 -0
- package/dist/integrations/anthropic/files/ai/tools/get-organization.ts +36 -0
- package/dist/integrations/anthropic/files/ai/tools/get-usage.ts +100 -0
- package/dist/integrations/anthropic/files/ai/tools/list-api-keys.ts +64 -0
- package/dist/integrations/anthropic/files/ai/tools/list-members.ts +65 -0
- package/dist/integrations/anthropic/files/ai/tools/list-workspaces.ts +35 -0
- package/dist/integrations/anthropic/files/lib/anthropic-admin-client.ts +264 -0
- package/dist/integrations/asana/connector.json +85 -0
- package/dist/integrations/asana/files/_env.example +4 -0
- package/dist/integrations/asana/files/ai/tools/create-task.ts +34 -0
- package/dist/integrations/asana/files/ai/tools/get-task.ts +26 -0
- package/dist/integrations/asana/files/ai/tools/list-projects.ts +26 -0
- package/dist/integrations/asana/files/ai/tools/list-tasks.ts +50 -0
- package/dist/integrations/asana/files/ai/tools/update-task.ts +36 -0
- package/dist/integrations/asana/files/app/api/auth/asana/callback/route.ts +11 -0
- package/dist/integrations/asana/files/app/api/auth/asana/route.ts +7 -0
- package/dist/integrations/asana/files/lib/asana-client.ts +162 -0
- package/dist/integrations/aws/connector.json +72 -0
- package/dist/integrations/aws/files/_env.example +10 -0
- package/dist/integrations/aws/files/ai/tools/get-s3-object.ts +62 -0
- package/dist/integrations/aws/files/ai/tools/list-ec2-instances.ts +56 -0
- package/dist/integrations/aws/files/ai/tools/list-lambda-functions.ts +57 -0
- package/dist/integrations/aws/files/ai/tools/list-s3-buckets.ts +44 -0
- package/dist/integrations/aws/files/ai/tools/list-s3-objects.ts +58 -0
- package/dist/integrations/aws/files/lib/aws-client.ts +255 -0
- package/dist/integrations/bitbucket/connector.json +85 -0
- package/dist/integrations/bitbucket/files/_env.example +9 -0
- package/dist/integrations/bitbucket/files/ai/tools/create-pull-request.ts +83 -0
- package/dist/integrations/bitbucket/files/ai/tools/list-issues.ts +112 -0
- package/dist/integrations/bitbucket/files/ai/tools/list-pull-requests.ts +91 -0
- package/dist/integrations/bitbucket/files/ai/tools/list-repositories.ts +78 -0
- package/dist/integrations/bitbucket/files/app/api/auth/bitbucket/callback/route.ts +11 -0
- package/dist/integrations/bitbucket/files/app/api/auth/bitbucket/route.ts +9 -0
- package/dist/integrations/bitbucket/files/lib/bitbucket-client.ts +316 -0
- package/dist/integrations/box/connector.json +85 -0
- package/dist/integrations/box/files/_env.example +4 -0
- package/dist/integrations/box/files/ai/tools/create-folder.ts +28 -0
- package/dist/integrations/box/files/ai/tools/get-file.ts +29 -0
- package/dist/integrations/box/files/ai/tools/list-files.ts +33 -0
- package/dist/integrations/box/files/ai/tools/search-files.ts +35 -0
- package/dist/integrations/box/files/ai/tools/upload-file.ts +32 -0
- package/dist/integrations/box/files/app/api/auth/box/callback/route.ts +11 -0
- package/dist/integrations/box/files/app/api/auth/box/route.ts +7 -0
- package/dist/integrations/box/files/lib/box-client.ts +280 -0
- package/dist/integrations/calendar/files/app/api/auth/calendar/callback/route.ts +7 -110
- package/dist/integrations/calendar/files/app/api/auth/calendar/route.ts +5 -25
- package/dist/integrations/clickup/connector.json +85 -0
- package/dist/integrations/clickup/files/_env.example +4 -0
- package/dist/integrations/clickup/files/ai/tools/create-task.ts +64 -0
- package/dist/integrations/clickup/files/ai/tools/get-task.ts +59 -0
- package/dist/integrations/clickup/files/ai/tools/list-lists.ts +109 -0
- package/dist/integrations/clickup/files/ai/tools/list-tasks.ts +95 -0
- package/dist/integrations/clickup/files/ai/tools/update-task.ts +85 -0
- package/dist/integrations/clickup/files/app/api/auth/clickup/callback/route.ts +11 -0
- package/dist/integrations/clickup/files/app/api/auth/clickup/route.ts +7 -0
- package/dist/integrations/clickup/files/lib/clickup-client.ts +439 -0
- package/dist/integrations/confluence/README.md +246 -0
- package/dist/integrations/confluence/connector.json +104 -0
- package/dist/integrations/confluence/files/_env.example +4 -0
- package/dist/integrations/confluence/files/ai/tools/create-page.ts +43 -0
- package/dist/integrations/confluence/files/ai/tools/get-page.ts +30 -0
- package/dist/integrations/confluence/files/ai/tools/list-spaces.ts +31 -0
- package/dist/integrations/confluence/files/ai/tools/search-content.ts +38 -0
- package/dist/integrations/confluence/files/ai/tools/update-page.ts +45 -0
- package/dist/integrations/confluence/files/app/api/auth/confluence/callback/route.ts +11 -0
- package/dist/integrations/confluence/files/app/api/auth/confluence/route.ts +9 -0
- package/dist/integrations/confluence/files/lib/confluence-client.ts +281 -0
- package/dist/integrations/discord/connector.json +100 -0
- package/dist/integrations/discord/files/_env.example +12 -0
- package/dist/integrations/discord/files/ai/tools/get-messages.ts +55 -0
- package/dist/integrations/discord/files/ai/tools/get-user.ts +32 -0
- package/dist/integrations/discord/files/ai/tools/list-channels.ts +32 -0
- package/dist/integrations/discord/files/ai/tools/list-guilds.ts +24 -0
- package/dist/integrations/discord/files/ai/tools/send-message.ts +33 -0
- package/dist/integrations/discord/files/app/api/auth/discord/callback/route.ts +11 -0
- package/dist/integrations/discord/files/app/api/auth/discord/route.ts +9 -0
- package/dist/integrations/discord/files/lib/discord-client.ts +273 -0
- package/dist/integrations/docs-google/connector.json +101 -0
- package/dist/integrations/docs-google/files/_env.example +8 -0
- package/dist/integrations/docs-google/files/ai/tools/create-document.ts +46 -0
- package/dist/integrations/docs-google/files/ai/tools/get-document.ts +46 -0
- package/dist/integrations/docs-google/files/ai/tools/list-documents.ts +42 -0
- package/dist/integrations/docs-google/files/ai/tools/search-documents.ts +38 -0
- package/dist/integrations/docs-google/files/ai/tools/update-document.ts +131 -0
- package/dist/integrations/docs-google/files/app/api/auth/docs-google/callback/route.ts +11 -0
- package/dist/integrations/docs-google/files/app/api/auth/docs-google/route.ts +9 -0
- package/dist/integrations/docs-google/files/lib/docs-client.ts +582 -0
- package/dist/integrations/drive/connector.json +134 -0
- package/dist/integrations/drive/files/_env.example +9 -0
- package/dist/integrations/drive/files/ai/tools/create-folder.ts +47 -0
- package/dist/integrations/drive/files/ai/tools/get-file.ts +55 -0
- package/dist/integrations/drive/files/ai/tools/list-files.ts +78 -0
- package/dist/integrations/drive/files/ai/tools/search-files.ts +79 -0
- package/dist/integrations/drive/files/ai/tools/upload-file.ts +59 -0
- package/dist/integrations/drive/files/app/api/auth/drive/callback/route.ts +11 -0
- package/dist/integrations/drive/files/app/api/auth/drive/route.ts +9 -0
- package/dist/integrations/drive/files/lib/drive-client.ts +359 -0
- package/dist/integrations/dropbox/connector.json +107 -0
- package/dist/integrations/dropbox/files/_env.example +24 -0
- package/dist/integrations/dropbox/files/ai/tools/get-account.ts +58 -0
- package/dist/integrations/dropbox/files/ai/tools/get-file.ts +61 -0
- package/dist/integrations/dropbox/files/ai/tools/list-files.ts +56 -0
- package/dist/integrations/dropbox/files/ai/tools/search-files.ts +70 -0
- package/dist/integrations/dropbox/files/ai/tools/upload-file.ts +48 -0
- package/dist/integrations/dropbox/files/app/api/auth/dropbox/callback/route.ts +11 -0
- package/dist/integrations/dropbox/files/app/api/auth/dropbox/route.ts +9 -0
- package/dist/integrations/dropbox/files/lib/dropbox-client.ts +397 -0
- package/dist/integrations/figma/INTEGRATION_SUMMARY.md +436 -0
- package/dist/integrations/figma/README.md +287 -0
- package/dist/integrations/figma/connector.json +100 -0
- package/dist/integrations/figma/files/_env.example +5 -0
- package/dist/integrations/figma/files/ai/tools/get-comments.ts +72 -0
- package/dist/integrations/figma/files/ai/tools/get-file.ts +54 -0
- package/dist/integrations/figma/files/ai/tools/list-files.ts +39 -0
- package/dist/integrations/figma/files/ai/tools/list-projects.ts +69 -0
- package/dist/integrations/figma/files/ai/tools/post-comment.ts +54 -0
- package/dist/integrations/figma/files/app/api/auth/figma/callback/route.ts +11 -0
- package/dist/integrations/figma/files/app/api/auth/figma/route.ts +9 -0
- package/dist/integrations/figma/files/lib/figma-client.ts +355 -0
- package/dist/integrations/figma/files/lib/types.ts +503 -0
- package/dist/integrations/freshdesk/connector.json +85 -0
- package/dist/integrations/freshdesk/files/_env.example +4 -0
- package/dist/integrations/freshdesk/files/ai/tools/create-ticket.ts +60 -0
- package/dist/integrations/freshdesk/files/ai/tools/get-ticket.ts +46 -0
- package/dist/integrations/freshdesk/files/ai/tools/list-contacts.ts +37 -0
- package/dist/integrations/freshdesk/files/ai/tools/list-tickets.ts +59 -0
- package/dist/integrations/freshdesk/files/ai/tools/update-ticket.ts +61 -0
- package/dist/integrations/freshdesk/files/app/api/auth/freshdesk/callback/route.ts +11 -0
- package/dist/integrations/freshdesk/files/app/api/auth/freshdesk/route.ts +7 -0
- package/dist/integrations/freshdesk/files/lib/freshdesk-client.ts +178 -0
- package/dist/integrations/github/files/app/api/auth/github/callback/route.ts +6 -127
- package/dist/integrations/github/files/app/api/auth/github/route.ts +4 -24
- package/dist/integrations/gitlab/connector.json +100 -0
- package/dist/integrations/gitlab/files/_env.example +7 -0
- package/dist/integrations/gitlab/files/ai/tools/create-issue.ts +49 -0
- package/dist/integrations/gitlab/files/ai/tools/get-issue.ts +56 -0
- package/dist/integrations/gitlab/files/ai/tools/list-merge-requests.ts +75 -0
- package/dist/integrations/gitlab/files/ai/tools/list-projects.ts +51 -0
- package/dist/integrations/gitlab/files/ai/tools/search-issues.ts +67 -0
- package/dist/integrations/gitlab/files/app/api/auth/gitlab/callback/route.ts +11 -0
- package/dist/integrations/gitlab/files/app/api/auth/gitlab/route.ts +9 -0
- package/dist/integrations/gitlab/files/lib/gitlab-client.ts +366 -0
- package/dist/integrations/gmail/files/app/api/auth/gmail/callback/route.ts +7 -108
- package/dist/integrations/gmail/files/app/api/auth/gmail/route.ts +5 -23
- package/dist/integrations/gmail/files/lib/gmail-client.ts +16 -55
- package/dist/integrations/hubspot/connector.json +98 -0
- package/dist/integrations/hubspot/files/_env.example +5 -0
- package/dist/integrations/hubspot/files/ai/tools/create-contact.ts +41 -0
- package/dist/integrations/hubspot/files/ai/tools/create-deal.ts +41 -0
- package/dist/integrations/hubspot/files/ai/tools/get-contact.ts +39 -0
- package/dist/integrations/hubspot/files/ai/tools/list-contacts.ts +43 -0
- package/dist/integrations/hubspot/files/ai/tools/list-deals.ts +41 -0
- package/dist/integrations/hubspot/files/app/api/auth/hubspot/callback/route.ts +11 -0
- package/dist/integrations/hubspot/files/app/api/auth/hubspot/route.ts +9 -0
- package/dist/integrations/hubspot/files/lib/hubspot-client.ts +393 -0
- package/dist/integrations/intercom/connector.json +85 -0
- package/dist/integrations/intercom/files/_env.example +4 -0
- package/dist/integrations/intercom/files/ai/tools/get-contact.ts +35 -0
- package/dist/integrations/intercom/files/ai/tools/get-conversation.ts +55 -0
- package/dist/integrations/intercom/files/ai/tools/list-contacts.ts +35 -0
- package/dist/integrations/intercom/files/ai/tools/list-conversations.ts +49 -0
- package/dist/integrations/intercom/files/ai/tools/send-message.ts +34 -0
- package/dist/integrations/intercom/files/app/api/auth/intercom/callback/route.ts +11 -0
- package/dist/integrations/intercom/files/app/api/auth/intercom/route.ts +7 -0
- package/dist/integrations/intercom/files/lib/intercom-client.ts +308 -0
- package/dist/integrations/jira/connector.json +109 -0
- package/dist/integrations/jira/files/ai/tools/create-issue.ts +47 -0
- package/dist/integrations/jira/files/ai/tools/get-issue.ts +57 -0
- package/dist/integrations/jira/files/ai/tools/list-projects.ts +30 -0
- package/dist/integrations/jira/files/ai/tools/search-issues.ts +49 -0
- package/dist/integrations/jira/files/ai/tools/update-issue.ts +81 -0
- package/dist/integrations/jira/files/app/api/auth/jira/callback/route.ts +11 -0
- package/dist/integrations/jira/files/app/api/auth/jira/route.ts +9 -0
- package/dist/integrations/jira/files/lib/jira-client.ts +338 -0
- package/dist/integrations/linear/connector.json +100 -0
- package/dist/integrations/linear/files/_env.example +6 -0
- package/dist/integrations/linear/files/ai/tools/create-issue.ts +71 -0
- package/dist/integrations/linear/files/ai/tools/get-issue.ts +55 -0
- package/dist/integrations/linear/files/ai/tools/list-projects.ts +43 -0
- package/dist/integrations/linear/files/ai/tools/search-issues.ts +54 -0
- package/dist/integrations/linear/files/ai/tools/update-issue.ts +71 -0
- package/dist/integrations/linear/files/app/api/auth/linear/callback/route.ts +11 -0
- package/dist/integrations/linear/files/app/api/auth/linear/route.ts +9 -0
- package/dist/integrations/linear/files/lib/linear-client.ts +464 -0
- package/dist/integrations/mailchimp/connector.json +85 -0
- package/dist/integrations/mailchimp/files/_env.example +4 -0
- package/dist/integrations/mailchimp/files/ai/tools/get-campaign.ts +45 -0
- package/dist/integrations/mailchimp/files/ai/tools/get-list.ts +51 -0
- package/dist/integrations/mailchimp/files/ai/tools/list-campaigns.ts +46 -0
- package/dist/integrations/mailchimp/files/ai/tools/list-lists.ts +46 -0
- package/dist/integrations/mailchimp/files/ai/tools/list-members.ts +58 -0
- package/dist/integrations/mailchimp/files/app/api/auth/mailchimp/callback/route.ts +11 -0
- package/dist/integrations/mailchimp/files/app/api/auth/mailchimp/route.ts +7 -0
- package/dist/integrations/mailchimp/files/lib/mailchimp-client.ts +267 -0
- package/dist/integrations/mixpanel/connector.json +96 -0
- package/dist/integrations/mixpanel/files/_env.example +11 -0
- package/dist/integrations/mixpanel/files/ai/tools/get-funnel.ts +46 -0
- package/dist/integrations/mixpanel/files/ai/tools/get-retention.ts +64 -0
- package/dist/integrations/mixpanel/files/ai/tools/list-cohorts.ts +46 -0
- package/dist/integrations/mixpanel/files/ai/tools/query-events.ts +43 -0
- package/dist/integrations/mixpanel/files/ai/tools/track-event.ts +41 -0
- package/dist/integrations/mixpanel/files/lib/mixpanel-client.ts +319 -0
- package/dist/integrations/monday/connector.json +85 -0
- package/dist/integrations/monday/files/_env.example +4 -0
- package/dist/integrations/monday/files/ai/tools/create-item.ts +36 -0
- package/dist/integrations/monday/files/ai/tools/get-item.ts +31 -0
- package/dist/integrations/monday/files/ai/tools/list-boards.ts +29 -0
- package/dist/integrations/monday/files/ai/tools/list-items.ts +36 -0
- package/dist/integrations/monday/files/ai/tools/update-item.ts +36 -0
- package/dist/integrations/monday/files/app/api/auth/monday/callback/route.ts +11 -0
- package/dist/integrations/monday/files/app/api/auth/monday/route.ts +7 -0
- package/dist/integrations/monday/files/lib/monday-client.ts +329 -0
- package/dist/integrations/neon/connector.json +89 -0
- package/dist/integrations/neon/files/_env.example +6 -0
- package/dist/integrations/neon/files/ai/tools/describe-table.ts +38 -0
- package/dist/integrations/neon/files/ai/tools/list-branches.ts +35 -0
- package/dist/integrations/neon/files/ai/tools/list-projects.ts +31 -0
- package/dist/integrations/neon/files/ai/tools/list-tables.ts +49 -0
- package/dist/integrations/neon/files/ai/tools/query-database.ts +33 -0
- package/dist/integrations/neon/files/app/api/auth/neon/route.ts +51 -0
- package/dist/integrations/neon/files/lib/neon-client.ts +294 -0
- package/dist/integrations/notion/connector.json +87 -0
- package/dist/integrations/notion/files/_env.example +6 -0
- package/dist/integrations/notion/files/ai/tools/create-page.ts +32 -0
- package/dist/integrations/notion/files/ai/tools/query-database.ts +44 -0
- package/dist/integrations/notion/files/ai/tools/read-page.ts +34 -0
- package/dist/integrations/notion/files/ai/tools/search-notion.ts +51 -0
- package/dist/integrations/notion/files/app/api/auth/notion/callback/route.ts +11 -0
- package/dist/integrations/notion/files/app/api/auth/notion/route.ts +9 -0
- package/dist/integrations/notion/files/lib/notion-client.ts +218 -0
- package/dist/integrations/onedrive/connector.json +100 -0
- package/dist/integrations/onedrive/files/_env.example +23 -0
- package/dist/integrations/onedrive/files/ai/tools/download-file.ts +38 -0
- package/dist/integrations/onedrive/files/ai/tools/list-files.ts +63 -0
- package/dist/integrations/onedrive/files/ai/tools/search-files.ts +59 -0
- package/dist/integrations/onedrive/files/ai/tools/upload-file.ts +43 -0
- package/dist/integrations/onedrive/files/app/api/auth/onedrive/callback/route.ts +11 -0
- package/dist/integrations/onedrive/files/app/api/auth/onedrive/route.ts +9 -0
- package/dist/integrations/onedrive/files/lib/onedrive-client.ts +314 -0
- package/dist/integrations/outlook/README.md +308 -0
- package/dist/integrations/outlook/connector.json +98 -0
- package/dist/integrations/outlook/files/_env.example +8 -0
- package/dist/integrations/outlook/files/ai/tools/get-email.ts +47 -0
- package/dist/integrations/outlook/files/ai/tools/list-emails.ts +46 -0
- package/dist/integrations/outlook/files/ai/tools/list-folders.ts +22 -0
- package/dist/integrations/outlook/files/ai/tools/search-emails.ts +41 -0
- package/dist/integrations/outlook/files/ai/tools/send-email.ts +41 -0
- package/dist/integrations/outlook/files/app/api/auth/outlook/callback/route.ts +11 -0
- package/dist/integrations/outlook/files/app/api/auth/outlook/route.ts +9 -0
- package/dist/integrations/outlook/files/lib/outlook-client.ts +204 -0
- package/dist/integrations/pipedrive/connector.json +85 -0
- package/dist/integrations/pipedrive/files/_env.example +4 -0
- package/dist/integrations/pipedrive/files/ai/tools/create-deal.ts +44 -0
- package/dist/integrations/pipedrive/files/ai/tools/get-deal.ts +34 -0
- package/dist/integrations/pipedrive/files/ai/tools/list-deals.ts +40 -0
- package/dist/integrations/pipedrive/files/ai/tools/list-persons.ts +33 -0
- package/dist/integrations/pipedrive/files/ai/tools/update-deal.ts +46 -0
- package/dist/integrations/pipedrive/files/app/api/auth/pipedrive/callback/route.ts +11 -0
- package/dist/integrations/pipedrive/files/app/api/auth/pipedrive/route.ts +7 -0
- package/dist/integrations/pipedrive/files/lib/pipedrive-client.ts +259 -0
- package/dist/integrations/posthog/connector.json +84 -0
- package/dist/integrations/posthog/files/_env.example +6 -0
- package/dist/integrations/posthog/files/ai/tools/capture-event.ts +37 -0
- package/dist/integrations/posthog/files/ai/tools/get-trends.ts +44 -0
- package/dist/integrations/posthog/files/ai/tools/list-feature-flags.ts +38 -0
- package/dist/integrations/posthog/files/ai/tools/list-persons.ts +32 -0
- package/dist/integrations/posthog/files/lib/posthog-client.ts +286 -0
- package/dist/integrations/quickbooks/connector.json +85 -0
- package/dist/integrations/quickbooks/files/_env.example +4 -0
- package/dist/integrations/quickbooks/files/ai/tools/create-invoice.ts +48 -0
- package/dist/integrations/quickbooks/files/ai/tools/get-customer.ts +36 -0
- package/dist/integrations/quickbooks/files/ai/tools/get-invoice.ts +46 -0
- package/dist/integrations/quickbooks/files/ai/tools/list-customers.ts +37 -0
- package/dist/integrations/quickbooks/files/ai/tools/list-invoices.ts +40 -0
- package/dist/integrations/quickbooks/files/app/api/auth/quickbooks/callback/route.ts +11 -0
- package/dist/integrations/quickbooks/files/app/api/auth/quickbooks/route.ts +7 -0
- package/dist/integrations/quickbooks/files/lib/quickbooks-client.ts +252 -0
- package/dist/integrations/salesforce/connector.json +104 -0
- package/dist/integrations/salesforce/files/ai/tools/create-lead.ts +101 -0
- package/dist/integrations/salesforce/files/ai/tools/get-account.ts +53 -0
- package/dist/integrations/salesforce/files/ai/tools/list-accounts.ts +50 -0
- package/dist/integrations/salesforce/files/ai/tools/list-contacts.ts +54 -0
- package/dist/integrations/salesforce/files/ai/tools/list-opportunities.ts +55 -0
- package/dist/integrations/salesforce/files/app/api/auth/salesforce/callback/route.ts +11 -0
- package/dist/integrations/salesforce/files/app/api/auth/salesforce/route.ts +9 -0
- package/dist/integrations/salesforce/files/lib/salesforce-client.ts +539 -0
- package/dist/integrations/sentry/connector.json +84 -0
- package/dist/integrations/sentry/files/_env.example +6 -0
- package/dist/integrations/sentry/files/ai/tools/get-issue.ts +66 -0
- package/dist/integrations/sentry/files/ai/tools/list-issues.ts +57 -0
- package/dist/integrations/sentry/files/ai/tools/list-projects.ts +32 -0
- package/dist/integrations/sentry/files/ai/tools/resolve-issue.ts +28 -0
- package/dist/integrations/sentry/files/lib/sentry-client.ts +268 -0
- package/dist/integrations/servicenow/connector.json +66 -0
- package/dist/integrations/servicenow/files/_env.example +5 -0
- package/dist/integrations/servicenow/files/ai/tools/create-incident.ts +58 -0
- package/dist/integrations/servicenow/files/ai/tools/get-incident.ts +59 -0
- package/dist/integrations/servicenow/files/ai/tools/list-incidents.ts +72 -0
- package/dist/integrations/servicenow/files/ai/tools/search-knowledge.ts +48 -0
- package/dist/integrations/servicenow/files/ai/tools/update-incident.ts +60 -0
- package/dist/integrations/servicenow/files/app/api/auth/servicenow/callback/route.ts +89 -0
- package/dist/integrations/servicenow/files/app/api/auth/servicenow/route.ts +42 -0
- package/dist/integrations/servicenow/files/lib/servicenow-client.ts +239 -0
- package/dist/integrations/sharepoint/connector.json +99 -0
- package/dist/integrations/sharepoint/files/ai/tools/get-file.ts +93 -0
- package/dist/integrations/sharepoint/files/ai/tools/get-site.ts +51 -0
- package/dist/integrations/sharepoint/files/ai/tools/list-files.ts +63 -0
- package/dist/integrations/sharepoint/files/ai/tools/list-sites.ts +28 -0
- package/dist/integrations/sharepoint/files/ai/tools/upload-file.ts +72 -0
- package/dist/integrations/sharepoint/files/app/api/auth/sharepoint/callback/route.ts +11 -0
- package/dist/integrations/sharepoint/files/app/api/auth/sharepoint/route.ts +9 -0
- package/dist/integrations/sharepoint/files/lib/sharepoint-client.ts +420 -0
- package/dist/integrations/sheets/README.md +331 -0
- package/dist/integrations/sheets/connector.json +99 -0
- package/dist/integrations/sheets/files/_env.example +8 -0
- package/dist/integrations/sheets/files/ai/tools/create-spreadsheet.ts +85 -0
- package/dist/integrations/sheets/files/ai/tools/get-spreadsheet.ts +39 -0
- package/dist/integrations/sheets/files/ai/tools/list-spreadsheets.ts +41 -0
- package/dist/integrations/sheets/files/ai/tools/read-range.ts +35 -0
- package/dist/integrations/sheets/files/ai/tools/write-range.ts +51 -0
- package/dist/integrations/sheets/files/app/api/auth/sheets/callback/route.ts +11 -0
- package/dist/integrations/sheets/files/app/api/auth/sheets/route.ts +9 -0
- package/dist/integrations/sheets/files/lib/sheets-client.ts +425 -0
- package/dist/integrations/shopify/connector.json +99 -0
- package/dist/integrations/shopify/files/_env.example +5 -0
- package/dist/integrations/shopify/files/ai/tools/get-order.ts +49 -0
- package/dist/integrations/shopify/files/ai/tools/get-product.ts +39 -0
- package/dist/integrations/shopify/files/ai/tools/list-customers.ts +40 -0
- package/dist/integrations/shopify/files/ai/tools/list-orders.ts +52 -0
- package/dist/integrations/shopify/files/ai/tools/list-products.ts +39 -0
- package/dist/integrations/shopify/files/app/api/auth/shopify/callback/route.ts +11 -0
- package/dist/integrations/shopify/files/app/api/auth/shopify/route.ts +7 -0
- package/dist/integrations/shopify/files/lib/shopify-client.ts +198 -0
- package/dist/integrations/slack/files/app/api/auth/slack/callback/route.ts +6 -127
- package/dist/integrations/slack/files/app/api/auth/slack/route.ts +4 -24
- package/dist/integrations/snowflake/connector.json +151 -0
- package/dist/integrations/snowflake/files/_env.example +16 -0
- package/dist/integrations/snowflake/files/ai/tools/describe-table.ts +57 -0
- package/dist/integrations/snowflake/files/ai/tools/list-databases.ts +34 -0
- package/dist/integrations/snowflake/files/ai/tools/list-schemas.ts +40 -0
- package/dist/integrations/snowflake/files/ai/tools/list-tables.ts +49 -0
- package/dist/integrations/snowflake/files/ai/tools/run-query.ts +119 -0
- package/dist/integrations/snowflake/files/lib/snowflake-client.ts +389 -0
- package/dist/integrations/stripe/connector.json +97 -0
- package/dist/integrations/stripe/files/_env.example +6 -0
- package/dist/integrations/stripe/files/ai/tools/get-balance.ts +28 -0
- package/dist/integrations/stripe/files/ai/tools/get-customer.ts +26 -0
- package/dist/integrations/stripe/files/ai/tools/list-customers.ts +42 -0
- package/dist/integrations/stripe/files/ai/tools/list-payments.ts +45 -0
- package/dist/integrations/stripe/files/ai/tools/list-subscriptions.ts +67 -0
- package/dist/integrations/stripe/files/app/api/auth/stripe/route.ts +71 -0
- package/dist/integrations/stripe/files/lib/stripe-client.ts +376 -0
- package/dist/integrations/supabase/connector.json +101 -0
- package/dist/integrations/supabase/files/_env.example +6 -0
- package/dist/integrations/supabase/files/ai/tools/delete-row.ts +77 -0
- package/dist/integrations/supabase/files/ai/tools/insert-row.ts +35 -0
- package/dist/integrations/supabase/files/ai/tools/list-tables.ts +60 -0
- package/dist/integrations/supabase/files/ai/tools/query-table.ts +48 -0
- package/dist/integrations/supabase/files/ai/tools/update-row.ts +64 -0
- package/dist/integrations/supabase/files/app/api/auth/supabase/route.ts +91 -0
- package/dist/integrations/supabase/files/lib/supabase-client.ts +296 -0
- package/dist/integrations/teams/README.md +256 -0
- package/dist/integrations/teams/connector.json +99 -0
- package/dist/integrations/teams/files/ai/tools/get-messages.ts +55 -0
- package/dist/integrations/teams/files/ai/tools/list-channels.ts +28 -0
- package/dist/integrations/teams/files/ai/tools/list-chats.ts +41 -0
- package/dist/integrations/teams/files/ai/tools/list-teams.ts +27 -0
- package/dist/integrations/teams/files/ai/tools/send-message.ts +61 -0
- package/dist/integrations/teams/files/app/api/auth/teams/callback/route.ts +11 -0
- package/dist/integrations/teams/files/app/api/auth/teams/route.ts +9 -0
- package/dist/integrations/teams/files/lib/teams-client.ts +345 -0
- package/dist/integrations/trello/connector.json +85 -0
- package/dist/integrations/trello/files/_env.example +4 -0
- package/dist/integrations/trello/files/ai/tools/create-card.ts +54 -0
- package/dist/integrations/trello/files/ai/tools/get-card.ts +33 -0
- package/dist/integrations/trello/files/ai/tools/list-boards.ts +29 -0
- package/dist/integrations/trello/files/ai/tools/list-cards.ts +52 -0
- package/dist/integrations/trello/files/ai/tools/update-card.ts +65 -0
- package/dist/integrations/trello/files/app/api/auth/trello/callback/route.ts +11 -0
- package/dist/integrations/trello/files/app/api/auth/trello/route.ts +7 -0
- package/dist/integrations/trello/files/lib/trello-client.ts +202 -0
- package/dist/integrations/twilio/connector.json +146 -0
- package/dist/integrations/twilio/files/_env.example +14 -0
- package/dist/integrations/twilio/files/ai/tools/get-message.ts +58 -0
- package/dist/integrations/twilio/files/ai/tools/list-calls.ts +129 -0
- package/dist/integrations/twilio/files/ai/tools/list-messages.ts +97 -0
- package/dist/integrations/twilio/files/ai/tools/send-sms.ts +75 -0
- package/dist/integrations/twilio/files/ai/tools/send-whatsapp.ts +81 -0
- package/dist/integrations/twilio/files/lib/twilio-client.ts +375 -0
- package/dist/integrations/twitter/connector.json +87 -0
- package/dist/integrations/twitter/files/_env.example +6 -0
- package/dist/integrations/twitter/files/ai/tools/get-timeline.ts +59 -0
- package/dist/integrations/twitter/files/ai/tools/post-tweet.ts +49 -0
- package/dist/integrations/twitter/files/ai/tools/search-tweets.ts +71 -0
- package/dist/integrations/twitter/files/app/api/auth/twitter/callback/route.ts +11 -0
- package/dist/integrations/twitter/files/app/api/auth/twitter/route.ts +9 -0
- package/dist/integrations/twitter/files/lib/twitter-client.ts +236 -0
- package/dist/integrations/webex/connector.json +85 -0
- package/dist/integrations/webex/files/_env.example +4 -0
- package/dist/integrations/webex/files/ai/tools/create-meeting.ts +69 -0
- package/dist/integrations/webex/files/ai/tools/get-meeting.ts +31 -0
- package/dist/integrations/webex/files/ai/tools/list-meetings.ts +44 -0
- package/dist/integrations/webex/files/ai/tools/list-rooms.ts +35 -0
- package/dist/integrations/webex/files/ai/tools/send-message.ts +51 -0
- package/dist/integrations/webex/files/app/api/auth/webex/callback/route.ts +11 -0
- package/dist/integrations/webex/files/app/api/auth/webex/route.ts +7 -0
- package/dist/integrations/webex/files/lib/webex-client.ts +279 -0
- package/dist/integrations/xero/connector.json +85 -0
- package/dist/integrations/xero/files/_env.example +4 -0
- package/dist/integrations/xero/files/ai/tools/create-invoice.ts +65 -0
- package/dist/integrations/xero/files/ai/tools/get-contact.ts +40 -0
- package/dist/integrations/xero/files/ai/tools/get-invoice.ts +44 -0
- package/dist/integrations/xero/files/ai/tools/list-contacts.ts +54 -0
- package/dist/integrations/xero/files/ai/tools/list-invoices.ts +54 -0
- package/dist/integrations/xero/files/app/api/auth/xero/callback/route.ts +11 -0
- package/dist/integrations/xero/files/app/api/auth/xero/route.ts +7 -0
- package/dist/integrations/xero/files/lib/xero-client.ts +292 -0
- package/dist/integrations/zendesk/connector.json +61 -0
- package/dist/integrations/zendesk/files/_env.example +5 -0
- package/dist/integrations/zendesk/files/ai/tools/create-ticket.ts +82 -0
- package/dist/integrations/zendesk/files/ai/tools/get-ticket.ts +53 -0
- package/dist/integrations/zendesk/files/ai/tools/list-tickets.ts +60 -0
- package/dist/integrations/zendesk/files/ai/tools/search-tickets.ts +56 -0
- package/dist/integrations/zendesk/files/app/api/auth/zendesk/callback/route.ts +91 -0
- package/dist/integrations/zendesk/files/app/api/auth/zendesk/route.ts +41 -0
- package/dist/integrations/zendesk/files/lib/zendesk-client.ts +265 -0
- package/dist/integrations/zoom/connector.json +85 -0
- package/dist/integrations/zoom/files/_env.example +4 -0
- package/dist/integrations/zoom/files/ai/tools/create-meeting.ts +106 -0
- package/dist/integrations/zoom/files/ai/tools/delete-meeting.ts +32 -0
- package/dist/integrations/zoom/files/ai/tools/get-meeting.ts +44 -0
- package/dist/integrations/zoom/files/ai/tools/list-meetings.ts +47 -0
- package/dist/integrations/zoom/files/ai/tools/update-meeting.ts +111 -0
- package/dist/integrations/zoom/files/app/api/auth/zoom/callback/route.ts +11 -0
- package/dist/integrations/zoom/files/app/api/auth/zoom/route.ts +7 -0
- package/dist/integrations/zoom/files/lib/zoom-client.ts +228 -0
- package/dist/oauth/handlers.js +554 -0
- package/dist/oauth/handlers.js.map +7 -0
- package/dist/oauth/index.js +1157 -0
- package/dist/oauth/index.js.map +7 -0
- package/dist/oauth/providers.js +927 -0
- package/dist/oauth/providers.js.map +7 -0
- package/dist/oauth/token-store.js +82 -0
- package/dist/oauth/token-store.js.map +7 -0
- package/package.json +25 -1
- package/dist/integrations/calendar/files/lib/token-store.ts +0 -113
- package/dist/integrations/github/files/lib/token-store.ts +0 -113
- package/dist/integrations/gmail/files/lib/oauth.ts +0 -145
- package/dist/integrations/gmail/files/lib/token-store.ts +0 -113
- package/dist/integrations/slack/files/lib/oauth.ts +0 -145
- package/dist/integrations/slack/files/lib/token-store.ts +0 -113
- /package/dist/integrations/{calendar → docs-google}/files/lib/oauth.ts +0 -0
- /package/dist/integrations/{github → drive}/files/lib/oauth.ts +0 -0
package/dist/cli.js
CHANGED
|
@@ -143,7 +143,6 @@ function __loggerResetForTests(options = {}) {
|
|
|
143
143
|
var LogLevel, originalConsole, cachedLogLevel, ConsoleLogger, getDefaultLevel, trackedLoggers, cliLogger, serverLogger, rendererLogger, bundlerLogger, agentLogger, logger;
|
|
144
144
|
var init_logger = __esm({
|
|
145
145
|
"src/core/utils/logger/logger.ts"() {
|
|
146
|
-
"use strict";
|
|
147
146
|
init_env();
|
|
148
147
|
LogLevel = /* @__PURE__ */ ((LogLevel2) => {
|
|
149
148
|
LogLevel2[LogLevel2["DEBUG"] = 0] = "DEBUG";
|
|
@@ -291,7 +290,7 @@ var init_deno = __esm({
|
|
|
291
290
|
"deno.json"() {
|
|
292
291
|
deno_default = {
|
|
293
292
|
name: "veryfront",
|
|
294
|
-
version: "0.0.
|
|
293
|
+
version: "0.0.51",
|
|
295
294
|
exclude: [
|
|
296
295
|
"npm/",
|
|
297
296
|
"dist/",
|
|
@@ -299,7 +298,8 @@ var init_deno = __esm({
|
|
|
299
298
|
"scripts/",
|
|
300
299
|
"examples/",
|
|
301
300
|
"tests/",
|
|
302
|
-
"src/cli/templates/files/"
|
|
301
|
+
"src/cli/templates/files/",
|
|
302
|
+
"src/cli/templates/integrations/"
|
|
303
303
|
],
|
|
304
304
|
exports: {
|
|
305
305
|
".": "./src/index.ts",
|
|
@@ -318,7 +318,11 @@ var init_deno = __esm({
|
|
|
318
318
|
"./ai/production": "./src/ai/production/index.ts",
|
|
319
319
|
"./ai/dev": "./src/ai/dev/index.ts",
|
|
320
320
|
"./ai/workflow": "./src/ai/workflow/index.ts",
|
|
321
|
-
"./ai/workflow/react": "./src/ai/workflow/react/index.ts"
|
|
321
|
+
"./ai/workflow/react": "./src/ai/workflow/react/index.ts",
|
|
322
|
+
"./oauth": "./src/core/oauth/index.ts",
|
|
323
|
+
"./oauth/providers": "./src/core/oauth/providers/index.ts",
|
|
324
|
+
"./oauth/handlers": "./src/core/oauth/handlers/index.ts",
|
|
325
|
+
"./oauth/token-store": "./src/core/oauth/token-store/index.ts"
|
|
322
326
|
},
|
|
323
327
|
imports: {
|
|
324
328
|
"@veryfront": "./src/index.ts",
|
|
@@ -362,6 +366,8 @@ var init_deno = __esm({
|
|
|
362
366
|
"@veryfront/modules/": "./src/module-system/",
|
|
363
367
|
"@veryfront/compat/console": "./src/platform/compat/console/index.ts",
|
|
364
368
|
"@veryfront/compat/": "./src/platform/compat/",
|
|
369
|
+
"@veryfront/oauth": "./src/core/oauth/index.ts",
|
|
370
|
+
"@veryfront/oauth/": "./src/core/oauth/",
|
|
365
371
|
"std/": "https://deno.land/std@0.220.0/",
|
|
366
372
|
"@std/path": "https://deno.land/std@0.220.0/path/mod.ts",
|
|
367
373
|
"@std/testing/bdd.ts": "https://deno.land/std@0.220.0/testing/bdd.ts",
|
|
@@ -401,7 +407,8 @@ var init_deno = __esm({
|
|
|
401
407
|
unocss: "https://esm.sh/unocss@0.59.0",
|
|
402
408
|
"@unocss/core": "https://esm.sh/@unocss/core@0.59.0",
|
|
403
409
|
"@unocss/preset-wind": "https://esm.sh/@unocss/preset-wind@0.59.0",
|
|
404
|
-
redis: "npm:redis"
|
|
410
|
+
redis: "npm:redis",
|
|
411
|
+
pg: "npm:pg"
|
|
405
412
|
},
|
|
406
413
|
compilerOptions: {
|
|
407
414
|
jsx: "react-jsx",
|
|
@@ -4545,12 +4552,12 @@ var init_deno3 = __esm({
|
|
|
4545
4552
|
import { join as join3 } from "node:path";
|
|
4546
4553
|
async function setupNodeFsWatcher(path, options) {
|
|
4547
4554
|
try {
|
|
4548
|
-
const
|
|
4555
|
+
const fs15 = await import("node:fs");
|
|
4549
4556
|
const fsPromises = await import("node:fs/promises");
|
|
4550
4557
|
const exists2 = await fsPromises.access(path).then(() => true).catch(() => false);
|
|
4551
4558
|
if (!exists2)
|
|
4552
4559
|
return;
|
|
4553
|
-
const watcher =
|
|
4560
|
+
const watcher = fs15.watch(path, { recursive: options.recursive }, (eventType, filename) => {
|
|
4554
4561
|
if (options.closed() || options.signal?.aborted)
|
|
4555
4562
|
return;
|
|
4556
4563
|
const kind = eventType === "change" ? "modify" : "any";
|
|
@@ -4627,22 +4634,22 @@ var init_filesystem_adapter = __esm({
|
|
|
4627
4634
|
init_utils();
|
|
4628
4635
|
NodeFileSystemAdapter = class {
|
|
4629
4636
|
async readFile(path) {
|
|
4630
|
-
const
|
|
4631
|
-
return await
|
|
4637
|
+
const fs15 = await import("node:fs/promises");
|
|
4638
|
+
return await fs15.readFile(path, "utf-8");
|
|
4632
4639
|
}
|
|
4633
4640
|
async readFileBytes(path) {
|
|
4634
|
-
const
|
|
4635
|
-
const buffer = await
|
|
4641
|
+
const fs15 = await import("node:fs/promises");
|
|
4642
|
+
const buffer = await fs15.readFile(path);
|
|
4636
4643
|
return buffer instanceof Uint8Array ? buffer : new Uint8Array(buffer);
|
|
4637
4644
|
}
|
|
4638
4645
|
async writeFile(path, content) {
|
|
4639
|
-
const
|
|
4640
|
-
await
|
|
4646
|
+
const fs15 = await import("node:fs/promises");
|
|
4647
|
+
await fs15.writeFile(path, content, "utf-8");
|
|
4641
4648
|
}
|
|
4642
4649
|
async exists(path) {
|
|
4643
|
-
const
|
|
4650
|
+
const fs15 = await import("node:fs/promises");
|
|
4644
4651
|
try {
|
|
4645
|
-
await
|
|
4652
|
+
await fs15.access(path);
|
|
4646
4653
|
return true;
|
|
4647
4654
|
} catch (error2) {
|
|
4648
4655
|
serverLogger.debug(`File access check failed for ${path}:`, error2);
|
|
@@ -4650,8 +4657,8 @@ var init_filesystem_adapter = __esm({
|
|
|
4650
4657
|
}
|
|
4651
4658
|
}
|
|
4652
4659
|
async *readDir(path) {
|
|
4653
|
-
const
|
|
4654
|
-
const entries = await
|
|
4660
|
+
const fs15 = await import("node:fs/promises");
|
|
4661
|
+
const entries = await fs15.readdir(path, { withFileTypes: true });
|
|
4655
4662
|
for (const entry of entries) {
|
|
4656
4663
|
yield {
|
|
4657
4664
|
name: entry.name,
|
|
@@ -4662,8 +4669,8 @@ var init_filesystem_adapter = __esm({
|
|
|
4662
4669
|
}
|
|
4663
4670
|
}
|
|
4664
4671
|
async stat(path) {
|
|
4665
|
-
const
|
|
4666
|
-
const stats = await
|
|
4672
|
+
const fs15 = await import("node:fs/promises");
|
|
4673
|
+
const stats = await fs15.stat(path);
|
|
4667
4674
|
return {
|
|
4668
4675
|
size: stats.size,
|
|
4669
4676
|
isFile: stats.isFile(),
|
|
@@ -4673,12 +4680,12 @@ var init_filesystem_adapter = __esm({
|
|
|
4673
4680
|
};
|
|
4674
4681
|
}
|
|
4675
4682
|
async mkdir(path, options) {
|
|
4676
|
-
const
|
|
4677
|
-
await
|
|
4683
|
+
const fs15 = await import("node:fs/promises");
|
|
4684
|
+
await fs15.mkdir(path, options);
|
|
4678
4685
|
}
|
|
4679
4686
|
async remove(path, options) {
|
|
4680
|
-
const
|
|
4681
|
-
await
|
|
4687
|
+
const fs15 = await import("node:fs/promises");
|
|
4688
|
+
await fs15.rm(path, { recursive: options?.recursive, force: true });
|
|
4682
4689
|
}
|
|
4683
4690
|
async makeTempDir(prefix) {
|
|
4684
4691
|
const { mkdtemp } = await import("node:fs/promises");
|
|
@@ -6994,9 +7001,9 @@ var init_std_fs = __esm({
|
|
|
6994
7001
|
// src/cli/templates/loader.ts
|
|
6995
7002
|
async function loadTemplateFromDirectory(templateDir) {
|
|
6996
7003
|
const files = [];
|
|
6997
|
-
const
|
|
7004
|
+
const fs15 = createFileSystem();
|
|
6998
7005
|
try {
|
|
6999
|
-
await walkDirectory(templateDir, templateDir, files,
|
|
7006
|
+
await walkDirectory(templateDir, templateDir, files, fs15);
|
|
7000
7007
|
} catch (error2) {
|
|
7001
7008
|
if (isDeno && error2 instanceof Deno.errors.NotFound) {
|
|
7002
7009
|
return [];
|
|
@@ -7008,19 +7015,19 @@ async function loadTemplateFromDirectory(templateDir) {
|
|
|
7008
7015
|
}
|
|
7009
7016
|
return files.sort((a56, b70) => a56.path.localeCompare(b70.path));
|
|
7010
7017
|
}
|
|
7011
|
-
async function walkDirectory(baseDir, currentDir, files,
|
|
7018
|
+
async function walkDirectory(baseDir, currentDir, files, fs15) {
|
|
7012
7019
|
if (isDeno) {
|
|
7013
7020
|
for await (const entry of Deno.readDir(currentDir)) {
|
|
7014
7021
|
const entryPath = join4(currentDir, entry.name);
|
|
7015
7022
|
if (entry.isDirectory) {
|
|
7016
|
-
await walkDirectory(baseDir, entryPath, files,
|
|
7023
|
+
await walkDirectory(baseDir, entryPath, files, fs15);
|
|
7017
7024
|
} else if (entry.isFile) {
|
|
7018
7025
|
let relativePath = relative3(baseDir, entryPath);
|
|
7019
7026
|
const fileName = relativePath.split("/").pop() || "";
|
|
7020
7027
|
if (FILE_NAME_MAPPINGS[fileName]) {
|
|
7021
7028
|
relativePath = relativePath.replace(fileName, FILE_NAME_MAPPINGS[fileName]);
|
|
7022
7029
|
}
|
|
7023
|
-
const content = await
|
|
7030
|
+
const content = await fs15.readTextFile(entryPath);
|
|
7024
7031
|
files.push({ path: relativePath, content });
|
|
7025
7032
|
}
|
|
7026
7033
|
}
|
|
@@ -7030,14 +7037,14 @@ async function walkDirectory(baseDir, currentDir, files, fs14) {
|
|
|
7030
7037
|
for (const entry of entries) {
|
|
7031
7038
|
const entryPath = join4(currentDir, entry.name);
|
|
7032
7039
|
if (entry.isDirectory()) {
|
|
7033
|
-
await walkDirectory(baseDir, entryPath, files,
|
|
7040
|
+
await walkDirectory(baseDir, entryPath, files, fs15);
|
|
7034
7041
|
} else if (entry.isFile()) {
|
|
7035
7042
|
let relativePath = relative3(baseDir, entryPath);
|
|
7036
7043
|
const fileName = relativePath.split("/").pop() || "";
|
|
7037
7044
|
if (FILE_NAME_MAPPINGS[fileName]) {
|
|
7038
7045
|
relativePath = relativePath.replace(fileName, FILE_NAME_MAPPINGS[fileName]);
|
|
7039
7046
|
}
|
|
7040
|
-
const content = await
|
|
7047
|
+
const content = await fs15.readTextFile(entryPath);
|
|
7041
7048
|
files.push({ path: relativePath, content });
|
|
7042
7049
|
}
|
|
7043
7050
|
}
|
|
@@ -7062,9 +7069,9 @@ function getTemplateDirectory(templateName) {
|
|
|
7062
7069
|
}
|
|
7063
7070
|
async function templateDirectoryExists(templateName) {
|
|
7064
7071
|
const templateDir = getTemplateDirectory(templateName);
|
|
7065
|
-
const
|
|
7072
|
+
const fs15 = createFileSystem();
|
|
7066
7073
|
try {
|
|
7067
|
-
const stat2 = await
|
|
7074
|
+
const stat2 = await fs15.stat(templateDir);
|
|
7068
7075
|
return stat2.isDirectory;
|
|
7069
7076
|
} catch {
|
|
7070
7077
|
return false;
|
|
@@ -7107,11 +7114,11 @@ function getFeatureDirectory(featureName) {
|
|
|
7107
7114
|
}
|
|
7108
7115
|
}
|
|
7109
7116
|
async function loadFeatureConfig(featureName) {
|
|
7110
|
-
const
|
|
7117
|
+
const fs15 = createFileSystem();
|
|
7111
7118
|
const featureDir = getFeatureDirectory(featureName);
|
|
7112
7119
|
const configPath = join4(featureDir, "feature.json");
|
|
7113
7120
|
try {
|
|
7114
|
-
const content = await
|
|
7121
|
+
const content = await fs15.readTextFile(configPath);
|
|
7115
7122
|
return JSON.parse(content);
|
|
7116
7123
|
} catch {
|
|
7117
7124
|
return null;
|
|
@@ -7217,10 +7224,10 @@ function mergeConfig(base, overlay) {
|
|
|
7217
7224
|
return result;
|
|
7218
7225
|
}
|
|
7219
7226
|
async function featureExists(featureName) {
|
|
7220
|
-
const
|
|
7227
|
+
const fs15 = createFileSystem();
|
|
7221
7228
|
const featureDir = getFeatureDirectory(featureName);
|
|
7222
7229
|
try {
|
|
7223
|
-
const stat2 = await
|
|
7230
|
+
const stat2 = await fs15.stat(featureDir);
|
|
7224
7231
|
return stat2.isDirectory;
|
|
7225
7232
|
} catch {
|
|
7226
7233
|
return false;
|
|
@@ -10957,7 +10964,7 @@ var init_security_config = __esm({
|
|
|
10957
10964
|
// src/routing/api/module-loader/loader.ts
|
|
10958
10965
|
async function loadHandlerModule(options) {
|
|
10959
10966
|
const { projectDir, modulePath, adapter, config } = options;
|
|
10960
|
-
const
|
|
10967
|
+
const fs15 = createFileSystem();
|
|
10961
10968
|
try {
|
|
10962
10969
|
let module;
|
|
10963
10970
|
if (modulePath.endsWith(".js")) {
|
|
@@ -10965,7 +10972,7 @@ async function loadHandlerModule(options) {
|
|
|
10965
10972
|
} else if (isDeno) {
|
|
10966
10973
|
module = await loadTSModuleDirect(modulePath);
|
|
10967
10974
|
} else {
|
|
10968
|
-
module = await loadAndTranspileModule(modulePath, projectDir, adapter,
|
|
10975
|
+
module = await loadAndTranspileModule(modulePath, projectDir, adapter, fs15, config);
|
|
10969
10976
|
}
|
|
10970
10977
|
return extractAPIRouteHandlers(module);
|
|
10971
10978
|
} catch (error2) {
|
|
@@ -11097,7 +11104,7 @@ function createImportMapPlugin(projectDir, adapter, config) {
|
|
|
11097
11104
|
}
|
|
11098
11105
|
};
|
|
11099
11106
|
}
|
|
11100
|
-
async function loadAndTranspileModule(modulePath, projectDir, adapter,
|
|
11107
|
+
async function loadAndTranspileModule(modulePath, projectDir, adapter, fs15, config) {
|
|
11101
11108
|
let resolvedPath = modulePath;
|
|
11102
11109
|
let source;
|
|
11103
11110
|
try {
|
|
@@ -11174,13 +11181,13 @@ async function loadAndTranspileModule(modulePath, projectDir, adapter, fs14, con
|
|
|
11174
11181
|
serverLogger.info(`[API] built handler ${resolvedPath}`);
|
|
11175
11182
|
const js = result.outputFiles?.[0]?.text ?? "export {}";
|
|
11176
11183
|
serverLogger.debug(`[API] transpiled size ${js.length} bytes`);
|
|
11177
|
-
return await loadModuleFromCode(js, adapter, projectDir,
|
|
11184
|
+
return await loadModuleFromCode(js, adapter, projectDir, fs15);
|
|
11178
11185
|
}
|
|
11179
|
-
async function loadModuleFromCode(code, _adapter, projectDir,
|
|
11180
|
-
const tempDir = await
|
|
11186
|
+
async function loadModuleFromCode(code, _adapter, projectDir, fs15) {
|
|
11187
|
+
const tempDir = await fs15.makeTempDir({ prefix: "vf-api-" });
|
|
11181
11188
|
const tempFile = join4(tempDir, "handler.mjs");
|
|
11182
|
-
const transformedCode = await rewriteExternalImports(code, projectDir,
|
|
11183
|
-
await
|
|
11189
|
+
const transformedCode = await rewriteExternalImports(code, projectDir, fs15);
|
|
11190
|
+
await fs15.writeTextFile(tempFile, transformedCode);
|
|
11184
11191
|
try {
|
|
11185
11192
|
return await import(`file://${tempFile}?v=${Date.now()}`);
|
|
11186
11193
|
} catch (e25) {
|
|
@@ -11188,10 +11195,10 @@ async function loadModuleFromCode(code, _adapter, projectDir, fs14) {
|
|
|
11188
11195
|
serverLogger.error(`[API] dynamic import failed ${tempFile}: ${errorMessage}`);
|
|
11189
11196
|
throw e25;
|
|
11190
11197
|
} finally {
|
|
11191
|
-
await
|
|
11198
|
+
await fs15.remove(tempDir, { recursive: true });
|
|
11192
11199
|
}
|
|
11193
11200
|
}
|
|
11194
|
-
async function rewriteExternalImports(code, projectDir,
|
|
11201
|
+
async function rewriteExternalImports(code, projectDir, fs15) {
|
|
11195
11202
|
let transformed = code;
|
|
11196
11203
|
if (isNode) {
|
|
11197
11204
|
try {
|
|
@@ -11201,7 +11208,7 @@ async function rewriteExternalImports(code, projectDir, fs14) {
|
|
|
11201
11208
|
const packagePath = join4(projectDir, "node_modules", packageName);
|
|
11202
11209
|
const packageJsonPath = join4(packagePath, "package.json");
|
|
11203
11210
|
try {
|
|
11204
|
-
const pkgJson = JSON.parse(await
|
|
11211
|
+
const pkgJson = JSON.parse(await fs15.readTextFile(packageJsonPath));
|
|
11205
11212
|
let entryPoint;
|
|
11206
11213
|
if (pkgJson.exports) {
|
|
11207
11214
|
const dotExport = pkgJson.exports["."];
|
|
@@ -11258,7 +11265,7 @@ async function rewriteExternalImports(code, projectDir, fs14) {
|
|
|
11258
11265
|
const vfPackageJsonPath = join4(vfPackagePath, "package.json");
|
|
11259
11266
|
let exportsMap = {};
|
|
11260
11267
|
try {
|
|
11261
|
-
const pkgJson = JSON.parse(await
|
|
11268
|
+
const pkgJson = JSON.parse(await fs15.readTextFile(vfPackageJsonPath));
|
|
11262
11269
|
exportsMap = pkgJson.exports || {};
|
|
11263
11270
|
} catch (err) {
|
|
11264
11271
|
serverLogger.debug(`[API] Could not read veryfront package.json: ${err}`);
|
|
@@ -13166,8 +13173,8 @@ var init_templates2 = __esm({
|
|
|
13166
13173
|
padding: 0;
|
|
13167
13174
|
color: inherit;
|
|
13168
13175
|
}`;
|
|
13169
|
-
CLIENT_ROUTER_BUNDLE = 'var __defProp = Object.defineProperty;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __esm = (fn, res) => function __init() {\n return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;\n};\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\n\n// src/core/utils/runtime-guards.ts\nfunction hasDenoRuntime(global) {\n return typeof global === "object" && global !== null && "Deno" in global && typeof global.Deno?.env?.get === "function";\n}\nfunction hasNodeProcess(global) {\n return typeof global === "object" && global !== null && "process" in global && typeof global.process?.env === "object";\n}\nfunction hasBunRuntime(global) {\n return typeof global === "object" && global !== null && "Bun" in global && typeof global.Bun !== "undefined";\n}\nvar init_runtime_guards = __esm({\n "src/core/utils/runtime-guards.ts"() {\n "use strict";\n }\n});\n\n// src/core/utils/logger/env.ts\nfunction getEnvironmentVariable(name) {\n try {\n if (typeof Deno !== "undefined" && hasDenoRuntime(globalThis)) {\n const value = globalThis.Deno?.env.get(name);\n return value === "" ? void 0 : value;\n }\n if (hasNodeProcess(globalThis)) {\n const value = globalThis.process?.env[name];\n return value === "" ? void 0 : value;\n }\n } catch {\n return void 0;\n }\n return void 0;\n}\nfunction isTestEnvironment() {\n return getEnvironmentVariable("NODE_ENV") === "test";\n}\nfunction isProductionEnvironment() {\n return getEnvironmentVariable("NODE_ENV") === "production";\n}\nfunction isDevelopmentEnvironment() {\n const env = getEnvironmentVariable("NODE_ENV");\n return env === "development" || env === void 0;\n}\nvar init_env = __esm({\n "src/core/utils/logger/env.ts"() {\n "use strict";\n init_runtime_guards();\n }\n});\n\n// src/core/utils/logger/logger.ts\nfunction resolveLogLevel(force = false) {\n if (force || cachedLogLevel === void 0) {\n cachedLogLevel = getDefaultLevel();\n }\n return cachedLogLevel;\n}\nfunction parseLogLevel(levelString) {\n if (!levelString)\n return void 0;\n const upper = levelString.toUpperCase();\n switch (upper) {\n case "DEBUG":\n return 0 /* DEBUG */;\n case "WARN":\n return 2 /* WARN */;\n case "ERROR":\n return 3 /* ERROR */;\n case "INFO":\n return 1 /* INFO */;\n default:\n return void 0;\n }\n}\nfunction createLogger(prefix) {\n const logger2 = new ConsoleLogger(prefix);\n trackedLoggers.add(logger2);\n return logger2;\n}\nfunction __loggerResetForTests(options = {}) {\n const updatedLevel = resolveLogLevel(true);\n for (const instance of trackedLoggers) {\n instance.setLevel(updatedLevel);\n }\n if (options.restoreConsole) {\n console.debug = originalConsole.debug;\n console.log = originalConsole.log;\n console.warn = originalConsole.warn;\n console.error = originalConsole.error;\n }\n}\nvar LogLevel, originalConsole, cachedLogLevel, ConsoleLogger, getDefaultLevel, trackedLoggers, cliLogger, serverLogger, rendererLogger, bundlerLogger, agentLogger, logger;\nvar init_logger = __esm({\n "src/core/utils/logger/logger.ts"() {\n "use strict";\n init_env();\n LogLevel = /* @__PURE__ */ ((LogLevel2) => {\n LogLevel2[LogLevel2["DEBUG"] = 0] = "DEBUG";\n LogLevel2[LogLevel2["INFO"] = 1] = "INFO";\n LogLevel2[LogLevel2["WARN"] = 2] = "WARN";\n LogLevel2[LogLevel2["ERROR"] = 3] = "ERROR";\n return LogLevel2;\n })(LogLevel || {});\n originalConsole = {\n debug: console.debug,\n log: console.log,\n warn: console.warn,\n error: console.error\n };\n ConsoleLogger = class {\n constructor(prefix, level = resolveLogLevel()) {\n this.prefix = prefix;\n this.level = level;\n }\n setLevel(level) {\n this.level = level;\n }\n getLevel() {\n return this.level;\n }\n debug(message, ...args) {\n if (this.level <= 0 /* DEBUG */) {\n console.debug(`[${this.prefix}] DEBUG: ${message}`, ...args);\n }\n }\n info(message, ...args) {\n if (this.level <= 1 /* INFO */) {\n console.log(`[${this.prefix}] ${message}`, ...args);\n }\n }\n warn(message, ...args) {\n if (this.level <= 2 /* WARN */) {\n console.warn(`[${this.prefix}] WARN: ${message}`, ...args);\n }\n }\n error(message, ...args) {\n if (this.level <= 3 /* ERROR */) {\n console.error(`[${this.prefix}] ERROR: ${message}`, ...args);\n }\n }\n async time(label, fn) {\n const start = performance.now();\n try {\n const result = await fn();\n const end = performance.now();\n this.debug(`${label} completed in ${(end - start).toFixed(2)}ms`);\n return result;\n } catch (error2) {\n const end = performance.now();\n this.error(`${label} failed after ${(end - start).toFixed(2)}ms`, error2);\n throw error2;\n }\n }\n };\n getDefaultLevel = () => {\n const envLevel = getEnvironmentVariable("LOG_LEVEL");\n const parsedLevel = parseLogLevel(envLevel);\n if (parsedLevel !== void 0)\n return parsedLevel;\n const debugFlag = getEnvironmentVariable("VERYFRONT_DEBUG");\n if (debugFlag === "1" || debugFlag === "true")\n return 0 /* DEBUG */;\n return 1 /* INFO */;\n };\n trackedLoggers = /* @__PURE__ */ new Set();\n cliLogger = createLogger("CLI");\n serverLogger = createLogger("SERVER");\n rendererLogger = createLogger("RENDERER");\n bundlerLogger = createLogger("BUNDLER");\n agentLogger = createLogger("AGENT");\n logger = createLogger("VERYFRONT");\n }\n});\n\n// src/core/utils/logger/index.ts\nvar init_logger2 = __esm({\n "src/core/utils/logger/index.ts"() {\n "use strict";\n init_logger();\n init_env();\n }\n});\n\n// src/core/utils/constants/build.ts\nvar DEFAULT_BUILD_CONCURRENCY, IMAGE_OPTIMIZATION;\nvar init_build = __esm({\n "src/core/utils/constants/build.ts"() {\n "use strict";\n DEFAULT_BUILD_CONCURRENCY = 4;\n IMAGE_OPTIMIZATION = {\n DEFAULT_SIZES: [640, 750, 828, 1080, 1200, 1920, 2048, 3840],\n DEFAULT_QUALITY: 80\n };\n }\n});\n\n// src/core/utils/constants/cache.ts\nvar SECONDS_PER_MINUTE, MINUTES_PER_HOUR, HOURS_PER_DAY, MS_PER_SECOND, DEFAULT_LRU_MAX_ENTRIES, COMPONENT_LOADER_MAX_ENTRIES, COMPONENT_LOADER_TTL_MS, MDX_RENDERER_MAX_ENTRIES, MDX_RENDERER_TTL_MS, RENDERER_CORE_MAX_ENTRIES, RENDERER_CORE_TTL_MS, TSX_LAYOUT_MAX_ENTRIES, TSX_LAYOUT_TTL_MS, DATA_FETCHING_MAX_ENTRIES, DATA_FETCHING_TTL_MS, MDX_CACHE_TTL_PRODUCTION_MS, MDX_CACHE_TTL_DEVELOPMENT_MS, BUNDLE_CACHE_TTL_PRODUCTION_MS, BUNDLE_CACHE_TTL_DEVELOPMENT_MS, BUNDLE_MANIFEST_PROD_TTL_MS, BUNDLE_MANIFEST_DEV_TTL_MS, RSC_MANIFEST_CACHE_TTL_MS, SERVER_ACTION_DEFAULT_TTL_SEC, DENO_KV_SAFE_SIZE_LIMIT_BYTES, HTTP_CACHE_SHORT_MAX_AGE_SEC, HTTP_CACHE_MEDIUM_MAX_AGE_SEC, HTTP_CACHE_LONG_MAX_AGE_SEC, ONE_DAY_MS, CACHE_CLEANUP_INTERVAL_MS, LRU_DEFAULT_MAX_ENTRIES, LRU_DEFAULT_MAX_SIZE_BYTES, CLEANUP_INTERVAL_MULTIPLIER;\nvar init_cache = __esm({\n "src/core/utils/constants/cache.ts"() {\n "use strict";\n SECONDS_PER_MINUTE = 60;\n MINUTES_PER_HOUR = 60;\n HOURS_PER_DAY = 24;\n MS_PER_SECOND = 1e3;\n DEFAULT_LRU_MAX_ENTRIES = 100;\n COMPONENT_LOADER_MAX_ENTRIES = 100;\n COMPONENT_LOADER_TTL_MS = 10 * SECONDS_PER_MINUTE * MS_PER_SECOND;\n MDX_RENDERER_MAX_ENTRIES = 200;\n MDX_RENDERER_TTL_MS = 10 * SECONDS_PER_MINUTE * MS_PER_SECOND;\n RENDERER_CORE_MAX_ENTRIES = 100;\n RENDERER_CORE_TTL_MS = 5 * SECONDS_PER_MINUTE * MS_PER_SECOND;\n TSX_LAYOUT_MAX_ENTRIES = 50;\n TSX_LAYOUT_TTL_MS = 10 * SECONDS_PER_MINUTE * MS_PER_SECOND;\n DATA_FETCHING_MAX_ENTRIES = 200;\n DATA_FETCHING_TTL_MS = 10 * SECONDS_PER_MINUTE * MS_PER_SECOND;\n MDX_CACHE_TTL_PRODUCTION_MS = HOURS_PER_DAY * MINUTES_PER_HOUR * SECONDS_PER_MINUTE * MS_PER_SECOND;\n MDX_CACHE_TTL_DEVELOPMENT_MS = 5 * SECONDS_PER_MINUTE * MS_PER_SECOND;\n BUNDLE_CACHE_TTL_PRODUCTION_MS = HOURS_PER_DAY * MINUTES_PER_HOUR * SECONDS_PER_MINUTE * MS_PER_SECOND;\n BUNDLE_CACHE_TTL_DEVELOPMENT_MS = 5 * SECONDS_PER_MINUTE * MS_PER_SECOND;\n BUNDLE_MANIFEST_PROD_TTL_MS = 7 * HOURS_PER_DAY * MINUTES_PER_HOUR * SECONDS_PER_MINUTE * MS_PER_SECOND;\n BUNDLE_MANIFEST_DEV_TTL_MS = MINUTES_PER_HOUR * SECONDS_PER_MINUTE * MS_PER_SECOND;\n RSC_MANIFEST_CACHE_TTL_MS = 5e3;\n SERVER_ACTION_DEFAULT_TTL_SEC = MINUTES_PER_HOUR * SECONDS_PER_MINUTE;\n DENO_KV_SAFE_SIZE_LIMIT_BYTES = 64e3;\n HTTP_CACHE_SHORT_MAX_AGE_SEC = 60;\n HTTP_CACHE_MEDIUM_MAX_AGE_SEC = 3600;\n HTTP_CACHE_LONG_MAX_AGE_SEC = 31536e3;\n ONE_DAY_MS = HOURS_PER_DAY * MINUTES_PER_HOUR * SECONDS_PER_MINUTE * MS_PER_SECOND;\n CACHE_CLEANUP_INTERVAL_MS = 6e4;\n LRU_DEFAULT_MAX_ENTRIES = 1e3;\n LRU_DEFAULT_MAX_SIZE_BYTES = 50 * 1024 * 1024;\n CLEANUP_INTERVAL_MULTIPLIER = 2;\n }\n});\n\n// deno.json\nvar deno_default;\nvar init_deno = __esm({\n "deno.json"() {\n deno_default = {\n name: "veryfront",\n version: "0.0.49",\n exclude: [\n "npm/",\n "dist/",\n "coverage/",\n "scripts/",\n "examples/",\n "tests/",\n "src/cli/templates/files/"\n ],\n exports: {\n ".": "./src/index.ts",\n "./cli": "./src/cli/main.ts",\n "./server": "./src/server/index.ts",\n "./middleware": "./src/middleware/index.ts",\n "./components": "./src/react/components/index.ts",\n "./data": "./src/data/index.ts",\n "./config": "./src/core/config/index.ts",\n "./platform": "./src/platform/index.ts",\n "./ai": "./src/ai/index.ts",\n "./ai/client": "./src/ai/client.ts",\n "./ai/react": "./src/ai/react/index.ts",\n "./ai/primitives": "./src/ai/react/primitives/index.ts",\n "./ai/components": "./src/ai/react/components/index.ts",\n "./ai/production": "./src/ai/production/index.ts",\n "./ai/dev": "./src/ai/dev/index.ts",\n "./ai/workflow": "./src/ai/workflow/index.ts",\n "./ai/workflow/react": "./src/ai/workflow/react/index.ts"\n },\n imports: {\n "@veryfront": "./src/index.ts",\n "@veryfront/": "./src/",\n "@veryfront/ai": "./src/ai/index.ts",\n "@veryfront/ai/": "./src/ai/",\n "@veryfront/platform": "./src/platform/index.ts",\n "@veryfront/platform/": "./src/platform/",\n "@veryfront/types": "./src/core/types/index.ts",\n "@veryfront/types/": "./src/core/types/",\n "@veryfront/utils": "./src/core/utils/index.ts",\n "@veryfront/utils/": "./src/core/utils/",\n "@veryfront/middleware": "./src/middleware/index.ts",\n "@veryfront/middleware/": "./src/middleware/",\n "@veryfront/errors": "./src/core/errors/index.ts",\n "@veryfront/errors/": "./src/core/errors/",\n "@veryfront/config": "./src/core/config/index.ts",\n "@veryfront/config/": "./src/core/config/",\n "@veryfront/observability": "./src/observability/index.ts",\n "@veryfront/observability/": "./src/observability/",\n "@veryfront/routing": "./src/routing/index.ts",\n "@veryfront/routing/": "./src/routing/",\n "@veryfront/transforms": "./src/build/transforms/index.ts",\n "@veryfront/transforms/": "./src/build/transforms/",\n "@veryfront/data": "./src/data/index.ts",\n "@veryfront/data/": "./src/data/",\n "@veryfront/security": "./src/security/index.ts",\n "@veryfront/security/": "./src/security/",\n "@veryfront/components": "./src/react/components/index.ts",\n "@veryfront/react": "./src/react/index.ts",\n "@veryfront/react/": "./src/react/",\n "@veryfront/html": "./src/html/index.ts",\n "@veryfront/html/": "./src/html/",\n "@veryfront/rendering": "./src/rendering/index.ts",\n "@veryfront/rendering/": "./src/rendering/",\n "@veryfront/build": "./src/build/index.ts",\n "@veryfront/build/": "./src/build/",\n "@veryfront/server": "./src/server/index.ts",\n "@veryfront/server/": "./src/server/",\n "@veryfront/modules": "./src/module-system/index.ts",\n "@veryfront/modules/": "./src/module-system/",\n "@veryfront/compat/console": "./src/platform/compat/console/index.ts",\n "@veryfront/compat/": "./src/platform/compat/",\n "std/": "https://deno.land/std@0.220.0/",\n "@std/path": "https://deno.land/std@0.220.0/path/mod.ts",\n "@std/testing/bdd.ts": "https://deno.land/std@0.220.0/testing/bdd.ts",\n "@std/expect": "https://deno.land/std@0.220.0/expect/mod.ts",\n csstype: "https://esm.sh/csstype@3.2.3",\n "@types/react": "https://esm.sh/@types/react@18.3.27?deps=csstype@3.2.3",\n "@types/react-dom": "https://esm.sh/@types/react-dom@18.3.7?deps=csstype@3.2.3",\n react: "https://esm.sh/react@18.3.1",\n "react-dom": "https://esm.sh/react-dom@18.3.1",\n "react-dom/server": "https://esm.sh/react-dom@18.3.1/server",\n "react-dom/client": "https://esm.sh/react-dom@18.3.1/client",\n "react/jsx-runtime": "https://esm.sh/react@18.3.1/jsx-runtime",\n "react/jsx-dev-runtime": "https://esm.sh/react@18.3.1/jsx-dev-runtime",\n "@mdx-js/mdx": "https://esm.sh/@mdx-js/mdx@3.0.0?deps=react@18.3.1,react-dom@18.3.1",\n "@mdx-js/react": "https://esm.sh/@mdx-js/react@3.0.0?deps=react@18.3.1,react-dom@18.3.1",\n "unist-util-visit": "https://esm.sh/unist-util-visit@5.0.0",\n "mdast-util-to-string": "https://esm.sh/mdast-util-to-string@4.0.0",\n "github-slugger": "https://esm.sh/github-slugger@2.0.0",\n "remark-gfm": "https://esm.sh/remark-gfm@4.0.1",\n "remark-frontmatter": "https://esm.sh/remark-frontmatter@5.0.0",\n "rehype-highlight": "https://esm.sh/rehype-highlight@7.0.2",\n "rehype-slug": "https://esm.sh/rehype-slug@6.0.0",\n esbuild: "https://deno.land/x/esbuild@v0.20.1/wasm.js",\n "esbuild/mod.js": "https://deno.land/x/esbuild@v0.20.1/mod.js",\n "es-module-lexer": "https://esm.sh/es-module-lexer@1.5.0",\n zod: "https://esm.sh/zod@3.22.0",\n "mime-types": "https://esm.sh/mime-types@2.1.35",\n mdast: "https://esm.sh/@types/mdast@4.0.3",\n hast: "https://esm.sh/@types/hast@3.0.3",\n unist: "https://esm.sh/@types/unist@3.0.2",\n unified: "https://esm.sh/unified@11.0.5?dts",\n ai: "https://esm.sh/ai@5.0.76?deps=react@18.3.1,react-dom@18.3.1",\n "ai/react": "https://esm.sh/@ai-sdk/react@2.0.59?deps=react@18.3.1,react-dom@18.3.1",\n "@ai-sdk/react": "https://esm.sh/@ai-sdk/react@2.0.59?deps=react@18.3.1,react-dom@18.3.1",\n "@ai-sdk/openai": "https://esm.sh/@ai-sdk/openai@2.0.1",\n "@ai-sdk/anthropic": "https://esm.sh/@ai-sdk/anthropic@2.0.4",\n unocss: "https://esm.sh/unocss@0.59.0",\n "@unocss/core": "https://esm.sh/@unocss/core@0.59.0",\n "@unocss/preset-wind": "https://esm.sh/@unocss/preset-wind@0.59.0",\n redis: "npm:redis"\n },\n compilerOptions: {\n jsx: "react-jsx",\n jsxImportSource: "react",\n strict: true,\n noImplicitAny: true,\n noUncheckedIndexedAccess: true,\n types: [],\n lib: [\n "deno.window",\n "dom",\n "dom.iterable",\n "dom.asynciterable",\n "deno.ns"\n ]\n },\n tasks: {\n setup: "deno run --allow-all scripts/setup.ts",\n dev: "deno run --allow-all --no-lock --unstable-net --unstable-worker-options src/cli/main.ts dev",\n build: "deno compile --allow-all --output ../../bin/veryfront src/cli/main.ts",\n "build:npm": "deno run -A scripts/build-npm.ts",\n release: "deno run -A scripts/release.ts",\n test: "DENO_JOBS=1 deno test --parallel --fail-fast --allow-all --unstable-worker-options --unstable-net",\n "test:unit": "DENO_JOBS=1 deno test --parallel --allow-all --v8-flags=--max-old-space-size=8192 --ignore=tests --unstable-worker-options --unstable-net",\n "test:integration": "DENO_JOBS=1 deno test --parallel --fail-fast --allow-all tests --unstable-worker-options --unstable-net",\n "test:coverage": "rm -rf coverage && DENO_JOBS=1 deno test --parallel --fail-fast --allow-all --coverage=coverage --unstable-worker-options --unstable-net || exit 1",\n "test:coverage:unit": "rm -rf coverage && DENO_JOBS=1 deno test --parallel --fail-fast --allow-all --coverage=coverage --ignore=tests --unstable-worker-options --unstable-net || exit 1",\n "test:coverage:integration": "rm -rf coverage && DENO_JOBS=1 deno test --parallel --fail-fast --allow-all --coverage=coverage tests --unstable-worker-options --unstable-net || exit 1",\n "coverage:report": "deno coverage coverage --include=src/ --exclude=tests --exclude=src/**/*_test.ts --exclude=src/**/*_test.tsx --exclude=src/**/*.test.ts --exclude=src/**/*.test.tsx --lcov > coverage/lcov.info && deno run --allow-read scripts/check-coverage.ts 80",\n "coverage:html": "deno coverage coverage --include=src/ --exclude=tests --exclude=src/**/*_test.ts --exclude=src/**/*_test.tsx --exclude=src/**/*.test.ts --exclude=src/**/*.test.tsx --html",\n lint: "DENO_NO_PACKAGE_JSON=1 deno lint src/",\n fmt: "deno fmt src/",\n typecheck: "deno check src/index.ts src/cli/main.ts src/server/index.ts src/routing/api/index.ts src/rendering/index.ts src/platform/index.ts src/platform/adapters/index.ts src/build/index.ts src/build/production-build/index.ts src/build/transforms/index.ts src/core/config/index.ts src/core/utils/index.ts src/data/index.ts src/security/index.ts src/middleware/index.ts src/server/handlers/dev/index.ts src/server/handlers/request/api/index.ts src/rendering/cache/index.ts src/rendering/cache/stores/index.ts src/rendering/rsc/actions/index.ts src/html/index.ts src/module-system/index.ts",\n "docs:check-links": "deno run -A scripts/check-doc-links.ts",\n "lint:ban-console": "deno run --allow-read scripts/ban-console.ts",\n "lint:ban-deep-imports": "deno run --allow-read scripts/ban-deep-imports.ts",\n "lint:ban-internal-root-imports": "deno run --allow-read scripts/ban-internal-root-imports.ts",\n "lint:check-awaits": "deno run --allow-read scripts/check-unawaited-promises.ts",\n "lint:platform": "deno run --allow-read scripts/lint-platform-agnostic.ts",\n "check:circular": "deno run -A jsr:@cunarist/deno-circular-deps src/index.ts"\n },\n lint: {\n include: [\n "src/**/*.ts",\n "src/**/*.tsx"\n ],\n exclude: [\n "dist/",\n "coverage/"\n ],\n rules: {\n tags: [\n "recommended"\n ],\n include: [\n "ban-untagged-todo"\n ],\n exclude: [\n "no-explicit-any",\n "no-process-global",\n "no-console"\n ]\n }\n },\n fmt: {\n include: [\n "src/**/*.ts",\n "src/**/*.tsx"\n ],\n exclude: [\n "dist/",\n "coverage/"\n ],\n options: {\n useTabs: false,\n lineWidth: 100,\n indentWidth: 2,\n semiColons: true,\n singleQuote: false,\n proseWrap: "preserve"\n }\n }\n };\n }\n});\n\n// src/platform/compat/runtime.ts\nvar isDeno, isNode, isBun, isCloudflare;\nvar init_runtime = __esm({\n "src/platform/compat/runtime.ts"() {\n "use strict";\n isDeno = typeof Deno !== "undefined";\n isNode = typeof globalThis.process !== "undefined" && globalThis.process?.versions?.node !== void 0;\n isBun = typeof globalThis.Bun !== "undefined";\n isCloudflare = typeof globalThis !== "undefined" && "caches" in globalThis && "WebSocketPair" in globalThis;\n }\n});\n\n// src/platform/compat/process.ts\nfunction getEnv(key) {\n if (isDeno) {\n return Deno.env.get(key);\n }\n if (hasNodeProcess2) {\n return nodeProcess.env[key];\n }\n return void 0;\n}\nfunction memoryUsage() {\n if (isDeno) {\n const usage2 = Deno.memoryUsage();\n return {\n rss: usage2.rss,\n heapTotal: usage2.heapTotal,\n heapUsed: usage2.heapUsed,\n external: usage2.external\n };\n }\n if (!hasNodeProcess2) {\n throw new Error("memoryUsage() is not supported in this runtime");\n }\n const usage = nodeProcess.memoryUsage();\n return {\n rss: usage.rss,\n heapTotal: usage.heapTotal,\n heapUsed: usage.heapUsed,\n external: usage.external || 0\n };\n}\nfunction execPath() {\n if (isDeno) {\n return Deno.execPath();\n }\n if (hasNodeProcess2) {\n return nodeProcess.execPath;\n }\n return "";\n}\nvar nodeProcess, hasNodeProcess2;\nvar init_process = __esm({\n "src/platform/compat/process.ts"() {\n "use strict";\n init_runtime();\n nodeProcess = globalThis.process;\n hasNodeProcess2 = !!nodeProcess?.versions?.node;\n }\n});\n\n// src/core/utils/version.ts\nvar VERSION;\nvar init_version = __esm({\n "src/core/utils/version.ts"() {\n "use strict";\n init_deno();\n init_process();\n VERSION = getEnv("VERYFRONT_VERSION") || (typeof deno_default.version === "string" ? deno_default.version : "0.0.0");\n }\n});\n\n// src/core/utils/constants/cdn.ts\nfunction getReactCDNUrl(version = REACT_DEFAULT_VERSION) {\n return `${ESM_CDN_BASE}/react@${version}`;\n}\nfunction getReactDOMCDNUrl(version = REACT_DEFAULT_VERSION) {\n return `${ESM_CDN_BASE}/react-dom@${version}`;\n}\nfunction getReactDOMClientCDNUrl(version = REACT_DEFAULT_VERSION) {\n return `${ESM_CDN_BASE}/react-dom@${version}/client`;\n}\nfunction getReactDOMServerCDNUrl(version = REACT_DEFAULT_VERSION) {\n return `${ESM_CDN_BASE}/react-dom@${version}/server`;\n}\nfunction getReactJSXRuntimeCDNUrl(version = REACT_DEFAULT_VERSION) {\n return `${ESM_CDN_BASE}/react@${version}/jsx-runtime`;\n}\nfunction getReactJSXDevRuntimeCDNUrl(version = REACT_DEFAULT_VERSION) {\n return `${ESM_CDN_BASE}/react@${version}/jsx-dev-runtime`;\n}\nfunction getReactImportMap(version = REACT_DEFAULT_VERSION) {\n return {\n react: getReactCDNUrl(version),\n "react-dom": getReactDOMCDNUrl(version),\n "react-dom/client": getReactDOMClientCDNUrl(version),\n "react-dom/server": getReactDOMServerCDNUrl(version),\n "react/jsx-runtime": getReactJSXRuntimeCDNUrl(version),\n "react/jsx-dev-runtime": getReactJSXDevRuntimeCDNUrl(version)\n };\n}\nfunction getDenoStdNodeBase() {\n return `${DENO_STD_BASE}/std@${DENO_STD_VERSION}/node`;\n}\nfunction getUnoCSSTailwindResetUrl() {\n return `${ESM_CDN_BASE}/@unocss/reset@${UNOCSS_VERSION}/tailwind.css`;\n}\nvar ESM_CDN_BASE, JSDELIVR_CDN_BASE, DENO_STD_BASE, REACT_VERSION_17, REACT_VERSION_18_2, REACT_VERSION_18_3, REACT_VERSION_19_RC, REACT_VERSION_19, REACT_DEFAULT_VERSION, DEFAULT_ALLOWED_CDN_HOSTS, DENO_STD_VERSION, UNOCSS_VERSION;\nvar init_cdn = __esm({\n "src/core/utils/constants/cdn.ts"() {\n "use strict";\n init_version();\n ESM_CDN_BASE = "https://esm.sh";\n JSDELIVR_CDN_BASE = "https://cdn.jsdelivr.net";\n DENO_STD_BASE = "https://deno.land";\n REACT_VERSION_17 = "17.0.2";\n REACT_VERSION_18_2 = "18.2.0";\n REACT_VERSION_18_3 = "18.3.1";\n REACT_VERSION_19_RC = "19.0.0-rc.0";\n REACT_VERSION_19 = "19.1.1";\n REACT_DEFAULT_VERSION = REACT_VERSION_18_3;\n DEFAULT_ALLOWED_CDN_HOSTS = [ESM_CDN_BASE, DENO_STD_BASE];\n DENO_STD_VERSION = "0.220.0";\n UNOCSS_VERSION = "0.59.0";\n }\n});\n\n// src/core/utils/constants/env.ts\nfunction isTruthyEnvValue(value) {\n if (!value)\n return false;\n const normalized = value.toLowerCase().trim();\n return normalized === "1" || normalized === "true" || normalized === "yes";\n}\nfunction isDebugEnabled(env) {\n return isTruthyEnvValue(env.get(ENV_VARS.DEBUG));\n}\nfunction isDeepInspectEnabled(env) {\n return isTruthyEnvValue(env.get(ENV_VARS.DEEP_INSPECT));\n}\nfunction isAnyDebugEnabled(env) {\n return isDebugEnabled(env) || isDeepInspectEnabled(env);\n}\nvar ENV_VARS;\nvar init_env2 = __esm({\n "src/core/utils/constants/env.ts"() {\n "use strict";\n ENV_VARS = {\n DEBUG: "VERYFRONT_DEBUG",\n DEEP_INSPECT: "VERYFRONT_DEEP_INSPECT",\n CACHE_DIR: "VERYFRONT_CACHE_DIR",\n PORT: "VERYFRONT_PORT",\n VERSION: "VERYFRONT_VERSION"\n };\n }\n});\n\n// src/core/utils/constants/hash.ts\nvar HASH_SEED_DJB2, HASH_SEED_FNV1A;\nvar init_hash = __esm({\n "src/core/utils/constants/hash.ts"() {\n "use strict";\n HASH_SEED_DJB2 = 5381;\n HASH_SEED_FNV1A = 2166136261;\n }\n});\n\n// src/core/utils/constants/http.ts\nvar KB_IN_BYTES, HTTP_MODULE_FETCH_TIMEOUT_MS, HMR_RECONNECT_DELAY_MS, HMR_RELOAD_DELAY_MS, HMR_FILE_WATCHER_DEBOUNCE_MS, HMR_KEEP_ALIVE_INTERVAL_MS, DASHBOARD_RECONNECT_DELAY_MS, SERVER_FUNCTION_DEFAULT_TIMEOUT_MS, PREFETCH_MAX_SIZE_BYTES, PREFETCH_DEFAULT_TIMEOUT_MS, PREFETCH_DEFAULT_DELAY_MS, HTTP_OK, HTTP_NO_CONTENT, HTTP_CREATED, HTTP_REDIRECT_FOUND, HTTP_NOT_MODIFIED, HTTP_BAD_REQUEST, HTTP_UNAUTHORIZED, HTTP_FORBIDDEN, HTTP_NOT_FOUND, HTTP_METHOD_NOT_ALLOWED, HTTP_GONE, HTTP_PAYLOAD_TOO_LARGE, HTTP_URI_TOO_LONG, HTTP_TOO_MANY_REQUESTS, HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE, HTTP_SERVER_ERROR, HTTP_INTERNAL_SERVER_ERROR, HTTP_BAD_GATEWAY, HTTP_NOT_IMPLEMENTED, HTTP_UNAVAILABLE, HTTP_NETWORK_CONNECT_TIMEOUT, HTTP_STATUS_SUCCESS_MIN, HTTP_STATUS_REDIRECT_MIN, HTTP_STATUS_CLIENT_ERROR_MIN, HTTP_STATUS_SERVER_ERROR_MIN, HTTP_CONTENT_TYPES, MS_PER_MINUTE, HTTP_CONTENT_TYPE_IMAGE_PNG, HTTP_CONTENT_TYPE_IMAGE_JPEG, HTTP_CONTENT_TYPE_IMAGE_WEBP, HTTP_CONTENT_TYPE_IMAGE_AVIF, HTTP_CONTENT_TYPE_IMAGE_SVG, HTTP_CONTENT_TYPE_IMAGE_GIF, HTTP_CONTENT_TYPE_IMAGE_ICO;\nvar init_http = __esm({\n "src/core/utils/constants/http.ts"() {\n "use strict";\n init_cache();\n KB_IN_BYTES = 1024;\n HTTP_MODULE_FETCH_TIMEOUT_MS = 2500;\n HMR_RECONNECT_DELAY_MS = 1e3;\n HMR_RELOAD_DELAY_MS = 1e3;\n HMR_FILE_WATCHER_DEBOUNCE_MS = 100;\n HMR_KEEP_ALIVE_INTERVAL_MS = 3e4;\n DASHBOARD_RECONNECT_DELAY_MS = 3e3;\n SERVER_FUNCTION_DEFAULT_TIMEOUT_MS = 3e4;\n PREFETCH_MAX_SIZE_BYTES = 200 * KB_IN_BYTES;\n PREFETCH_DEFAULT_TIMEOUT_MS = 1e4;\n PREFETCH_DEFAULT_DELAY_MS = 200;\n HTTP_OK = 200;\n HTTP_NO_CONTENT = 204;\n HTTP_CREATED = 201;\n HTTP_REDIRECT_FOUND = 302;\n HTTP_NOT_MODIFIED = 304;\n HTTP_BAD_REQUEST = 400;\n HTTP_UNAUTHORIZED = 401;\n HTTP_FORBIDDEN = 403;\n HTTP_NOT_FOUND = 404;\n HTTP_METHOD_NOT_ALLOWED = 405;\n HTTP_GONE = 410;\n HTTP_PAYLOAD_TOO_LARGE = 413;\n HTTP_URI_TOO_LONG = 414;\n HTTP_TOO_MANY_REQUESTS = 429;\n HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE = 431;\n HTTP_SERVER_ERROR = 500;\n HTTP_INTERNAL_SERVER_ERROR = 500;\n HTTP_BAD_GATEWAY = 502;\n HTTP_NOT_IMPLEMENTED = 501;\n HTTP_UNAVAILABLE = 503;\n HTTP_NETWORK_CONNECT_TIMEOUT = 599;\n HTTP_STATUS_SUCCESS_MIN = 200;\n HTTP_STATUS_REDIRECT_MIN = 300;\n HTTP_STATUS_CLIENT_ERROR_MIN = 400;\n HTTP_STATUS_SERVER_ERROR_MIN = 500;\n HTTP_CONTENT_TYPES = {\n JS: "application/javascript; charset=utf-8",\n JSON: "application/json; charset=utf-8",\n HTML: "text/html; charset=utf-8",\n CSS: "text/css; charset=utf-8",\n TEXT: "text/plain; charset=utf-8"\n };\n MS_PER_MINUTE = 6e4;\n HTTP_CONTENT_TYPE_IMAGE_PNG = "image/png";\n HTTP_CONTENT_TYPE_IMAGE_JPEG = "image/jpeg";\n HTTP_CONTENT_TYPE_IMAGE_WEBP = "image/webp";\n HTTP_CONTENT_TYPE_IMAGE_AVIF = "image/avif";\n HTTP_CONTENT_TYPE_IMAGE_SVG = "image/svg+xml";\n HTTP_CONTENT_TYPE_IMAGE_GIF = "image/gif";\n HTTP_CONTENT_TYPE_IMAGE_ICO = "image/x-icon";\n }\n});\n\n// src/core/utils/constants/hmr.ts\nfunction isValidHMRMessageType(type) {\n return Object.values(HMR_MESSAGE_TYPES).includes(\n type\n );\n}\nvar HMR_MAX_MESSAGE_SIZE_BYTES, HMR_MAX_MESSAGES_PER_MINUTE, HMR_CLIENT_RELOAD_DELAY_MS, HMR_PORT_OFFSET, HMR_RATE_LIMIT_WINDOW_MS, HMR_CLOSE_NORMAL, HMR_CLOSE_RATE_LIMIT, HMR_CLOSE_MESSAGE_TOO_LARGE, HMR_MESSAGE_TYPES;\nvar init_hmr = __esm({\n "src/core/utils/constants/hmr.ts"() {\n "use strict";\n init_http();\n HMR_MAX_MESSAGE_SIZE_BYTES = 1024 * KB_IN_BYTES;\n HMR_MAX_MESSAGES_PER_MINUTE = 100;\n HMR_CLIENT_RELOAD_DELAY_MS = 3e3;\n HMR_PORT_OFFSET = 1;\n HMR_RATE_LIMIT_WINDOW_MS = 6e4;\n HMR_CLOSE_NORMAL = 1e3;\n HMR_CLOSE_RATE_LIMIT = 1008;\n HMR_CLOSE_MESSAGE_TOO_LARGE = 1009;\n HMR_MESSAGE_TYPES = {\n CONNECTED: "connected",\n UPDATE: "update",\n RELOAD: "reload",\n PING: "ping",\n PONG: "pong"\n };\n }\n});\n\n// src/core/utils/constants/html.ts\nvar Z_INDEX_DEV_INDICATOR, Z_INDEX_ERROR_OVERLAY, BREAKPOINT_SM, BREAKPOINT_MD, BREAKPOINT_LG, BREAKPOINT_XL, PROSE_MAX_WIDTH;\nvar init_html = __esm({\n "src/core/utils/constants/html.ts"() {\n "use strict";\n Z_INDEX_DEV_INDICATOR = 9998;\n Z_INDEX_ERROR_OVERLAY = 9999;\n BREAKPOINT_SM = 640;\n BREAKPOINT_MD = 768;\n BREAKPOINT_LG = 1024;\n BREAKPOINT_XL = 1280;\n PROSE_MAX_WIDTH = "65ch";\n }\n});\n\n// src/core/utils/constants/network.ts\nvar DEFAULT_DEV_SERVER_PORT, DEFAULT_REDIS_PORT, DEFAULT_API_SERVER_PORT, DEFAULT_PREVIEW_SERVER_PORT, DEFAULT_METRICS_PORT, BYTES_PER_KB, BYTES_PER_MB, DEFAULT_IMAGE_THUMBNAIL_SIZE, DEFAULT_IMAGE_SMALL_SIZE, DEFAULT_IMAGE_LARGE_SIZE, RESPONSIVE_IMAGE_WIDTH_XS, RESPONSIVE_IMAGE_WIDTH_SM, RESPONSIVE_IMAGE_WIDTH_MD, RESPONSIVE_IMAGE_WIDTH_LG, RESPONSIVE_IMAGE_WIDTHS, MAX_CHUNK_SIZE_KB, MIN_PORT, MAX_PORT, DEFAULT_SERVER_PORT;\nvar init_network = __esm({\n "src/core/utils/constants/network.ts"() {\n "use strict";\n DEFAULT_DEV_SERVER_PORT = 3e3;\n DEFAULT_REDIS_PORT = 6379;\n DEFAULT_API_SERVER_PORT = 8080;\n DEFAULT_PREVIEW_SERVER_PORT = 5e3;\n DEFAULT_METRICS_PORT = 9e3;\n BYTES_PER_KB = 1024;\n BYTES_PER_MB = 1024 * 1024;\n DEFAULT_IMAGE_THUMBNAIL_SIZE = 256;\n DEFAULT_IMAGE_SMALL_SIZE = 512;\n DEFAULT_IMAGE_LARGE_SIZE = 2048;\n RESPONSIVE_IMAGE_WIDTH_XS = 320;\n RESPONSIVE_IMAGE_WIDTH_SM = 640;\n RESPONSIVE_IMAGE_WIDTH_MD = 1024;\n RESPONSIVE_IMAGE_WIDTH_LG = 1920;\n RESPONSIVE_IMAGE_WIDTHS = [\n RESPONSIVE_IMAGE_WIDTH_XS,\n RESPONSIVE_IMAGE_WIDTH_SM,\n RESPONSIVE_IMAGE_WIDTH_MD,\n RESPONSIVE_IMAGE_WIDTH_LG\n ];\n MAX_CHUNK_SIZE_KB = 4096;\n MIN_PORT = 1;\n MAX_PORT = 65535;\n DEFAULT_SERVER_PORT = 8e3;\n }\n});\n\n// src/core/utils/constants/security.ts\nvar MAX_PATH_TRAVERSAL_DEPTH, FORBIDDEN_PATH_PATTERNS, DIRECTORY_TRAVERSAL_PATTERN, ABSOLUTE_PATH_PATTERN, MAX_PATH_LENGTH, DEFAULT_MAX_STRING_LENGTH;\nvar init_security = __esm({\n "src/core/utils/constants/security.ts"() {\n "use strict";\n MAX_PATH_TRAVERSAL_DEPTH = 10;\n FORBIDDEN_PATH_PATTERNS = [\n /\\0/\n // Null bytes\n ];\n DIRECTORY_TRAVERSAL_PATTERN = /\\.\\.[\\/\\\\]/;\n ABSOLUTE_PATH_PATTERN = /^[\\/\\\\]/;\n MAX_PATH_LENGTH = 4096;\n DEFAULT_MAX_STRING_LENGTH = 1e3;\n }\n});\n\n// src/core/utils/constants/server.ts\nfunction isInternalEndpoint(pathname) {\n return pathname.startsWith(INTERNAL_PREFIX + "/");\n}\nfunction isStaticAsset(pathname) {\n return pathname.includes(".") || isInternalEndpoint(pathname);\n}\nfunction normalizeChunkPath(filename, basePath = INTERNAL_PATH_PREFIXES.CHUNKS) {\n if (filename.startsWith("/")) {\n return filename;\n }\n return `${basePath.replace(/\\/$/, "")}/${filename}`;\n}\nvar DEFAULT_DASHBOARD_PORT, DEFAULT_PORT, INTERNAL_PREFIX, INTERNAL_PATH_PREFIXES, INTERNAL_ENDPOINTS, BUILD_DIRS, PROJECT_DIRS, DEFAULT_CACHE_DIR, DEV_SERVER_ENDPOINTS;\nvar init_server = __esm({\n "src/core/utils/constants/server.ts"() {\n "use strict";\n DEFAULT_DASHBOARD_PORT = 3002;\n DEFAULT_PORT = 3e3;\n INTERNAL_PREFIX = "/_veryfront";\n INTERNAL_PATH_PREFIXES = {\n /** React Server Components endpoints */\n RSC: `${INTERNAL_PREFIX}/rsc/`,\n /** File system access endpoints (base64 encoded paths) */\n FS: `${INTERNAL_PREFIX}/fs/`,\n /** Virtual module system */\n MODULES: `${INTERNAL_PREFIX}/modules/`,\n /** Generated page modules */\n PAGES: `${INTERNAL_PREFIX}/pages/`,\n /** Data JSON endpoints */\n DATA: `${INTERNAL_PREFIX}/data/`,\n /** Library modules (AI SDK, etc.) */\n LIB: `${INTERNAL_PREFIX}/lib/`,\n /** Chunk assets */\n CHUNKS: `${INTERNAL_PREFIX}/chunks/`,\n /** Client component modules */\n CLIENT: `${INTERNAL_PREFIX}/client/`\n };\n INTERNAL_ENDPOINTS = {\n // Development endpoints\n HMR_RUNTIME: `${INTERNAL_PREFIX}/hmr-runtime.js`,\n HMR: `${INTERNAL_PREFIX}/hmr.js`,\n HYDRATE: `${INTERNAL_PREFIX}/hydrate.js`,\n ERROR_OVERLAY: `${INTERNAL_PREFIX}/error-overlay.js`,\n DEV_LOADER: `${INTERNAL_PREFIX}/dev-loader.js`,\n CLIENT_LOG: `${INTERNAL_PREFIX}/log`,\n // Production endpoints\n CLIENT_JS: `${INTERNAL_PREFIX}/client.js`,\n ROUTER_JS: `${INTERNAL_PREFIX}/router.js`,\n PREFETCH_JS: `${INTERNAL_PREFIX}/prefetch.js`,\n MANIFEST_JSON: `${INTERNAL_PREFIX}/manifest.json`,\n APP_JS: `${INTERNAL_PREFIX}/app.js`,\n // RSC endpoints\n RSC_CLIENT: `${INTERNAL_PREFIX}/rsc/client.js`,\n RSC_MANIFEST: `${INTERNAL_PREFIX}/rsc/manifest`,\n RSC_STREAM: `${INTERNAL_PREFIX}/rsc/stream`,\n RSC_PAYLOAD: `${INTERNAL_PREFIX}/rsc/payload`,\n RSC_RENDER: `${INTERNAL_PREFIX}/rsc/render`,\n RSC_PAGE: `${INTERNAL_PREFIX}/rsc/page`,\n RSC_MODULE: `${INTERNAL_PREFIX}/rsc/module`,\n RSC_DOM: `${INTERNAL_PREFIX}/rsc/dom.js`,\n RSC_HYDRATOR: `${INTERNAL_PREFIX}/rsc/hydrator.js`,\n RSC_HYDRATE_CLIENT: `${INTERNAL_PREFIX}/rsc/hydrate-client.js`,\n // Library module endpoints\n LIB_AI_REACT: `${INTERNAL_PREFIX}/lib/ai/react.js`,\n LIB_AI_COMPONENTS: `${INTERNAL_PREFIX}/lib/ai/components.js`,\n LIB_AI_PRIMITIVES: `${INTERNAL_PREFIX}/lib/ai/primitives.js`\n };\n BUILD_DIRS = {\n /** Main build output directory */\n ROOT: "_veryfront",\n /** Chunks directory */\n CHUNKS: "_veryfront/chunks",\n /** Data directory */\n DATA: "_veryfront/data",\n /** Assets directory */\n ASSETS: "_veryfront/assets"\n };\n PROJECT_DIRS = {\n /** Base veryfront internal directory */\n ROOT: ".veryfront",\n /** Cache directory for build artifacts, transforms, etc. */\n CACHE: ".veryfront/cache",\n /** KV store directory */\n KV: ".veryfront/kv",\n /** Log files directory */\n LOGS: ".veryfront/logs",\n /** Temporary files directory */\n TMP: ".veryfront/tmp"\n };\n DEFAULT_CACHE_DIR = PROJECT_DIRS.CACHE;\n DEV_SERVER_ENDPOINTS = {\n HMR_RUNTIME: INTERNAL_ENDPOINTS.HMR_RUNTIME,\n ERROR_OVERLAY: INTERNAL_ENDPOINTS.ERROR_OVERLAY\n };\n }\n});\n\n// src/core/utils/constants/index.ts\nvar init_constants = __esm({\n "src/core/utils/constants/index.ts"() {\n "use strict";\n init_build();\n init_cache();\n init_cdn();\n init_env2();\n init_hash();\n init_hmr();\n init_html();\n init_http();\n init_network();\n init_security();\n init_server();\n }\n});\n\n// src/core/utils/paths.ts\nvar PATHS, VERYFRONT_PATHS, FILE_EXTENSIONS;\nvar init_paths = __esm({\n "src/core/utils/paths.ts"() {\n "use strict";\n init_server();\n PATHS = {\n PAGES_DIR: "pages",\n COMPONENTS_DIR: "components",\n PUBLIC_DIR: "public",\n STYLES_DIR: "styles",\n DIST_DIR: "dist",\n CONFIG_FILE: "veryfront.config.js"\n };\n VERYFRONT_PATHS = {\n INTERNAL_PREFIX,\n BUILD_DIR: BUILD_DIRS.ROOT,\n CHUNKS_DIR: BUILD_DIRS.CHUNKS,\n DATA_DIR: BUILD_DIRS.DATA,\n ASSETS_DIR: BUILD_DIRS.ASSETS,\n HMR_RUNTIME: INTERNAL_ENDPOINTS.HMR_RUNTIME,\n CLIENT_JS: INTERNAL_ENDPOINTS.CLIENT_JS,\n ROUTER_JS: INTERNAL_ENDPOINTS.ROUTER_JS,\n ERROR_OVERLAY: INTERNAL_ENDPOINTS.ERROR_OVERLAY\n };\n FILE_EXTENSIONS = {\n MDX: [".mdx", ".md"],\n SCRIPT: [".tsx", ".ts", ".jsx", ".js"],\n STYLE: [".css", ".scss", ".sass"],\n ALL: [".mdx", ".md", ".tsx", ".ts", ".jsx", ".js", ".css"]\n };\n }\n});\n\n// src/core/utils/hash-utils.ts\nasync function computeHash(content) {\n const encoder = new TextEncoder();\n const data = encoder.encode(content);\n const hashBuffer = await crypto.subtle.digest("SHA-256", data);\n const hashArray = Array.from(new Uint8Array(hashBuffer));\n return hashArray.map((b) => b.toString(16).padStart(2, "0")).join("");\n}\nfunction getContentHash(content) {\n return computeHash(content);\n}\nfunction computeContentHash(content) {\n return computeHash(content);\n}\nfunction computeCodeHash(code) {\n const combined = code.code + (code.css || "") + (code.sourceMap || "");\n return computeHash(combined);\n}\nfunction simpleHash(str) {\n let hash = 0;\n for (let i = 0; i < str.length; i++) {\n const char = str.charCodeAt(i);\n hash = (hash << 5) - hash + char;\n hash = hash & hash;\n }\n return Math.abs(hash);\n}\nasync function shortHash(content) {\n const fullHash = await computeHash(content);\n return fullHash.slice(0, 8);\n}\nvar init_hash_utils = __esm({\n "src/core/utils/hash-utils.ts"() {\n "use strict";\n }\n});\n\n// src/core/utils/memoize.ts\nfunction memoizeAsync(fn, keyHasher) {\n const cache = new MemoCache();\n return async (...args) => {\n const key = keyHasher(...args);\n if (cache.has(key)) {\n return cache.get(key);\n }\n const result = await fn(...args);\n cache.set(key, result);\n return result;\n };\n}\nfunction memoize(fn, keyHasher) {\n const cache = new MemoCache();\n return (...args) => {\n const key = keyHasher(...args);\n if (cache.has(key)) {\n return cache.get(key);\n }\n const result = fn(...args);\n cache.set(key, result);\n return result;\n };\n}\nfunction simpleHash2(...values) {\n const FNV_OFFSET_BASIS = 2166136261;\n const FNV_PRIME = 16777619;\n let hash = FNV_OFFSET_BASIS;\n for (const value of values) {\n const str = typeof value === "string" ? value : String(value);\n for (let i = 0; i < str.length; i++) {\n hash ^= str.charCodeAt(i);\n hash = Math.imul(hash, FNV_PRIME);\n }\n }\n return (hash >>> 0).toString(36);\n}\nvar MemoCache;\nvar init_memoize = __esm({\n "src/core/utils/memoize.ts"() {\n "use strict";\n MemoCache = class {\n constructor() {\n this.cache = /* @__PURE__ */ new Map();\n }\n get(key) {\n return this.cache.get(key);\n }\n set(key, value) {\n this.cache.set(key, value);\n }\n has(key) {\n return this.cache.has(key);\n }\n clear() {\n this.cache.clear();\n }\n size() {\n return this.cache.size;\n }\n };\n }\n});\n\n// src/core/utils/path-utils.ts\nfunction normalizePath(pathname) {\n pathname = pathname.replace(/\\\\+/g, "/").replace(/\\/\\.+\\//g, "/");\n if (pathname !== "/" && pathname.endsWith("/")) {\n pathname = pathname.slice(0, -1);\n }\n return pathname;\n}\nfunction joinPath(a, b) {\n return `${a.replace(/\\/$/, "")}/${b.replace(/^\\//, "")}`;\n}\nfunction isWithinDirectory(root, target) {\n const normalizedRoot = normalizePath(root);\n const normalizedTarget = normalizePath(target);\n return normalizedTarget.startsWith(`${normalizedRoot}/`) || normalizedTarget === normalizedRoot;\n}\nfunction getExtension(path) {\n const lastDot = path.lastIndexOf(".");\n if (lastDot === -1 || lastDot === path.length - 1) {\n return "";\n }\n return path.slice(lastDot);\n}\nfunction getDirectory(path) {\n const normalized = normalizePath(path);\n const lastSlash = normalized.lastIndexOf("/");\n return lastSlash <= 0 ? "/" : normalized.slice(0, lastSlash);\n}\nfunction hasHashedFilename(path) {\n return /\\.[a-f0-9]{8,}\\./.test(path);\n}\nfunction isAbsolutePath(path) {\n return path.startsWith("/") || /^[A-Za-z]:[\\\\/]/.test(path);\n}\nfunction toBase64Url(s) {\n const b64 = btoa(s);\n return b64.replaceAll("+", "-").replaceAll("/", "_").replaceAll("=", "");\n}\nfunction fromBase64Url(encoded) {\n const b64 = encoded.replaceAll("-", "+").replaceAll("_", "/");\n const pad = b64.length % 4 === 2 ? "==" : b64.length % 4 === 3 ? "=" : "";\n try {\n return atob(b64 + pad);\n } catch (error2) {\n logger.debug(`Failed to decode base64url string "${encoded}":`, error2);\n return "";\n }\n}\nvar init_path_utils = __esm({\n "src/core/utils/path-utils.ts"() {\n "use strict";\n init_logger();\n }\n});\n\n// src/core/utils/format-utils.ts\nfunction formatBytes(bytes) {\n if (bytes === 0)\n return "0 Bytes";\n const absBytes = Math.abs(bytes);\n if (absBytes < 1) {\n return `${absBytes} Bytes`;\n }\n const k = 1024;\n const sizes = ["Bytes", "KB", "MB", "GB", "TB"];\n const i = Math.floor(Math.log(absBytes) / Math.log(k));\n const index = Math.max(0, Math.min(i, sizes.length - 1));\n return `${parseFloat((absBytes / Math.pow(k, index)).toFixed(2))} ${sizes[index]}`;\n}\nfunction estimateSize(value) {\n if (value === null || value === void 0)\n return 8;\n switch (typeof value) {\n case "boolean":\n return 4;\n case "number":\n return 8;\n case "string":\n return value.length * 2;\n case "function":\n return 0;\n case "object":\n return estimateObjectSize(value);\n default:\n return 32;\n }\n}\nfunction estimateSizeWithCircularHandling(value) {\n const seen = /* @__PURE__ */ new WeakSet();\n const encoder = new TextEncoder();\n const json3 = JSON.stringify(value, (_key, val) => {\n if (typeof val === "object" && val !== null) {\n if (seen.has(val))\n return void 0;\n seen.add(val);\n if (val instanceof Map) {\n return { __type: "Map", entries: Array.from(val.entries()) };\n }\n if (val instanceof Set) {\n return { __type: "Set", values: Array.from(val.values()) };\n }\n }\n if (typeof val === "function")\n return void 0;\n if (val instanceof Uint8Array) {\n return { __type: "Uint8Array", length: val.length };\n }\n return val;\n });\n return encoder.encode(json3 ?? "").length;\n}\nfunction estimateObjectSize(value) {\n if (value instanceof ArrayBuffer)\n return value.byteLength;\n if (value instanceof Uint8Array || value instanceof Uint16Array || value instanceof Uint32Array || value instanceof Int8Array || value instanceof Int16Array || value instanceof Int32Array) {\n return value.byteLength;\n }\n try {\n return JSON.stringify(value).length * 2;\n } catch (error2) {\n logger.debug("Failed to estimate size of non-serializable object:", error2);\n return 1024;\n }\n}\nfunction formatDuration(ms) {\n if (ms < 1e3)\n return `${ms}ms`;\n if (ms < 6e4)\n return `${(ms / 1e3).toFixed(1)}s`;\n if (ms < 36e5)\n return `${Math.floor(ms / 6e4)}m ${Math.floor(ms % 6e4 / 1e3)}s`;\n return `${Math.floor(ms / 36e5)}h ${Math.floor(ms % 36e5 / 6e4)}m`;\n}\nfunction formatNumber(num) {\n return num.toString().replace(/\\B(?=(\\d{3})+(?!\\d))/g, ",");\n}\nfunction truncateString(str, maxLength) {\n if (str.length <= maxLength)\n return str;\n return str.slice(0, maxLength - 3) + "...";\n}\nvar init_format_utils = __esm({\n "src/core/utils/format-utils.ts"() {\n "use strict";\n init_logger();\n }\n});\n\n// src/core/utils/bundle-manifest.ts\nfunction setBundleManifestStore(store) {\n manifestStore = store;\n serverLogger.info("[bundle-manifest] Bundle manifest store configured", {\n type: store.constructor.name\n });\n}\nfunction getBundleManifestStore() {\n return manifestStore;\n}\nvar InMemoryBundleManifestStore, manifestStore;\nvar init_bundle_manifest = __esm({\n "src/core/utils/bundle-manifest.ts"() {\n "use strict";\n init_logger2();\n init_hash_utils();\n InMemoryBundleManifestStore = class {\n constructor() {\n this.metadata = /* @__PURE__ */ new Map();\n this.code = /* @__PURE__ */ new Map();\n this.sourceIndex = /* @__PURE__ */ new Map();\n }\n getBundleMetadata(key) {\n const entry = this.metadata.get(key);\n if (!entry)\n return Promise.resolve(void 0);\n if (entry.expiry && Date.now() > entry.expiry) {\n this.metadata.delete(key);\n return Promise.resolve(void 0);\n }\n return Promise.resolve(entry.value);\n }\n setBundleMetadata(key, metadata, ttlMs) {\n const expiry = ttlMs ? Date.now() + ttlMs : void 0;\n this.metadata.set(key, { value: metadata, expiry });\n if (!this.sourceIndex.has(metadata.source)) {\n this.sourceIndex.set(metadata.source, /* @__PURE__ */ new Set());\n }\n this.sourceIndex.get(metadata.source).add(key);\n return Promise.resolve();\n }\n getBundleCode(hash) {\n const entry = this.code.get(hash);\n if (!entry)\n return Promise.resolve(void 0);\n if (entry.expiry && Date.now() > entry.expiry) {\n this.code.delete(hash);\n return Promise.resolve(void 0);\n }\n return Promise.resolve(entry.value);\n }\n setBundleCode(hash, code, ttlMs) {\n const expiry = ttlMs ? Date.now() + ttlMs : void 0;\n this.code.set(hash, { value: code, expiry });\n return Promise.resolve();\n }\n async deleteBundle(key) {\n const metadata = await this.getBundleMetadata(key);\n this.metadata.delete(key);\n if (metadata) {\n this.code.delete(metadata.codeHash);\n const sourceKeys = this.sourceIndex.get(metadata.source);\n if (sourceKeys) {\n sourceKeys.delete(key);\n if (sourceKeys.size === 0) {\n this.sourceIndex.delete(metadata.source);\n }\n }\n }\n }\n async invalidateSource(source) {\n const keys = this.sourceIndex.get(source);\n if (!keys)\n return 0;\n let count = 0;\n for (const key of Array.from(keys)) {\n await this.deleteBundle(key);\n count++;\n }\n this.sourceIndex.delete(source);\n return count;\n }\n clear() {\n this.metadata.clear();\n this.code.clear();\n this.sourceIndex.clear();\n return Promise.resolve();\n }\n isAvailable() {\n return Promise.resolve(true);\n }\n getStats() {\n let totalSize = 0;\n let oldest;\n let newest;\n for (const { value } of this.metadata.values()) {\n totalSize += value.size;\n if (!oldest || value.compiledAt < oldest)\n oldest = value.compiledAt;\n if (!newest || value.compiledAt > newest)\n newest = value.compiledAt;\n }\n return Promise.resolve({\n totalBundles: this.metadata.size,\n totalSize,\n oldestBundle: oldest,\n newestBundle: newest\n });\n }\n };\n manifestStore = new InMemoryBundleManifestStore();\n }\n});\n\n// src/core/utils/bundle-manifest-init.ts\nasync function initializeBundleManifest(config, mode, adapter) {\n const manifestConfig = config.cache?.bundleManifest;\n const enabled = manifestConfig?.enabled ?? mode === "production";\n if (!enabled) {\n serverLogger.info("[bundle-manifest] Bundle manifest disabled");\n setBundleManifestStore(new InMemoryBundleManifestStore());\n return;\n }\n const envType = adapter?.env.get("VERYFRONT_BUNDLE_MANIFEST_TYPE");\n const storeType = manifestConfig?.type || envType || "memory";\n serverLogger.info("[bundle-manifest] Initializing bundle manifest", {\n type: storeType,\n mode\n });\n try {\n let store;\n switch (storeType) {\n case "redis": {\n const { RedisBundleManifestStore } = await import("./bundle-manifest-redis.ts");\n const redisUrl = manifestConfig?.redisUrl || adapter?.env.get("VERYFRONT_BUNDLE_MANIFEST_REDIS_URL");\n store = new RedisBundleManifestStore(\n {\n url: redisUrl,\n keyPrefix: manifestConfig?.keyPrefix\n },\n adapter\n );\n const available = await store.isAvailable();\n if (!available) {\n serverLogger.warn("[bundle-manifest] Redis not available, falling back to in-memory");\n store = new InMemoryBundleManifestStore();\n } else {\n serverLogger.info("[bundle-manifest] Redis store initialized");\n }\n break;\n }\n case "kv": {\n const { KVBundleManifestStore } = await import("./bundle-manifest-kv.ts");\n store = new KVBundleManifestStore({\n keyPrefix: manifestConfig?.keyPrefix\n });\n const available = await store.isAvailable();\n if (!available) {\n serverLogger.warn("[bundle-manifest] KV not available, falling back to in-memory");\n store = new InMemoryBundleManifestStore();\n } else {\n serverLogger.info("[bundle-manifest] KV store initialized");\n }\n break;\n }\n case "memory":\n default: {\n store = new InMemoryBundleManifestStore();\n serverLogger.info("[bundle-manifest] In-memory store initialized");\n break;\n }\n }\n setBundleManifestStore(store);\n try {\n const stats = await store.getStats();\n serverLogger.info("[bundle-manifest] Store statistics", stats);\n } catch (error2) {\n serverLogger.debug("[bundle-manifest] Failed to get stats", { error: error2 });\n }\n } catch (error2) {\n serverLogger.error("[bundle-manifest] Failed to initialize store, using in-memory fallback", {\n error: error2\n });\n setBundleManifestStore(new InMemoryBundleManifestStore());\n }\n}\nfunction getBundleManifestTTL(config, mode) {\n const manifestConfig = config.cache?.bundleManifest;\n if (manifestConfig?.ttl) {\n return manifestConfig.ttl;\n }\n if (mode === "production") {\n return BUNDLE_MANIFEST_PROD_TTL_MS;\n } else {\n return BUNDLE_MANIFEST_DEV_TTL_MS;\n }\n}\nasync function warmupBundleManifest(store, keys) {\n serverLogger.info("[bundle-manifest] Warming up cache", { keys: keys.length });\n let loaded = 0;\n let failed = 0;\n for (const key of keys) {\n try {\n const metadata = await store.getBundleMetadata(key);\n if (metadata) {\n await store.getBundleCode(metadata.codeHash);\n loaded++;\n }\n } catch (error2) {\n serverLogger.debug("[bundle-manifest] Failed to warm up key", { key, error: error2 });\n failed++;\n }\n }\n serverLogger.info("[bundle-manifest] Cache warmup complete", { loaded, failed });\n}\nvar init_bundle_manifest_init = __esm({\n "src/core/utils/bundle-manifest-init.ts"() {\n "use strict";\n init_logger2();\n init_bundle_manifest();\n init_cache();\n }\n});\n\n// src/core/utils/feature-flags.ts\nfunction isRSCEnabled(config) {\n if (config?.experimental?.rsc !== void 0) {\n return config.experimental.rsc;\n }\n return getEnv("VERYFRONT_EXPERIMENTAL_RSC") === "1";\n}\nvar init_feature_flags = __esm({\n "src/core/utils/feature-flags.ts"() {\n "use strict";\n init_process();\n }\n});\n\n// src/core/utils/platform.ts\nfunction isCompiledBinary() {\n if (!isDeno)\n return false;\n try {\n const path = execPath();\n return path.includes("veryfront");\n } catch {\n return false;\n }\n}\nvar init_platform = __esm({\n "src/core/utils/platform.ts"() {\n "use strict";\n init_runtime();\n init_process();\n }\n});\n\n// src/core/utils/index.ts\nvar utils_exports = {};\n__export(utils_exports, {\n ABSOLUTE_PATH_PATTERN: () => ABSOLUTE_PATH_PATTERN,\n BREAKPOINT_LG: () => BREAKPOINT_LG,\n BREAKPOINT_MD: () => BREAKPOINT_MD,\n BREAKPOINT_SM: () => BREAKPOINT_SM,\n BREAKPOINT_XL: () => BREAKPOINT_XL,\n BUILD_DIRS: () => BUILD_DIRS,\n BUNDLE_CACHE_TTL_DEVELOPMENT_MS: () => BUNDLE_CACHE_TTL_DEVELOPMENT_MS,\n BUNDLE_CACHE_TTL_PRODUCTION_MS: () => BUNDLE_CACHE_TTL_PRODUCTION_MS,\n BUNDLE_MANIFEST_DEV_TTL_MS: () => BUNDLE_MANIFEST_DEV_TTL_MS,\n BUNDLE_MANIFEST_PROD_TTL_MS: () => BUNDLE_MANIFEST_PROD_TTL_MS,\n BYTES_PER_KB: () => BYTES_PER_KB,\n BYTES_PER_MB: () => BYTES_PER_MB,\n CACHE_CLEANUP_INTERVAL_MS: () => CACHE_CLEANUP_INTERVAL_MS,\n CLEANUP_INTERVAL_MULTIPLIER: () => CLEANUP_INTERVAL_MULTIPLIER,\n COMPONENT_LOADER_MAX_ENTRIES: () => COMPONENT_LOADER_MAX_ENTRIES,\n COMPONENT_LOADER_TTL_MS: () => COMPONENT_LOADER_TTL_MS,\n DASHBOARD_RECONNECT_DELAY_MS: () => DASHBOARD_RECONNECT_DELAY_MS,\n DATA_FETCHING_MAX_ENTRIES: () => DATA_FETCHING_MAX_ENTRIES,\n DATA_FETCHING_TTL_MS: () => DATA_FETCHING_TTL_MS,\n DEFAULT_ALLOWED_CDN_HOSTS: () => DEFAULT_ALLOWED_CDN_HOSTS,\n DEFAULT_API_SERVER_PORT: () => DEFAULT_API_SERVER_PORT,\n DEFAULT_BUILD_CONCURRENCY: () => DEFAULT_BUILD_CONCURRENCY,\n DEFAULT_CACHE_DIR: () => DEFAULT_CACHE_DIR,\n DEFAULT_DASHBOARD_PORT: () => DEFAULT_DASHBOARD_PORT,\n DEFAULT_DEV_SERVER_PORT: () => DEFAULT_DEV_SERVER_PORT,\n DEFAULT_IMAGE_LARGE_SIZE: () => DEFAULT_IMAGE_LARGE_SIZE,\n DEFAULT_IMAGE_SMALL_SIZE: () => DEFAULT_IMAGE_SMALL_SIZE,\n DEFAULT_IMAGE_THUMBNAIL_SIZE: () => DEFAULT_IMAGE_THUMBNAIL_SIZE,\n DEFAULT_LRU_MAX_ENTRIES: () => DEFAULT_LRU_MAX_ENTRIES,\n DEFAULT_MAX_STRING_LENGTH: () => DEFAULT_MAX_STRING_LENGTH,\n DEFAULT_METRICS_PORT: () => DEFAULT_METRICS_PORT,\n DEFAULT_PORT: () => DEFAULT_PORT,\n DEFAULT_PREVIEW_SERVER_PORT: () => DEFAULT_PREVIEW_SERVER_PORT,\n DEFAULT_REDIS_PORT: () => DEFAULT_REDIS_PORT,\n DEFAULT_SERVER_PORT: () => DEFAULT_SERVER_PORT,\n DENO_KV_SAFE_SIZE_LIMIT_BYTES: () => DENO_KV_SAFE_SIZE_LIMIT_BYTES,\n DENO_STD_BASE: () => DENO_STD_BASE,\n DENO_STD_VERSION: () => DENO_STD_VERSION,\n DEV_SERVER_ENDPOINTS: () => DEV_SERVER_ENDPOINTS,\n DIRECTORY_TRAVERSAL_PATTERN: () => DIRECTORY_TRAVERSAL_PATTERN,\n ENV_VARS: () => ENV_VARS,\n ESM_CDN_BASE: () => ESM_CDN_BASE,\n FILE_EXTENSIONS: () => FILE_EXTENSIONS,\n FORBIDDEN_PATH_PATTERNS: () => FORBIDDEN_PATH_PATTERNS,\n HASH_SEED_DJB2: () => HASH_SEED_DJB2,\n HASH_SEED_FNV1A: () => HASH_SEED_FNV1A,\n HMR_CLIENT_RELOAD_DELAY_MS: () => HMR_CLIENT_RELOAD_DELAY_MS,\n HMR_CLOSE_MESSAGE_TOO_LARGE: () => HMR_CLOSE_MESSAGE_TOO_LARGE,\n HMR_CLOSE_NORMAL: () => HMR_CLOSE_NORMAL,\n HMR_CLOSE_RATE_LIMIT: () => HMR_CLOSE_RATE_LIMIT,\n HMR_FILE_WATCHER_DEBOUNCE_MS: () => HMR_FILE_WATCHER_DEBOUNCE_MS,\n HMR_KEEP_ALIVE_INTERVAL_MS: () => HMR_KEEP_ALIVE_INTERVAL_MS,\n HMR_MAX_MESSAGES_PER_MINUTE: () => HMR_MAX_MESSAGES_PER_MINUTE,\n HMR_MAX_MESSAGE_SIZE_BYTES: () => HMR_MAX_MESSAGE_SIZE_BYTES,\n HMR_MESSAGE_TYPES: () => HMR_MESSAGE_TYPES,\n HMR_PORT_OFFSET: () => HMR_PORT_OFFSET,\n HMR_RATE_LIMIT_WINDOW_MS: () => HMR_RATE_LIMIT_WINDOW_MS,\n HMR_RECONNECT_DELAY_MS: () => HMR_RECONNECT_DELAY_MS,\n HMR_RELOAD_DELAY_MS: () => HMR_RELOAD_DELAY_MS,\n HOURS_PER_DAY: () => HOURS_PER_DAY,\n HTTP_BAD_GATEWAY: () => HTTP_BAD_GATEWAY,\n HTTP_BAD_REQUEST: () => HTTP_BAD_REQUEST,\n HTTP_CACHE_LONG_MAX_AGE_SEC: () => HTTP_CACHE_LONG_MAX_AGE_SEC,\n HTTP_CACHE_MEDIUM_MAX_AGE_SEC: () => HTTP_CACHE_MEDIUM_MAX_AGE_SEC,\n HTTP_CACHE_SHORT_MAX_AGE_SEC: () => HTTP_CACHE_SHORT_MAX_AGE_SEC,\n HTTP_CONTENT_TYPES: () => HTTP_CONTENT_TYPES,\n HTTP_CONTENT_TYPE_IMAGE_AVIF: () => HTTP_CONTENT_TYPE_IMAGE_AVIF,\n HTTP_CONTENT_TYPE_IMAGE_GIF: () => HTTP_CONTENT_TYPE_IMAGE_GIF,\n HTTP_CONTENT_TYPE_IMAGE_ICO: () => HTTP_CONTENT_TYPE_IMAGE_ICO,\n HTTP_CONTENT_TYPE_IMAGE_JPEG: () => HTTP_CONTENT_TYPE_IMAGE_JPEG,\n HTTP_CONTENT_TYPE_IMAGE_PNG: () => HTTP_CONTENT_TYPE_IMAGE_PNG,\n HTTP_CONTENT_TYPE_IMAGE_SVG: () => HTTP_CONTENT_TYPE_IMAGE_SVG,\n HTTP_CONTENT_TYPE_IMAGE_WEBP: () => HTTP_CONTENT_TYPE_IMAGE_WEBP,\n HTTP_CREATED: () => HTTP_CREATED,\n HTTP_FORBIDDEN: () => HTTP_FORBIDDEN,\n HTTP_GONE: () => HTTP_GONE,\n HTTP_INTERNAL_SERVER_ERROR: () => HTTP_INTERNAL_SERVER_ERROR,\n HTTP_METHOD_NOT_ALLOWED: () => HTTP_METHOD_NOT_ALLOWED,\n HTTP_MODULE_FETCH_TIMEOUT_MS: () => HTTP_MODULE_FETCH_TIMEOUT_MS,\n HTTP_NETWORK_CONNECT_TIMEOUT: () => HTTP_NETWORK_CONNECT_TIMEOUT,\n HTTP_NOT_FOUND: () => HTTP_NOT_FOUND,\n HTTP_NOT_IMPLEMENTED: () => HTTP_NOT_IMPLEMENTED,\n HTTP_NOT_MODIFIED: () => HTTP_NOT_MODIFIED,\n HTTP_NO_CONTENT: () => HTTP_NO_CONTENT,\n HTTP_OK: () => HTTP_OK,\n HTTP_PAYLOAD_TOO_LARGE: () => HTTP_PAYLOAD_TOO_LARGE,\n HTTP_REDIRECT_FOUND: () => HTTP_REDIRECT_FOUND,\n HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE: () => HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE,\n HTTP_SERVER_ERROR: () => HTTP_SERVER_ERROR,\n HTTP_STATUS_CLIENT_ERROR_MIN: () => HTTP_STATUS_CLIENT_ERROR_MIN,\n HTTP_STATUS_REDIRECT_MIN: () => HTTP_STATUS_REDIRECT_MIN,\n HTTP_STATUS_SERVER_ERROR_MIN: () => HTTP_STATUS_SERVER_ERROR_MIN,\n HTTP_STATUS_SUCCESS_MIN: () => HTTP_STATUS_SUCCESS_MIN,\n HTTP_TOO_MANY_REQUESTS: () => HTTP_TOO_MANY_REQUESTS,\n HTTP_UNAUTHORIZED: () => HTTP_UNAUTHORIZED,\n HTTP_UNAVAILABLE: () => HTTP_UNAVAILABLE,\n HTTP_URI_TOO_LONG: () => HTTP_URI_TOO_LONG,\n IMAGE_OPTIMIZATION: () => IMAGE_OPTIMIZATION,\n INTERNAL_ENDPOINTS: () => INTERNAL_ENDPOINTS,\n INTERNAL_PATH_PREFIXES: () => INTERNAL_PATH_PREFIXES,\n INTERNAL_PREFIX: () => INTERNAL_PREFIX,\n InMemoryBundleManifestStore: () => InMemoryBundleManifestStore,\n JSDELIVR_CDN_BASE: () => JSDELIVR_CDN_BASE,\n KB_IN_BYTES: () => KB_IN_BYTES,\n LRU_DEFAULT_MAX_ENTRIES: () => LRU_DEFAULT_MAX_ENTRIES,\n LRU_DEFAULT_MAX_SIZE_BYTES: () => LRU_DEFAULT_MAX_SIZE_BYTES,\n LogLevel: () => LogLevel,\n MAX_CHUNK_SIZE_KB: () => MAX_CHUNK_SIZE_KB,\n MAX_PATH_LENGTH: () => MAX_PATH_LENGTH,\n MAX_PATH_TRAVERSAL_DEPTH: () => MAX_PATH_TRAVERSAL_DEPTH,\n MAX_PORT: () => MAX_PORT,\n MDX_CACHE_TTL_DEVELOPMENT_MS: () => MDX_CACHE_TTL_DEVELOPMENT_MS,\n MDX_CACHE_TTL_PRODUCTION_MS: () => MDX_CACHE_TTL_PRODUCTION_MS,\n MDX_RENDERER_MAX_ENTRIES: () => MDX_RENDERER_MAX_ENTRIES,\n MDX_RENDERER_TTL_MS: () => MDX_RENDERER_TTL_MS,\n MINUTES_PER_HOUR: () => MINUTES_PER_HOUR,\n MIN_PORT: () => MIN_PORT,\n MS_PER_MINUTE: () => MS_PER_MINUTE,\n MS_PER_SECOND: () => MS_PER_SECOND,\n MemoCache: () => MemoCache,\n ONE_DAY_MS: () => ONE_DAY_MS,\n PATHS: () => PATHS,\n PREFETCH_DEFAULT_DELAY_MS: () => PREFETCH_DEFAULT_DELAY_MS,\n PREFETCH_DEFAULT_TIMEOUT_MS: () => PREFETCH_DEFAULT_TIMEOUT_MS,\n PREFETCH_MAX_SIZE_BYTES: () => PREFETCH_MAX_SIZE_BYTES,\n PROJECT_DIRS: () => PROJECT_DIRS,\n PROSE_MAX_WIDTH: () => PROSE_MAX_WIDTH,\n REACT_DEFAULT_VERSION: () => REACT_DEFAULT_VERSION,\n REACT_VERSION_17: () => REACT_VERSION_17,\n REACT_VERSION_18_2: () => REACT_VERSION_18_2,\n REACT_VERSION_18_3: () => REACT_VERSION_18_3,\n REACT_VERSION_19: () => REACT_VERSION_19,\n REACT_VERSION_19_RC: () => REACT_VERSION_19_RC,\n RENDERER_CORE_MAX_ENTRIES: () => RENDERER_CORE_MAX_ENTRIES,\n RENDERER_CORE_TTL_MS: () => RENDERER_CORE_TTL_MS,\n RESPONSIVE_IMAGE_WIDTHS: () => RESPONSIVE_IMAGE_WIDTHS,\n RESPONSIVE_IMAGE_WIDTH_LG: () => RESPONSIVE_IMAGE_WIDTH_LG,\n RESPONSIVE_IMAGE_WIDTH_MD: () => RESPONSIVE_IMAGE_WIDTH_MD,\n RESPONSIVE_IMAGE_WIDTH_SM: () => RESPONSIVE_IMAGE_WIDTH_SM,\n RESPONSIVE_IMAGE_WIDTH_XS: () => RESPONSIVE_IMAGE_WIDTH_XS,\n RSC_MANIFEST_CACHE_TTL_MS: () => RSC_MANIFEST_CACHE_TTL_MS,\n SECONDS_PER_MINUTE: () => SECONDS_PER_MINUTE,\n SERVER_ACTION_DEFAULT_TTL_SEC: () => SERVER_ACTION_DEFAULT_TTL_SEC,\n SERVER_FUNCTION_DEFAULT_TIMEOUT_MS: () => SERVER_FUNCTION_DEFAULT_TIMEOUT_MS,\n TSX_LAYOUT_MAX_ENTRIES: () => TSX_LAYOUT_MAX_ENTRIES,\n TSX_LAYOUT_TTL_MS: () => TSX_LAYOUT_TTL_MS,\n UNOCSS_VERSION: () => UNOCSS_VERSION,\n VERSION: () => VERSION,\n VERYFRONT_PATHS: () => VERYFRONT_PATHS,\n VERYFRONT_VERSION: () => VERSION,\n Z_INDEX_DEV_INDICATOR: () => Z_INDEX_DEV_INDICATOR,\n Z_INDEX_ERROR_OVERLAY: () => Z_INDEX_ERROR_OVERLAY,\n __loggerResetForTests: () => __loggerResetForTests,\n agentLogger: () => agentLogger,\n bundlerLogger: () => bundlerLogger,\n cliLogger: () => cliLogger,\n computeCodeHash: () => computeCodeHash,\n computeContentHash: () => computeContentHash,\n computeHash: () => computeHash,\n estimateSize: () => estimateSize,\n estimateSizeWithCircularHandling: () => estimateSizeWithCircularHandling,\n formatBytes: () => formatBytes,\n formatDuration: () => formatDuration,\n formatNumber: () => formatNumber,\n fromBase64Url: () => fromBase64Url,\n getBundleManifestStore: () => getBundleManifestStore,\n getBundleManifestTTL: () => getBundleManifestTTL,\n getContentHash: () => getContentHash,\n getDenoStdNodeBase: () => getDenoStdNodeBase,\n getDirectory: () => getDirectory,\n getEnvironmentVariable: () => getEnvironmentVariable,\n getExtension: () => getExtension,\n getReactCDNUrl: () => getReactCDNUrl,\n getReactDOMCDNUrl: () => getReactDOMCDNUrl,\n getReactDOMClientCDNUrl: () => getReactDOMClientCDNUrl,\n getReactDOMServerCDNUrl: () => getReactDOMServerCDNUrl,\n getReactImportMap: () => getReactImportMap,\n getReactJSXDevRuntimeCDNUrl: () => getReactJSXDevRuntimeCDNUrl,\n getReactJSXRuntimeCDNUrl: () => getReactJSXRuntimeCDNUrl,\n getUnoCSSTailwindResetUrl: () => getUnoCSSTailwindResetUrl,\n hasBunRuntime: () => hasBunRuntime,\n hasDenoRuntime: () => hasDenoRuntime,\n hasHashedFilename: () => hasHashedFilename,\n hasNodeProcess: () => hasNodeProcess,\n initializeBundleManifest: () => initializeBundleManifest,\n isAbsolutePath: () => isAbsolutePath,\n isAnyDebugEnabled: () => isAnyDebugEnabled,\n isCompiledBinary: () => isCompiledBinary,\n isDebugEnabled: () => isDebugEnabled,\n isDeepInspectEnabled: () => isDeepInspectEnabled,\n isDevelopmentEnvironment: () => isDevelopmentEnvironment,\n isInternalEndpoint: () => isInternalEndpoint,\n isProductionEnvironment: () => isProductionEnvironment,\n isRSCEnabled: () => isRSCEnabled,\n isStaticAsset: () => isStaticAsset,\n isTestEnvironment: () => isTestEnvironment,\n isTruthyEnvValue: () => isTruthyEnvValue,\n isValidHMRMessageType: () => isValidHMRMessageType,\n isWithinDirectory: () => isWithinDirectory,\n joinPath: () => joinPath,\n logger: () => logger,\n memoize: () => memoize,\n memoizeAsync: () => memoizeAsync,\n memoizeHash: () => simpleHash2,\n normalizeChunkPath: () => normalizeChunkPath,\n normalizePath: () => normalizePath,\n numericHash: () => simpleHash,\n rendererLogger: () => rendererLogger,\n serverLogger: () => serverLogger,\n setBundleManifestStore: () => setBundleManifestStore,\n shortHash: () => shortHash,\n simpleHash: () => simpleHash,\n toBase64Url: () => toBase64Url,\n truncateString: () => truncateString,\n warmupBundleManifest: () => warmupBundleManifest\n});\nvar init_utils = __esm({\n "src/core/utils/index.ts"() {\n init_runtime_guards();\n init_logger2();\n init_constants();\n init_version();\n init_paths();\n init_hash_utils();\n init_memoize();\n init_path_utils();\n init_format_utils();\n init_bundle_manifest();\n init_bundle_manifest_init();\n init_feature_flags();\n init_platform();\n }\n});\n\n// src/_shims/std-path.ts\nvar std_path_exports = {};\n__export(std_path_exports, {\n SEPARATOR: () => SEPARATOR,\n SEPARATOR_PATTERN: () => SEPARATOR_PATTERN,\n basename: () => basename2,\n delimiter: () => delimiter2,\n dirname: () => dirname2,\n extname: () => extname2,\n format: () => format2,\n fromFileUrl: () => fromFileUrl,\n isAbsolute: () => isAbsolute2,\n join: () => join2,\n normalize: () => normalize2,\n parse: () => parse2,\n relative: () => relative2,\n resolve: () => resolve2,\n sep: () => sep2,\n toFileUrl: () => toFileUrl\n});\nimport * as nodeUrl from "node:url";\nimport * as nodePath from "node:path";\nfunction fromFileUrl(url) {\n return nodeUrl.fileURLToPath(url);\n}\nfunction toFileUrl(path) {\n return nodeUrl.pathToFileURL(path);\n}\nvar basename2, dirname2, extname2, join2, resolve2, relative2, isAbsolute2, normalize2, parse2, format2, sep2, delimiter2, SEPARATOR, SEPARATOR_PATTERN;\nvar init_std_path = __esm({\n "src/_shims/std-path.ts"() {\n basename2 = nodePath.basename;\n dirname2 = nodePath.dirname;\n extname2 = nodePath.extname;\n join2 = nodePath.join;\n resolve2 = nodePath.resolve;\n relative2 = nodePath.relative;\n isAbsolute2 = nodePath.isAbsolute;\n normalize2 = nodePath.normalize;\n parse2 = nodePath.parse;\n format2 = nodePath.format;\n sep2 = nodePath.sep;\n delimiter2 = nodePath.delimiter;\n SEPARATOR = nodePath.sep;\n SEPARATOR_PATTERN = nodePath.sep === "/" ? /\\/+/ : /[\\\\/]+/;\n }\n});\n\n// src/core/errors/veryfront-error.ts\nfunction createError(error2) {\n return error2;\n}\nfunction toError(veryfrontError) {\n const error2 = new Error(veryfrontError.message);\n error2.name = `VeryfrontError[${veryfrontError.type}]`;\n Object.defineProperty(error2, "context", {\n value: veryfrontError,\n enumerable: false,\n configurable: true\n });\n return error2;\n}\nvar init_veryfront_error = __esm({\n "src/core/errors/veryfront-error.ts"() {\n "use strict";\n }\n});\n\n// src/core/config/schema.ts\nimport { z } from "zod";\nvar corsSchema, veryfrontConfigSchema;\nvar init_schema = __esm({\n "src/core/config/schema.ts"() {\n "use strict";\n init_veryfront_error();\n corsSchema = z.union([z.boolean(), z.object({ origin: z.string().optional() }).strict()]);\n veryfrontConfigSchema = z.object({\n title: z.string().optional(),\n description: z.string().optional(),\n experimental: z.object({\n esmLayouts: z.boolean().optional(),\n precompileMDX: z.boolean().optional()\n }).partial().optional(),\n router: z.enum(["app", "pages"]).optional(),\n defaultLayout: z.string().optional(),\n theme: z.object({ colors: z.record(z.string()).optional() }).partial().optional(),\n build: z.object({\n outDir: z.string().optional(),\n trailingSlash: z.boolean().optional(),\n esbuild: z.object({\n wasmURL: z.string().url().optional(),\n worker: z.boolean().optional()\n }).partial().optional()\n }).partial().optional(),\n cache: z.object({\n dir: z.string().optional(),\n bundleManifest: z.object({\n type: z.enum(["redis", "kv", "memory"]).optional(),\n redisUrl: z.string().optional(),\n keyPrefix: z.string().optional(),\n ttl: z.number().int().positive().optional(),\n enabled: z.boolean().optional()\n }).partial().optional()\n }).partial().optional(),\n dev: z.object({\n port: z.number().int().positive().optional(),\n host: z.string().optional(),\n open: z.boolean().optional(),\n hmr: z.boolean().optional(),\n components: z.array(z.string()).optional()\n }).partial().optional(),\n resolve: z.object({\n importMap: z.object({\n imports: z.record(z.string()).optional(),\n scopes: z.record(z.record(z.string())).optional()\n }).partial().optional()\n }).partial().optional(),\n security: z.object({\n csp: z.record(z.array(z.string())).optional(),\n remoteHosts: z.array(z.string().url()).optional(),\n cors: corsSchema.optional(),\n coop: z.enum(["same-origin", "same-origin-allow-popups", "unsafe-none"]).optional(),\n corp: z.enum(["same-origin", "same-site", "cross-origin"]).optional(),\n coep: z.enum(["require-corp", "unsafe-none"]).optional()\n }).partial().optional(),\n middleware: z.object({\n custom: z.array(z.function()).optional()\n }).partial().optional(),\n theming: z.object({\n brandName: z.string().optional(),\n logoHtml: z.string().optional()\n }).partial().optional(),\n assetPipeline: z.object({\n images: z.object({\n enabled: z.boolean().optional(),\n formats: z.array(z.enum(["webp", "avif", "jpeg", "png"])).optional(),\n sizes: z.array(z.number().int().positive()).optional(),\n quality: z.number().int().min(1).max(100).optional(),\n inputDir: z.string().optional(),\n outputDir: z.string().optional(),\n preserveOriginal: z.boolean().optional()\n }).partial().optional(),\n css: z.object({\n enabled: z.boolean().optional(),\n minify: z.boolean().optional(),\n autoprefixer: z.boolean().optional(),\n purge: z.boolean().optional(),\n criticalCSS: z.boolean().optional(),\n inputDir: z.string().optional(),\n outputDir: z.string().optional(),\n browsers: z.array(z.string()).optional(),\n purgeContent: z.array(z.string()).optional(),\n sourceMap: z.boolean().optional()\n }).partial().optional()\n }).partial().optional(),\n observability: z.object({\n tracing: z.object({\n enabled: z.boolean().optional(),\n exporter: z.enum(["jaeger", "zipkin", "otlp", "console"]).optional(),\n endpoint: z.string().optional(),\n serviceName: z.string().optional(),\n sampleRate: z.number().min(0).max(1).optional()\n }).partial().optional(),\n metrics: z.object({\n enabled: z.boolean().optional(),\n exporter: z.enum(["prometheus", "otlp", "console"]).optional(),\n endpoint: z.string().optional(),\n prefix: z.string().optional(),\n collectInterval: z.number().int().positive().optional()\n }).partial().optional()\n }).partial().optional(),\n fs: z.object({\n type: z.enum(["local", "veryfront-api", "memory"]).optional(),\n local: z.object({\n baseDir: z.string().optional()\n }).partial().optional(),\n veryfront: z.object({\n apiBaseUrl: z.string().url(),\n apiToken: z.string(),\n projectSlug: z.string(),\n cache: z.object({\n enabled: z.boolean().optional(),\n ttl: z.number().int().positive().optional(),\n maxSize: z.number().int().positive().optional()\n }).partial().optional(),\n retry: z.object({\n maxRetries: z.number().int().min(0).optional(),\n initialDelay: z.number().int().positive().optional(),\n maxDelay: z.number().int().positive().optional()\n }).partial().optional()\n }).partial().optional(),\n memory: z.object({\n files: z.record(z.union([z.string(), z.instanceof(Uint8Array)])).optional()\n }).partial().optional()\n }).partial().optional(),\n client: z.object({\n moduleResolution: z.enum(["cdn", "self-hosted", "bundled"]).optional(),\n cdn: z.object({\n provider: z.enum(["esm.sh", "unpkg", "jsdelivr"]).optional(),\n versions: z.union([\n z.literal("auto"),\n z.object({\n react: z.string().optional(),\n veryfront: z.string().optional()\n })\n ]).optional()\n }).partial().optional()\n }).partial().optional()\n }).partial();\n }\n});\n\n// src/core/config/loader.ts\nfunction getDefaultImportMapForConfig() {\n return { imports: getReactImportMap(REACT_DEFAULT_VERSION) };\n}\nvar DEFAULT_CONFIG;\nvar init_loader = __esm({\n "src/core/config/loader.ts"() {\n "use strict";\n init_schema();\n init_std_path();\n init_logger();\n init_cdn();\n init_server();\n DEFAULT_CONFIG = {\n title: "Veryfront App",\n description: "Built with Veryfront",\n experimental: {\n esmLayouts: true\n },\n router: void 0,\n defaultLayout: void 0,\n theme: {\n colors: {\n primary: "#3B82F6"\n }\n },\n build: {\n outDir: "dist",\n trailingSlash: false,\n esbuild: {\n wasmURL: "https://deno.land/x/esbuild@v0.20.1/esbuild.wasm",\n worker: false\n }\n },\n cache: {\n dir: DEFAULT_CACHE_DIR,\n render: {\n type: "memory",\n ttl: void 0,\n maxEntries: 500,\n kvPath: void 0,\n redisUrl: void 0,\n redisKeyPrefix: void 0\n }\n },\n dev: {\n port: 3002,\n host: "localhost",\n open: false\n },\n resolve: {\n importMap: getDefaultImportMapForConfig()\n },\n client: {\n moduleResolution: "cdn",\n cdn: {\n provider: "esm.sh",\n versions: "auto"\n }\n }\n };\n }\n});\n\n// src/core/config/define-config.ts\nvar init_define_config = __esm({\n "src/core/config/define-config.ts"() {\n "use strict";\n init_veryfront_error();\n init_process();\n }\n});\n\n// src/core/config/defaults.ts\nvar DEFAULT_DEV_PORT, DEFAULT_PREFETCH_DELAY_MS, DURATION_HISTOGRAM_BOUNDARIES_MS, SIZE_HISTOGRAM_BOUNDARIES_KB, PAGE_TRANSITION_DELAY_MS;\nvar init_defaults = __esm({\n "src/core/config/defaults.ts"() {\n "use strict";\n DEFAULT_DEV_PORT = 3e3;\n DEFAULT_PREFETCH_DELAY_MS = 100;\n DURATION_HISTOGRAM_BOUNDARIES_MS = [\n 5,\n 10,\n 25,\n 50,\n 75,\n 100,\n 250,\n 500,\n 750,\n 1e3,\n 2500,\n 5e3,\n 7500,\n 1e4\n ];\n SIZE_HISTOGRAM_BOUNDARIES_KB = [\n 1,\n 5,\n 10,\n 25,\n 50,\n 100,\n 250,\n 500,\n 1e3,\n 2500,\n 5e3,\n 1e4\n ];\n PAGE_TRANSITION_DELAY_MS = 150;\n }\n});\n\n// src/core/config/network-defaults.ts\nvar init_network_defaults = __esm({\n "src/core/config/network-defaults.ts"() {\n "use strict";\n }\n});\n\n// src/core/config/index.ts\nvar init_config = __esm({\n "src/core/config/index.ts"() {\n init_loader();\n init_define_config();\n init_schema();\n init_defaults();\n init_network_defaults();\n }\n});\n\n// src/core/errors/types.ts\nvar VeryfrontError;\nvar init_types = __esm({\n "src/core/errors/types.ts"() {\n "use strict";\n VeryfrontError = class extends Error {\n constructor(message, code, context) {\n super(message);\n this.name = "VeryfrontError";\n this.code = code;\n this.context = context;\n }\n };\n }\n});\n\n// src/core/errors/agent-errors.ts\nvar init_agent_errors = __esm({\n "src/core/errors/agent-errors.ts"() {\n "use strict";\n init_types();\n }\n});\n\n// src/core/errors/build-errors.ts\nvar init_build_errors = __esm({\n "src/core/errors/build-errors.ts"() {\n "use strict";\n init_types();\n }\n});\n\n// src/core/errors/runtime-errors.ts\nvar init_runtime_errors = __esm({\n "src/core/errors/runtime-errors.ts"() {\n "use strict";\n init_types();\n }\n});\n\n// src/core/errors/system-errors.ts\nvar NetworkError;\nvar init_system_errors = __esm({\n "src/core/errors/system-errors.ts"() {\n "use strict";\n init_types();\n NetworkError = class extends VeryfrontError {\n constructor(message, context) {\n super(message, "NETWORK_ERROR" /* NETWORK_ERROR */, context);\n this.name = "NetworkError";\n }\n };\n }\n});\n\n// src/core/errors/error-handlers.ts\nvar init_error_handlers = __esm({\n "src/core/errors/error-handlers.ts"() {\n "use strict";\n init_logger();\n init_types();\n }\n});\n\n// src/core/errors/error-codes.ts\nfunction getErrorDocsUrl(code) {\n return `https://veryfront.com/docs/errors/${code}`;\n}\nvar ErrorCode2;\nvar init_error_codes = __esm({\n "src/core/errors/error-codes.ts"() {\n "use strict";\n ErrorCode2 = {\n CONFIG_NOT_FOUND: "VF001",\n CONFIG_INVALID: "VF002",\n CONFIG_PARSE_ERROR: "VF003",\n CONFIG_VALIDATION_ERROR: "VF004",\n CONFIG_TYPE_ERROR: "VF005",\n IMPORT_MAP_INVALID: "VF006",\n CORS_CONFIG_INVALID: "VF007",\n BUILD_FAILED: "VF100",\n BUNDLE_ERROR: "VF101",\n TYPESCRIPT_ERROR: "VF102",\n MDX_COMPILE_ERROR: "VF103",\n ASSET_OPTIMIZATION_ERROR: "VF104",\n SSG_GENERATION_ERROR: "VF105",\n SOURCEMAP_ERROR: "VF106",\n HYDRATION_MISMATCH: "VF200",\n RENDER_ERROR: "VF201",\n COMPONENT_ERROR: "VF202",\n LAYOUT_NOT_FOUND: "VF203",\n PAGE_NOT_FOUND: "VF204",\n API_ERROR: "VF205",\n MIDDLEWARE_ERROR: "VF206",\n ROUTE_CONFLICT: "VF300",\n INVALID_ROUTE_FILE: "VF301",\n ROUTE_HANDLER_INVALID: "VF302",\n DYNAMIC_ROUTE_ERROR: "VF303",\n ROUTE_PARAMS_ERROR: "VF304",\n API_ROUTE_ERROR: "VF305",\n MODULE_NOT_FOUND: "VF400",\n IMPORT_RESOLUTION_ERROR: "VF401",\n CIRCULAR_DEPENDENCY: "VF402",\n INVALID_IMPORT: "VF403",\n DEPENDENCY_MISSING: "VF404",\n VERSION_MISMATCH: "VF405",\n PORT_IN_USE: "VF500",\n SERVER_START_ERROR: "VF501",\n HMR_ERROR: "VF502",\n CACHE_ERROR: "VF503",\n FILE_WATCH_ERROR: "VF504",\n REQUEST_ERROR: "VF505",\n CLIENT_BOUNDARY_VIOLATION: "VF600",\n SERVER_ONLY_IN_CLIENT: "VF601",\n CLIENT_ONLY_IN_SERVER: "VF602",\n INVALID_USE_CLIENT: "VF603",\n INVALID_USE_SERVER: "VF604",\n RSC_PAYLOAD_ERROR: "VF605",\n DEV_SERVER_ERROR: "VF700",\n FAST_REFRESH_ERROR: "VF701",\n ERROR_OVERLAY_ERROR: "VF702",\n SOURCE_MAP_ERROR: "VF703",\n DEPLOYMENT_ERROR: "VF800",\n PLATFORM_ERROR: "VF801",\n ENV_VAR_MISSING: "VF802",\n PRODUCTION_BUILD_REQUIRED: "VF803",\n UNKNOWN_ERROR: "VF900",\n PERMISSION_DENIED: "VF901",\n FILE_NOT_FOUND: "VF902",\n INVALID_ARGUMENT: "VF903",\n TIMEOUT_ERROR: "VF904"\n };\n }\n});\n\n// src/core/errors/catalog/factory.ts\nfunction createErrorSolution(code, config) {\n return {\n code,\n ...config,\n docs: config.docs ?? getErrorDocsUrl(code)\n };\n}\nfunction createSimpleError(code, title, message, steps) {\n return createErrorSolution(code, { title, message, steps });\n}\nvar init_factory = __esm({\n "src/core/errors/catalog/factory.ts"() {\n "use strict";\n init_error_codes();\n }\n});\n\n// src/core/errors/catalog/config-errors.ts\nvar CONFIG_ERROR_CATALOG;\nvar init_config_errors = __esm({\n "src/core/errors/catalog/config-errors.ts"() {\n "use strict";\n init_error_codes();\n init_factory();\n CONFIG_ERROR_CATALOG = {\n [ErrorCode2.CONFIG_NOT_FOUND]: createErrorSolution(ErrorCode2.CONFIG_NOT_FOUND, {\n title: "Configuration file not found",\n message: "Veryfront could not find veryfront.config.js in your project root.",\n steps: [\n "Create veryfront.config.js in your project root directory",\n "Run \'veryfront init\' to generate a default configuration",\n "Or copy from an example project"\n ],\n example: `// veryfront.config.js\nexport default {\n title: "My App",\n dev: { port: 3002 }\n}`,\n tips: ["You can use .ts or .mjs extensions too", "Config is optional for simple projects"]\n }),\n [ErrorCode2.CONFIG_INVALID]: createErrorSolution(ErrorCode2.CONFIG_INVALID, {\n title: "Invalid configuration",\n message: "Your configuration file has invalid values or structure.",\n steps: [\n "Check that the config exports a default object",\n "Ensure all values are valid JavaScript types",\n "Remove any trailing commas",\n "Verify property names match the schema"\n ],\n example: `// \\u2713 Valid config\nexport default {\n title: "My App",\n dev: {\n port: 3002,\n open: true\n }\n}`\n }),\n [ErrorCode2.CONFIG_PARSE_ERROR]: createSimpleError(\n ErrorCode2.CONFIG_PARSE_ERROR,\n "Configuration parse error",\n "Failed to parse your configuration file.",\n [\n "Check for syntax errors (missing brackets, quotes, etc.)",\n "Ensure the file has valid JavaScript/TypeScript syntax",\n "Look for the specific parse error in the output above"\n ]\n ),\n [ErrorCode2.CONFIG_VALIDATION_ERROR]: createSimpleError(\n ErrorCode2.CONFIG_VALIDATION_ERROR,\n "Configuration validation failed",\n "Configuration values do not pass validation.",\n [\n "Check that port numbers are between 1-65535",\n "Ensure boolean flags are true/false (not strings)",\n "Verify URLs are properly formatted",\n "Check array/object structures match expected format"\n ]\n ),\n [ErrorCode2.CONFIG_TYPE_ERROR]: createSimpleError(\n ErrorCode2.CONFIG_TYPE_ERROR,\n "Configuration type error",\n "A configuration value has the wrong type.",\n [\n "Check that numbers are not in quotes",\n \'Ensure booleans are true/false, not "true"/"false"\',\n "Verify arrays use [] brackets",\n "Check objects use {} braces"\n ]\n ),\n [ErrorCode2.IMPORT_MAP_INVALID]: createErrorSolution(ErrorCode2.IMPORT_MAP_INVALID, {\n title: "Invalid import map",\n message: "The import map in your configuration is invalid.",\n steps: [\n "Check import map structure: { imports: {}, scopes: {} }",\n "Ensure URLs are valid and accessible",\n "Verify package names are correct"\n ],\n example: `resolve: {\n importMap: {\n imports: {\n "react": "https://esm.sh/react@19",\n "@/utils": "./src/utils/index.ts"\n }\n }\n}`\n }),\n [ErrorCode2.CORS_CONFIG_INVALID]: createErrorSolution(ErrorCode2.CORS_CONFIG_INVALID, {\n title: "Invalid CORS configuration",\n message: "The CORS configuration is invalid.",\n steps: [\n "Use true for default CORS settings",\n "Or provide an object with origin, methods, headers",\n "Ensure origin is a string, not an array"\n ],\n example: `security: {\n cors: true // or { origin: "https://example.com" }\n}`\n })\n };\n }\n});\n\n// src/core/errors/catalog/build-errors.ts\nvar BUILD_ERROR_CATALOG;\nvar init_build_errors2 = __esm({\n "src/core/errors/catalog/build-errors.ts"() {\n "use strict";\n init_error_codes();\n init_factory();\n BUILD_ERROR_CATALOG = {\n [ErrorCode2.BUILD_FAILED]: createErrorSolution(ErrorCode2.BUILD_FAILED, {\n title: "Build failed",\n message: "The build process encountered errors.",\n steps: [\n "Check the error messages above for specific issues",\n "Fix any TypeScript or syntax errors",\n "Ensure all imports can be resolved",\n "Run \'veryfront doctor\' to check your environment"\n ],\n tips: ["Try running with --verbose for more details", "Check build logs for warnings"]\n }),\n [ErrorCode2.BUNDLE_ERROR]: createSimpleError(\n ErrorCode2.BUNDLE_ERROR,\n "Bundle generation failed",\n "Failed to generate JavaScript bundles.",\n [\n "Check for circular dependencies",\n "Ensure all imports are valid",\n "Try clearing cache: veryfront clean"\n ]\n ),\n [ErrorCode2.TYPESCRIPT_ERROR]: createSimpleError(\n ErrorCode2.TYPESCRIPT_ERROR,\n "TypeScript compilation error",\n "TypeScript found errors in your code.",\n [\n "Fix the TypeScript errors shown above",\n "Check your tsconfig.json configuration",\n "Ensure all types are properly imported"\n ]\n ),\n [ErrorCode2.MDX_COMPILE_ERROR]: createErrorSolution(ErrorCode2.MDX_COMPILE_ERROR, {\n title: "MDX compilation failed",\n message: "Failed to compile MDX file.",\n steps: [\n "Check for syntax errors in your MDX file",\n "Ensure frontmatter YAML is valid",\n "Verify JSX components are properly imported",\n "Check for unclosed tags or brackets"\n ],\n example: `---\ntitle: My Post\n---\n\nimport Button from \'./components/Button.jsx\'\n\n# Hello World\n\n<Button>Click me</Button>`\n }),\n [ErrorCode2.ASSET_OPTIMIZATION_ERROR]: createSimpleError(\n ErrorCode2.ASSET_OPTIMIZATION_ERROR,\n "Asset optimization failed",\n "Failed to optimize assets (images, CSS, etc.).",\n [\n "Check that asset files are valid",\n "Ensure file paths are correct",\n "Try disabling optimization temporarily"\n ]\n ),\n [ErrorCode2.SSG_GENERATION_ERROR]: createSimpleError(\n ErrorCode2.SSG_GENERATION_ERROR,\n "Static site generation failed",\n "Failed to generate static pages.",\n [\n "Check that all routes are valid",\n "Ensure getStaticData functions return correctly",\n "Verify no dynamic content requires runtime"\n ]\n ),\n [ErrorCode2.SOURCEMAP_ERROR]: createSimpleError(\n ErrorCode2.SOURCEMAP_ERROR,\n "Source map generation failed",\n "Failed to generate source maps.",\n [\n "Try disabling source maps temporarily",\n "Check for very large files that might cause issues"\n ]\n )\n };\n }\n});\n\n// src/core/errors/catalog/runtime-errors.ts\nvar RUNTIME_ERROR_CATALOG;\nvar init_runtime_errors2 = __esm({\n "src/core/errors/catalog/runtime-errors.ts"() {\n "use strict";\n init_error_codes();\n init_factory();\n RUNTIME_ERROR_CATALOG = {\n [ErrorCode2.HYDRATION_MISMATCH]: createErrorSolution(ErrorCode2.HYDRATION_MISMATCH, {\n title: "Hydration mismatch",\n message: "Client-side HTML does not match server-rendered HTML.",\n steps: [\n "Check for random values or timestamps in render",\n "Ensure Date() calls are consistent",\n "Avoid using browser-only APIs during SSR",\n "Check for white space or formatting differences"\n ],\n example: `// \\u274C Wrong - random on each render\n<div>{Math.random()}</div>\n\nconst [random, setRandom] = useState(0)\nuseEffect(() => setRandom(Math.random()), [])\n<div>{random}</div>`,\n relatedErrors: [ErrorCode2.RENDER_ERROR]\n }),\n [ErrorCode2.RENDER_ERROR]: createSimpleError(\n ErrorCode2.RENDER_ERROR,\n "Render error",\n "Failed to render component.",\n [\n "Check the component for errors",\n "Ensure all props are valid",\n "Look for null/undefined access",\n "Check error boundaries"\n ]\n ),\n [ErrorCode2.COMPONENT_ERROR]: createSimpleError(\n ErrorCode2.COMPONENT_ERROR,\n "Component error",\n "Error in component lifecycle or render.",\n [\n "Check component code for errors",\n "Ensure hooks follow Rules of Hooks",\n "Verify props are passed correctly"\n ]\n ),\n [ErrorCode2.LAYOUT_NOT_FOUND]: createErrorSolution(ErrorCode2.LAYOUT_NOT_FOUND, {\n title: "Layout file not found",\n message: "Required layout file is missing.",\n steps: [\n "Create app/layout.tsx in App Router",\n "Or create layouts/default.mdx for Pages Router",\n "Check file path and name are correct"\n ],\n example: `// app/layout.tsx\nexport default function RootLayout({ children }) {\n return (\n <html lang="en">\n <body>{children}</body>\n </html>\n )\n}`\n }),\n [ErrorCode2.PAGE_NOT_FOUND]: createSimpleError(\n ErrorCode2.PAGE_NOT_FOUND,\n "Page not found",\n "The requested page does not exist.",\n [\n "Check that the page file exists",\n "Verify file name matches route",\n "Ensure file extension is correct (.tsx, .jsx, .mdx)"\n ]\n ),\n [ErrorCode2.API_ERROR]: createSimpleError(\n ErrorCode2.API_ERROR,\n "API handler error",\n "Error in API route handler.",\n [\n "Check API handler code for errors",\n "Ensure proper error handling",\n "Verify request/response format"\n ]\n ),\n [ErrorCode2.MIDDLEWARE_ERROR]: createSimpleError(\n ErrorCode2.MIDDLEWARE_ERROR,\n "Middleware error",\n "Error in middleware execution.",\n [\n "Check middleware code for errors",\n "Ensure middleware returns Response",\n "Verify middleware is properly exported"\n ]\n )\n };\n }\n});\n\n// src/core/errors/catalog/route-errors.ts\nvar ROUTE_ERROR_CATALOG;\nvar init_route_errors = __esm({\n "src/core/errors/catalog/route-errors.ts"() {\n "use strict";\n init_error_codes();\n init_factory();\n ROUTE_ERROR_CATALOG = {\n [ErrorCode2.ROUTE_CONFLICT]: createSimpleError(\n ErrorCode2.ROUTE_CONFLICT,\n "Route conflict",\n "Multiple files are trying to handle the same route.",\n [\n "Check for duplicate route files",\n "Remove conflicting routes",\n "Use dynamic routes [id] carefully"\n ]\n ),\n [ErrorCode2.INVALID_ROUTE_FILE]: createErrorSolution(ErrorCode2.INVALID_ROUTE_FILE, {\n title: "Invalid route file",\n message: "Route file has invalid structure or exports.",\n steps: [\n "API routes must export GET, POST, etc. functions",\n "Page routes must export default component",\n "Check for syntax errors"\n ],\n example: `// app/api/users/route.ts\nexport async function GET() {\n return Response.json({ users: [] })\n}`\n }),\n [ErrorCode2.ROUTE_HANDLER_INVALID]: createSimpleError(\n ErrorCode2.ROUTE_HANDLER_INVALID,\n "Invalid route handler",\n "Route handler does not return Response.",\n [\n "Ensure handler returns Response object",\n "Use Response.json() for JSON responses",\n "Check for missing return statement"\n ]\n ),\n [ErrorCode2.DYNAMIC_ROUTE_ERROR]: createSimpleError(\n ErrorCode2.DYNAMIC_ROUTE_ERROR,\n "Dynamic route error",\n "Error in dynamic route handling.",\n [\n "Check [param] syntax is correct",\n "Ensure params are accessed properly",\n "Verify dynamic segment names"\n ]\n ),\n [ErrorCode2.ROUTE_PARAMS_ERROR]: createSimpleError(\n ErrorCode2.ROUTE_PARAMS_ERROR,\n "Route parameters error",\n "Error accessing route parameters.",\n [\n "Check params object structure",\n "Ensure parameter names match route",\n "Verify params are strings"\n ]\n ),\n [ErrorCode2.API_ROUTE_ERROR]: createSimpleError(\n ErrorCode2.API_ROUTE_ERROR,\n "API route error",\n "Error in API route execution.",\n [\n "Check API handler code",\n "Ensure proper error handling",\n "Verify request parsing"\n ]\n )\n };\n }\n});\n\n// src/core/errors/catalog/module-errors.ts\nvar MODULE_ERROR_CATALOG;\nvar init_module_errors = __esm({\n "src/core/errors/catalog/module-errors.ts"() {\n "use strict";\n init_error_codes();\n init_factory();\n MODULE_ERROR_CATALOG = {\n [ErrorCode2.MODULE_NOT_FOUND]: createErrorSolution(ErrorCode2.MODULE_NOT_FOUND, {\n title: "Module not found",\n message: "Cannot find the imported module.",\n steps: [\n "Check that the file path is correct",\n "Ensure the module is installed or exists",\n "Add missing module to import map",\n "Check for typos in import statement"\n ],\n example: `// Add to veryfront.config.js\nresolve: {\n importMap: {\n imports: {\n "missing-lib": "https://esm.sh/missing-lib@1.0.0"\n }\n }\n}`\n }),\n [ErrorCode2.IMPORT_RESOLUTION_ERROR]: createSimpleError(\n ErrorCode2.IMPORT_RESOLUTION_ERROR,\n "Import resolution failed",\n "Failed to resolve import specifier.",\n [\n "Check import paths are correct",\n "Ensure modules are in import map",\n "Verify network connectivity for remote imports"\n ]\n ),\n [ErrorCode2.CIRCULAR_DEPENDENCY]: createSimpleError(\n ErrorCode2.CIRCULAR_DEPENDENCY,\n "Circular dependency detected",\n "Files are importing each other in a circle.",\n [\n "Identify the circular import chain",\n "Extract shared code to separate file",\n "Use dependency injection or lazy imports"\n ]\n ),\n [ErrorCode2.INVALID_IMPORT]: createSimpleError(\n ErrorCode2.INVALID_IMPORT,\n "Invalid import statement",\n "Import statement has invalid syntax.",\n [\n \'Check import syntax: import X from "y"\',\n "Ensure quotes are properly closed",\n "Verify export exists in target module"\n ]\n ),\n [ErrorCode2.DEPENDENCY_MISSING]: createErrorSolution(ErrorCode2.DEPENDENCY_MISSING, {\n title: "Required dependency not found",\n message: "A required dependency is missing.",\n steps: [\n "Add React to your import map",\n "Ensure all peer dependencies are included",\n "Run \'veryfront doctor\' to verify setup"\n ],\n example: `// Minimum required imports\nresolve: {\n importMap: {\n imports: {\n "react": "https://esm.sh/react@19",\n "react-dom": "https://esm.sh/react-dom@19"\n }\n }\n}`\n }),\n [ErrorCode2.VERSION_MISMATCH]: createSimpleError(\n ErrorCode2.VERSION_MISMATCH,\n "Dependency version mismatch",\n "Incompatible versions of dependencies detected.",\n [\n "Ensure React and React-DOM versions match",\n "Check for multiple React instances",\n "Update dependencies to compatible versions"\n ]\n )\n };\n }\n});\n\n// src/core/errors/catalog/server-errors.ts\nvar SERVER_ERROR_CATALOG;\nvar init_server_errors = __esm({\n "src/core/errors/catalog/server-errors.ts"() {\n "use strict";\n init_error_codes();\n init_factory();\n SERVER_ERROR_CATALOG = {\n [ErrorCode2.PORT_IN_USE]: createErrorSolution(ErrorCode2.PORT_IN_USE, {\n title: "Port already in use",\n message: "Another process is using the specified port.",\n steps: [\n "Stop the other process: lsof -i :PORT",\n "Use a different port: veryfront dev --port 3003",\n "Add port to config file"\n ],\n example: `// veryfront.config.js\ndev: {\n port: 3003\n}`\n }),\n [ErrorCode2.SERVER_START_ERROR]: createSimpleError(\n ErrorCode2.SERVER_START_ERROR,\n "Server failed to start",\n "Development server could not start.",\n [\n "Check for port conflicts",\n "Ensure file permissions are correct",\n "Verify configuration is valid"\n ]\n ),\n [ErrorCode2.HMR_ERROR]: createSimpleError(\n ErrorCode2.HMR_ERROR,\n "Hot Module Replacement error",\n "HMR failed to update module.",\n [\n "Try refreshing the page",\n "Check for syntax errors",\n "Restart dev server if persistent"\n ]\n ),\n [ErrorCode2.CACHE_ERROR]: createSimpleError(\n ErrorCode2.CACHE_ERROR,\n "Cache operation failed",\n "Error reading or writing cache.",\n [\n "Clear cache: veryfront clean --cache",\n "Check disk space",\n "Verify file permissions"\n ]\n ),\n [ErrorCode2.FILE_WATCH_ERROR]: createSimpleError(\n ErrorCode2.FILE_WATCH_ERROR,\n "File watching failed",\n "Could not watch files for changes.",\n [\n "Check system file watch limits",\n "Reduce number of watched files",\n "Try restarting dev server"\n ]\n ),\n [ErrorCode2.REQUEST_ERROR]: createSimpleError(\n ErrorCode2.REQUEST_ERROR,\n "Request handling error",\n "Error processing HTTP request.",\n [\n "Check request format and headers",\n "Verify route handler code",\n "Check for middleware errors"\n ]\n )\n };\n }\n});\n\n// src/core/errors/catalog/rsc-errors.ts\nvar RSC_ERROR_CATALOG;\nvar init_rsc_errors = __esm({\n "src/core/errors/catalog/rsc-errors.ts"() {\n "use strict";\n init_error_codes();\n init_factory();\n RSC_ERROR_CATALOG = {\n [ErrorCode2.CLIENT_BOUNDARY_VIOLATION]: createErrorSolution(\n ErrorCode2.CLIENT_BOUNDARY_VIOLATION,\n {\n title: "Client/Server boundary violation",\n message: "Server-only code used in Client Component.",\n steps: [\n "Move server-only imports to Server Components",\n "Use \'use server\' for server actions",\n "Split component into server and client parts"\n ],\n example: `// \\u2713 Correct pattern\nimport { db } from \'./database\'\nexport default async function ServerComponent() {\n const data = await db.query(\'...\')\n return <ClientComponent data={data} />\n}\n\n\'use client\'\nexport default function ClientComponent({ data }) {\n return <div>{data}</div>\n}`\n }\n ),\n [ErrorCode2.SERVER_ONLY_IN_CLIENT]: createSimpleError(\n ErrorCode2.SERVER_ONLY_IN_CLIENT,\n "Server-only module in Client Component",\n "Cannot use server-only module in client code.",\n [\n "Move server logic to Server Component",\n "Use API routes for client data fetching",\n "Pass data as props from server"\n ]\n ),\n [ErrorCode2.CLIENT_ONLY_IN_SERVER]: createSimpleError(\n ErrorCode2.CLIENT_ONLY_IN_SERVER,\n "Client-only code in Server Component",\n "Cannot use browser APIs in Server Component.",\n [\n "Add \'use client\' directive",\n "Move client-only code to Client Component",\n "Use useEffect for client-side logic"\n ]\n ),\n [ErrorCode2.INVALID_USE_CLIENT]: createErrorSolution(ErrorCode2.INVALID_USE_CLIENT, {\n title: "Invalid \'use client\' directive",\n message: "\'use client\' directive is not properly placed.",\n steps: [\n "Place \'use client\' at the very top of file",\n "Must be before any imports",\n \'Use exact string: "use client"\'\n ],\n example: `\'use client\' // Must be first line\n\nimport React from \'react\'`\n }),\n [ErrorCode2.INVALID_USE_SERVER]: createSimpleError(\n ErrorCode2.INVALID_USE_SERVER,\n "Invalid \'use server\' directive",\n "\'use server\' directive is not properly placed.",\n [\n "Place \'use server\' at top of function",\n "Or at top of file for all functions",\n \'Use exact string: "use server"\'\n ]\n ),\n [ErrorCode2.RSC_PAYLOAD_ERROR]: createSimpleError(\n ErrorCode2.RSC_PAYLOAD_ERROR,\n "RSC payload error",\n "Error serializing Server Component payload.",\n [\n "Ensure props are JSON-serializable",\n "Avoid passing functions as props",\n "Check for circular references"\n ]\n )\n };\n }\n});\n\n// src/core/errors/catalog/dev-errors.ts\nvar DEV_ERROR_CATALOG;\nvar init_dev_errors = __esm({\n "src/core/errors/catalog/dev-errors.ts"() {\n "use strict";\n init_error_codes();\n init_factory();\n DEV_ERROR_CATALOG = {\n [ErrorCode2.DEV_SERVER_ERROR]: createSimpleError(\n ErrorCode2.DEV_SERVER_ERROR,\n "Development server error",\n "Error in development server.",\n [\n "Check server logs for details",\n "Try restarting dev server",\n "Clear cache and restart"\n ]\n ),\n [ErrorCode2.FAST_REFRESH_ERROR]: createSimpleError(\n ErrorCode2.FAST_REFRESH_ERROR,\n "Fast Refresh error",\n "React Fast Refresh failed.",\n [\n "Check for syntax errors",\n "Ensure components follow Fast Refresh rules",\n "Try full page refresh"\n ]\n ),\n [ErrorCode2.ERROR_OVERLAY_ERROR]: createSimpleError(\n ErrorCode2.ERROR_OVERLAY_ERROR,\n "Error overlay failed",\n "Could not display error overlay.",\n [\n "Check browser console for details",\n "Try disabling browser extensions",\n "Refresh the page"\n ]\n ),\n [ErrorCode2.SOURCE_MAP_ERROR]: createSimpleError(\n ErrorCode2.SOURCE_MAP_ERROR,\n "Source map error",\n "Error loading or parsing source map.",\n [\n "Check that source maps are enabled",\n "Try rebuilding the project",\n "Check for corrupted build files"\n ]\n )\n };\n }\n});\n\n// src/core/errors/catalog/deployment-errors.ts\nvar DEPLOYMENT_ERROR_CATALOG;\nvar init_deployment_errors = __esm({\n "src/core/errors/catalog/deployment-errors.ts"() {\n "use strict";\n init_error_codes();\n init_factory();\n DEPLOYMENT_ERROR_CATALOG = {\n [ErrorCode2.DEPLOYMENT_ERROR]: createSimpleError(\n ErrorCode2.DEPLOYMENT_ERROR,\n "Deployment failed",\n "Failed to deploy application.",\n [\n "Check deployment logs for details",\n "Verify platform credentials",\n "Ensure build succeeded first"\n ]\n ),\n [ErrorCode2.PLATFORM_ERROR]: createSimpleError(\n ErrorCode2.PLATFORM_ERROR,\n "Platform error",\n "Deployment platform returned an error.",\n [\n "Check platform status page",\n "Verify API keys and credentials",\n "Try deploying again"\n ]\n ),\n [ErrorCode2.ENV_VAR_MISSING]: createSimpleError(\n ErrorCode2.ENV_VAR_MISSING,\n "Environment variable missing",\n "Required environment variable is not set.",\n [\n "Add variable to .env file",\n "Set variable in deployment platform",\n "Check variable name is correct"\n ]\n ),\n [ErrorCode2.PRODUCTION_BUILD_REQUIRED]: createSimpleError(\n ErrorCode2.PRODUCTION_BUILD_REQUIRED,\n "Production build required",\n "Must build project before deploying.",\n [\n "Run \'veryfront build\' first",\n "Check that dist/ directory exists",\n "Verify build completed successfully"\n ]\n )\n };\n }\n});\n\n// src/core/errors/catalog/general-errors.ts\nvar GENERAL_ERROR_CATALOG;\nvar init_general_errors = __esm({\n "src/core/errors/catalog/general-errors.ts"() {\n "use strict";\n init_error_codes();\n init_factory();\n GENERAL_ERROR_CATALOG = {\n [ErrorCode2.UNKNOWN_ERROR]: createSimpleError(\n ErrorCode2.UNKNOWN_ERROR,\n "Unknown error",\n "An unexpected error occurred.",\n [\n "Check error details above",\n "Run \'veryfront doctor\' to diagnose",\n "Try restarting the operation",\n "Check GitHub issues for similar problems"\n ]\n ),\n [ErrorCode2.PERMISSION_DENIED]: createSimpleError(\n ErrorCode2.PERMISSION_DENIED,\n "Permission denied",\n "Insufficient permissions to perform operation.",\n [\n "Check file/directory permissions",\n "Run with appropriate permissions",\n "Verify user has write access"\n ]\n ),\n [ErrorCode2.FILE_NOT_FOUND]: createSimpleError(\n ErrorCode2.FILE_NOT_FOUND,\n "File not found",\n "Required file does not exist.",\n [\n "Check that file path is correct",\n "Verify file exists in project",\n "Check for typos in file name"\n ]\n ),\n [ErrorCode2.INVALID_ARGUMENT]: createSimpleError(\n ErrorCode2.INVALID_ARGUMENT,\n "Invalid argument",\n "Command received invalid argument.",\n [\n "Check command syntax",\n "Verify argument values",\n "Run \'veryfront help <command>\' for usage"\n ]\n ),\n [ErrorCode2.TIMEOUT_ERROR]: createSimpleError(\n ErrorCode2.TIMEOUT_ERROR,\n "Operation timed out",\n "Operation took too long to complete.",\n [\n "Check network connectivity",\n "Try increasing timeout if available",\n "Check for very large files"\n ]\n )\n };\n }\n});\n\n// src/core/errors/catalog/index.ts\nvar ERROR_CATALOG;\nvar init_catalog = __esm({\n "src/core/errors/catalog/index.ts"() {\n "use strict";\n init_config_errors();\n init_build_errors2();\n init_runtime_errors2();\n init_route_errors();\n init_module_errors();\n init_server_errors();\n init_rsc_errors();\n init_dev_errors();\n init_deployment_errors();\n init_general_errors();\n init_factory();\n ERROR_CATALOG = {\n ...CONFIG_ERROR_CATALOG,\n ...BUILD_ERROR_CATALOG,\n ...RUNTIME_ERROR_CATALOG,\n ...ROUTE_ERROR_CATALOG,\n ...MODULE_ERROR_CATALOG,\n ...SERVER_ERROR_CATALOG,\n ...RSC_ERROR_CATALOG,\n ...DEV_ERROR_CATALOG,\n ...DEPLOYMENT_ERROR_CATALOG,\n ...GENERAL_ERROR_CATALOG\n };\n }\n});\n\n// src/core/errors/user-friendly/error-catalog.ts\nvar init_error_catalog = __esm({\n "src/core/errors/user-friendly/error-catalog.ts"() {\n "use strict";\n }\n});\n\n// src/platform/compat/console/ansi.ts\nvar ansi, red, green, yellow, blue, magenta, cyan, white, gray, bold, dim, italic, underline, strikethrough, reset;\nvar init_ansi = __esm({\n "src/platform/compat/console/ansi.ts"() {\n ansi = (open, close) => (text2) => `\\x1B[${open}m${text2}\\x1B[${close}m`;\n red = ansi(31, 39);\n green = ansi(32, 39);\n yellow = ansi(33, 39);\n blue = ansi(34, 39);\n magenta = ansi(35, 39);\n cyan = ansi(36, 39);\n white = ansi(37, 39);\n gray = ansi(90, 39);\n bold = ansi(1, 22);\n dim = ansi(2, 22);\n italic = ansi(3, 23);\n underline = ansi(4, 24);\n strikethrough = ansi(9, 29);\n reset = (text2) => `\\x1B[0m${text2}`;\n }\n});\n\n// src/platform/compat/console/deno.ts\nvar deno_exports = {};\n__export(deno_exports, {\n blue: () => blue,\n bold: () => bold,\n colors: () => colors,\n cyan: () => cyan,\n dim: () => dim,\n gray: () => gray,\n green: () => green,\n italic: () => italic,\n magenta: () => magenta,\n red: () => red,\n reset: () => reset,\n strikethrough: () => strikethrough,\n underline: () => underline,\n white: () => white,\n yellow: () => yellow\n});\nvar colors;\nvar init_deno2 = __esm({\n "src/platform/compat/console/deno.ts"() {\n "use strict";\n init_ansi();\n colors = {\n red,\n green,\n yellow,\n blue,\n cyan,\n magenta,\n white,\n gray,\n bold,\n dim,\n italic,\n underline,\n strikethrough,\n reset\n };\n }\n});\n\n// src/platform/compat/console/node.ts\nvar node_exports = {};\n__export(node_exports, {\n blue: () => blue2,\n bold: () => bold2,\n colors: () => colors2,\n cyan: () => cyan2,\n dim: () => dim2,\n gray: () => gray2,\n green: () => green2,\n initColors: () => initColors,\n italic: () => italic2,\n magenta: () => magenta2,\n red: () => red2,\n reset: () => reset2,\n strikethrough: () => strikethrough2,\n underline: () => underline2,\n white: () => white2,\n yellow: () => yellow2\n});\nasync function ensurePc() {\n if (pc)\n return pc;\n const picocolorsModule = ["npm:", "picocolors"].join("");\n const mod = await import(picocolorsModule);\n pc = mod.default;\n return pc;\n}\nasync function initColors() {\n await ensurePc();\n}\nvar pc, lazyColor, colors2, red2, green2, yellow2, blue2, cyan2, magenta2, white2, gray2, bold2, dim2, italic2, underline2, strikethrough2, reset2;\nvar init_node = __esm({\n "src/platform/compat/console/node.ts"() {\n "use strict";\n pc = null;\n lazyColor = (fn) => (s) => pc?.[fn]?.(s) ?? s;\n colors2 = {\n red: lazyColor("red"),\n green: lazyColor("green"),\n yellow: lazyColor("yellow"),\n blue: lazyColor("blue"),\n cyan: lazyColor("cyan"),\n magenta: lazyColor("magenta"),\n white: lazyColor("white"),\n gray: lazyColor("gray"),\n bold: lazyColor("bold"),\n dim: lazyColor("dim"),\n italic: lazyColor("italic"),\n underline: lazyColor("underline"),\n strikethrough: lazyColor("strikethrough"),\n reset: lazyColor("reset")\n };\n red2 = lazyColor("red");\n green2 = lazyColor("green");\n yellow2 = lazyColor("yellow");\n blue2 = lazyColor("blue");\n cyan2 = lazyColor("cyan");\n magenta2 = lazyColor("magenta");\n white2 = lazyColor("white");\n gray2 = lazyColor("gray");\n bold2 = lazyColor("bold");\n dim2 = lazyColor("dim");\n italic2 = lazyColor("italic");\n underline2 = lazyColor("underline");\n strikethrough2 = lazyColor("strikethrough");\n reset2 = lazyColor("reset");\n }\n});\n\n// src/platform/compat/console/index.ts\nasync function loadColors() {\n if (_colors)\n return _colors;\n try {\n if (isDeno) {\n const mod = await Promise.resolve().then(() => (init_deno2(), deno_exports));\n _colors = mod.colors;\n } else {\n const mod = await Promise.resolve().then(() => (init_node(), node_exports));\n _colors = mod.colors;\n }\n } catch {\n _colors = fallbackColors;\n }\n return _colors;\n}\nvar noOp, fallbackColors, _colors, colorsPromise;\nvar init_console = __esm({\n "src/platform/compat/console/index.ts"() {\n init_runtime();\n noOp = (text2) => text2;\n fallbackColors = {\n red: noOp,\n green: noOp,\n yellow: noOp,\n blue: noOp,\n cyan: noOp,\n magenta: noOp,\n white: noOp,\n gray: noOp,\n bold: noOp,\n dim: noOp,\n italic: noOp,\n underline: noOp,\n strikethrough: noOp,\n reset: noOp\n };\n _colors = null;\n colorsPromise = loadColors();\n }\n});\n\n// src/core/errors/user-friendly/error-identifier.ts\nvar init_error_identifier = __esm({\n "src/core/errors/user-friendly/error-identifier.ts"() {\n "use strict";\n }\n});\n\n// src/core/errors/user-friendly/error-formatter.ts\nvar init_error_formatter = __esm({\n "src/core/errors/user-friendly/error-formatter.ts"() {\n "use strict";\n init_console();\n init_error_catalog();\n init_error_identifier();\n }\n});\n\n// src/core/errors/user-friendly/error-wrapper.ts\nvar init_error_wrapper = __esm({\n "src/core/errors/user-friendly/error-wrapper.ts"() {\n "use strict";\n init_console();\n init_process();\n init_logger();\n init_error_formatter();\n }\n});\n\n// src/core/errors/user-friendly/index.ts\nvar init_user_friendly = __esm({\n "src/core/errors/user-friendly/index.ts"() {\n "use strict";\n init_error_catalog();\n init_error_formatter();\n init_error_identifier();\n init_error_wrapper();\n }\n});\n\n// src/core/errors/index.ts\nvar init_errors = __esm({\n "src/core/errors/index.ts"() {\n init_types();\n init_agent_errors();\n init_build_errors();\n init_runtime_errors();\n init_system_errors();\n init_error_handlers();\n init_catalog();\n init_user_friendly();\n }\n});\n\n// src/platform/adapters/deno.ts\nvar DenoFileSystemAdapter, DenoEnvironmentAdapter, DenoServerAdapter, DenoShellAdapter, DenoServer, DenoAdapter, denoAdapter;\nvar init_deno3 = __esm({\n "src/platform/adapters/deno.ts"() {\n "use strict";\n init_veryfront_error();\n init_config();\n init_utils();\n DenoFileSystemAdapter = class {\n async readFile(path) {\n return await Deno.readTextFile(path);\n }\n async readFileBytes(path) {\n return await Deno.readFile(path);\n }\n async writeFile(path, content) {\n await Deno.writeTextFile(path, content);\n }\n async exists(path) {\n try {\n await Deno.stat(path);\n return true;\n } catch (_error) {\n return false;\n }\n }\n async *readDir(path) {\n for await (const entry of Deno.readDir(path)) {\n yield {\n name: entry.name,\n isFile: entry.isFile,\n isDirectory: entry.isDirectory,\n isSymlink: entry.isSymlink\n };\n }\n }\n async stat(path) {\n const stat = await Deno.stat(path);\n return {\n size: stat.size,\n isFile: stat.isFile,\n isDirectory: stat.isDirectory,\n isSymlink: stat.isSymlink,\n mtime: stat.mtime\n };\n }\n async mkdir(path, options) {\n await Deno.mkdir(path, options);\n }\n async remove(path, options) {\n await Deno.remove(path, options);\n }\n async makeTempDir(prefix) {\n return await Deno.makeTempDir({ prefix });\n }\n watch(paths, options) {\n const pathArray = Array.isArray(paths) ? paths : [paths];\n const recursive = options?.recursive ?? true;\n const signal = options?.signal;\n const watcher = Deno.watchFs(pathArray, { recursive });\n let closed = false;\n const denoIterator = watcher[Symbol.asyncIterator]();\n const mapEventKind = (kind) => {\n switch (kind) {\n case "create":\n return "create";\n case "modify":\n return "modify";\n case "remove":\n return "delete";\n default:\n return "any";\n }\n };\n const iterator = {\n async next() {\n if (closed || signal?.aborted) {\n return { done: true, value: void 0 };\n }\n try {\n const result = await denoIterator.next();\n if (result.done) {\n return { done: true, value: void 0 };\n }\n return {\n done: false,\n value: {\n kind: mapEventKind(result.value.kind),\n paths: result.value.paths\n }\n };\n } catch (error2) {\n if (closed || signal?.aborted) {\n return { done: true, value: void 0 };\n }\n throw error2;\n }\n },\n async return() {\n closed = true;\n if (denoIterator.return) {\n await denoIterator.return();\n }\n return { done: true, value: void 0 };\n }\n };\n const cleanup = () => {\n if (closed)\n return;\n closed = true;\n try {\n if ("close" in watcher && typeof watcher.close === "function") {\n watcher.close();\n }\n } catch (error2) {\n serverLogger.debug("[Deno] Filesystem watcher cleanup failed", { error: error2 });\n }\n };\n if (signal) {\n signal.addEventListener("abort", cleanup);\n }\n return {\n [Symbol.asyncIterator]() {\n return iterator;\n },\n close: cleanup\n };\n }\n };\n DenoEnvironmentAdapter = class {\n get(key) {\n return Deno.env.get(key);\n }\n set(key, value) {\n Deno.env.set(key, value);\n }\n toObject() {\n return Deno.env.toObject();\n }\n };\n DenoServerAdapter = class {\n upgradeWebSocket(request) {\n const { socket, response } = Deno.upgradeWebSocket(request);\n return { socket, response };\n }\n };\n DenoShellAdapter = class {\n statSync(path) {\n try {\n const stat = Deno.statSync(path);\n return {\n isFile: stat.isFile,\n isDirectory: stat.isDirectory\n };\n } catch (error2) {\n throw toError(createError({\n type: "file",\n message: `Failed to stat file: ${error2}`\n }));\n }\n }\n readFileSync(path) {\n try {\n return Deno.readTextFileSync(path);\n } catch (error2) {\n throw toError(createError({\n type: "file",\n message: `Failed to read file: ${error2}`\n }));\n }\n }\n };\n DenoServer = class {\n constructor(server, hostname, port, abortController) {\n this.server = server;\n this.hostname = hostname;\n this.port = port;\n this.abortController = abortController;\n }\n async stop() {\n try {\n if (this.abortController) {\n this.abortController.abort();\n }\n await this.server.shutdown();\n } catch (error2) {\n serverLogger.debug("[Deno] Server shutdown failed", { error: error2 });\n }\n }\n get addr() {\n return { hostname: this.hostname, port: this.port };\n }\n };\n DenoAdapter = class {\n constructor() {\n this.id = "deno";\n this.name = "deno";\n /** @deprecated Use `id` instead */\n this.platform = "deno";\n this.fs = new DenoFileSystemAdapter();\n this.env = new DenoEnvironmentAdapter();\n this.server = new DenoServerAdapter();\n this.shell = new DenoShellAdapter();\n this.capabilities = {\n typescript: true,\n jsx: true,\n http2: true,\n websocket: true,\n workers: true,\n fileWatching: true,\n shell: true,\n kvStore: true,\n // Deno KV available\n writableFs: true\n };\n /** @deprecated Use `capabilities` instead */\n this.features = {\n websocket: true,\n http2: true,\n workers: true,\n jsx: true,\n typescript: true\n };\n }\n serve(handler, options = {}) {\n const { port = DEFAULT_DEV_PORT, hostname = "localhost", onListen } = options;\n const controller = new AbortController();\n const signal = options.signal || controller.signal;\n const server = Deno.serve({\n port,\n hostname,\n signal,\n handler: async (request, _info) => {\n try {\n return await handler(request);\n } catch (error2) {\n const { serverLogger: serverLogger2 } = await Promise.resolve().then(() => (init_utils(), utils_exports));\n serverLogger2.error("Request handler error:", error2);\n return new Response("Internal Server Error", { status: 500 });\n }\n },\n onListen: (params) => {\n onListen?.({ hostname: params.hostname, port: params.port });\n }\n });\n const controllerToPass = options.signal ? void 0 : controller;\n return Promise.resolve(new DenoServer(server, hostname, port, controllerToPass));\n }\n };\n denoAdapter = new DenoAdapter();\n }\n});\n\n// src/rendering/client/router.ts\ninit_utils();\nimport ReactDOM from "react-dom/client";\n\n// src/routing/matchers/pattern-route-matcher.ts\ninit_path_utils();\n\n// src/routing/matchers/index.ts\ninit_utils();\n\n// src/platform/compat/path-helper.ts\nimport nodePath2 from "node:path";\nvar pathMod = null;\nif (typeof Deno === "undefined") {\n pathMod = nodePath2;\n} else {\n Promise.resolve().then(() => (init_std_path(), std_path_exports)).then((mod) => {\n pathMod = mod;\n });\n}\nvar sep3 = nodePath2.sep;\n\n// src/routing/client/dom-utils.ts\ninit_utils();\nfunction isInternalLink(target) {\n const href = target.getAttribute("href");\n if (!href)\n return false;\n if (href.startsWith("http") || href.startsWith("mailto:"))\n return false;\n if (href.startsWith("#"))\n return false;\n if (target.getAttribute("target") === "_blank" || target.getAttribute("download")) {\n return false;\n }\n return true;\n}\nfunction findAnchorElement(element) {\n let current = element;\n while (current && current.tagName !== "A") {\n current = current.parentElement;\n }\n if (!current || !(current instanceof HTMLAnchorElement)) {\n return null;\n }\n return current;\n}\nfunction updateMetaTags(frontmatter) {\n if (frontmatter.description) {\n updateMetaTag(\'meta[name="description"]\', "name", "description", frontmatter.description);\n }\n if (frontmatter.ogTitle) {\n updateMetaTag(\'meta[property="og:title"]\', "property", "og:title", frontmatter.ogTitle);\n }\n}\nfunction updateMetaTag(selector, attributeName, attributeValue, content) {\n let metaTag = document.querySelector(selector);\n if (!metaTag) {\n metaTag = document.createElement("meta");\n metaTag.setAttribute(attributeName, attributeValue);\n document.head.appendChild(metaTag);\n }\n metaTag.setAttribute("content", content);\n}\nfunction executeScripts(container) {\n const scripts = container.querySelectorAll("script");\n scripts.forEach((oldScript) => {\n const newScript = document.createElement("script");\n Array.from(oldScript.attributes).forEach((attribute) => {\n newScript.setAttribute(attribute.name, attribute.value);\n });\n newScript.textContent = oldScript.textContent;\n oldScript.parentNode?.replaceChild(newScript, oldScript);\n });\n}\nfunction applyHeadDirectives(container) {\n const nodes = container.querySelectorAll(\'[data-veryfront-head="1"], vf-head\');\n if (nodes.length > 0) {\n cleanManagedHeadTags();\n }\n nodes.forEach((wrapper) => {\n processHeadWrapper(wrapper);\n wrapper.parentElement?.removeChild(wrapper);\n });\n}\nfunction cleanManagedHeadTags() {\n document.head.querySelectorAll(\'[data-veryfront-managed="1"]\').forEach((element) => element.parentElement?.removeChild(element));\n}\nfunction processHeadWrapper(wrapper) {\n wrapper.childNodes.forEach((node) => {\n if (!(node instanceof Element))\n return;\n const tagName = node.tagName.toLowerCase();\n if (tagName === "title") {\n document.title = node.textContent || document.title;\n return;\n }\n const clone = document.createElement(tagName);\n for (const attribute of Array.from(node.attributes)) {\n clone.setAttribute(attribute.name, attribute.value);\n }\n if (node.textContent && !clone.hasAttribute("src")) {\n clone.textContent = node.textContent;\n }\n clone.setAttribute("data-veryfront-managed", "1");\n document.head.appendChild(clone);\n });\n}\nfunction manageFocus(container) {\n try {\n const focusElement = container.querySelector("[data-router-focus]") || container.querySelector("main") || container.querySelector("h1");\n if (focusElement && focusElement instanceof HTMLElement && "focus" in focusElement) {\n focusElement.focus({ preventScroll: true });\n }\n } catch (error2) {\n rendererLogger.warn("[router] focus management failed", error2);\n }\n}\nfunction extractPageDataFromScript() {\n const pageDataScript = document.querySelector("script[data-veryfront-page]");\n if (!pageDataScript)\n return null;\n try {\n const content = pageDataScript.textContent;\n if (!content) {\n rendererLogger.warn("[dom-utils] Page data script has no content");\n return {};\n }\n return JSON.parse(content);\n } catch (error2) {\n rendererLogger.error("[dom-utils] Failed to parse page data:", error2);\n return null;\n }\n}\nfunction parsePageDataFromHTML(html3) {\n const parser = new DOMParser();\n const doc = parser.parseFromString(html3, "text/html");\n const root = doc.getElementById("root");\n let content = "";\n if (root) {\n content = root.innerHTML || "";\n } else {\n rendererLogger.warn("[dom-utils] No root element found in HTML");\n }\n const pageDataScript = doc.querySelector("script[data-veryfront-page]");\n let pageData = {};\n if (pageDataScript) {\n try {\n const content2 = pageDataScript.textContent;\n if (!content2) {\n rendererLogger.warn("[dom-utils] Page data script in HTML has no content");\n } else {\n pageData = JSON.parse(content2);\n }\n } catch (error2) {\n rendererLogger.error("[dom-utils] Failed to parse page data from HTML:", error2);\n }\n }\n return { content, pageData };\n}\n\n// src/routing/client/navigation-handlers.ts\ninit_utils();\ninit_config();\nvar NavigationHandlers = class {\n constructor(prefetchDelay = DEFAULT_PREFETCH_DELAY_MS, prefetchOptions = {}) {\n this.prefetchQueue = /* @__PURE__ */ new Set();\n this.scrollPositions = /* @__PURE__ */ new Map();\n this.isPopStateNav = false;\n this.prefetchDelay = prefetchDelay;\n this.prefetchOptions = prefetchOptions;\n }\n createClickHandler(callbacks) {\n return (event) => {\n const anchor = findAnchorElement(event.target);\n if (!anchor || !isInternalLink(anchor))\n return;\n const href = anchor.getAttribute("href");\n event.preventDefault();\n callbacks.onNavigate(href);\n };\n }\n createPopStateHandler(callbacks) {\n return (_event) => {\n const path = globalThis.location.pathname;\n this.isPopStateNav = true;\n callbacks.onNavigate(path);\n };\n }\n createMouseOverHandler(callbacks) {\n return (event) => {\n const target = event.target;\n if (target.tagName !== "A")\n return;\n const href = target.getAttribute("href");\n if (!href || href.startsWith("http") || href.startsWith("#"))\n return;\n if (!this.shouldPrefetchOnHover(target))\n return;\n if (!this.prefetchQueue.has(href)) {\n this.prefetchQueue.add(href);\n setTimeout(() => {\n callbacks.onPrefetch(href);\n this.prefetchQueue.delete(href);\n }, this.prefetchDelay);\n }\n };\n }\n shouldPrefetchOnHover(target) {\n const prefetchAttribute = target.getAttribute("data-prefetch");\n const isHoverEnabled = Boolean(this.prefetchOptions.hover);\n if (prefetchAttribute === "false")\n return false;\n return prefetchAttribute === "true" || isHoverEnabled;\n }\n saveScrollPosition(path) {\n try {\n const scrollY = globalThis.scrollY;\n if (typeof scrollY === "number") {\n this.scrollPositions.set(path, scrollY);\n } else {\n rendererLogger.debug("[router] No valid scrollY value available");\n this.scrollPositions.set(path, 0);\n }\n } catch (error2) {\n rendererLogger.warn("[router] failed to record scroll position", error2);\n }\n }\n getScrollPosition(path) {\n const position = this.scrollPositions.get(path);\n if (position === void 0) {\n rendererLogger.debug(`[router] No scroll position stored for ${path}`);\n return 0;\n }\n return position;\n }\n isPopState() {\n return this.isPopStateNav;\n }\n clearPopStateFlag() {\n this.isPopStateNav = false;\n }\n clear() {\n this.prefetchQueue.clear();\n this.scrollPositions.clear();\n this.isPopStateNav = false;\n }\n};\n\n// src/routing/client/page-loader.ts\ninit_utils();\ninit_errors();\nvar PageLoader = class {\n constructor() {\n this.cache = /* @__PURE__ */ new Map();\n }\n getCached(path) {\n return this.cache.get(path);\n }\n isCached(path) {\n return this.cache.has(path);\n }\n setCache(path, data) {\n this.cache.set(path, data);\n }\n clearCache() {\n this.cache.clear();\n }\n async fetchPageData(path) {\n const jsonData = await this.tryFetchJSON(path);\n if (jsonData)\n return jsonData;\n return this.fetchAndParseHTML(path);\n }\n async tryFetchJSON(path) {\n try {\n const response = await fetch(`/_veryfront/data${path}.json`, {\n headers: { "X-Veryfront-Navigation": "client" }\n });\n if (response.ok) {\n return await response.json();\n }\n } catch (error2) {\n rendererLogger.debug(`[PageLoader] RSC fetch failed for ${path}, falling back to HTML:`, error2);\n }\n return null;\n }\n async fetchAndParseHTML(path) {\n const response = await fetch(path, {\n headers: { "X-Veryfront-Navigation": "client" }\n });\n if (!response.ok) {\n throw new NetworkError(`Failed to fetch ${path}`, {\n status: response.status,\n path\n });\n }\n const html3 = await response.text();\n const { content, pageData } = parsePageDataFromHTML(html3);\n return {\n html: content,\n ...pageData\n };\n }\n async loadPage(path) {\n const cachedData = this.getCached(path);\n if (cachedData) {\n rendererLogger.debug(`Loading ${path} from cache`);\n return cachedData;\n }\n const data = await this.fetchPageData(path);\n this.setCache(path, data);\n return data;\n }\n async prefetch(path) {\n if (this.isCached(path))\n return;\n rendererLogger.debug(`Prefetching ${path}`);\n try {\n const data = await this.fetchPageData(path);\n this.setCache(path, data);\n } catch (error2) {\n rendererLogger.warn(`Failed to prefetch ${path}`, error2);\n }\n }\n};\n\n// src/routing/client/page-transition.ts\ninit_utils();\ninit_config();\n\n// src/security/client/html-sanitizer.ts\nvar SUSPICIOUS_PATTERNS = [\n { pattern: /<script[^>]*>[\\s\\S]*?<\\/script>/gi, name: "inline script" },\n { pattern: /javascript:/gi, name: "javascript: URL" },\n { pattern: /\\bon\\w+\\s*=/gi, name: "event handler attribute" },\n { pattern: /data:\\s*text\\/html/gi, name: "data: HTML URL" }\n];\nfunction isDevMode() {\n if (typeof globalThis !== "undefined") {\n const g = globalThis;\n return g.__VERYFRONT_DEV__ === true || g.Deno?.env?.get?.("VERYFRONT_ENV") === "development";\n }\n return false;\n}\nfunction validateTrustedHtml(html3, options = {}) {\n const { strict = false, warn = true } = options;\n for (const { pattern, name } of SUSPICIOUS_PATTERNS) {\n pattern.lastIndex = 0;\n if (pattern.test(html3)) {\n const message = `[Security] Suspicious ${name} detected in server HTML`;\n if (warn) {\n console.warn(message);\n }\n if (strict || !isDevMode()) {\n throw new Error(`Potentially unsafe HTML: ${name} detected`);\n }\n }\n }\n return html3;\n}\n\n// src/routing/client/page-transition.ts\nvar PageTransition = class {\n constructor(setupViewportPrefetch) {\n this.setupViewportPrefetch = setupViewportPrefetch;\n }\n destroy() {\n if (this.pendingTransitionTimeout !== void 0) {\n clearTimeout(this.pendingTransitionTimeout);\n this.pendingTransitionTimeout = void 0;\n }\n }\n updatePage(data, isPopState, scrollY) {\n if (data.frontmatter?.title) {\n document.title = data.frontmatter.title;\n }\n updateMetaTags(data.frontmatter ?? {});\n const rootElement = document.getElementById("root");\n if (rootElement && (data.html ?? "") !== "") {\n this.performTransition(rootElement, data, isPopState, scrollY);\n }\n }\n performTransition(rootElement, data, isPopState, scrollY) {\n if (this.pendingTransitionTimeout !== void 0) {\n clearTimeout(this.pendingTransitionTimeout);\n }\n rootElement.style.opacity = "0";\n this.pendingTransitionTimeout = setTimeout(() => {\n this.pendingTransitionTimeout = void 0;\n rootElement.innerHTML = validateTrustedHtml(String(data.html ?? ""));\n rootElement.style.opacity = "1";\n executeScripts(rootElement);\n applyHeadDirectives(rootElement);\n this.setupViewportPrefetch(rootElement);\n manageFocus(rootElement);\n this.handleScroll(isPopState, scrollY);\n }, PAGE_TRANSITION_DELAY_MS);\n }\n handleScroll(isPopState, scrollY) {\n try {\n globalThis.scrollTo(0, isPopState ? scrollY : 0);\n } catch (error2) {\n rendererLogger.warn("[router] scroll handling failed", error2);\n }\n }\n showError(error2) {\n const rootElement = document.getElementById("root");\n if (!rootElement)\n return;\n const errorDiv = document.createElement("div");\n errorDiv.className = "veryfront-error-page";\n const heading = document.createElement("h1");\n heading.textContent = "Oops! Something went wrong";\n const message = document.createElement("p");\n message.textContent = error2.message;\n const button = document.createElement("button");\n button.type = "button";\n button.textContent = "Reload Page";\n button.onclick = () => globalThis.location.reload();\n errorDiv.appendChild(heading);\n errorDiv.appendChild(message);\n errorDiv.appendChild(button);\n rootElement.innerHTML = "";\n rootElement.appendChild(errorDiv);\n }\n setLoadingState(loading) {\n const indicator = document.getElementById("veryfront-loading");\n if (indicator) {\n indicator.style.display = loading ? "block" : "none";\n }\n document.body.classList.toggle("veryfront-loading", loading);\n }\n};\n\n// src/routing/client/viewport-prefetch.ts\ninit_utils();\nvar ViewportPrefetch = class {\n constructor(prefetchCallback, prefetchOptions = {}) {\n this.observer = null;\n this.prefetchCallback = prefetchCallback;\n this.prefetchOptions = prefetchOptions;\n }\n setup(root) {\n try {\n if (!("IntersectionObserver" in globalThis))\n return;\n if (this.observer)\n this.observer.disconnect();\n this.createObserver();\n this.observeLinks(root);\n } catch (error2) {\n rendererLogger.debug("[router] setupViewportPrefetch failed", error2);\n }\n }\n createObserver() {\n this.observer = new IntersectionObserver(\n (entries) => {\n for (const entry of entries) {\n if (entry.isIntersecting) {\n const isAnchor = typeof HTMLAnchorElement !== "undefined" ? entry.target instanceof HTMLAnchorElement : entry.target.tagName === "A";\n if (isAnchor) {\n const href = entry.target.getAttribute("href");\n if (href) {\n this.prefetchCallback(href);\n }\n this.observer?.unobserve(entry.target);\n }\n }\n }\n },\n { rootMargin: "200px" }\n );\n }\n observeLinks(root) {\n const anchors = root.querySelectorAll?.(\'a[href]:not([target="_blank"])\') ?? document.createDocumentFragment().querySelectorAll("a");\n const isViewportEnabled = Boolean(this.prefetchOptions.viewport);\n anchors.forEach((anchor) => {\n if (this.shouldObserveAnchor(anchor, isViewportEnabled)) {\n this.observer?.observe(anchor);\n }\n });\n }\n shouldObserveAnchor(anchor, isViewportEnabled) {\n const href = anchor.getAttribute("href") || "";\n if (!href || href.startsWith("http") || href.startsWith("#") || anchor.getAttribute("download")) {\n return false;\n }\n const prefetchAttribute = anchor.getAttribute("data-prefetch");\n if (prefetchAttribute === "false")\n return false;\n return prefetchAttribute === "viewport" || isViewportEnabled;\n }\n disconnect() {\n if (this.observer) {\n try {\n this.observer.disconnect();\n } catch (error2) {\n rendererLogger.warn("[router] prefetchObserver.disconnect failed", error2);\n }\n this.observer = null;\n }\n }\n};\n\n// src/routing/api/handler.ts\ninit_utils();\ninit_std_path();\ninit_config();\n\n// src/core/utils/lru-wrapper.ts\ninit_utils();\ninit_process();\n\n// src/routing/api/handler.ts\ninit_veryfront_error();\n\n// src/security/http/response/constants.ts\nvar CONTENT_TYPES = {\n JSON: "application/json; charset=utf-8",\n HTML: "text/html; charset=utf-8",\n TEXT: "text/plain; charset=utf-8",\n JAVASCRIPT: "application/javascript; charset=utf-8",\n CSS: "text/css; charset=utf-8",\n XML: "application/xml; charset=utf-8"\n};\nvar CACHE_DURATIONS = {\n SHORT: 60,\n MEDIUM: 3600,\n LONG: 31536e3\n};\n\n// src/security/http/cors/validators.ts\ninit_logger();\n\n// src/observability/tracing/manager.ts\ninit_utils();\n\n// src/observability/tracing/config.ts\ninit_process();\nvar DEFAULT_CONFIG2 = {\n enabled: false,\n exporter: "console",\n serviceName: "veryfront",\n sampleRate: 1,\n debug: false\n};\nfunction loadConfig(config = {}, adapter) {\n const finalConfig = { ...DEFAULT_CONFIG2, ...config };\n if (adapter?.env) {\n applyEnvFromAdapter(finalConfig, adapter.env);\n } else {\n applyEnvFromDeno(finalConfig);\n }\n return finalConfig;\n}\nfunction applyEnvFromAdapter(config, envAdapter) {\n if (!envAdapter)\n return;\n const otelEnabled = envAdapter.get("OTEL_TRACES_ENABLED");\n const veryfrontOtel = envAdapter.get("VERYFRONT_OTEL");\n const serviceName = envAdapter.get("OTEL_SERVICE_NAME");\n config.enabled = otelEnabled === "true" || veryfrontOtel === "1" || config.enabled;\n if (serviceName)\n config.serviceName = serviceName;\n const otlpEndpoint = envAdapter.get("OTEL_EXPORTER_OTLP_ENDPOINT");\n const tracesEndpoint = envAdapter.get("OTEL_EXPORTER_OTLP_TRACES_ENDPOINT");\n config.endpoint = otlpEndpoint || tracesEndpoint || config.endpoint;\n const exporterType = envAdapter.get("OTEL_TRACES_EXPORTER");\n if (isValidExporter(exporterType)) {\n config.exporter = exporterType;\n }\n}\nfunction applyEnvFromDeno(config) {\n try {\n config.enabled = getEnv("OTEL_TRACES_ENABLED") === "true" || getEnv("VERYFRONT_OTEL") === "1" || config.enabled;\n config.serviceName = getEnv("OTEL_SERVICE_NAME") || config.serviceName;\n config.endpoint = getEnv("OTEL_EXPORTER_OTLP_ENDPOINT") || getEnv("OTEL_EXPORTER_OTLP_TRACES_ENDPOINT") || config.endpoint;\n const exporterType = getEnv("OTEL_TRACES_EXPORTER");\n if (isValidExporter(exporterType)) {\n config.exporter = exporterType;\n }\n } catch {\n }\n}\nfunction isValidExporter(value) {\n return value === "jaeger" || value === "zipkin" || value === "otlp" || value === "console";\n}\n\n// src/observability/tracing/span-operations.ts\ninit_utils();\nvar SpanOperations = class {\n constructor(api, tracer2) {\n this.api = api;\n this.tracer = tracer2;\n }\n startSpan(name, options = {}) {\n try {\n const spanKind = this.mapSpanKind(options.kind);\n const span = this.tracer.startSpan(name, {\n kind: spanKind,\n attributes: options.attributes || {}\n }, options.parent);\n return span;\n } catch (error2) {\n serverLogger.debug("[tracing] Failed to start span", { name, error: error2 });\n return null;\n }\n }\n endSpan(span, error2) {\n if (!span)\n return;\n try {\n if (error2) {\n span.recordException(error2);\n span.setStatus({\n code: this.api.SpanStatusCode.ERROR,\n message: error2.message\n });\n } else {\n span.setStatus({ code: this.api.SpanStatusCode.OK });\n }\n span.end();\n } catch (err) {\n serverLogger.debug("[tracing] Failed to end span", err);\n }\n }\n setAttributes(span, attributes) {\n if (!span)\n return;\n try {\n span.setAttributes(attributes);\n } catch (error2) {\n serverLogger.debug("[tracing] Failed to set span attributes", error2);\n }\n }\n addEvent(span, name, attributes) {\n if (!span)\n return;\n try {\n span.addEvent(name, attributes);\n } catch (error2) {\n serverLogger.debug("[tracing] Failed to add span event", error2);\n }\n }\n createChildSpan(parentSpan, name, options = {}) {\n if (!parentSpan)\n return this.startSpan(name, options);\n try {\n const parentContext = this.api.trace.setSpan(this.api.context.active(), parentSpan);\n return this.startSpan(name, { ...options, parent: parentContext });\n } catch (error2) {\n serverLogger.debug("[tracing] Failed to create child span", error2);\n return null;\n }\n }\n mapSpanKind(kind) {\n if (!kind)\n return this.api.SpanKind.INTERNAL;\n const kindMap = {\n "internal": this.api.SpanKind.INTERNAL,\n "server": this.api.SpanKind.SERVER,\n "client": this.api.SpanKind.CLIENT,\n "producer": this.api.SpanKind.PRODUCER,\n "consumer": this.api.SpanKind.CONSUMER\n };\n return kindMap[kind.toLowerCase()] || this.api.SpanKind.INTERNAL;\n }\n};\n\n// src/observability/tracing/context-propagation.ts\ninit_utils();\nvar ContextPropagation = class {\n constructor(api, propagator) {\n this.api = api;\n this.propagator = propagator;\n }\n extractContext(headers) {\n try {\n const carrier = {};\n headers.forEach((value, key) => {\n carrier[key] = value;\n });\n return this.api.propagation.extract(this.api.context.active(), carrier);\n } catch (error2) {\n serverLogger.debug("[tracing] Failed to extract context from headers", error2);\n return void 0;\n }\n }\n injectContext(context, headers) {\n try {\n const carrier = {};\n this.api.propagation.inject(context, carrier);\n for (const [key, value] of Object.entries(carrier)) {\n headers.set(key, value);\n }\n } catch (error2) {\n serverLogger.debug("[tracing] Failed to inject context into headers", error2);\n }\n }\n getActiveContext() {\n try {\n return this.api.context.active();\n } catch (error2) {\n serverLogger.debug("[tracing] Failed to get active context", error2);\n return void 0;\n }\n }\n async withActiveSpan(span, fn) {\n if (!span)\n return await fn();\n return await this.api.context.with(\n this.api.trace.setSpan(this.api.context.active(), span),\n fn\n );\n }\n withSpan(name, fn, startSpan2, endSpan2) {\n const span = startSpan2(name);\n try {\n const result = fn(span);\n endSpan2(span);\n return result;\n } catch (error2) {\n endSpan2(span, error2);\n throw error2;\n }\n }\n async withSpanAsync(name, fn, startSpan2, endSpan2) {\n const span = startSpan2(name);\n try {\n const result = await fn(span);\n endSpan2(span);\n return result;\n } catch (error2) {\n endSpan2(span, error2);\n throw error2;\n }\n }\n};\n\n// src/observability/tracing/manager.ts\nvar TracingManager = class {\n constructor() {\n this.state = {\n initialized: false,\n tracer: null,\n api: null,\n propagator: null\n };\n this.spanOps = null;\n this.contextProp = null;\n }\n async initialize(config = {}, adapter) {\n if (this.state.initialized) {\n serverLogger.debug("[tracing] Already initialized");\n return;\n }\n const finalConfig = loadConfig(config, adapter);\n if (!finalConfig.enabled) {\n serverLogger.debug("[tracing] Tracing disabled");\n this.state.initialized = true;\n return;\n }\n try {\n await this.initializeTracer(finalConfig);\n this.state.initialized = true;\n serverLogger.info("[tracing] OpenTelemetry tracing initialized", {\n exporter: finalConfig.exporter,\n serviceName: finalConfig.serviceName,\n endpoint: finalConfig.endpoint\n });\n } catch (error2) {\n serverLogger.warn("[tracing] Failed to initialize OpenTelemetry tracing", error2);\n this.state.initialized = true;\n }\n }\n async initializeTracer(config) {\n const otelApiModule = ["npm:@opentelemetry/", "api@1"].join("");\n const api = await import(otelApiModule);\n this.state.api = api;\n this.state.tracer = api.trace.getTracer(config.serviceName || "veryfront", "0.1.0");\n const otelCoreModule = ["npm:@opentelemetry/", "core@1"].join("");\n const { W3CTraceContextPropagator } = await import(otelCoreModule);\n const propagator = new W3CTraceContextPropagator();\n this.state.propagator = propagator;\n api.propagation.setGlobalPropagator(propagator);\n if (this.state.api && this.state.tracer) {\n this.spanOps = new SpanOperations(this.state.api, this.state.tracer);\n }\n if (this.state.api && this.state.propagator) {\n this.contextProp = new ContextPropagation(this.state.api, this.state.propagator);\n }\n }\n isEnabled() {\n return this.state.initialized && this.state.tracer !== null;\n }\n getSpanOperations() {\n return this.spanOps;\n }\n getContextPropagation() {\n return this.contextProp;\n }\n getState() {\n return this.state;\n }\n shutdown() {\n if (!this.state.initialized)\n return;\n try {\n serverLogger.info("[tracing] Tracing shutdown initiated");\n } catch (error2) {\n serverLogger.warn("[tracing] Error during tracing shutdown", error2);\n }\n }\n};\nvar tracingManager = new TracingManager();\n\n// src/observability/metrics/manager.ts\ninit_utils();\n\n// src/observability/metrics/config.ts\ninit_process();\ninit_process();\nvar DEFAULT_METRICS_COLLECT_INTERVAL_MS2 = 6e4;\nvar DEFAULT_CONFIG3 = {\n enabled: false,\n exporter: "console",\n prefix: "veryfront",\n collectInterval: DEFAULT_METRICS_COLLECT_INTERVAL_MS2,\n debug: false\n};\nfunction loadConfig2(config, adapter) {\n const finalConfig = { ...DEFAULT_CONFIG3, ...config };\n if (adapter?.env) {\n const envAdapter = adapter.env;\n const otelEnabled = envAdapter.get("OTEL_METRICS_ENABLED");\n const veryfrontOtel = envAdapter.get("VERYFRONT_OTEL");\n finalConfig.enabled = otelEnabled === "true" || veryfrontOtel === "1" || finalConfig.enabled;\n const otlpEndpoint = envAdapter.get("OTEL_EXPORTER_OTLP_ENDPOINT");\n const metricsEndpoint = envAdapter.get(\n "OTEL_EXPORTER_OTLP_METRICS_ENDPOINT"\n );\n finalConfig.endpoint = otlpEndpoint || metricsEndpoint || finalConfig.endpoint;\n const exporterType = envAdapter.get("OTEL_METRICS_EXPORTER");\n if (exporterType === "prometheus" || exporterType === "otlp" || exporterType === "console") {\n finalConfig.exporter = exporterType;\n }\n } else {\n try {\n finalConfig.enabled = getEnv("OTEL_METRICS_ENABLED") === "true" || getEnv("VERYFRONT_OTEL") === "1" || finalConfig.enabled;\n finalConfig.endpoint = getEnv("OTEL_EXPORTER_OTLP_ENDPOINT") || getEnv("OTEL_EXPORTER_OTLP_METRICS_ENDPOINT") || finalConfig.endpoint;\n const exporterType = getEnv("OTEL_METRICS_EXPORTER");\n if (exporterType === "prometheus" || exporterType === "otlp" || exporterType === "console") {\n finalConfig.exporter = exporterType;\n }\n } catch {\n }\n }\n return finalConfig;\n}\nfunction getMemoryUsage() {\n try {\n return memoryUsage();\n } catch {\n return null;\n }\n}\n\n// src/observability/instruments/instruments-factory.ts\ninit_utils();\n\n// src/observability/instruments/build-instruments.ts\ninit_config();\nfunction createBuildInstruments(meter, config) {\n const buildDuration = meter.createHistogram(\n `${config.prefix}.build.duration`,\n {\n description: "Build operation duration",\n unit: "ms",\n advice: { explicitBucketBoundaries: DURATION_HISTOGRAM_BOUNDARIES_MS }\n }\n );\n const bundleSizeHistogram = meter.createHistogram(\n `${config.prefix}.build.bundle.size`,\n {\n description: "Bundle size distribution",\n unit: "kb",\n advice: { explicitBucketBoundaries: SIZE_HISTOGRAM_BOUNDARIES_KB }\n }\n );\n const bundleCounter = meter.createCounter(\n `${config.prefix}.build.bundles`,\n {\n description: "Total number of bundles created",\n unit: "bundles"\n }\n );\n return {\n buildDuration,\n bundleSizeHistogram,\n bundleCounter\n };\n}\n\n// src/observability/instruments/cache-instruments.ts\nfunction createCacheInstruments(meter, config, runtimeState) {\n const cacheGetCounter = meter.createCounter(\n `${config.prefix}.cache.gets`,\n {\n description: "Total number of cache get operations",\n unit: "operations"\n }\n );\n const cacheHitCounter = meter.createCounter(\n `${config.prefix}.cache.hits`,\n {\n description: "Total number of cache hits",\n unit: "hits"\n }\n );\n const cacheMissCounter = meter.createCounter(\n `${config.prefix}.cache.misses`,\n {\n description: "Total number of cache misses",\n unit: "misses"\n }\n );\n const cacheSetCounter = meter.createCounter(\n `${config.prefix}.cache.sets`,\n {\n description: "Total number of cache set operations",\n unit: "operations"\n }\n );\n const cacheInvalidateCounter = meter.createCounter(\n `${config.prefix}.cache.invalidations`,\n {\n description: "Total number of cache invalidations",\n unit: "operations"\n }\n );\n const cacheSizeGauge = meter.createObservableGauge(\n `${config.prefix}.cache.size`,\n {\n description: "Current cache size",\n unit: "entries"\n }\n );\n cacheSizeGauge.addCallback((result) => {\n result.observe(runtimeState.cacheSize);\n });\n return {\n cacheGetCounter,\n cacheHitCounter,\n cacheMissCounter,\n cacheSetCounter,\n cacheInvalidateCounter,\n cacheSizeGauge\n };\n}\n\n// src/observability/instruments/data-instruments.ts\ninit_config();\nfunction createDataInstruments(meter, config) {\n const dataFetchDuration = meter.createHistogram(\n `${config.prefix}.data.fetch.duration`,\n {\n description: "Data fetch duration",\n unit: "ms",\n advice: { explicitBucketBoundaries: DURATION_HISTOGRAM_BOUNDARIES_MS }\n }\n );\n const dataFetchCounter = meter.createCounter(\n `${config.prefix}.data.fetch.count`,\n {\n description: "Total number of data fetches",\n unit: "fetches"\n }\n );\n const dataFetchErrorCounter = meter.createCounter(\n `${config.prefix}.data.fetch.errors`,\n {\n description: "Data fetch errors",\n unit: "errors"\n }\n );\n return {\n dataFetchDuration,\n dataFetchCounter,\n dataFetchErrorCounter\n };\n}\n\n// src/observability/instruments/http-instruments.ts\ninit_config();\nfunction createHttpInstruments(meter, config) {\n const httpRequestCounter = meter.createCounter(\n `${config.prefix}.http.requests`,\n {\n description: "Total number of HTTP requests",\n unit: "requests"\n }\n );\n const httpRequestDuration = meter.createHistogram(\n `${config.prefix}.http.request.duration`,\n {\n description: "HTTP request duration",\n unit: "ms",\n advice: { explicitBucketBoundaries: DURATION_HISTOGRAM_BOUNDARIES_MS }\n }\n );\n const httpActiveRequests = meter.createUpDownCounter(\n `${config.prefix}.http.requests.active`,\n {\n description: "Number of active HTTP requests",\n unit: "requests"\n }\n );\n return {\n httpRequestCounter,\n httpRequestDuration,\n httpActiveRequests\n };\n}\n\n// src/observability/instruments/memory-instruments.ts\nfunction createMemoryInstruments(meter, config) {\n const memoryUsageGauge = meter.createObservableGauge(\n `${config.prefix}.memory.usage`,\n {\n description: "Memory usage",\n unit: "bytes"\n }\n );\n memoryUsageGauge.addCallback((result) => {\n const memoryUsage2 = getMemoryUsage();\n if (memoryUsage2) {\n result.observe(memoryUsage2.rss);\n }\n });\n const heapUsageGauge = meter.createObservableGauge(\n `${config.prefix}.memory.heap`,\n {\n description: "Heap memory usage",\n unit: "bytes"\n }\n );\n heapUsageGauge.addCallback((result) => {\n const memoryUsage2 = getMemoryUsage();\n if (memoryUsage2) {\n result.observe(memoryUsage2.heapUsed);\n }\n });\n return {\n memoryUsageGauge,\n heapUsageGauge\n };\n}\n\n// src/observability/instruments/render-instruments.ts\ninit_config();\nfunction createRenderInstruments(meter, config) {\n const renderDuration = meter.createHistogram(\n `${config.prefix}.render.duration`,\n {\n description: "Page render duration",\n unit: "ms",\n advice: { explicitBucketBoundaries: DURATION_HISTOGRAM_BOUNDARIES_MS }\n }\n );\n const renderCounter = meter.createCounter(\n `${config.prefix}.render.count`,\n {\n description: "Total number of page renders",\n unit: "renders"\n }\n );\n const renderErrorCounter = meter.createCounter(\n `${config.prefix}.render.errors`,\n {\n description: "Total number of render errors",\n unit: "errors"\n }\n );\n return {\n renderDuration,\n renderCounter,\n renderErrorCounter\n };\n}\n\n// src/observability/instruments/rsc-instruments.ts\ninit_config();\nfunction createRscInstruments(meter, config) {\n const rscRenderDuration = meter.createHistogram(\n `${config.prefix}.rsc.render.duration`,\n {\n description: "RSC render duration",\n unit: "ms",\n advice: { explicitBucketBoundaries: DURATION_HISTOGRAM_BOUNDARIES_MS }\n }\n );\n const rscStreamDuration = meter.createHistogram(\n `${config.prefix}.rsc.stream.duration`,\n {\n description: "RSC stream duration",\n unit: "ms",\n advice: { explicitBucketBoundaries: DURATION_HISTOGRAM_BOUNDARIES_MS }\n }\n );\n const rscManifestCounter = meter.createCounter(\n `${config.prefix}.rsc.manifest`,\n {\n description: "RSC manifest requests",\n unit: "requests"\n }\n );\n const rscPageCounter = meter.createCounter(\n `${config.prefix}.rsc.page`,\n {\n description: "RSC page requests",\n unit: "requests"\n }\n );\n const rscStreamCounter = meter.createCounter(\n `${config.prefix}.rsc.stream`,\n {\n description: "RSC stream requests",\n unit: "requests"\n }\n );\n const rscActionCounter = meter.createCounter(\n `${config.prefix}.rsc.action`,\n {\n description: "RSC action requests",\n unit: "requests"\n }\n );\n const rscErrorCounter = meter.createCounter(\n `${config.prefix}.rsc.errors`,\n {\n description: "RSC errors",\n unit: "errors"\n }\n );\n return {\n rscRenderDuration,\n rscStreamDuration,\n rscManifestCounter,\n rscPageCounter,\n rscStreamCounter,\n rscActionCounter,\n rscErrorCounter\n };\n}\n\n// src/observability/instruments/instruments-factory.ts\nfunction initializeInstruments(meter, config, runtimeState) {\n const instruments = {\n httpRequestCounter: null,\n httpRequestDuration: null,\n httpActiveRequests: null,\n cacheGetCounter: null,\n cacheHitCounter: null,\n cacheMissCounter: null,\n cacheSetCounter: null,\n cacheInvalidateCounter: null,\n cacheSizeGauge: null,\n renderDuration: null,\n renderCounter: null,\n renderErrorCounter: null,\n rscRenderDuration: null,\n rscStreamDuration: null,\n rscManifestCounter: null,\n rscPageCounter: null,\n rscStreamCounter: null,\n rscActionCounter: null,\n rscErrorCounter: null,\n buildDuration: null,\n bundleSizeHistogram: null,\n bundleCounter: null,\n dataFetchDuration: null,\n dataFetchCounter: null,\n dataFetchErrorCounter: null,\n corsRejectionCounter: null,\n securityHeadersCounter: null,\n memoryUsageGauge: null,\n heapUsageGauge: null\n };\n try {\n const httpInstruments = createHttpInstruments(meter, config);\n Object.assign(instruments, httpInstruments);\n const cacheInstruments = createCacheInstruments(meter, config, runtimeState);\n Object.assign(instruments, cacheInstruments);\n const renderInstruments = createRenderInstruments(meter, config);\n Object.assign(instruments, renderInstruments);\n const rscInstruments = createRscInstruments(meter, config);\n Object.assign(instruments, rscInstruments);\n const buildInstruments = createBuildInstruments(meter, config);\n Object.assign(instruments, buildInstruments);\n const dataInstruments = createDataInstruments(meter, config);\n Object.assign(instruments, dataInstruments);\n const memoryInstruments = createMemoryInstruments(meter, config);\n Object.assign(instruments, memoryInstruments);\n } catch (error2) {\n serverLogger.warn("[metrics] Failed to initialize metric instruments", error2);\n }\n return Promise.resolve(instruments);\n}\n\n// src/observability/metrics/recorder.ts\nvar MetricsRecorder = class {\n constructor(instruments, runtimeState) {\n this.instruments = instruments;\n this.runtimeState = runtimeState;\n }\n recordHttpRequest(attributes) {\n this.instruments.httpRequestCounter?.add(1, attributes);\n this.instruments.httpActiveRequests?.add(1, attributes);\n this.runtimeState.activeRequests++;\n }\n recordHttpRequestComplete(durationMs, attributes) {\n this.instruments.httpRequestDuration?.record(durationMs, attributes);\n this.instruments.httpActiveRequests?.add(-1, attributes);\n this.runtimeState.activeRequests--;\n }\n recordCacheGet(hit, attributes) {\n this.instruments.cacheGetCounter?.add(1, attributes);\n if (hit) {\n this.instruments.cacheHitCounter?.add(1, attributes);\n } else {\n this.instruments.cacheMissCounter?.add(1, attributes);\n }\n }\n recordCacheSet(attributes) {\n this.instruments.cacheSetCounter?.add(1, attributes);\n this.runtimeState.cacheSize++;\n }\n recordCacheInvalidate(count, attributes) {\n this.instruments.cacheInvalidateCounter?.add(count, attributes);\n this.runtimeState.cacheSize = Math.max(\n 0,\n this.runtimeState.cacheSize - count\n );\n }\n setCacheSize(size) {\n this.runtimeState.cacheSize = size;\n }\n // Render Metrics\n recordRender(durationMs, attributes) {\n this.instruments.renderDuration?.record(durationMs, attributes);\n this.instruments.renderCounter?.add(1, attributes);\n }\n recordRenderError(attributes) {\n this.instruments.renderErrorCounter?.add(1, attributes);\n }\n // RSC Metrics\n recordRSCRender(durationMs, attributes) {\n this.instruments.rscRenderDuration?.record(durationMs, attributes);\n }\n recordRSCStream(durationMs, attributes) {\n this.instruments.rscStreamDuration?.record(durationMs, attributes);\n }\n recordRSCRequest(type, attributes) {\n switch (type) {\n case "manifest":\n this.instruments.rscManifestCounter?.add(1, attributes);\n break;\n case "page":\n this.instruments.rscPageCounter?.add(1, attributes);\n break;\n case "stream":\n this.instruments.rscStreamCounter?.add(1, attributes);\n break;\n case "action":\n this.instruments.rscActionCounter?.add(1, attributes);\n break;\n }\n }\n recordRSCError(attributes) {\n this.instruments.rscErrorCounter?.add(1, attributes);\n }\n // Build Metrics\n recordBuild(durationMs, attributes) {\n this.instruments.buildDuration?.record(durationMs, attributes);\n }\n recordBundle(sizeKb, attributes) {\n this.instruments.bundleSizeHistogram?.record(sizeKb, attributes);\n this.instruments.bundleCounter?.add(1, attributes);\n }\n // Data Fetching Metrics\n recordDataFetch(durationMs, attributes) {\n this.instruments.dataFetchDuration?.record(durationMs, attributes);\n this.instruments.dataFetchCounter?.add(1, attributes);\n }\n recordDataFetchError(attributes) {\n this.instruments.dataFetchErrorCounter?.add(1, attributes);\n }\n // Security Metrics\n recordCorsRejection(attributes) {\n this.instruments.corsRejectionCounter?.add(1, attributes);\n }\n recordSecurityHeaders(attributes) {\n this.instruments.securityHeadersCounter?.add(1, attributes);\n }\n};\n\n// src/observability/metrics/manager.ts\nvar MetricsManager = class {\n constructor() {\n this.initialized = false;\n this.meter = null;\n this.api = null;\n this.recorder = null;\n this.instruments = this.createEmptyInstruments();\n this.runtimeState = {\n cacheSize: 0,\n activeRequests: 0\n };\n this.recorder = new MetricsRecorder(this.instruments, this.runtimeState);\n }\n createEmptyInstruments() {\n return {\n httpRequestCounter: null,\n httpRequestDuration: null,\n httpActiveRequests: null,\n cacheGetCounter: null,\n cacheHitCounter: null,\n cacheMissCounter: null,\n cacheSetCounter: null,\n cacheInvalidateCounter: null,\n cacheSizeGauge: null,\n renderDuration: null,\n renderCounter: null,\n renderErrorCounter: null,\n rscRenderDuration: null,\n rscStreamDuration: null,\n rscManifestCounter: null,\n rscPageCounter: null,\n rscStreamCounter: null,\n rscActionCounter: null,\n rscErrorCounter: null,\n buildDuration: null,\n bundleSizeHistogram: null,\n bundleCounter: null,\n dataFetchDuration: null,\n dataFetchCounter: null,\n dataFetchErrorCounter: null,\n corsRejectionCounter: null,\n securityHeadersCounter: null,\n memoryUsageGauge: null,\n heapUsageGauge: null\n };\n }\n async initialize(config = {}, adapter) {\n if (this.initialized) {\n serverLogger.debug("[metrics] Already initialized");\n return;\n }\n const finalConfig = loadConfig2(config, adapter);\n if (!finalConfig.enabled) {\n serverLogger.debug("[metrics] Metrics collection disabled");\n this.initialized = true;\n return;\n }\n try {\n this.api = await import("npm:@opentelemetry/api@1");\n this.meter = this.api.metrics.getMeter(finalConfig.prefix, "0.1.0");\n this.instruments = await initializeInstruments(\n this.meter,\n finalConfig,\n this.runtimeState\n );\n if (this.recorder) {\n this.recorder.instruments = this.instruments;\n }\n this.initialized = true;\n serverLogger.info("[metrics] OpenTelemetry metrics initialized", {\n exporter: finalConfig.exporter,\n endpoint: finalConfig.endpoint,\n prefix: finalConfig.prefix\n });\n } catch (error2) {\n serverLogger.warn("[metrics] Failed to initialize OpenTelemetry metrics", error2);\n this.initialized = true;\n }\n }\n isEnabled() {\n return this.initialized && this.meter !== null;\n }\n getRecorder() {\n return this.recorder;\n }\n getState() {\n return {\n initialized: this.initialized,\n cacheSize: this.runtimeState.cacheSize,\n activeRequests: this.runtimeState.activeRequests\n };\n }\n shutdown() {\n if (!this.initialized)\n return;\n try {\n serverLogger.info("[metrics] Metrics shutdown initiated");\n } catch (error2) {\n serverLogger.warn("[metrics] Error during metrics shutdown", error2);\n }\n }\n};\nvar metricsManager = new MetricsManager();\n\n// src/observability/metrics/index.ts\nvar getRecorder = () => metricsManager.getRecorder();\nfunction recordCorsRejection(attributes) {\n getRecorder()?.recordCorsRejection?.(attributes);\n}\nfunction recordSecurityHeaders(attributes) {\n getRecorder()?.recordSecurityHeaders?.(attributes);\n}\n\n// src/observability/auto-instrument/orchestrator.ts\ninit_utils();\n\n// src/observability/auto-instrument/http-instrumentation.ts\ninit_utils();\nimport {\n context as otContext,\n propagation,\n SpanKind,\n SpanStatusCode,\n trace\n} from "npm:@opentelemetry/api@1";\nvar tracer = trace.getTracer("veryfront-http");\n\n// src/security/http/cors/validators.ts\nasync function validateOrigin(requestOrigin, config) {\n if (!config) {\n return { allowedOrigin: null, allowCredentials: false };\n }\n if (config === true) {\n const origin = requestOrigin || "*";\n return { allowedOrigin: origin, allowCredentials: false };\n }\n const corsConfig = config;\n if (!corsConfig.origin) {\n return { allowedOrigin: null, allowCredentials: false };\n }\n if (!requestOrigin) {\n if (corsConfig.origin === "*") {\n return { allowedOrigin: "*", allowCredentials: false };\n }\n return { allowedOrigin: null, allowCredentials: false };\n }\n if (corsConfig.origin === "*") {\n if (corsConfig.credentials) {\n serverLogger.warn("[CORS] Cannot use credentials with wildcard origin - denying");\n return {\n allowedOrigin: null,\n allowCredentials: false,\n error: "Cannot use credentials with wildcard origin"\n };\n }\n return { allowedOrigin: "*", allowCredentials: false };\n }\n if (typeof corsConfig.origin === "function") {\n try {\n const result = await corsConfig.origin(requestOrigin);\n if (typeof result === "string") {\n return {\n allowedOrigin: result,\n allowCredentials: corsConfig.credentials ?? false\n };\n }\n const allowed = result === true;\n return {\n allowedOrigin: allowed ? requestOrigin : null,\n allowCredentials: allowed && (corsConfig.credentials ?? false),\n error: allowed ? void 0 : "Origin rejected by validation function"\n };\n } catch (error2) {\n serverLogger.error("[CORS] Origin validation function error", error2);\n return {\n allowedOrigin: null,\n allowCredentials: false,\n error: "Origin validation error"\n };\n }\n }\n if (Array.isArray(corsConfig.origin)) {\n const allowed = corsConfig.origin.includes(requestOrigin);\n if (!allowed) {\n recordCorsRejection();\n serverLogger.warn("[CORS] Origin not in allowlist", {\n requestOrigin,\n allowedOrigins: corsConfig.origin\n });\n }\n return {\n allowedOrigin: allowed ? requestOrigin : null,\n allowCredentials: allowed && (corsConfig.credentials ?? false),\n error: allowed ? void 0 : "Origin not in allowlist"\n };\n }\n if (typeof corsConfig.origin === "string") {\n const allowed = corsConfig.origin === requestOrigin;\n if (!allowed) {\n recordCorsRejection();\n serverLogger.warn("[CORS] Origin does not match", {\n requestOrigin,\n expectedOrigin: corsConfig.origin\n });\n }\n return {\n allowedOrigin: allowed ? requestOrigin : null,\n allowCredentials: allowed && (corsConfig.credentials ?? false),\n error: allowed ? void 0 : "Origin does not match"\n };\n }\n return {\n allowedOrigin: null,\n allowCredentials: false,\n error: "Invalid origin configuration"\n };\n}\nfunction validateOriginSync(requestOrigin, config) {\n if (!config) {\n return { allowedOrigin: null, allowCredentials: false };\n }\n if (config === true) {\n const origin = requestOrigin || "*";\n return { allowedOrigin: origin, allowCredentials: false };\n }\n const corsConfig = config;\n if (!corsConfig.origin) {\n return { allowedOrigin: null, allowCredentials: false };\n }\n if (!requestOrigin) {\n if (corsConfig.origin === "*") {\n return { allowedOrigin: "*", allowCredentials: false };\n }\n return { allowedOrigin: null, allowCredentials: false };\n }\n if (corsConfig.origin === "*") {\n if (corsConfig.credentials) {\n serverLogger.warn("[CORS] Cannot use credentials with wildcard origin - denying");\n return {\n allowedOrigin: null,\n allowCredentials: false,\n error: "Cannot use credentials with wildcard origin"\n };\n }\n return { allowedOrigin: "*", allowCredentials: false };\n }\n if (typeof corsConfig.origin === "function") {\n try {\n const result = corsConfig.origin(requestOrigin);\n if (result instanceof Promise) {\n serverLogger.warn(\n "[CORS] Async origin validators are not supported in synchronous contexts"\n );\n return {\n allowedOrigin: null,\n allowCredentials: false,\n error: "Async origin validators not supported"\n };\n }\n if (typeof result === "string") {\n return {\n allowedOrigin: result,\n allowCredentials: corsConfig.credentials ?? false\n };\n }\n const allowed = result === true;\n return {\n allowedOrigin: allowed ? requestOrigin : null,\n allowCredentials: allowed && (corsConfig.credentials ?? false),\n error: allowed ? void 0 : "Origin rejected by validation function"\n };\n } catch (error2) {\n serverLogger.error("[CORS] Origin validation function error", error2);\n return {\n allowedOrigin: null,\n allowCredentials: false,\n error: "Origin validation error"\n };\n }\n }\n if (Array.isArray(corsConfig.origin)) {\n const allowed = corsConfig.origin.includes(requestOrigin);\n if (!allowed) {\n recordCorsRejection();\n serverLogger.warn("[CORS] Origin not in allowlist (sync)", {\n requestOrigin,\n allowedOrigins: corsConfig.origin\n });\n }\n return {\n allowedOrigin: allowed ? requestOrigin : null,\n allowCredentials: allowed && (corsConfig.credentials ?? false),\n error: allowed ? void 0 : "Origin not in allowlist"\n };\n }\n if (typeof corsConfig.origin === "string") {\n const allowed = corsConfig.origin === requestOrigin;\n if (!allowed) {\n recordCorsRejection();\n serverLogger.warn("[CORS] Origin does not match (sync)", {\n requestOrigin,\n expectedOrigin: corsConfig.origin\n });\n }\n return {\n allowedOrigin: allowed ? requestOrigin : null,\n allowCredentials: allowed && (corsConfig.credentials ?? false),\n error: allowed ? void 0 : "Origin does not match"\n };\n }\n return {\n allowedOrigin: null,\n allowCredentials: false,\n error: "Invalid origin configuration"\n };\n}\n\n// src/security/http/cors/headers.ts\nasync function applyCORSHeaders(options) {\n const { request, response, headers: headersObj, config } = options;\n const validation = await validateOrigin(request.headers.get("origin"), config);\n if (!validation.allowedOrigin) {\n return response;\n }\n const headers = headersObj || (response ? new Headers(response.headers) : new Headers());\n headers.set("Access-Control-Allow-Origin", validation.allowedOrigin);\n if (validation.allowedOrigin !== "*") {\n const existingVary = headers.get("Vary");\n const varyValues = existingVary ? existingVary.split(",").map((v) => v.trim()) : [];\n if (!varyValues.includes("Origin")) {\n varyValues.push("Origin");\n headers.set("Vary", varyValues.join(", "));\n }\n }\n if (validation.allowCredentials && validation.allowedOrigin !== "*") {\n headers.set("Access-Control-Allow-Credentials", "true");\n }\n const corsConfig = typeof config === "object" ? config : null;\n if (corsConfig?.exposedHeaders && corsConfig.exposedHeaders.length > 0) {\n headers.set("Access-Control-Expose-Headers", corsConfig.exposedHeaders.join(", "));\n }\n if (response) {\n return new Response(response.body, {\n status: response.status,\n statusText: response.statusText,\n headers\n });\n }\n return;\n}\nfunction applyCORSHeadersSync(options) {\n const { request, response, headers: headersObj, config } = options;\n const validation = validateOriginSync(request.headers.get("origin"), config);\n if (!validation.allowedOrigin) {\n return response;\n }\n const headers = headersObj || (response ? new Headers(response.headers) : new Headers());\n headers.set("Access-Control-Allow-Origin", validation.allowedOrigin);\n if (validation.allowedOrigin !== "*") {\n const existingVary = headers.get("Vary");\n const varyValues = existingVary ? existingVary.split(",").map((v) => v.trim()) : [];\n if (!varyValues.includes("Origin")) {\n varyValues.push("Origin");\n headers.set("Vary", varyValues.join(", "));\n }\n }\n if (validation.allowCredentials && validation.allowedOrigin !== "*") {\n headers.set("Access-Control-Allow-Credentials", "true");\n }\n const corsConfig = typeof config === "object" ? config : null;\n if (corsConfig?.exposedHeaders && corsConfig.exposedHeaders.length > 0) {\n headers.set("Access-Control-Expose-Headers", corsConfig.exposedHeaders.join(", "));\n }\n if (response) {\n return new Response(response.body, {\n status: response.status,\n statusText: response.statusText,\n headers\n });\n }\n return;\n}\n\n// src/security/http/cors/constants.ts\ninit_config();\ninit_process();\n\n// src/security/http/cors/preflight.ts\ninit_logger();\n\n// src/security/http/cors/middleware.ts\ninit_veryfront_error();\n\n// src/security/http/response/security-handler.ts\nfunction generateNonce() {\n const array = new Uint8Array(16);\n crypto.getRandomValues(array);\n return btoa(String.fromCharCode(...array));\n}\nfunction buildCSP(isDev, nonce, cspUserHeader, config, adapter) {\n const envCsp = adapter?.env?.get?.("VERYFRONT_CSP");\n if (envCsp?.trim())\n return envCsp.replace(/{NONCE}/g, nonce);\n const defaultCsp = isDev ? [\n "default-src \'self\'",\n `style-src \'self\' \'unsafe-inline\' https://esm.sh https://cdnjs.cloudflare.com https://cdn.veryfront.com https://cdn.jsdelivr.net https://cdn.tailwindcss.com`,\n "img-src \'self\' data: https://cdn.veryfront.com https://cdnjs.cloudflare.com",\n `script-src \'self\' \'nonce-${nonce}\' \'unsafe-eval\' https://esm.sh https://cdn.tailwindcss.com`,\n "connect-src \'self\' https://esm.sh ws://localhost:* wss://localhost:*",\n "font-src \'self\' data: https://cdnjs.cloudflare.com"\n ].join("; ") : [\n "default-src \'self\'",\n `style-src \'self\' \'nonce-${nonce}\'`,\n "img-src \'self\' data:",\n `script-src \'self\' \'nonce-${nonce}\'`,\n "connect-src \'self\'"\n ].join("; ");\n if (cspUserHeader?.trim()) {\n return `${cspUserHeader.replace(/{NONCE}/g, nonce)}; ${defaultCsp}`;\n }\n const cfgCsp = config?.csp;\n if (cfgCsp && typeof cfgCsp === "object") {\n const pieces = [];\n for (const [k, v] of Object.entries(cfgCsp)) {\n if (v === void 0)\n continue;\n const key = String(k).replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`);\n const val = Array.isArray(v) ? v.join(" ") : String(v);\n pieces.push(`${key} ${val}`.replace(/{NONCE}/g, nonce));\n }\n if (pieces.length > 0) {\n return `${pieces.join("; ")}; ${defaultCsp}`;\n }\n }\n return defaultCsp;\n}\nfunction getSecurityHeader(headerName, defaultValue, config, adapter) {\n const configKey = headerName.toLowerCase();\n const configValue = config?.[configKey];\n const envValue = adapter?.env?.get?.(`VERYFRONT_${headerName}`);\n return (typeof configValue === "string" ? configValue : void 0) || envValue || defaultValue;\n}\nfunction applySecurityHeaders(headers, isDev, nonce, cspUserHeader, config, adapter) {\n const getHeaderOverride = (name) => {\n const overrides = config?.headers;\n if (!overrides)\n return void 0;\n const lower = name.toLowerCase();\n for (const [key, value] of Object.entries(overrides)) {\n if (key.toLowerCase() === lower) {\n return value;\n }\n }\n return void 0;\n };\n const contentTypeOptions = getHeaderOverride("x-content-type-options") ?? "nosniff";\n headers.set("X-Content-Type-Options", contentTypeOptions);\n const frameOptions = getHeaderOverride("x-frame-options") ?? "DENY";\n headers.set("X-Frame-Options", frameOptions);\n const xssProtection = getHeaderOverride("x-xss-protection") ?? "1; mode=block";\n headers.set("X-XSS-Protection", xssProtection);\n const csp = buildCSP(isDev, nonce, cspUserHeader, config, adapter);\n if (csp) {\n headers.set("Content-Security-Policy", csp);\n }\n if (!isDev) {\n const hstsMaxAge = config?.hsts?.maxAge ?? 31536e3;\n const hstsIncludeSubDomains = config?.hsts?.includeSubDomains ?? true;\n const hstsPreload = config?.hsts?.preload ?? false;\n let hstsValue = `max-age=${hstsMaxAge}`;\n if (hstsIncludeSubDomains) {\n hstsValue += "; includeSubDomains";\n }\n if (hstsPreload) {\n hstsValue += "; preload";\n }\n const hstsOverride = getHeaderOverride("strict-transport-security");\n headers.set("Strict-Transport-Security", hstsOverride ?? hstsValue);\n }\n const coop = getSecurityHeader("COOP", "same-origin", config, adapter);\n const corp = getSecurityHeader("CORP", "same-origin", config, adapter);\n const coep = getSecurityHeader("COEP", "", config, adapter);\n headers.set("Cross-Origin-Opener-Policy", coop);\n headers.set("Cross-Origin-Resource-Policy", corp);\n if (coep) {\n headers.set("Cross-Origin-Embedder-Policy", coep);\n }\n if (config?.headers) {\n for (const [key, value] of Object.entries(config.headers)) {\n if (value === void 0)\n continue;\n headers.set(key, value);\n }\n }\n recordSecurityHeaders();\n}\n\n// src/security/http/response/cache-handler.ts\nfunction buildCacheControl(strategy) {\n let cacheControl;\n if (typeof strategy === "string") {\n switch (strategy) {\n case "no-cache":\n cacheControl = "no-cache, no-store, must-revalidate";\n break;\n case "no-store":\n cacheControl = "no-store";\n break;\n case "short":\n cacheControl = `public, max-age=${CACHE_DURATIONS.SHORT}`;\n break;\n case "medium":\n cacheControl = `public, max-age=${CACHE_DURATIONS.MEDIUM}`;\n break;\n case "long":\n cacheControl = `public, max-age=${CACHE_DURATIONS.LONG}`;\n break;\n case "immutable":\n cacheControl = `public, max-age=${CACHE_DURATIONS.LONG}, immutable`;\n break;\n case "none":\n cacheControl = "no-cache, no-store, must-revalidate";\n break;\n default:\n cacheControl = "public, max-age=0";\n }\n } else {\n const parts = [];\n parts.push(strategy.public !== false ? "public" : "private");\n parts.push(`max-age=${strategy.maxAge}`);\n if (strategy.immutable)\n parts.push("immutable");\n if (strategy.mustRevalidate)\n parts.push("must-revalidate");\n cacheControl = parts.join(", ");\n }\n return cacheControl;\n}\n\n// src/security/http/response/fluent-methods.ts\nfunction withCORS(req, corsConfig) {\n const config = corsConfig ?? this.securityConfig?.cors;\n applyCORSHeadersSync({\n request: req,\n headers: this.headers,\n config\n });\n return this;\n}\nfunction withCORSAsync(req) {\n return applyCORSHeaders({\n request: req,\n headers: this.headers,\n config: this.securityConfig?.cors\n }).then(() => this);\n}\nfunction withSecurity(config) {\n const cfg = config ?? this.securityConfig;\n applySecurityHeaders(\n this.headers,\n this.isDev,\n this.nonce,\n this.cspUserHeader,\n cfg,\n this.adapter\n );\n return this;\n}\nfunction withCache(strategy) {\n const cacheControl = buildCacheControl(strategy);\n this.headers.set("cache-control", cacheControl);\n return this;\n}\nfunction withETag(etag) {\n this.headers.set("ETag", etag);\n return this;\n}\nfunction withHeaders(headers) {\n if (headers instanceof Headers) {\n headers.forEach((value, key) => {\n this.headers.set(key, value);\n });\n } else if (Array.isArray(headers)) {\n headers.forEach(([key, value]) => {\n this.headers.set(key, value);\n });\n } else {\n Object.entries(headers).forEach(([key, value]) => {\n this.headers.set(key, value);\n });\n }\n return this;\n}\nfunction withStatus(status) {\n this.status = status;\n return this;\n}\nfunction withAllow(methods) {\n const methodStr = Array.isArray(methods) ? methods.join(", ") : methods;\n this.headers.set("Allow", methodStr);\n this.headers.set("Access-Control-Allow-Methods", methodStr);\n return this;\n}\n\n// src/security/http/response/response-methods.ts\nfunction json(data, status) {\n this.headers.set("content-type", CONTENT_TYPES.JSON);\n return new Response(JSON.stringify(data), {\n status: status ?? this.status,\n headers: this.headers\n });\n}\nfunction text(body, status) {\n this.headers.set("content-type", CONTENT_TYPES.TEXT);\n return new Response(body, {\n status: status ?? this.status,\n headers: this.headers\n });\n}\nfunction html(body, status) {\n this.headers.set("content-type", CONTENT_TYPES.HTML);\n return new Response(body, {\n status: status ?? this.status,\n headers: this.headers\n });\n}\nfunction javascript(code, status) {\n this.headers.set("content-type", CONTENT_TYPES.JAVASCRIPT);\n return new Response(code, {\n status: status ?? this.status,\n headers: this.headers\n });\n}\nfunction withContentType(contentType, body, status) {\n this.headers.set("content-type", contentType);\n return new Response(body, {\n status: status ?? this.status,\n headers: this.headers\n });\n}\nfunction build(body = null, status) {\n return new Response(body, {\n status: status ?? this.status,\n headers: this.headers\n });\n}\nfunction notModified(etag) {\n if (etag) {\n this.headers.set("ETag", etag);\n }\n return new Response(null, {\n status: 304,\n headers: this.headers\n });\n}\n\n// src/security/http/response/static-helpers.ts\ninit_veryfront_error();\nvar ResponseBuilderClass = null;\nfunction setResponseBuilderClass(builderClass) {\n ResponseBuilderClass = builderClass;\n}\nfunction error(status, message, req, config) {\n if (!ResponseBuilderClass) {\n throw toError(createError({\n type: "config",\n message: "ResponseBuilder class not initialized"\n }));\n }\n const builder = new ResponseBuilderClass(config);\n builder.withCORS(req, config?.corsConfig);\n if (config?.securityConfig !== void 0) {\n builder.withSecurity(config.securityConfig ?? void 0);\n }\n const contentType = config?.contentType ?? CONTENT_TYPES.TEXT;\n if (contentType === CONTENT_TYPES.JSON) {\n return builder.json({ error: message }, status);\n } else if (contentType === CONTENT_TYPES.HTML) {\n return builder.html(message, status);\n }\n return builder.text(message, status);\n}\nfunction json2(data, req, config) {\n if (!ResponseBuilderClass) {\n throw toError(createError({\n type: "config",\n message: "ResponseBuilder class not initialized"\n }));\n }\n const builder = new ResponseBuilderClass(config);\n builder.withCORS(req, config?.corsConfig);\n if (config?.securityConfig !== void 0) {\n builder.withSecurity(config.securityConfig ?? void 0);\n }\n if (config?.cache) {\n builder.withCache(config.cache);\n }\n if (config?.etag) {\n builder.withETag(config.etag);\n }\n return builder.json(data, config?.status);\n}\nfunction html2(body, req, config) {\n if (!ResponseBuilderClass) {\n throw toError(createError({\n type: "config",\n message: "ResponseBuilder class not initialized"\n }));\n }\n const builder = new ResponseBuilderClass(config);\n builder.withCORS(req, config?.corsConfig);\n if (config?.securityConfig !== void 0) {\n builder.withSecurity(config.securityConfig ?? void 0);\n }\n if (config?.cache) {\n builder.withCache(config.cache);\n }\n if (config?.etag) {\n builder.withETag(config.etag);\n }\n return builder.html(body, config?.status);\n}\nfunction preflight(req, config) {\n if (!ResponseBuilderClass) {\n throw toError(createError({\n type: "config",\n message: "ResponseBuilder class not initialized"\n }));\n }\n const builder = new ResponseBuilderClass(config);\n builder.withCORS(req, config?.corsConfig);\n if (config?.securityConfig !== void 0) {\n builder.withSecurity(config.securityConfig ?? void 0);\n }\n const methods = config?.allowMethods ?? "GET,POST,PUT,PATCH,DELETE,OPTIONS";\n builder.withAllow(methods);\n const headers = config?.allowHeaders ?? req.headers.get("access-control-request-headers") ?? "Content-Type,Authorization";\n builder.headers.set(\n "Access-Control-Allow-Headers",\n Array.isArray(headers) ? headers.join(", ") : headers\n );\n return builder.build(null, 204);\n}\nfunction stream(streamData, req, config) {\n if (!ResponseBuilderClass) {\n throw toError(createError({\n type: "config",\n message: "ResponseBuilder class not initialized"\n }));\n }\n const builder = new ResponseBuilderClass(config);\n builder.withCORS(req, config?.corsConfig);\n if (config?.securityConfig !== void 0) {\n builder.withSecurity(config.securityConfig ?? void 0);\n }\n if (config?.cache) {\n builder.withCache(config.cache);\n }\n const contentType = config?.contentType ?? "application/octet-stream";\n return builder.withContentType(contentType, streamData);\n}\n\n// src/security/http/response/builder.ts\nvar ResponseBuilder = class {\n constructor(config) {\n this.withCORS = withCORS;\n this.withCORSAsync = withCORSAsync;\n this.withSecurity = withSecurity;\n this.withCache = withCache;\n this.withETag = withETag;\n this.withHeaders = withHeaders;\n this.withStatus = withStatus;\n this.withAllow = withAllow;\n this.json = json;\n this.text = text;\n this.html = html;\n this.javascript = javascript;\n this.withContentType = withContentType;\n this.build = build;\n this.notModified = notModified;\n this.headers = new Headers();\n this.status = 200;\n this.securityConfig = config?.securityConfig ?? null;\n this.isDev = config?.isDev ?? false;\n this.nonce = config?.nonce ?? generateNonce();\n this.cspUserHeader = config?.cspUserHeader ?? null;\n this.adapter = config?.adapter;\n }\n};\nResponseBuilder.error = error;\nResponseBuilder.json = json2;\nResponseBuilder.html = html2;\nResponseBuilder.preflight = preflight;\nResponseBuilder.stream = stream;\nsetResponseBuilderClass(\n ResponseBuilder\n);\n\n// src/security/http/base-handler.ts\ninit_utils();\n\n// src/core/constants/index.ts\ninit_constants();\n\n// src/core/constants/buffers.ts\nvar DEFAULT_MAX_BODY_SIZE_BYTES = 1024 * 1024;\nvar DEFAULT_MAX_FILE_SIZE_BYTES = 5 * 1024 * 1024;\nvar PREFETCH_QUEUE_MAX_SIZE_BYTES = 1024 * 1024;\nvar MAX_BUNDLE_CHUNK_SIZE_BYTES = 4096 * 1024;\n\n// src/core/constants/limits.ts\nvar MAX_URL_LENGTH_FOR_VALIDATION = 2048;\n\n// src/security/input-validation/parsers.ts\nimport { z as z2 } from "zod";\n\n// src/security/input-validation/schemas.ts\nimport { z as z3 } from "zod";\nvar CommonSchemas = {\n /**\n * Valid email address (RFC-compliant, max 255 chars)\n */\n email: z3.string().email().max(255),\n /**\n * Valid UUID v4 identifier\n */\n uuid: z3.string().uuid(),\n /**\n * URL-safe slug (lowercase alphanumeric with hyphens)\n */\n slug: z3.string().regex(/^[a-z0-9-]+$/).min(1).max(100),\n /**\n * Valid HTTP/HTTPS URL (max 2048 chars)\n */\n url: z3.string().url().max(MAX_URL_LENGTH_FOR_VALIDATION),\n /**\n * International phone number (E.164 format)\n */\n phoneNumber: z3.string().regex(/^\\+?[1-9]\\d{1,14}$/),\n /**\n * Pagination parameters with defaults\n */\n pagination: z3.object({\n page: z3.coerce.number().int().positive().default(1),\n limit: z3.coerce.number().int().positive().max(100).default(10),\n sort: z3.string().optional(),\n order: z3.enum(["asc", "desc"]).optional()\n }),\n /**\n * Date range with validation\n */\n dateRange: z3.object({\n from: z3.string().datetime(),\n to: z3.string().datetime()\n }).refine((data) => new Date(data.from) <= new Date(data.to), {\n message: "From date must be before or equal to To date"\n }),\n /**\n * Strong password requirements\n * - Minimum 8 characters\n * - At least one uppercase letter\n * - At least one lowercase letter\n * - At least one number\n * - At least one special character\n */\n strongPassword: z3.string().min(8, "Password must be at least 8 characters").regex(/[A-Z]/, "Password must contain at least one uppercase letter").regex(/[a-z]/, "Password must contain at least one lowercase letter").regex(/[0-9]/, "Password must contain at least one number").regex(/[^A-Za-z0-9]/, "Password must contain at least one special character")\n};\n\n// src/security/http/auth.ts\ninit_veryfront_error();\n\n// src/security/http/config.ts\ninit_config();\ninit_utils();\n\n// src/security/http/middleware/config-loader.ts\ninit_utils();\n\n// src/security/http/middleware/etag.ts\ninit_hash();\n\n// src/security/http/middleware/content-types.ts\ninit_http();\n\n// src/security/path-validation.ts\ninit_utils();\n\n// src/security/secure-fs.ts\ninit_utils();\n\n// src/routing/api/api-route-matcher.ts\ninit_process();\n\n// src/routing/api/module-loader/loader.ts\ninit_utils();\n\n// src/routing/api/module-loader/esbuild-plugin.ts\ninit_utils();\ninit_utils();\ninit_utils();\n\n// src/routing/api/module-loader/http-validator.ts\ninit_veryfront_error();\n\n// src/routing/api/module-loader/security-config.ts\ninit_utils();\ninit_utils();\n\n// src/routing/api/module-loader/loader.ts\ninit_veryfront_error();\n\n// src/platform/compat/fs.ts\ninit_veryfront_error();\ninit_runtime();\n\n// src/routing/api/module-loader/loader.ts\ninit_runtime();\n\n// src/routing/api/route-discovery.ts\ninit_std_path();\n\n// src/core/utils/file-discovery.ts\ninit_std_path();\ninit_deno3();\n\n// src/routing/api/route-executor.ts\ninit_veryfront_error();\n\n// src/routing/api/method-validator.ts\ninit_utils();\n\n// src/routing/api/error-handler.ts\ninit_utils();\ninit_utils();\ninit_utils();\n\n// src/rendering/client/router.ts\nvar VeryfrontRouter = class {\n constructor(options = {}) {\n this.root = null;\n const globalOptions = this.loadGlobalOptions();\n this.options = { ...globalOptions, ...options };\n this.baseUrl = options.baseUrl || globalThis.location.origin;\n this.currentPath = globalThis.location.pathname;\n this.pageLoader = new PageLoader();\n this.navigationHandlers = new NavigationHandlers(\n this.options.prefetchDelay,\n this.options.prefetch\n );\n this.pageTransition = new PageTransition((root) => this.viewportPrefetch.setup(root));\n this.viewportPrefetch = new ViewportPrefetch(\n (path) => this.prefetch(path),\n this.options.prefetch\n );\n this.handleClick = this.navigationHandlers.createClickHandler({\n onNavigate: (url) => this.navigate(url),\n onPrefetch: (url) => this.prefetch(url)\n });\n this.handlePopState = this.navigationHandlers.createPopStateHandler({\n onNavigate: (url) => this.navigate(url, false),\n onPrefetch: (url) => this.prefetch(url)\n });\n this.handleMouseOver = this.navigationHandlers.createMouseOverHandler({\n onNavigate: (url) => this.navigate(url),\n onPrefetch: (url) => this.prefetch(url)\n });\n }\n loadGlobalOptions() {\n try {\n const options = globalThis.__VERYFRONT_ROUTER_OPTS__;\n if (!options) {\n rendererLogger.debug("[router] No global options configured");\n return {};\n }\n return options;\n } catch (error2) {\n rendererLogger.error("[router] Failed to read global options:", error2);\n return {};\n }\n }\n init() {\n rendererLogger.info("Initializing client-side router");\n const rootElement = document.getElementById("root");\n if (!rootElement) {\n rendererLogger.error("Root element not found");\n return;\n }\n const ReactDOMToUse = globalThis.ReactDOM || ReactDOM;\n this.root = ReactDOMToUse.createRoot(rootElement);\n document.addEventListener("click", this.handleClick);\n globalThis.addEventListener("popstate", this.handlePopState);\n document.addEventListener("mouseover", this.handleMouseOver);\n this.viewportPrefetch.setup(document);\n this.cacheCurrentPage();\n }\n cacheCurrentPage() {\n const pageData = extractPageDataFromScript();\n if (pageData) {\n this.pageLoader.setCache(this.currentPath, pageData);\n }\n }\n async navigate(url, pushState = true) {\n rendererLogger.info(`Navigating to ${url}`);\n this.navigationHandlers.saveScrollPosition(this.currentPath);\n this.options.onStart?.(url);\n if (pushState) {\n globalThis.history.pushState({}, "", url);\n }\n await this.loadPage(url);\n this.options.onNavigate?.(url);\n }\n async loadPage(path, updateUI = true) {\n if (this.pageLoader.isCached(path)) {\n rendererLogger.debug(`Loading ${path} from cache`);\n const data = this.pageLoader.getCached(path);\n if (!data) {\n rendererLogger.warn(`[router] Cache entry for ${path} was unexpectedly null, fetching fresh data`);\n } else {\n if (updateUI) {\n this.updatePage(data);\n }\n return;\n }\n }\n this.pageTransition.setLoadingState(true);\n try {\n const data = await this.pageLoader.loadPage(path);\n if (updateUI) {\n this.updatePage(data);\n }\n this.currentPath = path;\n this.options.onComplete?.(path);\n } catch (error2) {\n rendererLogger.error(`Failed to load ${path}`, error2);\n this.options.onError?.(error2);\n this.pageTransition.showError(error2);\n } finally {\n this.pageTransition.setLoadingState(false);\n }\n }\n async prefetch(path) {\n await this.pageLoader.prefetch(path);\n }\n updatePage(data) {\n if (!this.root)\n return;\n const isPopState = this.navigationHandlers.isPopState();\n const scrollY = this.navigationHandlers.getScrollPosition(this.currentPath);\n this.pageTransition.updatePage(data, isPopState, scrollY);\n this.navigationHandlers.clearPopStateFlag();\n }\n destroy() {\n document.removeEventListener("click", this.handleClick);\n globalThis.removeEventListener("popstate", this.handlePopState);\n document.removeEventListener("mouseover", this.handleMouseOver);\n this.viewportPrefetch.disconnect();\n this.pageLoader.clearCache();\n this.navigationHandlers.clear();\n this.pageTransition.destroy();\n }\n};\nif (typeof window !== "undefined" && globalThis.document) {\n const router = new VeryfrontRouter();\n if (document.readyState === "loading") {\n document.addEventListener("DOMContentLoaded", () => router.init());\n } else {\n router.init();\n }\n globalThis.veryFrontRouter = router;\n}\nexport {\n VeryfrontRouter\n};\n';
|
|
13170
|
-
CLIENT_PREFETCH_BUNDLE = '// src/rendering/client/browser-logger.ts\nvar ConditionalBrowserLogger = class {\n constructor(prefix, level) {\n this.prefix = prefix;\n this.level = level;\n }\n debug(message, ...args) {\n if (this.level <= 0 /* DEBUG */) {\n console.debug?.(`[${this.prefix}] DEBUG: ${message}`, ...args);\n }\n }\n info(message, ...args) {\n if (this.level <= 1 /* INFO */) {\n console.log?.(`[${this.prefix}] ${message}`, ...args);\n }\n }\n warn(message, ...args) {\n if (this.level <= 2 /* WARN */) {\n console.warn?.(`[${this.prefix}] WARN: ${message}`, ...args);\n }\n }\n error(message, ...args) {\n if (this.level <= 3 /* ERROR */) {\n console.error?.(`[${this.prefix}] ERROR: ${message}`, ...args);\n }\n }\n};\nfunction getBrowserLogLevel() {\n if (typeof window === "undefined") {\n return 2 /* WARN */;\n }\n const windowObject = window;\n const isDevelopment = windowObject.__VERYFRONT_DEV__ || windowObject.__RSC_DEV__;\n if (!isDevelopment) {\n return 2 /* WARN */;\n }\n const isDebugEnabled = windowObject.__VERYFRONT_DEBUG__ || windowObject.__RSC_DEBUG__;\n return isDebugEnabled ? 0 /* DEBUG */ : 1 /* INFO */;\n}\nvar defaultLevel = getBrowserLogLevel();\nvar rscLogger = new ConditionalBrowserLogger("RSC", defaultLevel);\nvar prefetchLogger = new ConditionalBrowserLogger("PREFETCH", defaultLevel);\nvar hydrateLogger = new ConditionalBrowserLogger("HYDRATE", defaultLevel);\nvar browserLogger = new ConditionalBrowserLogger("VERYFRONT", defaultLevel);\n\n// src/rendering/client/prefetch/link-observer.ts\nvar LinkObserver = class {\n constructor(options, prefetchedUrls) {\n this.intersectionObserver = null;\n this.mutationObserver = null;\n this.pendingTimeouts = /* @__PURE__ */ new Map();\n this.elementTimeoutMap = /* @__PURE__ */ new WeakMap();\n this.timeoutCounter = 0;\n this.options = options;\n this.prefetchedUrls = prefetchedUrls;\n }\n init() {\n this.createIntersectionObserver();\n this.observeLinks();\n this.setupMutationObserver();\n }\n createIntersectionObserver() {\n this.intersectionObserver = new IntersectionObserver(\n (entries) => this.handleIntersection(entries),\n { rootMargin: this.options.rootMargin }\n );\n }\n handleIntersection(entries) {\n for (const entry of entries) {\n if (entry.isIntersecting) {\n const target = entry.target;\n let isAnchor = false;\n if (typeof HTMLAnchorElement !== "undefined") {\n isAnchor = target instanceof HTMLAnchorElement;\n } else {\n isAnchor = target.tagName === "A";\n }\n if (!isAnchor) {\n continue;\n }\n const link = target;\n const timeoutKey = this.timeoutCounter++;\n const timeoutId = setTimeout(() => {\n this.pendingTimeouts.delete(timeoutKey);\n this.elementTimeoutMap.delete(link);\n this.options.onLinkVisible(link);\n }, this.options.delay);\n this.pendingTimeouts.set(timeoutKey, timeoutId);\n this.elementTimeoutMap.set(link, timeoutKey);\n }\n }\n }\n observeLinks() {\n const links = document.querySelectorAll(\'a[href^="/"], a[href^="./"]\');\n links.forEach((link) => {\n if (this.isValidLink(link)) {\n this.intersectionObserver?.observe(link);\n }\n });\n }\n setupMutationObserver() {\n this.mutationObserver = new MutationObserver((mutations) => {\n for (const mutation of mutations) {\n if (mutation.type === "childList") {\n mutation.addedNodes.forEach((node) => {\n if (node.nodeType === Node.ELEMENT_NODE) {\n this.observeElement(node);\n }\n });\n mutation.removedNodes.forEach((node) => {\n if (node.nodeType === Node.ELEMENT_NODE) {\n this.clearElementTimeouts(node);\n }\n });\n }\n }\n });\n this.mutationObserver.observe(document.body, {\n childList: true,\n subtree: true\n });\n }\n clearElementTimeouts(element) {\n if (element.tagName === "A") {\n const timeoutKey = this.elementTimeoutMap.get(element);\n if (timeoutKey !== void 0) {\n const timeoutId = this.pendingTimeouts.get(timeoutKey);\n if (timeoutId) {\n clearTimeout(timeoutId);\n this.pendingTimeouts.delete(timeoutKey);\n }\n this.elementTimeoutMap.delete(element);\n }\n }\n const links = element.querySelectorAll("a");\n links.forEach((link) => {\n const timeoutKey = this.elementTimeoutMap.get(link);\n if (timeoutKey !== void 0) {\n const timeoutId = this.pendingTimeouts.get(timeoutKey);\n if (timeoutId) {\n clearTimeout(timeoutId);\n this.pendingTimeouts.delete(timeoutKey);\n }\n this.elementTimeoutMap.delete(link);\n }\n });\n }\n observeElement(element) {\n const isAnchor = typeof HTMLAnchorElement !== "undefined" ? element instanceof HTMLAnchorElement : element.tagName === "A";\n if (isAnchor && this.isValidLink(element)) {\n this.intersectionObserver?.observe(element);\n }\n const links = element.querySelectorAll(\'a[href^="/"], a[href^="./"]\');\n links.forEach((link) => {\n const isLinkAnchor = typeof HTMLAnchorElement !== "undefined" ? link instanceof HTMLAnchorElement : link.tagName === "A";\n if (isLinkAnchor && this.isValidLink(link)) {\n this.intersectionObserver?.observe(link);\n }\n });\n }\n isValidLink(link) {\n if (link.hostname !== globalThis.location.hostname)\n return false;\n if (link.hasAttribute("download"))\n return false;\n if (link.target === "_blank")\n return false;\n const url = link.href;\n if (this.prefetchedUrls.has(url))\n return false;\n if (url === globalThis.location.href)\n return false;\n if (link.hash && link.pathname === globalThis.location.pathname) {\n return false;\n }\n if (link.dataset.noPrefetch)\n return false;\n return true;\n }\n destroy() {\n for (const [_, timeoutId] of this.pendingTimeouts) {\n clearTimeout(timeoutId);\n }\n this.pendingTimeouts.clear();\n if (this.intersectionObserver) {\n this.intersectionObserver.disconnect();\n this.intersectionObserver = null;\n }\n if (this.mutationObserver) {\n this.mutationObserver.disconnect();\n this.mutationObserver = null;\n }\n }\n};\n\n// src/rendering/client/prefetch/network-utils.ts\nvar NetworkUtils = class {\n constructor(allowedNetworks = ["4g", "wifi", "ethernet"]) {\n this.allowedNetworks = allowedNetworks;\n this.networkInfo = this.getNetworkConnection();\n }\n getNavigatorWithConnection() {\n if (typeof globalThis.navigator === "undefined") {\n return null;\n }\n return globalThis.navigator;\n }\n getNetworkConnection() {\n const nav = this.getNavigatorWithConnection();\n return nav?.connection || nav?.mozConnection || nav?.webkitConnection || null;\n }\n shouldPrefetch() {\n const nav = this.getNavigatorWithConnection();\n if (nav?.connection?.saveData) {\n return false;\n }\n if (this.networkInfo) {\n const effectiveType = this.networkInfo.effectiveType;\n if (effectiveType !== void 0 && !this.allowedNetworks.includes(effectiveType)) {\n return false;\n }\n }\n return true;\n }\n onNetworkChange(callback) {\n if (this.networkInfo?.addEventListener) {\n this.networkInfo.addEventListener("change", callback);\n }\n }\n getNetworkInfo() {\n return this.networkInfo;\n }\n};\n\n// src/core/utils/constants/cache.ts\nvar SECONDS_PER_MINUTE = 60;\nvar MINUTES_PER_HOUR = 60;\nvar HOURS_PER_DAY = 24;\nvar MS_PER_SECOND = 1e3;\nvar COMPONENT_LOADER_TTL_MS = 10 * SECONDS_PER_MINUTE * MS_PER_SECOND;\nvar MDX_RENDERER_TTL_MS = 10 * SECONDS_PER_MINUTE * MS_PER_SECOND;\nvar RENDERER_CORE_TTL_MS = 5 * SECONDS_PER_MINUTE * MS_PER_SECOND;\nvar TSX_LAYOUT_TTL_MS = 10 * SECONDS_PER_MINUTE * MS_PER_SECOND;\nvar DATA_FETCHING_TTL_MS = 10 * SECONDS_PER_MINUTE * MS_PER_SECOND;\nvar MDX_CACHE_TTL_PRODUCTION_MS = HOURS_PER_DAY * MINUTES_PER_HOUR * SECONDS_PER_MINUTE * MS_PER_SECOND;\nvar MDX_CACHE_TTL_DEVELOPMENT_MS = 5 * SECONDS_PER_MINUTE * MS_PER_SECOND;\nvar BUNDLE_CACHE_TTL_PRODUCTION_MS = HOURS_PER_DAY * MINUTES_PER_HOUR * SECONDS_PER_MINUTE * MS_PER_SECOND;\nvar BUNDLE_CACHE_TTL_DEVELOPMENT_MS = 5 * SECONDS_PER_MINUTE * MS_PER_SECOND;\nvar BUNDLE_MANIFEST_PROD_TTL_MS = 7 * HOURS_PER_DAY * MINUTES_PER_HOUR * SECONDS_PER_MINUTE * MS_PER_SECOND;\nvar BUNDLE_MANIFEST_DEV_TTL_MS = MINUTES_PER_HOUR * SECONDS_PER_MINUTE * MS_PER_SECOND;\nvar SERVER_ACTION_DEFAULT_TTL_SEC = MINUTES_PER_HOUR * SECONDS_PER_MINUTE;\nvar ONE_DAY_MS = HOURS_PER_DAY * MINUTES_PER_HOUR * SECONDS_PER_MINUTE * MS_PER_SECOND;\nvar LRU_DEFAULT_MAX_SIZE_BYTES = 50 * 1024 * 1024;\n\n// deno.json\nvar deno_default = {\n name: "veryfront",\n version: "0.0.49",\n exclude: [\n "npm/",\n "dist/",\n "coverage/",\n "scripts/",\n "examples/",\n "tests/",\n "src/cli/templates/files/"\n ],\n exports: {\n ".": "./src/index.ts",\n "./cli": "./src/cli/main.ts",\n "./server": "./src/server/index.ts",\n "./middleware": "./src/middleware/index.ts",\n "./components": "./src/react/components/index.ts",\n "./data": "./src/data/index.ts",\n "./config": "./src/core/config/index.ts",\n "./platform": "./src/platform/index.ts",\n "./ai": "./src/ai/index.ts",\n "./ai/client": "./src/ai/client.ts",\n "./ai/react": "./src/ai/react/index.ts",\n "./ai/primitives": "./src/ai/react/primitives/index.ts",\n "./ai/components": "./src/ai/react/components/index.ts",\n "./ai/production": "./src/ai/production/index.ts",\n "./ai/dev": "./src/ai/dev/index.ts",\n "./ai/workflow": "./src/ai/workflow/index.ts",\n "./ai/workflow/react": "./src/ai/workflow/react/index.ts"\n },\n imports: {\n "@veryfront": "./src/index.ts",\n "@veryfront/": "./src/",\n "@veryfront/ai": "./src/ai/index.ts",\n "@veryfront/ai/": "./src/ai/",\n "@veryfront/platform": "./src/platform/index.ts",\n "@veryfront/platform/": "./src/platform/",\n "@veryfront/types": "./src/core/types/index.ts",\n "@veryfront/types/": "./src/core/types/",\n "@veryfront/utils": "./src/core/utils/index.ts",\n "@veryfront/utils/": "./src/core/utils/",\n "@veryfront/middleware": "./src/middleware/index.ts",\n "@veryfront/middleware/": "./src/middleware/",\n "@veryfront/errors": "./src/core/errors/index.ts",\n "@veryfront/errors/": "./src/core/errors/",\n "@veryfront/config": "./src/core/config/index.ts",\n "@veryfront/config/": "./src/core/config/",\n "@veryfront/observability": "./src/observability/index.ts",\n "@veryfront/observability/": "./src/observability/",\n "@veryfront/routing": "./src/routing/index.ts",\n "@veryfront/routing/": "./src/routing/",\n "@veryfront/transforms": "./src/build/transforms/index.ts",\n "@veryfront/transforms/": "./src/build/transforms/",\n "@veryfront/data": "./src/data/index.ts",\n "@veryfront/data/": "./src/data/",\n "@veryfront/security": "./src/security/index.ts",\n "@veryfront/security/": "./src/security/",\n "@veryfront/components": "./src/react/components/index.ts",\n "@veryfront/react": "./src/react/index.ts",\n "@veryfront/react/": "./src/react/",\n "@veryfront/html": "./src/html/index.ts",\n "@veryfront/html/": "./src/html/",\n "@veryfront/rendering": "./src/rendering/index.ts",\n "@veryfront/rendering/": "./src/rendering/",\n "@veryfront/build": "./src/build/index.ts",\n "@veryfront/build/": "./src/build/",\n "@veryfront/server": "./src/server/index.ts",\n "@veryfront/server/": "./src/server/",\n "@veryfront/modules": "./src/module-system/index.ts",\n "@veryfront/modules/": "./src/module-system/",\n "@veryfront/compat/console": "./src/platform/compat/console/index.ts",\n "@veryfront/compat/": "./src/platform/compat/",\n "std/": "https://deno.land/std@0.220.0/",\n "@std/path": "https://deno.land/std@0.220.0/path/mod.ts",\n "@std/testing/bdd.ts": "https://deno.land/std@0.220.0/testing/bdd.ts",\n "@std/expect": "https://deno.land/std@0.220.0/expect/mod.ts",\n csstype: "https://esm.sh/csstype@3.2.3",\n "@types/react": "https://esm.sh/@types/react@18.3.27?deps=csstype@3.2.3",\n "@types/react-dom": "https://esm.sh/@types/react-dom@18.3.7?deps=csstype@3.2.3",\n react: "https://esm.sh/react@18.3.1",\n "react-dom": "https://esm.sh/react-dom@18.3.1",\n "react-dom/server": "https://esm.sh/react-dom@18.3.1/server",\n "react-dom/client": "https://esm.sh/react-dom@18.3.1/client",\n "react/jsx-runtime": "https://esm.sh/react@18.3.1/jsx-runtime",\n "react/jsx-dev-runtime": "https://esm.sh/react@18.3.1/jsx-dev-runtime",\n "@mdx-js/mdx": "https://esm.sh/@mdx-js/mdx@3.0.0?deps=react@18.3.1,react-dom@18.3.1",\n "@mdx-js/react": "https://esm.sh/@mdx-js/react@3.0.0?deps=react@18.3.1,react-dom@18.3.1",\n "unist-util-visit": "https://esm.sh/unist-util-visit@5.0.0",\n "mdast-util-to-string": "https://esm.sh/mdast-util-to-string@4.0.0",\n "github-slugger": "https://esm.sh/github-slugger@2.0.0",\n "remark-gfm": "https://esm.sh/remark-gfm@4.0.1",\n "remark-frontmatter": "https://esm.sh/remark-frontmatter@5.0.0",\n "rehype-highlight": "https://esm.sh/rehype-highlight@7.0.2",\n "rehype-slug": "https://esm.sh/rehype-slug@6.0.0",\n esbuild: "https://deno.land/x/esbuild@v0.20.1/wasm.js",\n "esbuild/mod.js": "https://deno.land/x/esbuild@v0.20.1/mod.js",\n "es-module-lexer": "https://esm.sh/es-module-lexer@1.5.0",\n zod: "https://esm.sh/zod@3.22.0",\n "mime-types": "https://esm.sh/mime-types@2.1.35",\n mdast: "https://esm.sh/@types/mdast@4.0.3",\n hast: "https://esm.sh/@types/hast@3.0.3",\n unist: "https://esm.sh/@types/unist@3.0.2",\n unified: "https://esm.sh/unified@11.0.5?dts",\n ai: "https://esm.sh/ai@5.0.76?deps=react@18.3.1,react-dom@18.3.1",\n "ai/react": "https://esm.sh/@ai-sdk/react@2.0.59?deps=react@18.3.1,react-dom@18.3.1",\n "@ai-sdk/react": "https://esm.sh/@ai-sdk/react@2.0.59?deps=react@18.3.1,react-dom@18.3.1",\n "@ai-sdk/openai": "https://esm.sh/@ai-sdk/openai@2.0.1",\n "@ai-sdk/anthropic": "https://esm.sh/@ai-sdk/anthropic@2.0.4",\n unocss: "https://esm.sh/unocss@0.59.0",\n "@unocss/core": "https://esm.sh/@unocss/core@0.59.0",\n "@unocss/preset-wind": "https://esm.sh/@unocss/preset-wind@0.59.0",\n redis: "npm:redis"\n },\n compilerOptions: {\n jsx: "react-jsx",\n jsxImportSource: "react",\n strict: true,\n noImplicitAny: true,\n noUncheckedIndexedAccess: true,\n types: [],\n lib: [\n "deno.window",\n "dom",\n "dom.iterable",\n "dom.asynciterable",\n "deno.ns"\n ]\n },\n tasks: {\n setup: "deno run --allow-all scripts/setup.ts",\n dev: "deno run --allow-all --no-lock --unstable-net --unstable-worker-options src/cli/main.ts dev",\n build: "deno compile --allow-all --output ../../bin/veryfront src/cli/main.ts",\n "build:npm": "deno run -A scripts/build-npm.ts",\n release: "deno run -A scripts/release.ts",\n test: "DENO_JOBS=1 deno test --parallel --fail-fast --allow-all --unstable-worker-options --unstable-net",\n "test:unit": "DENO_JOBS=1 deno test --parallel --allow-all --v8-flags=--max-old-space-size=8192 --ignore=tests --unstable-worker-options --unstable-net",\n "test:integration": "DENO_JOBS=1 deno test --parallel --fail-fast --allow-all tests --unstable-worker-options --unstable-net",\n "test:coverage": "rm -rf coverage && DENO_JOBS=1 deno test --parallel --fail-fast --allow-all --coverage=coverage --unstable-worker-options --unstable-net || exit 1",\n "test:coverage:unit": "rm -rf coverage && DENO_JOBS=1 deno test --parallel --fail-fast --allow-all --coverage=coverage --ignore=tests --unstable-worker-options --unstable-net || exit 1",\n "test:coverage:integration": "rm -rf coverage && DENO_JOBS=1 deno test --parallel --fail-fast --allow-all --coverage=coverage tests --unstable-worker-options --unstable-net || exit 1",\n "coverage:report": "deno coverage coverage --include=src/ --exclude=tests --exclude=src/**/*_test.ts --exclude=src/**/*_test.tsx --exclude=src/**/*.test.ts --exclude=src/**/*.test.tsx --lcov > coverage/lcov.info && deno run --allow-read scripts/check-coverage.ts 80",\n "coverage:html": "deno coverage coverage --include=src/ --exclude=tests --exclude=src/**/*_test.ts --exclude=src/**/*_test.tsx --exclude=src/**/*.test.ts --exclude=src/**/*.test.tsx --html",\n lint: "DENO_NO_PACKAGE_JSON=1 deno lint src/",\n fmt: "deno fmt src/",\n typecheck: "deno check src/index.ts src/cli/main.ts src/server/index.ts src/routing/api/index.ts src/rendering/index.ts src/platform/index.ts src/platform/adapters/index.ts src/build/index.ts src/build/production-build/index.ts src/build/transforms/index.ts src/core/config/index.ts src/core/utils/index.ts src/data/index.ts src/security/index.ts src/middleware/index.ts src/server/handlers/dev/index.ts src/server/handlers/request/api/index.ts src/rendering/cache/index.ts src/rendering/cache/stores/index.ts src/rendering/rsc/actions/index.ts src/html/index.ts src/module-system/index.ts",\n "docs:check-links": "deno run -A scripts/check-doc-links.ts",\n "lint:ban-console": "deno run --allow-read scripts/ban-console.ts",\n "lint:ban-deep-imports": "deno run --allow-read scripts/ban-deep-imports.ts",\n "lint:ban-internal-root-imports": "deno run --allow-read scripts/ban-internal-root-imports.ts",\n "lint:check-awaits": "deno run --allow-read scripts/check-unawaited-promises.ts",\n "lint:platform": "deno run --allow-read scripts/lint-platform-agnostic.ts",\n "check:circular": "deno run -A jsr:@cunarist/deno-circular-deps src/index.ts"\n },\n lint: {\n include: [\n "src/**/*.ts",\n "src/**/*.tsx"\n ],\n exclude: [\n "dist/",\n "coverage/"\n ],\n rules: {\n tags: [\n "recommended"\n ],\n include: [\n "ban-untagged-todo"\n ],\n exclude: [\n "no-explicit-any",\n "no-process-global",\n "no-console"\n ]\n }\n },\n fmt: {\n include: [\n "src/**/*.ts",\n "src/**/*.tsx"\n ],\n exclude: [\n "dist/",\n "coverage/"\n ],\n options: {\n useTabs: false,\n lineWidth: 100,\n indentWidth: 2,\n semiColons: true,\n singleQuote: false,\n proseWrap: "preserve"\n }\n }\n};\n\n// src/platform/compat/runtime.ts\nvar isDeno = typeof Deno !== "undefined";\nvar isNode = typeof globalThis.process !== "undefined" && globalThis.process?.versions?.node !== void 0;\nvar isBun = typeof globalThis.Bun !== "undefined";\nvar isCloudflare = typeof globalThis !== "undefined" && "caches" in globalThis && "WebSocketPair" in globalThis;\n\n// src/platform/compat/process.ts\nvar nodeProcess = globalThis.process;\nvar hasNodeProcess = !!nodeProcess?.versions?.node;\nfunction getEnv(key) {\n if (isDeno) {\n return Deno.env.get(key);\n }\n if (hasNodeProcess) {\n return nodeProcess.env[key];\n }\n return void 0;\n}\n\n// src/core/utils/version.ts\nvar VERSION = getEnv("VERYFRONT_VERSION") || (typeof deno_default.version === "string" ? deno_default.version : "0.0.0");\n\n// src/core/utils/constants/http.ts\nvar KB_IN_BYTES = 1024;\nvar PREFETCH_MAX_SIZE_BYTES = 200 * KB_IN_BYTES;\nvar PREFETCH_DEFAULT_TIMEOUT_MS = 1e4;\nvar PREFETCH_DEFAULT_DELAY_MS = 200;\n\n// src/core/utils/constants/hmr.ts\nvar HMR_MAX_MESSAGE_SIZE_BYTES = 1024 * KB_IN_BYTES;\n\n// src/core/utils/constants/network.ts\nvar BYTES_PER_MB = 1024 * 1024;\n\n// src/core/utils/constants/server.ts\nvar INTERNAL_PREFIX = "/_veryfront";\nvar INTERNAL_PATH_PREFIXES = {\n /** React Server Components endpoints */\n RSC: `${INTERNAL_PREFIX}/rsc/`,\n /** File system access endpoints (base64 encoded paths) */\n FS: `${INTERNAL_PREFIX}/fs/`,\n /** Virtual module system */\n MODULES: `${INTERNAL_PREFIX}/modules/`,\n /** Generated page modules */\n PAGES: `${INTERNAL_PREFIX}/pages/`,\n /** Data JSON endpoints */\n DATA: `${INTERNAL_PREFIX}/data/`,\n /** Library modules (AI SDK, etc.) */\n LIB: `${INTERNAL_PREFIX}/lib/`,\n /** Chunk assets */\n CHUNKS: `${INTERNAL_PREFIX}/chunks/`,\n /** Client component modules */\n CLIENT: `${INTERNAL_PREFIX}/client/`\n};\nvar INTERNAL_ENDPOINTS = {\n // Development endpoints\n HMR_RUNTIME: `${INTERNAL_PREFIX}/hmr-runtime.js`,\n HMR: `${INTERNAL_PREFIX}/hmr.js`,\n HYDRATE: `${INTERNAL_PREFIX}/hydrate.js`,\n ERROR_OVERLAY: `${INTERNAL_PREFIX}/error-overlay.js`,\n DEV_LOADER: `${INTERNAL_PREFIX}/dev-loader.js`,\n CLIENT_LOG: `${INTERNAL_PREFIX}/log`,\n // Production endpoints\n CLIENT_JS: `${INTERNAL_PREFIX}/client.js`,\n ROUTER_JS: `${INTERNAL_PREFIX}/router.js`,\n PREFETCH_JS: `${INTERNAL_PREFIX}/prefetch.js`,\n MANIFEST_JSON: `${INTERNAL_PREFIX}/manifest.json`,\n APP_JS: `${INTERNAL_PREFIX}/app.js`,\n // RSC endpoints\n RSC_CLIENT: `${INTERNAL_PREFIX}/rsc/client.js`,\n RSC_MANIFEST: `${INTERNAL_PREFIX}/rsc/manifest`,\n RSC_STREAM: `${INTERNAL_PREFIX}/rsc/stream`,\n RSC_PAYLOAD: `${INTERNAL_PREFIX}/rsc/payload`,\n RSC_RENDER: `${INTERNAL_PREFIX}/rsc/render`,\n RSC_PAGE: `${INTERNAL_PREFIX}/rsc/page`,\n RSC_MODULE: `${INTERNAL_PREFIX}/rsc/module`,\n RSC_DOM: `${INTERNAL_PREFIX}/rsc/dom.js`,\n RSC_HYDRATOR: `${INTERNAL_PREFIX}/rsc/hydrator.js`,\n RSC_HYDRATE_CLIENT: `${INTERNAL_PREFIX}/rsc/hydrate-client.js`,\n // Library module endpoints\n LIB_AI_REACT: `${INTERNAL_PREFIX}/lib/ai/react.js`,\n LIB_AI_COMPONENTS: `${INTERNAL_PREFIX}/lib/ai/components.js`,\n LIB_AI_PRIMITIVES: `${INTERNAL_PREFIX}/lib/ai/primitives.js`\n};\nvar BUILD_DIRS = {\n /** Main build output directory */\n ROOT: "_veryfront",\n /** Chunks directory */\n CHUNKS: "_veryfront/chunks",\n /** Data directory */\n DATA: "_veryfront/data",\n /** Assets directory */\n ASSETS: "_veryfront/assets"\n};\nvar PROJECT_DIRS = {\n /** Base veryfront internal directory */\n ROOT: ".veryfront",\n /** Cache directory for build artifacts, transforms, etc. */\n CACHE: ".veryfront/cache",\n /** KV store directory */\n KV: ".veryfront/kv",\n /** Log files directory */\n LOGS: ".veryfront/logs",\n /** Temporary files directory */\n TMP: ".veryfront/tmp"\n};\nvar DEFAULT_CACHE_DIR = PROJECT_DIRS.CACHE;\nvar DEV_SERVER_ENDPOINTS = {\n HMR_RUNTIME: INTERNAL_ENDPOINTS.HMR_RUNTIME,\n ERROR_OVERLAY: INTERNAL_ENDPOINTS.ERROR_OVERLAY\n};\n\n// src/core/constants/buffers.ts\nvar DEFAULT_MAX_BODY_SIZE_BYTES = 1024 * 1024;\nvar DEFAULT_MAX_FILE_SIZE_BYTES = 5 * 1024 * 1024;\nvar PREFETCH_QUEUE_MAX_SIZE_BYTES = 1024 * 1024;\nvar MAX_BUNDLE_CHUNK_SIZE_BYTES = 4096 * 1024;\n\n// src/rendering/client/prefetch/prefetch-queue.ts\nvar DEFAULT_OPTIONS = {\n maxConcurrent: 4,\n maxSize: PREFETCH_QUEUE_MAX_SIZE_BYTES,\n timeout: 5e3\n};\nfunction isAbortError(error) {\n return Boolean(\n error && typeof error === "object" && "name" in error && error.name === "AbortError"\n );\n}\nvar PrefetchQueue = class {\n constructor(options = {}, prefetchedUrls) {\n this.controllers = /* @__PURE__ */ new Map();\n this.concurrent = 0;\n this.stopped = false;\n this.options = { ...DEFAULT_OPTIONS, ...options };\n this.prefetchedUrls = prefetchedUrls ?? /* @__PURE__ */ new Set();\n }\n setResourceCallback(callback) {\n this.onResourcesFetched = callback;\n }\n enqueue(url) {\n void this.prefetch(url);\n }\n has(url) {\n return this.prefetchedUrls.has(url) || this.controllers.has(url);\n }\n get size() {\n return this.getQueueSize();\n }\n clear() {\n this.stopAll();\n this.prefetchedUrls.clear();\n }\n start() {\n this.stopped = false;\n }\n stop() {\n this.stopped = true;\n this.stopAll();\n }\n getQueueSize() {\n return this.controllers.size;\n }\n getConcurrentCount() {\n return this.concurrent;\n }\n async prefetchLink(link) {\n if (this.stopped) {\n return;\n }\n const url = link.href;\n if (!url || this.controllers.has(url) || this.prefetchedUrls.has(url)) {\n return;\n }\n if (this.concurrent >= this.options.maxConcurrent) {\n prefetchLogger.debug?.(`Prefetch queue full, skipping ${url}`);\n return;\n }\n let parsedUrl;\n try {\n parsedUrl = new URL(url);\n } catch (_error) {\n prefetchLogger.debug?.(`Invalid prefetch URL ${url}`);\n return;\n }\n const controller = new AbortController();\n this.controllers.set(url, controller);\n this.concurrent += 1;\n const timeoutId = this.options.timeout > 0 ? setTimeout(() => controller.abort(), this.options.timeout) : void 0;\n try {\n const response = await fetch(parsedUrl.toString(), {\n method: "GET",\n signal: controller.signal,\n headers: { "X-Veryfront-Prefetch": "1" }\n });\n if (!response.ok) {\n return;\n }\n if (this.isResponseTooLarge(response)) {\n prefetchLogger.debug?.(`Prefetch too large, skipping ${url}`);\n return;\n }\n this.prefetchedUrls.add(url);\n if (this.onResourcesFetched) {\n try {\n await this.onResourcesFetched(response, url);\n } catch (callbackError) {\n prefetchLogger.error?.(`Prefetch callback failed for ${url}`, callbackError);\n }\n }\n } catch (error) {\n if (!isAbortError(error)) {\n prefetchLogger.error?.(`Failed to prefetch ${url}`, error);\n }\n } finally {\n if (timeoutId !== void 0) {\n clearTimeout(timeoutId);\n }\n this.controllers.delete(url);\n this.concurrent = Math.max(0, this.concurrent - 1);\n }\n }\n async prefetch(url) {\n const link = typeof document !== "undefined" ? document.createElement("a") : { href: url };\n link.href = url;\n await this.prefetchLink(link);\n }\n stopAll() {\n for (const controller of this.controllers.values()) {\n controller.abort();\n }\n this.controllers.clear();\n this.concurrent = 0;\n }\n isResponseTooLarge(response) {\n const rawLength = response.headers.get("content-length");\n if (rawLength === null) {\n return false;\n }\n const size = Number.parseInt(rawLength, 10);\n if (!Number.isFinite(size)) {\n return false;\n }\n return size > this.options.maxSize;\n }\n};\nvar prefetchQueue = new PrefetchQueue();\n\n// src/rendering/client/prefetch/resource-hints.ts\nvar ResourceHintsManager = class {\n constructor() {\n this.appliedHints = /* @__PURE__ */ new Set();\n }\n applyResourceHints(hints) {\n for (const hint of hints) {\n const key = `${hint.type}:${hint.href}`;\n if (this.appliedHints.has(key))\n continue;\n const existing = document.querySelector(`link[rel="${hint.type}"][href="${hint.href}"]`);\n if (existing) {\n this.appliedHints.add(key);\n continue;\n }\n this.createAndAppendHint(hint);\n this.appliedHints.add(key);\n prefetchLogger.debug(`Added resource hint: ${hint.type} ${hint.href}`);\n }\n }\n createAndAppendHint(hint) {\n if (!document.head) {\n prefetchLogger.warn("document.head is not available, skipping resource hint");\n return;\n }\n const link = document.createElement("link");\n link.rel = hint.type;\n link.href = hint.href;\n if (hint.as)\n link.setAttribute("as", hint.as);\n if (hint.crossOrigin)\n link.setAttribute("crossorigin", hint.crossOrigin);\n if (hint.media)\n link.setAttribute("media", hint.media);\n document.head.appendChild(link);\n }\n extractResourceHints(html, prefetchedUrls) {\n try {\n const parser = new DOMParser();\n const doc = parser.parseFromString(html, "text/html");\n const hints = [];\n this.extractPreloadLinks(doc, prefetchedUrls, hints);\n this.extractScripts(doc, prefetchedUrls, hints);\n this.extractStylesheets(doc, prefetchedUrls, hints);\n return hints;\n } catch (error) {\n prefetchLogger.error("Failed to parse prefetched page", error);\n return [];\n }\n }\n isValidResourceHintType(rel) {\n return rel === "prefetch" || rel === "preload" || rel === "preconnect" || rel === "dns-prefetch";\n }\n extractPreloadLinks(doc, prefetchedUrls, hints) {\n doc.querySelectorAll(\'link[rel="preload"], link[rel="prefetch"]\').forEach((link) => {\n const htmlLink = link;\n const href = htmlLink.href;\n if (href && !prefetchedUrls.has(href) && this.isValidResourceHintType(htmlLink.rel)) {\n hints.push({\n type: htmlLink.rel,\n href,\n as: htmlLink.getAttribute("as") || void 0\n });\n }\n });\n }\n extractScripts(doc, prefetchedUrls, hints) {\n doc.querySelectorAll("script[src]").forEach((script) => {\n const src = script.src;\n if (src && !prefetchedUrls.has(src)) {\n hints.push({ type: "prefetch", href: src, as: "script" });\n }\n });\n }\n extractStylesheets(doc, prefetchedUrls, hints) {\n doc.querySelectorAll(\'link[rel="stylesheet"]\').forEach((link) => {\n const href = link.href;\n if (href && !prefetchedUrls.has(href)) {\n hints.push({ type: "prefetch", href, as: "style" });\n }\n });\n }\n static generateResourceHints(_route, assets) {\n const hints = [\n \'<link rel="dns-prefetch" href="https://cdn.jsdelivr.net">\',\n \'<link rel="dns-prefetch" href="https://esm.sh">\',\n \'<link rel="preconnect" href="https://cdn.jsdelivr.net" crossorigin>\'\n ];\n for (const asset of assets) {\n if (asset.endsWith(".js")) {\n hints.push(`<link rel="modulepreload" href="${asset}">`);\n } else if (asset.endsWith(".css")) {\n hints.push(`<link rel="preload" as="style" href="${asset}">`);\n } else if (asset.match(/\\.(woff2?|ttf|otf)$/)) {\n hints.push(`<link rel="preload" as="font" href="${asset}" crossorigin>`);\n }\n }\n return hints.join("\\n");\n }\n};\n\n// src/core/utils/runtime-guards.ts\nfunction hasDenoRuntime(global) {\n return typeof global === "object" && global !== null && "Deno" in global && typeof global.Deno?.env?.get === "function";\n}\nfunction hasNodeProcess2(global) {\n return typeof global === "object" && global !== null && "process" in global && typeof global.process?.env === "object";\n}\n\n// src/core/utils/logger/env.ts\nfunction getEnvironmentVariable(name) {\n try {\n if (typeof Deno !== "undefined" && hasDenoRuntime(globalThis)) {\n const value = globalThis.Deno?.env.get(name);\n return value === "" ? void 0 : value;\n }\n if (hasNodeProcess2(globalThis)) {\n const value = globalThis.process?.env[name];\n return value === "" ? void 0 : value;\n }\n } catch {\n return void 0;\n }\n return void 0;\n}\n\n// src/core/utils/logger/logger.ts\nvar cachedLogLevel;\nfunction resolveLogLevel(force = false) {\n if (force || cachedLogLevel === void 0) {\n cachedLogLevel = getDefaultLevel();\n }\n return cachedLogLevel;\n}\nvar ConsoleLogger = class {\n constructor(prefix, level = resolveLogLevel()) {\n this.prefix = prefix;\n this.level = level;\n }\n setLevel(level) {\n this.level = level;\n }\n getLevel() {\n return this.level;\n }\n debug(message, ...args) {\n if (this.level <= 0 /* DEBUG */) {\n console.debug(`[${this.prefix}] DEBUG: ${message}`, ...args);\n }\n }\n info(message, ...args) {\n if (this.level <= 1 /* INFO */) {\n console.log(`[${this.prefix}] ${message}`, ...args);\n }\n }\n warn(message, ...args) {\n if (this.level <= 2 /* WARN */) {\n console.warn(`[${this.prefix}] WARN: ${message}`, ...args);\n }\n }\n error(message, ...args) {\n if (this.level <= 3 /* ERROR */) {\n console.error(`[${this.prefix}] ERROR: ${message}`, ...args);\n }\n }\n async time(label, fn) {\n const start = performance.now();\n try {\n const result = await fn();\n const end = performance.now();\n this.debug(`${label} completed in ${(end - start).toFixed(2)}ms`);\n return result;\n } catch (error) {\n const end = performance.now();\n this.error(`${label} failed after ${(end - start).toFixed(2)}ms`, error);\n throw error;\n }\n }\n};\nfunction parseLogLevel(levelString) {\n if (!levelString)\n return void 0;\n const upper = levelString.toUpperCase();\n switch (upper) {\n case "DEBUG":\n return 0 /* DEBUG */;\n case "WARN":\n return 2 /* WARN */;\n case "ERROR":\n return 3 /* ERROR */;\n case "INFO":\n return 1 /* INFO */;\n default:\n return void 0;\n }\n}\nvar getDefaultLevel = () => {\n const envLevel = getEnvironmentVariable("LOG_LEVEL");\n const parsedLevel = parseLogLevel(envLevel);\n if (parsedLevel !== void 0)\n return parsedLevel;\n const debugFlag = getEnvironmentVariable("VERYFRONT_DEBUG");\n if (debugFlag === "1" || debugFlag === "true")\n return 0 /* DEBUG */;\n return 1 /* INFO */;\n};\nvar trackedLoggers = /* @__PURE__ */ new Set();\nfunction createLogger(prefix) {\n const logger2 = new ConsoleLogger(prefix);\n trackedLoggers.add(logger2);\n return logger2;\n}\nvar cliLogger = createLogger("CLI");\nvar serverLogger = createLogger("SERVER");\nvar rendererLogger = createLogger("RENDERER");\nvar bundlerLogger = createLogger("BUNDLER");\nvar agentLogger = createLogger("AGENT");\nvar logger = createLogger("VERYFRONT");\n\n// src/core/utils/paths.ts\nvar VERYFRONT_PATHS = {\n INTERNAL_PREFIX,\n BUILD_DIR: BUILD_DIRS.ROOT,\n CHUNKS_DIR: BUILD_DIRS.CHUNKS,\n DATA_DIR: BUILD_DIRS.DATA,\n ASSETS_DIR: BUILD_DIRS.ASSETS,\n HMR_RUNTIME: INTERNAL_ENDPOINTS.HMR_RUNTIME,\n CLIENT_JS: INTERNAL_ENDPOINTS.CLIENT_JS,\n ROUTER_JS: INTERNAL_ENDPOINTS.ROUTER_JS,\n ERROR_OVERLAY: INTERNAL_ENDPOINTS.ERROR_OVERLAY\n};\n\n// src/core/utils/bundle-manifest.ts\nvar InMemoryBundleManifestStore = class {\n constructor() {\n this.metadata = /* @__PURE__ */ new Map();\n this.code = /* @__PURE__ */ new Map();\n this.sourceIndex = /* @__PURE__ */ new Map();\n }\n getBundleMetadata(key) {\n const entry = this.metadata.get(key);\n if (!entry)\n return Promise.resolve(void 0);\n if (entry.expiry && Date.now() > entry.expiry) {\n this.metadata.delete(key);\n return Promise.resolve(void 0);\n }\n return Promise.resolve(entry.value);\n }\n setBundleMetadata(key, metadata, ttlMs) {\n const expiry = ttlMs ? Date.now() + ttlMs : void 0;\n this.metadata.set(key, { value: metadata, expiry });\n if (!this.sourceIndex.has(metadata.source)) {\n this.sourceIndex.set(metadata.source, /* @__PURE__ */ new Set());\n }\n this.sourceIndex.get(metadata.source).add(key);\n return Promise.resolve();\n }\n getBundleCode(hash) {\n const entry = this.code.get(hash);\n if (!entry)\n return Promise.resolve(void 0);\n if (entry.expiry && Date.now() > entry.expiry) {\n this.code.delete(hash);\n return Promise.resolve(void 0);\n }\n return Promise.resolve(entry.value);\n }\n setBundleCode(hash, code, ttlMs) {\n const expiry = ttlMs ? Date.now() + ttlMs : void 0;\n this.code.set(hash, { value: code, expiry });\n return Promise.resolve();\n }\n async deleteBundle(key) {\n const metadata = await this.getBundleMetadata(key);\n this.metadata.delete(key);\n if (metadata) {\n this.code.delete(metadata.codeHash);\n const sourceKeys = this.sourceIndex.get(metadata.source);\n if (sourceKeys) {\n sourceKeys.delete(key);\n if (sourceKeys.size === 0) {\n this.sourceIndex.delete(metadata.source);\n }\n }\n }\n }\n async invalidateSource(source) {\n const keys = this.sourceIndex.get(source);\n if (!keys)\n return 0;\n let count = 0;\n for (const key of Array.from(keys)) {\n await this.deleteBundle(key);\n count++;\n }\n this.sourceIndex.delete(source);\n return count;\n }\n clear() {\n this.metadata.clear();\n this.code.clear();\n this.sourceIndex.clear();\n return Promise.resolve();\n }\n isAvailable() {\n return Promise.resolve(true);\n }\n getStats() {\n let totalSize = 0;\n let oldest;\n let newest;\n for (const { value } of this.metadata.values()) {\n totalSize += value.size;\n if (!oldest || value.compiledAt < oldest)\n oldest = value.compiledAt;\n if (!newest || value.compiledAt > newest)\n newest = value.compiledAt;\n }\n return Promise.resolve({\n totalBundles: this.metadata.size,\n totalSize,\n oldestBundle: oldest,\n newestBundle: newest\n });\n }\n};\nvar manifestStore = new InMemoryBundleManifestStore();\n\n// src/rendering/client/prefetch.ts\nvar PrefetchManager = class {\n constructor(options = {}) {\n this.prefetchedUrls = /* @__PURE__ */ new Set();\n this.linkObserver = null;\n this.options = {\n rootMargin: options.rootMargin || "50px",\n delay: options.delay || PREFETCH_DEFAULT_DELAY_MS,\n maxConcurrent: options.maxConcurrent || 2,\n allowedNetworks: options.allowedNetworks || ["4g", "wifi", "ethernet"],\n maxSize: options.maxSize || PREFETCH_MAX_SIZE_BYTES,\n timeout: options.timeout || PREFETCH_DEFAULT_TIMEOUT_MS\n };\n this.networkUtils = new NetworkUtils(this.options.allowedNetworks);\n this.resourceHintsManager = new ResourceHintsManager();\n this.prefetchQueue = new PrefetchQueue(\n {\n maxConcurrent: this.options.maxConcurrent,\n maxSize: this.options.maxSize,\n timeout: this.options.timeout\n },\n this.prefetchedUrls\n );\n this.prefetchQueue.setResourceCallback(\n (response, url) => this.prefetchPageResources(response, url)\n );\n }\n init() {\n prefetchLogger.info("Initializing prefetch manager");\n if (!this.networkUtils.shouldPrefetch()) {\n prefetchLogger.info("Prefetching disabled due to network conditions");\n return;\n }\n this.linkObserver = new LinkObserver(\n {\n rootMargin: this.options.rootMargin,\n delay: this.options.delay,\n onLinkVisible: (link) => this.prefetchQueue.prefetchLink(link)\n },\n this.prefetchedUrls\n );\n this.linkObserver.init();\n this.networkUtils.onNetworkChange(() => {\n if (!this.networkUtils.shouldPrefetch()) {\n this.prefetchQueue.stopAll();\n }\n });\n }\n async prefetchPageResources(response, _pageUrl) {\n const html = await response.text();\n const hints = this.resourceHintsManager.extractResourceHints(html, this.prefetchedUrls);\n this.resourceHintsManager.applyResourceHints(hints);\n }\n applyResourceHints(hints) {\n this.resourceHintsManager.applyResourceHints(hints);\n }\n async prefetch(url) {\n await this.prefetchQueue.prefetch(url);\n }\n static generateResourceHints(route, assets) {\n return ResourceHintsManager.generateResourceHints(route, assets);\n }\n destroy() {\n this.linkObserver?.destroy();\n this.prefetchQueue.stopAll();\n this.prefetchedUrls.clear();\n }\n};\nif (typeof window !== "undefined") {\n const prefetchManager = new PrefetchManager();\n if (document.readyState === "loading") {\n document.addEventListener("DOMContentLoaded", () => prefetchManager.init());\n } else {\n prefetchManager.init();\n }\n globalThis.veryFrontPrefetch = prefetchManager;\n}\nexport {\n PrefetchManager\n};\n';
|
|
13176
|
+
CLIENT_ROUTER_BUNDLE = 'var __defProp = Object.defineProperty;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __esm = (fn, res) => function __init() {\n return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;\n};\nvar __export = (target, all) => {\n for (var name in all)\n __defProp(target, name, { get: all[name], enumerable: true });\n};\n\n// src/core/utils/runtime-guards.ts\nfunction hasDenoRuntime(global) {\n return typeof global === "object" && global !== null && "Deno" in global && typeof global.Deno?.env?.get === "function";\n}\nfunction hasNodeProcess(global) {\n return typeof global === "object" && global !== null && "process" in global && typeof global.process?.env === "object";\n}\nfunction hasBunRuntime(global) {\n return typeof global === "object" && global !== null && "Bun" in global && typeof global.Bun !== "undefined";\n}\nvar init_runtime_guards = __esm({\n "src/core/utils/runtime-guards.ts"() {\n "use strict";\n }\n});\n\n// src/core/utils/logger/env.ts\nfunction getEnvironmentVariable(name) {\n try {\n if (typeof Deno !== "undefined" && hasDenoRuntime(globalThis)) {\n const value = globalThis.Deno?.env.get(name);\n return value === "" ? void 0 : value;\n }\n if (hasNodeProcess(globalThis)) {\n const value = globalThis.process?.env[name];\n return value === "" ? void 0 : value;\n }\n } catch {\n return void 0;\n }\n return void 0;\n}\nfunction isTestEnvironment() {\n return getEnvironmentVariable("NODE_ENV") === "test";\n}\nfunction isProductionEnvironment() {\n return getEnvironmentVariable("NODE_ENV") === "production";\n}\nfunction isDevelopmentEnvironment() {\n const env = getEnvironmentVariable("NODE_ENV");\n return env === "development" || env === void 0;\n}\nvar init_env = __esm({\n "src/core/utils/logger/env.ts"() {\n "use strict";\n init_runtime_guards();\n }\n});\n\n// src/core/utils/logger/logger.ts\nfunction resolveLogLevel(force = false) {\n if (force || cachedLogLevel === void 0) {\n cachedLogLevel = getDefaultLevel();\n }\n return cachedLogLevel;\n}\nfunction parseLogLevel(levelString) {\n if (!levelString)\n return void 0;\n const upper = levelString.toUpperCase();\n switch (upper) {\n case "DEBUG":\n return 0 /* DEBUG */;\n case "WARN":\n return 2 /* WARN */;\n case "ERROR":\n return 3 /* ERROR */;\n case "INFO":\n return 1 /* INFO */;\n default:\n return void 0;\n }\n}\nfunction createLogger(prefix) {\n const logger2 = new ConsoleLogger(prefix);\n trackedLoggers.add(logger2);\n return logger2;\n}\nfunction __loggerResetForTests(options = {}) {\n const updatedLevel = resolveLogLevel(true);\n for (const instance of trackedLoggers) {\n instance.setLevel(updatedLevel);\n }\n if (options.restoreConsole) {\n console.debug = originalConsole.debug;\n console.log = originalConsole.log;\n console.warn = originalConsole.warn;\n console.error = originalConsole.error;\n }\n}\nvar LogLevel, originalConsole, cachedLogLevel, ConsoleLogger, getDefaultLevel, trackedLoggers, cliLogger, serverLogger, rendererLogger, bundlerLogger, agentLogger, logger;\nvar init_logger = __esm({\n "src/core/utils/logger/logger.ts"() {\n "use strict";\n init_env();\n LogLevel = /* @__PURE__ */ ((LogLevel2) => {\n LogLevel2[LogLevel2["DEBUG"] = 0] = "DEBUG";\n LogLevel2[LogLevel2["INFO"] = 1] = "INFO";\n LogLevel2[LogLevel2["WARN"] = 2] = "WARN";\n LogLevel2[LogLevel2["ERROR"] = 3] = "ERROR";\n return LogLevel2;\n })(LogLevel || {});\n originalConsole = {\n debug: console.debug,\n log: console.log,\n warn: console.warn,\n error: console.error\n };\n ConsoleLogger = class {\n constructor(prefix, level = resolveLogLevel()) {\n this.prefix = prefix;\n this.level = level;\n }\n setLevel(level) {\n this.level = level;\n }\n getLevel() {\n return this.level;\n }\n debug(message, ...args) {\n if (this.level <= 0 /* DEBUG */) {\n console.debug(`[${this.prefix}] DEBUG: ${message}`, ...args);\n }\n }\n info(message, ...args) {\n if (this.level <= 1 /* INFO */) {\n console.log(`[${this.prefix}] ${message}`, ...args);\n }\n }\n warn(message, ...args) {\n if (this.level <= 2 /* WARN */) {\n console.warn(`[${this.prefix}] WARN: ${message}`, ...args);\n }\n }\n error(message, ...args) {\n if (this.level <= 3 /* ERROR */) {\n console.error(`[${this.prefix}] ERROR: ${message}`, ...args);\n }\n }\n async time(label, fn) {\n const start = performance.now();\n try {\n const result = await fn();\n const end = performance.now();\n this.debug(`${label} completed in ${(end - start).toFixed(2)}ms`);\n return result;\n } catch (error2) {\n const end = performance.now();\n this.error(`${label} failed after ${(end - start).toFixed(2)}ms`, error2);\n throw error2;\n }\n }\n };\n getDefaultLevel = () => {\n const envLevel = getEnvironmentVariable("LOG_LEVEL");\n const parsedLevel = parseLogLevel(envLevel);\n if (parsedLevel !== void 0)\n return parsedLevel;\n const debugFlag = getEnvironmentVariable("VERYFRONT_DEBUG");\n if (debugFlag === "1" || debugFlag === "true")\n return 0 /* DEBUG */;\n return 1 /* INFO */;\n };\n trackedLoggers = /* @__PURE__ */ new Set();\n cliLogger = createLogger("CLI");\n serverLogger = createLogger("SERVER");\n rendererLogger = createLogger("RENDERER");\n bundlerLogger = createLogger("BUNDLER");\n agentLogger = createLogger("AGENT");\n logger = createLogger("VERYFRONT");\n }\n});\n\n// src/core/utils/logger/index.ts\nvar init_logger2 = __esm({\n "src/core/utils/logger/index.ts"() {\n "use strict";\n init_logger();\n init_env();\n }\n});\n\n// src/core/utils/constants/build.ts\nvar DEFAULT_BUILD_CONCURRENCY, IMAGE_OPTIMIZATION;\nvar init_build = __esm({\n "src/core/utils/constants/build.ts"() {\n "use strict";\n DEFAULT_BUILD_CONCURRENCY = 4;\n IMAGE_OPTIMIZATION = {\n DEFAULT_SIZES: [640, 750, 828, 1080, 1200, 1920, 2048, 3840],\n DEFAULT_QUALITY: 80\n };\n }\n});\n\n// src/core/utils/constants/cache.ts\nvar SECONDS_PER_MINUTE, MINUTES_PER_HOUR, HOURS_PER_DAY, MS_PER_SECOND, DEFAULT_LRU_MAX_ENTRIES, COMPONENT_LOADER_MAX_ENTRIES, COMPONENT_LOADER_TTL_MS, MDX_RENDERER_MAX_ENTRIES, MDX_RENDERER_TTL_MS, RENDERER_CORE_MAX_ENTRIES, RENDERER_CORE_TTL_MS, TSX_LAYOUT_MAX_ENTRIES, TSX_LAYOUT_TTL_MS, DATA_FETCHING_MAX_ENTRIES, DATA_FETCHING_TTL_MS, MDX_CACHE_TTL_PRODUCTION_MS, MDX_CACHE_TTL_DEVELOPMENT_MS, BUNDLE_CACHE_TTL_PRODUCTION_MS, BUNDLE_CACHE_TTL_DEVELOPMENT_MS, BUNDLE_MANIFEST_PROD_TTL_MS, BUNDLE_MANIFEST_DEV_TTL_MS, RSC_MANIFEST_CACHE_TTL_MS, SERVER_ACTION_DEFAULT_TTL_SEC, DENO_KV_SAFE_SIZE_LIMIT_BYTES, HTTP_CACHE_SHORT_MAX_AGE_SEC, HTTP_CACHE_MEDIUM_MAX_AGE_SEC, HTTP_CACHE_LONG_MAX_AGE_SEC, ONE_DAY_MS, CACHE_CLEANUP_INTERVAL_MS, LRU_DEFAULT_MAX_ENTRIES, LRU_DEFAULT_MAX_SIZE_BYTES, CLEANUP_INTERVAL_MULTIPLIER;\nvar init_cache = __esm({\n "src/core/utils/constants/cache.ts"() {\n "use strict";\n SECONDS_PER_MINUTE = 60;\n MINUTES_PER_HOUR = 60;\n HOURS_PER_DAY = 24;\n MS_PER_SECOND = 1e3;\n DEFAULT_LRU_MAX_ENTRIES = 100;\n COMPONENT_LOADER_MAX_ENTRIES = 100;\n COMPONENT_LOADER_TTL_MS = 10 * SECONDS_PER_MINUTE * MS_PER_SECOND;\n MDX_RENDERER_MAX_ENTRIES = 200;\n MDX_RENDERER_TTL_MS = 10 * SECONDS_PER_MINUTE * MS_PER_SECOND;\n RENDERER_CORE_MAX_ENTRIES = 100;\n RENDERER_CORE_TTL_MS = 5 * SECONDS_PER_MINUTE * MS_PER_SECOND;\n TSX_LAYOUT_MAX_ENTRIES = 50;\n TSX_LAYOUT_TTL_MS = 10 * SECONDS_PER_MINUTE * MS_PER_SECOND;\n DATA_FETCHING_MAX_ENTRIES = 200;\n DATA_FETCHING_TTL_MS = 10 * SECONDS_PER_MINUTE * MS_PER_SECOND;\n MDX_CACHE_TTL_PRODUCTION_MS = HOURS_PER_DAY * MINUTES_PER_HOUR * SECONDS_PER_MINUTE * MS_PER_SECOND;\n MDX_CACHE_TTL_DEVELOPMENT_MS = 5 * SECONDS_PER_MINUTE * MS_PER_SECOND;\n BUNDLE_CACHE_TTL_PRODUCTION_MS = HOURS_PER_DAY * MINUTES_PER_HOUR * SECONDS_PER_MINUTE * MS_PER_SECOND;\n BUNDLE_CACHE_TTL_DEVELOPMENT_MS = 5 * SECONDS_PER_MINUTE * MS_PER_SECOND;\n BUNDLE_MANIFEST_PROD_TTL_MS = 7 * HOURS_PER_DAY * MINUTES_PER_HOUR * SECONDS_PER_MINUTE * MS_PER_SECOND;\n BUNDLE_MANIFEST_DEV_TTL_MS = MINUTES_PER_HOUR * SECONDS_PER_MINUTE * MS_PER_SECOND;\n RSC_MANIFEST_CACHE_TTL_MS = 5e3;\n SERVER_ACTION_DEFAULT_TTL_SEC = MINUTES_PER_HOUR * SECONDS_PER_MINUTE;\n DENO_KV_SAFE_SIZE_LIMIT_BYTES = 64e3;\n HTTP_CACHE_SHORT_MAX_AGE_SEC = 60;\n HTTP_CACHE_MEDIUM_MAX_AGE_SEC = 3600;\n HTTP_CACHE_LONG_MAX_AGE_SEC = 31536e3;\n ONE_DAY_MS = HOURS_PER_DAY * MINUTES_PER_HOUR * SECONDS_PER_MINUTE * MS_PER_SECOND;\n CACHE_CLEANUP_INTERVAL_MS = 6e4;\n LRU_DEFAULT_MAX_ENTRIES = 1e3;\n LRU_DEFAULT_MAX_SIZE_BYTES = 50 * 1024 * 1024;\n CLEANUP_INTERVAL_MULTIPLIER = 2;\n }\n});\n\n// deno.json\nvar deno_default;\nvar init_deno = __esm({\n "deno.json"() {\n deno_default = {\n name: "veryfront",\n version: "0.0.51",\n exclude: [\n "npm/",\n "dist/",\n "coverage/",\n "scripts/",\n "examples/",\n "tests/",\n "src/cli/templates/files/",\n "src/cli/templates/integrations/"\n ],\n exports: {\n ".": "./src/index.ts",\n "./cli": "./src/cli/main.ts",\n "./server": "./src/server/index.ts",\n "./middleware": "./src/middleware/index.ts",\n "./components": "./src/react/components/index.ts",\n "./data": "./src/data/index.ts",\n "./config": "./src/core/config/index.ts",\n "./platform": "./src/platform/index.ts",\n "./ai": "./src/ai/index.ts",\n "./ai/client": "./src/ai/client.ts",\n "./ai/react": "./src/ai/react/index.ts",\n "./ai/primitives": "./src/ai/react/primitives/index.ts",\n "./ai/components": "./src/ai/react/components/index.ts",\n "./ai/production": "./src/ai/production/index.ts",\n "./ai/dev": "./src/ai/dev/index.ts",\n "./ai/workflow": "./src/ai/workflow/index.ts",\n "./ai/workflow/react": "./src/ai/workflow/react/index.ts",\n "./oauth": "./src/core/oauth/index.ts",\n "./oauth/providers": "./src/core/oauth/providers/index.ts",\n "./oauth/handlers": "./src/core/oauth/handlers/index.ts",\n "./oauth/token-store": "./src/core/oauth/token-store/index.ts"\n },\n imports: {\n "@veryfront": "./src/index.ts",\n "@veryfront/": "./src/",\n "@veryfront/ai": "./src/ai/index.ts",\n "@veryfront/ai/": "./src/ai/",\n "@veryfront/platform": "./src/platform/index.ts",\n "@veryfront/platform/": "./src/platform/",\n "@veryfront/types": "./src/core/types/index.ts",\n "@veryfront/types/": "./src/core/types/",\n "@veryfront/utils": "./src/core/utils/index.ts",\n "@veryfront/utils/": "./src/core/utils/",\n "@veryfront/middleware": "./src/middleware/index.ts",\n "@veryfront/middleware/": "./src/middleware/",\n "@veryfront/errors": "./src/core/errors/index.ts",\n "@veryfront/errors/": "./src/core/errors/",\n "@veryfront/config": "./src/core/config/index.ts",\n "@veryfront/config/": "./src/core/config/",\n "@veryfront/observability": "./src/observability/index.ts",\n "@veryfront/observability/": "./src/observability/",\n "@veryfront/routing": "./src/routing/index.ts",\n "@veryfront/routing/": "./src/routing/",\n "@veryfront/transforms": "./src/build/transforms/index.ts",\n "@veryfront/transforms/": "./src/build/transforms/",\n "@veryfront/data": "./src/data/index.ts",\n "@veryfront/data/": "./src/data/",\n "@veryfront/security": "./src/security/index.ts",\n "@veryfront/security/": "./src/security/",\n "@veryfront/components": "./src/react/components/index.ts",\n "@veryfront/react": "./src/react/index.ts",\n "@veryfront/react/": "./src/react/",\n "@veryfront/html": "./src/html/index.ts",\n "@veryfront/html/": "./src/html/",\n "@veryfront/rendering": "./src/rendering/index.ts",\n "@veryfront/rendering/": "./src/rendering/",\n "@veryfront/build": "./src/build/index.ts",\n "@veryfront/build/": "./src/build/",\n "@veryfront/server": "./src/server/index.ts",\n "@veryfront/server/": "./src/server/",\n "@veryfront/modules": "./src/module-system/index.ts",\n "@veryfront/modules/": "./src/module-system/",\n "@veryfront/compat/console": "./src/platform/compat/console/index.ts",\n "@veryfront/compat/": "./src/platform/compat/",\n "@veryfront/oauth": "./src/core/oauth/index.ts",\n "@veryfront/oauth/": "./src/core/oauth/",\n "std/": "https://deno.land/std@0.220.0/",\n "@std/path": "https://deno.land/std@0.220.0/path/mod.ts",\n "@std/testing/bdd.ts": "https://deno.land/std@0.220.0/testing/bdd.ts",\n "@std/expect": "https://deno.land/std@0.220.0/expect/mod.ts",\n csstype: "https://esm.sh/csstype@3.2.3",\n "@types/react": "https://esm.sh/@types/react@18.3.27?deps=csstype@3.2.3",\n "@types/react-dom": "https://esm.sh/@types/react-dom@18.3.7?deps=csstype@3.2.3",\n react: "https://esm.sh/react@18.3.1",\n "react-dom": "https://esm.sh/react-dom@18.3.1",\n "react-dom/server": "https://esm.sh/react-dom@18.3.1/server",\n "react-dom/client": "https://esm.sh/react-dom@18.3.1/client",\n "react/jsx-runtime": "https://esm.sh/react@18.3.1/jsx-runtime",\n "react/jsx-dev-runtime": "https://esm.sh/react@18.3.1/jsx-dev-runtime",\n "@mdx-js/mdx": "https://esm.sh/@mdx-js/mdx@3.0.0?deps=react@18.3.1,react-dom@18.3.1",\n "@mdx-js/react": "https://esm.sh/@mdx-js/react@3.0.0?deps=react@18.3.1,react-dom@18.3.1",\n "unist-util-visit": "https://esm.sh/unist-util-visit@5.0.0",\n "mdast-util-to-string": "https://esm.sh/mdast-util-to-string@4.0.0",\n "github-slugger": "https://esm.sh/github-slugger@2.0.0",\n "remark-gfm": "https://esm.sh/remark-gfm@4.0.1",\n "remark-frontmatter": "https://esm.sh/remark-frontmatter@5.0.0",\n "rehype-highlight": "https://esm.sh/rehype-highlight@7.0.2",\n "rehype-slug": "https://esm.sh/rehype-slug@6.0.0",\n esbuild: "https://deno.land/x/esbuild@v0.20.1/wasm.js",\n "esbuild/mod.js": "https://deno.land/x/esbuild@v0.20.1/mod.js",\n "es-module-lexer": "https://esm.sh/es-module-lexer@1.5.0",\n zod: "https://esm.sh/zod@3.22.0",\n "mime-types": "https://esm.sh/mime-types@2.1.35",\n mdast: "https://esm.sh/@types/mdast@4.0.3",\n hast: "https://esm.sh/@types/hast@3.0.3",\n unist: "https://esm.sh/@types/unist@3.0.2",\n unified: "https://esm.sh/unified@11.0.5?dts",\n ai: "https://esm.sh/ai@5.0.76?deps=react@18.3.1,react-dom@18.3.1",\n "ai/react": "https://esm.sh/@ai-sdk/react@2.0.59?deps=react@18.3.1,react-dom@18.3.1",\n "@ai-sdk/react": "https://esm.sh/@ai-sdk/react@2.0.59?deps=react@18.3.1,react-dom@18.3.1",\n "@ai-sdk/openai": "https://esm.sh/@ai-sdk/openai@2.0.1",\n "@ai-sdk/anthropic": "https://esm.sh/@ai-sdk/anthropic@2.0.4",\n unocss: "https://esm.sh/unocss@0.59.0",\n "@unocss/core": "https://esm.sh/@unocss/core@0.59.0",\n "@unocss/preset-wind": "https://esm.sh/@unocss/preset-wind@0.59.0",\n redis: "npm:redis",\n pg: "npm:pg"\n },\n compilerOptions: {\n jsx: "react-jsx",\n jsxImportSource: "react",\n strict: true,\n noImplicitAny: true,\n noUncheckedIndexedAccess: true,\n types: [],\n lib: [\n "deno.window",\n "dom",\n "dom.iterable",\n "dom.asynciterable",\n "deno.ns"\n ]\n },\n tasks: {\n setup: "deno run --allow-all scripts/setup.ts",\n dev: "deno run --allow-all --no-lock --unstable-net --unstable-worker-options src/cli/main.ts dev",\n build: "deno compile --allow-all --output ../../bin/veryfront src/cli/main.ts",\n "build:npm": "deno run -A scripts/build-npm.ts",\n release: "deno run -A scripts/release.ts",\n test: "DENO_JOBS=1 deno test --parallel --fail-fast --allow-all --unstable-worker-options --unstable-net",\n "test:unit": "DENO_JOBS=1 deno test --parallel --allow-all --v8-flags=--max-old-space-size=8192 --ignore=tests --unstable-worker-options --unstable-net",\n "test:integration": "DENO_JOBS=1 deno test --parallel --fail-fast --allow-all tests --unstable-worker-options --unstable-net",\n "test:coverage": "rm -rf coverage && DENO_JOBS=1 deno test --parallel --fail-fast --allow-all --coverage=coverage --unstable-worker-options --unstable-net || exit 1",\n "test:coverage:unit": "rm -rf coverage && DENO_JOBS=1 deno test --parallel --fail-fast --allow-all --coverage=coverage --ignore=tests --unstable-worker-options --unstable-net || exit 1",\n "test:coverage:integration": "rm -rf coverage && DENO_JOBS=1 deno test --parallel --fail-fast --allow-all --coverage=coverage tests --unstable-worker-options --unstable-net || exit 1",\n "coverage:report": "deno coverage coverage --include=src/ --exclude=tests --exclude=src/**/*_test.ts --exclude=src/**/*_test.tsx --exclude=src/**/*.test.ts --exclude=src/**/*.test.tsx --lcov > coverage/lcov.info && deno run --allow-read scripts/check-coverage.ts 80",\n "coverage:html": "deno coverage coverage --include=src/ --exclude=tests --exclude=src/**/*_test.ts --exclude=src/**/*_test.tsx --exclude=src/**/*.test.ts --exclude=src/**/*.test.tsx --html",\n lint: "DENO_NO_PACKAGE_JSON=1 deno lint src/",\n fmt: "deno fmt src/",\n typecheck: "deno check src/index.ts src/cli/main.ts src/server/index.ts src/routing/api/index.ts src/rendering/index.ts src/platform/index.ts src/platform/adapters/index.ts src/build/index.ts src/build/production-build/index.ts src/build/transforms/index.ts src/core/config/index.ts src/core/utils/index.ts src/data/index.ts src/security/index.ts src/middleware/index.ts src/server/handlers/dev/index.ts src/server/handlers/request/api/index.ts src/rendering/cache/index.ts src/rendering/cache/stores/index.ts src/rendering/rsc/actions/index.ts src/html/index.ts src/module-system/index.ts",\n "docs:check-links": "deno run -A scripts/check-doc-links.ts",\n "lint:ban-console": "deno run --allow-read scripts/ban-console.ts",\n "lint:ban-deep-imports": "deno run --allow-read scripts/ban-deep-imports.ts",\n "lint:ban-internal-root-imports": "deno run --allow-read scripts/ban-internal-root-imports.ts",\n "lint:check-awaits": "deno run --allow-read scripts/check-unawaited-promises.ts",\n "lint:platform": "deno run --allow-read scripts/lint-platform-agnostic.ts",\n "check:circular": "deno run -A jsr:@cunarist/deno-circular-deps src/index.ts"\n },\n lint: {\n include: [\n "src/**/*.ts",\n "src/**/*.tsx"\n ],\n exclude: [\n "dist/",\n "coverage/"\n ],\n rules: {\n tags: [\n "recommended"\n ],\n include: [\n "ban-untagged-todo"\n ],\n exclude: [\n "no-explicit-any",\n "no-process-global",\n "no-console"\n ]\n }\n },\n fmt: {\n include: [\n "src/**/*.ts",\n "src/**/*.tsx"\n ],\n exclude: [\n "dist/",\n "coverage/"\n ],\n options: {\n useTabs: false,\n lineWidth: 100,\n indentWidth: 2,\n semiColons: true,\n singleQuote: false,\n proseWrap: "preserve"\n }\n }\n };\n }\n});\n\n// src/platform/compat/runtime.ts\nvar isDeno, isNode, isBun, isCloudflare;\nvar init_runtime = __esm({\n "src/platform/compat/runtime.ts"() {\n "use strict";\n isDeno = typeof Deno !== "undefined";\n isNode = typeof globalThis.process !== "undefined" && globalThis.process?.versions?.node !== void 0;\n isBun = typeof globalThis.Bun !== "undefined";\n isCloudflare = typeof globalThis !== "undefined" && "caches" in globalThis && "WebSocketPair" in globalThis;\n }\n});\n\n// src/platform/compat/process.ts\nfunction getEnv(key) {\n if (isDeno) {\n return Deno.env.get(key);\n }\n if (hasNodeProcess2) {\n return nodeProcess.env[key];\n }\n return void 0;\n}\nfunction memoryUsage() {\n if (isDeno) {\n const usage2 = Deno.memoryUsage();\n return {\n rss: usage2.rss,\n heapTotal: usage2.heapTotal,\n heapUsed: usage2.heapUsed,\n external: usage2.external\n };\n }\n if (!hasNodeProcess2) {\n throw new Error("memoryUsage() is not supported in this runtime");\n }\n const usage = nodeProcess.memoryUsage();\n return {\n rss: usage.rss,\n heapTotal: usage.heapTotal,\n heapUsed: usage.heapUsed,\n external: usage.external || 0\n };\n}\nfunction execPath() {\n if (isDeno) {\n return Deno.execPath();\n }\n if (hasNodeProcess2) {\n return nodeProcess.execPath;\n }\n return "";\n}\nvar nodeProcess, hasNodeProcess2;\nvar init_process = __esm({\n "src/platform/compat/process.ts"() {\n "use strict";\n init_runtime();\n nodeProcess = globalThis.process;\n hasNodeProcess2 = !!nodeProcess?.versions?.node;\n }\n});\n\n// src/core/utils/version.ts\nvar VERSION;\nvar init_version = __esm({\n "src/core/utils/version.ts"() {\n "use strict";\n init_deno();\n init_process();\n VERSION = getEnv("VERYFRONT_VERSION") || (typeof deno_default.version === "string" ? deno_default.version : "0.0.0");\n }\n});\n\n// src/core/utils/constants/cdn.ts\nfunction getReactCDNUrl(version = REACT_DEFAULT_VERSION) {\n return `${ESM_CDN_BASE}/react@${version}`;\n}\nfunction getReactDOMCDNUrl(version = REACT_DEFAULT_VERSION) {\n return `${ESM_CDN_BASE}/react-dom@${version}`;\n}\nfunction getReactDOMClientCDNUrl(version = REACT_DEFAULT_VERSION) {\n return `${ESM_CDN_BASE}/react-dom@${version}/client`;\n}\nfunction getReactDOMServerCDNUrl(version = REACT_DEFAULT_VERSION) {\n return `${ESM_CDN_BASE}/react-dom@${version}/server`;\n}\nfunction getReactJSXRuntimeCDNUrl(version = REACT_DEFAULT_VERSION) {\n return `${ESM_CDN_BASE}/react@${version}/jsx-runtime`;\n}\nfunction getReactJSXDevRuntimeCDNUrl(version = REACT_DEFAULT_VERSION) {\n return `${ESM_CDN_BASE}/react@${version}/jsx-dev-runtime`;\n}\nfunction getReactImportMap(version = REACT_DEFAULT_VERSION) {\n return {\n react: getReactCDNUrl(version),\n "react-dom": getReactDOMCDNUrl(version),\n "react-dom/client": getReactDOMClientCDNUrl(version),\n "react-dom/server": getReactDOMServerCDNUrl(version),\n "react/jsx-runtime": getReactJSXRuntimeCDNUrl(version),\n "react/jsx-dev-runtime": getReactJSXDevRuntimeCDNUrl(version)\n };\n}\nfunction getDenoStdNodeBase() {\n return `${DENO_STD_BASE}/std@${DENO_STD_VERSION}/node`;\n}\nfunction getUnoCSSTailwindResetUrl() {\n return `${ESM_CDN_BASE}/@unocss/reset@${UNOCSS_VERSION}/tailwind.css`;\n}\nvar ESM_CDN_BASE, JSDELIVR_CDN_BASE, DENO_STD_BASE, REACT_VERSION_17, REACT_VERSION_18_2, REACT_VERSION_18_3, REACT_VERSION_19_RC, REACT_VERSION_19, REACT_DEFAULT_VERSION, DEFAULT_ALLOWED_CDN_HOSTS, DENO_STD_VERSION, UNOCSS_VERSION;\nvar init_cdn = __esm({\n "src/core/utils/constants/cdn.ts"() {\n "use strict";\n init_version();\n ESM_CDN_BASE = "https://esm.sh";\n JSDELIVR_CDN_BASE = "https://cdn.jsdelivr.net";\n DENO_STD_BASE = "https://deno.land";\n REACT_VERSION_17 = "17.0.2";\n REACT_VERSION_18_2 = "18.2.0";\n REACT_VERSION_18_3 = "18.3.1";\n REACT_VERSION_19_RC = "19.0.0-rc.0";\n REACT_VERSION_19 = "19.1.1";\n REACT_DEFAULT_VERSION = REACT_VERSION_18_3;\n DEFAULT_ALLOWED_CDN_HOSTS = [ESM_CDN_BASE, DENO_STD_BASE];\n DENO_STD_VERSION = "0.220.0";\n UNOCSS_VERSION = "0.59.0";\n }\n});\n\n// src/core/utils/constants/env.ts\nfunction isTruthyEnvValue(value) {\n if (!value)\n return false;\n const normalized = value.toLowerCase().trim();\n return normalized === "1" || normalized === "true" || normalized === "yes";\n}\nfunction isDebugEnabled(env) {\n return isTruthyEnvValue(env.get(ENV_VARS.DEBUG));\n}\nfunction isDeepInspectEnabled(env) {\n return isTruthyEnvValue(env.get(ENV_VARS.DEEP_INSPECT));\n}\nfunction isAnyDebugEnabled(env) {\n return isDebugEnabled(env) || isDeepInspectEnabled(env);\n}\nvar ENV_VARS;\nvar init_env2 = __esm({\n "src/core/utils/constants/env.ts"() {\n "use strict";\n ENV_VARS = {\n DEBUG: "VERYFRONT_DEBUG",\n DEEP_INSPECT: "VERYFRONT_DEEP_INSPECT",\n CACHE_DIR: "VERYFRONT_CACHE_DIR",\n PORT: "VERYFRONT_PORT",\n VERSION: "VERYFRONT_VERSION"\n };\n }\n});\n\n// src/core/utils/constants/hash.ts\nvar HASH_SEED_DJB2, HASH_SEED_FNV1A;\nvar init_hash = __esm({\n "src/core/utils/constants/hash.ts"() {\n "use strict";\n HASH_SEED_DJB2 = 5381;\n HASH_SEED_FNV1A = 2166136261;\n }\n});\n\n// src/core/utils/constants/http.ts\nvar KB_IN_BYTES, HTTP_MODULE_FETCH_TIMEOUT_MS, HMR_RECONNECT_DELAY_MS, HMR_RELOAD_DELAY_MS, HMR_FILE_WATCHER_DEBOUNCE_MS, HMR_KEEP_ALIVE_INTERVAL_MS, DASHBOARD_RECONNECT_DELAY_MS, SERVER_FUNCTION_DEFAULT_TIMEOUT_MS, PREFETCH_MAX_SIZE_BYTES, PREFETCH_DEFAULT_TIMEOUT_MS, PREFETCH_DEFAULT_DELAY_MS, HTTP_OK, HTTP_NO_CONTENT, HTTP_CREATED, HTTP_REDIRECT_FOUND, HTTP_NOT_MODIFIED, HTTP_BAD_REQUEST, HTTP_UNAUTHORIZED, HTTP_FORBIDDEN, HTTP_NOT_FOUND, HTTP_METHOD_NOT_ALLOWED, HTTP_GONE, HTTP_PAYLOAD_TOO_LARGE, HTTP_URI_TOO_LONG, HTTP_TOO_MANY_REQUESTS, HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE, HTTP_SERVER_ERROR, HTTP_INTERNAL_SERVER_ERROR, HTTP_BAD_GATEWAY, HTTP_NOT_IMPLEMENTED, HTTP_UNAVAILABLE, HTTP_NETWORK_CONNECT_TIMEOUT, HTTP_STATUS_SUCCESS_MIN, HTTP_STATUS_REDIRECT_MIN, HTTP_STATUS_CLIENT_ERROR_MIN, HTTP_STATUS_SERVER_ERROR_MIN, HTTP_CONTENT_TYPES, MS_PER_MINUTE, HTTP_CONTENT_TYPE_IMAGE_PNG, HTTP_CONTENT_TYPE_IMAGE_JPEG, HTTP_CONTENT_TYPE_IMAGE_WEBP, HTTP_CONTENT_TYPE_IMAGE_AVIF, HTTP_CONTENT_TYPE_IMAGE_SVG, HTTP_CONTENT_TYPE_IMAGE_GIF, HTTP_CONTENT_TYPE_IMAGE_ICO;\nvar init_http = __esm({\n "src/core/utils/constants/http.ts"() {\n "use strict";\n init_cache();\n KB_IN_BYTES = 1024;\n HTTP_MODULE_FETCH_TIMEOUT_MS = 2500;\n HMR_RECONNECT_DELAY_MS = 1e3;\n HMR_RELOAD_DELAY_MS = 1e3;\n HMR_FILE_WATCHER_DEBOUNCE_MS = 100;\n HMR_KEEP_ALIVE_INTERVAL_MS = 3e4;\n DASHBOARD_RECONNECT_DELAY_MS = 3e3;\n SERVER_FUNCTION_DEFAULT_TIMEOUT_MS = 3e4;\n PREFETCH_MAX_SIZE_BYTES = 200 * KB_IN_BYTES;\n PREFETCH_DEFAULT_TIMEOUT_MS = 1e4;\n PREFETCH_DEFAULT_DELAY_MS = 200;\n HTTP_OK = 200;\n HTTP_NO_CONTENT = 204;\n HTTP_CREATED = 201;\n HTTP_REDIRECT_FOUND = 302;\n HTTP_NOT_MODIFIED = 304;\n HTTP_BAD_REQUEST = 400;\n HTTP_UNAUTHORIZED = 401;\n HTTP_FORBIDDEN = 403;\n HTTP_NOT_FOUND = 404;\n HTTP_METHOD_NOT_ALLOWED = 405;\n HTTP_GONE = 410;\n HTTP_PAYLOAD_TOO_LARGE = 413;\n HTTP_URI_TOO_LONG = 414;\n HTTP_TOO_MANY_REQUESTS = 429;\n HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE = 431;\n HTTP_SERVER_ERROR = 500;\n HTTP_INTERNAL_SERVER_ERROR = 500;\n HTTP_BAD_GATEWAY = 502;\n HTTP_NOT_IMPLEMENTED = 501;\n HTTP_UNAVAILABLE = 503;\n HTTP_NETWORK_CONNECT_TIMEOUT = 599;\n HTTP_STATUS_SUCCESS_MIN = 200;\n HTTP_STATUS_REDIRECT_MIN = 300;\n HTTP_STATUS_CLIENT_ERROR_MIN = 400;\n HTTP_STATUS_SERVER_ERROR_MIN = 500;\n HTTP_CONTENT_TYPES = {\n JS: "application/javascript; charset=utf-8",\n JSON: "application/json; charset=utf-8",\n HTML: "text/html; charset=utf-8",\n CSS: "text/css; charset=utf-8",\n TEXT: "text/plain; charset=utf-8"\n };\n MS_PER_MINUTE = 6e4;\n HTTP_CONTENT_TYPE_IMAGE_PNG = "image/png";\n HTTP_CONTENT_TYPE_IMAGE_JPEG = "image/jpeg";\n HTTP_CONTENT_TYPE_IMAGE_WEBP = "image/webp";\n HTTP_CONTENT_TYPE_IMAGE_AVIF = "image/avif";\n HTTP_CONTENT_TYPE_IMAGE_SVG = "image/svg+xml";\n HTTP_CONTENT_TYPE_IMAGE_GIF = "image/gif";\n HTTP_CONTENT_TYPE_IMAGE_ICO = "image/x-icon";\n }\n});\n\n// src/core/utils/constants/hmr.ts\nfunction isValidHMRMessageType(type) {\n return Object.values(HMR_MESSAGE_TYPES).includes(\n type\n );\n}\nvar HMR_MAX_MESSAGE_SIZE_BYTES, HMR_MAX_MESSAGES_PER_MINUTE, HMR_CLIENT_RELOAD_DELAY_MS, HMR_PORT_OFFSET, HMR_RATE_LIMIT_WINDOW_MS, HMR_CLOSE_NORMAL, HMR_CLOSE_RATE_LIMIT, HMR_CLOSE_MESSAGE_TOO_LARGE, HMR_MESSAGE_TYPES;\nvar init_hmr = __esm({\n "src/core/utils/constants/hmr.ts"() {\n "use strict";\n init_http();\n HMR_MAX_MESSAGE_SIZE_BYTES = 1024 * KB_IN_BYTES;\n HMR_MAX_MESSAGES_PER_MINUTE = 100;\n HMR_CLIENT_RELOAD_DELAY_MS = 3e3;\n HMR_PORT_OFFSET = 1;\n HMR_RATE_LIMIT_WINDOW_MS = 6e4;\n HMR_CLOSE_NORMAL = 1e3;\n HMR_CLOSE_RATE_LIMIT = 1008;\n HMR_CLOSE_MESSAGE_TOO_LARGE = 1009;\n HMR_MESSAGE_TYPES = {\n CONNECTED: "connected",\n UPDATE: "update",\n RELOAD: "reload",\n PING: "ping",\n PONG: "pong"\n };\n }\n});\n\n// src/core/utils/constants/html.ts\nvar Z_INDEX_DEV_INDICATOR, Z_INDEX_ERROR_OVERLAY, BREAKPOINT_SM, BREAKPOINT_MD, BREAKPOINT_LG, BREAKPOINT_XL, PROSE_MAX_WIDTH;\nvar init_html = __esm({\n "src/core/utils/constants/html.ts"() {\n "use strict";\n Z_INDEX_DEV_INDICATOR = 9998;\n Z_INDEX_ERROR_OVERLAY = 9999;\n BREAKPOINT_SM = 640;\n BREAKPOINT_MD = 768;\n BREAKPOINT_LG = 1024;\n BREAKPOINT_XL = 1280;\n PROSE_MAX_WIDTH = "65ch";\n }\n});\n\n// src/core/utils/constants/network.ts\nvar DEFAULT_DEV_SERVER_PORT, DEFAULT_REDIS_PORT, DEFAULT_API_SERVER_PORT, DEFAULT_PREVIEW_SERVER_PORT, DEFAULT_METRICS_PORT, BYTES_PER_KB, BYTES_PER_MB, DEFAULT_IMAGE_THUMBNAIL_SIZE, DEFAULT_IMAGE_SMALL_SIZE, DEFAULT_IMAGE_LARGE_SIZE, RESPONSIVE_IMAGE_WIDTH_XS, RESPONSIVE_IMAGE_WIDTH_SM, RESPONSIVE_IMAGE_WIDTH_MD, RESPONSIVE_IMAGE_WIDTH_LG, RESPONSIVE_IMAGE_WIDTHS, MAX_CHUNK_SIZE_KB, MIN_PORT, MAX_PORT, DEFAULT_SERVER_PORT;\nvar init_network = __esm({\n "src/core/utils/constants/network.ts"() {\n "use strict";\n DEFAULT_DEV_SERVER_PORT = 3e3;\n DEFAULT_REDIS_PORT = 6379;\n DEFAULT_API_SERVER_PORT = 8080;\n DEFAULT_PREVIEW_SERVER_PORT = 5e3;\n DEFAULT_METRICS_PORT = 9e3;\n BYTES_PER_KB = 1024;\n BYTES_PER_MB = 1024 * 1024;\n DEFAULT_IMAGE_THUMBNAIL_SIZE = 256;\n DEFAULT_IMAGE_SMALL_SIZE = 512;\n DEFAULT_IMAGE_LARGE_SIZE = 2048;\n RESPONSIVE_IMAGE_WIDTH_XS = 320;\n RESPONSIVE_IMAGE_WIDTH_SM = 640;\n RESPONSIVE_IMAGE_WIDTH_MD = 1024;\n RESPONSIVE_IMAGE_WIDTH_LG = 1920;\n RESPONSIVE_IMAGE_WIDTHS = [\n RESPONSIVE_IMAGE_WIDTH_XS,\n RESPONSIVE_IMAGE_WIDTH_SM,\n RESPONSIVE_IMAGE_WIDTH_MD,\n RESPONSIVE_IMAGE_WIDTH_LG\n ];\n MAX_CHUNK_SIZE_KB = 4096;\n MIN_PORT = 1;\n MAX_PORT = 65535;\n DEFAULT_SERVER_PORT = 8e3;\n }\n});\n\n// src/core/utils/constants/security.ts\nvar MAX_PATH_TRAVERSAL_DEPTH, FORBIDDEN_PATH_PATTERNS, DIRECTORY_TRAVERSAL_PATTERN, ABSOLUTE_PATH_PATTERN, MAX_PATH_LENGTH, DEFAULT_MAX_STRING_LENGTH;\nvar init_security = __esm({\n "src/core/utils/constants/security.ts"() {\n "use strict";\n MAX_PATH_TRAVERSAL_DEPTH = 10;\n FORBIDDEN_PATH_PATTERNS = [\n /\\0/\n // Null bytes\n ];\n DIRECTORY_TRAVERSAL_PATTERN = /\\.\\.[\\/\\\\]/;\n ABSOLUTE_PATH_PATTERN = /^[\\/\\\\]/;\n MAX_PATH_LENGTH = 4096;\n DEFAULT_MAX_STRING_LENGTH = 1e3;\n }\n});\n\n// src/core/utils/constants/server.ts\nfunction isInternalEndpoint(pathname) {\n return pathname.startsWith(INTERNAL_PREFIX + "/");\n}\nfunction isStaticAsset(pathname) {\n return pathname.includes(".") || isInternalEndpoint(pathname);\n}\nfunction normalizeChunkPath(filename, basePath = INTERNAL_PATH_PREFIXES.CHUNKS) {\n if (filename.startsWith("/")) {\n return filename;\n }\n return `${basePath.replace(/\\/$/, "")}/${filename}`;\n}\nvar DEFAULT_DASHBOARD_PORT, DEFAULT_PORT, INTERNAL_PREFIX, INTERNAL_PATH_PREFIXES, INTERNAL_ENDPOINTS, BUILD_DIRS, PROJECT_DIRS, DEFAULT_CACHE_DIR, DEV_SERVER_ENDPOINTS;\nvar init_server = __esm({\n "src/core/utils/constants/server.ts"() {\n "use strict";\n DEFAULT_DASHBOARD_PORT = 3002;\n DEFAULT_PORT = 3e3;\n INTERNAL_PREFIX = "/_veryfront";\n INTERNAL_PATH_PREFIXES = {\n /** React Server Components endpoints */\n RSC: `${INTERNAL_PREFIX}/rsc/`,\n /** File system access endpoints (base64 encoded paths) */\n FS: `${INTERNAL_PREFIX}/fs/`,\n /** Virtual module system */\n MODULES: `${INTERNAL_PREFIX}/modules/`,\n /** Generated page modules */\n PAGES: `${INTERNAL_PREFIX}/pages/`,\n /** Data JSON endpoints */\n DATA: `${INTERNAL_PREFIX}/data/`,\n /** Library modules (AI SDK, etc.) */\n LIB: `${INTERNAL_PREFIX}/lib/`,\n /** Chunk assets */\n CHUNKS: `${INTERNAL_PREFIX}/chunks/`,\n /** Client component modules */\n CLIENT: `${INTERNAL_PREFIX}/client/`\n };\n INTERNAL_ENDPOINTS = {\n // Development endpoints\n HMR_RUNTIME: `${INTERNAL_PREFIX}/hmr-runtime.js`,\n HMR: `${INTERNAL_PREFIX}/hmr.js`,\n HYDRATE: `${INTERNAL_PREFIX}/hydrate.js`,\n ERROR_OVERLAY: `${INTERNAL_PREFIX}/error-overlay.js`,\n DEV_LOADER: `${INTERNAL_PREFIX}/dev-loader.js`,\n CLIENT_LOG: `${INTERNAL_PREFIX}/log`,\n // Production endpoints\n CLIENT_JS: `${INTERNAL_PREFIX}/client.js`,\n ROUTER_JS: `${INTERNAL_PREFIX}/router.js`,\n PREFETCH_JS: `${INTERNAL_PREFIX}/prefetch.js`,\n MANIFEST_JSON: `${INTERNAL_PREFIX}/manifest.json`,\n APP_JS: `${INTERNAL_PREFIX}/app.js`,\n // RSC endpoints\n RSC_CLIENT: `${INTERNAL_PREFIX}/rsc/client.js`,\n RSC_MANIFEST: `${INTERNAL_PREFIX}/rsc/manifest`,\n RSC_STREAM: `${INTERNAL_PREFIX}/rsc/stream`,\n RSC_PAYLOAD: `${INTERNAL_PREFIX}/rsc/payload`,\n RSC_RENDER: `${INTERNAL_PREFIX}/rsc/render`,\n RSC_PAGE: `${INTERNAL_PREFIX}/rsc/page`,\n RSC_MODULE: `${INTERNAL_PREFIX}/rsc/module`,\n RSC_DOM: `${INTERNAL_PREFIX}/rsc/dom.js`,\n RSC_HYDRATOR: `${INTERNAL_PREFIX}/rsc/hydrator.js`,\n RSC_HYDRATE_CLIENT: `${INTERNAL_PREFIX}/rsc/hydrate-client.js`,\n // Library module endpoints\n LIB_AI_REACT: `${INTERNAL_PREFIX}/lib/ai/react.js`,\n LIB_AI_COMPONENTS: `${INTERNAL_PREFIX}/lib/ai/components.js`,\n LIB_AI_PRIMITIVES: `${INTERNAL_PREFIX}/lib/ai/primitives.js`\n };\n BUILD_DIRS = {\n /** Main build output directory */\n ROOT: "_veryfront",\n /** Chunks directory */\n CHUNKS: "_veryfront/chunks",\n /** Data directory */\n DATA: "_veryfront/data",\n /** Assets directory */\n ASSETS: "_veryfront/assets"\n };\n PROJECT_DIRS = {\n /** Base veryfront internal directory */\n ROOT: ".veryfront",\n /** Cache directory for build artifacts, transforms, etc. */\n CACHE: ".veryfront/cache",\n /** KV store directory */\n KV: ".veryfront/kv",\n /** Log files directory */\n LOGS: ".veryfront/logs",\n /** Temporary files directory */\n TMP: ".veryfront/tmp"\n };\n DEFAULT_CACHE_DIR = PROJECT_DIRS.CACHE;\n DEV_SERVER_ENDPOINTS = {\n HMR_RUNTIME: INTERNAL_ENDPOINTS.HMR_RUNTIME,\n ERROR_OVERLAY: INTERNAL_ENDPOINTS.ERROR_OVERLAY\n };\n }\n});\n\n// src/core/utils/constants/index.ts\nvar init_constants = __esm({\n "src/core/utils/constants/index.ts"() {\n "use strict";\n init_build();\n init_cache();\n init_cdn();\n init_env2();\n init_hash();\n init_hmr();\n init_html();\n init_http();\n init_network();\n init_security();\n init_server();\n }\n});\n\n// src/core/utils/paths.ts\nvar PATHS, VERYFRONT_PATHS, FILE_EXTENSIONS;\nvar init_paths = __esm({\n "src/core/utils/paths.ts"() {\n "use strict";\n init_server();\n PATHS = {\n PAGES_DIR: "pages",\n COMPONENTS_DIR: "components",\n PUBLIC_DIR: "public",\n STYLES_DIR: "styles",\n DIST_DIR: "dist",\n CONFIG_FILE: "veryfront.config.js"\n };\n VERYFRONT_PATHS = {\n INTERNAL_PREFIX,\n BUILD_DIR: BUILD_DIRS.ROOT,\n CHUNKS_DIR: BUILD_DIRS.CHUNKS,\n DATA_DIR: BUILD_DIRS.DATA,\n ASSETS_DIR: BUILD_DIRS.ASSETS,\n HMR_RUNTIME: INTERNAL_ENDPOINTS.HMR_RUNTIME,\n CLIENT_JS: INTERNAL_ENDPOINTS.CLIENT_JS,\n ROUTER_JS: INTERNAL_ENDPOINTS.ROUTER_JS,\n ERROR_OVERLAY: INTERNAL_ENDPOINTS.ERROR_OVERLAY\n };\n FILE_EXTENSIONS = {\n MDX: [".mdx", ".md"],\n SCRIPT: [".tsx", ".ts", ".jsx", ".js"],\n STYLE: [".css", ".scss", ".sass"],\n ALL: [".mdx", ".md", ".tsx", ".ts", ".jsx", ".js", ".css"]\n };\n }\n});\n\n// src/core/utils/hash-utils.ts\nasync function computeHash(content) {\n const encoder = new TextEncoder();\n const data = encoder.encode(content);\n const hashBuffer = await crypto.subtle.digest("SHA-256", data);\n const hashArray = Array.from(new Uint8Array(hashBuffer));\n return hashArray.map((b) => b.toString(16).padStart(2, "0")).join("");\n}\nfunction getContentHash(content) {\n return computeHash(content);\n}\nfunction computeContentHash(content) {\n return computeHash(content);\n}\nfunction computeCodeHash(code) {\n const combined = code.code + (code.css || "") + (code.sourceMap || "");\n return computeHash(combined);\n}\nfunction simpleHash(str) {\n let hash = 0;\n for (let i = 0; i < str.length; i++) {\n const char = str.charCodeAt(i);\n hash = (hash << 5) - hash + char;\n hash = hash & hash;\n }\n return Math.abs(hash);\n}\nasync function shortHash(content) {\n const fullHash = await computeHash(content);\n return fullHash.slice(0, 8);\n}\nvar init_hash_utils = __esm({\n "src/core/utils/hash-utils.ts"() {\n "use strict";\n }\n});\n\n// src/core/utils/memoize.ts\nfunction memoizeAsync(fn, keyHasher) {\n const cache = new MemoCache();\n return async (...args) => {\n const key = keyHasher(...args);\n if (cache.has(key)) {\n return cache.get(key);\n }\n const result = await fn(...args);\n cache.set(key, result);\n return result;\n };\n}\nfunction memoize(fn, keyHasher) {\n const cache = new MemoCache();\n return (...args) => {\n const key = keyHasher(...args);\n if (cache.has(key)) {\n return cache.get(key);\n }\n const result = fn(...args);\n cache.set(key, result);\n return result;\n };\n}\nfunction simpleHash2(...values) {\n const FNV_OFFSET_BASIS = 2166136261;\n const FNV_PRIME = 16777619;\n let hash = FNV_OFFSET_BASIS;\n for (const value of values) {\n const str = typeof value === "string" ? value : String(value);\n for (let i = 0; i < str.length; i++) {\n hash ^= str.charCodeAt(i);\n hash = Math.imul(hash, FNV_PRIME);\n }\n }\n return (hash >>> 0).toString(36);\n}\nvar MemoCache;\nvar init_memoize = __esm({\n "src/core/utils/memoize.ts"() {\n "use strict";\n MemoCache = class {\n constructor() {\n this.cache = /* @__PURE__ */ new Map();\n }\n get(key) {\n return this.cache.get(key);\n }\n set(key, value) {\n this.cache.set(key, value);\n }\n has(key) {\n return this.cache.has(key);\n }\n clear() {\n this.cache.clear();\n }\n size() {\n return this.cache.size;\n }\n };\n }\n});\n\n// src/core/utils/path-utils.ts\nfunction normalizePath(pathname) {\n pathname = pathname.replace(/\\\\+/g, "/").replace(/\\/\\.+\\//g, "/");\n if (pathname !== "/" && pathname.endsWith("/")) {\n pathname = pathname.slice(0, -1);\n }\n return pathname;\n}\nfunction joinPath(a, b) {\n return `${a.replace(/\\/$/, "")}/${b.replace(/^\\//, "")}`;\n}\nfunction isWithinDirectory(root, target) {\n const normalizedRoot = normalizePath(root);\n const normalizedTarget = normalizePath(target);\n return normalizedTarget.startsWith(`${normalizedRoot}/`) || normalizedTarget === normalizedRoot;\n}\nfunction getExtension(path) {\n const lastDot = path.lastIndexOf(".");\n if (lastDot === -1 || lastDot === path.length - 1) {\n return "";\n }\n return path.slice(lastDot);\n}\nfunction getDirectory(path) {\n const normalized = normalizePath(path);\n const lastSlash = normalized.lastIndexOf("/");\n return lastSlash <= 0 ? "/" : normalized.slice(0, lastSlash);\n}\nfunction hasHashedFilename(path) {\n return /\\.[a-f0-9]{8,}\\./.test(path);\n}\nfunction isAbsolutePath(path) {\n return path.startsWith("/") || /^[A-Za-z]:[\\\\/]/.test(path);\n}\nfunction toBase64Url(s) {\n const b64 = btoa(s);\n return b64.replaceAll("+", "-").replaceAll("/", "_").replaceAll("=", "");\n}\nfunction fromBase64Url(encoded) {\n const b64 = encoded.replaceAll("-", "+").replaceAll("_", "/");\n const pad = b64.length % 4 === 2 ? "==" : b64.length % 4 === 3 ? "=" : "";\n try {\n return atob(b64 + pad);\n } catch (error2) {\n logger.debug(`Failed to decode base64url string "${encoded}":`, error2);\n return "";\n }\n}\nvar init_path_utils = __esm({\n "src/core/utils/path-utils.ts"() {\n "use strict";\n init_logger();\n }\n});\n\n// src/core/utils/format-utils.ts\nfunction formatBytes(bytes) {\n if (bytes === 0)\n return "0 Bytes";\n const absBytes = Math.abs(bytes);\n if (absBytes < 1) {\n return `${absBytes} Bytes`;\n }\n const k = 1024;\n const sizes = ["Bytes", "KB", "MB", "GB", "TB"];\n const i = Math.floor(Math.log(absBytes) / Math.log(k));\n const index = Math.max(0, Math.min(i, sizes.length - 1));\n return `${parseFloat((absBytes / Math.pow(k, index)).toFixed(2))} ${sizes[index]}`;\n}\nfunction estimateSize(value) {\n if (value === null || value === void 0)\n return 8;\n switch (typeof value) {\n case "boolean":\n return 4;\n case "number":\n return 8;\n case "string":\n return value.length * 2;\n case "function":\n return 0;\n case "object":\n return estimateObjectSize(value);\n default:\n return 32;\n }\n}\nfunction estimateSizeWithCircularHandling(value) {\n const seen = /* @__PURE__ */ new WeakSet();\n const encoder = new TextEncoder();\n const json3 = JSON.stringify(value, (_key, val) => {\n if (typeof val === "object" && val !== null) {\n if (seen.has(val))\n return void 0;\n seen.add(val);\n if (val instanceof Map) {\n return { __type: "Map", entries: Array.from(val.entries()) };\n }\n if (val instanceof Set) {\n return { __type: "Set", values: Array.from(val.values()) };\n }\n }\n if (typeof val === "function")\n return void 0;\n if (val instanceof Uint8Array) {\n return { __type: "Uint8Array", length: val.length };\n }\n return val;\n });\n return encoder.encode(json3 ?? "").length;\n}\nfunction estimateObjectSize(value) {\n if (value instanceof ArrayBuffer)\n return value.byteLength;\n if (value instanceof Uint8Array || value instanceof Uint16Array || value instanceof Uint32Array || value instanceof Int8Array || value instanceof Int16Array || value instanceof Int32Array) {\n return value.byteLength;\n }\n try {\n return JSON.stringify(value).length * 2;\n } catch (error2) {\n logger.debug("Failed to estimate size of non-serializable object:", error2);\n return 1024;\n }\n}\nfunction formatDuration(ms) {\n if (ms < 1e3)\n return `${ms}ms`;\n if (ms < 6e4)\n return `${(ms / 1e3).toFixed(1)}s`;\n if (ms < 36e5)\n return `${Math.floor(ms / 6e4)}m ${Math.floor(ms % 6e4 / 1e3)}s`;\n return `${Math.floor(ms / 36e5)}h ${Math.floor(ms % 36e5 / 6e4)}m`;\n}\nfunction formatNumber(num) {\n return num.toString().replace(/\\B(?=(\\d{3})+(?!\\d))/g, ",");\n}\nfunction truncateString(str, maxLength) {\n if (str.length <= maxLength)\n return str;\n return str.slice(0, maxLength - 3) + "...";\n}\nvar init_format_utils = __esm({\n "src/core/utils/format-utils.ts"() {\n "use strict";\n init_logger();\n }\n});\n\n// src/core/utils/bundle-manifest.ts\nfunction setBundleManifestStore(store) {\n manifestStore = store;\n serverLogger.info("[bundle-manifest] Bundle manifest store configured", {\n type: store.constructor.name\n });\n}\nfunction getBundleManifestStore() {\n return manifestStore;\n}\nvar InMemoryBundleManifestStore, manifestStore;\nvar init_bundle_manifest = __esm({\n "src/core/utils/bundle-manifest.ts"() {\n "use strict";\n init_logger2();\n init_hash_utils();\n InMemoryBundleManifestStore = class {\n constructor() {\n this.metadata = /* @__PURE__ */ new Map();\n this.code = /* @__PURE__ */ new Map();\n this.sourceIndex = /* @__PURE__ */ new Map();\n }\n getBundleMetadata(key) {\n const entry = this.metadata.get(key);\n if (!entry)\n return Promise.resolve(void 0);\n if (entry.expiry && Date.now() > entry.expiry) {\n this.metadata.delete(key);\n return Promise.resolve(void 0);\n }\n return Promise.resolve(entry.value);\n }\n setBundleMetadata(key, metadata, ttlMs) {\n const expiry = ttlMs ? Date.now() + ttlMs : void 0;\n this.metadata.set(key, { value: metadata, expiry });\n if (!this.sourceIndex.has(metadata.source)) {\n this.sourceIndex.set(metadata.source, /* @__PURE__ */ new Set());\n }\n this.sourceIndex.get(metadata.source).add(key);\n return Promise.resolve();\n }\n getBundleCode(hash) {\n const entry = this.code.get(hash);\n if (!entry)\n return Promise.resolve(void 0);\n if (entry.expiry && Date.now() > entry.expiry) {\n this.code.delete(hash);\n return Promise.resolve(void 0);\n }\n return Promise.resolve(entry.value);\n }\n setBundleCode(hash, code, ttlMs) {\n const expiry = ttlMs ? Date.now() + ttlMs : void 0;\n this.code.set(hash, { value: code, expiry });\n return Promise.resolve();\n }\n async deleteBundle(key) {\n const metadata = await this.getBundleMetadata(key);\n this.metadata.delete(key);\n if (metadata) {\n this.code.delete(metadata.codeHash);\n const sourceKeys = this.sourceIndex.get(metadata.source);\n if (sourceKeys) {\n sourceKeys.delete(key);\n if (sourceKeys.size === 0) {\n this.sourceIndex.delete(metadata.source);\n }\n }\n }\n }\n async invalidateSource(source) {\n const keys = this.sourceIndex.get(source);\n if (!keys)\n return 0;\n let count = 0;\n for (const key of Array.from(keys)) {\n await this.deleteBundle(key);\n count++;\n }\n this.sourceIndex.delete(source);\n return count;\n }\n clear() {\n this.metadata.clear();\n this.code.clear();\n this.sourceIndex.clear();\n return Promise.resolve();\n }\n isAvailable() {\n return Promise.resolve(true);\n }\n getStats() {\n let totalSize = 0;\n let oldest;\n let newest;\n for (const { value } of this.metadata.values()) {\n totalSize += value.size;\n if (!oldest || value.compiledAt < oldest)\n oldest = value.compiledAt;\n if (!newest || value.compiledAt > newest)\n newest = value.compiledAt;\n }\n return Promise.resolve({\n totalBundles: this.metadata.size,\n totalSize,\n oldestBundle: oldest,\n newestBundle: newest\n });\n }\n };\n manifestStore = new InMemoryBundleManifestStore();\n }\n});\n\n// src/core/utils/bundle-manifest-init.ts\nasync function initializeBundleManifest(config, mode, adapter) {\n const manifestConfig = config.cache?.bundleManifest;\n const enabled = manifestConfig?.enabled ?? mode === "production";\n if (!enabled) {\n serverLogger.info("[bundle-manifest] Bundle manifest disabled");\n setBundleManifestStore(new InMemoryBundleManifestStore());\n return;\n }\n const envType = adapter?.env.get("VERYFRONT_BUNDLE_MANIFEST_TYPE");\n const storeType = manifestConfig?.type || envType || "memory";\n serverLogger.info("[bundle-manifest] Initializing bundle manifest", {\n type: storeType,\n mode\n });\n try {\n let store;\n switch (storeType) {\n case "redis": {\n const { RedisBundleManifestStore } = await import("./bundle-manifest-redis.ts");\n const redisUrl = manifestConfig?.redisUrl || adapter?.env.get("VERYFRONT_BUNDLE_MANIFEST_REDIS_URL");\n store = new RedisBundleManifestStore(\n {\n url: redisUrl,\n keyPrefix: manifestConfig?.keyPrefix\n },\n adapter\n );\n const available = await store.isAvailable();\n if (!available) {\n serverLogger.warn("[bundle-manifest] Redis not available, falling back to in-memory");\n store = new InMemoryBundleManifestStore();\n } else {\n serverLogger.info("[bundle-manifest] Redis store initialized");\n }\n break;\n }\n case "kv": {\n const { KVBundleManifestStore } = await import("./bundle-manifest-kv.ts");\n store = new KVBundleManifestStore({\n keyPrefix: manifestConfig?.keyPrefix\n });\n const available = await store.isAvailable();\n if (!available) {\n serverLogger.warn("[bundle-manifest] KV not available, falling back to in-memory");\n store = new InMemoryBundleManifestStore();\n } else {\n serverLogger.info("[bundle-manifest] KV store initialized");\n }\n break;\n }\n case "memory":\n default: {\n store = new InMemoryBundleManifestStore();\n serverLogger.info("[bundle-manifest] In-memory store initialized");\n break;\n }\n }\n setBundleManifestStore(store);\n try {\n const stats = await store.getStats();\n serverLogger.info("[bundle-manifest] Store statistics", stats);\n } catch (error2) {\n serverLogger.debug("[bundle-manifest] Failed to get stats", { error: error2 });\n }\n } catch (error2) {\n serverLogger.error("[bundle-manifest] Failed to initialize store, using in-memory fallback", {\n error: error2\n });\n setBundleManifestStore(new InMemoryBundleManifestStore());\n }\n}\nfunction getBundleManifestTTL(config, mode) {\n const manifestConfig = config.cache?.bundleManifest;\n if (manifestConfig?.ttl) {\n return manifestConfig.ttl;\n }\n if (mode === "production") {\n return BUNDLE_MANIFEST_PROD_TTL_MS;\n } else {\n return BUNDLE_MANIFEST_DEV_TTL_MS;\n }\n}\nasync function warmupBundleManifest(store, keys) {\n serverLogger.info("[bundle-manifest] Warming up cache", { keys: keys.length });\n let loaded = 0;\n let failed = 0;\n for (const key of keys) {\n try {\n const metadata = await store.getBundleMetadata(key);\n if (metadata) {\n await store.getBundleCode(metadata.codeHash);\n loaded++;\n }\n } catch (error2) {\n serverLogger.debug("[bundle-manifest] Failed to warm up key", { key, error: error2 });\n failed++;\n }\n }\n serverLogger.info("[bundle-manifest] Cache warmup complete", { loaded, failed });\n}\nvar init_bundle_manifest_init = __esm({\n "src/core/utils/bundle-manifest-init.ts"() {\n "use strict";\n init_logger2();\n init_bundle_manifest();\n init_cache();\n }\n});\n\n// src/core/utils/feature-flags.ts\nfunction isRSCEnabled(config) {\n if (config?.experimental?.rsc !== void 0) {\n return config.experimental.rsc;\n }\n return getEnv("VERYFRONT_EXPERIMENTAL_RSC") === "1";\n}\nvar init_feature_flags = __esm({\n "src/core/utils/feature-flags.ts"() {\n "use strict";\n init_process();\n }\n});\n\n// src/core/utils/platform.ts\nfunction isCompiledBinary() {\n if (!isDeno)\n return false;\n try {\n const path = execPath();\n return path.includes("veryfront");\n } catch {\n return false;\n }\n}\nvar init_platform = __esm({\n "src/core/utils/platform.ts"() {\n "use strict";\n init_runtime();\n init_process();\n }\n});\n\n// src/core/utils/index.ts\nvar utils_exports = {};\n__export(utils_exports, {\n ABSOLUTE_PATH_PATTERN: () => ABSOLUTE_PATH_PATTERN,\n BREAKPOINT_LG: () => BREAKPOINT_LG,\n BREAKPOINT_MD: () => BREAKPOINT_MD,\n BREAKPOINT_SM: () => BREAKPOINT_SM,\n BREAKPOINT_XL: () => BREAKPOINT_XL,\n BUILD_DIRS: () => BUILD_DIRS,\n BUNDLE_CACHE_TTL_DEVELOPMENT_MS: () => BUNDLE_CACHE_TTL_DEVELOPMENT_MS,\n BUNDLE_CACHE_TTL_PRODUCTION_MS: () => BUNDLE_CACHE_TTL_PRODUCTION_MS,\n BUNDLE_MANIFEST_DEV_TTL_MS: () => BUNDLE_MANIFEST_DEV_TTL_MS,\n BUNDLE_MANIFEST_PROD_TTL_MS: () => BUNDLE_MANIFEST_PROD_TTL_MS,\n BYTES_PER_KB: () => BYTES_PER_KB,\n BYTES_PER_MB: () => BYTES_PER_MB,\n CACHE_CLEANUP_INTERVAL_MS: () => CACHE_CLEANUP_INTERVAL_MS,\n CLEANUP_INTERVAL_MULTIPLIER: () => CLEANUP_INTERVAL_MULTIPLIER,\n COMPONENT_LOADER_MAX_ENTRIES: () => COMPONENT_LOADER_MAX_ENTRIES,\n COMPONENT_LOADER_TTL_MS: () => COMPONENT_LOADER_TTL_MS,\n DASHBOARD_RECONNECT_DELAY_MS: () => DASHBOARD_RECONNECT_DELAY_MS,\n DATA_FETCHING_MAX_ENTRIES: () => DATA_FETCHING_MAX_ENTRIES,\n DATA_FETCHING_TTL_MS: () => DATA_FETCHING_TTL_MS,\n DEFAULT_ALLOWED_CDN_HOSTS: () => DEFAULT_ALLOWED_CDN_HOSTS,\n DEFAULT_API_SERVER_PORT: () => DEFAULT_API_SERVER_PORT,\n DEFAULT_BUILD_CONCURRENCY: () => DEFAULT_BUILD_CONCURRENCY,\n DEFAULT_CACHE_DIR: () => DEFAULT_CACHE_DIR,\n DEFAULT_DASHBOARD_PORT: () => DEFAULT_DASHBOARD_PORT,\n DEFAULT_DEV_SERVER_PORT: () => DEFAULT_DEV_SERVER_PORT,\n DEFAULT_IMAGE_LARGE_SIZE: () => DEFAULT_IMAGE_LARGE_SIZE,\n DEFAULT_IMAGE_SMALL_SIZE: () => DEFAULT_IMAGE_SMALL_SIZE,\n DEFAULT_IMAGE_THUMBNAIL_SIZE: () => DEFAULT_IMAGE_THUMBNAIL_SIZE,\n DEFAULT_LRU_MAX_ENTRIES: () => DEFAULT_LRU_MAX_ENTRIES,\n DEFAULT_MAX_STRING_LENGTH: () => DEFAULT_MAX_STRING_LENGTH,\n DEFAULT_METRICS_PORT: () => DEFAULT_METRICS_PORT,\n DEFAULT_PORT: () => DEFAULT_PORT,\n DEFAULT_PREVIEW_SERVER_PORT: () => DEFAULT_PREVIEW_SERVER_PORT,\n DEFAULT_REDIS_PORT: () => DEFAULT_REDIS_PORT,\n DEFAULT_SERVER_PORT: () => DEFAULT_SERVER_PORT,\n DENO_KV_SAFE_SIZE_LIMIT_BYTES: () => DENO_KV_SAFE_SIZE_LIMIT_BYTES,\n DENO_STD_BASE: () => DENO_STD_BASE,\n DENO_STD_VERSION: () => DENO_STD_VERSION,\n DEV_SERVER_ENDPOINTS: () => DEV_SERVER_ENDPOINTS,\n DIRECTORY_TRAVERSAL_PATTERN: () => DIRECTORY_TRAVERSAL_PATTERN,\n ENV_VARS: () => ENV_VARS,\n ESM_CDN_BASE: () => ESM_CDN_BASE,\n FILE_EXTENSIONS: () => FILE_EXTENSIONS,\n FORBIDDEN_PATH_PATTERNS: () => FORBIDDEN_PATH_PATTERNS,\n HASH_SEED_DJB2: () => HASH_SEED_DJB2,\n HASH_SEED_FNV1A: () => HASH_SEED_FNV1A,\n HMR_CLIENT_RELOAD_DELAY_MS: () => HMR_CLIENT_RELOAD_DELAY_MS,\n HMR_CLOSE_MESSAGE_TOO_LARGE: () => HMR_CLOSE_MESSAGE_TOO_LARGE,\n HMR_CLOSE_NORMAL: () => HMR_CLOSE_NORMAL,\n HMR_CLOSE_RATE_LIMIT: () => HMR_CLOSE_RATE_LIMIT,\n HMR_FILE_WATCHER_DEBOUNCE_MS: () => HMR_FILE_WATCHER_DEBOUNCE_MS,\n HMR_KEEP_ALIVE_INTERVAL_MS: () => HMR_KEEP_ALIVE_INTERVAL_MS,\n HMR_MAX_MESSAGES_PER_MINUTE: () => HMR_MAX_MESSAGES_PER_MINUTE,\n HMR_MAX_MESSAGE_SIZE_BYTES: () => HMR_MAX_MESSAGE_SIZE_BYTES,\n HMR_MESSAGE_TYPES: () => HMR_MESSAGE_TYPES,\n HMR_PORT_OFFSET: () => HMR_PORT_OFFSET,\n HMR_RATE_LIMIT_WINDOW_MS: () => HMR_RATE_LIMIT_WINDOW_MS,\n HMR_RECONNECT_DELAY_MS: () => HMR_RECONNECT_DELAY_MS,\n HMR_RELOAD_DELAY_MS: () => HMR_RELOAD_DELAY_MS,\n HOURS_PER_DAY: () => HOURS_PER_DAY,\n HTTP_BAD_GATEWAY: () => HTTP_BAD_GATEWAY,\n HTTP_BAD_REQUEST: () => HTTP_BAD_REQUEST,\n HTTP_CACHE_LONG_MAX_AGE_SEC: () => HTTP_CACHE_LONG_MAX_AGE_SEC,\n HTTP_CACHE_MEDIUM_MAX_AGE_SEC: () => HTTP_CACHE_MEDIUM_MAX_AGE_SEC,\n HTTP_CACHE_SHORT_MAX_AGE_SEC: () => HTTP_CACHE_SHORT_MAX_AGE_SEC,\n HTTP_CONTENT_TYPES: () => HTTP_CONTENT_TYPES,\n HTTP_CONTENT_TYPE_IMAGE_AVIF: () => HTTP_CONTENT_TYPE_IMAGE_AVIF,\n HTTP_CONTENT_TYPE_IMAGE_GIF: () => HTTP_CONTENT_TYPE_IMAGE_GIF,\n HTTP_CONTENT_TYPE_IMAGE_ICO: () => HTTP_CONTENT_TYPE_IMAGE_ICO,\n HTTP_CONTENT_TYPE_IMAGE_JPEG: () => HTTP_CONTENT_TYPE_IMAGE_JPEG,\n HTTP_CONTENT_TYPE_IMAGE_PNG: () => HTTP_CONTENT_TYPE_IMAGE_PNG,\n HTTP_CONTENT_TYPE_IMAGE_SVG: () => HTTP_CONTENT_TYPE_IMAGE_SVG,\n HTTP_CONTENT_TYPE_IMAGE_WEBP: () => HTTP_CONTENT_TYPE_IMAGE_WEBP,\n HTTP_CREATED: () => HTTP_CREATED,\n HTTP_FORBIDDEN: () => HTTP_FORBIDDEN,\n HTTP_GONE: () => HTTP_GONE,\n HTTP_INTERNAL_SERVER_ERROR: () => HTTP_INTERNAL_SERVER_ERROR,\n HTTP_METHOD_NOT_ALLOWED: () => HTTP_METHOD_NOT_ALLOWED,\n HTTP_MODULE_FETCH_TIMEOUT_MS: () => HTTP_MODULE_FETCH_TIMEOUT_MS,\n HTTP_NETWORK_CONNECT_TIMEOUT: () => HTTP_NETWORK_CONNECT_TIMEOUT,\n HTTP_NOT_FOUND: () => HTTP_NOT_FOUND,\n HTTP_NOT_IMPLEMENTED: () => HTTP_NOT_IMPLEMENTED,\n HTTP_NOT_MODIFIED: () => HTTP_NOT_MODIFIED,\n HTTP_NO_CONTENT: () => HTTP_NO_CONTENT,\n HTTP_OK: () => HTTP_OK,\n HTTP_PAYLOAD_TOO_LARGE: () => HTTP_PAYLOAD_TOO_LARGE,\n HTTP_REDIRECT_FOUND: () => HTTP_REDIRECT_FOUND,\n HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE: () => HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE,\n HTTP_SERVER_ERROR: () => HTTP_SERVER_ERROR,\n HTTP_STATUS_CLIENT_ERROR_MIN: () => HTTP_STATUS_CLIENT_ERROR_MIN,\n HTTP_STATUS_REDIRECT_MIN: () => HTTP_STATUS_REDIRECT_MIN,\n HTTP_STATUS_SERVER_ERROR_MIN: () => HTTP_STATUS_SERVER_ERROR_MIN,\n HTTP_STATUS_SUCCESS_MIN: () => HTTP_STATUS_SUCCESS_MIN,\n HTTP_TOO_MANY_REQUESTS: () => HTTP_TOO_MANY_REQUESTS,\n HTTP_UNAUTHORIZED: () => HTTP_UNAUTHORIZED,\n HTTP_UNAVAILABLE: () => HTTP_UNAVAILABLE,\n HTTP_URI_TOO_LONG: () => HTTP_URI_TOO_LONG,\n IMAGE_OPTIMIZATION: () => IMAGE_OPTIMIZATION,\n INTERNAL_ENDPOINTS: () => INTERNAL_ENDPOINTS,\n INTERNAL_PATH_PREFIXES: () => INTERNAL_PATH_PREFIXES,\n INTERNAL_PREFIX: () => INTERNAL_PREFIX,\n InMemoryBundleManifestStore: () => InMemoryBundleManifestStore,\n JSDELIVR_CDN_BASE: () => JSDELIVR_CDN_BASE,\n KB_IN_BYTES: () => KB_IN_BYTES,\n LRU_DEFAULT_MAX_ENTRIES: () => LRU_DEFAULT_MAX_ENTRIES,\n LRU_DEFAULT_MAX_SIZE_BYTES: () => LRU_DEFAULT_MAX_SIZE_BYTES,\n LogLevel: () => LogLevel,\n MAX_CHUNK_SIZE_KB: () => MAX_CHUNK_SIZE_KB,\n MAX_PATH_LENGTH: () => MAX_PATH_LENGTH,\n MAX_PATH_TRAVERSAL_DEPTH: () => MAX_PATH_TRAVERSAL_DEPTH,\n MAX_PORT: () => MAX_PORT,\n MDX_CACHE_TTL_DEVELOPMENT_MS: () => MDX_CACHE_TTL_DEVELOPMENT_MS,\n MDX_CACHE_TTL_PRODUCTION_MS: () => MDX_CACHE_TTL_PRODUCTION_MS,\n MDX_RENDERER_MAX_ENTRIES: () => MDX_RENDERER_MAX_ENTRIES,\n MDX_RENDERER_TTL_MS: () => MDX_RENDERER_TTL_MS,\n MINUTES_PER_HOUR: () => MINUTES_PER_HOUR,\n MIN_PORT: () => MIN_PORT,\n MS_PER_MINUTE: () => MS_PER_MINUTE,\n MS_PER_SECOND: () => MS_PER_SECOND,\n MemoCache: () => MemoCache,\n ONE_DAY_MS: () => ONE_DAY_MS,\n PATHS: () => PATHS,\n PREFETCH_DEFAULT_DELAY_MS: () => PREFETCH_DEFAULT_DELAY_MS,\n PREFETCH_DEFAULT_TIMEOUT_MS: () => PREFETCH_DEFAULT_TIMEOUT_MS,\n PREFETCH_MAX_SIZE_BYTES: () => PREFETCH_MAX_SIZE_BYTES,\n PROJECT_DIRS: () => PROJECT_DIRS,\n PROSE_MAX_WIDTH: () => PROSE_MAX_WIDTH,\n REACT_DEFAULT_VERSION: () => REACT_DEFAULT_VERSION,\n REACT_VERSION_17: () => REACT_VERSION_17,\n REACT_VERSION_18_2: () => REACT_VERSION_18_2,\n REACT_VERSION_18_3: () => REACT_VERSION_18_3,\n REACT_VERSION_19: () => REACT_VERSION_19,\n REACT_VERSION_19_RC: () => REACT_VERSION_19_RC,\n RENDERER_CORE_MAX_ENTRIES: () => RENDERER_CORE_MAX_ENTRIES,\n RENDERER_CORE_TTL_MS: () => RENDERER_CORE_TTL_MS,\n RESPONSIVE_IMAGE_WIDTHS: () => RESPONSIVE_IMAGE_WIDTHS,\n RESPONSIVE_IMAGE_WIDTH_LG: () => RESPONSIVE_IMAGE_WIDTH_LG,\n RESPONSIVE_IMAGE_WIDTH_MD: () => RESPONSIVE_IMAGE_WIDTH_MD,\n RESPONSIVE_IMAGE_WIDTH_SM: () => RESPONSIVE_IMAGE_WIDTH_SM,\n RESPONSIVE_IMAGE_WIDTH_XS: () => RESPONSIVE_IMAGE_WIDTH_XS,\n RSC_MANIFEST_CACHE_TTL_MS: () => RSC_MANIFEST_CACHE_TTL_MS,\n SECONDS_PER_MINUTE: () => SECONDS_PER_MINUTE,\n SERVER_ACTION_DEFAULT_TTL_SEC: () => SERVER_ACTION_DEFAULT_TTL_SEC,\n SERVER_FUNCTION_DEFAULT_TIMEOUT_MS: () => SERVER_FUNCTION_DEFAULT_TIMEOUT_MS,\n TSX_LAYOUT_MAX_ENTRIES: () => TSX_LAYOUT_MAX_ENTRIES,\n TSX_LAYOUT_TTL_MS: () => TSX_LAYOUT_TTL_MS,\n UNOCSS_VERSION: () => UNOCSS_VERSION,\n VERSION: () => VERSION,\n VERYFRONT_PATHS: () => VERYFRONT_PATHS,\n VERYFRONT_VERSION: () => VERSION,\n Z_INDEX_DEV_INDICATOR: () => Z_INDEX_DEV_INDICATOR,\n Z_INDEX_ERROR_OVERLAY: () => Z_INDEX_ERROR_OVERLAY,\n __loggerResetForTests: () => __loggerResetForTests,\n agentLogger: () => agentLogger,\n bundlerLogger: () => bundlerLogger,\n cliLogger: () => cliLogger,\n computeCodeHash: () => computeCodeHash,\n computeContentHash: () => computeContentHash,\n computeHash: () => computeHash,\n estimateSize: () => estimateSize,\n estimateSizeWithCircularHandling: () => estimateSizeWithCircularHandling,\n formatBytes: () => formatBytes,\n formatDuration: () => formatDuration,\n formatNumber: () => formatNumber,\n fromBase64Url: () => fromBase64Url,\n getBundleManifestStore: () => getBundleManifestStore,\n getBundleManifestTTL: () => getBundleManifestTTL,\n getContentHash: () => getContentHash,\n getDenoStdNodeBase: () => getDenoStdNodeBase,\n getDirectory: () => getDirectory,\n getEnvironmentVariable: () => getEnvironmentVariable,\n getExtension: () => getExtension,\n getReactCDNUrl: () => getReactCDNUrl,\n getReactDOMCDNUrl: () => getReactDOMCDNUrl,\n getReactDOMClientCDNUrl: () => getReactDOMClientCDNUrl,\n getReactDOMServerCDNUrl: () => getReactDOMServerCDNUrl,\n getReactImportMap: () => getReactImportMap,\n getReactJSXDevRuntimeCDNUrl: () => getReactJSXDevRuntimeCDNUrl,\n getReactJSXRuntimeCDNUrl: () => getReactJSXRuntimeCDNUrl,\n getUnoCSSTailwindResetUrl: () => getUnoCSSTailwindResetUrl,\n hasBunRuntime: () => hasBunRuntime,\n hasDenoRuntime: () => hasDenoRuntime,\n hasHashedFilename: () => hasHashedFilename,\n hasNodeProcess: () => hasNodeProcess,\n initializeBundleManifest: () => initializeBundleManifest,\n isAbsolutePath: () => isAbsolutePath,\n isAnyDebugEnabled: () => isAnyDebugEnabled,\n isCompiledBinary: () => isCompiledBinary,\n isDebugEnabled: () => isDebugEnabled,\n isDeepInspectEnabled: () => isDeepInspectEnabled,\n isDevelopmentEnvironment: () => isDevelopmentEnvironment,\n isInternalEndpoint: () => isInternalEndpoint,\n isProductionEnvironment: () => isProductionEnvironment,\n isRSCEnabled: () => isRSCEnabled,\n isStaticAsset: () => isStaticAsset,\n isTestEnvironment: () => isTestEnvironment,\n isTruthyEnvValue: () => isTruthyEnvValue,\n isValidHMRMessageType: () => isValidHMRMessageType,\n isWithinDirectory: () => isWithinDirectory,\n joinPath: () => joinPath,\n logger: () => logger,\n memoize: () => memoize,\n memoizeAsync: () => memoizeAsync,\n memoizeHash: () => simpleHash2,\n normalizeChunkPath: () => normalizeChunkPath,\n normalizePath: () => normalizePath,\n numericHash: () => simpleHash,\n rendererLogger: () => rendererLogger,\n serverLogger: () => serverLogger,\n setBundleManifestStore: () => setBundleManifestStore,\n shortHash: () => shortHash,\n simpleHash: () => simpleHash,\n toBase64Url: () => toBase64Url,\n truncateString: () => truncateString,\n warmupBundleManifest: () => warmupBundleManifest\n});\nvar init_utils = __esm({\n "src/core/utils/index.ts"() {\n init_runtime_guards();\n init_logger2();\n init_constants();\n init_version();\n init_paths();\n init_hash_utils();\n init_memoize();\n init_path_utils();\n init_format_utils();\n init_bundle_manifest();\n init_bundle_manifest_init();\n init_feature_flags();\n init_platform();\n }\n});\n\n// src/_shims/std-path.ts\nvar std_path_exports = {};\n__export(std_path_exports, {\n SEPARATOR: () => SEPARATOR,\n SEPARATOR_PATTERN: () => SEPARATOR_PATTERN,\n basename: () => basename2,\n delimiter: () => delimiter2,\n dirname: () => dirname2,\n extname: () => extname2,\n format: () => format2,\n fromFileUrl: () => fromFileUrl,\n isAbsolute: () => isAbsolute2,\n join: () => join2,\n normalize: () => normalize2,\n parse: () => parse2,\n relative: () => relative2,\n resolve: () => resolve2,\n sep: () => sep2,\n toFileUrl: () => toFileUrl\n});\nimport * as nodeUrl from "node:url";\nimport * as nodePath from "node:path";\nfunction fromFileUrl(url) {\n return nodeUrl.fileURLToPath(url);\n}\nfunction toFileUrl(path) {\n return nodeUrl.pathToFileURL(path);\n}\nvar basename2, dirname2, extname2, join2, resolve2, relative2, isAbsolute2, normalize2, parse2, format2, sep2, delimiter2, SEPARATOR, SEPARATOR_PATTERN;\nvar init_std_path = __esm({\n "src/_shims/std-path.ts"() {\n basename2 = nodePath.basename;\n dirname2 = nodePath.dirname;\n extname2 = nodePath.extname;\n join2 = nodePath.join;\n resolve2 = nodePath.resolve;\n relative2 = nodePath.relative;\n isAbsolute2 = nodePath.isAbsolute;\n normalize2 = nodePath.normalize;\n parse2 = nodePath.parse;\n format2 = nodePath.format;\n sep2 = nodePath.sep;\n delimiter2 = nodePath.delimiter;\n SEPARATOR = nodePath.sep;\n SEPARATOR_PATTERN = nodePath.sep === "/" ? /\\/+/ : /[\\\\/]+/;\n }\n});\n\n// src/core/errors/veryfront-error.ts\nfunction createError(error2) {\n return error2;\n}\nfunction toError(veryfrontError) {\n const error2 = new Error(veryfrontError.message);\n error2.name = `VeryfrontError[${veryfrontError.type}]`;\n Object.defineProperty(error2, "context", {\n value: veryfrontError,\n enumerable: false,\n configurable: true\n });\n return error2;\n}\nvar init_veryfront_error = __esm({\n "src/core/errors/veryfront-error.ts"() {\n "use strict";\n }\n});\n\n// src/core/config/schema.ts\nimport { z } from "zod";\nvar corsSchema, veryfrontConfigSchema;\nvar init_schema = __esm({\n "src/core/config/schema.ts"() {\n "use strict";\n init_veryfront_error();\n corsSchema = z.union([z.boolean(), z.object({ origin: z.string().optional() }).strict()]);\n veryfrontConfigSchema = z.object({\n title: z.string().optional(),\n description: z.string().optional(),\n experimental: z.object({\n esmLayouts: z.boolean().optional(),\n precompileMDX: z.boolean().optional()\n }).partial().optional(),\n router: z.enum(["app", "pages"]).optional(),\n defaultLayout: z.string().optional(),\n theme: z.object({ colors: z.record(z.string()).optional() }).partial().optional(),\n build: z.object({\n outDir: z.string().optional(),\n trailingSlash: z.boolean().optional(),\n esbuild: z.object({\n wasmURL: z.string().url().optional(),\n worker: z.boolean().optional()\n }).partial().optional()\n }).partial().optional(),\n cache: z.object({\n dir: z.string().optional(),\n bundleManifest: z.object({\n type: z.enum(["redis", "kv", "memory"]).optional(),\n redisUrl: z.string().optional(),\n keyPrefix: z.string().optional(),\n ttl: z.number().int().positive().optional(),\n enabled: z.boolean().optional()\n }).partial().optional()\n }).partial().optional(),\n dev: z.object({\n port: z.number().int().positive().optional(),\n host: z.string().optional(),\n open: z.boolean().optional(),\n hmr: z.boolean().optional(),\n components: z.array(z.string()).optional()\n }).partial().optional(),\n resolve: z.object({\n importMap: z.object({\n imports: z.record(z.string()).optional(),\n scopes: z.record(z.record(z.string())).optional()\n }).partial().optional()\n }).partial().optional(),\n security: z.object({\n csp: z.record(z.array(z.string())).optional(),\n remoteHosts: z.array(z.string().url()).optional(),\n cors: corsSchema.optional(),\n coop: z.enum(["same-origin", "same-origin-allow-popups", "unsafe-none"]).optional(),\n corp: z.enum(["same-origin", "same-site", "cross-origin"]).optional(),\n coep: z.enum(["require-corp", "unsafe-none"]).optional()\n }).partial().optional(),\n middleware: z.object({\n custom: z.array(z.function()).optional()\n }).partial().optional(),\n theming: z.object({\n brandName: z.string().optional(),\n logoHtml: z.string().optional()\n }).partial().optional(),\n assetPipeline: z.object({\n images: z.object({\n enabled: z.boolean().optional(),\n formats: z.array(z.enum(["webp", "avif", "jpeg", "png"])).optional(),\n sizes: z.array(z.number().int().positive()).optional(),\n quality: z.number().int().min(1).max(100).optional(),\n inputDir: z.string().optional(),\n outputDir: z.string().optional(),\n preserveOriginal: z.boolean().optional()\n }).partial().optional(),\n css: z.object({\n enabled: z.boolean().optional(),\n minify: z.boolean().optional(),\n autoprefixer: z.boolean().optional(),\n purge: z.boolean().optional(),\n criticalCSS: z.boolean().optional(),\n inputDir: z.string().optional(),\n outputDir: z.string().optional(),\n browsers: z.array(z.string()).optional(),\n purgeContent: z.array(z.string()).optional(),\n sourceMap: z.boolean().optional()\n }).partial().optional()\n }).partial().optional(),\n observability: z.object({\n tracing: z.object({\n enabled: z.boolean().optional(),\n exporter: z.enum(["jaeger", "zipkin", "otlp", "console"]).optional(),\n endpoint: z.string().optional(),\n serviceName: z.string().optional(),\n sampleRate: z.number().min(0).max(1).optional()\n }).partial().optional(),\n metrics: z.object({\n enabled: z.boolean().optional(),\n exporter: z.enum(["prometheus", "otlp", "console"]).optional(),\n endpoint: z.string().optional(),\n prefix: z.string().optional(),\n collectInterval: z.number().int().positive().optional()\n }).partial().optional()\n }).partial().optional(),\n fs: z.object({\n type: z.enum(["local", "veryfront-api", "memory"]).optional(),\n local: z.object({\n baseDir: z.string().optional()\n }).partial().optional(),\n veryfront: z.object({\n apiBaseUrl: z.string().url(),\n apiToken: z.string(),\n projectSlug: z.string(),\n cache: z.object({\n enabled: z.boolean().optional(),\n ttl: z.number().int().positive().optional(),\n maxSize: z.number().int().positive().optional()\n }).partial().optional(),\n retry: z.object({\n maxRetries: z.number().int().min(0).optional(),\n initialDelay: z.number().int().positive().optional(),\n maxDelay: z.number().int().positive().optional()\n }).partial().optional()\n }).partial().optional(),\n memory: z.object({\n files: z.record(z.union([z.string(), z.instanceof(Uint8Array)])).optional()\n }).partial().optional()\n }).partial().optional(),\n client: z.object({\n moduleResolution: z.enum(["cdn", "self-hosted", "bundled"]).optional(),\n cdn: z.object({\n provider: z.enum(["esm.sh", "unpkg", "jsdelivr"]).optional(),\n versions: z.union([\n z.literal("auto"),\n z.object({\n react: z.string().optional(),\n veryfront: z.string().optional()\n })\n ]).optional()\n }).partial().optional()\n }).partial().optional()\n }).partial();\n }\n});\n\n// src/core/config/loader.ts\nfunction getDefaultImportMapForConfig() {\n return { imports: getReactImportMap(REACT_DEFAULT_VERSION) };\n}\nvar DEFAULT_CONFIG;\nvar init_loader = __esm({\n "src/core/config/loader.ts"() {\n "use strict";\n init_schema();\n init_std_path();\n init_logger();\n init_cdn();\n init_server();\n DEFAULT_CONFIG = {\n title: "Veryfront App",\n description: "Built with Veryfront",\n experimental: {\n esmLayouts: true\n },\n router: void 0,\n defaultLayout: void 0,\n theme: {\n colors: {\n primary: "#3B82F6"\n }\n },\n build: {\n outDir: "dist",\n trailingSlash: false,\n esbuild: {\n wasmURL: "https://deno.land/x/esbuild@v0.20.1/esbuild.wasm",\n worker: false\n }\n },\n cache: {\n dir: DEFAULT_CACHE_DIR,\n render: {\n type: "memory",\n ttl: void 0,\n maxEntries: 500,\n kvPath: void 0,\n redisUrl: void 0,\n redisKeyPrefix: void 0\n }\n },\n dev: {\n port: 3002,\n host: "localhost",\n open: false\n },\n resolve: {\n importMap: getDefaultImportMapForConfig()\n },\n client: {\n moduleResolution: "cdn",\n cdn: {\n provider: "esm.sh",\n versions: "auto"\n }\n }\n };\n }\n});\n\n// src/core/config/define-config.ts\nvar init_define_config = __esm({\n "src/core/config/define-config.ts"() {\n "use strict";\n init_veryfront_error();\n init_process();\n }\n});\n\n// src/core/config/defaults.ts\nvar DEFAULT_DEV_PORT, DEFAULT_PREFETCH_DELAY_MS, DURATION_HISTOGRAM_BOUNDARIES_MS, SIZE_HISTOGRAM_BOUNDARIES_KB, PAGE_TRANSITION_DELAY_MS;\nvar init_defaults = __esm({\n "src/core/config/defaults.ts"() {\n "use strict";\n DEFAULT_DEV_PORT = 3e3;\n DEFAULT_PREFETCH_DELAY_MS = 100;\n DURATION_HISTOGRAM_BOUNDARIES_MS = [\n 5,\n 10,\n 25,\n 50,\n 75,\n 100,\n 250,\n 500,\n 750,\n 1e3,\n 2500,\n 5e3,\n 7500,\n 1e4\n ];\n SIZE_HISTOGRAM_BOUNDARIES_KB = [\n 1,\n 5,\n 10,\n 25,\n 50,\n 100,\n 250,\n 500,\n 1e3,\n 2500,\n 5e3,\n 1e4\n ];\n PAGE_TRANSITION_DELAY_MS = 150;\n }\n});\n\n// src/core/config/network-defaults.ts\nvar init_network_defaults = __esm({\n "src/core/config/network-defaults.ts"() {\n "use strict";\n }\n});\n\n// src/core/config/index.ts\nvar init_config = __esm({\n "src/core/config/index.ts"() {\n init_loader();\n init_define_config();\n init_schema();\n init_defaults();\n init_network_defaults();\n }\n});\n\n// src/core/errors/types.ts\nvar VeryfrontError;\nvar init_types = __esm({\n "src/core/errors/types.ts"() {\n "use strict";\n VeryfrontError = class extends Error {\n constructor(message, code, context) {\n super(message);\n this.name = "VeryfrontError";\n this.code = code;\n this.context = context;\n }\n };\n }\n});\n\n// src/core/errors/agent-errors.ts\nvar init_agent_errors = __esm({\n "src/core/errors/agent-errors.ts"() {\n "use strict";\n init_types();\n }\n});\n\n// src/core/errors/build-errors.ts\nvar init_build_errors = __esm({\n "src/core/errors/build-errors.ts"() {\n "use strict";\n init_types();\n }\n});\n\n// src/core/errors/runtime-errors.ts\nvar init_runtime_errors = __esm({\n "src/core/errors/runtime-errors.ts"() {\n "use strict";\n init_types();\n }\n});\n\n// src/core/errors/system-errors.ts\nvar NetworkError;\nvar init_system_errors = __esm({\n "src/core/errors/system-errors.ts"() {\n "use strict";\n init_types();\n NetworkError = class extends VeryfrontError {\n constructor(message, context) {\n super(message, "NETWORK_ERROR" /* NETWORK_ERROR */, context);\n this.name = "NetworkError";\n }\n };\n }\n});\n\n// src/core/errors/error-handlers.ts\nvar init_error_handlers = __esm({\n "src/core/errors/error-handlers.ts"() {\n "use strict";\n init_logger();\n init_types();\n }\n});\n\n// src/core/errors/error-codes.ts\nfunction getErrorDocsUrl(code) {\n return `https://veryfront.com/docs/errors/${code}`;\n}\nvar ErrorCode2;\nvar init_error_codes = __esm({\n "src/core/errors/error-codes.ts"() {\n "use strict";\n ErrorCode2 = {\n CONFIG_NOT_FOUND: "VF001",\n CONFIG_INVALID: "VF002",\n CONFIG_PARSE_ERROR: "VF003",\n CONFIG_VALIDATION_ERROR: "VF004",\n CONFIG_TYPE_ERROR: "VF005",\n IMPORT_MAP_INVALID: "VF006",\n CORS_CONFIG_INVALID: "VF007",\n BUILD_FAILED: "VF100",\n BUNDLE_ERROR: "VF101",\n TYPESCRIPT_ERROR: "VF102",\n MDX_COMPILE_ERROR: "VF103",\n ASSET_OPTIMIZATION_ERROR: "VF104",\n SSG_GENERATION_ERROR: "VF105",\n SOURCEMAP_ERROR: "VF106",\n HYDRATION_MISMATCH: "VF200",\n RENDER_ERROR: "VF201",\n COMPONENT_ERROR: "VF202",\n LAYOUT_NOT_FOUND: "VF203",\n PAGE_NOT_FOUND: "VF204",\n API_ERROR: "VF205",\n MIDDLEWARE_ERROR: "VF206",\n ROUTE_CONFLICT: "VF300",\n INVALID_ROUTE_FILE: "VF301",\n ROUTE_HANDLER_INVALID: "VF302",\n DYNAMIC_ROUTE_ERROR: "VF303",\n ROUTE_PARAMS_ERROR: "VF304",\n API_ROUTE_ERROR: "VF305",\n MODULE_NOT_FOUND: "VF400",\n IMPORT_RESOLUTION_ERROR: "VF401",\n CIRCULAR_DEPENDENCY: "VF402",\n INVALID_IMPORT: "VF403",\n DEPENDENCY_MISSING: "VF404",\n VERSION_MISMATCH: "VF405",\n PORT_IN_USE: "VF500",\n SERVER_START_ERROR: "VF501",\n HMR_ERROR: "VF502",\n CACHE_ERROR: "VF503",\n FILE_WATCH_ERROR: "VF504",\n REQUEST_ERROR: "VF505",\n CLIENT_BOUNDARY_VIOLATION: "VF600",\n SERVER_ONLY_IN_CLIENT: "VF601",\n CLIENT_ONLY_IN_SERVER: "VF602",\n INVALID_USE_CLIENT: "VF603",\n INVALID_USE_SERVER: "VF604",\n RSC_PAYLOAD_ERROR: "VF605",\n DEV_SERVER_ERROR: "VF700",\n FAST_REFRESH_ERROR: "VF701",\n ERROR_OVERLAY_ERROR: "VF702",\n SOURCE_MAP_ERROR: "VF703",\n DEPLOYMENT_ERROR: "VF800",\n PLATFORM_ERROR: "VF801",\n ENV_VAR_MISSING: "VF802",\n PRODUCTION_BUILD_REQUIRED: "VF803",\n UNKNOWN_ERROR: "VF900",\n PERMISSION_DENIED: "VF901",\n FILE_NOT_FOUND: "VF902",\n INVALID_ARGUMENT: "VF903",\n TIMEOUT_ERROR: "VF904"\n };\n }\n});\n\n// src/core/errors/catalog/factory.ts\nfunction createErrorSolution(code, config) {\n return {\n code,\n ...config,\n docs: config.docs ?? getErrorDocsUrl(code)\n };\n}\nfunction createSimpleError(code, title, message, steps) {\n return createErrorSolution(code, { title, message, steps });\n}\nvar init_factory = __esm({\n "src/core/errors/catalog/factory.ts"() {\n "use strict";\n init_error_codes();\n }\n});\n\n// src/core/errors/catalog/config-errors.ts\nvar CONFIG_ERROR_CATALOG;\nvar init_config_errors = __esm({\n "src/core/errors/catalog/config-errors.ts"() {\n "use strict";\n init_error_codes();\n init_factory();\n CONFIG_ERROR_CATALOG = {\n [ErrorCode2.CONFIG_NOT_FOUND]: createErrorSolution(ErrorCode2.CONFIG_NOT_FOUND, {\n title: "Configuration file not found",\n message: "Veryfront could not find veryfront.config.js in your project root.",\n steps: [\n "Create veryfront.config.js in your project root directory",\n "Run \'veryfront init\' to generate a default configuration",\n "Or copy from an example project"\n ],\n example: `// veryfront.config.js\nexport default {\n title: "My App",\n dev: { port: 3002 }\n}`,\n tips: ["You can use .ts or .mjs extensions too", "Config is optional for simple projects"]\n }),\n [ErrorCode2.CONFIG_INVALID]: createErrorSolution(ErrorCode2.CONFIG_INVALID, {\n title: "Invalid configuration",\n message: "Your configuration file has invalid values or structure.",\n steps: [\n "Check that the config exports a default object",\n "Ensure all values are valid JavaScript types",\n "Remove any trailing commas",\n "Verify property names match the schema"\n ],\n example: `// \\u2713 Valid config\nexport default {\n title: "My App",\n dev: {\n port: 3002,\n open: true\n }\n}`\n }),\n [ErrorCode2.CONFIG_PARSE_ERROR]: createSimpleError(\n ErrorCode2.CONFIG_PARSE_ERROR,\n "Configuration parse error",\n "Failed to parse your configuration file.",\n [\n "Check for syntax errors (missing brackets, quotes, etc.)",\n "Ensure the file has valid JavaScript/TypeScript syntax",\n "Look for the specific parse error in the output above"\n ]\n ),\n [ErrorCode2.CONFIG_VALIDATION_ERROR]: createSimpleError(\n ErrorCode2.CONFIG_VALIDATION_ERROR,\n "Configuration validation failed",\n "Configuration values do not pass validation.",\n [\n "Check that port numbers are between 1-65535",\n "Ensure boolean flags are true/false (not strings)",\n "Verify URLs are properly formatted",\n "Check array/object structures match expected format"\n ]\n ),\n [ErrorCode2.CONFIG_TYPE_ERROR]: createSimpleError(\n ErrorCode2.CONFIG_TYPE_ERROR,\n "Configuration type error",\n "A configuration value has the wrong type.",\n [\n "Check that numbers are not in quotes",\n \'Ensure booleans are true/false, not "true"/"false"\',\n "Verify arrays use [] brackets",\n "Check objects use {} braces"\n ]\n ),\n [ErrorCode2.IMPORT_MAP_INVALID]: createErrorSolution(ErrorCode2.IMPORT_MAP_INVALID, {\n title: "Invalid import map",\n message: "The import map in your configuration is invalid.",\n steps: [\n "Check import map structure: { imports: {}, scopes: {} }",\n "Ensure URLs are valid and accessible",\n "Verify package names are correct"\n ],\n example: `resolve: {\n importMap: {\n imports: {\n "react": "https://esm.sh/react@19",\n "@/utils": "./src/utils/index.ts"\n }\n }\n}`\n }),\n [ErrorCode2.CORS_CONFIG_INVALID]: createErrorSolution(ErrorCode2.CORS_CONFIG_INVALID, {\n title: "Invalid CORS configuration",\n message: "The CORS configuration is invalid.",\n steps: [\n "Use true for default CORS settings",\n "Or provide an object with origin, methods, headers",\n "Ensure origin is a string, not an array"\n ],\n example: `security: {\n cors: true // or { origin: "https://example.com" }\n}`\n })\n };\n }\n});\n\n// src/core/errors/catalog/build-errors.ts\nvar BUILD_ERROR_CATALOG;\nvar init_build_errors2 = __esm({\n "src/core/errors/catalog/build-errors.ts"() {\n "use strict";\n init_error_codes();\n init_factory();\n BUILD_ERROR_CATALOG = {\n [ErrorCode2.BUILD_FAILED]: createErrorSolution(ErrorCode2.BUILD_FAILED, {\n title: "Build failed",\n message: "The build process encountered errors.",\n steps: [\n "Check the error messages above for specific issues",\n "Fix any TypeScript or syntax errors",\n "Ensure all imports can be resolved",\n "Run \'veryfront doctor\' to check your environment"\n ],\n tips: ["Try running with --verbose for more details", "Check build logs for warnings"]\n }),\n [ErrorCode2.BUNDLE_ERROR]: createSimpleError(\n ErrorCode2.BUNDLE_ERROR,\n "Bundle generation failed",\n "Failed to generate JavaScript bundles.",\n [\n "Check for circular dependencies",\n "Ensure all imports are valid",\n "Try clearing cache: veryfront clean"\n ]\n ),\n [ErrorCode2.TYPESCRIPT_ERROR]: createSimpleError(\n ErrorCode2.TYPESCRIPT_ERROR,\n "TypeScript compilation error",\n "TypeScript found errors in your code.",\n [\n "Fix the TypeScript errors shown above",\n "Check your tsconfig.json configuration",\n "Ensure all types are properly imported"\n ]\n ),\n [ErrorCode2.MDX_COMPILE_ERROR]: createErrorSolution(ErrorCode2.MDX_COMPILE_ERROR, {\n title: "MDX compilation failed",\n message: "Failed to compile MDX file.",\n steps: [\n "Check for syntax errors in your MDX file",\n "Ensure frontmatter YAML is valid",\n "Verify JSX components are properly imported",\n "Check for unclosed tags or brackets"\n ],\n example: `---\ntitle: My Post\n---\n\nimport Button from \'./components/Button.jsx\'\n\n# Hello World\n\n<Button>Click me</Button>`\n }),\n [ErrorCode2.ASSET_OPTIMIZATION_ERROR]: createSimpleError(\n ErrorCode2.ASSET_OPTIMIZATION_ERROR,\n "Asset optimization failed",\n "Failed to optimize assets (images, CSS, etc.).",\n [\n "Check that asset files are valid",\n "Ensure file paths are correct",\n "Try disabling optimization temporarily"\n ]\n ),\n [ErrorCode2.SSG_GENERATION_ERROR]: createSimpleError(\n ErrorCode2.SSG_GENERATION_ERROR,\n "Static site generation failed",\n "Failed to generate static pages.",\n [\n "Check that all routes are valid",\n "Ensure getStaticData functions return correctly",\n "Verify no dynamic content requires runtime"\n ]\n ),\n [ErrorCode2.SOURCEMAP_ERROR]: createSimpleError(\n ErrorCode2.SOURCEMAP_ERROR,\n "Source map generation failed",\n "Failed to generate source maps.",\n [\n "Try disabling source maps temporarily",\n "Check for very large files that might cause issues"\n ]\n )\n };\n }\n});\n\n// src/core/errors/catalog/runtime-errors.ts\nvar RUNTIME_ERROR_CATALOG;\nvar init_runtime_errors2 = __esm({\n "src/core/errors/catalog/runtime-errors.ts"() {\n "use strict";\n init_error_codes();\n init_factory();\n RUNTIME_ERROR_CATALOG = {\n [ErrorCode2.HYDRATION_MISMATCH]: createErrorSolution(ErrorCode2.HYDRATION_MISMATCH, {\n title: "Hydration mismatch",\n message: "Client-side HTML does not match server-rendered HTML.",\n steps: [\n "Check for random values or timestamps in render",\n "Ensure Date() calls are consistent",\n "Avoid using browser-only APIs during SSR",\n "Check for white space or formatting differences"\n ],\n example: `// \\u274C Wrong - random on each render\n<div>{Math.random()}</div>\n\nconst [random, setRandom] = useState(0)\nuseEffect(() => setRandom(Math.random()), [])\n<div>{random}</div>`,\n relatedErrors: [ErrorCode2.RENDER_ERROR]\n }),\n [ErrorCode2.RENDER_ERROR]: createSimpleError(\n ErrorCode2.RENDER_ERROR,\n "Render error",\n "Failed to render component.",\n [\n "Check the component for errors",\n "Ensure all props are valid",\n "Look for null/undefined access",\n "Check error boundaries"\n ]\n ),\n [ErrorCode2.COMPONENT_ERROR]: createSimpleError(\n ErrorCode2.COMPONENT_ERROR,\n "Component error",\n "Error in component lifecycle or render.",\n [\n "Check component code for errors",\n "Ensure hooks follow Rules of Hooks",\n "Verify props are passed correctly"\n ]\n ),\n [ErrorCode2.LAYOUT_NOT_FOUND]: createErrorSolution(ErrorCode2.LAYOUT_NOT_FOUND, {\n title: "Layout file not found",\n message: "Required layout file is missing.",\n steps: [\n "Create app/layout.tsx in App Router",\n "Or create layouts/default.mdx for Pages Router",\n "Check file path and name are correct"\n ],\n example: `// app/layout.tsx\nexport default function RootLayout({ children }) {\n return (\n <html lang="en">\n <body>{children}</body>\n </html>\n )\n}`\n }),\n [ErrorCode2.PAGE_NOT_FOUND]: createSimpleError(\n ErrorCode2.PAGE_NOT_FOUND,\n "Page not found",\n "The requested page does not exist.",\n [\n "Check that the page file exists",\n "Verify file name matches route",\n "Ensure file extension is correct (.tsx, .jsx, .mdx)"\n ]\n ),\n [ErrorCode2.API_ERROR]: createSimpleError(\n ErrorCode2.API_ERROR,\n "API handler error",\n "Error in API route handler.",\n [\n "Check API handler code for errors",\n "Ensure proper error handling",\n "Verify request/response format"\n ]\n ),\n [ErrorCode2.MIDDLEWARE_ERROR]: createSimpleError(\n ErrorCode2.MIDDLEWARE_ERROR,\n "Middleware error",\n "Error in middleware execution.",\n [\n "Check middleware code for errors",\n "Ensure middleware returns Response",\n "Verify middleware is properly exported"\n ]\n )\n };\n }\n});\n\n// src/core/errors/catalog/route-errors.ts\nvar ROUTE_ERROR_CATALOG;\nvar init_route_errors = __esm({\n "src/core/errors/catalog/route-errors.ts"() {\n "use strict";\n init_error_codes();\n init_factory();\n ROUTE_ERROR_CATALOG = {\n [ErrorCode2.ROUTE_CONFLICT]: createSimpleError(\n ErrorCode2.ROUTE_CONFLICT,\n "Route conflict",\n "Multiple files are trying to handle the same route.",\n [\n "Check for duplicate route files",\n "Remove conflicting routes",\n "Use dynamic routes [id] carefully"\n ]\n ),\n [ErrorCode2.INVALID_ROUTE_FILE]: createErrorSolution(ErrorCode2.INVALID_ROUTE_FILE, {\n title: "Invalid route file",\n message: "Route file has invalid structure or exports.",\n steps: [\n "API routes must export GET, POST, etc. functions",\n "Page routes must export default component",\n "Check for syntax errors"\n ],\n example: `// app/api/users/route.ts\nexport async function GET() {\n return Response.json({ users: [] })\n}`\n }),\n [ErrorCode2.ROUTE_HANDLER_INVALID]: createSimpleError(\n ErrorCode2.ROUTE_HANDLER_INVALID,\n "Invalid route handler",\n "Route handler does not return Response.",\n [\n "Ensure handler returns Response object",\n "Use Response.json() for JSON responses",\n "Check for missing return statement"\n ]\n ),\n [ErrorCode2.DYNAMIC_ROUTE_ERROR]: createSimpleError(\n ErrorCode2.DYNAMIC_ROUTE_ERROR,\n "Dynamic route error",\n "Error in dynamic route handling.",\n [\n "Check [param] syntax is correct",\n "Ensure params are accessed properly",\n "Verify dynamic segment names"\n ]\n ),\n [ErrorCode2.ROUTE_PARAMS_ERROR]: createSimpleError(\n ErrorCode2.ROUTE_PARAMS_ERROR,\n "Route parameters error",\n "Error accessing route parameters.",\n [\n "Check params object structure",\n "Ensure parameter names match route",\n "Verify params are strings"\n ]\n ),\n [ErrorCode2.API_ROUTE_ERROR]: createSimpleError(\n ErrorCode2.API_ROUTE_ERROR,\n "API route error",\n "Error in API route execution.",\n [\n "Check API handler code",\n "Ensure proper error handling",\n "Verify request parsing"\n ]\n )\n };\n }\n});\n\n// src/core/errors/catalog/module-errors.ts\nvar MODULE_ERROR_CATALOG;\nvar init_module_errors = __esm({\n "src/core/errors/catalog/module-errors.ts"() {\n "use strict";\n init_error_codes();\n init_factory();\n MODULE_ERROR_CATALOG = {\n [ErrorCode2.MODULE_NOT_FOUND]: createErrorSolution(ErrorCode2.MODULE_NOT_FOUND, {\n title: "Module not found",\n message: "Cannot find the imported module.",\n steps: [\n "Check that the file path is correct",\n "Ensure the module is installed or exists",\n "Add missing module to import map",\n "Check for typos in import statement"\n ],\n example: `// Add to veryfront.config.js\nresolve: {\n importMap: {\n imports: {\n "missing-lib": "https://esm.sh/missing-lib@1.0.0"\n }\n }\n}`\n }),\n [ErrorCode2.IMPORT_RESOLUTION_ERROR]: createSimpleError(\n ErrorCode2.IMPORT_RESOLUTION_ERROR,\n "Import resolution failed",\n "Failed to resolve import specifier.",\n [\n "Check import paths are correct",\n "Ensure modules are in import map",\n "Verify network connectivity for remote imports"\n ]\n ),\n [ErrorCode2.CIRCULAR_DEPENDENCY]: createSimpleError(\n ErrorCode2.CIRCULAR_DEPENDENCY,\n "Circular dependency detected",\n "Files are importing each other in a circle.",\n [\n "Identify the circular import chain",\n "Extract shared code to separate file",\n "Use dependency injection or lazy imports"\n ]\n ),\n [ErrorCode2.INVALID_IMPORT]: createSimpleError(\n ErrorCode2.INVALID_IMPORT,\n "Invalid import statement",\n "Import statement has invalid syntax.",\n [\n \'Check import syntax: import X from "y"\',\n "Ensure quotes are properly closed",\n "Verify export exists in target module"\n ]\n ),\n [ErrorCode2.DEPENDENCY_MISSING]: createErrorSolution(ErrorCode2.DEPENDENCY_MISSING, {\n title: "Required dependency not found",\n message: "A required dependency is missing.",\n steps: [\n "Add React to your import map",\n "Ensure all peer dependencies are included",\n "Run \'veryfront doctor\' to verify setup"\n ],\n example: `// Minimum required imports\nresolve: {\n importMap: {\n imports: {\n "react": "https://esm.sh/react@19",\n "react-dom": "https://esm.sh/react-dom@19"\n }\n }\n}`\n }),\n [ErrorCode2.VERSION_MISMATCH]: createSimpleError(\n ErrorCode2.VERSION_MISMATCH,\n "Dependency version mismatch",\n "Incompatible versions of dependencies detected.",\n [\n "Ensure React and React-DOM versions match",\n "Check for multiple React instances",\n "Update dependencies to compatible versions"\n ]\n )\n };\n }\n});\n\n// src/core/errors/catalog/server-errors.ts\nvar SERVER_ERROR_CATALOG;\nvar init_server_errors = __esm({\n "src/core/errors/catalog/server-errors.ts"() {\n "use strict";\n init_error_codes();\n init_factory();\n SERVER_ERROR_CATALOG = {\n [ErrorCode2.PORT_IN_USE]: createErrorSolution(ErrorCode2.PORT_IN_USE, {\n title: "Port already in use",\n message: "Another process is using the specified port.",\n steps: [\n "Stop the other process: lsof -i :PORT",\n "Use a different port: veryfront dev --port 3003",\n "Add port to config file"\n ],\n example: `// veryfront.config.js\ndev: {\n port: 3003\n}`\n }),\n [ErrorCode2.SERVER_START_ERROR]: createSimpleError(\n ErrorCode2.SERVER_START_ERROR,\n "Server failed to start",\n "Development server could not start.",\n [\n "Check for port conflicts",\n "Ensure file permissions are correct",\n "Verify configuration is valid"\n ]\n ),\n [ErrorCode2.HMR_ERROR]: createSimpleError(\n ErrorCode2.HMR_ERROR,\n "Hot Module Replacement error",\n "HMR failed to update module.",\n [\n "Try refreshing the page",\n "Check for syntax errors",\n "Restart dev server if persistent"\n ]\n ),\n [ErrorCode2.CACHE_ERROR]: createSimpleError(\n ErrorCode2.CACHE_ERROR,\n "Cache operation failed",\n "Error reading or writing cache.",\n [\n "Clear cache: veryfront clean --cache",\n "Check disk space",\n "Verify file permissions"\n ]\n ),\n [ErrorCode2.FILE_WATCH_ERROR]: createSimpleError(\n ErrorCode2.FILE_WATCH_ERROR,\n "File watching failed",\n "Could not watch files for changes.",\n [\n "Check system file watch limits",\n "Reduce number of watched files",\n "Try restarting dev server"\n ]\n ),\n [ErrorCode2.REQUEST_ERROR]: createSimpleError(\n ErrorCode2.REQUEST_ERROR,\n "Request handling error",\n "Error processing HTTP request.",\n [\n "Check request format and headers",\n "Verify route handler code",\n "Check for middleware errors"\n ]\n )\n };\n }\n});\n\n// src/core/errors/catalog/rsc-errors.ts\nvar RSC_ERROR_CATALOG;\nvar init_rsc_errors = __esm({\n "src/core/errors/catalog/rsc-errors.ts"() {\n "use strict";\n init_error_codes();\n init_factory();\n RSC_ERROR_CATALOG = {\n [ErrorCode2.CLIENT_BOUNDARY_VIOLATION]: createErrorSolution(\n ErrorCode2.CLIENT_BOUNDARY_VIOLATION,\n {\n title: "Client/Server boundary violation",\n message: "Server-only code used in Client Component.",\n steps: [\n "Move server-only imports to Server Components",\n "Use \'use server\' for server actions",\n "Split component into server and client parts"\n ],\n example: `// \\u2713 Correct pattern\nimport { db } from \'./database\'\nexport default async function ServerComponent() {\n const data = await db.query(\'...\')\n return <ClientComponent data={data} />\n}\n\n\'use client\'\nexport default function ClientComponent({ data }) {\n return <div>{data}</div>\n}`\n }\n ),\n [ErrorCode2.SERVER_ONLY_IN_CLIENT]: createSimpleError(\n ErrorCode2.SERVER_ONLY_IN_CLIENT,\n "Server-only module in Client Component",\n "Cannot use server-only module in client code.",\n [\n "Move server logic to Server Component",\n "Use API routes for client data fetching",\n "Pass data as props from server"\n ]\n ),\n [ErrorCode2.CLIENT_ONLY_IN_SERVER]: createSimpleError(\n ErrorCode2.CLIENT_ONLY_IN_SERVER,\n "Client-only code in Server Component",\n "Cannot use browser APIs in Server Component.",\n [\n "Add \'use client\' directive",\n "Move client-only code to Client Component",\n "Use useEffect for client-side logic"\n ]\n ),\n [ErrorCode2.INVALID_USE_CLIENT]: createErrorSolution(ErrorCode2.INVALID_USE_CLIENT, {\n title: "Invalid \'use client\' directive",\n message: "\'use client\' directive is not properly placed.",\n steps: [\n "Place \'use client\' at the very top of file",\n "Must be before any imports",\n \'Use exact string: "use client"\'\n ],\n example: `\'use client\' // Must be first line\n\nimport React from \'react\'`\n }),\n [ErrorCode2.INVALID_USE_SERVER]: createSimpleError(\n ErrorCode2.INVALID_USE_SERVER,\n "Invalid \'use server\' directive",\n "\'use server\' directive is not properly placed.",\n [\n "Place \'use server\' at top of function",\n "Or at top of file for all functions",\n \'Use exact string: "use server"\'\n ]\n ),\n [ErrorCode2.RSC_PAYLOAD_ERROR]: createSimpleError(\n ErrorCode2.RSC_PAYLOAD_ERROR,\n "RSC payload error",\n "Error serializing Server Component payload.",\n [\n "Ensure props are JSON-serializable",\n "Avoid passing functions as props",\n "Check for circular references"\n ]\n )\n };\n }\n});\n\n// src/core/errors/catalog/dev-errors.ts\nvar DEV_ERROR_CATALOG;\nvar init_dev_errors = __esm({\n "src/core/errors/catalog/dev-errors.ts"() {\n "use strict";\n init_error_codes();\n init_factory();\n DEV_ERROR_CATALOG = {\n [ErrorCode2.DEV_SERVER_ERROR]: createSimpleError(\n ErrorCode2.DEV_SERVER_ERROR,\n "Development server error",\n "Error in development server.",\n [\n "Check server logs for details",\n "Try restarting dev server",\n "Clear cache and restart"\n ]\n ),\n [ErrorCode2.FAST_REFRESH_ERROR]: createSimpleError(\n ErrorCode2.FAST_REFRESH_ERROR,\n "Fast Refresh error",\n "React Fast Refresh failed.",\n [\n "Check for syntax errors",\n "Ensure components follow Fast Refresh rules",\n "Try full page refresh"\n ]\n ),\n [ErrorCode2.ERROR_OVERLAY_ERROR]: createSimpleError(\n ErrorCode2.ERROR_OVERLAY_ERROR,\n "Error overlay failed",\n "Could not display error overlay.",\n [\n "Check browser console for details",\n "Try disabling browser extensions",\n "Refresh the page"\n ]\n ),\n [ErrorCode2.SOURCE_MAP_ERROR]: createSimpleError(\n ErrorCode2.SOURCE_MAP_ERROR,\n "Source map error",\n "Error loading or parsing source map.",\n [\n "Check that source maps are enabled",\n "Try rebuilding the project",\n "Check for corrupted build files"\n ]\n )\n };\n }\n});\n\n// src/core/errors/catalog/deployment-errors.ts\nvar DEPLOYMENT_ERROR_CATALOG;\nvar init_deployment_errors = __esm({\n "src/core/errors/catalog/deployment-errors.ts"() {\n "use strict";\n init_error_codes();\n init_factory();\n DEPLOYMENT_ERROR_CATALOG = {\n [ErrorCode2.DEPLOYMENT_ERROR]: createSimpleError(\n ErrorCode2.DEPLOYMENT_ERROR,\n "Deployment failed",\n "Failed to deploy application.",\n [\n "Check deployment logs for details",\n "Verify platform credentials",\n "Ensure build succeeded first"\n ]\n ),\n [ErrorCode2.PLATFORM_ERROR]: createSimpleError(\n ErrorCode2.PLATFORM_ERROR,\n "Platform error",\n "Deployment platform returned an error.",\n [\n "Check platform status page",\n "Verify API keys and credentials",\n "Try deploying again"\n ]\n ),\n [ErrorCode2.ENV_VAR_MISSING]: createSimpleError(\n ErrorCode2.ENV_VAR_MISSING,\n "Environment variable missing",\n "Required environment variable is not set.",\n [\n "Add variable to .env file",\n "Set variable in deployment platform",\n "Check variable name is correct"\n ]\n ),\n [ErrorCode2.PRODUCTION_BUILD_REQUIRED]: createSimpleError(\n ErrorCode2.PRODUCTION_BUILD_REQUIRED,\n "Production build required",\n "Must build project before deploying.",\n [\n "Run \'veryfront build\' first",\n "Check that dist/ directory exists",\n "Verify build completed successfully"\n ]\n )\n };\n }\n});\n\n// src/core/errors/catalog/general-errors.ts\nvar GENERAL_ERROR_CATALOG;\nvar init_general_errors = __esm({\n "src/core/errors/catalog/general-errors.ts"() {\n "use strict";\n init_error_codes();\n init_factory();\n GENERAL_ERROR_CATALOG = {\n [ErrorCode2.UNKNOWN_ERROR]: createSimpleError(\n ErrorCode2.UNKNOWN_ERROR,\n "Unknown error",\n "An unexpected error occurred.",\n [\n "Check error details above",\n "Run \'veryfront doctor\' to diagnose",\n "Try restarting the operation",\n "Check GitHub issues for similar problems"\n ]\n ),\n [ErrorCode2.PERMISSION_DENIED]: createSimpleError(\n ErrorCode2.PERMISSION_DENIED,\n "Permission denied",\n "Insufficient permissions to perform operation.",\n [\n "Check file/directory permissions",\n "Run with appropriate permissions",\n "Verify user has write access"\n ]\n ),\n [ErrorCode2.FILE_NOT_FOUND]: createSimpleError(\n ErrorCode2.FILE_NOT_FOUND,\n "File not found",\n "Required file does not exist.",\n [\n "Check that file path is correct",\n "Verify file exists in project",\n "Check for typos in file name"\n ]\n ),\n [ErrorCode2.INVALID_ARGUMENT]: createSimpleError(\n ErrorCode2.INVALID_ARGUMENT,\n "Invalid argument",\n "Command received invalid argument.",\n [\n "Check command syntax",\n "Verify argument values",\n "Run \'veryfront help <command>\' for usage"\n ]\n ),\n [ErrorCode2.TIMEOUT_ERROR]: createSimpleError(\n ErrorCode2.TIMEOUT_ERROR,\n "Operation timed out",\n "Operation took too long to complete.",\n [\n "Check network connectivity",\n "Try increasing timeout if available",\n "Check for very large files"\n ]\n )\n };\n }\n});\n\n// src/core/errors/catalog/index.ts\nvar ERROR_CATALOG;\nvar init_catalog = __esm({\n "src/core/errors/catalog/index.ts"() {\n "use strict";\n init_config_errors();\n init_build_errors2();\n init_runtime_errors2();\n init_route_errors();\n init_module_errors();\n init_server_errors();\n init_rsc_errors();\n init_dev_errors();\n init_deployment_errors();\n init_general_errors();\n init_factory();\n ERROR_CATALOG = {\n ...CONFIG_ERROR_CATALOG,\n ...BUILD_ERROR_CATALOG,\n ...RUNTIME_ERROR_CATALOG,\n ...ROUTE_ERROR_CATALOG,\n ...MODULE_ERROR_CATALOG,\n ...SERVER_ERROR_CATALOG,\n ...RSC_ERROR_CATALOG,\n ...DEV_ERROR_CATALOG,\n ...DEPLOYMENT_ERROR_CATALOG,\n ...GENERAL_ERROR_CATALOG\n };\n }\n});\n\n// src/core/errors/user-friendly/error-catalog.ts\nvar init_error_catalog = __esm({\n "src/core/errors/user-friendly/error-catalog.ts"() {\n "use strict";\n }\n});\n\n// src/platform/compat/console/ansi.ts\nvar ansi, red, green, yellow, blue, magenta, cyan, white, gray, bold, dim, italic, underline, strikethrough, reset;\nvar init_ansi = __esm({\n "src/platform/compat/console/ansi.ts"() {\n ansi = (open, close) => (text2) => `\\x1B[${open}m${text2}\\x1B[${close}m`;\n red = ansi(31, 39);\n green = ansi(32, 39);\n yellow = ansi(33, 39);\n blue = ansi(34, 39);\n magenta = ansi(35, 39);\n cyan = ansi(36, 39);\n white = ansi(37, 39);\n gray = ansi(90, 39);\n bold = ansi(1, 22);\n dim = ansi(2, 22);\n italic = ansi(3, 23);\n underline = ansi(4, 24);\n strikethrough = ansi(9, 29);\n reset = (text2) => `\\x1B[0m${text2}`;\n }\n});\n\n// src/platform/compat/console/deno.ts\nvar deno_exports = {};\n__export(deno_exports, {\n blue: () => blue,\n bold: () => bold,\n colors: () => colors,\n cyan: () => cyan,\n dim: () => dim,\n gray: () => gray,\n green: () => green,\n italic: () => italic,\n magenta: () => magenta,\n red: () => red,\n reset: () => reset,\n strikethrough: () => strikethrough,\n underline: () => underline,\n white: () => white,\n yellow: () => yellow\n});\nvar colors;\nvar init_deno2 = __esm({\n "src/platform/compat/console/deno.ts"() {\n "use strict";\n init_ansi();\n colors = {\n red,\n green,\n yellow,\n blue,\n cyan,\n magenta,\n white,\n gray,\n bold,\n dim,\n italic,\n underline,\n strikethrough,\n reset\n };\n }\n});\n\n// src/platform/compat/console/node.ts\nvar node_exports = {};\n__export(node_exports, {\n blue: () => blue2,\n bold: () => bold2,\n colors: () => colors2,\n cyan: () => cyan2,\n dim: () => dim2,\n gray: () => gray2,\n green: () => green2,\n initColors: () => initColors,\n italic: () => italic2,\n magenta: () => magenta2,\n red: () => red2,\n reset: () => reset2,\n strikethrough: () => strikethrough2,\n underline: () => underline2,\n white: () => white2,\n yellow: () => yellow2\n});\nasync function ensurePc() {\n if (pc)\n return pc;\n const picocolorsModule = ["npm:", "picocolors"].join("");\n const mod = await import(picocolorsModule);\n pc = mod.default;\n return pc;\n}\nasync function initColors() {\n await ensurePc();\n}\nvar pc, lazyColor, colors2, red2, green2, yellow2, blue2, cyan2, magenta2, white2, gray2, bold2, dim2, italic2, underline2, strikethrough2, reset2;\nvar init_node = __esm({\n "src/platform/compat/console/node.ts"() {\n "use strict";\n pc = null;\n lazyColor = (fn) => (s) => pc?.[fn]?.(s) ?? s;\n colors2 = {\n red: lazyColor("red"),\n green: lazyColor("green"),\n yellow: lazyColor("yellow"),\n blue: lazyColor("blue"),\n cyan: lazyColor("cyan"),\n magenta: lazyColor("magenta"),\n white: lazyColor("white"),\n gray: lazyColor("gray"),\n bold: lazyColor("bold"),\n dim: lazyColor("dim"),\n italic: lazyColor("italic"),\n underline: lazyColor("underline"),\n strikethrough: lazyColor("strikethrough"),\n reset: lazyColor("reset")\n };\n red2 = lazyColor("red");\n green2 = lazyColor("green");\n yellow2 = lazyColor("yellow");\n blue2 = lazyColor("blue");\n cyan2 = lazyColor("cyan");\n magenta2 = lazyColor("magenta");\n white2 = lazyColor("white");\n gray2 = lazyColor("gray");\n bold2 = lazyColor("bold");\n dim2 = lazyColor("dim");\n italic2 = lazyColor("italic");\n underline2 = lazyColor("underline");\n strikethrough2 = lazyColor("strikethrough");\n reset2 = lazyColor("reset");\n }\n});\n\n// src/platform/compat/console/index.ts\nasync function loadColors() {\n if (_colors)\n return _colors;\n try {\n if (isDeno) {\n const mod = await Promise.resolve().then(() => (init_deno2(), deno_exports));\n _colors = mod.colors;\n } else {\n const mod = await Promise.resolve().then(() => (init_node(), node_exports));\n _colors = mod.colors;\n }\n } catch {\n _colors = fallbackColors;\n }\n return _colors;\n}\nvar noOp, fallbackColors, _colors, colorsPromise;\nvar init_console = __esm({\n "src/platform/compat/console/index.ts"() {\n init_runtime();\n noOp = (text2) => text2;\n fallbackColors = {\n red: noOp,\n green: noOp,\n yellow: noOp,\n blue: noOp,\n cyan: noOp,\n magenta: noOp,\n white: noOp,\n gray: noOp,\n bold: noOp,\n dim: noOp,\n italic: noOp,\n underline: noOp,\n strikethrough: noOp,\n reset: noOp\n };\n _colors = null;\n colorsPromise = loadColors();\n }\n});\n\n// src/core/errors/user-friendly/error-identifier.ts\nvar init_error_identifier = __esm({\n "src/core/errors/user-friendly/error-identifier.ts"() {\n "use strict";\n }\n});\n\n// src/core/errors/user-friendly/error-formatter.ts\nvar init_error_formatter = __esm({\n "src/core/errors/user-friendly/error-formatter.ts"() {\n "use strict";\n init_console();\n init_error_catalog();\n init_error_identifier();\n }\n});\n\n// src/core/errors/user-friendly/error-wrapper.ts\nvar init_error_wrapper = __esm({\n "src/core/errors/user-friendly/error-wrapper.ts"() {\n "use strict";\n init_console();\n init_process();\n init_logger();\n init_error_formatter();\n }\n});\n\n// src/core/errors/user-friendly/index.ts\nvar init_user_friendly = __esm({\n "src/core/errors/user-friendly/index.ts"() {\n "use strict";\n init_error_catalog();\n init_error_formatter();\n init_error_identifier();\n init_error_wrapper();\n }\n});\n\n// src/core/errors/index.ts\nvar init_errors = __esm({\n "src/core/errors/index.ts"() {\n init_types();\n init_agent_errors();\n init_build_errors();\n init_runtime_errors();\n init_system_errors();\n init_error_handlers();\n init_catalog();\n init_user_friendly();\n }\n});\n\n// src/platform/adapters/deno.ts\nvar DenoFileSystemAdapter, DenoEnvironmentAdapter, DenoServerAdapter, DenoShellAdapter, DenoServer, DenoAdapter, denoAdapter;\nvar init_deno3 = __esm({\n "src/platform/adapters/deno.ts"() {\n "use strict";\n init_veryfront_error();\n init_config();\n init_utils();\n DenoFileSystemAdapter = class {\n async readFile(path) {\n return await Deno.readTextFile(path);\n }\n async readFileBytes(path) {\n return await Deno.readFile(path);\n }\n async writeFile(path, content) {\n await Deno.writeTextFile(path, content);\n }\n async exists(path) {\n try {\n await Deno.stat(path);\n return true;\n } catch (_error) {\n return false;\n }\n }\n async *readDir(path) {\n for await (const entry of Deno.readDir(path)) {\n yield {\n name: entry.name,\n isFile: entry.isFile,\n isDirectory: entry.isDirectory,\n isSymlink: entry.isSymlink\n };\n }\n }\n async stat(path) {\n const stat = await Deno.stat(path);\n return {\n size: stat.size,\n isFile: stat.isFile,\n isDirectory: stat.isDirectory,\n isSymlink: stat.isSymlink,\n mtime: stat.mtime\n };\n }\n async mkdir(path, options) {\n await Deno.mkdir(path, options);\n }\n async remove(path, options) {\n await Deno.remove(path, options);\n }\n async makeTempDir(prefix) {\n return await Deno.makeTempDir({ prefix });\n }\n watch(paths, options) {\n const pathArray = Array.isArray(paths) ? paths : [paths];\n const recursive = options?.recursive ?? true;\n const signal = options?.signal;\n const watcher = Deno.watchFs(pathArray, { recursive });\n let closed = false;\n const denoIterator = watcher[Symbol.asyncIterator]();\n const mapEventKind = (kind) => {\n switch (kind) {\n case "create":\n return "create";\n case "modify":\n return "modify";\n case "remove":\n return "delete";\n default:\n return "any";\n }\n };\n const iterator = {\n async next() {\n if (closed || signal?.aborted) {\n return { done: true, value: void 0 };\n }\n try {\n const result = await denoIterator.next();\n if (result.done) {\n return { done: true, value: void 0 };\n }\n return {\n done: false,\n value: {\n kind: mapEventKind(result.value.kind),\n paths: result.value.paths\n }\n };\n } catch (error2) {\n if (closed || signal?.aborted) {\n return { done: true, value: void 0 };\n }\n throw error2;\n }\n },\n async return() {\n closed = true;\n if (denoIterator.return) {\n await denoIterator.return();\n }\n return { done: true, value: void 0 };\n }\n };\n const cleanup = () => {\n if (closed)\n return;\n closed = true;\n try {\n if ("close" in watcher && typeof watcher.close === "function") {\n watcher.close();\n }\n } catch (error2) {\n serverLogger.debug("[Deno] Filesystem watcher cleanup failed", { error: error2 });\n }\n };\n if (signal) {\n signal.addEventListener("abort", cleanup);\n }\n return {\n [Symbol.asyncIterator]() {\n return iterator;\n },\n close: cleanup\n };\n }\n };\n DenoEnvironmentAdapter = class {\n get(key) {\n return Deno.env.get(key);\n }\n set(key, value) {\n Deno.env.set(key, value);\n }\n toObject() {\n return Deno.env.toObject();\n }\n };\n DenoServerAdapter = class {\n upgradeWebSocket(request) {\n const { socket, response } = Deno.upgradeWebSocket(request);\n return { socket, response };\n }\n };\n DenoShellAdapter = class {\n statSync(path) {\n try {\n const stat = Deno.statSync(path);\n return {\n isFile: stat.isFile,\n isDirectory: stat.isDirectory\n };\n } catch (error2) {\n throw toError(createError({\n type: "file",\n message: `Failed to stat file: ${error2}`\n }));\n }\n }\n readFileSync(path) {\n try {\n return Deno.readTextFileSync(path);\n } catch (error2) {\n throw toError(createError({\n type: "file",\n message: `Failed to read file: ${error2}`\n }));\n }\n }\n };\n DenoServer = class {\n constructor(server, hostname, port, abortController) {\n this.server = server;\n this.hostname = hostname;\n this.port = port;\n this.abortController = abortController;\n }\n async stop() {\n try {\n if (this.abortController) {\n this.abortController.abort();\n }\n await this.server.shutdown();\n } catch (error2) {\n serverLogger.debug("[Deno] Server shutdown failed", { error: error2 });\n }\n }\n get addr() {\n return { hostname: this.hostname, port: this.port };\n }\n };\n DenoAdapter = class {\n constructor() {\n this.id = "deno";\n this.name = "deno";\n /** @deprecated Use `id` instead */\n this.platform = "deno";\n this.fs = new DenoFileSystemAdapter();\n this.env = new DenoEnvironmentAdapter();\n this.server = new DenoServerAdapter();\n this.shell = new DenoShellAdapter();\n this.capabilities = {\n typescript: true,\n jsx: true,\n http2: true,\n websocket: true,\n workers: true,\n fileWatching: true,\n shell: true,\n kvStore: true,\n // Deno KV available\n writableFs: true\n };\n /** @deprecated Use `capabilities` instead */\n this.features = {\n websocket: true,\n http2: true,\n workers: true,\n jsx: true,\n typescript: true\n };\n }\n serve(handler, options = {}) {\n const { port = DEFAULT_DEV_PORT, hostname = "localhost", onListen } = options;\n const controller = new AbortController();\n const signal = options.signal || controller.signal;\n const server = Deno.serve({\n port,\n hostname,\n signal,\n handler: async (request, _info) => {\n try {\n return await handler(request);\n } catch (error2) {\n const { serverLogger: serverLogger2 } = await Promise.resolve().then(() => (init_utils(), utils_exports));\n serverLogger2.error("Request handler error:", error2);\n return new Response("Internal Server Error", { status: 500 });\n }\n },\n onListen: (params) => {\n onListen?.({ hostname: params.hostname, port: params.port });\n }\n });\n const controllerToPass = options.signal ? void 0 : controller;\n return Promise.resolve(new DenoServer(server, hostname, port, controllerToPass));\n }\n };\n denoAdapter = new DenoAdapter();\n }\n});\n\n// src/rendering/client/router.ts\ninit_utils();\nimport ReactDOM from "react-dom/client";\n\n// src/routing/matchers/pattern-route-matcher.ts\ninit_path_utils();\n\n// src/routing/matchers/index.ts\ninit_utils();\n\n// src/platform/compat/path-helper.ts\nimport nodePath2 from "node:path";\nvar pathMod = null;\nif (typeof Deno === "undefined") {\n pathMod = nodePath2;\n} else {\n Promise.resolve().then(() => (init_std_path(), std_path_exports)).then((mod) => {\n pathMod = mod;\n });\n}\nvar sep3 = nodePath2.sep;\n\n// src/routing/client/dom-utils.ts\ninit_utils();\nfunction isInternalLink(target) {\n const href = target.getAttribute("href");\n if (!href)\n return false;\n if (href.startsWith("http") || href.startsWith("mailto:"))\n return false;\n if (href.startsWith("#"))\n return false;\n if (target.getAttribute("target") === "_blank" || target.getAttribute("download")) {\n return false;\n }\n return true;\n}\nfunction findAnchorElement(element) {\n let current = element;\n while (current && current.tagName !== "A") {\n current = current.parentElement;\n }\n if (!current || !(current instanceof HTMLAnchorElement)) {\n return null;\n }\n return current;\n}\nfunction updateMetaTags(frontmatter) {\n if (frontmatter.description) {\n updateMetaTag(\'meta[name="description"]\', "name", "description", frontmatter.description);\n }\n if (frontmatter.ogTitle) {\n updateMetaTag(\'meta[property="og:title"]\', "property", "og:title", frontmatter.ogTitle);\n }\n}\nfunction updateMetaTag(selector, attributeName, attributeValue, content) {\n let metaTag = document.querySelector(selector);\n if (!metaTag) {\n metaTag = document.createElement("meta");\n metaTag.setAttribute(attributeName, attributeValue);\n document.head.appendChild(metaTag);\n }\n metaTag.setAttribute("content", content);\n}\nfunction executeScripts(container) {\n const scripts = container.querySelectorAll("script");\n scripts.forEach((oldScript) => {\n const newScript = document.createElement("script");\n Array.from(oldScript.attributes).forEach((attribute) => {\n newScript.setAttribute(attribute.name, attribute.value);\n });\n newScript.textContent = oldScript.textContent;\n oldScript.parentNode?.replaceChild(newScript, oldScript);\n });\n}\nfunction applyHeadDirectives(container) {\n const nodes = container.querySelectorAll(\'[data-veryfront-head="1"], vf-head\');\n if (nodes.length > 0) {\n cleanManagedHeadTags();\n }\n nodes.forEach((wrapper) => {\n processHeadWrapper(wrapper);\n wrapper.parentElement?.removeChild(wrapper);\n });\n}\nfunction cleanManagedHeadTags() {\n document.head.querySelectorAll(\'[data-veryfront-managed="1"]\').forEach((element) => element.parentElement?.removeChild(element));\n}\nfunction processHeadWrapper(wrapper) {\n wrapper.childNodes.forEach((node) => {\n if (!(node instanceof Element))\n return;\n const tagName = node.tagName.toLowerCase();\n if (tagName === "title") {\n document.title = node.textContent || document.title;\n return;\n }\n const clone = document.createElement(tagName);\n for (const attribute of Array.from(node.attributes)) {\n clone.setAttribute(attribute.name, attribute.value);\n }\n if (node.textContent && !clone.hasAttribute("src")) {\n clone.textContent = node.textContent;\n }\n clone.setAttribute("data-veryfront-managed", "1");\n document.head.appendChild(clone);\n });\n}\nfunction manageFocus(container) {\n try {\n const focusElement = container.querySelector("[data-router-focus]") || container.querySelector("main") || container.querySelector("h1");\n if (focusElement && focusElement instanceof HTMLElement && "focus" in focusElement) {\n focusElement.focus({ preventScroll: true });\n }\n } catch (error2) {\n rendererLogger.warn("[router] focus management failed", error2);\n }\n}\nfunction extractPageDataFromScript() {\n const pageDataScript = document.querySelector("script[data-veryfront-page]");\n if (!pageDataScript)\n return null;\n try {\n const content = pageDataScript.textContent;\n if (!content) {\n rendererLogger.warn("[dom-utils] Page data script has no content");\n return {};\n }\n return JSON.parse(content);\n } catch (error2) {\n rendererLogger.error("[dom-utils] Failed to parse page data:", error2);\n return null;\n }\n}\nfunction parsePageDataFromHTML(html3) {\n const parser = new DOMParser();\n const doc = parser.parseFromString(html3, "text/html");\n const root = doc.getElementById("root");\n let content = "";\n if (root) {\n content = root.innerHTML || "";\n } else {\n rendererLogger.warn("[dom-utils] No root element found in HTML");\n }\n const pageDataScript = doc.querySelector("script[data-veryfront-page]");\n let pageData = {};\n if (pageDataScript) {\n try {\n const content2 = pageDataScript.textContent;\n if (!content2) {\n rendererLogger.warn("[dom-utils] Page data script in HTML has no content");\n } else {\n pageData = JSON.parse(content2);\n }\n } catch (error2) {\n rendererLogger.error("[dom-utils] Failed to parse page data from HTML:", error2);\n }\n }\n return { content, pageData };\n}\n\n// src/routing/client/navigation-handlers.ts\ninit_utils();\ninit_config();\nvar NavigationHandlers = class {\n constructor(prefetchDelay = DEFAULT_PREFETCH_DELAY_MS, prefetchOptions = {}) {\n this.prefetchQueue = /* @__PURE__ */ new Set();\n this.scrollPositions = /* @__PURE__ */ new Map();\n this.isPopStateNav = false;\n this.prefetchDelay = prefetchDelay;\n this.prefetchOptions = prefetchOptions;\n }\n createClickHandler(callbacks) {\n return (event) => {\n const anchor = findAnchorElement(event.target);\n if (!anchor || !isInternalLink(anchor))\n return;\n const href = anchor.getAttribute("href");\n event.preventDefault();\n callbacks.onNavigate(href);\n };\n }\n createPopStateHandler(callbacks) {\n return (_event) => {\n const path = globalThis.location.pathname;\n this.isPopStateNav = true;\n callbacks.onNavigate(path);\n };\n }\n createMouseOverHandler(callbacks) {\n return (event) => {\n const target = event.target;\n if (target.tagName !== "A")\n return;\n const href = target.getAttribute("href");\n if (!href || href.startsWith("http") || href.startsWith("#"))\n return;\n if (!this.shouldPrefetchOnHover(target))\n return;\n if (!this.prefetchQueue.has(href)) {\n this.prefetchQueue.add(href);\n setTimeout(() => {\n callbacks.onPrefetch(href);\n this.prefetchQueue.delete(href);\n }, this.prefetchDelay);\n }\n };\n }\n shouldPrefetchOnHover(target) {\n const prefetchAttribute = target.getAttribute("data-prefetch");\n const isHoverEnabled = Boolean(this.prefetchOptions.hover);\n if (prefetchAttribute === "false")\n return false;\n return prefetchAttribute === "true" || isHoverEnabled;\n }\n saveScrollPosition(path) {\n try {\n const scrollY = globalThis.scrollY;\n if (typeof scrollY === "number") {\n this.scrollPositions.set(path, scrollY);\n } else {\n rendererLogger.debug("[router] No valid scrollY value available");\n this.scrollPositions.set(path, 0);\n }\n } catch (error2) {\n rendererLogger.warn("[router] failed to record scroll position", error2);\n }\n }\n getScrollPosition(path) {\n const position = this.scrollPositions.get(path);\n if (position === void 0) {\n rendererLogger.debug(`[router] No scroll position stored for ${path}`);\n return 0;\n }\n return position;\n }\n isPopState() {\n return this.isPopStateNav;\n }\n clearPopStateFlag() {\n this.isPopStateNav = false;\n }\n clear() {\n this.prefetchQueue.clear();\n this.scrollPositions.clear();\n this.isPopStateNav = false;\n }\n};\n\n// src/routing/client/page-loader.ts\ninit_utils();\ninit_errors();\nvar PageLoader = class {\n constructor() {\n this.cache = /* @__PURE__ */ new Map();\n }\n getCached(path) {\n return this.cache.get(path);\n }\n isCached(path) {\n return this.cache.has(path);\n }\n setCache(path, data) {\n this.cache.set(path, data);\n }\n clearCache() {\n this.cache.clear();\n }\n async fetchPageData(path) {\n const jsonData = await this.tryFetchJSON(path);\n if (jsonData)\n return jsonData;\n return this.fetchAndParseHTML(path);\n }\n async tryFetchJSON(path) {\n try {\n const response = await fetch(`/_veryfront/data${path}.json`, {\n headers: { "X-Veryfront-Navigation": "client" }\n });\n if (response.ok) {\n return await response.json();\n }\n } catch (error2) {\n rendererLogger.debug(`[PageLoader] RSC fetch failed for ${path}, falling back to HTML:`, error2);\n }\n return null;\n }\n async fetchAndParseHTML(path) {\n const response = await fetch(path, {\n headers: { "X-Veryfront-Navigation": "client" }\n });\n if (!response.ok) {\n throw new NetworkError(`Failed to fetch ${path}`, {\n status: response.status,\n path\n });\n }\n const html3 = await response.text();\n const { content, pageData } = parsePageDataFromHTML(html3);\n return {\n html: content,\n ...pageData\n };\n }\n async loadPage(path) {\n const cachedData = this.getCached(path);\n if (cachedData) {\n rendererLogger.debug(`Loading ${path} from cache`);\n return cachedData;\n }\n const data = await this.fetchPageData(path);\n this.setCache(path, data);\n return data;\n }\n async prefetch(path) {\n if (this.isCached(path))\n return;\n rendererLogger.debug(`Prefetching ${path}`);\n try {\n const data = await this.fetchPageData(path);\n this.setCache(path, data);\n } catch (error2) {\n rendererLogger.warn(`Failed to prefetch ${path}`, error2);\n }\n }\n};\n\n// src/routing/client/page-transition.ts\ninit_utils();\ninit_config();\n\n// src/security/client/html-sanitizer.ts\nvar SUSPICIOUS_PATTERNS = [\n { pattern: /<script[^>]*>[\\s\\S]*?<\\/script>/gi, name: "inline script" },\n { pattern: /javascript:/gi, name: "javascript: URL" },\n { pattern: /\\bon\\w+\\s*=/gi, name: "event handler attribute" },\n { pattern: /data:\\s*text\\/html/gi, name: "data: HTML URL" }\n];\nfunction isDevMode() {\n if (typeof globalThis !== "undefined") {\n const g = globalThis;\n return g.__VERYFRONT_DEV__ === true || g.Deno?.env?.get?.("VERYFRONT_ENV") === "development";\n }\n return false;\n}\nfunction validateTrustedHtml(html3, options = {}) {\n const { strict = false, warn = true } = options;\n for (const { pattern, name } of SUSPICIOUS_PATTERNS) {\n pattern.lastIndex = 0;\n if (pattern.test(html3)) {\n const message = `[Security] Suspicious ${name} detected in server HTML`;\n if (warn) {\n console.warn(message);\n }\n if (strict || !isDevMode()) {\n throw new Error(`Potentially unsafe HTML: ${name} detected`);\n }\n }\n }\n return html3;\n}\n\n// src/routing/client/page-transition.ts\nvar PageTransition = class {\n constructor(setupViewportPrefetch) {\n this.setupViewportPrefetch = setupViewportPrefetch;\n }\n destroy() {\n if (this.pendingTransitionTimeout !== void 0) {\n clearTimeout(this.pendingTransitionTimeout);\n this.pendingTransitionTimeout = void 0;\n }\n }\n updatePage(data, isPopState, scrollY) {\n if (data.frontmatter?.title) {\n document.title = data.frontmatter.title;\n }\n updateMetaTags(data.frontmatter ?? {});\n const rootElement = document.getElementById("root");\n if (rootElement && (data.html ?? "") !== "") {\n this.performTransition(rootElement, data, isPopState, scrollY);\n }\n }\n performTransition(rootElement, data, isPopState, scrollY) {\n if (this.pendingTransitionTimeout !== void 0) {\n clearTimeout(this.pendingTransitionTimeout);\n }\n rootElement.style.opacity = "0";\n this.pendingTransitionTimeout = setTimeout(() => {\n this.pendingTransitionTimeout = void 0;\n rootElement.innerHTML = validateTrustedHtml(String(data.html ?? ""));\n rootElement.style.opacity = "1";\n executeScripts(rootElement);\n applyHeadDirectives(rootElement);\n this.setupViewportPrefetch(rootElement);\n manageFocus(rootElement);\n this.handleScroll(isPopState, scrollY);\n }, PAGE_TRANSITION_DELAY_MS);\n }\n handleScroll(isPopState, scrollY) {\n try {\n globalThis.scrollTo(0, isPopState ? scrollY : 0);\n } catch (error2) {\n rendererLogger.warn("[router] scroll handling failed", error2);\n }\n }\n showError(error2) {\n const rootElement = document.getElementById("root");\n if (!rootElement)\n return;\n const errorDiv = document.createElement("div");\n errorDiv.className = "veryfront-error-page";\n const heading = document.createElement("h1");\n heading.textContent = "Oops! Something went wrong";\n const message = document.createElement("p");\n message.textContent = error2.message;\n const button = document.createElement("button");\n button.type = "button";\n button.textContent = "Reload Page";\n button.onclick = () => globalThis.location.reload();\n errorDiv.appendChild(heading);\n errorDiv.appendChild(message);\n errorDiv.appendChild(button);\n rootElement.innerHTML = "";\n rootElement.appendChild(errorDiv);\n }\n setLoadingState(loading) {\n const indicator = document.getElementById("veryfront-loading");\n if (indicator) {\n indicator.style.display = loading ? "block" : "none";\n }\n document.body.classList.toggle("veryfront-loading", loading);\n }\n};\n\n// src/routing/client/viewport-prefetch.ts\ninit_utils();\nvar ViewportPrefetch = class {\n constructor(prefetchCallback, prefetchOptions = {}) {\n this.observer = null;\n this.prefetchCallback = prefetchCallback;\n this.prefetchOptions = prefetchOptions;\n }\n setup(root) {\n try {\n if (!("IntersectionObserver" in globalThis))\n return;\n if (this.observer)\n this.observer.disconnect();\n this.createObserver();\n this.observeLinks(root);\n } catch (error2) {\n rendererLogger.debug("[router] setupViewportPrefetch failed", error2);\n }\n }\n createObserver() {\n this.observer = new IntersectionObserver(\n (entries) => {\n for (const entry of entries) {\n if (entry.isIntersecting) {\n const isAnchor = typeof HTMLAnchorElement !== "undefined" ? entry.target instanceof HTMLAnchorElement : entry.target.tagName === "A";\n if (isAnchor) {\n const href = entry.target.getAttribute("href");\n if (href) {\n this.prefetchCallback(href);\n }\n this.observer?.unobserve(entry.target);\n }\n }\n }\n },\n { rootMargin: "200px" }\n );\n }\n observeLinks(root) {\n const anchors = root.querySelectorAll?.(\'a[href]:not([target="_blank"])\') ?? document.createDocumentFragment().querySelectorAll("a");\n const isViewportEnabled = Boolean(this.prefetchOptions.viewport);\n anchors.forEach((anchor) => {\n if (this.shouldObserveAnchor(anchor, isViewportEnabled)) {\n this.observer?.observe(anchor);\n }\n });\n }\n shouldObserveAnchor(anchor, isViewportEnabled) {\n const href = anchor.getAttribute("href") || "";\n if (!href || href.startsWith("http") || href.startsWith("#") || anchor.getAttribute("download")) {\n return false;\n }\n const prefetchAttribute = anchor.getAttribute("data-prefetch");\n if (prefetchAttribute === "false")\n return false;\n return prefetchAttribute === "viewport" || isViewportEnabled;\n }\n disconnect() {\n if (this.observer) {\n try {\n this.observer.disconnect();\n } catch (error2) {\n rendererLogger.warn("[router] prefetchObserver.disconnect failed", error2);\n }\n this.observer = null;\n }\n }\n};\n\n// src/routing/api/handler.ts\ninit_utils();\ninit_std_path();\ninit_config();\n\n// src/core/utils/lru-wrapper.ts\ninit_utils();\ninit_process();\n\n// src/routing/api/handler.ts\ninit_veryfront_error();\n\n// src/security/http/response/constants.ts\nvar CONTENT_TYPES = {\n JSON: "application/json; charset=utf-8",\n HTML: "text/html; charset=utf-8",\n TEXT: "text/plain; charset=utf-8",\n JAVASCRIPT: "application/javascript; charset=utf-8",\n CSS: "text/css; charset=utf-8",\n XML: "application/xml; charset=utf-8"\n};\nvar CACHE_DURATIONS = {\n SHORT: 60,\n MEDIUM: 3600,\n LONG: 31536e3\n};\n\n// src/security/http/cors/validators.ts\ninit_logger();\n\n// src/observability/tracing/manager.ts\ninit_utils();\n\n// src/observability/tracing/config.ts\ninit_process();\nvar DEFAULT_CONFIG2 = {\n enabled: false,\n exporter: "console",\n serviceName: "veryfront",\n sampleRate: 1,\n debug: false\n};\nfunction loadConfig(config = {}, adapter) {\n const finalConfig = { ...DEFAULT_CONFIG2, ...config };\n if (adapter?.env) {\n applyEnvFromAdapter(finalConfig, adapter.env);\n } else {\n applyEnvFromDeno(finalConfig);\n }\n return finalConfig;\n}\nfunction applyEnvFromAdapter(config, envAdapter) {\n if (!envAdapter)\n return;\n const otelEnabled = envAdapter.get("OTEL_TRACES_ENABLED");\n const veryfrontOtel = envAdapter.get("VERYFRONT_OTEL");\n const serviceName = envAdapter.get("OTEL_SERVICE_NAME");\n config.enabled = otelEnabled === "true" || veryfrontOtel === "1" || config.enabled;\n if (serviceName)\n config.serviceName = serviceName;\n const otlpEndpoint = envAdapter.get("OTEL_EXPORTER_OTLP_ENDPOINT");\n const tracesEndpoint = envAdapter.get("OTEL_EXPORTER_OTLP_TRACES_ENDPOINT");\n config.endpoint = otlpEndpoint || tracesEndpoint || config.endpoint;\n const exporterType = envAdapter.get("OTEL_TRACES_EXPORTER");\n if (isValidExporter(exporterType)) {\n config.exporter = exporterType;\n }\n}\nfunction applyEnvFromDeno(config) {\n try {\n config.enabled = getEnv("OTEL_TRACES_ENABLED") === "true" || getEnv("VERYFRONT_OTEL") === "1" || config.enabled;\n config.serviceName = getEnv("OTEL_SERVICE_NAME") || config.serviceName;\n config.endpoint = getEnv("OTEL_EXPORTER_OTLP_ENDPOINT") || getEnv("OTEL_EXPORTER_OTLP_TRACES_ENDPOINT") || config.endpoint;\n const exporterType = getEnv("OTEL_TRACES_EXPORTER");\n if (isValidExporter(exporterType)) {\n config.exporter = exporterType;\n }\n } catch {\n }\n}\nfunction isValidExporter(value) {\n return value === "jaeger" || value === "zipkin" || value === "otlp" || value === "console";\n}\n\n// src/observability/tracing/span-operations.ts\ninit_utils();\nvar SpanOperations = class {\n constructor(api, tracer2) {\n this.api = api;\n this.tracer = tracer2;\n }\n startSpan(name, options = {}) {\n try {\n const spanKind = this.mapSpanKind(options.kind);\n const span = this.tracer.startSpan(name, {\n kind: spanKind,\n attributes: options.attributes || {}\n }, options.parent);\n return span;\n } catch (error2) {\n serverLogger.debug("[tracing] Failed to start span", { name, error: error2 });\n return null;\n }\n }\n endSpan(span, error2) {\n if (!span)\n return;\n try {\n if (error2) {\n span.recordException(error2);\n span.setStatus({\n code: this.api.SpanStatusCode.ERROR,\n message: error2.message\n });\n } else {\n span.setStatus({ code: this.api.SpanStatusCode.OK });\n }\n span.end();\n } catch (err) {\n serverLogger.debug("[tracing] Failed to end span", err);\n }\n }\n setAttributes(span, attributes) {\n if (!span)\n return;\n try {\n span.setAttributes(attributes);\n } catch (error2) {\n serverLogger.debug("[tracing] Failed to set span attributes", error2);\n }\n }\n addEvent(span, name, attributes) {\n if (!span)\n return;\n try {\n span.addEvent(name, attributes);\n } catch (error2) {\n serverLogger.debug("[tracing] Failed to add span event", error2);\n }\n }\n createChildSpan(parentSpan, name, options = {}) {\n if (!parentSpan)\n return this.startSpan(name, options);\n try {\n const parentContext = this.api.trace.setSpan(this.api.context.active(), parentSpan);\n return this.startSpan(name, { ...options, parent: parentContext });\n } catch (error2) {\n serverLogger.debug("[tracing] Failed to create child span", error2);\n return null;\n }\n }\n mapSpanKind(kind) {\n if (!kind)\n return this.api.SpanKind.INTERNAL;\n const kindMap = {\n "internal": this.api.SpanKind.INTERNAL,\n "server": this.api.SpanKind.SERVER,\n "client": this.api.SpanKind.CLIENT,\n "producer": this.api.SpanKind.PRODUCER,\n "consumer": this.api.SpanKind.CONSUMER\n };\n return kindMap[kind.toLowerCase()] || this.api.SpanKind.INTERNAL;\n }\n};\n\n// src/observability/tracing/context-propagation.ts\ninit_utils();\nvar ContextPropagation = class {\n constructor(api, propagator) {\n this.api = api;\n this.propagator = propagator;\n }\n extractContext(headers) {\n try {\n const carrier = {};\n headers.forEach((value, key) => {\n carrier[key] = value;\n });\n return this.api.propagation.extract(this.api.context.active(), carrier);\n } catch (error2) {\n serverLogger.debug("[tracing] Failed to extract context from headers", error2);\n return void 0;\n }\n }\n injectContext(context, headers) {\n try {\n const carrier = {};\n this.api.propagation.inject(context, carrier);\n for (const [key, value] of Object.entries(carrier)) {\n headers.set(key, value);\n }\n } catch (error2) {\n serverLogger.debug("[tracing] Failed to inject context into headers", error2);\n }\n }\n getActiveContext() {\n try {\n return this.api.context.active();\n } catch (error2) {\n serverLogger.debug("[tracing] Failed to get active context", error2);\n return void 0;\n }\n }\n async withActiveSpan(span, fn) {\n if (!span)\n return await fn();\n return await this.api.context.with(\n this.api.trace.setSpan(this.api.context.active(), span),\n fn\n );\n }\n withSpan(name, fn, startSpan2, endSpan2) {\n const span = startSpan2(name);\n try {\n const result = fn(span);\n endSpan2(span);\n return result;\n } catch (error2) {\n endSpan2(span, error2);\n throw error2;\n }\n }\n async withSpanAsync(name, fn, startSpan2, endSpan2) {\n const span = startSpan2(name);\n try {\n const result = await fn(span);\n endSpan2(span);\n return result;\n } catch (error2) {\n endSpan2(span, error2);\n throw error2;\n }\n }\n};\n\n// src/observability/tracing/manager.ts\nvar TracingManager = class {\n constructor() {\n this.state = {\n initialized: false,\n tracer: null,\n api: null,\n propagator: null\n };\n this.spanOps = null;\n this.contextProp = null;\n }\n async initialize(config = {}, adapter) {\n if (this.state.initialized) {\n serverLogger.debug("[tracing] Already initialized");\n return;\n }\n const finalConfig = loadConfig(config, adapter);\n if (!finalConfig.enabled) {\n serverLogger.debug("[tracing] Tracing disabled");\n this.state.initialized = true;\n return;\n }\n try {\n await this.initializeTracer(finalConfig);\n this.state.initialized = true;\n serverLogger.info("[tracing] OpenTelemetry tracing initialized", {\n exporter: finalConfig.exporter,\n serviceName: finalConfig.serviceName,\n endpoint: finalConfig.endpoint\n });\n } catch (error2) {\n serverLogger.warn("[tracing] Failed to initialize OpenTelemetry tracing", error2);\n this.state.initialized = true;\n }\n }\n async initializeTracer(config) {\n const otelApiModule = ["npm:@opentelemetry/", "api@1"].join("");\n const api = await import(otelApiModule);\n this.state.api = api;\n this.state.tracer = api.trace.getTracer(config.serviceName || "veryfront", "0.1.0");\n const otelCoreModule = ["npm:@opentelemetry/", "core@1"].join("");\n const { W3CTraceContextPropagator } = await import(otelCoreModule);\n const propagator = new W3CTraceContextPropagator();\n this.state.propagator = propagator;\n api.propagation.setGlobalPropagator(propagator);\n if (this.state.api && this.state.tracer) {\n this.spanOps = new SpanOperations(this.state.api, this.state.tracer);\n }\n if (this.state.api && this.state.propagator) {\n this.contextProp = new ContextPropagation(this.state.api, this.state.propagator);\n }\n }\n isEnabled() {\n return this.state.initialized && this.state.tracer !== null;\n }\n getSpanOperations() {\n return this.spanOps;\n }\n getContextPropagation() {\n return this.contextProp;\n }\n getState() {\n return this.state;\n }\n shutdown() {\n if (!this.state.initialized)\n return;\n try {\n serverLogger.info("[tracing] Tracing shutdown initiated");\n } catch (error2) {\n serverLogger.warn("[tracing] Error during tracing shutdown", error2);\n }\n }\n};\nvar tracingManager = new TracingManager();\n\n// src/observability/metrics/manager.ts\ninit_utils();\n\n// src/observability/metrics/config.ts\ninit_process();\ninit_process();\nvar DEFAULT_METRICS_COLLECT_INTERVAL_MS2 = 6e4;\nvar DEFAULT_CONFIG3 = {\n enabled: false,\n exporter: "console",\n prefix: "veryfront",\n collectInterval: DEFAULT_METRICS_COLLECT_INTERVAL_MS2,\n debug: false\n};\nfunction loadConfig2(config, adapter) {\n const finalConfig = { ...DEFAULT_CONFIG3, ...config };\n if (adapter?.env) {\n const envAdapter = adapter.env;\n const otelEnabled = envAdapter.get("OTEL_METRICS_ENABLED");\n const veryfrontOtel = envAdapter.get("VERYFRONT_OTEL");\n finalConfig.enabled = otelEnabled === "true" || veryfrontOtel === "1" || finalConfig.enabled;\n const otlpEndpoint = envAdapter.get("OTEL_EXPORTER_OTLP_ENDPOINT");\n const metricsEndpoint = envAdapter.get(\n "OTEL_EXPORTER_OTLP_METRICS_ENDPOINT"\n );\n finalConfig.endpoint = otlpEndpoint || metricsEndpoint || finalConfig.endpoint;\n const exporterType = envAdapter.get("OTEL_METRICS_EXPORTER");\n if (exporterType === "prometheus" || exporterType === "otlp" || exporterType === "console") {\n finalConfig.exporter = exporterType;\n }\n } else {\n try {\n finalConfig.enabled = getEnv("OTEL_METRICS_ENABLED") === "true" || getEnv("VERYFRONT_OTEL") === "1" || finalConfig.enabled;\n finalConfig.endpoint = getEnv("OTEL_EXPORTER_OTLP_ENDPOINT") || getEnv("OTEL_EXPORTER_OTLP_METRICS_ENDPOINT") || finalConfig.endpoint;\n const exporterType = getEnv("OTEL_METRICS_EXPORTER");\n if (exporterType === "prometheus" || exporterType === "otlp" || exporterType === "console") {\n finalConfig.exporter = exporterType;\n }\n } catch {\n }\n }\n return finalConfig;\n}\nfunction getMemoryUsage() {\n try {\n return memoryUsage();\n } catch {\n return null;\n }\n}\n\n// src/observability/instruments/instruments-factory.ts\ninit_utils();\n\n// src/observability/instruments/build-instruments.ts\ninit_config();\nfunction createBuildInstruments(meter, config) {\n const buildDuration = meter.createHistogram(\n `${config.prefix}.build.duration`,\n {\n description: "Build operation duration",\n unit: "ms",\n advice: { explicitBucketBoundaries: DURATION_HISTOGRAM_BOUNDARIES_MS }\n }\n );\n const bundleSizeHistogram = meter.createHistogram(\n `${config.prefix}.build.bundle.size`,\n {\n description: "Bundle size distribution",\n unit: "kb",\n advice: { explicitBucketBoundaries: SIZE_HISTOGRAM_BOUNDARIES_KB }\n }\n );\n const bundleCounter = meter.createCounter(\n `${config.prefix}.build.bundles`,\n {\n description: "Total number of bundles created",\n unit: "bundles"\n }\n );\n return {\n buildDuration,\n bundleSizeHistogram,\n bundleCounter\n };\n}\n\n// src/observability/instruments/cache-instruments.ts\nfunction createCacheInstruments(meter, config, runtimeState) {\n const cacheGetCounter = meter.createCounter(\n `${config.prefix}.cache.gets`,\n {\n description: "Total number of cache get operations",\n unit: "operations"\n }\n );\n const cacheHitCounter = meter.createCounter(\n `${config.prefix}.cache.hits`,\n {\n description: "Total number of cache hits",\n unit: "hits"\n }\n );\n const cacheMissCounter = meter.createCounter(\n `${config.prefix}.cache.misses`,\n {\n description: "Total number of cache misses",\n unit: "misses"\n }\n );\n const cacheSetCounter = meter.createCounter(\n `${config.prefix}.cache.sets`,\n {\n description: "Total number of cache set operations",\n unit: "operations"\n }\n );\n const cacheInvalidateCounter = meter.createCounter(\n `${config.prefix}.cache.invalidations`,\n {\n description: "Total number of cache invalidations",\n unit: "operations"\n }\n );\n const cacheSizeGauge = meter.createObservableGauge(\n `${config.prefix}.cache.size`,\n {\n description: "Current cache size",\n unit: "entries"\n }\n );\n cacheSizeGauge.addCallback((result) => {\n result.observe(runtimeState.cacheSize);\n });\n return {\n cacheGetCounter,\n cacheHitCounter,\n cacheMissCounter,\n cacheSetCounter,\n cacheInvalidateCounter,\n cacheSizeGauge\n };\n}\n\n// src/observability/instruments/data-instruments.ts\ninit_config();\nfunction createDataInstruments(meter, config) {\n const dataFetchDuration = meter.createHistogram(\n `${config.prefix}.data.fetch.duration`,\n {\n description: "Data fetch duration",\n unit: "ms",\n advice: { explicitBucketBoundaries: DURATION_HISTOGRAM_BOUNDARIES_MS }\n }\n );\n const dataFetchCounter = meter.createCounter(\n `${config.prefix}.data.fetch.count`,\n {\n description: "Total number of data fetches",\n unit: "fetches"\n }\n );\n const dataFetchErrorCounter = meter.createCounter(\n `${config.prefix}.data.fetch.errors`,\n {\n description: "Data fetch errors",\n unit: "errors"\n }\n );\n return {\n dataFetchDuration,\n dataFetchCounter,\n dataFetchErrorCounter\n };\n}\n\n// src/observability/instruments/http-instruments.ts\ninit_config();\nfunction createHttpInstruments(meter, config) {\n const httpRequestCounter = meter.createCounter(\n `${config.prefix}.http.requests`,\n {\n description: "Total number of HTTP requests",\n unit: "requests"\n }\n );\n const httpRequestDuration = meter.createHistogram(\n `${config.prefix}.http.request.duration`,\n {\n description: "HTTP request duration",\n unit: "ms",\n advice: { explicitBucketBoundaries: DURATION_HISTOGRAM_BOUNDARIES_MS }\n }\n );\n const httpActiveRequests = meter.createUpDownCounter(\n `${config.prefix}.http.requests.active`,\n {\n description: "Number of active HTTP requests",\n unit: "requests"\n }\n );\n return {\n httpRequestCounter,\n httpRequestDuration,\n httpActiveRequests\n };\n}\n\n// src/observability/instruments/memory-instruments.ts\nfunction createMemoryInstruments(meter, config) {\n const memoryUsageGauge = meter.createObservableGauge(\n `${config.prefix}.memory.usage`,\n {\n description: "Memory usage",\n unit: "bytes"\n }\n );\n memoryUsageGauge.addCallback((result) => {\n const memoryUsage2 = getMemoryUsage();\n if (memoryUsage2) {\n result.observe(memoryUsage2.rss);\n }\n });\n const heapUsageGauge = meter.createObservableGauge(\n `${config.prefix}.memory.heap`,\n {\n description: "Heap memory usage",\n unit: "bytes"\n }\n );\n heapUsageGauge.addCallback((result) => {\n const memoryUsage2 = getMemoryUsage();\n if (memoryUsage2) {\n result.observe(memoryUsage2.heapUsed);\n }\n });\n return {\n memoryUsageGauge,\n heapUsageGauge\n };\n}\n\n// src/observability/instruments/render-instruments.ts\ninit_config();\nfunction createRenderInstruments(meter, config) {\n const renderDuration = meter.createHistogram(\n `${config.prefix}.render.duration`,\n {\n description: "Page render duration",\n unit: "ms",\n advice: { explicitBucketBoundaries: DURATION_HISTOGRAM_BOUNDARIES_MS }\n }\n );\n const renderCounter = meter.createCounter(\n `${config.prefix}.render.count`,\n {\n description: "Total number of page renders",\n unit: "renders"\n }\n );\n const renderErrorCounter = meter.createCounter(\n `${config.prefix}.render.errors`,\n {\n description: "Total number of render errors",\n unit: "errors"\n }\n );\n return {\n renderDuration,\n renderCounter,\n renderErrorCounter\n };\n}\n\n// src/observability/instruments/rsc-instruments.ts\ninit_config();\nfunction createRscInstruments(meter, config) {\n const rscRenderDuration = meter.createHistogram(\n `${config.prefix}.rsc.render.duration`,\n {\n description: "RSC render duration",\n unit: "ms",\n advice: { explicitBucketBoundaries: DURATION_HISTOGRAM_BOUNDARIES_MS }\n }\n );\n const rscStreamDuration = meter.createHistogram(\n `${config.prefix}.rsc.stream.duration`,\n {\n description: "RSC stream duration",\n unit: "ms",\n advice: { explicitBucketBoundaries: DURATION_HISTOGRAM_BOUNDARIES_MS }\n }\n );\n const rscManifestCounter = meter.createCounter(\n `${config.prefix}.rsc.manifest`,\n {\n description: "RSC manifest requests",\n unit: "requests"\n }\n );\n const rscPageCounter = meter.createCounter(\n `${config.prefix}.rsc.page`,\n {\n description: "RSC page requests",\n unit: "requests"\n }\n );\n const rscStreamCounter = meter.createCounter(\n `${config.prefix}.rsc.stream`,\n {\n description: "RSC stream requests",\n unit: "requests"\n }\n );\n const rscActionCounter = meter.createCounter(\n `${config.prefix}.rsc.action`,\n {\n description: "RSC action requests",\n unit: "requests"\n }\n );\n const rscErrorCounter = meter.createCounter(\n `${config.prefix}.rsc.errors`,\n {\n description: "RSC errors",\n unit: "errors"\n }\n );\n return {\n rscRenderDuration,\n rscStreamDuration,\n rscManifestCounter,\n rscPageCounter,\n rscStreamCounter,\n rscActionCounter,\n rscErrorCounter\n };\n}\n\n// src/observability/instruments/instruments-factory.ts\nfunction initializeInstruments(meter, config, runtimeState) {\n const instruments = {\n httpRequestCounter: null,\n httpRequestDuration: null,\n httpActiveRequests: null,\n cacheGetCounter: null,\n cacheHitCounter: null,\n cacheMissCounter: null,\n cacheSetCounter: null,\n cacheInvalidateCounter: null,\n cacheSizeGauge: null,\n renderDuration: null,\n renderCounter: null,\n renderErrorCounter: null,\n rscRenderDuration: null,\n rscStreamDuration: null,\n rscManifestCounter: null,\n rscPageCounter: null,\n rscStreamCounter: null,\n rscActionCounter: null,\n rscErrorCounter: null,\n buildDuration: null,\n bundleSizeHistogram: null,\n bundleCounter: null,\n dataFetchDuration: null,\n dataFetchCounter: null,\n dataFetchErrorCounter: null,\n corsRejectionCounter: null,\n securityHeadersCounter: null,\n memoryUsageGauge: null,\n heapUsageGauge: null\n };\n try {\n const httpInstruments = createHttpInstruments(meter, config);\n Object.assign(instruments, httpInstruments);\n const cacheInstruments = createCacheInstruments(meter, config, runtimeState);\n Object.assign(instruments, cacheInstruments);\n const renderInstruments = createRenderInstruments(meter, config);\n Object.assign(instruments, renderInstruments);\n const rscInstruments = createRscInstruments(meter, config);\n Object.assign(instruments, rscInstruments);\n const buildInstruments = createBuildInstruments(meter, config);\n Object.assign(instruments, buildInstruments);\n const dataInstruments = createDataInstruments(meter, config);\n Object.assign(instruments, dataInstruments);\n const memoryInstruments = createMemoryInstruments(meter, config);\n Object.assign(instruments, memoryInstruments);\n } catch (error2) {\n serverLogger.warn("[metrics] Failed to initialize metric instruments", error2);\n }\n return Promise.resolve(instruments);\n}\n\n// src/observability/metrics/recorder.ts\nvar MetricsRecorder = class {\n constructor(instruments, runtimeState) {\n this.instruments = instruments;\n this.runtimeState = runtimeState;\n }\n recordHttpRequest(attributes) {\n this.instruments.httpRequestCounter?.add(1, attributes);\n this.instruments.httpActiveRequests?.add(1, attributes);\n this.runtimeState.activeRequests++;\n }\n recordHttpRequestComplete(durationMs, attributes) {\n this.instruments.httpRequestDuration?.record(durationMs, attributes);\n this.instruments.httpActiveRequests?.add(-1, attributes);\n this.runtimeState.activeRequests--;\n }\n recordCacheGet(hit, attributes) {\n this.instruments.cacheGetCounter?.add(1, attributes);\n if (hit) {\n this.instruments.cacheHitCounter?.add(1, attributes);\n } else {\n this.instruments.cacheMissCounter?.add(1, attributes);\n }\n }\n recordCacheSet(attributes) {\n this.instruments.cacheSetCounter?.add(1, attributes);\n this.runtimeState.cacheSize++;\n }\n recordCacheInvalidate(count, attributes) {\n this.instruments.cacheInvalidateCounter?.add(count, attributes);\n this.runtimeState.cacheSize = Math.max(\n 0,\n this.runtimeState.cacheSize - count\n );\n }\n setCacheSize(size) {\n this.runtimeState.cacheSize = size;\n }\n // Render Metrics\n recordRender(durationMs, attributes) {\n this.instruments.renderDuration?.record(durationMs, attributes);\n this.instruments.renderCounter?.add(1, attributes);\n }\n recordRenderError(attributes) {\n this.instruments.renderErrorCounter?.add(1, attributes);\n }\n // RSC Metrics\n recordRSCRender(durationMs, attributes) {\n this.instruments.rscRenderDuration?.record(durationMs, attributes);\n }\n recordRSCStream(durationMs, attributes) {\n this.instruments.rscStreamDuration?.record(durationMs, attributes);\n }\n recordRSCRequest(type, attributes) {\n switch (type) {\n case "manifest":\n this.instruments.rscManifestCounter?.add(1, attributes);\n break;\n case "page":\n this.instruments.rscPageCounter?.add(1, attributes);\n break;\n case "stream":\n this.instruments.rscStreamCounter?.add(1, attributes);\n break;\n case "action":\n this.instruments.rscActionCounter?.add(1, attributes);\n break;\n }\n }\n recordRSCError(attributes) {\n this.instruments.rscErrorCounter?.add(1, attributes);\n }\n // Build Metrics\n recordBuild(durationMs, attributes) {\n this.instruments.buildDuration?.record(durationMs, attributes);\n }\n recordBundle(sizeKb, attributes) {\n this.instruments.bundleSizeHistogram?.record(sizeKb, attributes);\n this.instruments.bundleCounter?.add(1, attributes);\n }\n // Data Fetching Metrics\n recordDataFetch(durationMs, attributes) {\n this.instruments.dataFetchDuration?.record(durationMs, attributes);\n this.instruments.dataFetchCounter?.add(1, attributes);\n }\n recordDataFetchError(attributes) {\n this.instruments.dataFetchErrorCounter?.add(1, attributes);\n }\n // Security Metrics\n recordCorsRejection(attributes) {\n this.instruments.corsRejectionCounter?.add(1, attributes);\n }\n recordSecurityHeaders(attributes) {\n this.instruments.securityHeadersCounter?.add(1, attributes);\n }\n};\n\n// src/observability/metrics/manager.ts\nvar MetricsManager = class {\n constructor() {\n this.initialized = false;\n this.meter = null;\n this.api = null;\n this.recorder = null;\n this.instruments = this.createEmptyInstruments();\n this.runtimeState = {\n cacheSize: 0,\n activeRequests: 0\n };\n this.recorder = new MetricsRecorder(this.instruments, this.runtimeState);\n }\n createEmptyInstruments() {\n return {\n httpRequestCounter: null,\n httpRequestDuration: null,\n httpActiveRequests: null,\n cacheGetCounter: null,\n cacheHitCounter: null,\n cacheMissCounter: null,\n cacheSetCounter: null,\n cacheInvalidateCounter: null,\n cacheSizeGauge: null,\n renderDuration: null,\n renderCounter: null,\n renderErrorCounter: null,\n rscRenderDuration: null,\n rscStreamDuration: null,\n rscManifestCounter: null,\n rscPageCounter: null,\n rscStreamCounter: null,\n rscActionCounter: null,\n rscErrorCounter: null,\n buildDuration: null,\n bundleSizeHistogram: null,\n bundleCounter: null,\n dataFetchDuration: null,\n dataFetchCounter: null,\n dataFetchErrorCounter: null,\n corsRejectionCounter: null,\n securityHeadersCounter: null,\n memoryUsageGauge: null,\n heapUsageGauge: null\n };\n }\n async initialize(config = {}, adapter) {\n if (this.initialized) {\n serverLogger.debug("[metrics] Already initialized");\n return;\n }\n const finalConfig = loadConfig2(config, adapter);\n if (!finalConfig.enabled) {\n serverLogger.debug("[metrics] Metrics collection disabled");\n this.initialized = true;\n return;\n }\n try {\n this.api = await import("npm:@opentelemetry/api@1");\n this.meter = this.api.metrics.getMeter(finalConfig.prefix, "0.1.0");\n this.instruments = await initializeInstruments(\n this.meter,\n finalConfig,\n this.runtimeState\n );\n if (this.recorder) {\n this.recorder.instruments = this.instruments;\n }\n this.initialized = true;\n serverLogger.info("[metrics] OpenTelemetry metrics initialized", {\n exporter: finalConfig.exporter,\n endpoint: finalConfig.endpoint,\n prefix: finalConfig.prefix\n });\n } catch (error2) {\n serverLogger.warn("[metrics] Failed to initialize OpenTelemetry metrics", error2);\n this.initialized = true;\n }\n }\n isEnabled() {\n return this.initialized && this.meter !== null;\n }\n getRecorder() {\n return this.recorder;\n }\n getState() {\n return {\n initialized: this.initialized,\n cacheSize: this.runtimeState.cacheSize,\n activeRequests: this.runtimeState.activeRequests\n };\n }\n shutdown() {\n if (!this.initialized)\n return;\n try {\n serverLogger.info("[metrics] Metrics shutdown initiated");\n } catch (error2) {\n serverLogger.warn("[metrics] Error during metrics shutdown", error2);\n }\n }\n};\nvar metricsManager = new MetricsManager();\n\n// src/observability/metrics/index.ts\nvar getRecorder = () => metricsManager.getRecorder();\nfunction recordCorsRejection(attributes) {\n getRecorder()?.recordCorsRejection?.(attributes);\n}\nfunction recordSecurityHeaders(attributes) {\n getRecorder()?.recordSecurityHeaders?.(attributes);\n}\n\n// src/observability/auto-instrument/orchestrator.ts\ninit_utils();\n\n// src/observability/auto-instrument/http-instrumentation.ts\ninit_utils();\nimport {\n context as otContext,\n propagation,\n SpanKind,\n SpanStatusCode,\n trace\n} from "npm:@opentelemetry/api@1";\nvar tracer = trace.getTracer("veryfront-http");\n\n// src/security/http/cors/validators.ts\nasync function validateOrigin(requestOrigin, config) {\n if (!config) {\n return { allowedOrigin: null, allowCredentials: false };\n }\n if (config === true) {\n const origin = requestOrigin || "*";\n return { allowedOrigin: origin, allowCredentials: false };\n }\n const corsConfig = config;\n if (!corsConfig.origin) {\n return { allowedOrigin: null, allowCredentials: false };\n }\n if (!requestOrigin) {\n if (corsConfig.origin === "*") {\n return { allowedOrigin: "*", allowCredentials: false };\n }\n return { allowedOrigin: null, allowCredentials: false };\n }\n if (corsConfig.origin === "*") {\n if (corsConfig.credentials) {\n serverLogger.warn("[CORS] Cannot use credentials with wildcard origin - denying");\n return {\n allowedOrigin: null,\n allowCredentials: false,\n error: "Cannot use credentials with wildcard origin"\n };\n }\n return { allowedOrigin: "*", allowCredentials: false };\n }\n if (typeof corsConfig.origin === "function") {\n try {\n const result = await corsConfig.origin(requestOrigin);\n if (typeof result === "string") {\n return {\n allowedOrigin: result,\n allowCredentials: corsConfig.credentials ?? false\n };\n }\n const allowed = result === true;\n return {\n allowedOrigin: allowed ? requestOrigin : null,\n allowCredentials: allowed && (corsConfig.credentials ?? false),\n error: allowed ? void 0 : "Origin rejected by validation function"\n };\n } catch (error2) {\n serverLogger.error("[CORS] Origin validation function error", error2);\n return {\n allowedOrigin: null,\n allowCredentials: false,\n error: "Origin validation error"\n };\n }\n }\n if (Array.isArray(corsConfig.origin)) {\n const allowed = corsConfig.origin.includes(requestOrigin);\n if (!allowed) {\n recordCorsRejection();\n serverLogger.warn("[CORS] Origin not in allowlist", {\n requestOrigin,\n allowedOrigins: corsConfig.origin\n });\n }\n return {\n allowedOrigin: allowed ? requestOrigin : null,\n allowCredentials: allowed && (corsConfig.credentials ?? false),\n error: allowed ? void 0 : "Origin not in allowlist"\n };\n }\n if (typeof corsConfig.origin === "string") {\n const allowed = corsConfig.origin === requestOrigin;\n if (!allowed) {\n recordCorsRejection();\n serverLogger.warn("[CORS] Origin does not match", {\n requestOrigin,\n expectedOrigin: corsConfig.origin\n });\n }\n return {\n allowedOrigin: allowed ? requestOrigin : null,\n allowCredentials: allowed && (corsConfig.credentials ?? false),\n error: allowed ? void 0 : "Origin does not match"\n };\n }\n return {\n allowedOrigin: null,\n allowCredentials: false,\n error: "Invalid origin configuration"\n };\n}\nfunction validateOriginSync(requestOrigin, config) {\n if (!config) {\n return { allowedOrigin: null, allowCredentials: false };\n }\n if (config === true) {\n const origin = requestOrigin || "*";\n return { allowedOrigin: origin, allowCredentials: false };\n }\n const corsConfig = config;\n if (!corsConfig.origin) {\n return { allowedOrigin: null, allowCredentials: false };\n }\n if (!requestOrigin) {\n if (corsConfig.origin === "*") {\n return { allowedOrigin: "*", allowCredentials: false };\n }\n return { allowedOrigin: null, allowCredentials: false };\n }\n if (corsConfig.origin === "*") {\n if (corsConfig.credentials) {\n serverLogger.warn("[CORS] Cannot use credentials with wildcard origin - denying");\n return {\n allowedOrigin: null,\n allowCredentials: false,\n error: "Cannot use credentials with wildcard origin"\n };\n }\n return { allowedOrigin: "*", allowCredentials: false };\n }\n if (typeof corsConfig.origin === "function") {\n try {\n const result = corsConfig.origin(requestOrigin);\n if (result instanceof Promise) {\n serverLogger.warn(\n "[CORS] Async origin validators are not supported in synchronous contexts"\n );\n return {\n allowedOrigin: null,\n allowCredentials: false,\n error: "Async origin validators not supported"\n };\n }\n if (typeof result === "string") {\n return {\n allowedOrigin: result,\n allowCredentials: corsConfig.credentials ?? false\n };\n }\n const allowed = result === true;\n return {\n allowedOrigin: allowed ? requestOrigin : null,\n allowCredentials: allowed && (corsConfig.credentials ?? false),\n error: allowed ? void 0 : "Origin rejected by validation function"\n };\n } catch (error2) {\n serverLogger.error("[CORS] Origin validation function error", error2);\n return {\n allowedOrigin: null,\n allowCredentials: false,\n error: "Origin validation error"\n };\n }\n }\n if (Array.isArray(corsConfig.origin)) {\n const allowed = corsConfig.origin.includes(requestOrigin);\n if (!allowed) {\n recordCorsRejection();\n serverLogger.warn("[CORS] Origin not in allowlist (sync)", {\n requestOrigin,\n allowedOrigins: corsConfig.origin\n });\n }\n return {\n allowedOrigin: allowed ? requestOrigin : null,\n allowCredentials: allowed && (corsConfig.credentials ?? false),\n error: allowed ? void 0 : "Origin not in allowlist"\n };\n }\n if (typeof corsConfig.origin === "string") {\n const allowed = corsConfig.origin === requestOrigin;\n if (!allowed) {\n recordCorsRejection();\n serverLogger.warn("[CORS] Origin does not match (sync)", {\n requestOrigin,\n expectedOrigin: corsConfig.origin\n });\n }\n return {\n allowedOrigin: allowed ? requestOrigin : null,\n allowCredentials: allowed && (corsConfig.credentials ?? false),\n error: allowed ? void 0 : "Origin does not match"\n };\n }\n return {\n allowedOrigin: null,\n allowCredentials: false,\n error: "Invalid origin configuration"\n };\n}\n\n// src/security/http/cors/headers.ts\nasync function applyCORSHeaders(options) {\n const { request, response, headers: headersObj, config } = options;\n const validation = await validateOrigin(request.headers.get("origin"), config);\n if (!validation.allowedOrigin) {\n return response;\n }\n const headers = headersObj || (response ? new Headers(response.headers) : new Headers());\n headers.set("Access-Control-Allow-Origin", validation.allowedOrigin);\n if (validation.allowedOrigin !== "*") {\n const existingVary = headers.get("Vary");\n const varyValues = existingVary ? existingVary.split(",").map((v) => v.trim()) : [];\n if (!varyValues.includes("Origin")) {\n varyValues.push("Origin");\n headers.set("Vary", varyValues.join(", "));\n }\n }\n if (validation.allowCredentials && validation.allowedOrigin !== "*") {\n headers.set("Access-Control-Allow-Credentials", "true");\n }\n const corsConfig = typeof config === "object" ? config : null;\n if (corsConfig?.exposedHeaders && corsConfig.exposedHeaders.length > 0) {\n headers.set("Access-Control-Expose-Headers", corsConfig.exposedHeaders.join(", "));\n }\n if (response) {\n return new Response(response.body, {\n status: response.status,\n statusText: response.statusText,\n headers\n });\n }\n return;\n}\nfunction applyCORSHeadersSync(options) {\n const { request, response, headers: headersObj, config } = options;\n const validation = validateOriginSync(request.headers.get("origin"), config);\n if (!validation.allowedOrigin) {\n return response;\n }\n const headers = headersObj || (response ? new Headers(response.headers) : new Headers());\n headers.set("Access-Control-Allow-Origin", validation.allowedOrigin);\n if (validation.allowedOrigin !== "*") {\n const existingVary = headers.get("Vary");\n const varyValues = existingVary ? existingVary.split(",").map((v) => v.trim()) : [];\n if (!varyValues.includes("Origin")) {\n varyValues.push("Origin");\n headers.set("Vary", varyValues.join(", "));\n }\n }\n if (validation.allowCredentials && validation.allowedOrigin !== "*") {\n headers.set("Access-Control-Allow-Credentials", "true");\n }\n const corsConfig = typeof config === "object" ? config : null;\n if (corsConfig?.exposedHeaders && corsConfig.exposedHeaders.length > 0) {\n headers.set("Access-Control-Expose-Headers", corsConfig.exposedHeaders.join(", "));\n }\n if (response) {\n return new Response(response.body, {\n status: response.status,\n statusText: response.statusText,\n headers\n });\n }\n return;\n}\n\n// src/security/http/cors/constants.ts\ninit_config();\ninit_process();\n\n// src/security/http/cors/preflight.ts\ninit_logger();\n\n// src/security/http/cors/middleware.ts\ninit_veryfront_error();\n\n// src/security/http/response/security-handler.ts\nfunction generateNonce() {\n const array = new Uint8Array(16);\n crypto.getRandomValues(array);\n return btoa(String.fromCharCode(...array));\n}\nfunction buildCSP(isDev, nonce, cspUserHeader, config, adapter) {\n const envCsp = adapter?.env?.get?.("VERYFRONT_CSP");\n if (envCsp?.trim())\n return envCsp.replace(/{NONCE}/g, nonce);\n const defaultCsp = isDev ? [\n "default-src \'self\'",\n `style-src \'self\' \'unsafe-inline\' https://esm.sh https://cdnjs.cloudflare.com https://cdn.veryfront.com https://cdn.jsdelivr.net https://cdn.tailwindcss.com`,\n "img-src \'self\' data: https://cdn.veryfront.com https://cdnjs.cloudflare.com",\n `script-src \'self\' \'nonce-${nonce}\' \'unsafe-eval\' https://esm.sh https://cdn.tailwindcss.com`,\n "connect-src \'self\' https://esm.sh ws://localhost:* wss://localhost:*",\n "font-src \'self\' data: https://cdnjs.cloudflare.com"\n ].join("; ") : [\n "default-src \'self\'",\n `style-src \'self\' \'nonce-${nonce}\'`,\n "img-src \'self\' data:",\n `script-src \'self\' \'nonce-${nonce}\'`,\n "connect-src \'self\'"\n ].join("; ");\n if (cspUserHeader?.trim()) {\n return `${cspUserHeader.replace(/{NONCE}/g, nonce)}; ${defaultCsp}`;\n }\n const cfgCsp = config?.csp;\n if (cfgCsp && typeof cfgCsp === "object") {\n const pieces = [];\n for (const [k, v] of Object.entries(cfgCsp)) {\n if (v === void 0)\n continue;\n const key = String(k).replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`);\n const val = Array.isArray(v) ? v.join(" ") : String(v);\n pieces.push(`${key} ${val}`.replace(/{NONCE}/g, nonce));\n }\n if (pieces.length > 0) {\n return `${pieces.join("; ")}; ${defaultCsp}`;\n }\n }\n return defaultCsp;\n}\nfunction getSecurityHeader(headerName, defaultValue, config, adapter) {\n const configKey = headerName.toLowerCase();\n const configValue = config?.[configKey];\n const envValue = adapter?.env?.get?.(`VERYFRONT_${headerName}`);\n return (typeof configValue === "string" ? configValue : void 0) || envValue || defaultValue;\n}\nfunction applySecurityHeaders(headers, isDev, nonce, cspUserHeader, config, adapter) {\n const getHeaderOverride = (name) => {\n const overrides = config?.headers;\n if (!overrides)\n return void 0;\n const lower = name.toLowerCase();\n for (const [key, value] of Object.entries(overrides)) {\n if (key.toLowerCase() === lower) {\n return value;\n }\n }\n return void 0;\n };\n const contentTypeOptions = getHeaderOverride("x-content-type-options") ?? "nosniff";\n headers.set("X-Content-Type-Options", contentTypeOptions);\n const frameOptions = getHeaderOverride("x-frame-options") ?? "DENY";\n headers.set("X-Frame-Options", frameOptions);\n const xssProtection = getHeaderOverride("x-xss-protection") ?? "1; mode=block";\n headers.set("X-XSS-Protection", xssProtection);\n const csp = buildCSP(isDev, nonce, cspUserHeader, config, adapter);\n if (csp) {\n headers.set("Content-Security-Policy", csp);\n }\n if (!isDev) {\n const hstsMaxAge = config?.hsts?.maxAge ?? 31536e3;\n const hstsIncludeSubDomains = config?.hsts?.includeSubDomains ?? true;\n const hstsPreload = config?.hsts?.preload ?? false;\n let hstsValue = `max-age=${hstsMaxAge}`;\n if (hstsIncludeSubDomains) {\n hstsValue += "; includeSubDomains";\n }\n if (hstsPreload) {\n hstsValue += "; preload";\n }\n const hstsOverride = getHeaderOverride("strict-transport-security");\n headers.set("Strict-Transport-Security", hstsOverride ?? hstsValue);\n }\n const coop = getSecurityHeader("COOP", "same-origin", config, adapter);\n const corp = getSecurityHeader("CORP", "same-origin", config, adapter);\n const coep = getSecurityHeader("COEP", "", config, adapter);\n headers.set("Cross-Origin-Opener-Policy", coop);\n headers.set("Cross-Origin-Resource-Policy", corp);\n if (coep) {\n headers.set("Cross-Origin-Embedder-Policy", coep);\n }\n if (config?.headers) {\n for (const [key, value] of Object.entries(config.headers)) {\n if (value === void 0)\n continue;\n headers.set(key, value);\n }\n }\n recordSecurityHeaders();\n}\n\n// src/security/http/response/cache-handler.ts\nfunction buildCacheControl(strategy) {\n let cacheControl;\n if (typeof strategy === "string") {\n switch (strategy) {\n case "no-cache":\n cacheControl = "no-cache, no-store, must-revalidate";\n break;\n case "no-store":\n cacheControl = "no-store";\n break;\n case "short":\n cacheControl = `public, max-age=${CACHE_DURATIONS.SHORT}`;\n break;\n case "medium":\n cacheControl = `public, max-age=${CACHE_DURATIONS.MEDIUM}`;\n break;\n case "long":\n cacheControl = `public, max-age=${CACHE_DURATIONS.LONG}`;\n break;\n case "immutable":\n cacheControl = `public, max-age=${CACHE_DURATIONS.LONG}, immutable`;\n break;\n case "none":\n cacheControl = "no-cache, no-store, must-revalidate";\n break;\n default:\n cacheControl = "public, max-age=0";\n }\n } else {\n const parts = [];\n parts.push(strategy.public !== false ? "public" : "private");\n parts.push(`max-age=${strategy.maxAge}`);\n if (strategy.immutable)\n parts.push("immutable");\n if (strategy.mustRevalidate)\n parts.push("must-revalidate");\n cacheControl = parts.join(", ");\n }\n return cacheControl;\n}\n\n// src/security/http/response/fluent-methods.ts\nfunction withCORS(req, corsConfig) {\n const config = corsConfig ?? this.securityConfig?.cors;\n applyCORSHeadersSync({\n request: req,\n headers: this.headers,\n config\n });\n return this;\n}\nfunction withCORSAsync(req) {\n return applyCORSHeaders({\n request: req,\n headers: this.headers,\n config: this.securityConfig?.cors\n }).then(() => this);\n}\nfunction withSecurity(config) {\n const cfg = config ?? this.securityConfig;\n applySecurityHeaders(\n this.headers,\n this.isDev,\n this.nonce,\n this.cspUserHeader,\n cfg,\n this.adapter\n );\n return this;\n}\nfunction withCache(strategy) {\n const cacheControl = buildCacheControl(strategy);\n this.headers.set("cache-control", cacheControl);\n return this;\n}\nfunction withETag(etag) {\n this.headers.set("ETag", etag);\n return this;\n}\nfunction withHeaders(headers) {\n if (headers instanceof Headers) {\n headers.forEach((value, key) => {\n this.headers.set(key, value);\n });\n } else if (Array.isArray(headers)) {\n headers.forEach(([key, value]) => {\n this.headers.set(key, value);\n });\n } else {\n Object.entries(headers).forEach(([key, value]) => {\n this.headers.set(key, value);\n });\n }\n return this;\n}\nfunction withStatus(status) {\n this.status = status;\n return this;\n}\nfunction withAllow(methods) {\n const methodStr = Array.isArray(methods) ? methods.join(", ") : methods;\n this.headers.set("Allow", methodStr);\n this.headers.set("Access-Control-Allow-Methods", methodStr);\n return this;\n}\n\n// src/security/http/response/response-methods.ts\nfunction json(data, status) {\n this.headers.set("content-type", CONTENT_TYPES.JSON);\n return new Response(JSON.stringify(data), {\n status: status ?? this.status,\n headers: this.headers\n });\n}\nfunction text(body, status) {\n this.headers.set("content-type", CONTENT_TYPES.TEXT);\n return new Response(body, {\n status: status ?? this.status,\n headers: this.headers\n });\n}\nfunction html(body, status) {\n this.headers.set("content-type", CONTENT_TYPES.HTML);\n return new Response(body, {\n status: status ?? this.status,\n headers: this.headers\n });\n}\nfunction javascript(code, status) {\n this.headers.set("content-type", CONTENT_TYPES.JAVASCRIPT);\n return new Response(code, {\n status: status ?? this.status,\n headers: this.headers\n });\n}\nfunction withContentType(contentType, body, status) {\n this.headers.set("content-type", contentType);\n return new Response(body, {\n status: status ?? this.status,\n headers: this.headers\n });\n}\nfunction build(body = null, status) {\n return new Response(body, {\n status: status ?? this.status,\n headers: this.headers\n });\n}\nfunction notModified(etag) {\n if (etag) {\n this.headers.set("ETag", etag);\n }\n return new Response(null, {\n status: 304,\n headers: this.headers\n });\n}\n\n// src/security/http/response/static-helpers.ts\ninit_veryfront_error();\nvar ResponseBuilderClass = null;\nfunction setResponseBuilderClass(builderClass) {\n ResponseBuilderClass = builderClass;\n}\nfunction error(status, message, req, config) {\n if (!ResponseBuilderClass) {\n throw toError(createError({\n type: "config",\n message: "ResponseBuilder class not initialized"\n }));\n }\n const builder = new ResponseBuilderClass(config);\n builder.withCORS(req, config?.corsConfig);\n if (config?.securityConfig !== void 0) {\n builder.withSecurity(config.securityConfig ?? void 0);\n }\n const contentType = config?.contentType ?? CONTENT_TYPES.TEXT;\n if (contentType === CONTENT_TYPES.JSON) {\n return builder.json({ error: message }, status);\n } else if (contentType === CONTENT_TYPES.HTML) {\n return builder.html(message, status);\n }\n return builder.text(message, status);\n}\nfunction json2(data, req, config) {\n if (!ResponseBuilderClass) {\n throw toError(createError({\n type: "config",\n message: "ResponseBuilder class not initialized"\n }));\n }\n const builder = new ResponseBuilderClass(config);\n builder.withCORS(req, config?.corsConfig);\n if (config?.securityConfig !== void 0) {\n builder.withSecurity(config.securityConfig ?? void 0);\n }\n if (config?.cache) {\n builder.withCache(config.cache);\n }\n if (config?.etag) {\n builder.withETag(config.etag);\n }\n return builder.json(data, config?.status);\n}\nfunction html2(body, req, config) {\n if (!ResponseBuilderClass) {\n throw toError(createError({\n type: "config",\n message: "ResponseBuilder class not initialized"\n }));\n }\n const builder = new ResponseBuilderClass(config);\n builder.withCORS(req, config?.corsConfig);\n if (config?.securityConfig !== void 0) {\n builder.withSecurity(config.securityConfig ?? void 0);\n }\n if (config?.cache) {\n builder.withCache(config.cache);\n }\n if (config?.etag) {\n builder.withETag(config.etag);\n }\n return builder.html(body, config?.status);\n}\nfunction preflight(req, config) {\n if (!ResponseBuilderClass) {\n throw toError(createError({\n type: "config",\n message: "ResponseBuilder class not initialized"\n }));\n }\n const builder = new ResponseBuilderClass(config);\n builder.withCORS(req, config?.corsConfig);\n if (config?.securityConfig !== void 0) {\n builder.withSecurity(config.securityConfig ?? void 0);\n }\n const methods = config?.allowMethods ?? "GET,POST,PUT,PATCH,DELETE,OPTIONS";\n builder.withAllow(methods);\n const headers = config?.allowHeaders ?? req.headers.get("access-control-request-headers") ?? "Content-Type,Authorization";\n builder.headers.set(\n "Access-Control-Allow-Headers",\n Array.isArray(headers) ? headers.join(", ") : headers\n );\n return builder.build(null, 204);\n}\nfunction stream(streamData, req, config) {\n if (!ResponseBuilderClass) {\n throw toError(createError({\n type: "config",\n message: "ResponseBuilder class not initialized"\n }));\n }\n const builder = new ResponseBuilderClass(config);\n builder.withCORS(req, config?.corsConfig);\n if (config?.securityConfig !== void 0) {\n builder.withSecurity(config.securityConfig ?? void 0);\n }\n if (config?.cache) {\n builder.withCache(config.cache);\n }\n const contentType = config?.contentType ?? "application/octet-stream";\n return builder.withContentType(contentType, streamData);\n}\n\n// src/security/http/response/builder.ts\nvar ResponseBuilder = class {\n constructor(config) {\n this.withCORS = withCORS;\n this.withCORSAsync = withCORSAsync;\n this.withSecurity = withSecurity;\n this.withCache = withCache;\n this.withETag = withETag;\n this.withHeaders = withHeaders;\n this.withStatus = withStatus;\n this.withAllow = withAllow;\n this.json = json;\n this.text = text;\n this.html = html;\n this.javascript = javascript;\n this.withContentType = withContentType;\n this.build = build;\n this.notModified = notModified;\n this.headers = new Headers();\n this.status = 200;\n this.securityConfig = config?.securityConfig ?? null;\n this.isDev = config?.isDev ?? false;\n this.nonce = config?.nonce ?? generateNonce();\n this.cspUserHeader = config?.cspUserHeader ?? null;\n this.adapter = config?.adapter;\n }\n};\nResponseBuilder.error = error;\nResponseBuilder.json = json2;\nResponseBuilder.html = html2;\nResponseBuilder.preflight = preflight;\nResponseBuilder.stream = stream;\nsetResponseBuilderClass(\n ResponseBuilder\n);\n\n// src/security/http/base-handler.ts\ninit_utils();\n\n// src/core/constants/index.ts\ninit_constants();\n\n// src/core/constants/buffers.ts\nvar DEFAULT_MAX_BODY_SIZE_BYTES = 1024 * 1024;\nvar DEFAULT_MAX_FILE_SIZE_BYTES = 5 * 1024 * 1024;\nvar PREFETCH_QUEUE_MAX_SIZE_BYTES = 1024 * 1024;\nvar MAX_BUNDLE_CHUNK_SIZE_BYTES = 4096 * 1024;\n\n// src/core/constants/limits.ts\nvar MAX_URL_LENGTH_FOR_VALIDATION = 2048;\n\n// src/security/input-validation/parsers.ts\nimport { z as z2 } from "zod";\n\n// src/security/input-validation/schemas.ts\nimport { z as z3 } from "zod";\nvar CommonSchemas = {\n /**\n * Valid email address (RFC-compliant, max 255 chars)\n */\n email: z3.string().email().max(255),\n /**\n * Valid UUID v4 identifier\n */\n uuid: z3.string().uuid(),\n /**\n * URL-safe slug (lowercase alphanumeric with hyphens)\n */\n slug: z3.string().regex(/^[a-z0-9-]+$/).min(1).max(100),\n /**\n * Valid HTTP/HTTPS URL (max 2048 chars)\n */\n url: z3.string().url().max(MAX_URL_LENGTH_FOR_VALIDATION),\n /**\n * International phone number (E.164 format)\n */\n phoneNumber: z3.string().regex(/^\\+?[1-9]\\d{1,14}$/),\n /**\n * Pagination parameters with defaults\n */\n pagination: z3.object({\n page: z3.coerce.number().int().positive().default(1),\n limit: z3.coerce.number().int().positive().max(100).default(10),\n sort: z3.string().optional(),\n order: z3.enum(["asc", "desc"]).optional()\n }),\n /**\n * Date range with validation\n */\n dateRange: z3.object({\n from: z3.string().datetime(),\n to: z3.string().datetime()\n }).refine((data) => new Date(data.from) <= new Date(data.to), {\n message: "From date must be before or equal to To date"\n }),\n /**\n * Strong password requirements\n * - Minimum 8 characters\n * - At least one uppercase letter\n * - At least one lowercase letter\n * - At least one number\n * - At least one special character\n */\n strongPassword: z3.string().min(8, "Password must be at least 8 characters").regex(/[A-Z]/, "Password must contain at least one uppercase letter").regex(/[a-z]/, "Password must contain at least one lowercase letter").regex(/[0-9]/, "Password must contain at least one number").regex(/[^A-Za-z0-9]/, "Password must contain at least one special character")\n};\n\n// src/security/http/auth.ts\ninit_veryfront_error();\n\n// src/security/http/config.ts\ninit_config();\ninit_utils();\n\n// src/security/http/middleware/config-loader.ts\ninit_utils();\n\n// src/security/http/middleware/etag.ts\ninit_hash();\n\n// src/security/http/middleware/content-types.ts\ninit_http();\n\n// src/security/path-validation.ts\ninit_utils();\n\n// src/security/secure-fs.ts\ninit_utils();\n\n// src/routing/api/api-route-matcher.ts\ninit_process();\n\n// src/routing/api/module-loader/loader.ts\ninit_utils();\n\n// src/routing/api/module-loader/esbuild-plugin.ts\ninit_utils();\ninit_utils();\ninit_utils();\n\n// src/routing/api/module-loader/http-validator.ts\ninit_veryfront_error();\n\n// src/routing/api/module-loader/security-config.ts\ninit_utils();\ninit_utils();\n\n// src/routing/api/module-loader/loader.ts\ninit_veryfront_error();\n\n// src/platform/compat/fs.ts\ninit_veryfront_error();\ninit_runtime();\n\n// src/routing/api/module-loader/loader.ts\ninit_runtime();\n\n// src/routing/api/route-discovery.ts\ninit_std_path();\n\n// src/core/utils/file-discovery.ts\ninit_std_path();\ninit_deno3();\n\n// src/routing/api/route-executor.ts\ninit_veryfront_error();\n\n// src/routing/api/method-validator.ts\ninit_utils();\n\n// src/routing/api/error-handler.ts\ninit_utils();\ninit_utils();\ninit_utils();\n\n// src/rendering/client/router.ts\nvar VeryfrontRouter = class {\n constructor(options = {}) {\n this.root = null;\n const globalOptions = this.loadGlobalOptions();\n this.options = { ...globalOptions, ...options };\n this.baseUrl = options.baseUrl || globalThis.location.origin;\n this.currentPath = globalThis.location.pathname;\n this.pageLoader = new PageLoader();\n this.navigationHandlers = new NavigationHandlers(\n this.options.prefetchDelay,\n this.options.prefetch\n );\n this.pageTransition = new PageTransition((root) => this.viewportPrefetch.setup(root));\n this.viewportPrefetch = new ViewportPrefetch(\n (path) => this.prefetch(path),\n this.options.prefetch\n );\n this.handleClick = this.navigationHandlers.createClickHandler({\n onNavigate: (url) => this.navigate(url),\n onPrefetch: (url) => this.prefetch(url)\n });\n this.handlePopState = this.navigationHandlers.createPopStateHandler({\n onNavigate: (url) => this.navigate(url, false),\n onPrefetch: (url) => this.prefetch(url)\n });\n this.handleMouseOver = this.navigationHandlers.createMouseOverHandler({\n onNavigate: (url) => this.navigate(url),\n onPrefetch: (url) => this.prefetch(url)\n });\n }\n loadGlobalOptions() {\n try {\n const options = globalThis.__VERYFRONT_ROUTER_OPTS__;\n if (!options) {\n rendererLogger.debug("[router] No global options configured");\n return {};\n }\n return options;\n } catch (error2) {\n rendererLogger.error("[router] Failed to read global options:", error2);\n return {};\n }\n }\n init() {\n rendererLogger.info("Initializing client-side router");\n const rootElement = document.getElementById("root");\n if (!rootElement) {\n rendererLogger.error("Root element not found");\n return;\n }\n const ReactDOMToUse = globalThis.ReactDOM || ReactDOM;\n this.root = ReactDOMToUse.createRoot(rootElement);\n document.addEventListener("click", this.handleClick);\n globalThis.addEventListener("popstate", this.handlePopState);\n document.addEventListener("mouseover", this.handleMouseOver);\n this.viewportPrefetch.setup(document);\n this.cacheCurrentPage();\n }\n cacheCurrentPage() {\n const pageData = extractPageDataFromScript();\n if (pageData) {\n this.pageLoader.setCache(this.currentPath, pageData);\n }\n }\n async navigate(url, pushState = true) {\n rendererLogger.info(`Navigating to ${url}`);\n this.navigationHandlers.saveScrollPosition(this.currentPath);\n this.options.onStart?.(url);\n if (pushState) {\n globalThis.history.pushState({}, "", url);\n }\n await this.loadPage(url);\n this.options.onNavigate?.(url);\n }\n async loadPage(path, updateUI = true) {\n if (this.pageLoader.isCached(path)) {\n rendererLogger.debug(`Loading ${path} from cache`);\n const data = this.pageLoader.getCached(path);\n if (!data) {\n rendererLogger.warn(`[router] Cache entry for ${path} was unexpectedly null, fetching fresh data`);\n } else {\n if (updateUI) {\n this.updatePage(data);\n }\n return;\n }\n }\n this.pageTransition.setLoadingState(true);\n try {\n const data = await this.pageLoader.loadPage(path);\n if (updateUI) {\n this.updatePage(data);\n }\n this.currentPath = path;\n this.options.onComplete?.(path);\n } catch (error2) {\n rendererLogger.error(`Failed to load ${path}`, error2);\n this.options.onError?.(error2);\n this.pageTransition.showError(error2);\n } finally {\n this.pageTransition.setLoadingState(false);\n }\n }\n async prefetch(path) {\n await this.pageLoader.prefetch(path);\n }\n updatePage(data) {\n if (!this.root)\n return;\n const isPopState = this.navigationHandlers.isPopState();\n const scrollY = this.navigationHandlers.getScrollPosition(this.currentPath);\n this.pageTransition.updatePage(data, isPopState, scrollY);\n this.navigationHandlers.clearPopStateFlag();\n }\n destroy() {\n document.removeEventListener("click", this.handleClick);\n globalThis.removeEventListener("popstate", this.handlePopState);\n document.removeEventListener("mouseover", this.handleMouseOver);\n this.viewportPrefetch.disconnect();\n this.pageLoader.clearCache();\n this.navigationHandlers.clear();\n this.pageTransition.destroy();\n }\n};\nif (typeof window !== "undefined" && globalThis.document) {\n const router = new VeryfrontRouter();\n if (document.readyState === "loading") {\n document.addEventListener("DOMContentLoaded", () => router.init());\n } else {\n router.init();\n }\n globalThis.veryFrontRouter = router;\n}\nexport {\n VeryfrontRouter\n};\n';
|
|
13177
|
+
CLIENT_PREFETCH_BUNDLE = '// src/rendering/client/browser-logger.ts\nvar ConditionalBrowserLogger = class {\n constructor(prefix, level) {\n this.prefix = prefix;\n this.level = level;\n }\n debug(message, ...args) {\n if (this.level <= 0 /* DEBUG */) {\n console.debug?.(`[${this.prefix}] DEBUG: ${message}`, ...args);\n }\n }\n info(message, ...args) {\n if (this.level <= 1 /* INFO */) {\n console.log?.(`[${this.prefix}] ${message}`, ...args);\n }\n }\n warn(message, ...args) {\n if (this.level <= 2 /* WARN */) {\n console.warn?.(`[${this.prefix}] WARN: ${message}`, ...args);\n }\n }\n error(message, ...args) {\n if (this.level <= 3 /* ERROR */) {\n console.error?.(`[${this.prefix}] ERROR: ${message}`, ...args);\n }\n }\n};\nfunction getBrowserLogLevel() {\n if (typeof window === "undefined") {\n return 2 /* WARN */;\n }\n const windowObject = window;\n const isDevelopment = windowObject.__VERYFRONT_DEV__ || windowObject.__RSC_DEV__;\n if (!isDevelopment) {\n return 2 /* WARN */;\n }\n const isDebugEnabled = windowObject.__VERYFRONT_DEBUG__ || windowObject.__RSC_DEBUG__;\n return isDebugEnabled ? 0 /* DEBUG */ : 1 /* INFO */;\n}\nvar defaultLevel = getBrowserLogLevel();\nvar rscLogger = new ConditionalBrowserLogger("RSC", defaultLevel);\nvar prefetchLogger = new ConditionalBrowserLogger("PREFETCH", defaultLevel);\nvar hydrateLogger = new ConditionalBrowserLogger("HYDRATE", defaultLevel);\nvar browserLogger = new ConditionalBrowserLogger("VERYFRONT", defaultLevel);\n\n// src/rendering/client/prefetch/link-observer.ts\nvar LinkObserver = class {\n constructor(options, prefetchedUrls) {\n this.intersectionObserver = null;\n this.mutationObserver = null;\n this.pendingTimeouts = /* @__PURE__ */ new Map();\n this.elementTimeoutMap = /* @__PURE__ */ new WeakMap();\n this.timeoutCounter = 0;\n this.options = options;\n this.prefetchedUrls = prefetchedUrls;\n }\n init() {\n this.createIntersectionObserver();\n this.observeLinks();\n this.setupMutationObserver();\n }\n createIntersectionObserver() {\n this.intersectionObserver = new IntersectionObserver(\n (entries) => this.handleIntersection(entries),\n { rootMargin: this.options.rootMargin }\n );\n }\n handleIntersection(entries) {\n for (const entry of entries) {\n if (entry.isIntersecting) {\n const target = entry.target;\n let isAnchor = false;\n if (typeof HTMLAnchorElement !== "undefined") {\n isAnchor = target instanceof HTMLAnchorElement;\n } else {\n isAnchor = target.tagName === "A";\n }\n if (!isAnchor) {\n continue;\n }\n const link = target;\n const timeoutKey = this.timeoutCounter++;\n const timeoutId = setTimeout(() => {\n this.pendingTimeouts.delete(timeoutKey);\n this.elementTimeoutMap.delete(link);\n this.options.onLinkVisible(link);\n }, this.options.delay);\n this.pendingTimeouts.set(timeoutKey, timeoutId);\n this.elementTimeoutMap.set(link, timeoutKey);\n }\n }\n }\n observeLinks() {\n const links = document.querySelectorAll(\'a[href^="/"], a[href^="./"]\');\n links.forEach((link) => {\n if (this.isValidLink(link)) {\n this.intersectionObserver?.observe(link);\n }\n });\n }\n setupMutationObserver() {\n this.mutationObserver = new MutationObserver((mutations) => {\n for (const mutation of mutations) {\n if (mutation.type === "childList") {\n mutation.addedNodes.forEach((node) => {\n if (node.nodeType === Node.ELEMENT_NODE) {\n this.observeElement(node);\n }\n });\n mutation.removedNodes.forEach((node) => {\n if (node.nodeType === Node.ELEMENT_NODE) {\n this.clearElementTimeouts(node);\n }\n });\n }\n }\n });\n this.mutationObserver.observe(document.body, {\n childList: true,\n subtree: true\n });\n }\n clearElementTimeouts(element) {\n if (element.tagName === "A") {\n const timeoutKey = this.elementTimeoutMap.get(element);\n if (timeoutKey !== void 0) {\n const timeoutId = this.pendingTimeouts.get(timeoutKey);\n if (timeoutId) {\n clearTimeout(timeoutId);\n this.pendingTimeouts.delete(timeoutKey);\n }\n this.elementTimeoutMap.delete(element);\n }\n }\n const links = element.querySelectorAll("a");\n links.forEach((link) => {\n const timeoutKey = this.elementTimeoutMap.get(link);\n if (timeoutKey !== void 0) {\n const timeoutId = this.pendingTimeouts.get(timeoutKey);\n if (timeoutId) {\n clearTimeout(timeoutId);\n this.pendingTimeouts.delete(timeoutKey);\n }\n this.elementTimeoutMap.delete(link);\n }\n });\n }\n observeElement(element) {\n const isAnchor = typeof HTMLAnchorElement !== "undefined" ? element instanceof HTMLAnchorElement : element.tagName === "A";\n if (isAnchor && this.isValidLink(element)) {\n this.intersectionObserver?.observe(element);\n }\n const links = element.querySelectorAll(\'a[href^="/"], a[href^="./"]\');\n links.forEach((link) => {\n const isLinkAnchor = typeof HTMLAnchorElement !== "undefined" ? link instanceof HTMLAnchorElement : link.tagName === "A";\n if (isLinkAnchor && this.isValidLink(link)) {\n this.intersectionObserver?.observe(link);\n }\n });\n }\n isValidLink(link) {\n if (link.hostname !== globalThis.location.hostname)\n return false;\n if (link.hasAttribute("download"))\n return false;\n if (link.target === "_blank")\n return false;\n const url = link.href;\n if (this.prefetchedUrls.has(url))\n return false;\n if (url === globalThis.location.href)\n return false;\n if (link.hash && link.pathname === globalThis.location.pathname) {\n return false;\n }\n if (link.dataset.noPrefetch)\n return false;\n return true;\n }\n destroy() {\n for (const [_, timeoutId] of this.pendingTimeouts) {\n clearTimeout(timeoutId);\n }\n this.pendingTimeouts.clear();\n if (this.intersectionObserver) {\n this.intersectionObserver.disconnect();\n this.intersectionObserver = null;\n }\n if (this.mutationObserver) {\n this.mutationObserver.disconnect();\n this.mutationObserver = null;\n }\n }\n};\n\n// src/rendering/client/prefetch/network-utils.ts\nvar NetworkUtils = class {\n constructor(allowedNetworks = ["4g", "wifi", "ethernet"]) {\n this.allowedNetworks = allowedNetworks;\n this.networkInfo = this.getNetworkConnection();\n }\n getNavigatorWithConnection() {\n if (typeof globalThis.navigator === "undefined") {\n return null;\n }\n return globalThis.navigator;\n }\n getNetworkConnection() {\n const nav = this.getNavigatorWithConnection();\n return nav?.connection || nav?.mozConnection || nav?.webkitConnection || null;\n }\n shouldPrefetch() {\n const nav = this.getNavigatorWithConnection();\n if (nav?.connection?.saveData) {\n return false;\n }\n if (this.networkInfo) {\n const effectiveType = this.networkInfo.effectiveType;\n if (effectiveType !== void 0 && !this.allowedNetworks.includes(effectiveType)) {\n return false;\n }\n }\n return true;\n }\n onNetworkChange(callback) {\n if (this.networkInfo?.addEventListener) {\n this.networkInfo.addEventListener("change", callback);\n }\n }\n getNetworkInfo() {\n return this.networkInfo;\n }\n};\n\n// src/core/utils/constants/cache.ts\nvar SECONDS_PER_MINUTE = 60;\nvar MINUTES_PER_HOUR = 60;\nvar HOURS_PER_DAY = 24;\nvar MS_PER_SECOND = 1e3;\nvar COMPONENT_LOADER_TTL_MS = 10 * SECONDS_PER_MINUTE * MS_PER_SECOND;\nvar MDX_RENDERER_TTL_MS = 10 * SECONDS_PER_MINUTE * MS_PER_SECOND;\nvar RENDERER_CORE_TTL_MS = 5 * SECONDS_PER_MINUTE * MS_PER_SECOND;\nvar TSX_LAYOUT_TTL_MS = 10 * SECONDS_PER_MINUTE * MS_PER_SECOND;\nvar DATA_FETCHING_TTL_MS = 10 * SECONDS_PER_MINUTE * MS_PER_SECOND;\nvar MDX_CACHE_TTL_PRODUCTION_MS = HOURS_PER_DAY * MINUTES_PER_HOUR * SECONDS_PER_MINUTE * MS_PER_SECOND;\nvar MDX_CACHE_TTL_DEVELOPMENT_MS = 5 * SECONDS_PER_MINUTE * MS_PER_SECOND;\nvar BUNDLE_CACHE_TTL_PRODUCTION_MS = HOURS_PER_DAY * MINUTES_PER_HOUR * SECONDS_PER_MINUTE * MS_PER_SECOND;\nvar BUNDLE_CACHE_TTL_DEVELOPMENT_MS = 5 * SECONDS_PER_MINUTE * MS_PER_SECOND;\nvar BUNDLE_MANIFEST_PROD_TTL_MS = 7 * HOURS_PER_DAY * MINUTES_PER_HOUR * SECONDS_PER_MINUTE * MS_PER_SECOND;\nvar BUNDLE_MANIFEST_DEV_TTL_MS = MINUTES_PER_HOUR * SECONDS_PER_MINUTE * MS_PER_SECOND;\nvar SERVER_ACTION_DEFAULT_TTL_SEC = MINUTES_PER_HOUR * SECONDS_PER_MINUTE;\nvar ONE_DAY_MS = HOURS_PER_DAY * MINUTES_PER_HOUR * SECONDS_PER_MINUTE * MS_PER_SECOND;\nvar LRU_DEFAULT_MAX_SIZE_BYTES = 50 * 1024 * 1024;\n\n// deno.json\nvar deno_default = {\n name: "veryfront",\n version: "0.0.51",\n exclude: [\n "npm/",\n "dist/",\n "coverage/",\n "scripts/",\n "examples/",\n "tests/",\n "src/cli/templates/files/",\n "src/cli/templates/integrations/"\n ],\n exports: {\n ".": "./src/index.ts",\n "./cli": "./src/cli/main.ts",\n "./server": "./src/server/index.ts",\n "./middleware": "./src/middleware/index.ts",\n "./components": "./src/react/components/index.ts",\n "./data": "./src/data/index.ts",\n "./config": "./src/core/config/index.ts",\n "./platform": "./src/platform/index.ts",\n "./ai": "./src/ai/index.ts",\n "./ai/client": "./src/ai/client.ts",\n "./ai/react": "./src/ai/react/index.ts",\n "./ai/primitives": "./src/ai/react/primitives/index.ts",\n "./ai/components": "./src/ai/react/components/index.ts",\n "./ai/production": "./src/ai/production/index.ts",\n "./ai/dev": "./src/ai/dev/index.ts",\n "./ai/workflow": "./src/ai/workflow/index.ts",\n "./ai/workflow/react": "./src/ai/workflow/react/index.ts",\n "./oauth": "./src/core/oauth/index.ts",\n "./oauth/providers": "./src/core/oauth/providers/index.ts",\n "./oauth/handlers": "./src/core/oauth/handlers/index.ts",\n "./oauth/token-store": "./src/core/oauth/token-store/index.ts"\n },\n imports: {\n "@veryfront": "./src/index.ts",\n "@veryfront/": "./src/",\n "@veryfront/ai": "./src/ai/index.ts",\n "@veryfront/ai/": "./src/ai/",\n "@veryfront/platform": "./src/platform/index.ts",\n "@veryfront/platform/": "./src/platform/",\n "@veryfront/types": "./src/core/types/index.ts",\n "@veryfront/types/": "./src/core/types/",\n "@veryfront/utils": "./src/core/utils/index.ts",\n "@veryfront/utils/": "./src/core/utils/",\n "@veryfront/middleware": "./src/middleware/index.ts",\n "@veryfront/middleware/": "./src/middleware/",\n "@veryfront/errors": "./src/core/errors/index.ts",\n "@veryfront/errors/": "./src/core/errors/",\n "@veryfront/config": "./src/core/config/index.ts",\n "@veryfront/config/": "./src/core/config/",\n "@veryfront/observability": "./src/observability/index.ts",\n "@veryfront/observability/": "./src/observability/",\n "@veryfront/routing": "./src/routing/index.ts",\n "@veryfront/routing/": "./src/routing/",\n "@veryfront/transforms": "./src/build/transforms/index.ts",\n "@veryfront/transforms/": "./src/build/transforms/",\n "@veryfront/data": "./src/data/index.ts",\n "@veryfront/data/": "./src/data/",\n "@veryfront/security": "./src/security/index.ts",\n "@veryfront/security/": "./src/security/",\n "@veryfront/components": "./src/react/components/index.ts",\n "@veryfront/react": "./src/react/index.ts",\n "@veryfront/react/": "./src/react/",\n "@veryfront/html": "./src/html/index.ts",\n "@veryfront/html/": "./src/html/",\n "@veryfront/rendering": "./src/rendering/index.ts",\n "@veryfront/rendering/": "./src/rendering/",\n "@veryfront/build": "./src/build/index.ts",\n "@veryfront/build/": "./src/build/",\n "@veryfront/server": "./src/server/index.ts",\n "@veryfront/server/": "./src/server/",\n "@veryfront/modules": "./src/module-system/index.ts",\n "@veryfront/modules/": "./src/module-system/",\n "@veryfront/compat/console": "./src/platform/compat/console/index.ts",\n "@veryfront/compat/": "./src/platform/compat/",\n "@veryfront/oauth": "./src/core/oauth/index.ts",\n "@veryfront/oauth/": "./src/core/oauth/",\n "std/": "https://deno.land/std@0.220.0/",\n "@std/path": "https://deno.land/std@0.220.0/path/mod.ts",\n "@std/testing/bdd.ts": "https://deno.land/std@0.220.0/testing/bdd.ts",\n "@std/expect": "https://deno.land/std@0.220.0/expect/mod.ts",\n csstype: "https://esm.sh/csstype@3.2.3",\n "@types/react": "https://esm.sh/@types/react@18.3.27?deps=csstype@3.2.3",\n "@types/react-dom": "https://esm.sh/@types/react-dom@18.3.7?deps=csstype@3.2.3",\n react: "https://esm.sh/react@18.3.1",\n "react-dom": "https://esm.sh/react-dom@18.3.1",\n "react-dom/server": "https://esm.sh/react-dom@18.3.1/server",\n "react-dom/client": "https://esm.sh/react-dom@18.3.1/client",\n "react/jsx-runtime": "https://esm.sh/react@18.3.1/jsx-runtime",\n "react/jsx-dev-runtime": "https://esm.sh/react@18.3.1/jsx-dev-runtime",\n "@mdx-js/mdx": "https://esm.sh/@mdx-js/mdx@3.0.0?deps=react@18.3.1,react-dom@18.3.1",\n "@mdx-js/react": "https://esm.sh/@mdx-js/react@3.0.0?deps=react@18.3.1,react-dom@18.3.1",\n "unist-util-visit": "https://esm.sh/unist-util-visit@5.0.0",\n "mdast-util-to-string": "https://esm.sh/mdast-util-to-string@4.0.0",\n "github-slugger": "https://esm.sh/github-slugger@2.0.0",\n "remark-gfm": "https://esm.sh/remark-gfm@4.0.1",\n "remark-frontmatter": "https://esm.sh/remark-frontmatter@5.0.0",\n "rehype-highlight": "https://esm.sh/rehype-highlight@7.0.2",\n "rehype-slug": "https://esm.sh/rehype-slug@6.0.0",\n esbuild: "https://deno.land/x/esbuild@v0.20.1/wasm.js",\n "esbuild/mod.js": "https://deno.land/x/esbuild@v0.20.1/mod.js",\n "es-module-lexer": "https://esm.sh/es-module-lexer@1.5.0",\n zod: "https://esm.sh/zod@3.22.0",\n "mime-types": "https://esm.sh/mime-types@2.1.35",\n mdast: "https://esm.sh/@types/mdast@4.0.3",\n hast: "https://esm.sh/@types/hast@3.0.3",\n unist: "https://esm.sh/@types/unist@3.0.2",\n unified: "https://esm.sh/unified@11.0.5?dts",\n ai: "https://esm.sh/ai@5.0.76?deps=react@18.3.1,react-dom@18.3.1",\n "ai/react": "https://esm.sh/@ai-sdk/react@2.0.59?deps=react@18.3.1,react-dom@18.3.1",\n "@ai-sdk/react": "https://esm.sh/@ai-sdk/react@2.0.59?deps=react@18.3.1,react-dom@18.3.1",\n "@ai-sdk/openai": "https://esm.sh/@ai-sdk/openai@2.0.1",\n "@ai-sdk/anthropic": "https://esm.sh/@ai-sdk/anthropic@2.0.4",\n unocss: "https://esm.sh/unocss@0.59.0",\n "@unocss/core": "https://esm.sh/@unocss/core@0.59.0",\n "@unocss/preset-wind": "https://esm.sh/@unocss/preset-wind@0.59.0",\n redis: "npm:redis",\n pg: "npm:pg"\n },\n compilerOptions: {\n jsx: "react-jsx",\n jsxImportSource: "react",\n strict: true,\n noImplicitAny: true,\n noUncheckedIndexedAccess: true,\n types: [],\n lib: [\n "deno.window",\n "dom",\n "dom.iterable",\n "dom.asynciterable",\n "deno.ns"\n ]\n },\n tasks: {\n setup: "deno run --allow-all scripts/setup.ts",\n dev: "deno run --allow-all --no-lock --unstable-net --unstable-worker-options src/cli/main.ts dev",\n build: "deno compile --allow-all --output ../../bin/veryfront src/cli/main.ts",\n "build:npm": "deno run -A scripts/build-npm.ts",\n release: "deno run -A scripts/release.ts",\n test: "DENO_JOBS=1 deno test --parallel --fail-fast --allow-all --unstable-worker-options --unstable-net",\n "test:unit": "DENO_JOBS=1 deno test --parallel --allow-all --v8-flags=--max-old-space-size=8192 --ignore=tests --unstable-worker-options --unstable-net",\n "test:integration": "DENO_JOBS=1 deno test --parallel --fail-fast --allow-all tests --unstable-worker-options --unstable-net",\n "test:coverage": "rm -rf coverage && DENO_JOBS=1 deno test --parallel --fail-fast --allow-all --coverage=coverage --unstable-worker-options --unstable-net || exit 1",\n "test:coverage:unit": "rm -rf coverage && DENO_JOBS=1 deno test --parallel --fail-fast --allow-all --coverage=coverage --ignore=tests --unstable-worker-options --unstable-net || exit 1",\n "test:coverage:integration": "rm -rf coverage && DENO_JOBS=1 deno test --parallel --fail-fast --allow-all --coverage=coverage tests --unstable-worker-options --unstable-net || exit 1",\n "coverage:report": "deno coverage coverage --include=src/ --exclude=tests --exclude=src/**/*_test.ts --exclude=src/**/*_test.tsx --exclude=src/**/*.test.ts --exclude=src/**/*.test.tsx --lcov > coverage/lcov.info && deno run --allow-read scripts/check-coverage.ts 80",\n "coverage:html": "deno coverage coverage --include=src/ --exclude=tests --exclude=src/**/*_test.ts --exclude=src/**/*_test.tsx --exclude=src/**/*.test.ts --exclude=src/**/*.test.tsx --html",\n lint: "DENO_NO_PACKAGE_JSON=1 deno lint src/",\n fmt: "deno fmt src/",\n typecheck: "deno check src/index.ts src/cli/main.ts src/server/index.ts src/routing/api/index.ts src/rendering/index.ts src/platform/index.ts src/platform/adapters/index.ts src/build/index.ts src/build/production-build/index.ts src/build/transforms/index.ts src/core/config/index.ts src/core/utils/index.ts src/data/index.ts src/security/index.ts src/middleware/index.ts src/server/handlers/dev/index.ts src/server/handlers/request/api/index.ts src/rendering/cache/index.ts src/rendering/cache/stores/index.ts src/rendering/rsc/actions/index.ts src/html/index.ts src/module-system/index.ts",\n "docs:check-links": "deno run -A scripts/check-doc-links.ts",\n "lint:ban-console": "deno run --allow-read scripts/ban-console.ts",\n "lint:ban-deep-imports": "deno run --allow-read scripts/ban-deep-imports.ts",\n "lint:ban-internal-root-imports": "deno run --allow-read scripts/ban-internal-root-imports.ts",\n "lint:check-awaits": "deno run --allow-read scripts/check-unawaited-promises.ts",\n "lint:platform": "deno run --allow-read scripts/lint-platform-agnostic.ts",\n "check:circular": "deno run -A jsr:@cunarist/deno-circular-deps src/index.ts"\n },\n lint: {\n include: [\n "src/**/*.ts",\n "src/**/*.tsx"\n ],\n exclude: [\n "dist/",\n "coverage/"\n ],\n rules: {\n tags: [\n "recommended"\n ],\n include: [\n "ban-untagged-todo"\n ],\n exclude: [\n "no-explicit-any",\n "no-process-global",\n "no-console"\n ]\n }\n },\n fmt: {\n include: [\n "src/**/*.ts",\n "src/**/*.tsx"\n ],\n exclude: [\n "dist/",\n "coverage/"\n ],\n options: {\n useTabs: false,\n lineWidth: 100,\n indentWidth: 2,\n semiColons: true,\n singleQuote: false,\n proseWrap: "preserve"\n }\n }\n};\n\n// src/platform/compat/runtime.ts\nvar isDeno = typeof Deno !== "undefined";\nvar isNode = typeof globalThis.process !== "undefined" && globalThis.process?.versions?.node !== void 0;\nvar isBun = typeof globalThis.Bun !== "undefined";\nvar isCloudflare = typeof globalThis !== "undefined" && "caches" in globalThis && "WebSocketPair" in globalThis;\n\n// src/platform/compat/process.ts\nvar nodeProcess = globalThis.process;\nvar hasNodeProcess = !!nodeProcess?.versions?.node;\nfunction getEnv(key) {\n if (isDeno) {\n return Deno.env.get(key);\n }\n if (hasNodeProcess) {\n return nodeProcess.env[key];\n }\n return void 0;\n}\n\n// src/core/utils/version.ts\nvar VERSION = getEnv("VERYFRONT_VERSION") || (typeof deno_default.version === "string" ? deno_default.version : "0.0.0");\n\n// src/core/utils/constants/http.ts\nvar KB_IN_BYTES = 1024;\nvar PREFETCH_MAX_SIZE_BYTES = 200 * KB_IN_BYTES;\nvar PREFETCH_DEFAULT_TIMEOUT_MS = 1e4;\nvar PREFETCH_DEFAULT_DELAY_MS = 200;\n\n// src/core/utils/constants/hmr.ts\nvar HMR_MAX_MESSAGE_SIZE_BYTES = 1024 * KB_IN_BYTES;\n\n// src/core/utils/constants/network.ts\nvar BYTES_PER_MB = 1024 * 1024;\n\n// src/core/utils/constants/server.ts\nvar INTERNAL_PREFIX = "/_veryfront";\nvar INTERNAL_PATH_PREFIXES = {\n /** React Server Components endpoints */\n RSC: `${INTERNAL_PREFIX}/rsc/`,\n /** File system access endpoints (base64 encoded paths) */\n FS: `${INTERNAL_PREFIX}/fs/`,\n /** Virtual module system */\n MODULES: `${INTERNAL_PREFIX}/modules/`,\n /** Generated page modules */\n PAGES: `${INTERNAL_PREFIX}/pages/`,\n /** Data JSON endpoints */\n DATA: `${INTERNAL_PREFIX}/data/`,\n /** Library modules (AI SDK, etc.) */\n LIB: `${INTERNAL_PREFIX}/lib/`,\n /** Chunk assets */\n CHUNKS: `${INTERNAL_PREFIX}/chunks/`,\n /** Client component modules */\n CLIENT: `${INTERNAL_PREFIX}/client/`\n};\nvar INTERNAL_ENDPOINTS = {\n // Development endpoints\n HMR_RUNTIME: `${INTERNAL_PREFIX}/hmr-runtime.js`,\n HMR: `${INTERNAL_PREFIX}/hmr.js`,\n HYDRATE: `${INTERNAL_PREFIX}/hydrate.js`,\n ERROR_OVERLAY: `${INTERNAL_PREFIX}/error-overlay.js`,\n DEV_LOADER: `${INTERNAL_PREFIX}/dev-loader.js`,\n CLIENT_LOG: `${INTERNAL_PREFIX}/log`,\n // Production endpoints\n CLIENT_JS: `${INTERNAL_PREFIX}/client.js`,\n ROUTER_JS: `${INTERNAL_PREFIX}/router.js`,\n PREFETCH_JS: `${INTERNAL_PREFIX}/prefetch.js`,\n MANIFEST_JSON: `${INTERNAL_PREFIX}/manifest.json`,\n APP_JS: `${INTERNAL_PREFIX}/app.js`,\n // RSC endpoints\n RSC_CLIENT: `${INTERNAL_PREFIX}/rsc/client.js`,\n RSC_MANIFEST: `${INTERNAL_PREFIX}/rsc/manifest`,\n RSC_STREAM: `${INTERNAL_PREFIX}/rsc/stream`,\n RSC_PAYLOAD: `${INTERNAL_PREFIX}/rsc/payload`,\n RSC_RENDER: `${INTERNAL_PREFIX}/rsc/render`,\n RSC_PAGE: `${INTERNAL_PREFIX}/rsc/page`,\n RSC_MODULE: `${INTERNAL_PREFIX}/rsc/module`,\n RSC_DOM: `${INTERNAL_PREFIX}/rsc/dom.js`,\n RSC_HYDRATOR: `${INTERNAL_PREFIX}/rsc/hydrator.js`,\n RSC_HYDRATE_CLIENT: `${INTERNAL_PREFIX}/rsc/hydrate-client.js`,\n // Library module endpoints\n LIB_AI_REACT: `${INTERNAL_PREFIX}/lib/ai/react.js`,\n LIB_AI_COMPONENTS: `${INTERNAL_PREFIX}/lib/ai/components.js`,\n LIB_AI_PRIMITIVES: `${INTERNAL_PREFIX}/lib/ai/primitives.js`\n};\nvar BUILD_DIRS = {\n /** Main build output directory */\n ROOT: "_veryfront",\n /** Chunks directory */\n CHUNKS: "_veryfront/chunks",\n /** Data directory */\n DATA: "_veryfront/data",\n /** Assets directory */\n ASSETS: "_veryfront/assets"\n};\nvar PROJECT_DIRS = {\n /** Base veryfront internal directory */\n ROOT: ".veryfront",\n /** Cache directory for build artifacts, transforms, etc. */\n CACHE: ".veryfront/cache",\n /** KV store directory */\n KV: ".veryfront/kv",\n /** Log files directory */\n LOGS: ".veryfront/logs",\n /** Temporary files directory */\n TMP: ".veryfront/tmp"\n};\nvar DEFAULT_CACHE_DIR = PROJECT_DIRS.CACHE;\nvar DEV_SERVER_ENDPOINTS = {\n HMR_RUNTIME: INTERNAL_ENDPOINTS.HMR_RUNTIME,\n ERROR_OVERLAY: INTERNAL_ENDPOINTS.ERROR_OVERLAY\n};\n\n// src/core/constants/buffers.ts\nvar DEFAULT_MAX_BODY_SIZE_BYTES = 1024 * 1024;\nvar DEFAULT_MAX_FILE_SIZE_BYTES = 5 * 1024 * 1024;\nvar PREFETCH_QUEUE_MAX_SIZE_BYTES = 1024 * 1024;\nvar MAX_BUNDLE_CHUNK_SIZE_BYTES = 4096 * 1024;\n\n// src/rendering/client/prefetch/prefetch-queue.ts\nvar DEFAULT_OPTIONS = {\n maxConcurrent: 4,\n maxSize: PREFETCH_QUEUE_MAX_SIZE_BYTES,\n timeout: 5e3\n};\nfunction isAbortError(error) {\n return Boolean(\n error && typeof error === "object" && "name" in error && error.name === "AbortError"\n );\n}\nvar PrefetchQueue = class {\n constructor(options = {}, prefetchedUrls) {\n this.controllers = /* @__PURE__ */ new Map();\n this.concurrent = 0;\n this.stopped = false;\n this.options = { ...DEFAULT_OPTIONS, ...options };\n this.prefetchedUrls = prefetchedUrls ?? /* @__PURE__ */ new Set();\n }\n setResourceCallback(callback) {\n this.onResourcesFetched = callback;\n }\n enqueue(url) {\n void this.prefetch(url);\n }\n has(url) {\n return this.prefetchedUrls.has(url) || this.controllers.has(url);\n }\n get size() {\n return this.getQueueSize();\n }\n clear() {\n this.stopAll();\n this.prefetchedUrls.clear();\n }\n start() {\n this.stopped = false;\n }\n stop() {\n this.stopped = true;\n this.stopAll();\n }\n getQueueSize() {\n return this.controllers.size;\n }\n getConcurrentCount() {\n return this.concurrent;\n }\n async prefetchLink(link) {\n if (this.stopped) {\n return;\n }\n const url = link.href;\n if (!url || this.controllers.has(url) || this.prefetchedUrls.has(url)) {\n return;\n }\n if (this.concurrent >= this.options.maxConcurrent) {\n prefetchLogger.debug?.(`Prefetch queue full, skipping ${url}`);\n return;\n }\n let parsedUrl;\n try {\n parsedUrl = new URL(url);\n } catch (_error) {\n prefetchLogger.debug?.(`Invalid prefetch URL ${url}`);\n return;\n }\n const controller = new AbortController();\n this.controllers.set(url, controller);\n this.concurrent += 1;\n const timeoutId = this.options.timeout > 0 ? setTimeout(() => controller.abort(), this.options.timeout) : void 0;\n try {\n const response = await fetch(parsedUrl.toString(), {\n method: "GET",\n signal: controller.signal,\n headers: { "X-Veryfront-Prefetch": "1" }\n });\n if (!response.ok) {\n return;\n }\n if (this.isResponseTooLarge(response)) {\n prefetchLogger.debug?.(`Prefetch too large, skipping ${url}`);\n return;\n }\n this.prefetchedUrls.add(url);\n if (this.onResourcesFetched) {\n try {\n await this.onResourcesFetched(response, url);\n } catch (callbackError) {\n prefetchLogger.error?.(`Prefetch callback failed for ${url}`, callbackError);\n }\n }\n } catch (error) {\n if (!isAbortError(error)) {\n prefetchLogger.error?.(`Failed to prefetch ${url}`, error);\n }\n } finally {\n if (timeoutId !== void 0) {\n clearTimeout(timeoutId);\n }\n this.controllers.delete(url);\n this.concurrent = Math.max(0, this.concurrent - 1);\n }\n }\n async prefetch(url) {\n const link = typeof document !== "undefined" ? document.createElement("a") : { href: url };\n link.href = url;\n await this.prefetchLink(link);\n }\n stopAll() {\n for (const controller of this.controllers.values()) {\n controller.abort();\n }\n this.controllers.clear();\n this.concurrent = 0;\n }\n isResponseTooLarge(response) {\n const rawLength = response.headers.get("content-length");\n if (rawLength === null) {\n return false;\n }\n const size = Number.parseInt(rawLength, 10);\n if (!Number.isFinite(size)) {\n return false;\n }\n return size > this.options.maxSize;\n }\n};\nvar prefetchQueue = new PrefetchQueue();\n\n// src/rendering/client/prefetch/resource-hints.ts\nvar ResourceHintsManager = class {\n constructor() {\n this.appliedHints = /* @__PURE__ */ new Set();\n }\n applyResourceHints(hints) {\n for (const hint of hints) {\n const key = `${hint.type}:${hint.href}`;\n if (this.appliedHints.has(key))\n continue;\n const existing = document.querySelector(`link[rel="${hint.type}"][href="${hint.href}"]`);\n if (existing) {\n this.appliedHints.add(key);\n continue;\n }\n this.createAndAppendHint(hint);\n this.appliedHints.add(key);\n prefetchLogger.debug(`Added resource hint: ${hint.type} ${hint.href}`);\n }\n }\n createAndAppendHint(hint) {\n if (!document.head) {\n prefetchLogger.warn("document.head is not available, skipping resource hint");\n return;\n }\n const link = document.createElement("link");\n link.rel = hint.type;\n link.href = hint.href;\n if (hint.as)\n link.setAttribute("as", hint.as);\n if (hint.crossOrigin)\n link.setAttribute("crossorigin", hint.crossOrigin);\n if (hint.media)\n link.setAttribute("media", hint.media);\n document.head.appendChild(link);\n }\n extractResourceHints(html, prefetchedUrls) {\n try {\n const parser = new DOMParser();\n const doc = parser.parseFromString(html, "text/html");\n const hints = [];\n this.extractPreloadLinks(doc, prefetchedUrls, hints);\n this.extractScripts(doc, prefetchedUrls, hints);\n this.extractStylesheets(doc, prefetchedUrls, hints);\n return hints;\n } catch (error) {\n prefetchLogger.error("Failed to parse prefetched page", error);\n return [];\n }\n }\n isValidResourceHintType(rel) {\n return rel === "prefetch" || rel === "preload" || rel === "preconnect" || rel === "dns-prefetch";\n }\n extractPreloadLinks(doc, prefetchedUrls, hints) {\n doc.querySelectorAll(\'link[rel="preload"], link[rel="prefetch"]\').forEach((link) => {\n const htmlLink = link;\n const href = htmlLink.href;\n if (href && !prefetchedUrls.has(href) && this.isValidResourceHintType(htmlLink.rel)) {\n hints.push({\n type: htmlLink.rel,\n href,\n as: htmlLink.getAttribute("as") || void 0\n });\n }\n });\n }\n extractScripts(doc, prefetchedUrls, hints) {\n doc.querySelectorAll("script[src]").forEach((script) => {\n const src = script.src;\n if (src && !prefetchedUrls.has(src)) {\n hints.push({ type: "prefetch", href: src, as: "script" });\n }\n });\n }\n extractStylesheets(doc, prefetchedUrls, hints) {\n doc.querySelectorAll(\'link[rel="stylesheet"]\').forEach((link) => {\n const href = link.href;\n if (href && !prefetchedUrls.has(href)) {\n hints.push({ type: "prefetch", href, as: "style" });\n }\n });\n }\n static generateResourceHints(_route, assets) {\n const hints = [\n \'<link rel="dns-prefetch" href="https://cdn.jsdelivr.net">\',\n \'<link rel="dns-prefetch" href="https://esm.sh">\',\n \'<link rel="preconnect" href="https://cdn.jsdelivr.net" crossorigin>\'\n ];\n for (const asset of assets) {\n if (asset.endsWith(".js")) {\n hints.push(`<link rel="modulepreload" href="${asset}">`);\n } else if (asset.endsWith(".css")) {\n hints.push(`<link rel="preload" as="style" href="${asset}">`);\n } else if (asset.match(/\\.(woff2?|ttf|otf)$/)) {\n hints.push(`<link rel="preload" as="font" href="${asset}" crossorigin>`);\n }\n }\n return hints.join("\\n");\n }\n};\n\n// src/core/utils/runtime-guards.ts\nfunction hasDenoRuntime(global) {\n return typeof global === "object" && global !== null && "Deno" in global && typeof global.Deno?.env?.get === "function";\n}\nfunction hasNodeProcess2(global) {\n return typeof global === "object" && global !== null && "process" in global && typeof global.process?.env === "object";\n}\n\n// src/core/utils/logger/env.ts\nfunction getEnvironmentVariable(name) {\n try {\n if (typeof Deno !== "undefined" && hasDenoRuntime(globalThis)) {\n const value = globalThis.Deno?.env.get(name);\n return value === "" ? void 0 : value;\n }\n if (hasNodeProcess2(globalThis)) {\n const value = globalThis.process?.env[name];\n return value === "" ? void 0 : value;\n }\n } catch {\n return void 0;\n }\n return void 0;\n}\n\n// src/core/utils/logger/logger.ts\nvar cachedLogLevel;\nfunction resolveLogLevel(force = false) {\n if (force || cachedLogLevel === void 0) {\n cachedLogLevel = getDefaultLevel();\n }\n return cachedLogLevel;\n}\nvar ConsoleLogger = class {\n constructor(prefix, level = resolveLogLevel()) {\n this.prefix = prefix;\n this.level = level;\n }\n setLevel(level) {\n this.level = level;\n }\n getLevel() {\n return this.level;\n }\n debug(message, ...args) {\n if (this.level <= 0 /* DEBUG */) {\n console.debug(`[${this.prefix}] DEBUG: ${message}`, ...args);\n }\n }\n info(message, ...args) {\n if (this.level <= 1 /* INFO */) {\n console.log(`[${this.prefix}] ${message}`, ...args);\n }\n }\n warn(message, ...args) {\n if (this.level <= 2 /* WARN */) {\n console.warn(`[${this.prefix}] WARN: ${message}`, ...args);\n }\n }\n error(message, ...args) {\n if (this.level <= 3 /* ERROR */) {\n console.error(`[${this.prefix}] ERROR: ${message}`, ...args);\n }\n }\n async time(label, fn) {\n const start = performance.now();\n try {\n const result = await fn();\n const end = performance.now();\n this.debug(`${label} completed in ${(end - start).toFixed(2)}ms`);\n return result;\n } catch (error) {\n const end = performance.now();\n this.error(`${label} failed after ${(end - start).toFixed(2)}ms`, error);\n throw error;\n }\n }\n};\nfunction parseLogLevel(levelString) {\n if (!levelString)\n return void 0;\n const upper = levelString.toUpperCase();\n switch (upper) {\n case "DEBUG":\n return 0 /* DEBUG */;\n case "WARN":\n return 2 /* WARN */;\n case "ERROR":\n return 3 /* ERROR */;\n case "INFO":\n return 1 /* INFO */;\n default:\n return void 0;\n }\n}\nvar getDefaultLevel = () => {\n const envLevel = getEnvironmentVariable("LOG_LEVEL");\n const parsedLevel = parseLogLevel(envLevel);\n if (parsedLevel !== void 0)\n return parsedLevel;\n const debugFlag = getEnvironmentVariable("VERYFRONT_DEBUG");\n if (debugFlag === "1" || debugFlag === "true")\n return 0 /* DEBUG */;\n return 1 /* INFO */;\n};\nvar trackedLoggers = /* @__PURE__ */ new Set();\nfunction createLogger(prefix) {\n const logger2 = new ConsoleLogger(prefix);\n trackedLoggers.add(logger2);\n return logger2;\n}\nvar cliLogger = createLogger("CLI");\nvar serverLogger = createLogger("SERVER");\nvar rendererLogger = createLogger("RENDERER");\nvar bundlerLogger = createLogger("BUNDLER");\nvar agentLogger = createLogger("AGENT");\nvar logger = createLogger("VERYFRONT");\n\n// src/core/utils/paths.ts\nvar VERYFRONT_PATHS = {\n INTERNAL_PREFIX,\n BUILD_DIR: BUILD_DIRS.ROOT,\n CHUNKS_DIR: BUILD_DIRS.CHUNKS,\n DATA_DIR: BUILD_DIRS.DATA,\n ASSETS_DIR: BUILD_DIRS.ASSETS,\n HMR_RUNTIME: INTERNAL_ENDPOINTS.HMR_RUNTIME,\n CLIENT_JS: INTERNAL_ENDPOINTS.CLIENT_JS,\n ROUTER_JS: INTERNAL_ENDPOINTS.ROUTER_JS,\n ERROR_OVERLAY: INTERNAL_ENDPOINTS.ERROR_OVERLAY\n};\n\n// src/core/utils/bundle-manifest.ts\nvar InMemoryBundleManifestStore = class {\n constructor() {\n this.metadata = /* @__PURE__ */ new Map();\n this.code = /* @__PURE__ */ new Map();\n this.sourceIndex = /* @__PURE__ */ new Map();\n }\n getBundleMetadata(key) {\n const entry = this.metadata.get(key);\n if (!entry)\n return Promise.resolve(void 0);\n if (entry.expiry && Date.now() > entry.expiry) {\n this.metadata.delete(key);\n return Promise.resolve(void 0);\n }\n return Promise.resolve(entry.value);\n }\n setBundleMetadata(key, metadata, ttlMs) {\n const expiry = ttlMs ? Date.now() + ttlMs : void 0;\n this.metadata.set(key, { value: metadata, expiry });\n if (!this.sourceIndex.has(metadata.source)) {\n this.sourceIndex.set(metadata.source, /* @__PURE__ */ new Set());\n }\n this.sourceIndex.get(metadata.source).add(key);\n return Promise.resolve();\n }\n getBundleCode(hash) {\n const entry = this.code.get(hash);\n if (!entry)\n return Promise.resolve(void 0);\n if (entry.expiry && Date.now() > entry.expiry) {\n this.code.delete(hash);\n return Promise.resolve(void 0);\n }\n return Promise.resolve(entry.value);\n }\n setBundleCode(hash, code, ttlMs) {\n const expiry = ttlMs ? Date.now() + ttlMs : void 0;\n this.code.set(hash, { value: code, expiry });\n return Promise.resolve();\n }\n async deleteBundle(key) {\n const metadata = await this.getBundleMetadata(key);\n this.metadata.delete(key);\n if (metadata) {\n this.code.delete(metadata.codeHash);\n const sourceKeys = this.sourceIndex.get(metadata.source);\n if (sourceKeys) {\n sourceKeys.delete(key);\n if (sourceKeys.size === 0) {\n this.sourceIndex.delete(metadata.source);\n }\n }\n }\n }\n async invalidateSource(source) {\n const keys = this.sourceIndex.get(source);\n if (!keys)\n return 0;\n let count = 0;\n for (const key of Array.from(keys)) {\n await this.deleteBundle(key);\n count++;\n }\n this.sourceIndex.delete(source);\n return count;\n }\n clear() {\n this.metadata.clear();\n this.code.clear();\n this.sourceIndex.clear();\n return Promise.resolve();\n }\n isAvailable() {\n return Promise.resolve(true);\n }\n getStats() {\n let totalSize = 0;\n let oldest;\n let newest;\n for (const { value } of this.metadata.values()) {\n totalSize += value.size;\n if (!oldest || value.compiledAt < oldest)\n oldest = value.compiledAt;\n if (!newest || value.compiledAt > newest)\n newest = value.compiledAt;\n }\n return Promise.resolve({\n totalBundles: this.metadata.size,\n totalSize,\n oldestBundle: oldest,\n newestBundle: newest\n });\n }\n};\nvar manifestStore = new InMemoryBundleManifestStore();\n\n// src/rendering/client/prefetch.ts\nvar PrefetchManager = class {\n constructor(options = {}) {\n this.prefetchedUrls = /* @__PURE__ */ new Set();\n this.linkObserver = null;\n this.options = {\n rootMargin: options.rootMargin || "50px",\n delay: options.delay || PREFETCH_DEFAULT_DELAY_MS,\n maxConcurrent: options.maxConcurrent || 2,\n allowedNetworks: options.allowedNetworks || ["4g", "wifi", "ethernet"],\n maxSize: options.maxSize || PREFETCH_MAX_SIZE_BYTES,\n timeout: options.timeout || PREFETCH_DEFAULT_TIMEOUT_MS\n };\n this.networkUtils = new NetworkUtils(this.options.allowedNetworks);\n this.resourceHintsManager = new ResourceHintsManager();\n this.prefetchQueue = new PrefetchQueue(\n {\n maxConcurrent: this.options.maxConcurrent,\n maxSize: this.options.maxSize,\n timeout: this.options.timeout\n },\n this.prefetchedUrls\n );\n this.prefetchQueue.setResourceCallback(\n (response, url) => this.prefetchPageResources(response, url)\n );\n }\n init() {\n prefetchLogger.info("Initializing prefetch manager");\n if (!this.networkUtils.shouldPrefetch()) {\n prefetchLogger.info("Prefetching disabled due to network conditions");\n return;\n }\n this.linkObserver = new LinkObserver(\n {\n rootMargin: this.options.rootMargin,\n delay: this.options.delay,\n onLinkVisible: (link) => this.prefetchQueue.prefetchLink(link)\n },\n this.prefetchedUrls\n );\n this.linkObserver.init();\n this.networkUtils.onNetworkChange(() => {\n if (!this.networkUtils.shouldPrefetch()) {\n this.prefetchQueue.stopAll();\n }\n });\n }\n async prefetchPageResources(response, _pageUrl) {\n const html = await response.text();\n const hints = this.resourceHintsManager.extractResourceHints(html, this.prefetchedUrls);\n this.resourceHintsManager.applyResourceHints(hints);\n }\n applyResourceHints(hints) {\n this.resourceHintsManager.applyResourceHints(hints);\n }\n async prefetch(url) {\n await this.prefetchQueue.prefetch(url);\n }\n static generateResourceHints(route, assets) {\n return ResourceHintsManager.generateResourceHints(route, assets);\n }\n destroy() {\n this.linkObserver?.destroy();\n this.prefetchQueue.stopAll();\n this.prefetchedUrls.clear();\n }\n};\nif (typeof window !== "undefined") {\n const prefetchManager = new PrefetchManager();\n if (document.readyState === "loading") {\n document.addEventListener("DOMContentLoaded", () => prefetchManager.init());\n } else {\n prefetchManager.init();\n }\n globalThis.veryFrontPrefetch = prefetchManager;\n}\nexport {\n PrefetchManager\n};\n';
|
|
13171
13178
|
}
|
|
13172
13179
|
});
|
|
13173
13180
|
|
|
@@ -13658,7 +13665,6 @@ __export(ssr_adapter_exports, {
|
|
|
13658
13665
|
});
|
|
13659
13666
|
var init_ssr_adapter = __esm({
|
|
13660
13667
|
"src/react/compat/ssr-adapter/index.ts"() {
|
|
13661
|
-
"use strict";
|
|
13662
13668
|
init_server_loader();
|
|
13663
13669
|
init_string_renderer();
|
|
13664
13670
|
init_stream_renderer();
|
|
@@ -33652,11 +33658,11 @@ var init_transform_core = __esm({
|
|
|
33652
33658
|
async function getGlobalTmpDir() {
|
|
33653
33659
|
if (!globalTmpDir) {
|
|
33654
33660
|
const os = await import("node:os");
|
|
33655
|
-
const
|
|
33661
|
+
const fs15 = await import("node:fs/promises");
|
|
33656
33662
|
const tmpBase = os.tmpdir();
|
|
33657
33663
|
const tmpName = `vf-modules-${Date.now()}-${Math.random().toString(36).substring(2, 8)}`;
|
|
33658
33664
|
globalTmpDir = join2(tmpBase, tmpName);
|
|
33659
|
-
await
|
|
33665
|
+
await fs15.mkdir(globalTmpDir, { recursive: true });
|
|
33660
33666
|
}
|
|
33661
33667
|
return globalTmpDir;
|
|
33662
33668
|
}
|
|
@@ -33730,12 +33736,12 @@ async function parseLocalImports(code, filePath, _projectDir) {
|
|
|
33730
33736
|
return localImports;
|
|
33731
33737
|
}
|
|
33732
33738
|
async function resolveLocalImportPath(fromFile, importSpecifier) {
|
|
33733
|
-
const
|
|
33739
|
+
const fs15 = createFileSystem();
|
|
33734
33740
|
const fromDir = fromFile.substring(0, fromFile.lastIndexOf("/"));
|
|
33735
33741
|
const basePath = resolveRelative(fromDir, importSpecifier);
|
|
33736
33742
|
if (/\.(tsx?|jsx?|mjs|cjs|mdx)$/.test(importSpecifier)) {
|
|
33737
33743
|
try {
|
|
33738
|
-
const stat2 = await
|
|
33744
|
+
const stat2 = await fs15.stat(basePath);
|
|
33739
33745
|
if (stat2.isFile) {
|
|
33740
33746
|
return basePath;
|
|
33741
33747
|
}
|
|
@@ -33746,7 +33752,7 @@ async function resolveLocalImportPath(fromFile, importSpecifier) {
|
|
|
33746
33752
|
for (const ext of EXTENSIONS) {
|
|
33747
33753
|
const fullPath = basePath + ext;
|
|
33748
33754
|
try {
|
|
33749
|
-
const stat2 = await
|
|
33755
|
+
const stat2 = await fs15.stat(fullPath);
|
|
33750
33756
|
if (stat2.isFile) {
|
|
33751
33757
|
return fullPath;
|
|
33752
33758
|
}
|
|
@@ -33756,7 +33762,7 @@ async function resolveLocalImportPath(fromFile, importSpecifier) {
|
|
|
33756
33762
|
for (const ext of EXTENSIONS) {
|
|
33757
33763
|
const indexPath = basePath + "/index" + ext;
|
|
33758
33764
|
try {
|
|
33759
|
-
const stat2 = await
|
|
33765
|
+
const stat2 = await fs15.stat(indexPath);
|
|
33760
33766
|
if (stat2.isFile) {
|
|
33761
33767
|
return indexPath;
|
|
33762
33768
|
}
|
|
@@ -33941,9 +33947,9 @@ async function loadComponentFromSource(source, filePath, projectDir, adapter, op
|
|
|
33941
33947
|
const relativeFilePath = resolveRelativePath2(filePath, projectDir);
|
|
33942
33948
|
const componentFile = join2(tmpDir, normalizeModulePath(relativeFilePath));
|
|
33943
33949
|
const componentDir = componentFile.substring(0, componentFile.lastIndexOf("/"));
|
|
33944
|
-
const
|
|
33945
|
-
await
|
|
33946
|
-
await
|
|
33950
|
+
const fs15 = createFileSystem();
|
|
33951
|
+
await fs15.mkdir(componentDir, { recursive: true });
|
|
33952
|
+
await fs15.writeTextFile(componentFile, transformedCode);
|
|
33947
33953
|
const cacheBuster = Date.now();
|
|
33948
33954
|
const mod = await import(`file://${componentFile}?t=${cacheBuster}`);
|
|
33949
33955
|
const component = extractComponent(mod, filePath);
|
|
@@ -34176,8 +34182,8 @@ if (typeof window !== 'undefined' && !window.__veryfront_react_imports) {
|
|
|
34176
34182
|
window.__veryfront_react_imports = ${reactImports};
|
|
34177
34183
|
}
|
|
34178
34184
|
`;
|
|
34179
|
-
const
|
|
34180
|
-
await
|
|
34185
|
+
const fs15 = createFileSystem();
|
|
34186
|
+
await fs15.writeTextFile(shimPath, shimContent);
|
|
34181
34187
|
return shimPath;
|
|
34182
34188
|
}
|
|
34183
34189
|
async function createBuildContext(options, entryPoints) {
|
|
@@ -34432,8 +34438,8 @@ function createCodeSplitter(options) {
|
|
|
34432
34438
|
return new CodeSplitter(options);
|
|
34433
34439
|
}
|
|
34434
34440
|
async function loadChunkManifest(manifestPath) {
|
|
34435
|
-
const
|
|
34436
|
-
const content = await
|
|
34441
|
+
const fs15 = createFileSystem();
|
|
34442
|
+
const content = await fs15.readTextFile(manifestPath);
|
|
34437
34443
|
return JSON.parse(content);
|
|
34438
34444
|
}
|
|
34439
34445
|
function getChunksForRoute(manifest, routePath) {
|
|
@@ -38564,7 +38570,6 @@ function extractParams(pattern, slug) {
|
|
|
38564
38570
|
}
|
|
38565
38571
|
var init_dynamic_route_matcher = __esm({
|
|
38566
38572
|
"src/routing/slug-mapper/dynamic-route-matcher.ts"() {
|
|
38567
|
-
"use strict";
|
|
38568
38573
|
}
|
|
38569
38574
|
});
|
|
38570
38575
|
|
|
@@ -38744,9 +38749,9 @@ async function statWithFallback(path, adapter) {
|
|
|
38744
38749
|
try {
|
|
38745
38750
|
return await adapter.fs.stat(path);
|
|
38746
38751
|
} catch {
|
|
38747
|
-
const
|
|
38752
|
+
const fs15 = createFileSystem();
|
|
38748
38753
|
try {
|
|
38749
|
-
const stat2 = await
|
|
38754
|
+
const stat2 = await fs15.stat(path);
|
|
38750
38755
|
return {
|
|
38751
38756
|
size: stat2.size,
|
|
38752
38757
|
isFile: stat2.isFile,
|
|
@@ -38767,10 +38772,10 @@ async function readDirWithFallback(dir, adapter) {
|
|
|
38767
38772
|
}
|
|
38768
38773
|
return entries;
|
|
38769
38774
|
} catch {
|
|
38770
|
-
const
|
|
38775
|
+
const fs15 = createFileSystem();
|
|
38771
38776
|
try {
|
|
38772
38777
|
const entries = [];
|
|
38773
|
-
for await (const entry of
|
|
38778
|
+
for await (const entry of fs15.readDir(dir)) {
|
|
38774
38779
|
entries.push({
|
|
38775
38780
|
name: entry.name,
|
|
38776
38781
|
isFile: entry.isFile,
|
|
@@ -44248,9 +44253,9 @@ function buildContentAttributes(slug, noLayout, ssrHash) {
|
|
|
44248
44253
|
async function detectVersions(projectDir) {
|
|
44249
44254
|
try {
|
|
44250
44255
|
const { createFileSystem: createFileSystem2 } = await Promise.resolve().then(() => (init_fs(), fs_exports));
|
|
44251
|
-
const
|
|
44256
|
+
const fs15 = createFileSystem2();
|
|
44252
44257
|
const packageJsonPath = `${projectDir}/package.json`;
|
|
44253
|
-
const content = await
|
|
44258
|
+
const content = await fs15.readTextFile(packageJsonPath);
|
|
44254
44259
|
const pkg = JSON.parse(content);
|
|
44255
44260
|
const deps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
44256
44261
|
return {
|
|
@@ -48656,13 +48661,13 @@ function createResolvePlugin(fileCache, projectDir) {
|
|
|
48656
48661
|
};
|
|
48657
48662
|
}
|
|
48658
48663
|
function createCSSPlugin(result) {
|
|
48659
|
-
const
|
|
48664
|
+
const fs15 = createFileSystem();
|
|
48660
48665
|
return {
|
|
48661
48666
|
name: "veryfront-css",
|
|
48662
48667
|
setup(build3) {
|
|
48663
48668
|
build3.onLoad({ filter: /\.css$/ }, async (args) => {
|
|
48664
48669
|
try {
|
|
48665
|
-
const content = await
|
|
48670
|
+
const content = await fs15.readTextFile(args.path);
|
|
48666
48671
|
result.outputs.set(args.path, {
|
|
48667
48672
|
path: args.path,
|
|
48668
48673
|
content,
|
|
@@ -49157,14 +49162,14 @@ import * as esbuild6 from "esbuild";
|
|
|
49157
49162
|
async function buildEmbeddedPreset(options) {
|
|
49158
49163
|
const { projectDir, outDir } = options;
|
|
49159
49164
|
const embeddedDir = join2(outDir, "embedded");
|
|
49160
|
-
const
|
|
49161
|
-
await
|
|
49162
|
-
await
|
|
49165
|
+
const fs15 = createFileSystem();
|
|
49166
|
+
await fs15.mkdir(embeddedDir, { recursive: true });
|
|
49167
|
+
await fs15.mkdir(join2(embeddedDir, "rsc"), { recursive: true });
|
|
49163
49168
|
const candidates = [join2(projectDir, "app", "page.mdx"), join2(projectDir, "pages", "index.mdx")];
|
|
49164
49169
|
let entryPath = "";
|
|
49165
49170
|
for (const c70 of candidates) {
|
|
49166
49171
|
try {
|
|
49167
|
-
const st9 = await
|
|
49172
|
+
const st9 = await fs15.stat(c70);
|
|
49168
49173
|
if (st9.isFile) {
|
|
49169
49174
|
entryPath = c70;
|
|
49170
49175
|
break;
|
|
@@ -49175,8 +49180,8 @@ async function buildEmbeddedPreset(options) {
|
|
|
49175
49180
|
}
|
|
49176
49181
|
if (!entryPath) {
|
|
49177
49182
|
entryPath = join2(projectDir, ".veryfront", "__embedded_fallback__.tsx");
|
|
49178
|
-
await
|
|
49179
|
-
await
|
|
49183
|
+
await fs15.mkdir(join2(projectDir, ".veryfront"), { recursive: true });
|
|
49184
|
+
await fs15.writeTextFile(
|
|
49180
49185
|
entryPath,
|
|
49181
49186
|
`export default function Page(){ return '<div>Veryfront</div>'; }`
|
|
49182
49187
|
);
|
|
@@ -49186,7 +49191,7 @@ async function buildEmbeddedPreset(options) {
|
|
|
49186
49191
|
try {
|
|
49187
49192
|
const appBuild = await esbuild6.build({
|
|
49188
49193
|
stdin: {
|
|
49189
|
-
contents: await
|
|
49194
|
+
contents: await fs15.readTextFile(entryPath),
|
|
49190
49195
|
sourcefile: entryPath,
|
|
49191
49196
|
resolveDir: projectDir,
|
|
49192
49197
|
loader: "tsx"
|
|
@@ -49215,13 +49220,13 @@ async function buildEmbeddedPreset(options) {
|
|
|
49215
49220
|
message: "Failed to generate embedded app bundle"
|
|
49216
49221
|
}));
|
|
49217
49222
|
}
|
|
49218
|
-
await
|
|
49223
|
+
await fs15.writeTextFile(appOut, bundledAppCode);
|
|
49219
49224
|
const routes = [];
|
|
49220
49225
|
async function discoverAppRoutes2() {
|
|
49221
49226
|
const results = [];
|
|
49222
49227
|
const base = join2(projectDir, "app");
|
|
49223
49228
|
async function walk2(dir, rel = "") {
|
|
49224
|
-
for await (const ent of
|
|
49229
|
+
for await (const ent of fs15.readDir(dir)) {
|
|
49225
49230
|
const abs = join2(dir, ent.name);
|
|
49226
49231
|
const relNext = rel ? `${rel}/${ent.name}` : ent.name;
|
|
49227
49232
|
if (ent.isDirectory) {
|
|
@@ -49244,7 +49249,7 @@ async function buildEmbeddedPreset(options) {
|
|
|
49244
49249
|
const results = [];
|
|
49245
49250
|
const base = join2(projectDir, "pages");
|
|
49246
49251
|
async function walk2(dir, rel = "") {
|
|
49247
|
-
for await (const ent of
|
|
49252
|
+
for await (const ent of fs15.readDir(dir)) {
|
|
49248
49253
|
const abs = join2(dir, ent.name);
|
|
49249
49254
|
const relNext = rel ? `${rel}/${ent.name}` : ent.name;
|
|
49250
49255
|
if (ent.isDirectory) {
|
|
@@ -49267,14 +49272,14 @@ async function buildEmbeddedPreset(options) {
|
|
|
49267
49272
|
const discovered = [...await discoverAppRoutes2(), ...await discoverPagesRoutes2()];
|
|
49268
49273
|
for (const r41 of discovered) {
|
|
49269
49274
|
try {
|
|
49270
|
-
const mdxContent = await
|
|
49275
|
+
const mdxContent = await fs15.readTextFile(r41.sourcePath);
|
|
49271
49276
|
const compiled = await compileMDXToJS(r41.sourcePath, mdxContent, {
|
|
49272
49277
|
projectDir,
|
|
49273
49278
|
mode: "production",
|
|
49274
49279
|
adapter: denoAdapter
|
|
49275
49280
|
});
|
|
49276
|
-
await
|
|
49277
|
-
await
|
|
49281
|
+
await fs15.mkdir(r41.filePath.slice(0, r41.filePath.lastIndexOf("/")), { recursive: true });
|
|
49282
|
+
await fs15.writeTextFile(r41.filePath, compiled.code);
|
|
49278
49283
|
const fileRel = r41.filePath.slice(embeddedDir.length + 1).replace(/\\/g, "/");
|
|
49279
49284
|
routes.push({
|
|
49280
49285
|
path: r41.routePath,
|
|
@@ -49297,14 +49302,14 @@ async function buildEmbeddedPreset(options) {
|
|
|
49297
49302
|
for (const url of rscFiles) {
|
|
49298
49303
|
try {
|
|
49299
49304
|
const srcPath = url.pathname;
|
|
49300
|
-
const src = await
|
|
49305
|
+
const src = await fs15.readTextFile(srcPath);
|
|
49301
49306
|
const res = await esbuild6.transform(src, {
|
|
49302
49307
|
loader: "ts",
|
|
49303
49308
|
target: "es2020",
|
|
49304
49309
|
format: "esm"
|
|
49305
49310
|
});
|
|
49306
49311
|
const name = srcPath.substring(srcPath.lastIndexOf("/") + 1).replace(/\.tsx?$/, ".js");
|
|
49307
|
-
await
|
|
49312
|
+
await fs15.writeTextFile(join2(embeddedDir, "rsc", name), res.code);
|
|
49308
49313
|
} catch (e25) {
|
|
49309
49314
|
bundlerLogger.warn("embedded: failed to process RSC file", { error: String(e25) });
|
|
49310
49315
|
}
|
|
@@ -49330,7 +49335,7 @@ async function buildEmbeddedPreset(options) {
|
|
|
49330
49335
|
}
|
|
49331
49336
|
]
|
|
49332
49337
|
};
|
|
49333
|
-
await
|
|
49338
|
+
await fs15.writeTextFile(join2(embeddedDir, "manifest.json"), JSON.stringify(manifest, null, 2));
|
|
49334
49339
|
bundlerLogger.info("Embedded preset built", { outDir: embeddedDir });
|
|
49335
49340
|
try {
|
|
49336
49341
|
esbuild6.stop();
|
|
@@ -50418,7 +50423,7 @@ ${f53}`);
|
|
|
50418
50423
|
l52.isLogicalExpression = Ni2;
|
|
50419
50424
|
l52.isLoop = Wp;
|
|
50420
50425
|
l52.isMemberExpression = Li3;
|
|
50421
|
-
l52.isMetaProperty =
|
|
50426
|
+
l52.isMetaProperty = fs15;
|
|
50422
50427
|
l52.isMethod = pu;
|
|
50423
50428
|
l52.isMiscellaneous = gu;
|
|
50424
50429
|
l52.isMixedTypeAnnotation = so3;
|
|
@@ -50789,7 +50794,7 @@ ${f53}`);
|
|
|
50789
50794
|
function cs(e25, t38) {
|
|
50790
50795
|
return !e25 || e25.type !== "ImportExpression" ? false : t38 == null || (0, c70.default)(e25, t38);
|
|
50791
50796
|
}
|
|
50792
|
-
function
|
|
50797
|
+
function fs15(e25, t38) {
|
|
50793
50798
|
return !e25 || e25.type !== "MetaProperty" ? false : t38 == null || (0, c70.default)(e25, t38);
|
|
50794
50799
|
}
|
|
50795
50800
|
function ys(e25, t38) {
|
|
@@ -59277,7 +59282,7 @@ var init_generator = __esm({
|
|
|
59277
59282
|
c70.MemberExpression = Is2;
|
|
59278
59283
|
c70.MetaProperty = Os;
|
|
59279
59284
|
c70.ModuleExpression = Ns2;
|
|
59280
|
-
c70.NewExpression =
|
|
59285
|
+
c70.NewExpression = fs15;
|
|
59281
59286
|
c70.OptionalCallExpression = ds;
|
|
59282
59287
|
c70.OptionalMemberExpression = _s;
|
|
59283
59288
|
c70.ParenthesizedExpression = cs;
|
|
@@ -59305,7 +59310,7 @@ var init_generator = __esm({
|
|
|
59305
59310
|
function us(t38) {
|
|
59306
59311
|
this.print(t38.test, t38), this.space(), this.token("?"), this.space(), this.print(t38.consequent, t38), this.space(), this.token(":"), this.space(), this.print(t38.alternate, t38);
|
|
59307
59312
|
}
|
|
59308
|
-
function
|
|
59313
|
+
function fs15(t38, i48) {
|
|
59309
59314
|
this.word("new"), this.space(), this.print(t38.callee, t38), !(this.format.minified && t38.arguments.length === 0 && !t38.optional && !as(i48, { callee: t38 }) && !pt9(i48) && !os(i48)) && (this.print(t38.typeArguments, t38), this.print(t38.typeParameters, t38), t38.optional && this.token("?."), this.token("("), this.printList(t38.arguments, t38), this.token(")"));
|
|
59310
59315
|
}
|
|
59311
59316
|
function ms(t38) {
|
|
@@ -62496,7 +62501,7 @@ var init_parser2 = __esm({
|
|
|
62496
62501
|
function vi3() {
|
|
62497
62502
|
return new Dt10(ve7);
|
|
62498
62503
|
}
|
|
62499
|
-
function
|
|
62504
|
+
function fs15() {
|
|
62500
62505
|
return new nt11();
|
|
62501
62506
|
}
|
|
62502
62507
|
var st9 = 0, ms = 1, Ft10 = 2, ys = 4, Q31 = 8, ce12 = class {
|
|
@@ -66430,7 +66435,7 @@ var init_parser2 = __esm({
|
|
|
66430
66435
|
}
|
|
66431
66436
|
parseFunctionBody(t38, e25, s48 = false) {
|
|
66432
66437
|
let i48 = e25 && !this.match(5);
|
|
66433
|
-
if (this.expressionScope.enter(
|
|
66438
|
+
if (this.expressionScope.enter(fs15()), i48)
|
|
66434
66439
|
t38.body = this.parseMaybeAssign(), this.checkParams(t38, false, e25, false);
|
|
66435
66440
|
else {
|
|
66436
66441
|
let a56 = this.state.strict, n48 = this.state.labels;
|
|
@@ -67171,7 +67176,7 @@ var init_parser2 = __esm({
|
|
|
67171
67176
|
return this.parseInitializer(t38), this.semicolon(), this.finishNode(t38, "ClassAccessorProperty");
|
|
67172
67177
|
}
|
|
67173
67178
|
parseInitializer(t38) {
|
|
67174
|
-
this.scope.enter(Y31 | It8), this.expressionScope.enter(
|
|
67179
|
+
this.scope.enter(Y31 | It8), this.expressionScope.enter(fs15()), this.prodParam.enter(st9), t38.value = this.eat(29) ? this.parseMaybeAssignAllowIn() : null, this.expressionScope.exit(), this.prodParam.exit(), this.scope.exit();
|
|
67175
67180
|
}
|
|
67176
67181
|
parseClassId(t38, e25, s48, i48 = hs) {
|
|
67177
67182
|
if (w62(this.state.type))
|
|
@@ -69039,7 +69044,7 @@ var init_types7 = __esm({
|
|
|
69039
69044
|
a56.isClassExpression = wa;
|
|
69040
69045
|
a56.isClassImplements = bs;
|
|
69041
69046
|
a56.isClassMethod = Ga2;
|
|
69042
|
-
a56.isClassPrivateMethod =
|
|
69047
|
+
a56.isClassPrivateMethod = fs15;
|
|
69043
69048
|
a56.isClassPrivateProperty = ps;
|
|
69044
69049
|
a56.isClassProperty = ls;
|
|
69045
69050
|
a56.isCompletionStatement = xu;
|
|
@@ -69563,7 +69568,7 @@ var init_types7 = __esm({
|
|
|
69563
69568
|
function ps(e25, t38) {
|
|
69564
69569
|
return e25 && e25.type === "ClassPrivateProperty" ? typeof t38 > "u" ? true : (0, o45.default)(e25, t38) : false;
|
|
69565
69570
|
}
|
|
69566
|
-
function
|
|
69571
|
+
function fs15(e25, t38) {
|
|
69567
69572
|
return e25 && e25.type === "ClassPrivateMethod" ? typeof t38 > "u" ? true : (0, o45.default)(e25, t38) : false;
|
|
69568
69573
|
}
|
|
69569
69574
|
function cs(e25, t38) {
|
|
@@ -87703,7 +87708,7 @@ var init_semver = __esm({
|
|
|
87703
87708
|
});
|
|
87704
87709
|
H34 = h48((Dn3, or3) => {
|
|
87705
87710
|
"use strict";
|
|
87706
|
-
var
|
|
87711
|
+
var fs15 = d52(), hs = (t38, e25, r41) => fs15(t38, e25, r41) <= 0;
|
|
87707
87712
|
or3.exports = hs;
|
|
87708
87713
|
});
|
|
87709
87714
|
re13 = h48((Gn3, cr3) => {
|
|
@@ -95946,17 +95951,17 @@ var init_asset_utils = __esm({
|
|
|
95946
95951
|
|
|
95947
95952
|
// src/build/asset-pipeline/image-optimizer/variant-generator.ts
|
|
95948
95953
|
async function generateVariant(sharp, image, relPath, format4, width, metadata, quality, outputDir) {
|
|
95949
|
-
const
|
|
95954
|
+
const fs15 = createFileSystem();
|
|
95950
95955
|
try {
|
|
95951
95956
|
const outputPath = getVariantPath(outputDir, relPath, format4, width);
|
|
95952
|
-
await
|
|
95957
|
+
await fs15.mkdir(dirname2(outputPath), { recursive: true });
|
|
95953
95958
|
const processor = image.clone().resize(width, null, {
|
|
95954
95959
|
fit: "inside",
|
|
95955
95960
|
withoutEnlargement: true
|
|
95956
95961
|
});
|
|
95957
95962
|
const formattedProcessor = processFormat(processor, format4, quality);
|
|
95958
95963
|
const buffer = await formattedProcessor.toBuffer();
|
|
95959
|
-
await
|
|
95964
|
+
await fs15.writeFile(outputPath, buffer);
|
|
95960
95965
|
const processedMetadata = await sharp(buffer).metadata();
|
|
95961
95966
|
return {
|
|
95962
95967
|
format: format4,
|
|
@@ -96027,10 +96032,10 @@ var init_variant_generator = __esm({
|
|
|
96027
96032
|
|
|
96028
96033
|
// src/build/asset-pipeline/image-optimizer/manifest-manager.ts
|
|
96029
96034
|
async function writeManifest2(imageManifest, outputDir) {
|
|
96030
|
-
const
|
|
96035
|
+
const fs15 = createFileSystem();
|
|
96031
96036
|
const manifestPath = join2(outputDir, MANIFEST_FILENAME);
|
|
96032
96037
|
const manifest = Object.fromEntries(imageManifest);
|
|
96033
|
-
await
|
|
96038
|
+
await fs15.writeTextFile(
|
|
96034
96039
|
manifestPath,
|
|
96035
96040
|
JSON.stringify(manifest, null, 2)
|
|
96036
96041
|
);
|
|
@@ -96398,9 +96403,9 @@ async function processTailwindCSS(options) {
|
|
|
96398
96403
|
async function processTailwindCSSInDirectory(projectDir, cssDir = "styles", outputDir = ".veryfront/css") {
|
|
96399
96404
|
const results = [];
|
|
96400
96405
|
const cssPath = join2(projectDir, cssDir);
|
|
96401
|
-
const
|
|
96406
|
+
const fs15 = createFileSystem();
|
|
96402
96407
|
try {
|
|
96403
|
-
for await (const entry of
|
|
96408
|
+
for await (const entry of fs15.readDir(cssPath)) {
|
|
96404
96409
|
if (entry.isFile && entry.name.endsWith(".css")) {
|
|
96405
96410
|
const filePath = join2(cssPath, entry.name);
|
|
96406
96411
|
if (await isTailwindV4File(filePath, projectDir, denoAdapter)) {
|
|
@@ -97043,8 +97048,8 @@ async function isNotFoundError2(error2, path) {
|
|
|
97043
97048
|
return true;
|
|
97044
97049
|
}
|
|
97045
97050
|
}
|
|
97046
|
-
const
|
|
97047
|
-
const exists2 = await
|
|
97051
|
+
const fs15 = getFs();
|
|
97052
|
+
const exists2 = await fs15.exists(path);
|
|
97048
97053
|
return !exists2;
|
|
97049
97054
|
}
|
|
97050
97055
|
async function loadEnv(options = {}) {
|
|
@@ -97057,10 +97062,10 @@ async function loadEnv(options = {}) {
|
|
|
97057
97062
|
];
|
|
97058
97063
|
let loadedCount = 0;
|
|
97059
97064
|
let totalVars = 0;
|
|
97060
|
-
const
|
|
97065
|
+
const fs15 = getFs();
|
|
97061
97066
|
for (const file of envFiles) {
|
|
97062
97067
|
try {
|
|
97063
|
-
const content = await
|
|
97068
|
+
const content = await fs15.readTextFile(file);
|
|
97064
97069
|
const vars = parseEnvFile(content);
|
|
97065
97070
|
for (const [key, value] of Object.entries(vars)) {
|
|
97066
97071
|
const existing = getEnv(key);
|
|
@@ -97152,8 +97157,8 @@ function expandVariables(value, vars) {
|
|
|
97152
97157
|
return value;
|
|
97153
97158
|
}
|
|
97154
97159
|
function supportsEnvFiles() {
|
|
97155
|
-
const
|
|
97156
|
-
return typeof
|
|
97160
|
+
const fs15 = getFs();
|
|
97161
|
+
return typeof fs15.readTextFile === "function";
|
|
97157
97162
|
}
|
|
97158
97163
|
var _fs;
|
|
97159
97164
|
var init_env_loader = __esm({
|
|
@@ -100241,8 +100246,8 @@ var init_lib_modules_handler = __esm({
|
|
|
100241
100246
|
});
|
|
100242
100247
|
|
|
100243
100248
|
// src/rendering/rsc/component-analyzer.ts
|
|
100244
|
-
async function analyzeComponent(filePath,
|
|
100245
|
-
const content = await
|
|
100249
|
+
async function analyzeComponent(filePath, fs15) {
|
|
100250
|
+
const content = await fs15.readFile(filePath);
|
|
100246
100251
|
const hasUseClient = detectDirective(content, "use client");
|
|
100247
100252
|
const hasUseServer = detectDirective(content, "use server");
|
|
100248
100253
|
let type = "server";
|
|
@@ -100308,10 +100313,10 @@ function generateComponentId(filePath) {
|
|
|
100308
100313
|
function toPascalCase(str) {
|
|
100309
100314
|
return str.split(/[-_\s]+/).map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join("");
|
|
100310
100315
|
}
|
|
100311
|
-
async function buildClientManifest(projectDir, appDir = "app",
|
|
100316
|
+
async function buildClientManifest(projectDir, appDir = "app", fs15) {
|
|
100312
100317
|
const manifest = /* @__PURE__ */ new Map();
|
|
100313
100318
|
const appPath = join2(projectDir, appDir);
|
|
100314
|
-
let fsAdapter =
|
|
100319
|
+
let fsAdapter = fs15;
|
|
100315
100320
|
if (!fsAdapter) {
|
|
100316
100321
|
try {
|
|
100317
100322
|
const adapter = await getAdapter();
|
|
@@ -100341,19 +100346,19 @@ async function buildClientManifest(projectDir, appDir = "app", fs14) {
|
|
|
100341
100346
|
}
|
|
100342
100347
|
return manifest;
|
|
100343
100348
|
}
|
|
100344
|
-
async function walkDirectory3(dir, callback,
|
|
100349
|
+
async function walkDirectory3(dir, callback, fs15) {
|
|
100345
100350
|
try {
|
|
100346
|
-
if (!
|
|
100351
|
+
if (!fs15) {
|
|
100347
100352
|
throw new Error("FileSystemAdapter is required for walkDirectory");
|
|
100348
100353
|
}
|
|
100349
|
-
const entries =
|
|
100354
|
+
const entries = fs15.readDir(dir);
|
|
100350
100355
|
for await (const entry of entries) {
|
|
100351
100356
|
const path = join2(dir, entry.name);
|
|
100352
100357
|
if (entry.isDirectory) {
|
|
100353
100358
|
if (entry.name.startsWith(".") || entry.name === "node_modules") {
|
|
100354
100359
|
continue;
|
|
100355
100360
|
}
|
|
100356
|
-
await walkDirectory3(path, callback,
|
|
100361
|
+
await walkDirectory3(path, callback, fs15);
|
|
100357
100362
|
} else if (entry.isFile) {
|
|
100358
100363
|
await callback(path);
|
|
100359
100364
|
}
|
|
@@ -103965,8 +103970,8 @@ function analyzeImports(content) {
|
|
|
103965
103970
|
}
|
|
103966
103971
|
return { local, remote, shared };
|
|
103967
103972
|
}
|
|
103968
|
-
async function analyzeProjectChunks(projectDir,
|
|
103969
|
-
const fsAdapter =
|
|
103973
|
+
async function analyzeProjectChunks(projectDir, fs15) {
|
|
103974
|
+
const fsAdapter = fs15 ?? createFileSystem();
|
|
103970
103975
|
const pages = /* @__PURE__ */ new Map();
|
|
103971
103976
|
const sharedDeps = /* @__PURE__ */ new Map();
|
|
103972
103977
|
const mdxFiles = [];
|
|
@@ -104101,8 +104106,8 @@ init_process();
|
|
|
104101
104106
|
async function analyzeChunksCommand(options) {
|
|
104102
104107
|
const { projectDir, output } = options;
|
|
104103
104108
|
try {
|
|
104104
|
-
const
|
|
104105
|
-
const analysis = await analyzeProjectChunks(projectDir,
|
|
104109
|
+
const fs15 = createFileSystem();
|
|
104110
|
+
const analysis = await analyzeProjectChunks(projectDir, fs15);
|
|
104106
104111
|
if (analysis.sharedDeps.size > 0) {
|
|
104107
104112
|
cliLogger.info("Top shared dependencies:");
|
|
104108
104113
|
const sorted = Array.from(analysis.sharedDeps.entries()).sort((a56, b70) => b70[1] - a56[1]).slice(0, 10);
|
|
@@ -104125,7 +104130,7 @@ async function analyzeChunksCommand(options) {
|
|
|
104125
104130
|
}
|
|
104126
104131
|
if (output) {
|
|
104127
104132
|
const manifest = generateChunkManifest(analysis);
|
|
104128
|
-
await
|
|
104133
|
+
await fs15.writeTextFile(output, JSON.stringify(manifest, null, 2));
|
|
104129
104134
|
cliLogger.info(`Saved chunk manifest to ${output}`);
|
|
104130
104135
|
}
|
|
104131
104136
|
const totalSharedUsage = Array.from(analysis.sharedDeps.values()).reduce(
|
|
@@ -104397,11 +104402,11 @@ async function cleanCommand(options) {
|
|
|
104397
104402
|
}
|
|
104398
104403
|
}
|
|
104399
104404
|
async function cleanDirectory(path) {
|
|
104400
|
-
const
|
|
104401
|
-
if (!await
|
|
104405
|
+
const fs15 = createFileSystem();
|
|
104406
|
+
if (!await fs15.exists(path))
|
|
104402
104407
|
return;
|
|
104403
104408
|
try {
|
|
104404
|
-
await
|
|
104409
|
+
await fs15.remove(path, { recursive: true });
|
|
104405
104410
|
} catch (error2) {
|
|
104406
104411
|
cliLogger.error(`Failed to clean directory ${path}:`, error2);
|
|
104407
104412
|
}
|
|
@@ -104841,12 +104846,12 @@ async function createPackageJson(projectDir, projectName) {
|
|
|
104841
104846
|
dependencies: {
|
|
104842
104847
|
react: "^19.0.0",
|
|
104843
104848
|
"react-dom": "^19.0.0",
|
|
104844
|
-
veryfront: "^0.0.
|
|
104849
|
+
veryfront: "^0.0.51",
|
|
104845
104850
|
zod: "^3.24.0"
|
|
104846
104851
|
}
|
|
104847
104852
|
};
|
|
104848
|
-
const
|
|
104849
|
-
await
|
|
104853
|
+
const fs15 = createFileSystem();
|
|
104854
|
+
await fs15.writeTextFile(
|
|
104850
104855
|
join2(projectDir, "package.json"),
|
|
104851
104856
|
JSON.stringify(packageJson, null, 2)
|
|
104852
104857
|
);
|
|
@@ -104926,7 +104931,7 @@ async function detectPackageManager(projectDir, preference) {
|
|
|
104926
104931
|
if (preference) {
|
|
104927
104932
|
return preference;
|
|
104928
104933
|
}
|
|
104929
|
-
const
|
|
104934
|
+
const fs15 = createFileSystem();
|
|
104930
104935
|
const lockfiles = [
|
|
104931
104936
|
{ file: "bun.lockb", pm: "bun" },
|
|
104932
104937
|
{ file: "pnpm-lock.yaml", pm: "pnpm" },
|
|
@@ -104935,7 +104940,7 @@ async function detectPackageManager(projectDir, preference) {
|
|
|
104935
104940
|
];
|
|
104936
104941
|
for (const { file, pm } of lockfiles) {
|
|
104937
104942
|
const lockPath = join6(projectDir, file);
|
|
104938
|
-
if (await
|
|
104943
|
+
if (await fs15.exists(lockPath)) {
|
|
104939
104944
|
cliLogger.debug(`Detected ${pm} from ${file}`);
|
|
104940
104945
|
return pm;
|
|
104941
104946
|
}
|
|
@@ -104943,7 +104948,7 @@ async function detectPackageManager(projectDir, preference) {
|
|
|
104943
104948
|
const parentDir = join6(projectDir, "..");
|
|
104944
104949
|
for (const { file, pm } of lockfiles) {
|
|
104945
104950
|
const lockPath = join6(parentDir, file);
|
|
104946
|
-
if (await
|
|
104951
|
+
if (await fs15.exists(lockPath)) {
|
|
104947
104952
|
cliLogger.debug(`Detected ${pm} from parent directory ${file}`);
|
|
104948
104953
|
return pm;
|
|
104949
104954
|
}
|
|
@@ -105013,6 +105018,12 @@ async function promptForEnvVars(envVars, options = {}) {
|
|
|
105013
105018
|
cliLogger.info(`${cyan3("Environment Setup:")}`);
|
|
105014
105019
|
cliLogger.info(dim3(" Press Enter to skip and set values later\n"));
|
|
105015
105020
|
}
|
|
105021
|
+
const prefilledValues = options.prefilledValues || {};
|
|
105022
|
+
const hasPrefilledValues = Object.keys(prefilledValues).length > 0;
|
|
105023
|
+
if (hasPrefilledValues && envVars.length > 0) {
|
|
105024
|
+
cliLogger.info("");
|
|
105025
|
+
cliLogger.info(`${cyan3("Environment Setup:")} Using values from config file`);
|
|
105026
|
+
}
|
|
105016
105027
|
for (const envVar of envVars) {
|
|
105017
105028
|
const commentLines = [];
|
|
105018
105029
|
commentLines.push(`# ${envVar.description}`);
|
|
@@ -105026,9 +105037,16 @@ async function promptForEnvVars(envVars, options = {}) {
|
|
|
105026
105037
|
exampleLines.push(...commentLines);
|
|
105027
105038
|
exampleLines.push(`${envVar.name}=${placeholder}`);
|
|
105028
105039
|
exampleLines.push("");
|
|
105029
|
-
let value = "";
|
|
105030
|
-
if (interactive) {
|
|
105040
|
+
let value = prefilledValues[envVar.name] || "";
|
|
105041
|
+
if (!value && interactive) {
|
|
105031
105042
|
value = await promptForSingleEnvVar(envVar);
|
|
105043
|
+
} else if (value && hasPrefilledValues) {
|
|
105044
|
+
if (envVar.sensitive) {
|
|
105045
|
+
const masked = value.length > 8 ? value.substring(0, 4) + "..." + value.substring(value.length - 4) : "****";
|
|
105046
|
+
cliLogger.debug(` ${cyan3(envVar.name)}: ${dim3(masked)}`);
|
|
105047
|
+
} else {
|
|
105048
|
+
cliLogger.debug(` ${cyan3(envVar.name)}: ${dim3(value)}`);
|
|
105049
|
+
}
|
|
105032
105050
|
}
|
|
105033
105051
|
values[envVar.name] = value;
|
|
105034
105052
|
if (value) {
|
|
@@ -105130,7 +105148,51 @@ var AVAILABLE_INTEGRATIONS = [
|
|
|
105130
105148
|
"jira",
|
|
105131
105149
|
"notion",
|
|
105132
105150
|
"servicenow",
|
|
105133
|
-
"
|
|
105151
|
+
"confluence",
|
|
105152
|
+
"linear",
|
|
105153
|
+
"gitlab",
|
|
105154
|
+
"outlook",
|
|
105155
|
+
"teams",
|
|
105156
|
+
"figma",
|
|
105157
|
+
"sheets",
|
|
105158
|
+
"airtable",
|
|
105159
|
+
"supabase",
|
|
105160
|
+
"neon",
|
|
105161
|
+
"sharepoint",
|
|
105162
|
+
"discord",
|
|
105163
|
+
"hubspot",
|
|
105164
|
+
"stripe",
|
|
105165
|
+
"dropbox",
|
|
105166
|
+
"salesforce",
|
|
105167
|
+
"twitter",
|
|
105168
|
+
"onedrive",
|
|
105169
|
+
"bitbucket",
|
|
105170
|
+
"sentry",
|
|
105171
|
+
"posthog",
|
|
105172
|
+
"zendesk",
|
|
105173
|
+
// New integrations
|
|
105174
|
+
"asana",
|
|
105175
|
+
"monday",
|
|
105176
|
+
"zoom",
|
|
105177
|
+
"trello",
|
|
105178
|
+
"box",
|
|
105179
|
+
"shopify",
|
|
105180
|
+
"clickup",
|
|
105181
|
+
"intercom",
|
|
105182
|
+
"pipedrive",
|
|
105183
|
+
"mailchimp",
|
|
105184
|
+
"webex",
|
|
105185
|
+
"freshdesk",
|
|
105186
|
+
"quickbooks",
|
|
105187
|
+
"xero",
|
|
105188
|
+
// 50+ integrations
|
|
105189
|
+
"drive",
|
|
105190
|
+
"docs-google",
|
|
105191
|
+
"snowflake",
|
|
105192
|
+
"mixpanel",
|
|
105193
|
+
"twilio",
|
|
105194
|
+
"anthropic",
|
|
105195
|
+
"aws"
|
|
105134
105196
|
];
|
|
105135
105197
|
function getIntegrationDirectory(integrationName) {
|
|
105136
105198
|
const moduleUrl = new URL(".", import.meta.url);
|
|
@@ -105150,11 +105212,11 @@ function getIntegrationDirectory(integrationName) {
|
|
|
105150
105212
|
}
|
|
105151
105213
|
}
|
|
105152
105214
|
async function loadIntegrationConfig(integrationName) {
|
|
105153
|
-
const
|
|
105215
|
+
const fs15 = createFileSystem();
|
|
105154
105216
|
const integrationDir = getIntegrationDirectory(integrationName);
|
|
105155
105217
|
const configPath = join4(integrationDir, "connector.json");
|
|
105156
105218
|
try {
|
|
105157
|
-
const content = await
|
|
105219
|
+
const content = await fs15.readTextFile(configPath);
|
|
105158
105220
|
return JSON.parse(content);
|
|
105159
105221
|
} catch {
|
|
105160
105222
|
return null;
|
|
@@ -105856,12 +105918,128 @@ var TEMPLATES = [
|
|
|
105856
105918
|
{ value: "docs", label: "Docs", description: "Documentation site" },
|
|
105857
105919
|
{ value: "minimal", label: "Minimal", description: "Simple starting point" }
|
|
105858
105920
|
];
|
|
105859
|
-
var
|
|
105860
|
-
{
|
|
105861
|
-
|
|
105862
|
-
|
|
105863
|
-
|
|
105921
|
+
var INTEGRATION_CATEGORIES = [
|
|
105922
|
+
{
|
|
105923
|
+
name: "Communication",
|
|
105924
|
+
integrations: [
|
|
105925
|
+
{ value: "gmail", label: "Gmail", description: "Read, search, send emails" },
|
|
105926
|
+
{ value: "slack", label: "Slack", description: "Messages, channels, search" },
|
|
105927
|
+
{ value: "outlook", label: "Outlook", description: "Email via Microsoft Graph" },
|
|
105928
|
+
{ value: "teams", label: "Teams", description: "Chat, meetings" },
|
|
105929
|
+
{ value: "discord", label: "Discord", description: "Messages, server management" },
|
|
105930
|
+
{ value: "webex", label: "Webex", description: "Messaging, meetings" },
|
|
105931
|
+
{ value: "zoom", label: "Zoom", description: "Meetings, webinars" },
|
|
105932
|
+
{ value: "twilio", label: "Twilio", description: "SMS, voice" }
|
|
105933
|
+
]
|
|
105934
|
+
},
|
|
105935
|
+
{
|
|
105936
|
+
name: "Productivity",
|
|
105937
|
+
integrations: [
|
|
105938
|
+
{ value: "calendar", label: "Calendar", description: "Google Calendar events" },
|
|
105939
|
+
{ value: "notion", label: "Notion", description: "Pages, databases, blocks" },
|
|
105940
|
+
{ value: "jira", label: "Jira", description: "Issues, projects, sprints" },
|
|
105941
|
+
{ value: "linear", label: "Linear", description: "Issue tracking" },
|
|
105942
|
+
{ value: "asana", label: "Asana", description: "Tasks, projects" },
|
|
105943
|
+
{ value: "trello", label: "Trello", description: "Boards, lists, cards" },
|
|
105944
|
+
{ value: "monday", label: "Monday", description: "Work management" },
|
|
105945
|
+
{ value: "clickup", label: "ClickUp", description: "Tasks, docs" },
|
|
105946
|
+
{ value: "confluence", label: "Confluence", description: "Wiki pages, spaces" }
|
|
105947
|
+
]
|
|
105948
|
+
},
|
|
105949
|
+
{
|
|
105950
|
+
name: "Development",
|
|
105951
|
+
integrations: [
|
|
105952
|
+
{ value: "github", label: "GitHub", description: "Repos, issues, PRs, actions" },
|
|
105953
|
+
{ value: "gitlab", label: "GitLab", description: "Repos, merge requests, pipelines" },
|
|
105954
|
+
{ value: "bitbucket", label: "Bitbucket", description: "Repos, pull requests" },
|
|
105955
|
+
{ value: "sentry", label: "Sentry", description: "Error tracking" },
|
|
105956
|
+
{ value: "posthog", label: "PostHog", description: "Product analytics" },
|
|
105957
|
+
{ value: "mixpanel", label: "Mixpanel", description: "Analytics, events" }
|
|
105958
|
+
]
|
|
105959
|
+
},
|
|
105960
|
+
{
|
|
105961
|
+
name: "Storage",
|
|
105962
|
+
integrations: [
|
|
105963
|
+
{ value: "drive", label: "Google Drive", description: "Files, folders" },
|
|
105964
|
+
{ value: "docs-google", label: "Google Docs", description: "Documents" },
|
|
105965
|
+
{ value: "sheets", label: "Google Sheets", description: "Spreadsheets" },
|
|
105966
|
+
{ value: "onedrive", label: "OneDrive", description: "Microsoft files" },
|
|
105967
|
+
{ value: "sharepoint", label: "SharePoint", description: "Enterprise content" },
|
|
105968
|
+
{ value: "dropbox", label: "Dropbox", description: "File storage" },
|
|
105969
|
+
{ value: "box", label: "Box", description: "Enterprise files" },
|
|
105970
|
+
{ value: "airtable", label: "Airtable", description: "Database, spreadsheet" }
|
|
105971
|
+
]
|
|
105972
|
+
},
|
|
105973
|
+
{
|
|
105974
|
+
name: "Infrastructure",
|
|
105975
|
+
integrations: [
|
|
105976
|
+
{ value: "supabase", label: "Supabase", description: "Postgres, auth, storage" },
|
|
105977
|
+
{ value: "neon", label: "Neon", description: "Serverless Postgres" },
|
|
105978
|
+
{ value: "snowflake", label: "Snowflake", description: "Data warehouse" },
|
|
105979
|
+
{ value: "aws", label: "AWS", description: "S3, Lambda, DynamoDB" }
|
|
105980
|
+
]
|
|
105981
|
+
},
|
|
105982
|
+
{
|
|
105983
|
+
name: "Sales & CRM",
|
|
105984
|
+
integrations: [
|
|
105985
|
+
{ value: "salesforce", label: "Salesforce", description: "CRM, sales automation" },
|
|
105986
|
+
{ value: "hubspot", label: "HubSpot", description: "Marketing, sales" },
|
|
105987
|
+
{ value: "pipedrive", label: "Pipedrive", description: "Sales pipeline" }
|
|
105988
|
+
]
|
|
105989
|
+
},
|
|
105990
|
+
{
|
|
105991
|
+
name: "Support",
|
|
105992
|
+
integrations: [
|
|
105993
|
+
{ value: "zendesk", label: "Zendesk", description: "Tickets, support" },
|
|
105994
|
+
{ value: "intercom", label: "Intercom", description: "Customer messaging" },
|
|
105995
|
+
{ value: "freshdesk", label: "Freshdesk", description: "Help desk" },
|
|
105996
|
+
{ value: "servicenow", label: "ServiceNow", description: "IT service management" }
|
|
105997
|
+
]
|
|
105998
|
+
},
|
|
105999
|
+
{
|
|
106000
|
+
name: "Finance",
|
|
106001
|
+
integrations: [
|
|
106002
|
+
{ value: "stripe", label: "Stripe", description: "Payments, subscriptions" },
|
|
106003
|
+
{ value: "quickbooks", label: "QuickBooks", description: "Accounting" },
|
|
106004
|
+
{ value: "xero", label: "Xero", description: "Accounting" }
|
|
106005
|
+
]
|
|
106006
|
+
},
|
|
106007
|
+
{
|
|
106008
|
+
name: "Marketing",
|
|
106009
|
+
integrations: [
|
|
106010
|
+
{ value: "mailchimp", label: "Mailchimp", description: "Email marketing" },
|
|
106011
|
+
{ value: "shopify", label: "Shopify", description: "E-commerce" },
|
|
106012
|
+
{ value: "twitter", label: "Twitter/X", description: "Social media" }
|
|
106013
|
+
]
|
|
106014
|
+
},
|
|
106015
|
+
{
|
|
106016
|
+
name: "Design",
|
|
106017
|
+
integrations: [
|
|
106018
|
+
{ value: "figma", label: "Figma", description: "Design files, comments" }
|
|
106019
|
+
]
|
|
106020
|
+
},
|
|
106021
|
+
{
|
|
106022
|
+
name: "AI Providers",
|
|
106023
|
+
integrations: [
|
|
106024
|
+
{ value: "anthropic", label: "Anthropic", description: "Claude models" }
|
|
106025
|
+
]
|
|
106026
|
+
}
|
|
105864
106027
|
];
|
|
106028
|
+
function getIntegrationChoices() {
|
|
106029
|
+
const choices = [];
|
|
106030
|
+
for (const category of INTEGRATION_CATEGORIES) {
|
|
106031
|
+
choices.push({
|
|
106032
|
+
value: `__header_${category.name}`,
|
|
106033
|
+
label: `\u2500\u2500 ${category.name} \u2500\u2500`,
|
|
106034
|
+
description: "",
|
|
106035
|
+
isHeader: true
|
|
106036
|
+
});
|
|
106037
|
+
for (const integration of category.integrations) {
|
|
106038
|
+
choices.push(integration);
|
|
106039
|
+
}
|
|
106040
|
+
}
|
|
106041
|
+
return choices;
|
|
106042
|
+
}
|
|
105865
106043
|
function canRunWizard() {
|
|
105866
106044
|
const disablePrompt = getEnv("CI") === "1" || getEnv("DENO_TESTING") === "1";
|
|
105867
106045
|
return !disablePrompt && isInteractive();
|
|
@@ -105902,9 +106080,15 @@ async function runInteractiveWizard() {
|
|
|
105902
106080
|
skipped: false
|
|
105903
106081
|
};
|
|
105904
106082
|
}
|
|
106083
|
+
console.log("");
|
|
106084
|
+
console.log(dim3("Use arrow keys to navigate, space to select, enter to confirm"));
|
|
106085
|
+
console.log(dim3("Popular choices: Gmail, Slack, GitHub, Calendar, Notion"));
|
|
106086
|
+
console.log("");
|
|
106087
|
+
const choices = getIntegrationChoices();
|
|
105905
106088
|
const selected = await multiSelect(
|
|
105906
106089
|
"Which services should your agent connect to?",
|
|
105907
|
-
|
|
106090
|
+
choices.filter((c70) => !c70.isHeader)
|
|
106091
|
+
// Filter out headers for selection
|
|
105908
106092
|
);
|
|
105909
106093
|
const integrations = selected;
|
|
105910
106094
|
console.log("");
|
|
@@ -105946,7 +106130,7 @@ async function initCommand(options) {
|
|
|
105946
106130
|
}
|
|
105947
106131
|
}
|
|
105948
106132
|
const projectDir = name ? join2(cwd(), name) : cwd();
|
|
105949
|
-
const
|
|
106133
|
+
const fs15 = createFileSystem();
|
|
105950
106134
|
if (features.length > 0) {
|
|
105951
106135
|
const validation = validateFeatures(features);
|
|
105952
106136
|
if (!validation.valid) {
|
|
@@ -105977,7 +106161,7 @@ async function initCommand(options) {
|
|
|
105977
106161
|
`Creating new Veryfront project${name ? ` in ${name}` : ""} with template: ${template}${featuresStr}${integrationsStr}`
|
|
105978
106162
|
);
|
|
105979
106163
|
if (name) {
|
|
105980
|
-
const exists2 = await
|
|
106164
|
+
const exists2 = await fs15.exists(projectDir);
|
|
105981
106165
|
if (exists2) {
|
|
105982
106166
|
throw new FileSystemError(`Directory ${name} already exists`);
|
|
105983
106167
|
}
|
|
@@ -106058,7 +106242,7 @@ async function initCommand(options) {
|
|
|
106058
106242
|
if (fileDir !== projectDir) {
|
|
106059
106243
|
await ensureDir(fileDir);
|
|
106060
106244
|
}
|
|
106061
|
-
await
|
|
106245
|
+
await fs15.writeTextFile(filePath, file.content);
|
|
106062
106246
|
cliLogger.debug(`Created file: ${file.path}`);
|
|
106063
106247
|
}
|
|
106064
106248
|
await createPackageJson(projectDir, name);
|
|
@@ -106072,21 +106256,22 @@ async function initCommand(options) {
|
|
|
106072
106256
|
return true;
|
|
106073
106257
|
});
|
|
106074
106258
|
const envResult = await promptForEnvVars(uniqueEnvVars, {
|
|
106075
|
-
skipPrompt: options.skipEnvPrompt
|
|
106259
|
+
skipPrompt: options.skipEnvPrompt,
|
|
106260
|
+
prefilledValues: options.env
|
|
106076
106261
|
});
|
|
106077
|
-
await
|
|
106262
|
+
await fs15.writeTextFile(join2(projectDir, ".env"), envResult.envContent);
|
|
106078
106263
|
cliLogger.debug("Created file: .env");
|
|
106079
|
-
await
|
|
106264
|
+
await fs15.writeTextFile(join2(projectDir, ".env.example"), envResult.envExampleContent);
|
|
106080
106265
|
cliLogger.debug("Created file: .env.example");
|
|
106081
106266
|
}
|
|
106082
106267
|
const gitignorePath = join2(projectDir, ".gitignore");
|
|
106083
106268
|
let existingGitignore;
|
|
106084
106269
|
try {
|
|
106085
|
-
existingGitignore = await
|
|
106270
|
+
existingGitignore = await fs15.readTextFile(gitignorePath);
|
|
106086
106271
|
} catch {
|
|
106087
106272
|
}
|
|
106088
106273
|
const gitignoreContent = generateGitignoreContent(existingGitignore);
|
|
106089
|
-
await
|
|
106274
|
+
await fs15.writeTextFile(gitignorePath, gitignoreContent);
|
|
106090
106275
|
cliLogger.debug("Updated file: .gitignore");
|
|
106091
106276
|
options._featureTips = featureTips;
|
|
106092
106277
|
cliLogger.info(`${green3("\u2705")} Created Veryfront project${name ? ` at ${name}` : ""}`);
|
|
@@ -106264,8 +106449,8 @@ function toPathStat(info) {
|
|
|
106264
106449
|
}
|
|
106265
106450
|
async function statPath(path, adapter) {
|
|
106266
106451
|
try {
|
|
106267
|
-
const
|
|
106268
|
-
const info = await
|
|
106452
|
+
const fs15 = createFileSystem();
|
|
106453
|
+
const info = await fs15.stat(path);
|
|
106269
106454
|
return toPathStat(info);
|
|
106270
106455
|
} catch (error2) {
|
|
106271
106456
|
if (!isNotFoundError(error2)) {
|
|
@@ -106278,9 +106463,9 @@ async function statPath(path, adapter) {
|
|
|
106278
106463
|
async function ensureDirPath(path, adapter) {
|
|
106279
106464
|
if (!path)
|
|
106280
106465
|
return;
|
|
106281
|
-
const
|
|
106466
|
+
const fs15 = createFileSystem();
|
|
106282
106467
|
try {
|
|
106283
|
-
await
|
|
106468
|
+
await fs15.mkdir(path, { recursive: true });
|
|
106284
106469
|
return;
|
|
106285
106470
|
} catch (error2) {
|
|
106286
106471
|
if (typeof error2 === "object" && error2 !== null && "code" in error2 && (error2.code === "EEXIST" || error2.code === "ERR_FS_EISDIR")) {
|
|
@@ -106310,13 +106495,13 @@ async function copyStaticAssets(adapter, projectDir, outputDir, dryRun = false)
|
|
|
106310
106495
|
}
|
|
106311
106496
|
const destinationRoot = outputDir;
|
|
106312
106497
|
const readFileBytes = async (path) => {
|
|
106313
|
-
const
|
|
106314
|
-
const buffer = await
|
|
106498
|
+
const fs15 = createFileSystem();
|
|
106499
|
+
const buffer = await fs15.readFile(path);
|
|
106315
106500
|
return buffer instanceof Uint8Array ? buffer : new Uint8Array(buffer);
|
|
106316
106501
|
};
|
|
106317
106502
|
const writeFileBytes = async (path, data) => {
|
|
106318
|
-
const
|
|
106319
|
-
await
|
|
106503
|
+
const fs15 = createFileSystem();
|
|
106504
|
+
await fs15.writeFile(path, data);
|
|
106320
106505
|
};
|
|
106321
106506
|
if (!dryRun) {
|
|
106322
106507
|
await ensureDirPath(destinationRoot, adapter);
|
|
@@ -106325,8 +106510,8 @@ async function copyStaticAssets(adapter, projectDir, outputDir, dryRun = false)
|
|
|
106325
106510
|
try {
|
|
106326
106511
|
await writeFileBytes(testFilePath, testBytes);
|
|
106327
106512
|
try {
|
|
106328
|
-
const
|
|
106329
|
-
await
|
|
106513
|
+
const fs15 = createFileSystem();
|
|
106514
|
+
await fs15.remove(testFilePath);
|
|
106330
106515
|
} catch (_error) {
|
|
106331
106516
|
}
|
|
106332
106517
|
} catch (error2) {
|
|
@@ -106384,17 +106569,17 @@ try {
|
|
|
106384
106569
|
} catch {
|
|
106385
106570
|
}
|
|
106386
106571
|
async function statFile(path) {
|
|
106387
|
-
const
|
|
106572
|
+
const fs15 = createFileSystem();
|
|
106388
106573
|
try {
|
|
106389
|
-
const stat2 = await
|
|
106574
|
+
const stat2 = await fs15.stat(path);
|
|
106390
106575
|
return { isFile: stat2.isFile };
|
|
106391
106576
|
} catch (error2) {
|
|
106392
106577
|
throw error2;
|
|
106393
106578
|
}
|
|
106394
106579
|
}
|
|
106395
106580
|
async function readTextFile(path) {
|
|
106396
|
-
const
|
|
106397
|
-
return await
|
|
106581
|
+
const fs15 = createFileSystem();
|
|
106582
|
+
return await fs15.readTextFile(path);
|
|
106398
106583
|
}
|
|
106399
106584
|
var moduleDir = dirname6(fromFileUrl(import.meta.url));
|
|
106400
106585
|
var packageRoot = join8(moduleDir, "..", "..", "..");
|
|
@@ -107216,7 +107401,7 @@ async function setupBuildDirectories(adapter, outputDir, dryRun) {
|
|
|
107216
107401
|
serverLogger
|
|
107217
107402
|
);
|
|
107218
107403
|
if (!dryRun) {
|
|
107219
|
-
const
|
|
107404
|
+
const fs15 = createFileSystem();
|
|
107220
107405
|
const dirs = [
|
|
107221
107406
|
outputDir,
|
|
107222
107407
|
join11(outputDir, "_veryfront"),
|
|
@@ -107226,7 +107411,7 @@ async function setupBuildDirectories(adapter, outputDir, dryRun) {
|
|
|
107226
107411
|
];
|
|
107227
107412
|
for (const dir of dirs) {
|
|
107228
107413
|
try {
|
|
107229
|
-
await
|
|
107414
|
+
await fs15.mkdir(dir, { recursive: true });
|
|
107230
107415
|
} catch (error2) {
|
|
107231
107416
|
if (error2 && typeof error2 === "object" && "code" in error2 && error2.code === "EEXIST") {
|
|
107232
107417
|
continue;
|
|
@@ -107664,8 +107849,8 @@ async function buildProduction(options) {
|
|
|
107664
107849
|
const startTime = Date.now();
|
|
107665
107850
|
const normalizedOptions = normalizeBuildOptions(options);
|
|
107666
107851
|
try {
|
|
107667
|
-
const
|
|
107668
|
-
const exists2 = await
|
|
107852
|
+
const fs15 = createFileSystem();
|
|
107853
|
+
const exists2 = await fs15.exists(normalizedOptions.projectDir);
|
|
107669
107854
|
if (!exists2) {
|
|
107670
107855
|
throw new Error("Directory does not exist");
|
|
107671
107856
|
}
|
|
@@ -108396,11 +108581,11 @@ async function importModule(file, context2) {
|
|
|
108396
108581
|
if (transpileCache.has(cacheKey)) {
|
|
108397
108582
|
return transpileCache.get(cacheKey);
|
|
108398
108583
|
}
|
|
108399
|
-
const
|
|
108584
|
+
const fs15 = createFileSystem();
|
|
108400
108585
|
const filePath = file.replace("file://", "");
|
|
108401
108586
|
let source;
|
|
108402
108587
|
try {
|
|
108403
|
-
source = await
|
|
108588
|
+
source = await fs15.readTextFile(filePath);
|
|
108404
108589
|
} catch (error2) {
|
|
108405
108590
|
throw new Error(`Failed to read file ${filePath}: ${error2}`);
|
|
108406
108591
|
}
|
|
@@ -108451,21 +108636,21 @@ async function importModule(file, context2) {
|
|
|
108451
108636
|
throw new Error(`Failed to transpile ${filePath}: ${first}`);
|
|
108452
108637
|
}
|
|
108453
108638
|
const js = result.outputFiles?.[0]?.text ?? "export {}";
|
|
108454
|
-
const tempDir = await
|
|
108639
|
+
const tempDir = await fs15.makeTempDir({ prefix: "vf-discovery-" });
|
|
108455
108640
|
const tempFile = join4(tempDir, "module.mjs");
|
|
108456
108641
|
let transformedCode;
|
|
108457
108642
|
if (isDeno) {
|
|
108458
108643
|
transformedCode = rewriteForDeno(js, fileDir);
|
|
108459
108644
|
} else {
|
|
108460
|
-
transformedCode = await rewriteDiscoveryImports(js, context2.baseDir || ".",
|
|
108645
|
+
transformedCode = await rewriteDiscoveryImports(js, context2.baseDir || ".", fs15, fileDir);
|
|
108461
108646
|
}
|
|
108462
|
-
await
|
|
108647
|
+
await fs15.writeTextFile(tempFile, transformedCode);
|
|
108463
108648
|
try {
|
|
108464
108649
|
const module = await import(`file://${tempFile}?v=${Date.now()}`);
|
|
108465
108650
|
transpileCache.set(cacheKey, module);
|
|
108466
108651
|
return module;
|
|
108467
108652
|
} finally {
|
|
108468
|
-
await
|
|
108653
|
+
await fs15.remove(tempDir, { recursive: true });
|
|
108469
108654
|
}
|
|
108470
108655
|
}
|
|
108471
108656
|
function rewriteForDeno(code, fileDir) {
|
|
@@ -108490,7 +108675,7 @@ function rewriteForDeno(code, fileDir) {
|
|
|
108490
108675
|
);
|
|
108491
108676
|
return transformed;
|
|
108492
108677
|
}
|
|
108493
|
-
async function rewriteDiscoveryImports(code, projectDir,
|
|
108678
|
+
async function rewriteDiscoveryImports(code, projectDir, fs15, fileDir) {
|
|
108494
108679
|
let transformed = code;
|
|
108495
108680
|
try {
|
|
108496
108681
|
const { pathToFileURL: pathToFileURL2 } = await import("node:url");
|
|
@@ -108505,7 +108690,7 @@ async function rewriteDiscoveryImports(code, projectDir, fs14, fileDir) {
|
|
|
108505
108690
|
const packagePath = join4(projectDir, "node_modules", packageName);
|
|
108506
108691
|
const packageJsonPath = join4(packagePath, "package.json");
|
|
108507
108692
|
try {
|
|
108508
|
-
const pkgJson = JSON.parse(await
|
|
108693
|
+
const pkgJson = JSON.parse(await fs15.readTextFile(packageJsonPath));
|
|
108509
108694
|
let entryPoint;
|
|
108510
108695
|
if (pkgJson.exports) {
|
|
108511
108696
|
const dotExport = pkgJson.exports["."];
|
|
@@ -108560,7 +108745,7 @@ async function rewriteDiscoveryImports(code, projectDir, fs14, fileDir) {
|
|
|
108560
108745
|
const vfPackageJsonPath = join4(vfPackagePath, "package.json");
|
|
108561
108746
|
let exportsMap = {};
|
|
108562
108747
|
try {
|
|
108563
|
-
const pkgJson = JSON.parse(await
|
|
108748
|
+
const pkgJson = JSON.parse(await fs15.readTextFile(vfPackageJsonPath));
|
|
108564
108749
|
exportsMap = pkgJson.exports || {};
|
|
108565
108750
|
} catch {
|
|
108566
108751
|
}
|
|
@@ -108784,14 +108969,14 @@ async function findTypeScriptFiles(dir, context2) {
|
|
|
108784
108969
|
}
|
|
108785
108970
|
}
|
|
108786
108971
|
} else {
|
|
108787
|
-
const { fs:
|
|
108788
|
-
if (!
|
|
108972
|
+
const { fs: fs15, path } = await getNodeDeps(context2);
|
|
108973
|
+
if (!fs15 || !path) {
|
|
108789
108974
|
return files;
|
|
108790
108975
|
}
|
|
108791
|
-
if (!
|
|
108976
|
+
if (!fs15.existsSync(dir)) {
|
|
108792
108977
|
return files;
|
|
108793
108978
|
}
|
|
108794
|
-
const entries =
|
|
108979
|
+
const entries = fs15.readdirSync(dir, { withFileTypes: true });
|
|
108795
108980
|
for (const entry of entries) {
|
|
108796
108981
|
const filePath = path.join(dir, entry.name);
|
|
108797
108982
|
if (entry.isFile() && (entry.name.endsWith(".ts") || entry.name.endsWith(".tsx"))) {
|
|
@@ -108978,11 +109163,11 @@ async function detectProjectDir() {
|
|
|
108978
109163
|
const projectDir = cwd();
|
|
108979
109164
|
const configPath = join2(projectDir, "veryfront.config.ts");
|
|
108980
109165
|
const altConfigPath = join2(projectDir, "veryfront.config.js");
|
|
108981
|
-
const
|
|
108982
|
-
if (await
|
|
109166
|
+
const fs15 = createFileSystem();
|
|
109167
|
+
if (await fs15.exists(configPath)) {
|
|
108983
109168
|
return projectDir;
|
|
108984
109169
|
}
|
|
108985
|
-
if (await
|
|
109170
|
+
if (await fs15.exists(altConfigPath)) {
|
|
108986
109171
|
return projectDir;
|
|
108987
109172
|
}
|
|
108988
109173
|
cliLogger.debug("No veryfront config found, using defaults");
|
|
@@ -109005,10 +109190,497 @@ init_config();
|
|
|
109005
109190
|
init_utils();
|
|
109006
109191
|
init_veryfront_error();
|
|
109007
109192
|
init_fs();
|
|
109193
|
+
|
|
109194
|
+
// src/cli/commands/generate/integration-generator.ts
|
|
109195
|
+
init_std_path();
|
|
109196
|
+
init_console();
|
|
109197
|
+
init_utils();
|
|
109198
|
+
init_fs();
|
|
109199
|
+
init_process();
|
|
109008
109200
|
var fs13;
|
|
109201
|
+
function canRunPrompts() {
|
|
109202
|
+
const disablePrompt = getEnv("CI") === "1" || getEnv("DENO_TESTING") === "1";
|
|
109203
|
+
return !disablePrompt && isInteractive();
|
|
109204
|
+
}
|
|
109205
|
+
async function promptText(question, defaultValue) {
|
|
109206
|
+
const defaultHint = defaultValue ? dim3(` (${defaultValue})`) : "";
|
|
109207
|
+
console.log(`${cyan3("?")} ${question}${defaultHint}`);
|
|
109208
|
+
const buf = new Uint8Array(1024);
|
|
109209
|
+
if (typeof Deno !== "undefined") {
|
|
109210
|
+
const n48 = await Deno.stdin.read(buf);
|
|
109211
|
+
const input = new TextDecoder().decode(buf.subarray(0, n48 || 0)).trim();
|
|
109212
|
+
return input || defaultValue || "";
|
|
109213
|
+
} else {
|
|
109214
|
+
return new Promise((resolve6) => {
|
|
109215
|
+
const readline = __require2("readline");
|
|
109216
|
+
const rl = readline.createInterface({
|
|
109217
|
+
input: process.stdin,
|
|
109218
|
+
output: process.stdout
|
|
109219
|
+
});
|
|
109220
|
+
rl.question(" > ", (answer) => {
|
|
109221
|
+
rl.close();
|
|
109222
|
+
resolve6(answer.trim() || defaultValue || "");
|
|
109223
|
+
});
|
|
109224
|
+
});
|
|
109225
|
+
}
|
|
109226
|
+
}
|
|
109227
|
+
async function generateIntegration(projectDir, options = {}) {
|
|
109228
|
+
fs13 = createFileSystem();
|
|
109229
|
+
let config;
|
|
109230
|
+
if (options.skipPrompts || !canRunPrompts()) {
|
|
109231
|
+
if (!options.name || !options.displayName || !options.authType) {
|
|
109232
|
+
throw new Error(
|
|
109233
|
+
"Non-interactive mode requires --name, --display-name, and --auth-type options"
|
|
109234
|
+
);
|
|
109235
|
+
}
|
|
109236
|
+
config = {
|
|
109237
|
+
name: options.name.toLowerCase(),
|
|
109238
|
+
displayName: options.displayName,
|
|
109239
|
+
authType: options.authType,
|
|
109240
|
+
apiBaseUrl: options.apiBaseUrl || `https://api.${options.name}.com`,
|
|
109241
|
+
authorizationUrl: options.authorizationUrl,
|
|
109242
|
+
tokenUrl: options.tokenUrl,
|
|
109243
|
+
scopes: options.scopes?.split(",").map((s48) => s48.trim()) || [],
|
|
109244
|
+
envVarPrefix: options.name.toUpperCase()
|
|
109245
|
+
};
|
|
109246
|
+
} else {
|
|
109247
|
+
console.log("");
|
|
109248
|
+
console.log(green3("Integration Generator"));
|
|
109249
|
+
console.log("Let's create a new service integration.\n");
|
|
109250
|
+
const name = options.name || await promptText(
|
|
109251
|
+
"Integration name (lowercase, e.g., twilio, zendesk):"
|
|
109252
|
+
);
|
|
109253
|
+
if (!name || !/^[a-z][a-z0-9-]*$/.test(name)) {
|
|
109254
|
+
throw new Error("Integration name must be lowercase letters, numbers, and hyphens");
|
|
109255
|
+
}
|
|
109256
|
+
const displayName = options.displayName || await promptText(
|
|
109257
|
+
"Display name:",
|
|
109258
|
+
name.charAt(0).toUpperCase() + name.slice(1)
|
|
109259
|
+
);
|
|
109260
|
+
const authTypeChoice = options.authType || await select(
|
|
109261
|
+
"Authentication type:",
|
|
109262
|
+
[
|
|
109263
|
+
{ value: "oauth2", label: "OAuth 2.0", description: "For services with OAuth flow" },
|
|
109264
|
+
{ value: "api-key", label: "API Key", description: "For services with API key auth" }
|
|
109265
|
+
],
|
|
109266
|
+
0
|
|
109267
|
+
);
|
|
109268
|
+
const authType = authTypeChoice || "oauth2";
|
|
109269
|
+
const apiBaseUrl = options.apiBaseUrl || await promptText(
|
|
109270
|
+
"API base URL:",
|
|
109271
|
+
`https://api.${name}.com`
|
|
109272
|
+
);
|
|
109273
|
+
let authorizationUrl;
|
|
109274
|
+
let tokenUrl;
|
|
109275
|
+
let scopes = [];
|
|
109276
|
+
if (authType === "oauth2") {
|
|
109277
|
+
authorizationUrl = options.authorizationUrl || await promptText(
|
|
109278
|
+
"OAuth authorization URL:",
|
|
109279
|
+
`https://${name}.com/oauth/authorize`
|
|
109280
|
+
);
|
|
109281
|
+
tokenUrl = options.tokenUrl || await promptText(
|
|
109282
|
+
"OAuth token URL:",
|
|
109283
|
+
`https://${name}.com/oauth/token`
|
|
109284
|
+
);
|
|
109285
|
+
const scopesInput = options.scopes || await promptText(
|
|
109286
|
+
"OAuth scopes (comma-separated, or leave empty):"
|
|
109287
|
+
);
|
|
109288
|
+
scopes = scopesInput ? scopesInput.split(",").map((s48) => s48.trim()) : [];
|
|
109289
|
+
}
|
|
109290
|
+
config = {
|
|
109291
|
+
name,
|
|
109292
|
+
displayName,
|
|
109293
|
+
authType,
|
|
109294
|
+
apiBaseUrl,
|
|
109295
|
+
authorizationUrl,
|
|
109296
|
+
tokenUrl,
|
|
109297
|
+
scopes,
|
|
109298
|
+
envVarPrefix: name.toUpperCase().replace(/-/g, "_")
|
|
109299
|
+
};
|
|
109300
|
+
}
|
|
109301
|
+
await createIntegrationFiles(projectDir, config);
|
|
109302
|
+
console.log("");
|
|
109303
|
+
console.log(green3("Integration created successfully!"));
|
|
109304
|
+
console.log("");
|
|
109305
|
+
console.log("Files created:");
|
|
109306
|
+
console.log(` ${cyan3("ai/integrations/" + config.name + "/")} - Integration directory`);
|
|
109307
|
+
console.log("");
|
|
109308
|
+
console.log("Next steps:");
|
|
109309
|
+
console.log(` 1. Add your ${config.envVarPrefix}_* environment variables to .env`);
|
|
109310
|
+
if (config.authType === "oauth2") {
|
|
109311
|
+
console.log(` 2. Configure OAuth app in ${config.displayName} developer portal`);
|
|
109312
|
+
console.log(` 3. Set callback URL to: /api/auth/${config.name}/callback`);
|
|
109313
|
+
}
|
|
109314
|
+
console.log(` 4. Customize the generated tools in ai/integrations/${config.name}/tools/`);
|
|
109315
|
+
console.log("");
|
|
109316
|
+
}
|
|
109317
|
+
async function createIntegrationFiles(projectDir, config) {
|
|
109318
|
+
const baseDir = join2(projectDir, "ai", "integrations", config.name);
|
|
109319
|
+
await ensureDir2(baseDir);
|
|
109320
|
+
await ensureDir2(join2(baseDir, "lib"));
|
|
109321
|
+
await ensureDir2(join2(baseDir, "tools"));
|
|
109322
|
+
if (config.authType === "oauth2") {
|
|
109323
|
+
await ensureDir2(join2(projectDir, "app", "api", "auth", config.name));
|
|
109324
|
+
await ensureDir2(join2(projectDir, "app", "api", "auth", config.name, "callback"));
|
|
109325
|
+
}
|
|
109326
|
+
if (config.authType === "oauth2") {
|
|
109327
|
+
await createOAuth2Files(projectDir, baseDir, config);
|
|
109328
|
+
} else {
|
|
109329
|
+
await createApiKeyFiles(projectDir, baseDir, config);
|
|
109330
|
+
}
|
|
109331
|
+
await createClientFile(baseDir, config);
|
|
109332
|
+
await createToolSkeletons(baseDir, config);
|
|
109333
|
+
await createEnvExample(projectDir, config);
|
|
109334
|
+
}
|
|
109335
|
+
async function createOAuth2Files(projectDir, baseDir, config) {
|
|
109336
|
+
const tokenStore = `/**
|
|
109337
|
+
* Token storage for ${config.displayName} OAuth
|
|
109338
|
+
*/
|
|
109339
|
+
|
|
109340
|
+
interface TokenData {
|
|
109341
|
+
accessToken: string;
|
|
109342
|
+
refreshToken?: string;
|
|
109343
|
+
expiresAt?: number;
|
|
109344
|
+
}
|
|
109345
|
+
|
|
109346
|
+
let tokenData: TokenData | null = null;
|
|
109347
|
+
|
|
109348
|
+
export function setTokens(access: string, refresh?: string, expiresIn?: number): void {
|
|
109349
|
+
tokenData = {
|
|
109350
|
+
accessToken: access,
|
|
109351
|
+
refreshToken: refresh,
|
|
109352
|
+
expiresAt: expiresIn ? Date.now() + expiresIn * 1000 : undefined,
|
|
109353
|
+
};
|
|
109354
|
+
}
|
|
109355
|
+
|
|
109356
|
+
export async function getAccessToken(): Promise<string | null> {
|
|
109357
|
+
if (!tokenData) return null;
|
|
109358
|
+
|
|
109359
|
+
// Check if token is expired
|
|
109360
|
+
if (tokenData.expiresAt && Date.now() > tokenData.expiresAt) {
|
|
109361
|
+
// TODO: Implement token refresh
|
|
109362
|
+
return null;
|
|
109363
|
+
}
|
|
109364
|
+
|
|
109365
|
+
return tokenData.accessToken;
|
|
109366
|
+
}
|
|
109367
|
+
|
|
109368
|
+
export function clearTokens(): void {
|
|
109369
|
+
tokenData = null;
|
|
109370
|
+
}
|
|
109371
|
+
`;
|
|
109372
|
+
await fs13.writeTextFile(join2(baseDir, "lib", "token-store.ts"), tokenStore);
|
|
109373
|
+
cliLogger.debug(`Created ${join2(baseDir, "lib", "token-store.ts")}`);
|
|
109374
|
+
const oauthRoute = `/**
|
|
109375
|
+
* ${config.displayName} OAuth initialization route
|
|
109376
|
+
*/
|
|
109377
|
+
|
|
109378
|
+
import { redirect } from "veryfront";
|
|
109379
|
+
|
|
109380
|
+
export function GET(): Response {
|
|
109381
|
+
const clientId = process.env.${config.envVarPrefix}_CLIENT_ID;
|
|
109382
|
+
|
|
109383
|
+
if (!clientId) {
|
|
109384
|
+
return Response.json(
|
|
109385
|
+
{ error: "${config.envVarPrefix}_CLIENT_ID not configured" },
|
|
109386
|
+
{ status: 500 }
|
|
109387
|
+
);
|
|
109388
|
+
}
|
|
109389
|
+
|
|
109390
|
+
const redirectUri = \`\${process.env.NEXT_PUBLIC_APP_URL || "http://localhost:3002"}/api/auth/${config.name}/callback\`;
|
|
109391
|
+
const state = crypto.randomUUID();
|
|
109392
|
+
|
|
109393
|
+
const params = new URLSearchParams({
|
|
109394
|
+
client_id: clientId,
|
|
109395
|
+
redirect_uri: redirectUri,
|
|
109396
|
+
response_type: "code",
|
|
109397
|
+
state,
|
|
109398
|
+
${config.scopes.length > 0 ? `scope: "${config.scopes.join(" ")}",` : '// scope: "read write",'}
|
|
109399
|
+
});
|
|
109400
|
+
|
|
109401
|
+
return redirect(\`${config.authorizationUrl}?\${params}\`);
|
|
109402
|
+
}
|
|
109403
|
+
`;
|
|
109404
|
+
await fs13.writeTextFile(
|
|
109405
|
+
join2(projectDir, "app", "api", "auth", config.name, "route.ts"),
|
|
109406
|
+
oauthRoute
|
|
109407
|
+
);
|
|
109408
|
+
cliLogger.debug(`Created OAuth init route`);
|
|
109409
|
+
const callbackRoute = `/**
|
|
109410
|
+
* ${config.displayName} OAuth callback route
|
|
109411
|
+
*/
|
|
109412
|
+
|
|
109413
|
+
import { redirect } from "veryfront";
|
|
109414
|
+
import { setTokens } from "../../../../ai/integrations/${config.name}/lib/token-store.ts";
|
|
109415
|
+
|
|
109416
|
+
export async function GET(request: Request): Promise<Response> {
|
|
109417
|
+
const url = new URL(request.url);
|
|
109418
|
+
const code = url.searchParams.get("code");
|
|
109419
|
+
const error = url.searchParams.get("error");
|
|
109420
|
+
|
|
109421
|
+
if (error) {
|
|
109422
|
+
console.error("${config.displayName} OAuth error:", error);
|
|
109423
|
+
return redirect("/?error=" + encodeURIComponent(error));
|
|
109424
|
+
}
|
|
109425
|
+
|
|
109426
|
+
if (!code) {
|
|
109427
|
+
return redirect("/?error=no_code");
|
|
109428
|
+
}
|
|
109429
|
+
|
|
109430
|
+
const clientId = process.env.${config.envVarPrefix}_CLIENT_ID;
|
|
109431
|
+
const clientSecret = process.env.${config.envVarPrefix}_CLIENT_SECRET;
|
|
109432
|
+
const redirectUri = \`\${process.env.NEXT_PUBLIC_APP_URL || "http://localhost:3002"}/api/auth/${config.name}/callback\`;
|
|
109433
|
+
|
|
109434
|
+
try {
|
|
109435
|
+
const response = await fetch("${config.tokenUrl}", {
|
|
109436
|
+
method: "POST",
|
|
109437
|
+
headers: {
|
|
109438
|
+
"Content-Type": "application/x-www-form-urlencoded",
|
|
109439
|
+
},
|
|
109440
|
+
body: new URLSearchParams({
|
|
109441
|
+
grant_type: "authorization_code",
|
|
109442
|
+
code,
|
|
109443
|
+
client_id: clientId!,
|
|
109444
|
+
client_secret: clientSecret!,
|
|
109445
|
+
redirect_uri: redirectUri,
|
|
109446
|
+
}),
|
|
109447
|
+
});
|
|
109448
|
+
|
|
109449
|
+
if (!response.ok) {
|
|
109450
|
+
const errorData = await response.text();
|
|
109451
|
+
console.error("Token exchange failed:", errorData);
|
|
109452
|
+
return redirect("/?error=token_exchange_failed");
|
|
109453
|
+
}
|
|
109454
|
+
|
|
109455
|
+
const data = await response.json();
|
|
109456
|
+
setTokens(data.access_token, data.refresh_token, data.expires_in);
|
|
109457
|
+
|
|
109458
|
+
return redirect("/?connected=${config.name}");
|
|
109459
|
+
} catch (err) {
|
|
109460
|
+
console.error("OAuth callback error:", err);
|
|
109461
|
+
return redirect("/?error=callback_failed");
|
|
109462
|
+
}
|
|
109463
|
+
}
|
|
109464
|
+
`;
|
|
109465
|
+
await fs13.writeTextFile(
|
|
109466
|
+
join2(projectDir, "app", "api", "auth", config.name, "callback", "route.ts"),
|
|
109467
|
+
callbackRoute
|
|
109468
|
+
);
|
|
109469
|
+
cliLogger.debug(`Created OAuth callback route`);
|
|
109470
|
+
}
|
|
109471
|
+
async function createApiKeyFiles(_projectDir, baseDir, config) {
|
|
109472
|
+
const tokenStore = `/**
|
|
109473
|
+
* API key accessor for ${config.displayName}
|
|
109474
|
+
*/
|
|
109475
|
+
|
|
109476
|
+
export function getApiKey(): string | null {
|
|
109477
|
+
return process.env.${config.envVarPrefix}_API_KEY || null;
|
|
109478
|
+
}
|
|
109479
|
+
|
|
109480
|
+
export function requireApiKey(): string {
|
|
109481
|
+
const key = getApiKey();
|
|
109482
|
+
if (!key) {
|
|
109483
|
+
throw new Error("${config.envVarPrefix}_API_KEY not configured");
|
|
109484
|
+
}
|
|
109485
|
+
return key;
|
|
109486
|
+
}
|
|
109487
|
+
`;
|
|
109488
|
+
await fs13.writeTextFile(join2(baseDir, "lib", "token-store.ts"), tokenStore);
|
|
109489
|
+
cliLogger.debug(`Created ${join2(baseDir, "lib", "token-store.ts")}`);
|
|
109490
|
+
}
|
|
109491
|
+
async function createClientFile(baseDir, config) {
|
|
109492
|
+
const authHeader = config.authType === "oauth2" ? `"Authorization": \`Bearer \${token}\`` : `"Authorization": \`Bearer \${apiKey}\``;
|
|
109493
|
+
const tokenImport = config.authType === "oauth2" ? `import { getAccessToken } from "./token-store.ts";` : `import { requireApiKey } from "./token-store.ts";`;
|
|
109494
|
+
const tokenCheck = config.authType === "oauth2" ? `const token = await getAccessToken();
|
|
109495
|
+
if (!token) {
|
|
109496
|
+
throw new Error("Not authenticated with ${config.displayName}. Please connect your account.");
|
|
109497
|
+
}` : `const apiKey = requireApiKey();`;
|
|
109498
|
+
const client = `/**
|
|
109499
|
+
* ${config.displayName} API Client
|
|
109500
|
+
*/
|
|
109501
|
+
|
|
109502
|
+
${tokenImport}
|
|
109503
|
+
|
|
109504
|
+
const API_BASE_URL = "${config.apiBaseUrl}";
|
|
109505
|
+
|
|
109506
|
+
interface ${config.displayName}Response<T> {
|
|
109507
|
+
data?: T;
|
|
109508
|
+
error?: string;
|
|
109509
|
+
}
|
|
109510
|
+
|
|
109511
|
+
/**
|
|
109512
|
+
* Make an authenticated request to the ${config.displayName} API
|
|
109513
|
+
*/
|
|
109514
|
+
async function ${config.name}Fetch<T>(
|
|
109515
|
+
endpoint: string,
|
|
109516
|
+
options: RequestInit = {}
|
|
109517
|
+
): Promise<T> {
|
|
109518
|
+
${tokenCheck}
|
|
109519
|
+
|
|
109520
|
+
const response = await fetch(\`\${API_BASE_URL}\${endpoint}\`, {
|
|
109521
|
+
...options,
|
|
109522
|
+
headers: {
|
|
109523
|
+
${authHeader},
|
|
109524
|
+
"Content-Type": "application/json",
|
|
109525
|
+
...options.headers,
|
|
109526
|
+
},
|
|
109527
|
+
});
|
|
109528
|
+
|
|
109529
|
+
if (!response.ok) {
|
|
109530
|
+
const error = await response.text();
|
|
109531
|
+
throw new Error(\`${config.displayName} API error: \${response.status} \${error}\`);
|
|
109532
|
+
}
|
|
109533
|
+
|
|
109534
|
+
return response.json();
|
|
109535
|
+
}
|
|
109536
|
+
|
|
109537
|
+
// ============================================================================
|
|
109538
|
+
// API Methods - Customize these for your integration
|
|
109539
|
+
// ============================================================================
|
|
109540
|
+
|
|
109541
|
+
/**
|
|
109542
|
+
* List items from ${config.displayName}
|
|
109543
|
+
*/
|
|
109544
|
+
export async function listItems(options?: {
|
|
109545
|
+
limit?: number;
|
|
109546
|
+
offset?: number;
|
|
109547
|
+
}): Promise<unknown[]> {
|
|
109548
|
+
const params = new URLSearchParams();
|
|
109549
|
+
if (options?.limit) params.set("limit", String(options.limit));
|
|
109550
|
+
if (options?.offset) params.set("offset", String(options.offset));
|
|
109551
|
+
|
|
109552
|
+
const query = params.toString() ? \`?\${params}\` : "";
|
|
109553
|
+
return ${config.name}Fetch<unknown[]>(\`/items\${query}\`);
|
|
109554
|
+
}
|
|
109555
|
+
|
|
109556
|
+
/**
|
|
109557
|
+
* Get a single item by ID
|
|
109558
|
+
*/
|
|
109559
|
+
export async function getItem(id: string): Promise<unknown> {
|
|
109560
|
+
return ${config.name}Fetch<unknown>(\`/items/\${id}\`);
|
|
109561
|
+
}
|
|
109562
|
+
|
|
109563
|
+
/**
|
|
109564
|
+
* Create a new item
|
|
109565
|
+
*/
|
|
109566
|
+
export async function createItem(data: Record<string, unknown>): Promise<unknown> {
|
|
109567
|
+
return ${config.name}Fetch<unknown>("/items", {
|
|
109568
|
+
method: "POST",
|
|
109569
|
+
body: JSON.stringify(data),
|
|
109570
|
+
});
|
|
109571
|
+
}
|
|
109572
|
+
|
|
109573
|
+
/**
|
|
109574
|
+
* Search items
|
|
109575
|
+
*/
|
|
109576
|
+
export async function searchItems(query: string): Promise<unknown[]> {
|
|
109577
|
+
return ${config.name}Fetch<unknown[]>(\`/search?q=\${encodeURIComponent(query)}\`);
|
|
109578
|
+
}
|
|
109579
|
+
`;
|
|
109580
|
+
await fs13.writeTextFile(join2(baseDir, "lib", `${config.name}-client.ts`), client);
|
|
109581
|
+
cliLogger.debug(`Created API client`);
|
|
109582
|
+
}
|
|
109583
|
+
async function createToolSkeletons(baseDir, config) {
|
|
109584
|
+
const tools = [
|
|
109585
|
+
{
|
|
109586
|
+
id: `list-${config.name}-items`,
|
|
109587
|
+
name: `List ${config.displayName} Items`,
|
|
109588
|
+
description: `List items from ${config.displayName}`,
|
|
109589
|
+
file: "list-items.ts"
|
|
109590
|
+
},
|
|
109591
|
+
{
|
|
109592
|
+
id: `get-${config.name}-item`,
|
|
109593
|
+
name: `Get ${config.displayName} Item`,
|
|
109594
|
+
description: `Get a specific item from ${config.displayName}`,
|
|
109595
|
+
file: "get-item.ts"
|
|
109596
|
+
},
|
|
109597
|
+
{
|
|
109598
|
+
id: `search-${config.name}`,
|
|
109599
|
+
name: `Search ${config.displayName}`,
|
|
109600
|
+
description: `Search for items in ${config.displayName}`,
|
|
109601
|
+
file: "search.ts"
|
|
109602
|
+
}
|
|
109603
|
+
];
|
|
109604
|
+
for (const tool of tools) {
|
|
109605
|
+
const toolContent = `/**
|
|
109606
|
+
* ${tool.name}
|
|
109607
|
+
*/
|
|
109608
|
+
|
|
109609
|
+
import { tool } from "veryfront/ai";
|
|
109610
|
+
import { z } from "zod";
|
|
109611
|
+
import { listItems, getItem, searchItems } from "../lib/${config.name}-client.ts";
|
|
109612
|
+
|
|
109613
|
+
export default tool({
|
|
109614
|
+
id: "${tool.id}",
|
|
109615
|
+
description: "${tool.description}",
|
|
109616
|
+
inputSchema: z.object({
|
|
109617
|
+
${tool.file === "list-items.ts" ? `limit: z.number().optional().describe("Maximum number of items to return"),
|
|
109618
|
+
offset: z.number().optional().describe("Number of items to skip"),` : ""}
|
|
109619
|
+
${tool.file === "get-item.ts" ? `id: z.string().describe("The ID of the item to retrieve"),` : ""}
|
|
109620
|
+
${tool.file === "search.ts" ? `query: z.string().describe("Search query"),` : ""}
|
|
109621
|
+
}),
|
|
109622
|
+
execute: async (input) => {
|
|
109623
|
+
try {
|
|
109624
|
+
${tool.file === "list-items.ts" ? `const items = await listItems({
|
|
109625
|
+
limit: input.limit,
|
|
109626
|
+
offset: input.offset,
|
|
109627
|
+
});
|
|
109628
|
+
return {
|
|
109629
|
+
success: true,
|
|
109630
|
+
items,
|
|
109631
|
+
count: items.length,
|
|
109632
|
+
};` : ""}
|
|
109633
|
+
${tool.file === "get-item.ts" ? `const item = await getItem(input.id);
|
|
109634
|
+
return {
|
|
109635
|
+
success: true,
|
|
109636
|
+
item,
|
|
109637
|
+
};` : ""}
|
|
109638
|
+
${tool.file === "search.ts" ? `const results = await searchItems(input.query);
|
|
109639
|
+
return {
|
|
109640
|
+
success: true,
|
|
109641
|
+
results,
|
|
109642
|
+
count: results.length,
|
|
109643
|
+
};` : ""}
|
|
109644
|
+
} catch (error) {
|
|
109645
|
+
return {
|
|
109646
|
+
success: false,
|
|
109647
|
+
error: error instanceof Error ? error.message : "Unknown error",
|
|
109648
|
+
};
|
|
109649
|
+
}
|
|
109650
|
+
},
|
|
109651
|
+
});
|
|
109652
|
+
`;
|
|
109653
|
+
await fs13.writeTextFile(join2(baseDir, "tools", tool.file), toolContent);
|
|
109654
|
+
cliLogger.debug(`Created tool: ${tool.file}`);
|
|
109655
|
+
}
|
|
109656
|
+
}
|
|
109657
|
+
async function createEnvExample(projectDir, config) {
|
|
109658
|
+
const envExamplePath = join2(projectDir, ".env.example");
|
|
109659
|
+
let envContent;
|
|
109660
|
+
if (config.authType === "oauth2") {
|
|
109661
|
+
envContent = `
|
|
109662
|
+
# ${config.displayName} OAuth
|
|
109663
|
+
${config.envVarPrefix}_CLIENT_ID=your_client_id
|
|
109664
|
+
${config.envVarPrefix}_CLIENT_SECRET=your_client_secret
|
|
109665
|
+
`;
|
|
109666
|
+
} else {
|
|
109667
|
+
envContent = `
|
|
109668
|
+
# ${config.displayName} API
|
|
109669
|
+
${config.envVarPrefix}_API_KEY=your_api_key
|
|
109670
|
+
`;
|
|
109671
|
+
}
|
|
109672
|
+
try {
|
|
109673
|
+
const existing = await fs13.readTextFile(envExamplePath);
|
|
109674
|
+
if (!existing.includes(config.envVarPrefix)) {
|
|
109675
|
+
await fs13.writeTextFile(envExamplePath, existing + envContent);
|
|
109676
|
+
cliLogger.debug(`Updated .env.example`);
|
|
109677
|
+
}
|
|
109678
|
+
} catch {
|
|
109679
|
+
await fs13.writeTextFile(envExamplePath, `# Environment Variables${envContent}`);
|
|
109680
|
+
cliLogger.debug(`Created .env.example`);
|
|
109681
|
+
}
|
|
109682
|
+
}
|
|
109009
109683
|
async function ensureDir2(path) {
|
|
109010
|
-
if (!fs13)
|
|
109011
|
-
fs13 = createFileSystem();
|
|
109012
109684
|
try {
|
|
109013
109685
|
await fs13.mkdir(path, { recursive: true });
|
|
109014
109686
|
} catch (error2) {
|
|
@@ -109019,11 +109691,27 @@ async function ensureDir2(path) {
|
|
|
109019
109691
|
}
|
|
109020
109692
|
}
|
|
109021
109693
|
}
|
|
109694
|
+
|
|
109695
|
+
// src/cli/commands/generate.ts
|
|
109696
|
+
var fs14;
|
|
109697
|
+
async function ensureDir3(path) {
|
|
109698
|
+
if (!fs14)
|
|
109699
|
+
fs14 = createFileSystem();
|
|
109700
|
+
try {
|
|
109701
|
+
await fs14.mkdir(path, { recursive: true });
|
|
109702
|
+
} catch (error2) {
|
|
109703
|
+
const code = error2?.code;
|
|
109704
|
+
const isAlreadyExists = code === "EEXIST" || typeof Deno !== "undefined" && error2 instanceof Deno.errors.AlreadyExists;
|
|
109705
|
+
if (!isAlreadyExists) {
|
|
109706
|
+
throw error2;
|
|
109707
|
+
}
|
|
109708
|
+
}
|
|
109709
|
+
}
|
|
109022
109710
|
function toSlug(name) {
|
|
109023
109711
|
return name.replace(/\s+/g, "-").replace(/[^a-zA-Z0-9_\-[\]/]/g, "").replace(/\/+/g, "/");
|
|
109024
109712
|
}
|
|
109025
109713
|
async function generateCommand(projectDir, type, name) {
|
|
109026
|
-
|
|
109714
|
+
fs14 = createFileSystem();
|
|
109027
109715
|
let preferred = "pages-router";
|
|
109028
109716
|
try {
|
|
109029
109717
|
const { getAdapter: getAdapter2 } = await Promise.resolve().then(() => (init_detect(), detect_exports));
|
|
@@ -109039,7 +109727,7 @@ async function generateCommand(projectDir, type, name) {
|
|
|
109039
109727
|
switch (type) {
|
|
109040
109728
|
case "rsc": {
|
|
109041
109729
|
const dir = join2(projectDir, "app", slug || "");
|
|
109042
|
-
await
|
|
109730
|
+
await ensureDir3(dir);
|
|
109043
109731
|
const file = join2(dir, "page.tsx");
|
|
109044
109732
|
const title = slug.split("/").pop() || "RSC";
|
|
109045
109733
|
const content = `export default function ${toComponentName(title)}(){
|
|
@@ -109052,7 +109740,7 @@ async function generateCommand(projectDir, type, name) {
|
|
|
109052
109740
|
);
|
|
109053
109741
|
}
|
|
109054
109742
|
`;
|
|
109055
|
-
await
|
|
109743
|
+
await fs14.writeTextFile(file, content);
|
|
109056
109744
|
cliLogger.info(`Created ${file}`);
|
|
109057
109745
|
break;
|
|
109058
109746
|
}
|
|
@@ -109060,20 +109748,20 @@ async function generateCommand(projectDir, type, name) {
|
|
|
109060
109748
|
const isApp = preferred === "app-router";
|
|
109061
109749
|
if (isApp) {
|
|
109062
109750
|
const pageDir = join2(projectDir, "app", slug || "");
|
|
109063
|
-
await
|
|
109751
|
+
await ensureDir3(pageDir);
|
|
109064
109752
|
const file2 = join2(pageDir, "page.tsx");
|
|
109065
109753
|
const title2 = slug.split("/").pop() || "Page";
|
|
109066
109754
|
const content2 = `export default function ${toComponentName(
|
|
109067
109755
|
title2
|
|
109068
109756
|
)}(){ return <div>${title2}</div>; }
|
|
109069
109757
|
`;
|
|
109070
|
-
await
|
|
109758
|
+
await fs14.writeTextFile(file2, content2);
|
|
109071
109759
|
cliLogger.info(`Created ${file2}`);
|
|
109072
109760
|
break;
|
|
109073
109761
|
}
|
|
109074
109762
|
const subdir = slug.includes("/") ? slug.split("/").slice(0, -1).join("/") : "";
|
|
109075
109763
|
const base = join2(projectDir, "pages");
|
|
109076
|
-
await
|
|
109764
|
+
await ensureDir3(base + (subdir ? `/${subdir}` : ""));
|
|
109077
109765
|
const fname = `${slug.split("/").pop() || "index"}.mdx`;
|
|
109078
109766
|
const file = join2(base, subdir ? `${subdir}/${fname}` : fname);
|
|
109079
109767
|
const title = slug.split("/").pop() || "Page";
|
|
@@ -109085,22 +109773,22 @@ title: ${title}
|
|
|
109085
109773
|
|
|
109086
109774
|
This is a new page.
|
|
109087
109775
|
`;
|
|
109088
|
-
await
|
|
109776
|
+
await fs14.writeTextFile(file, content);
|
|
109089
109777
|
cliLogger.info(`Created ${file}`);
|
|
109090
109778
|
break;
|
|
109091
109779
|
}
|
|
109092
109780
|
case "layout": {
|
|
109093
109781
|
if (preferred === "app-router") {
|
|
109094
109782
|
const dir = join2(projectDir, "app", slug || "");
|
|
109095
|
-
await
|
|
109783
|
+
await ensureDir3(dir);
|
|
109096
109784
|
const file = join2(dir, `layout.tsx`);
|
|
109097
109785
|
const content = `export default function Layout({ children }: { children: React.ReactNode }){ return (<section>${slug || "root"}{children}</section>); }
|
|
109098
109786
|
`;
|
|
109099
|
-
await
|
|
109787
|
+
await fs14.writeTextFile(file, content);
|
|
109100
109788
|
cliLogger.info(`Created ${file}`);
|
|
109101
109789
|
} else {
|
|
109102
109790
|
const dir = join2(projectDir, "layouts");
|
|
109103
|
-
await
|
|
109791
|
+
await ensureDir3(dir);
|
|
109104
109792
|
const file = join2(dir, `${slug}.mdx`);
|
|
109105
109793
|
const content = `---
|
|
109106
109794
|
isLayout: true
|
|
@@ -109112,14 +109800,14 @@ export default function ${toComponentName(
|
|
|
109112
109800
|
return (<div className="${slug}-layout"><main>{children}</main></div>);
|
|
109113
109801
|
}
|
|
109114
109802
|
`;
|
|
109115
|
-
await
|
|
109803
|
+
await fs14.writeTextFile(file, content);
|
|
109116
109804
|
cliLogger.info(`Created ${file}`);
|
|
109117
109805
|
}
|
|
109118
109806
|
break;
|
|
109119
109807
|
}
|
|
109120
109808
|
case "provider": {
|
|
109121
109809
|
const dir = join2(projectDir, "providers");
|
|
109122
|
-
await
|
|
109810
|
+
await ensureDir3(dir);
|
|
109123
109811
|
const file = join2(dir, `${slug}.mdx`);
|
|
109124
109812
|
const content = `---
|
|
109125
109813
|
isProvider: true
|
|
@@ -109132,7 +109820,7 @@ export default function ${toComponentName(
|
|
|
109132
109820
|
return (<div className="${slug}-provider">{children}</div>);
|
|
109133
109821
|
}
|
|
109134
109822
|
`;
|
|
109135
|
-
await
|
|
109823
|
+
await fs14.writeTextFile(file, content);
|
|
109136
109824
|
cliLogger.info(`Created ${file}`);
|
|
109137
109825
|
break;
|
|
109138
109826
|
}
|
|
@@ -109140,27 +109828,31 @@ export default function ${toComponentName(
|
|
|
109140
109828
|
const isApp = preferred === "app-router";
|
|
109141
109829
|
if (isApp) {
|
|
109142
109830
|
const routeDir = join2(projectDir, "app", slug || "");
|
|
109143
|
-
await
|
|
109831
|
+
await ensureDir3(routeDir);
|
|
109144
109832
|
const file2 = join2(routeDir, "route.ts");
|
|
109145
109833
|
const content2 = `export const GET = (_req: Request) => Response.json({ ok: true });
|
|
109146
109834
|
`;
|
|
109147
|
-
await
|
|
109835
|
+
await fs14.writeTextFile(file2, content2);
|
|
109148
109836
|
cliLogger.info(`Created ${file2}`);
|
|
109149
109837
|
break;
|
|
109150
109838
|
}
|
|
109151
109839
|
const subdir = slug.includes("/") ? slug.split("/").slice(0, -1).join("/") : "";
|
|
109152
109840
|
const apiBase = join2(projectDir, "pages", "api");
|
|
109153
|
-
await
|
|
109841
|
+
await ensureDir3(apiBase + (subdir ? `/${subdir}` : ""));
|
|
109154
109842
|
const fname = `${slug.split("/").pop() || "index"}.ts`;
|
|
109155
109843
|
const file = join2(apiBase, subdir ? `${subdir}/${fname}` : fname);
|
|
109156
109844
|
const content = `export function GET(_req: Request) {
|
|
109157
109845
|
return new Response(JSON.stringify({ ok: true }), { headers: { 'content-type': 'application/json' } });
|
|
109158
109846
|
}
|
|
109159
109847
|
`;
|
|
109160
|
-
await
|
|
109848
|
+
await fs14.writeTextFile(file, content);
|
|
109161
109849
|
cliLogger.info(`Created ${file}`);
|
|
109162
109850
|
break;
|
|
109163
109851
|
}
|
|
109852
|
+
case "integration": {
|
|
109853
|
+
await generateIntegration(projectDir, { name: name || void 0 });
|
|
109854
|
+
break;
|
|
109855
|
+
}
|
|
109164
109856
|
default:
|
|
109165
109857
|
throw toError(createError({
|
|
109166
109858
|
type: "config",
|
|
@@ -109197,9 +109889,17 @@ var COMMANDS = {
|
|
|
109197
109889
|
flag: "--integrations <list>",
|
|
109198
109890
|
description: "Service integrations for AI template (gmail,slack,github,calendar)"
|
|
109199
109891
|
},
|
|
109892
|
+
{
|
|
109893
|
+
flag: "-c, --config <file>",
|
|
109894
|
+
description: "JSON config file for programmatic scaffolding"
|
|
109895
|
+
},
|
|
109200
109896
|
{
|
|
109201
109897
|
flag: "--skip-install",
|
|
109202
109898
|
description: "Skip automatic dependency installation"
|
|
109899
|
+
},
|
|
109900
|
+
{
|
|
109901
|
+
flag: "--skip-env-prompt",
|
|
109902
|
+
description: "Skip environment variable prompts"
|
|
109203
109903
|
}
|
|
109204
109904
|
],
|
|
109205
109905
|
examples: [
|
|
@@ -109207,11 +109907,14 @@ var COMMANDS = {
|
|
|
109207
109907
|
"veryfront init my-app",
|
|
109208
109908
|
"veryfront init my-agent --template ai --integrations gmail,slack",
|
|
109209
109909
|
"veryfront init my-blog --template blog",
|
|
109210
|
-
"veryfront init my-docs --template docs"
|
|
109910
|
+
"veryfront init my-docs --template docs",
|
|
109911
|
+
"veryfront init --config project.json # From config file"
|
|
109211
109912
|
],
|
|
109212
109913
|
notes: [
|
|
109213
109914
|
"Run without arguments for interactive wizard",
|
|
109214
|
-
"Using --integrations implies --template ai"
|
|
109915
|
+
"Using --integrations implies --template ai",
|
|
109916
|
+
"Config file supports: name, template, integrations, skipInstall, skipEnvPrompt, env",
|
|
109917
|
+
"Use env object to pre-fill credentials: { env: { GOOGLE_CLIENT_ID: '...', ... } }"
|
|
109215
109918
|
]
|
|
109216
109919
|
},
|
|
109217
109920
|
dev: {
|
|
@@ -109382,13 +110085,19 @@ var COMMANDS = {
|
|
|
109382
110085
|
generate: {
|
|
109383
110086
|
name: "generate",
|
|
109384
110087
|
description: "Generate code scaffolds",
|
|
109385
|
-
usage: "veryfront generate <type>
|
|
110088
|
+
usage: "veryfront generate <type> [name]",
|
|
109386
110089
|
options: [],
|
|
109387
110090
|
examples: [
|
|
109388
110091
|
"veryfront generate page about",
|
|
109389
110092
|
"veryfront generate layout admin",
|
|
109390
110093
|
"veryfront generate api users/[id]",
|
|
109391
|
-
"veryfront generate provider auth"
|
|
110094
|
+
"veryfront generate provider auth",
|
|
110095
|
+
"veryfront generate integration # Interactive wizard",
|
|
110096
|
+
"veryfront generate integration twilio # With name preset"
|
|
110097
|
+
],
|
|
110098
|
+
notes: [
|
|
110099
|
+
"Types: page, layout, provider, api, integration",
|
|
110100
|
+
"Integration type launches interactive wizard if name not provided"
|
|
109392
110101
|
]
|
|
109393
110102
|
}
|
|
109394
110103
|
};
|
|
@@ -109558,7 +110267,11 @@ init_process();
|
|
|
109558
110267
|
async function handleGenerateCommand(args) {
|
|
109559
110268
|
const type = args._[1];
|
|
109560
110269
|
const name = args._[2];
|
|
109561
|
-
const validTypes = ["page", "layout", "provider", "api"];
|
|
110270
|
+
const validTypes = ["page", "layout", "provider", "api", "integration"];
|
|
110271
|
+
if (type === "integration") {
|
|
110272
|
+
await generateCommand(cwd(), type, name || "");
|
|
110273
|
+
return;
|
|
110274
|
+
}
|
|
109562
110275
|
if (!type || !name || !validTypes.includes(type)) {
|
|
109563
110276
|
showCommandHelp("generate");
|
|
109564
110277
|
exitProcess(2);
|
|
@@ -109569,6 +110282,7 @@ async function handleGenerateCommand(args) {
|
|
|
109569
110282
|
|
|
109570
110283
|
// src/cli/index/command-router.ts
|
|
109571
110284
|
init_process();
|
|
110285
|
+
init_fs();
|
|
109572
110286
|
init_console();
|
|
109573
110287
|
function showBasicHelp(command) {
|
|
109574
110288
|
if (command && COMMANDS[command]) {
|
|
@@ -109644,9 +110358,35 @@ async function routeCommand(args) {
|
|
|
109644
110358
|
try {
|
|
109645
110359
|
switch (command) {
|
|
109646
110360
|
case "init": {
|
|
109647
|
-
|
|
109648
|
-
|
|
110361
|
+
let name = args._[1];
|
|
110362
|
+
let template = args.t || args.template;
|
|
109649
110363
|
let integrations;
|
|
110364
|
+
let skipInstall = Boolean(args["skip-install"]);
|
|
110365
|
+
let skipEnvPrompt = Boolean(args["skip-env-prompt"]);
|
|
110366
|
+
let env2;
|
|
110367
|
+
const configPath = args.config || args.c;
|
|
110368
|
+
if (configPath) {
|
|
110369
|
+
const fs15 = createFileSystem();
|
|
110370
|
+
const resolvedPath = String(configPath).startsWith("/") ? String(configPath) : join6(cwd(), String(configPath));
|
|
110371
|
+
try {
|
|
110372
|
+
const configContent = await fs15.readTextFile(resolvedPath);
|
|
110373
|
+
const config = JSON.parse(configContent);
|
|
110374
|
+
name = name || config.name;
|
|
110375
|
+
template = template || config.template;
|
|
110376
|
+
integrations = integrations || config.integrations;
|
|
110377
|
+
skipInstall = skipInstall || config.skipInstall || false;
|
|
110378
|
+
skipEnvPrompt = skipEnvPrompt || config.skipEnvPrompt || false;
|
|
110379
|
+
env2 = config.env;
|
|
110380
|
+
cliLogger.debug(`Loaded config from ${resolvedPath}`);
|
|
110381
|
+
} catch (error2) {
|
|
110382
|
+
cliLogger.error(`Failed to read config file: ${resolvedPath}`);
|
|
110383
|
+
if (error2 instanceof SyntaxError) {
|
|
110384
|
+
cliLogger.error("Invalid JSON syntax in config file");
|
|
110385
|
+
}
|
|
110386
|
+
exitProcess(1);
|
|
110387
|
+
return;
|
|
110388
|
+
}
|
|
110389
|
+
}
|
|
109650
110390
|
if (args.integrations) {
|
|
109651
110391
|
const integrationsArg = String(args.integrations);
|
|
109652
110392
|
integrations = integrationsArg.split(",").map((s48) => s48.trim());
|
|
@@ -109654,8 +110394,10 @@ async function routeCommand(args) {
|
|
|
109654
110394
|
await initCommand({
|
|
109655
110395
|
name,
|
|
109656
110396
|
template,
|
|
109657
|
-
skipInstall
|
|
109658
|
-
|
|
110397
|
+
skipInstall,
|
|
110398
|
+
skipEnvPrompt,
|
|
110399
|
+
integrations,
|
|
110400
|
+
env: env2
|
|
109659
110401
|
});
|
|
109660
110402
|
break;
|
|
109661
110403
|
}
|