@agent-native/core 0.79.12 → 0.79.16
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/corpus/README.md +2 -2
- package/corpus/core/CHANGELOG.md +25 -0
- package/corpus/core/docs/content/locales/zh-TW/a2a-protocol.md +68 -68
- package/corpus/core/docs/content/locales/zh-TW/actions.md +82 -82
- package/corpus/core/docs/content/locales/zh-TW/agent-mentions.md +22 -22
- package/corpus/core/docs/content/locales/zh-TW/agent-surfaces.md +82 -82
- package/corpus/core/docs/content/locales/zh-TW/agent-teams.md +29 -29
- package/corpus/core/docs/content/locales/zh-TW/agent-web-surfaces.md +11 -11
- package/corpus/core/docs/content/locales/zh-TW/audit-log.md +16 -16
- package/corpus/core/docs/content/locales/zh-TW/authentication.md +32 -32
- package/corpus/core/docs/content/locales/zh-TW/automations.md +32 -32
- package/corpus/core/docs/content/locales/zh-TW/blueprint-installer.md +19 -19
- package/corpus/core/docs/content/locales/zh-TW/cli-adapters.md +17 -17
- package/corpus/core/docs/content/locales/zh-TW/client.md +62 -62
- package/corpus/core/docs/content/locales/zh-TW/cloneable-saas.md +32 -32
- package/corpus/core/docs/content/locales/zh-TW/code-agents-ui.md +91 -91
- package/corpus/core/docs/content/locales/zh-TW/components.md +51 -51
- package/corpus/core/docs/content/locales/zh-TW/context-awareness.md +66 -66
- package/corpus/core/docs/content/locales/zh-TW/creating-templates.md +39 -39
- package/corpus/core/docs/content/locales/zh-TW/cross-app-sso.md +29 -29
- package/corpus/core/docs/content/locales/zh-TW/database.md +21 -21
- package/corpus/core/docs/content/locales/zh-TW/deployment.md +37 -37
- package/corpus/core/docs/content/locales/zh-TW/dispatch.md +43 -43
- package/corpus/core/docs/content/locales/zh-TW/drop-in-agent.md +34 -34
- package/corpus/core/docs/content/locales/zh-TW/durable-resume.md +18 -18
- package/corpus/core/docs/content/locales/zh-TW/embedding-sdk.md +73 -73
- package/corpus/core/docs/content/locales/zh-TW/evals.md +16 -16
- package/corpus/core/docs/content/locales/zh-TW/extensions.md +81 -81
- package/corpus/core/docs/content/locales/zh-TW/external-agents.md +146 -146
- package/corpus/core/docs/content/locales/zh-TW/faq.md +43 -43
- package/corpus/core/docs/content/locales/zh-TW/file-uploads.md +11 -11
- package/corpus/core/docs/content/locales/zh-TW/frames.md +33 -33
- package/corpus/core/docs/content/locales/zh-TW/getting-started.md +28 -28
- package/corpus/core/docs/content/locales/zh-TW/harness-agents.md +78 -78
- package/corpus/core/docs/content/locales/zh-TW/human-approval.md +27 -27
- package/corpus/core/docs/content/locales/zh-TW/internationalization.md +19 -19
- package/corpus/core/docs/content/locales/zh-TW/key-concepts.md +68 -68
- package/corpus/core/docs/content/locales/zh-TW/local-file-mode.md +50 -50
- package/corpus/core/docs/content/locales/zh-TW/mcp-apps.md +38 -38
- package/corpus/core/docs/content/locales/zh-TW/mcp-clients.md +67 -67
- package/corpus/core/docs/content/locales/zh-TW/mcp-protocol.md +50 -50
- package/corpus/core/docs/content/locales/zh-TW/messaging.md +99 -99
- package/corpus/core/docs/content/locales/zh-TW/migration-workbench.md +6 -6
- package/corpus/core/docs/content/locales/zh-TW/multi-app-workspace.md +39 -39
- package/corpus/core/docs/content/locales/zh-TW/multi-tenancy.md +7 -7
- package/corpus/core/docs/content/locales/zh-TW/native-chat-ui.md +38 -38
- package/corpus/core/docs/content/locales/zh-TW/notifications.md +23 -23
- package/corpus/core/docs/content/locales/zh-TW/observability.md +49 -49
- package/corpus/core/docs/content/locales/zh-TW/observational-memory.md +23 -23
- package/corpus/core/docs/content/locales/zh-TW/onboarding.md +40 -40
- package/corpus/core/docs/content/locales/zh-TW/plan-plugin.md +37 -37
- package/corpus/core/docs/content/locales/zh-TW/pr-visual-recap.md +72 -72
- package/corpus/core/docs/content/locales/zh-TW/processors.md +17 -17
- package/corpus/core/docs/content/locales/zh-TW/progress.md +15 -15
- package/corpus/core/docs/content/locales/zh-TW/pure-agent-apps.md +10 -10
- package/corpus/core/docs/content/locales/zh-TW/real-time-collaboration.md +103 -103
- package/corpus/core/docs/content/locales/zh-TW/recurring-jobs.md +19 -19
- package/corpus/core/docs/content/locales/zh-TW/routing.md +9 -9
- package/corpus/core/docs/content/locales/zh-TW/sandbox-adapters.md +48 -48
- package/corpus/core/docs/content/locales/zh-TW/security.md +49 -49
- package/corpus/core/docs/content/locales/zh-TW/server.md +47 -47
- package/corpus/core/docs/content/locales/zh-TW/sharing.md +22 -22
- package/corpus/core/docs/content/locales/zh-TW/skills-guide.md +46 -46
- package/corpus/core/docs/content/locales/zh-TW/template-analytics.md +40 -40
- package/corpus/core/docs/content/locales/zh-TW/template-assets.md +69 -69
- package/corpus/core/docs/content/locales/zh-TW/template-brain.md +81 -81
- package/corpus/core/docs/content/locales/zh-TW/template-calendar.md +40 -40
- package/corpus/core/docs/content/locales/zh-TW/template-chat.md +27 -27
- package/corpus/core/docs/content/locales/zh-TW/template-clips.md +85 -85
- package/corpus/core/docs/content/locales/zh-TW/template-content.md +65 -66
- package/corpus/core/docs/content/locales/zh-TW/template-design.md +29 -29
- package/corpus/core/docs/content/locales/zh-TW/template-dispatch.md +51 -51
- package/corpus/core/docs/content/locales/zh-TW/template-forms.md +25 -25
- package/corpus/core/docs/content/locales/zh-TW/template-mail.md +71 -71
- package/corpus/core/docs/content/locales/zh-TW/template-plan.md +92 -92
- package/corpus/core/docs/content/locales/zh-TW/template-slides.md +52 -52
- package/corpus/core/docs/content/locales/zh-TW/template-videos.md +30 -30
- package/corpus/core/docs/content/locales/zh-TW/tracking.md +29 -29
- package/corpus/core/docs/content/locales/zh-TW/using-your-agent.md +18 -18
- package/corpus/core/docs/content/locales/zh-TW/voice-input.md +19 -19
- package/corpus/core/docs/content/locales/zh-TW/what-is-agent-native.md +61 -61
- package/corpus/core/docs/content/locales/zh-TW/workspace-connections.md +41 -41
- package/corpus/core/docs/content/locales/zh-TW/workspace-management.md +27 -27
- package/corpus/core/docs/content/locales/zh-TW/workspace.md +58 -58
- package/corpus/core/docs/content/locales/zh-TW/writing-agent-instructions.md +41 -41
- package/corpus/core/docs/content/template-clips.md +48 -2
- package/corpus/core/package.json +2 -1
- package/corpus/core/src/client/AgentPanel.tsx +29 -6
- package/corpus/core/src/deploy/build.ts +432 -42
- package/corpus/core/src/deploy/route-discovery.ts +1 -1
- package/corpus/core/src/server/edge.ts +50 -0
- package/corpus/core/src/styles/agent-native.css +123 -0
- package/corpus/core/src/templates/default/app/i18n/zh-TW.ts +44 -44
- package/corpus/core/src/vite/client.ts +1 -0
- package/corpus/templates/analytics/app/components/layout/Layout.tsx +5 -3
- package/corpus/templates/analytics/app/i18n/zh-TW.ts +69 -70
- package/corpus/templates/analytics/changelog/2026-06-27-traditional-chinese-copy-uses-taiwan-terminology.md +6 -0
- package/corpus/templates/assets/app/components/layout/Layout.tsx +3 -3
- package/corpus/templates/assets/app/i18n/zh-TW.ts +82 -82
- package/corpus/templates/assets/changelog/2026-06-27-traditional-chinese-copy-uses-taiwan-terminology.md +6 -0
- package/corpus/templates/brain/app/components/layout/Layout.tsx +6 -4
- package/corpus/templates/brain/app/i18n/zh-TW.ts +90 -90
- package/corpus/templates/brain/changelog/2026-06-27-traditional-chinese-copy-uses-taiwan-terminology.md +6 -0
- package/corpus/templates/calendar/app/components/layout/AppLayout.tsx +1 -1
- package/corpus/templates/calendar/app/components/layout/Sidebar.tsx +1 -1
- package/corpus/templates/calendar/app/i18n/zh-TW.ts +57 -57
- package/corpus/templates/calendar/changelog/2026-06-27-traditional-chinese-copy-uses-taiwan-terminology.md +6 -0
- package/corpus/templates/calendar/server/lib/booking-og-fonts.ts +20 -6
- package/corpus/templates/calendar/server/lib/booking-og-image.ts +17 -9
- package/corpus/templates/chat/app/components/layout/Layout.tsx +5 -3
- package/corpus/templates/chat/app/i18n/zh-TW.ts +3 -3
- package/corpus/templates/chat/changelog/2026-06-27-traditional-chinese-copy-uses-taiwan-terminology.md +6 -0
- package/corpus/templates/clips/AGENTS.md +6 -0
- package/corpus/templates/clips/actions/delete-recording-permanent.ts +7 -1
- package/corpus/templates/clips/actions/get-recording-player-data.ts +44 -2
- package/corpus/templates/clips/actions/navigate.ts +2 -0
- package/corpus/templates/clips/actions/save-bug-report-context.ts +173 -0
- package/corpus/templates/clips/actions/view-screen.ts +58 -7
- package/corpus/templates/clips/app/components/recorder/storage-setup-card.tsx +9 -3
- package/corpus/templates/clips/app/hooks/use-navigation-state.ts +17 -0
- package/corpus/templates/clips/app/i18n/ar-SA.ts +31 -0
- package/corpus/templates/clips/app/i18n/de-DE.ts +32 -0
- package/corpus/templates/clips/app/i18n/en-US.ts +32 -0
- package/corpus/templates/clips/app/i18n/es-ES.ts +32 -0
- package/corpus/templates/clips/app/i18n/fr-FR.ts +32 -0
- package/corpus/templates/clips/app/i18n/hi-IN.ts +32 -0
- package/corpus/templates/clips/app/i18n/ja-JP.ts +31 -0
- package/corpus/templates/clips/app/i18n/ko-KR.ts +32 -0
- package/corpus/templates/clips/app/i18n/pt-BR.ts +32 -0
- package/corpus/templates/clips/app/i18n/zh-CN.ts +30 -0
- package/corpus/templates/clips/app/i18n/zh-TW.ts +461 -451
- package/corpus/templates/clips/app/routes/bug-report.done.tsx +126 -0
- package/corpus/templates/clips/app/routes/bug-report.tsx +222 -0
- package/corpus/templates/clips/app/routes/record.tsx +104 -12
- package/corpus/templates/clips/changelog/2026-06-26-brief-network-blips-no-longer-block-recording-or-wrongly-pro.md +6 -0
- package/corpus/templates/clips/changelog/2026-06-26-bug-report-recordings-can-keep-redacted-host-app-context-wit.md +6 -0
- package/corpus/templates/clips/changelog/2026-06-26-bug-report-widgets-can-launch-clips-recordings-from-embedded.md +6 -0
- package/corpus/templates/clips/changelog/2026-06-26-desktop-recording-keeps-connected-users-out-of-the-storage-s.md +6 -0
- package/corpus/templates/clips/changelog/2026-06-26-if-a-recording-can-t-be-uploaded-the-chrome-extension-now-sa.md +6 -0
- package/corpus/templates/clips/changelog/2026-06-27-traditional-chinese-copy-uses-taiwan-terminology.md +6 -0
- package/corpus/templates/clips/chrome-extension/public/manifest.json +9 -2
- package/corpus/templates/clips/chrome-extension/src/background.ts +43 -0
- package/corpus/templates/clips/chrome-extension/src/offscreen.ts +111 -6
- package/corpus/templates/clips/chrome-extension/src/popup.ts +18 -7
- package/corpus/templates/clips/desktop/src/app.tsx +53 -19
- package/corpus/templates/clips/server/db/schema.ts +26 -0
- package/corpus/templates/clips/server/lib/public-agent-context.ts +51 -0
- package/corpus/templates/clips/server/plugins/auth.ts +1 -0
- package/corpus/templates/clips/server/plugins/db.ts +28 -0
- package/corpus/templates/clips/server/routes/api/agent-context.json.get.ts +4 -1
- package/corpus/templates/clips/shared/bug-report.ts +161 -0
- package/corpus/templates/content/app/components/layout/Layout.tsx +10 -8
- package/corpus/templates/content/app/components/sidebar/DocumentSidebar.tsx +1 -1
- package/corpus/templates/content/app/i18n/zh-TW.ts +67 -66
- package/corpus/templates/content/changelog/2026-06-27-traditional-chinese-copy-uses-taiwan-terminology.md +6 -0
- package/corpus/templates/design/app/components/layout/Layout.tsx +3 -3
- package/corpus/templates/design/app/i18n/zh-TW.ts +44 -44
- package/corpus/templates/design/changelog/2026-06-27-traditional-chinese-copy-uses-taiwan-terminology.md +6 -0
- package/corpus/templates/dispatch/app/i18n/zh-TW.ts +5 -4
- package/corpus/templates/dispatch/changelog/2026-06-27-traditional-chinese-copy-uses-taiwan-terminology.md +6 -0
- package/corpus/templates/forms/app/components/layout/Layout.tsx +4 -2
- package/corpus/templates/forms/app/components/layout/Sidebar.tsx +1 -1
- package/corpus/templates/forms/app/i18n/zh-TW.ts +48 -48
- package/corpus/templates/forms/changelog/2026-06-27-traditional-chinese-copy-uses-taiwan-terminology.md +6 -0
- package/corpus/templates/macros/app/components/layout/AppLayout.tsx +3 -3
- package/corpus/templates/macros/app/i18n/zh-TW.ts +5 -5
- package/corpus/templates/macros/changelog/2026-06-27-traditional-chinese-copy-uses-taiwan-terminology.md +6 -0
- package/corpus/templates/mail/app/i18n/zh-TW.ts +83 -83
- package/corpus/templates/mail/changelog/2026-06-27-traditional-chinese-copy-uses-taiwan-terminology.md +6 -0
- package/corpus/templates/plan/app/components/layout/Layout.tsx +5 -3
- package/corpus/templates/plan/app/i18n/zh-TW.ts +69 -69
- package/corpus/templates/plan/changelog/2026-06-27-traditional-chinese-copy-uses-taiwan-terminology.md +6 -0
- package/corpus/templates/slides/app/components/layout/Layout.tsx +3 -3
- package/corpus/templates/slides/app/i18n/zh-TW.ts +64 -64
- package/corpus/templates/slides/changelog/2026-06-27-traditional-chinese-copy-uses-taiwan-terminology.md +6 -0
- package/corpus/templates/videos/app/components/layout/Layout.tsx +2 -2
- package/corpus/templates/videos/app/i18n/zh-TW.ts +54 -54
- package/corpus/templates/videos/changelog/2026-06-27-traditional-chinese-copy-uses-taiwan-terminology.md +6 -0
- package/dist/client/AgentPanel.d.ts.map +1 -1
- package/dist/client/AgentPanel.js +16 -6
- package/dist/client/AgentPanel.js.map +1 -1
- package/dist/collab/routes.d.ts +2 -2
- package/dist/deploy/build.d.ts +3 -1
- package/dist/deploy/build.d.ts.map +1 -1
- package/dist/deploy/build.js +372 -37
- package/dist/deploy/build.js.map +1 -1
- package/dist/deploy/route-discovery.d.ts +1 -1
- package/dist/deploy/route-discovery.js +1 -1
- package/dist/deploy/route-discovery.js.map +1 -1
- package/dist/notifications/routes.d.ts +1 -1
- package/dist/observability/routes.d.ts +5 -5
- package/dist/resources/handlers.d.ts +3 -3
- package/dist/server/agent-engine-api-key-route.d.ts +2 -2
- package/dist/server/edge.d.ts +11 -0
- package/dist/server/edge.d.ts.map +1 -0
- package/dist/server/edge.js +11 -0
- package/dist/server/edge.js.map +1 -0
- package/dist/server/transcribe-voice.d.ts +1 -1
- package/dist/styles/agent-native.css +123 -0
- package/dist/templates/default/app/i18n/zh-TW.ts +44 -44
- package/dist/vite/client.d.ts.map +1 -1
- package/dist/vite/client.js +1 -0
- package/dist/vite/client.js.map +1 -1
- package/docs/content/locales/zh-TW/a2a-protocol.md +68 -68
- package/docs/content/locales/zh-TW/actions.md +82 -82
- package/docs/content/locales/zh-TW/agent-mentions.md +22 -22
- package/docs/content/locales/zh-TW/agent-surfaces.md +82 -82
- package/docs/content/locales/zh-TW/agent-teams.md +29 -29
- package/docs/content/locales/zh-TW/agent-web-surfaces.md +11 -11
- package/docs/content/locales/zh-TW/audit-log.md +16 -16
- package/docs/content/locales/zh-TW/authentication.md +32 -32
- package/docs/content/locales/zh-TW/automations.md +32 -32
- package/docs/content/locales/zh-TW/blueprint-installer.md +19 -19
- package/docs/content/locales/zh-TW/cli-adapters.md +17 -17
- package/docs/content/locales/zh-TW/client.md +62 -62
- package/docs/content/locales/zh-TW/cloneable-saas.md +32 -32
- package/docs/content/locales/zh-TW/code-agents-ui.md +91 -91
- package/docs/content/locales/zh-TW/components.md +51 -51
- package/docs/content/locales/zh-TW/context-awareness.md +66 -66
- package/docs/content/locales/zh-TW/creating-templates.md +39 -39
- package/docs/content/locales/zh-TW/cross-app-sso.md +29 -29
- package/docs/content/locales/zh-TW/database.md +21 -21
- package/docs/content/locales/zh-TW/deployment.md +37 -37
- package/docs/content/locales/zh-TW/dispatch.md +43 -43
- package/docs/content/locales/zh-TW/drop-in-agent.md +34 -34
- package/docs/content/locales/zh-TW/durable-resume.md +18 -18
- package/docs/content/locales/zh-TW/embedding-sdk.md +73 -73
- package/docs/content/locales/zh-TW/evals.md +16 -16
- package/docs/content/locales/zh-TW/extensions.md +81 -81
- package/docs/content/locales/zh-TW/external-agents.md +146 -146
- package/docs/content/locales/zh-TW/faq.md +43 -43
- package/docs/content/locales/zh-TW/file-uploads.md +11 -11
- package/docs/content/locales/zh-TW/frames.md +33 -33
- package/docs/content/locales/zh-TW/getting-started.md +28 -28
- package/docs/content/locales/zh-TW/harness-agents.md +78 -78
- package/docs/content/locales/zh-TW/human-approval.md +27 -27
- package/docs/content/locales/zh-TW/internationalization.md +19 -19
- package/docs/content/locales/zh-TW/key-concepts.md +68 -68
- package/docs/content/locales/zh-TW/local-file-mode.md +50 -50
- package/docs/content/locales/zh-TW/mcp-apps.md +38 -38
- package/docs/content/locales/zh-TW/mcp-clients.md +67 -67
- package/docs/content/locales/zh-TW/mcp-protocol.md +50 -50
- package/docs/content/locales/zh-TW/messaging.md +99 -99
- package/docs/content/locales/zh-TW/migration-workbench.md +6 -6
- package/docs/content/locales/zh-TW/multi-app-workspace.md +39 -39
- package/docs/content/locales/zh-TW/multi-tenancy.md +7 -7
- package/docs/content/locales/zh-TW/native-chat-ui.md +38 -38
- package/docs/content/locales/zh-TW/notifications.md +23 -23
- package/docs/content/locales/zh-TW/observability.md +49 -49
- package/docs/content/locales/zh-TW/observational-memory.md +23 -23
- package/docs/content/locales/zh-TW/onboarding.md +40 -40
- package/docs/content/locales/zh-TW/plan-plugin.md +37 -37
- package/docs/content/locales/zh-TW/pr-visual-recap.md +72 -72
- package/docs/content/locales/zh-TW/processors.md +17 -17
- package/docs/content/locales/zh-TW/progress.md +15 -15
- package/docs/content/locales/zh-TW/pure-agent-apps.md +10 -10
- package/docs/content/locales/zh-TW/real-time-collaboration.md +103 -103
- package/docs/content/locales/zh-TW/recurring-jobs.md +19 -19
- package/docs/content/locales/zh-TW/routing.md +9 -9
- package/docs/content/locales/zh-TW/sandbox-adapters.md +48 -48
- package/docs/content/locales/zh-TW/security.md +49 -49
- package/docs/content/locales/zh-TW/server.md +47 -47
- package/docs/content/locales/zh-TW/sharing.md +22 -22
- package/docs/content/locales/zh-TW/skills-guide.md +46 -46
- package/docs/content/locales/zh-TW/template-analytics.md +40 -40
- package/docs/content/locales/zh-TW/template-assets.md +69 -69
- package/docs/content/locales/zh-TW/template-brain.md +81 -81
- package/docs/content/locales/zh-TW/template-calendar.md +40 -40
- package/docs/content/locales/zh-TW/template-chat.md +27 -27
- package/docs/content/locales/zh-TW/template-clips.md +85 -85
- package/docs/content/locales/zh-TW/template-content.md +65 -66
- package/docs/content/locales/zh-TW/template-design.md +29 -29
- package/docs/content/locales/zh-TW/template-dispatch.md +51 -51
- package/docs/content/locales/zh-TW/template-forms.md +25 -25
- package/docs/content/locales/zh-TW/template-mail.md +71 -71
- package/docs/content/locales/zh-TW/template-plan.md +92 -92
- package/docs/content/locales/zh-TW/template-slides.md +52 -52
- package/docs/content/locales/zh-TW/template-videos.md +30 -30
- package/docs/content/locales/zh-TW/tracking.md +29 -29
- package/docs/content/locales/zh-TW/using-your-agent.md +18 -18
- package/docs/content/locales/zh-TW/voice-input.md +19 -19
- package/docs/content/locales/zh-TW/what-is-agent-native.md +61 -61
- package/docs/content/locales/zh-TW/workspace-connections.md +41 -41
- package/docs/content/locales/zh-TW/workspace-management.md +27 -27
- package/docs/content/locales/zh-TW/workspace.md +58 -58
- package/docs/content/locales/zh-TW/writing-agent-instructions.md +41 -41
- package/docs/content/template-clips.md +48 -2
- package/package.json +2 -1
- package/src/templates/default/app/i18n/zh-TW.ts +44 -44
package/dist/collab/routes.d.ts
CHANGED
|
@@ -26,8 +26,8 @@ export declare const getCollabState: import("h3").EventHandlerWithFetch<import("
|
|
|
26
26
|
* Body: { update: string (base64), requestSource?: string }
|
|
27
27
|
*/
|
|
28
28
|
export declare const postCollabUpdate: import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
|
|
29
|
-
error: string;
|
|
30
29
|
ok?: undefined;
|
|
30
|
+
error: string;
|
|
31
31
|
} | {
|
|
32
32
|
error?: undefined;
|
|
33
33
|
ok: boolean;
|
|
@@ -42,8 +42,8 @@ export declare const postCollabUpdate: import("h3").EventHandlerWithFetch<import
|
|
|
42
42
|
*/
|
|
43
43
|
export declare const postCollabText: import("h3").EventHandlerWithFetch<import("h3").EventHandlerRequest, Promise<{
|
|
44
44
|
ok?: undefined;
|
|
45
|
-
error: string;
|
|
46
45
|
text?: undefined;
|
|
46
|
+
error: string;
|
|
47
47
|
} | {
|
|
48
48
|
error?: undefined;
|
|
49
49
|
ok: boolean;
|
package/dist/deploy/build.d.ts
CHANGED
|
@@ -16,6 +16,8 @@ import { type DiscoveredRoute, type DiscoveredAction } from "./route-discovery.j
|
|
|
16
16
|
import { type WorkspaceCoreExports } from "./workspace-core.js";
|
|
17
17
|
export declare const NITRO_RUNTIME_IGNORE_PATTERNS: string[];
|
|
18
18
|
export declare const CLOUDFLARE_WORKER_ESBUILD_EXTERNALS: string[];
|
|
19
|
+
export declare const CLOUDFLARE_WORKER_STUB_MODULES: Record<string, string>;
|
|
20
|
+
export declare const CLOUDFLARE_WORKER_NODE_BUILTIN_STUB_MODULES: Record<string, string>;
|
|
19
21
|
export interface GenerateWorkerEntryOptions {
|
|
20
22
|
includeReactRouterSsr?: boolean;
|
|
21
23
|
}
|
|
@@ -51,7 +53,7 @@ export declare function addImmutableAssetRouteRulesForClientBuild(routeRules: Ro
|
|
|
51
53
|
* If a workspace core is present (monorepo with `agent-native.workspaceCore`
|
|
52
54
|
* configured and the named package resolves), any plugin slot that the
|
|
53
55
|
* workspace core exports is imported from there instead of from
|
|
54
|
-
* `@agent-native/core/server`. This is the middle layer of the three-layer
|
|
56
|
+
* `@agent-native/core/server/edge`. This is the middle layer of the three-layer
|
|
55
57
|
* inheritance model: app local > workspace core > framework default.
|
|
56
58
|
*/
|
|
57
59
|
export declare function generateWorkerEntry(routes: DiscoveredRoute[], pluginPaths: string[], defaultPluginStems?: string[], actions?: DiscoveredAction[], workspaceCore?: WorkspaceCoreExports | null, immutableAssetPaths?: string[], builtAppBasePath?: string, options?: GenerateWorkerEntryOptions): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/deploy/build.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;GAYG;AAmCH,OAAO,EAML,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,qBAAqB,CAAC;AAI7B,eAAO,MAAM,6BAA6B,UAiBzC,CAAC;AAEF,eAAO,MAAM,mCAAmC,UAiB/C,CAAC;AAEF,MAAM,WAAW,0BA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O,CAAC,IAAI,CAAC,CAAC;IAChD,UAAU,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3C;AAED,MAAM,WAAW,yBAAyB;IACxC,KAAK,EAAE,GAAG,CAAC;IACX,KAAK,EAAE,eAAe,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,qBAAqB,CACzC,IAAI,EAAE,yBAAyB,GAC9B,OAAO,CAAC,IAAI,CAAC,CA+Bf"}
|
package/dist/deploy/build.js
CHANGED
|
@@ -64,6 +64,334 @@ export const CLOUDFLARE_WORKER_ESBUILD_EXTERNALS = [
|
|
|
64
64
|
"@sparticuz/chromium-min",
|
|
65
65
|
"fsevents",
|
|
66
66
|
];
|
|
67
|
+
export const CLOUDFLARE_WORKER_STUB_MODULES = {
|
|
68
|
+
"better-sqlite3": "export default {}; export const Database = class {}; export const watch = () => ({ close() {} });\n",
|
|
69
|
+
"node-pty": "export default {}; export const watch = () => ({ close() {} });\n",
|
|
70
|
+
chokidar: "export default {}; export const watch = () => ({ close() {} });\n",
|
|
71
|
+
fsevents: "export default {}; export const watch = () => ({ close() {} });\n",
|
|
72
|
+
dotenv: "export default {}; export const config = () => ({ parsed: {} });\n",
|
|
73
|
+
"@anthropic-ai/sdk": "export default class Anthropic {}\n",
|
|
74
|
+
"@anthropic-ai/tokenizer": "export default {}; export const countTokens = undefined;\n",
|
|
75
|
+
"@sentry/node": [
|
|
76
|
+
"export const init = () => {};",
|
|
77
|
+
"const scope = {",
|
|
78
|
+
" setUser() {},",
|
|
79
|
+
" setTag() {},",
|
|
80
|
+
" setExtra() {},",
|
|
81
|
+
" setContext() {},",
|
|
82
|
+
" setLevel() {},",
|
|
83
|
+
" getScopeData() { return {}; },",
|
|
84
|
+
"};",
|
|
85
|
+
"export const getIsolationScope = () => scope;",
|
|
86
|
+
"export const withScope = (fn) => fn(scope);",
|
|
87
|
+
"export const captureException = () => undefined;",
|
|
88
|
+
"export default { init, getIsolationScope, withScope, captureException };",
|
|
89
|
+
"",
|
|
90
|
+
].join("\n"),
|
|
91
|
+
"@resvg/resvg-js": [
|
|
92
|
+
"export class Resvg {",
|
|
93
|
+
' constructor() { throw new Error("@resvg/resvg-js unavailable in Cloudflare Pages worker"); }',
|
|
94
|
+
"}",
|
|
95
|
+
"export default { Resvg };",
|
|
96
|
+
"",
|
|
97
|
+
].join("\n"),
|
|
98
|
+
"playwright-core": [
|
|
99
|
+
"const unavailable = async () => { throw new Error('playwright-core unavailable in Cloudflare Pages worker'); };",
|
|
100
|
+
"export const chromium = { launch: unavailable };",
|
|
101
|
+
"export const firefox = { launch: unavailable };",
|
|
102
|
+
"export const webkit = { launch: unavailable };",
|
|
103
|
+
"export default { chromium, firefox, webkit };",
|
|
104
|
+
"",
|
|
105
|
+
].join("\n"),
|
|
106
|
+
"@sparticuz/chromium-min": [
|
|
107
|
+
"const chromium = {",
|
|
108
|
+
" args: [],",
|
|
109
|
+
" setGraphicsMode: false,",
|
|
110
|
+
" executablePath: async () => { throw new Error('@sparticuz/chromium-min unavailable in Cloudflare Pages worker'); },",
|
|
111
|
+
"};",
|
|
112
|
+
"export default chromium;",
|
|
113
|
+
"",
|
|
114
|
+
].join("\n"),
|
|
115
|
+
"@google/genai": [
|
|
116
|
+
"export class GoogleGenAI {",
|
|
117
|
+
" constructor() { throw new Error('@google/genai unavailable in Cloudflare Pages worker'); }",
|
|
118
|
+
"}",
|
|
119
|
+
"export default { GoogleGenAI };",
|
|
120
|
+
"",
|
|
121
|
+
].join("\n"),
|
|
122
|
+
"pdf-parse": [
|
|
123
|
+
"export class PDFParse {",
|
|
124
|
+
" constructor() { throw new Error('pdf-parse unavailable in Cloudflare Pages worker'); }",
|
|
125
|
+
"}",
|
|
126
|
+
"export default { PDFParse };",
|
|
127
|
+
"",
|
|
128
|
+
].join("\n"),
|
|
129
|
+
"pdfjs-dist": "export default {}; export const getDocument = () => { throw new Error('pdfjs-dist unavailable in Cloudflare Pages worker'); };\n",
|
|
130
|
+
"chartjs-node-canvas": [
|
|
131
|
+
"export class ChartJSNodeCanvas {",
|
|
132
|
+
" constructor() { throw new Error('chartjs-node-canvas unavailable in Cloudflare Pages worker'); }",
|
|
133
|
+
"}",
|
|
134
|
+
"export default { ChartJSNodeCanvas };",
|
|
135
|
+
"",
|
|
136
|
+
].join("\n"),
|
|
137
|
+
"@napi-rs/canvas": "export default {}; export const createCanvas = () => { throw new Error('@napi-rs/canvas unavailable in Cloudflare Pages worker'); };\n",
|
|
138
|
+
mermaid: "export default {}; export const mermaidAPI = {};\n",
|
|
139
|
+
"@excalidraw/excalidraw": "export default {}; export const MainMenu = {}; export const WelcomeScreen = {};\n",
|
|
140
|
+
"@excalidraw/mermaid-to-excalidraw": "export default async () => ({ elements: [], files: {} });\n",
|
|
141
|
+
};
|
|
142
|
+
function cloudflareNodeBuiltinStubSource(moduleName, namedExports, overrides = []) {
|
|
143
|
+
const overridden = new Set(overrides.flatMap((source) => Array.from(source.matchAll(/\bexport const ([A-Za-z_$][\w$]*)/g)).map((match) => match[1])));
|
|
144
|
+
const exports = Array.from(new Set(namedExports))
|
|
145
|
+
.filter((name) => !overridden.has(name))
|
|
146
|
+
.sort();
|
|
147
|
+
return [
|
|
148
|
+
`const unavailable = (name) => (..._args) => { throw new Error(name + " is unavailable in Cloudflare Pages workers"); };`,
|
|
149
|
+
`const proxy = new Proxy({}, { get(_target, prop) { return unavailable("${moduleName}." + String(prop)); } });`,
|
|
150
|
+
...overrides,
|
|
151
|
+
...exports.map((name) => `export const ${name} = unavailable("${moduleName}.${name}");`),
|
|
152
|
+
"export default proxy;",
|
|
153
|
+
"",
|
|
154
|
+
].join("\n");
|
|
155
|
+
}
|
|
156
|
+
export const CLOUDFLARE_WORKER_NODE_BUILTIN_STUB_MODULES = {
|
|
157
|
+
child_process: cloudflareNodeBuiltinStubSource("child_process", [
|
|
158
|
+
"exec",
|
|
159
|
+
"execFile",
|
|
160
|
+
"execFileSync",
|
|
161
|
+
"execSync",
|
|
162
|
+
"fork",
|
|
163
|
+
"spawn",
|
|
164
|
+
"spawnSync",
|
|
165
|
+
]),
|
|
166
|
+
cluster: cloudflareNodeBuiltinStubSource("cluster", [
|
|
167
|
+
"disconnect",
|
|
168
|
+
"fork",
|
|
169
|
+
"isMaster",
|
|
170
|
+
"isPrimary",
|
|
171
|
+
"isWorker",
|
|
172
|
+
"setupMaster",
|
|
173
|
+
"setupPrimary",
|
|
174
|
+
"worker",
|
|
175
|
+
"workers",
|
|
176
|
+
]),
|
|
177
|
+
dgram: cloudflareNodeBuiltinStubSource("dgram", ["createSocket"]),
|
|
178
|
+
dns: cloudflareNodeBuiltinStubSource("dns", [
|
|
179
|
+
"lookup",
|
|
180
|
+
"promises",
|
|
181
|
+
"resolve",
|
|
182
|
+
"resolve4",
|
|
183
|
+
"resolve6",
|
|
184
|
+
]),
|
|
185
|
+
"dns/promises": cloudflareNodeBuiltinStubSource("dns/promises", [
|
|
186
|
+
"lookup",
|
|
187
|
+
"resolve",
|
|
188
|
+
"resolve4",
|
|
189
|
+
"resolve6",
|
|
190
|
+
]),
|
|
191
|
+
domain: cloudflareNodeBuiltinStubSource("domain", ["create"]),
|
|
192
|
+
fs: cloudflareNodeBuiltinStubSource("fs", [
|
|
193
|
+
"access",
|
|
194
|
+
"accessSync",
|
|
195
|
+
"appendFile",
|
|
196
|
+
"appendFileSync",
|
|
197
|
+
"chmod",
|
|
198
|
+
"chmodSync",
|
|
199
|
+
"close",
|
|
200
|
+
"closeSync",
|
|
201
|
+
"copyFile",
|
|
202
|
+
"copyFileSync",
|
|
203
|
+
"cp",
|
|
204
|
+
"cpSync",
|
|
205
|
+
"createReadStream",
|
|
206
|
+
"createWriteStream",
|
|
207
|
+
"existsSync",
|
|
208
|
+
"lstat",
|
|
209
|
+
"lstatSync",
|
|
210
|
+
"mkdir",
|
|
211
|
+
"mkdirSync",
|
|
212
|
+
"open",
|
|
213
|
+
"openSync",
|
|
214
|
+
"readFile",
|
|
215
|
+
"readFileSync",
|
|
216
|
+
"readdir",
|
|
217
|
+
"readdirSync",
|
|
218
|
+
"readlink",
|
|
219
|
+
"readlinkSync",
|
|
220
|
+
"realpath",
|
|
221
|
+
"realpathSync",
|
|
222
|
+
"rename",
|
|
223
|
+
"renameSync",
|
|
224
|
+
"rm",
|
|
225
|
+
"rmSync",
|
|
226
|
+
"stat",
|
|
227
|
+
"statSync",
|
|
228
|
+
"symlink",
|
|
229
|
+
"symlinkSync",
|
|
230
|
+
"unlink",
|
|
231
|
+
"unlinkSync",
|
|
232
|
+
"watch",
|
|
233
|
+
"writeFile",
|
|
234
|
+
"writeFileSync",
|
|
235
|
+
], [
|
|
236
|
+
"export const constants = {};",
|
|
237
|
+
"export const promises = {};",
|
|
238
|
+
"export const existsSync = () => false;",
|
|
239
|
+
"export const readdirSync = () => [];",
|
|
240
|
+
"export const realpathSync = (value) => value;",
|
|
241
|
+
"export const mkdirSync = () => undefined;",
|
|
242
|
+
"export const rmSync = () => undefined;",
|
|
243
|
+
]),
|
|
244
|
+
"fs/promises": cloudflareNodeBuiltinStubSource("fs/promises", [
|
|
245
|
+
"access",
|
|
246
|
+
"appendFile",
|
|
247
|
+
"chmod",
|
|
248
|
+
"copyFile",
|
|
249
|
+
"cp",
|
|
250
|
+
"lstat",
|
|
251
|
+
"mkdtemp",
|
|
252
|
+
"mkdir",
|
|
253
|
+
"readFile",
|
|
254
|
+
"readdir",
|
|
255
|
+
"readlink",
|
|
256
|
+
"realpath",
|
|
257
|
+
"rename",
|
|
258
|
+
"rm",
|
|
259
|
+
"stat",
|
|
260
|
+
"symlink",
|
|
261
|
+
"unlink",
|
|
262
|
+
"writeFile",
|
|
263
|
+
]),
|
|
264
|
+
http: cloudflareNodeBuiltinStubSource("http", [
|
|
265
|
+
"Agent",
|
|
266
|
+
"ClientRequest",
|
|
267
|
+
"IncomingMessage",
|
|
268
|
+
"ServerResponse",
|
|
269
|
+
"createServer",
|
|
270
|
+
"get",
|
|
271
|
+
"request",
|
|
272
|
+
]),
|
|
273
|
+
http2: cloudflareNodeBuiltinStubSource("http2", [
|
|
274
|
+
"Http2ServerRequest",
|
|
275
|
+
"Http2ServerResponse",
|
|
276
|
+
"constants",
|
|
277
|
+
"connect",
|
|
278
|
+
"createSecureServer",
|
|
279
|
+
"createServer",
|
|
280
|
+
]),
|
|
281
|
+
https: cloudflareNodeBuiltinStubSource("https", [
|
|
282
|
+
"Agent",
|
|
283
|
+
"createServer",
|
|
284
|
+
"get",
|
|
285
|
+
"request",
|
|
286
|
+
]),
|
|
287
|
+
inspector: cloudflareNodeBuiltinStubSource("inspector", [
|
|
288
|
+
"Session",
|
|
289
|
+
"close",
|
|
290
|
+
"open",
|
|
291
|
+
"url",
|
|
292
|
+
"waitForDebugger",
|
|
293
|
+
]),
|
|
294
|
+
module: cloudflareNodeBuiltinStubSource("module", ["Module", "builtinModules", "createRequire", "syncBuiltinESMExports"], [
|
|
295
|
+
"export const builtinModules = [];",
|
|
296
|
+
"export const createRequire = () => globalThis.require ?? ((specifier) => { throw new Error('Cannot require: ' + specifier); });",
|
|
297
|
+
]),
|
|
298
|
+
net: cloudflareNodeBuiltinStubSource("net", ["Socket", "connect", "createConnection", "createServer", "isIP"], [
|
|
299
|
+
`export const isIP = (value) => {
|
|
300
|
+
const input = String(value ?? "");
|
|
301
|
+
const ipv4Parts = input.split(".");
|
|
302
|
+
if (
|
|
303
|
+
ipv4Parts.length === 4 &&
|
|
304
|
+
ipv4Parts.every((part) => /^\\d{1,3}$/.test(part) && Number(part) >= 0 && Number(part) <= 255)
|
|
305
|
+
) {
|
|
306
|
+
return 4;
|
|
307
|
+
}
|
|
308
|
+
if (input.includes(":") && /^[0-9A-Fa-f:.]+$/.test(input)) {
|
|
309
|
+
return 6;
|
|
310
|
+
}
|
|
311
|
+
return 0;
|
|
312
|
+
};`,
|
|
313
|
+
]),
|
|
314
|
+
os: cloudflareNodeBuiltinStubSource("os", [
|
|
315
|
+
"arch",
|
|
316
|
+
"cpus",
|
|
317
|
+
"endianness",
|
|
318
|
+
"freemem",
|
|
319
|
+
"homedir",
|
|
320
|
+
"hostname",
|
|
321
|
+
"networkInterfaces",
|
|
322
|
+
"platform",
|
|
323
|
+
"release",
|
|
324
|
+
"tmpdir",
|
|
325
|
+
"totalmem",
|
|
326
|
+
"type",
|
|
327
|
+
"userInfo",
|
|
328
|
+
], [
|
|
329
|
+
'export const EOL = "\\n";',
|
|
330
|
+
'export const arch = () => "x64";',
|
|
331
|
+
"export const cpus = () => [];",
|
|
332
|
+
'export const endianness = () => "LE";',
|
|
333
|
+
"export const freemem = () => 0;",
|
|
334
|
+
'export const homedir = () => "/tmp";',
|
|
335
|
+
'export const hostname = () => "cloudflare-worker";',
|
|
336
|
+
"export const networkInterfaces = () => ({});",
|
|
337
|
+
'export const platform = () => "linux";',
|
|
338
|
+
'export const release = () => "";',
|
|
339
|
+
'export const tmpdir = () => "/tmp";',
|
|
340
|
+
"export const totalmem = () => 0;",
|
|
341
|
+
'export const type = () => "Worker";',
|
|
342
|
+
"export const userInfo = () => ({ username: 'worker', homedir: '/tmp' });",
|
|
343
|
+
]),
|
|
344
|
+
readline: cloudflareNodeBuiltinStubSource("readline", [
|
|
345
|
+
"Interface",
|
|
346
|
+
"clearLine",
|
|
347
|
+
"clearScreenDown",
|
|
348
|
+
"createInterface",
|
|
349
|
+
"cursorTo",
|
|
350
|
+
"emitKeypressEvents",
|
|
351
|
+
"moveCursor",
|
|
352
|
+
]),
|
|
353
|
+
repl: cloudflareNodeBuiltinStubSource("repl", ["start"]),
|
|
354
|
+
sqlite: cloudflareNodeBuiltinStubSource("sqlite", ["DatabaseSync"]),
|
|
355
|
+
sys: cloudflareNodeBuiltinStubSource("sys", [
|
|
356
|
+
"debug",
|
|
357
|
+
"deprecate",
|
|
358
|
+
"error",
|
|
359
|
+
"inspect",
|
|
360
|
+
"log",
|
|
361
|
+
"print",
|
|
362
|
+
"puts",
|
|
363
|
+
]),
|
|
364
|
+
tls: cloudflareNodeBuiltinStubSource("tls", [
|
|
365
|
+
"TLSSocket",
|
|
366
|
+
"connect",
|
|
367
|
+
"createSecureContext",
|
|
368
|
+
"createServer",
|
|
369
|
+
]),
|
|
370
|
+
trace_events: cloudflareNodeBuiltinStubSource("trace_events", [
|
|
371
|
+
"createTracing",
|
|
372
|
+
"getEnabledCategories",
|
|
373
|
+
]),
|
|
374
|
+
tty: cloudflareNodeBuiltinStubSource("tty", [
|
|
375
|
+
"ReadStream",
|
|
376
|
+
"WriteStream",
|
|
377
|
+
"isatty",
|
|
378
|
+
]),
|
|
379
|
+
v8: cloudflareNodeBuiltinStubSource("v8", [
|
|
380
|
+
"deserialize",
|
|
381
|
+
"getHeapStatistics",
|
|
382
|
+
"serialize",
|
|
383
|
+
]),
|
|
384
|
+
vm: cloudflareNodeBuiltinStubSource("vm", [
|
|
385
|
+
"Script",
|
|
386
|
+
"compileFunction",
|
|
387
|
+
"createContext",
|
|
388
|
+
"runInContext",
|
|
389
|
+
"runInNewContext",
|
|
390
|
+
"runInThisContext",
|
|
391
|
+
]),
|
|
392
|
+
wasi: cloudflareNodeBuiltinStubSource("wasi", ["WASI"]),
|
|
393
|
+
worker_threads: cloudflareNodeBuiltinStubSource("worker_threads", ["MessageChannel", "MessagePort", "Worker", "isMainThread", "parentPort"], ["export const isMainThread = true;", "export const parentPort = null;"]),
|
|
394
|
+
};
|
|
67
395
|
function normalizeConfiguredAppBasePath() {
|
|
68
396
|
return normalizeAppBasePath(process.env.VITE_APP_BASE_PATH || process.env.APP_BASE_PATH);
|
|
69
397
|
}
|
|
@@ -76,6 +404,7 @@ const NODE_ONLY_PLUGINS = new Set([
|
|
|
76
404
|
// observability there; the framework default is the Node SDK.
|
|
77
405
|
"sentry",
|
|
78
406
|
]);
|
|
407
|
+
const EDGE_SERVER_ENTRYPOINT = "@agent-native/core/server/edge";
|
|
79
408
|
function isNodeOnlyPlugin(filePath) {
|
|
80
409
|
const basename = path.basename(filePath, path.extname(filePath));
|
|
81
410
|
return NODE_ONLY_PLUGINS.has(basename);
|
|
@@ -83,7 +412,7 @@ function isNodeOnlyPlugin(filePath) {
|
|
|
83
412
|
export function generateProvidedPluginsNitroPluginSource(pluginStems) {
|
|
84
413
|
const stems = [...new Set(pluginStems.filter(Boolean))].sort();
|
|
85
414
|
return `// AUTO-GENERATED by @agent-native/core deploy build
|
|
86
|
-
import { markDefaultPluginProvided } from "
|
|
415
|
+
import { markDefaultPluginProvided } from "${EDGE_SERVER_ENTRYPOINT}";
|
|
87
416
|
|
|
88
417
|
const pluginStems = ${JSON.stringify(stems)};
|
|
89
418
|
|
|
@@ -130,7 +459,7 @@ export function addImmutableAssetRouteRulesForClientBuild(routeRules, clientDir,
|
|
|
130
459
|
* If a workspace core is present (monorepo with `agent-native.workspaceCore`
|
|
131
460
|
* configured and the named package resolves), any plugin slot that the
|
|
132
461
|
* workspace core exports is imported from there instead of from
|
|
133
|
-
* `@agent-native/core/server`. This is the middle layer of the three-layer
|
|
462
|
+
* `@agent-native/core/server/edge`. This is the middle layer of the three-layer
|
|
134
463
|
* inheritance model: app local > workspace core > framework default.
|
|
135
464
|
*/
|
|
136
465
|
export function generateWorkerEntry(routes, pluginPaths, defaultPluginStems = [], actions = [], workspaceCore = null, immutableAssetPaths = [], builtAppBasePath = normalizeConfiguredAppBasePath(), options = {}) {
|
|
@@ -207,11 +536,11 @@ export function generateWorkerEntry(routes, pluginPaths, defaultPluginStems = []
|
|
|
207
536
|
pluginImports.push(`import { ${workspaceExportName} as ${varName} } from ${JSON.stringify(`${workspaceCore.packageName}/server`)};`);
|
|
208
537
|
}
|
|
209
538
|
else {
|
|
210
|
-
// Fall back to the framework default from
|
|
539
|
+
// Fall back to the framework default from the edge-safe core entrypoint.
|
|
211
540
|
const defaultExportName = DEFAULT_PLUGIN_REGISTRY[stem];
|
|
212
541
|
if (!defaultExportName)
|
|
213
542
|
continue;
|
|
214
|
-
pluginImports.push(`import { ${defaultExportName} as ${varName} } from "
|
|
543
|
+
pluginImports.push(`import { ${defaultExportName} as ${varName} } from "${EDGE_SERVER_ENTRYPOINT}";`);
|
|
215
544
|
}
|
|
216
545
|
pluginCalls.push(` if (typeof ${varName} === "function") {
|
|
217
546
|
await ${varName}(nitroApp);
|
|
@@ -226,7 +555,7 @@ export function generateWorkerEntry(routes, pluginPaths, defaultPluginStems = []
|
|
|
226
555
|
]
|
|
227
556
|
: [];
|
|
228
557
|
if (generatedPluginMarks.length > 0) {
|
|
229
|
-
pluginImports.unshift(`import { markDefaultPluginProvided as markGeneratedPluginProvided } from "
|
|
558
|
+
pluginImports.unshift(`import { markDefaultPluginProvided as markGeneratedPluginProvided } from "${EDGE_SERVER_ENTRYPOINT}";`);
|
|
230
559
|
}
|
|
231
560
|
return `
|
|
232
561
|
// Auto-generated worker entry point for ${preset}
|
|
@@ -911,8 +1240,8 @@ async function buildCloudflarePages() {
|
|
|
911
1240
|
writeCloudflarePagesStaticShell({ serverDir, distDir, tmpDir });
|
|
912
1241
|
// Exclude _worker.js from being served as a public asset
|
|
913
1242
|
fs.writeFileSync(path.join(distDir, ".assetsignore"), "_worker.js\n");
|
|
914
|
-
// Write
|
|
915
|
-
//
|
|
1243
|
+
// Write package metadata inside _worker.js/ for the ES module worker that
|
|
1244
|
+
// Wrangler compiles and uploads for Cloudflare Pages.
|
|
916
1245
|
fs.mkdirSync(path.join(distDir, "_worker.js"), { recursive: true });
|
|
917
1246
|
fs.writeFileSync(path.join(distDir, "_worker.js", "package.json"), JSON.stringify({ main: "index.js", type: "module" }));
|
|
918
1247
|
// Create empty stub for native modules that wrangler's bundler needs to resolve
|
|
@@ -973,21 +1302,22 @@ async function buildCloudflarePages() {
|
|
|
973
1302
|
// Create stub modules for native/Node-only deps that can't run on Workers.
|
|
974
1303
|
// These get resolved by esbuild instead of the real modules, avoiding bundling
|
|
975
1304
|
// native code that would fail on the Workers runtime.
|
|
976
|
-
const stubModules = [
|
|
977
|
-
"better-sqlite3",
|
|
978
|
-
"node-pty",
|
|
979
|
-
"chokidar",
|
|
980
|
-
"fsevents",
|
|
981
|
-
"dotenv",
|
|
982
|
-
"@anthropic-ai/sdk",
|
|
983
|
-
];
|
|
984
1305
|
const stubDir = path.join(tmpDir, "node_modules");
|
|
985
|
-
for (const mod of
|
|
1306
|
+
for (const [mod, source] of Object.entries(CLOUDFLARE_WORKER_STUB_MODULES)) {
|
|
986
1307
|
const modDir = path.join(stubDir, mod);
|
|
987
1308
|
fs.mkdirSync(modDir, { recursive: true });
|
|
988
|
-
fs.writeFileSync(path.join(modDir, "index.js"),
|
|
1309
|
+
fs.writeFileSync(path.join(modDir, "index.js"), source);
|
|
989
1310
|
fs.writeFileSync(path.join(modDir, "package.json"), JSON.stringify({ name: mod, main: "index.js", type: "module" }));
|
|
990
1311
|
}
|
|
1312
|
+
const stubAliases = Object.keys(CLOUDFLARE_WORKER_STUB_MODULES).map((mod) => `--alias:${mod}=${path.join(stubDir, mod, "index.js")}`);
|
|
1313
|
+
const nodeBuiltinStubDir = path.join(tmpDir, "node-builtin-stubs");
|
|
1314
|
+
fs.mkdirSync(nodeBuiltinStubDir, { recursive: true });
|
|
1315
|
+
const nodeBuiltinStubAliases = [];
|
|
1316
|
+
for (const [mod, source] of Object.entries(CLOUDFLARE_WORKER_NODE_BUILTIN_STUB_MODULES).sort(([a], [b]) => b.length - a.length)) {
|
|
1317
|
+
const stubFile = path.join(nodeBuiltinStubDir, `${mod.replace(/\W+/g, "_")}.js`);
|
|
1318
|
+
fs.writeFileSync(stubFile, source);
|
|
1319
|
+
nodeBuiltinStubAliases.push(`--alias:${mod}=${stubFile}`, `--alias:node:${mod}=${stubFile}`);
|
|
1320
|
+
}
|
|
991
1321
|
const esbuildBin = findEsbuild();
|
|
992
1322
|
// Externalize node builtins (both bare and node: prefixed) — the require
|
|
993
1323
|
// shim handles bare ones. Also alias every `node:*` specifier to its bare
|
|
@@ -1001,8 +1331,15 @@ async function buildCloudflarePages() {
|
|
|
1001
1331
|
// Only externalize bare names. node:* externals would otherwise pin
|
|
1002
1332
|
// the prefix in output; instead we alias node:* → bare so anything that
|
|
1003
1333
|
// resolves past alias land as bare externals.
|
|
1004
|
-
const
|
|
1005
|
-
const
|
|
1334
|
+
const nodeBuiltinStubs = new Set(Object.keys(CLOUDFLARE_WORKER_NODE_BUILTIN_STUB_MODULES));
|
|
1335
|
+
const nodeExternals = builtinNames
|
|
1336
|
+
.filter((n) => !nodeBuiltinStubs.has(n))
|
|
1337
|
+
.sort((a, b) => b.length - a.length)
|
|
1338
|
+
.map((n) => `--external:${n}`);
|
|
1339
|
+
const nodeAliases = builtinNames
|
|
1340
|
+
.filter((n) => !nodeBuiltinStubs.has(n))
|
|
1341
|
+
.sort((a, b) => b.length - a.length)
|
|
1342
|
+
.map((n) => `--alias:node:${n}=${n}`);
|
|
1006
1343
|
// Hard externalize large client-only / node-only libraries so they don't
|
|
1007
1344
|
// bloat the edge worker. These are never executed in the CF Pages runtime
|
|
1008
1345
|
// — mermaid/excalidraw render in the browser, pdf-parse and @google/genai
|
|
@@ -1014,7 +1351,7 @@ async function buildCloudflarePages() {
|
|
|
1014
1351
|
// files. Both import sites degrade gracefully when the runtime import
|
|
1015
1352
|
// fails: context-xray token counts fall back to char/4 estimates and the
|
|
1016
1353
|
// OG image route falls back to SVG.
|
|
1017
|
-
const heavyClientExternals = CLOUDFLARE_WORKER_ESBUILD_EXTERNALS.map((p) => `--external:${p}`);
|
|
1354
|
+
const heavyClientExternals = CLOUDFLARE_WORKER_ESBUILD_EXTERNALS.filter((p) => !Object.hasOwn(CLOUDFLARE_WORKER_STUB_MODULES, p)).map((p) => `--external:${p}`);
|
|
1018
1355
|
execFileSync(esbuildBin, [
|
|
1019
1356
|
tmpEntry,
|
|
1020
1357
|
"--bundle",
|
|
@@ -1040,6 +1377,8 @@ async function buildCloudflarePages() {
|
|
|
1040
1377
|
// Externalize node: builtins — CF Workers runtime provides them
|
|
1041
1378
|
...nodeExternals,
|
|
1042
1379
|
...heavyClientExternals,
|
|
1380
|
+
...stubAliases,
|
|
1381
|
+
...nodeBuiltinStubAliases,
|
|
1043
1382
|
// Rewrite node:* -> bare names so chunks never contain node: imports
|
|
1044
1383
|
...nodeAliases,
|
|
1045
1384
|
], { stdio: "inherit", cwd });
|
|
@@ -1125,6 +1464,7 @@ const NODE_BUILTINS = [
|
|
|
1125
1464
|
"dgram",
|
|
1126
1465
|
"diagnostics_channel",
|
|
1127
1466
|
"dns",
|
|
1467
|
+
"dns/promises",
|
|
1128
1468
|
"domain",
|
|
1129
1469
|
"events",
|
|
1130
1470
|
"fs",
|
|
@@ -1168,22 +1508,12 @@ export function getNodeBuiltinNames() {
|
|
|
1168
1508
|
* Injected via esbuild --inject so CJS deps work on Workers runtime.
|
|
1169
1509
|
*/
|
|
1170
1510
|
function generateRequireShim() {
|
|
1171
|
-
// Shim
|
|
1172
|
-
//
|
|
1173
|
-
//
|
|
1174
|
-
//
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
// Some builtins exist only as runtime polyfills under nodejs_compat
|
|
1178
|
-
// (some are no-op stubs). That's fine — the `import` returns whatever
|
|
1179
|
-
// the runtime provides; failures only surface when callers actually USE
|
|
1180
|
-
// the unsupported APIs at request time, which is the same as if the
|
|
1181
|
-
// shim wasn't there.
|
|
1182
|
-
//
|
|
1183
|
-
// `sqlite` is excluded because it's Node 22+ only and Workers'
|
|
1184
|
-
// nodejs_compat doesn't expose it yet — importing it makes the whole
|
|
1185
|
-
// bundle fail to load.
|
|
1186
|
-
const shimmed = NODE_BUILTINS.filter((name) => name !== "sqlite");
|
|
1511
|
+
// Shim Node builtins that Cloudflare Pages can import, and return lazy
|
|
1512
|
+
// unavailable proxies for builtins that Pages Functions reject at upload
|
|
1513
|
+
// time (child_process, fs, net, etc.). This lets optional Node-only code stay
|
|
1514
|
+
// present in the shared bundle without making worker initialization fail.
|
|
1515
|
+
const stubbed = new Set(Object.keys(CLOUDFLARE_WORKER_NODE_BUILTIN_STUB_MODULES));
|
|
1516
|
+
const shimmed = NODE_BUILTINS.filter((name) => !stubbed.has(name));
|
|
1187
1517
|
// Bare module names — CF Pages Functions runs under nodejs_compat v1,
|
|
1188
1518
|
// which rejects "node:fs" and only accepts "fs". The post-build pass in
|
|
1189
1519
|
// buildCloudflarePages() also strips any `node:` prefix that esbuild or
|
|
@@ -1200,8 +1530,13 @@ function generateRequireShim() {
|
|
|
1200
1530
|
const entries = shimmed
|
|
1201
1531
|
.map((m) => `"${m}":__${m.replace("/", "_")}`)
|
|
1202
1532
|
.join(",");
|
|
1533
|
+
const stubEntries = Array.from(stubbed)
|
|
1534
|
+
.sort()
|
|
1535
|
+
.map((m) => `"${m}":__unavailable("${m}")`)
|
|
1536
|
+
.join(",");
|
|
1537
|
+
const allEntries = [entries, stubEntries].filter(Boolean).join(",");
|
|
1203
1538
|
const messageChannelPolyfill = `if(typeof MessageChannel==="undefined"){globalThis.MessageChannel=class{constructor(){const a={onmessage:null},b={onmessage:null};a.postMessage=d=>{if(b.onmessage)setTimeout(()=>b.onmessage({data:d}),0)};b.postMessage=d=>{if(a.onmessage)setTimeout(()=>a.onmessage({data:d}),0)};this.port1=a;this.port2=b}}}`;
|
|
1204
|
-
return `${imports}\n${messageChannelPolyfill}\nconst __mods={${
|
|
1539
|
+
return `${imports}\n${messageChannelPolyfill}\nconst __unavailable=(m)=>new Proxy({}, { get(_target, prop) { return (..._args) => { throw new Error(m + "." + String(prop) + " is unavailable in Cloudflare Pages workers"); }; } });\nconst __mods={${allEntries}};export var require=globalThis.require||function(m){const r=__mods[m];if(r!==undefined)return r;throw new Error("Cannot require: "+m)};\n`;
|
|
1205
1540
|
}
|
|
1206
1541
|
function findEsbuild() {
|
|
1207
1542
|
// Try to resolve esbuild's binary via Node module resolution
|