@agent-native/core 0.79.12 → 0.79.15
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 +19 -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 +27 -3
- package/corpus/core/src/deploy/build.ts +417 -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 +93 -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 +14 -4
- package/dist/client/AgentPanel.js.map +1 -1
- package/dist/collab/routes.d.ts +1 -1
- package/dist/deploy/build.d.ts +3 -1
- package/dist/deploy/build.d.ts.map +1 -1
- package/dist/deploy/build.js +361 -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/resources/handlers.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/styles/agent-native.css +93 -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;
|
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,0BAA0B;IACzC,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED,UAAU,wBAAwB;IAChC,KAAK,EAAE,6BAA6B,CAAC;IACrC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,6BAA6B,CAAC,CAAC;IACtD,GAAG,EAAE,MAAM,CAAC;CACb;AAED,UAAU,6BAA6B;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;CAChB;AAED,UAAU,6BAA6B;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAA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AAO,CAAC,IAAI,CAAC,CA+Bf"}
|
package/dist/deploy/build.js
CHANGED
|
@@ -64,6 +64,323 @@ 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
|
+
"mkdir",
|
|
252
|
+
"readFile",
|
|
253
|
+
"readdir",
|
|
254
|
+
"readlink",
|
|
255
|
+
"realpath",
|
|
256
|
+
"rename",
|
|
257
|
+
"rm",
|
|
258
|
+
"stat",
|
|
259
|
+
"symlink",
|
|
260
|
+
"unlink",
|
|
261
|
+
"writeFile",
|
|
262
|
+
]),
|
|
263
|
+
http: cloudflareNodeBuiltinStubSource("http", [
|
|
264
|
+
"Agent",
|
|
265
|
+
"ClientRequest",
|
|
266
|
+
"IncomingMessage",
|
|
267
|
+
"ServerResponse",
|
|
268
|
+
"createServer",
|
|
269
|
+
"get",
|
|
270
|
+
"request",
|
|
271
|
+
]),
|
|
272
|
+
http2: cloudflareNodeBuiltinStubSource("http2", [
|
|
273
|
+
"Http2ServerRequest",
|
|
274
|
+
"Http2ServerResponse",
|
|
275
|
+
"constants",
|
|
276
|
+
"connect",
|
|
277
|
+
"createSecureServer",
|
|
278
|
+
"createServer",
|
|
279
|
+
]),
|
|
280
|
+
https: cloudflareNodeBuiltinStubSource("https", [
|
|
281
|
+
"Agent",
|
|
282
|
+
"createServer",
|
|
283
|
+
"get",
|
|
284
|
+
"request",
|
|
285
|
+
]),
|
|
286
|
+
inspector: cloudflareNodeBuiltinStubSource("inspector", [
|
|
287
|
+
"Session",
|
|
288
|
+
"close",
|
|
289
|
+
"open",
|
|
290
|
+
"url",
|
|
291
|
+
"waitForDebugger",
|
|
292
|
+
]),
|
|
293
|
+
module: cloudflareNodeBuiltinStubSource("module", ["Module", "builtinModules", "createRequire", "syncBuiltinESMExports"], [
|
|
294
|
+
"export const builtinModules = [];",
|
|
295
|
+
"export const createRequire = () => globalThis.require ?? ((specifier) => { throw new Error('Cannot require: ' + specifier); });",
|
|
296
|
+
]),
|
|
297
|
+
net: cloudflareNodeBuiltinStubSource("net", [
|
|
298
|
+
"Socket",
|
|
299
|
+
"connect",
|
|
300
|
+
"createConnection",
|
|
301
|
+
"createServer",
|
|
302
|
+
]),
|
|
303
|
+
os: cloudflareNodeBuiltinStubSource("os", [
|
|
304
|
+
"arch",
|
|
305
|
+
"cpus",
|
|
306
|
+
"endianness",
|
|
307
|
+
"freemem",
|
|
308
|
+
"homedir",
|
|
309
|
+
"hostname",
|
|
310
|
+
"networkInterfaces",
|
|
311
|
+
"platform",
|
|
312
|
+
"release",
|
|
313
|
+
"tmpdir",
|
|
314
|
+
"totalmem",
|
|
315
|
+
"type",
|
|
316
|
+
"userInfo",
|
|
317
|
+
], [
|
|
318
|
+
'export const EOL = "\\n";',
|
|
319
|
+
'export const arch = () => "x64";',
|
|
320
|
+
"export const cpus = () => [];",
|
|
321
|
+
'export const endianness = () => "LE";',
|
|
322
|
+
"export const freemem = () => 0;",
|
|
323
|
+
'export const homedir = () => "/tmp";',
|
|
324
|
+
'export const hostname = () => "cloudflare-worker";',
|
|
325
|
+
"export const networkInterfaces = () => ({});",
|
|
326
|
+
'export const platform = () => "linux";',
|
|
327
|
+
'export const release = () => "";',
|
|
328
|
+
'export const tmpdir = () => "/tmp";',
|
|
329
|
+
"export const totalmem = () => 0;",
|
|
330
|
+
'export const type = () => "Worker";',
|
|
331
|
+
"export const userInfo = () => ({ username: 'worker', homedir: '/tmp' });",
|
|
332
|
+
]),
|
|
333
|
+
readline: cloudflareNodeBuiltinStubSource("readline", [
|
|
334
|
+
"Interface",
|
|
335
|
+
"clearLine",
|
|
336
|
+
"clearScreenDown",
|
|
337
|
+
"createInterface",
|
|
338
|
+
"cursorTo",
|
|
339
|
+
"emitKeypressEvents",
|
|
340
|
+
"moveCursor",
|
|
341
|
+
]),
|
|
342
|
+
repl: cloudflareNodeBuiltinStubSource("repl", ["start"]),
|
|
343
|
+
sqlite: cloudflareNodeBuiltinStubSource("sqlite", ["DatabaseSync"]),
|
|
344
|
+
sys: cloudflareNodeBuiltinStubSource("sys", [
|
|
345
|
+
"debug",
|
|
346
|
+
"deprecate",
|
|
347
|
+
"error",
|
|
348
|
+
"inspect",
|
|
349
|
+
"log",
|
|
350
|
+
"print",
|
|
351
|
+
"puts",
|
|
352
|
+
]),
|
|
353
|
+
tls: cloudflareNodeBuiltinStubSource("tls", [
|
|
354
|
+
"TLSSocket",
|
|
355
|
+
"connect",
|
|
356
|
+
"createSecureContext",
|
|
357
|
+
"createServer",
|
|
358
|
+
]),
|
|
359
|
+
trace_events: cloudflareNodeBuiltinStubSource("trace_events", [
|
|
360
|
+
"createTracing",
|
|
361
|
+
"getEnabledCategories",
|
|
362
|
+
]),
|
|
363
|
+
tty: cloudflareNodeBuiltinStubSource("tty", [
|
|
364
|
+
"ReadStream",
|
|
365
|
+
"WriteStream",
|
|
366
|
+
"isatty",
|
|
367
|
+
]),
|
|
368
|
+
v8: cloudflareNodeBuiltinStubSource("v8", [
|
|
369
|
+
"deserialize",
|
|
370
|
+
"getHeapStatistics",
|
|
371
|
+
"serialize",
|
|
372
|
+
]),
|
|
373
|
+
vm: cloudflareNodeBuiltinStubSource("vm", [
|
|
374
|
+
"Script",
|
|
375
|
+
"compileFunction",
|
|
376
|
+
"createContext",
|
|
377
|
+
"runInContext",
|
|
378
|
+
"runInNewContext",
|
|
379
|
+
"runInThisContext",
|
|
380
|
+
]),
|
|
381
|
+
wasi: cloudflareNodeBuiltinStubSource("wasi", ["WASI"]),
|
|
382
|
+
worker_threads: cloudflareNodeBuiltinStubSource("worker_threads", ["MessageChannel", "MessagePort", "Worker", "isMainThread", "parentPort"], ["export const isMainThread = true;", "export const parentPort = null;"]),
|
|
383
|
+
};
|
|
67
384
|
function normalizeConfiguredAppBasePath() {
|
|
68
385
|
return normalizeAppBasePath(process.env.VITE_APP_BASE_PATH || process.env.APP_BASE_PATH);
|
|
69
386
|
}
|
|
@@ -76,6 +393,7 @@ const NODE_ONLY_PLUGINS = new Set([
|
|
|
76
393
|
// observability there; the framework default is the Node SDK.
|
|
77
394
|
"sentry",
|
|
78
395
|
]);
|
|
396
|
+
const EDGE_SERVER_ENTRYPOINT = "@agent-native/core/server/edge";
|
|
79
397
|
function isNodeOnlyPlugin(filePath) {
|
|
80
398
|
const basename = path.basename(filePath, path.extname(filePath));
|
|
81
399
|
return NODE_ONLY_PLUGINS.has(basename);
|
|
@@ -83,7 +401,7 @@ function isNodeOnlyPlugin(filePath) {
|
|
|
83
401
|
export function generateProvidedPluginsNitroPluginSource(pluginStems) {
|
|
84
402
|
const stems = [...new Set(pluginStems.filter(Boolean))].sort();
|
|
85
403
|
return `// AUTO-GENERATED by @agent-native/core deploy build
|
|
86
|
-
import { markDefaultPluginProvided } from "
|
|
404
|
+
import { markDefaultPluginProvided } from "${EDGE_SERVER_ENTRYPOINT}";
|
|
87
405
|
|
|
88
406
|
const pluginStems = ${JSON.stringify(stems)};
|
|
89
407
|
|
|
@@ -130,7 +448,7 @@ export function addImmutableAssetRouteRulesForClientBuild(routeRules, clientDir,
|
|
|
130
448
|
* If a workspace core is present (monorepo with `agent-native.workspaceCore`
|
|
131
449
|
* configured and the named package resolves), any plugin slot that the
|
|
132
450
|
* workspace core exports is imported from there instead of from
|
|
133
|
-
* `@agent-native/core/server`. This is the middle layer of the three-layer
|
|
451
|
+
* `@agent-native/core/server/edge`. This is the middle layer of the three-layer
|
|
134
452
|
* inheritance model: app local > workspace core > framework default.
|
|
135
453
|
*/
|
|
136
454
|
export function generateWorkerEntry(routes, pluginPaths, defaultPluginStems = [], actions = [], workspaceCore = null, immutableAssetPaths = [], builtAppBasePath = normalizeConfiguredAppBasePath(), options = {}) {
|
|
@@ -207,11 +525,11 @@ export function generateWorkerEntry(routes, pluginPaths, defaultPluginStems = []
|
|
|
207
525
|
pluginImports.push(`import { ${workspaceExportName} as ${varName} } from ${JSON.stringify(`${workspaceCore.packageName}/server`)};`);
|
|
208
526
|
}
|
|
209
527
|
else {
|
|
210
|
-
// Fall back to the framework default from
|
|
528
|
+
// Fall back to the framework default from the edge-safe core entrypoint.
|
|
211
529
|
const defaultExportName = DEFAULT_PLUGIN_REGISTRY[stem];
|
|
212
530
|
if (!defaultExportName)
|
|
213
531
|
continue;
|
|
214
|
-
pluginImports.push(`import { ${defaultExportName} as ${varName} } from "
|
|
532
|
+
pluginImports.push(`import { ${defaultExportName} as ${varName} } from "${EDGE_SERVER_ENTRYPOINT}";`);
|
|
215
533
|
}
|
|
216
534
|
pluginCalls.push(` if (typeof ${varName} === "function") {
|
|
217
535
|
await ${varName}(nitroApp);
|
|
@@ -226,7 +544,7 @@ export function generateWorkerEntry(routes, pluginPaths, defaultPluginStems = []
|
|
|
226
544
|
]
|
|
227
545
|
: [];
|
|
228
546
|
if (generatedPluginMarks.length > 0) {
|
|
229
|
-
pluginImports.unshift(`import { markDefaultPluginProvided as markGeneratedPluginProvided } from "
|
|
547
|
+
pluginImports.unshift(`import { markDefaultPluginProvided as markGeneratedPluginProvided } from "${EDGE_SERVER_ENTRYPOINT}";`);
|
|
230
548
|
}
|
|
231
549
|
return `
|
|
232
550
|
// Auto-generated worker entry point for ${preset}
|
|
@@ -911,8 +1229,8 @@ async function buildCloudflarePages() {
|
|
|
911
1229
|
writeCloudflarePagesStaticShell({ serverDir, distDir, tmpDir });
|
|
912
1230
|
// Exclude _worker.js from being served as a public asset
|
|
913
1231
|
fs.writeFileSync(path.join(distDir, ".assetsignore"), "_worker.js\n");
|
|
914
|
-
// Write
|
|
915
|
-
//
|
|
1232
|
+
// Write package metadata inside _worker.js/ for the ES module worker that
|
|
1233
|
+
// Wrangler compiles and uploads for Cloudflare Pages.
|
|
916
1234
|
fs.mkdirSync(path.join(distDir, "_worker.js"), { recursive: true });
|
|
917
1235
|
fs.writeFileSync(path.join(distDir, "_worker.js", "package.json"), JSON.stringify({ main: "index.js", type: "module" }));
|
|
918
1236
|
// Create empty stub for native modules that wrangler's bundler needs to resolve
|
|
@@ -973,21 +1291,22 @@ async function buildCloudflarePages() {
|
|
|
973
1291
|
// Create stub modules for native/Node-only deps that can't run on Workers.
|
|
974
1292
|
// These get resolved by esbuild instead of the real modules, avoiding bundling
|
|
975
1293
|
// 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
1294
|
const stubDir = path.join(tmpDir, "node_modules");
|
|
985
|
-
for (const mod of
|
|
1295
|
+
for (const [mod, source] of Object.entries(CLOUDFLARE_WORKER_STUB_MODULES)) {
|
|
986
1296
|
const modDir = path.join(stubDir, mod);
|
|
987
1297
|
fs.mkdirSync(modDir, { recursive: true });
|
|
988
|
-
fs.writeFileSync(path.join(modDir, "index.js"),
|
|
1298
|
+
fs.writeFileSync(path.join(modDir, "index.js"), source);
|
|
989
1299
|
fs.writeFileSync(path.join(modDir, "package.json"), JSON.stringify({ name: mod, main: "index.js", type: "module" }));
|
|
990
1300
|
}
|
|
1301
|
+
const stubAliases = Object.keys(CLOUDFLARE_WORKER_STUB_MODULES).map((mod) => `--alias:${mod}=${path.join(stubDir, mod, "index.js")}`);
|
|
1302
|
+
const nodeBuiltinStubDir = path.join(tmpDir, "node-builtin-stubs");
|
|
1303
|
+
fs.mkdirSync(nodeBuiltinStubDir, { recursive: true });
|
|
1304
|
+
const nodeBuiltinStubAliases = [];
|
|
1305
|
+
for (const [mod, source] of Object.entries(CLOUDFLARE_WORKER_NODE_BUILTIN_STUB_MODULES).sort(([a], [b]) => b.length - a.length)) {
|
|
1306
|
+
const stubFile = path.join(nodeBuiltinStubDir, `${mod.replace(/\W+/g, "_")}.js`);
|
|
1307
|
+
fs.writeFileSync(stubFile, source);
|
|
1308
|
+
nodeBuiltinStubAliases.push(`--alias:${mod}=${stubFile}`, `--alias:node:${mod}=${stubFile}`);
|
|
1309
|
+
}
|
|
991
1310
|
const esbuildBin = findEsbuild();
|
|
992
1311
|
// Externalize node builtins (both bare and node: prefixed) — the require
|
|
993
1312
|
// shim handles bare ones. Also alias every `node:*` specifier to its bare
|
|
@@ -1001,8 +1320,15 @@ async function buildCloudflarePages() {
|
|
|
1001
1320
|
// Only externalize bare names. node:* externals would otherwise pin
|
|
1002
1321
|
// the prefix in output; instead we alias node:* → bare so anything that
|
|
1003
1322
|
// resolves past alias land as bare externals.
|
|
1004
|
-
const
|
|
1005
|
-
const
|
|
1323
|
+
const nodeBuiltinStubs = new Set(Object.keys(CLOUDFLARE_WORKER_NODE_BUILTIN_STUB_MODULES));
|
|
1324
|
+
const nodeExternals = builtinNames
|
|
1325
|
+
.filter((n) => !nodeBuiltinStubs.has(n))
|
|
1326
|
+
.sort((a, b) => b.length - a.length)
|
|
1327
|
+
.map((n) => `--external:${n}`);
|
|
1328
|
+
const nodeAliases = builtinNames
|
|
1329
|
+
.filter((n) => !nodeBuiltinStubs.has(n))
|
|
1330
|
+
.sort((a, b) => b.length - a.length)
|
|
1331
|
+
.map((n) => `--alias:node:${n}=${n}`);
|
|
1006
1332
|
// Hard externalize large client-only / node-only libraries so they don't
|
|
1007
1333
|
// bloat the edge worker. These are never executed in the CF Pages runtime
|
|
1008
1334
|
// — mermaid/excalidraw render in the browser, pdf-parse and @google/genai
|
|
@@ -1014,7 +1340,7 @@ async function buildCloudflarePages() {
|
|
|
1014
1340
|
// files. Both import sites degrade gracefully when the runtime import
|
|
1015
1341
|
// fails: context-xray token counts fall back to char/4 estimates and the
|
|
1016
1342
|
// OG image route falls back to SVG.
|
|
1017
|
-
const heavyClientExternals = CLOUDFLARE_WORKER_ESBUILD_EXTERNALS.map((p) => `--external:${p}`);
|
|
1343
|
+
const heavyClientExternals = CLOUDFLARE_WORKER_ESBUILD_EXTERNALS.filter((p) => !Object.hasOwn(CLOUDFLARE_WORKER_STUB_MODULES, p)).map((p) => `--external:${p}`);
|
|
1018
1344
|
execFileSync(esbuildBin, [
|
|
1019
1345
|
tmpEntry,
|
|
1020
1346
|
"--bundle",
|
|
@@ -1040,6 +1366,8 @@ async function buildCloudflarePages() {
|
|
|
1040
1366
|
// Externalize node: builtins — CF Workers runtime provides them
|
|
1041
1367
|
...nodeExternals,
|
|
1042
1368
|
...heavyClientExternals,
|
|
1369
|
+
...stubAliases,
|
|
1370
|
+
...nodeBuiltinStubAliases,
|
|
1043
1371
|
// Rewrite node:* -> bare names so chunks never contain node: imports
|
|
1044
1372
|
...nodeAliases,
|
|
1045
1373
|
], { stdio: "inherit", cwd });
|
|
@@ -1125,6 +1453,7 @@ const NODE_BUILTINS = [
|
|
|
1125
1453
|
"dgram",
|
|
1126
1454
|
"diagnostics_channel",
|
|
1127
1455
|
"dns",
|
|
1456
|
+
"dns/promises",
|
|
1128
1457
|
"domain",
|
|
1129
1458
|
"events",
|
|
1130
1459
|
"fs",
|
|
@@ -1168,22 +1497,12 @@ export function getNodeBuiltinNames() {
|
|
|
1168
1497
|
* Injected via esbuild --inject so CJS deps work on Workers runtime.
|
|
1169
1498
|
*/
|
|
1170
1499
|
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");
|
|
1500
|
+
// Shim Node builtins that Cloudflare Pages can import, and return lazy
|
|
1501
|
+
// unavailable proxies for builtins that Pages Functions reject at upload
|
|
1502
|
+
// time (child_process, fs, net, etc.). This lets optional Node-only code stay
|
|
1503
|
+
// present in the shared bundle without making worker initialization fail.
|
|
1504
|
+
const stubbed = new Set(Object.keys(CLOUDFLARE_WORKER_NODE_BUILTIN_STUB_MODULES));
|
|
1505
|
+
const shimmed = NODE_BUILTINS.filter((name) => !stubbed.has(name));
|
|
1187
1506
|
// Bare module names — CF Pages Functions runs under nodejs_compat v1,
|
|
1188
1507
|
// which rejects "node:fs" and only accepts "fs". The post-build pass in
|
|
1189
1508
|
// buildCloudflarePages() also strips any `node:` prefix that esbuild or
|
|
@@ -1200,8 +1519,13 @@ function generateRequireShim() {
|
|
|
1200
1519
|
const entries = shimmed
|
|
1201
1520
|
.map((m) => `"${m}":__${m.replace("/", "_")}`)
|
|
1202
1521
|
.join(",");
|
|
1522
|
+
const stubEntries = Array.from(stubbed)
|
|
1523
|
+
.sort()
|
|
1524
|
+
.map((m) => `"${m}":__unavailable("${m}")`)
|
|
1525
|
+
.join(",");
|
|
1526
|
+
const allEntries = [entries, stubEntries].filter(Boolean).join(",");
|
|
1203
1527
|
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={${
|
|
1528
|
+
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
1529
|
}
|
|
1206
1530
|
function findEsbuild() {
|
|
1207
1531
|
// Try to resolve esbuild's binary via Node module resolution
|