[PR #733] feat: lightweight worker for static exports #804

Open
opened 2026-05-06 13:10:11 +02:00 by BreizhHardware · 0 comments

📋 Pull Request Information

Original PR: https://github.com/cloudflare/vinext/pull/733
Author: @raed04
Created: 4/1/2026
Status: 🔄 Open

Base: mainHead: claude/objective-torvalds


📝 Commits (1)

  • 00a2724 feat: lightweight worker for static exports (#566)

📊 Changes

3 files changed (+273 additions, -15 deletions)

View changed files

📝 packages/vinext/src/deploy.ts (+58 -14)
📝 packages/vinext/src/index.ts (+2 -1)
📝 tests/deploy.test.ts (+213 -0)

📄 Description

Summary

Closes #566 — strips the full worker from static export builds.

  • When next.config sets output: "export", vinext deploy now generates a wrangler config that serves pre-rendered files directly via Cloudflare's built-in asset serving — no worker entry, no ASSETS/IMAGES bindings, no KV namespace
  • Adds isStaticExport detection to ProjectInfo (heuristic: reads next.config, strips // and /* */ comments, matches output: "export")
  • Relaxes the Cloudflare plugin guard so static export projects don't need @cloudflare/vite-plugin
  • 24 new tests covering detection edge cases, config generation, and file generation

Changes

File What
packages/vinext/src/deploy.ts detectStaticExport(), isStaticExport on ProjectInfo, static branch in generateWranglerConfig, skip worker in getFilesToGenerate
packages/vinext/src/index.ts Guard uses nextConfig.output !== "export" (already-loaded config)
tests/deploy.test.ts 24 new tests: comment stripping, .cjs/.ts/.mjs detection, block comments, standalone negative, empty/missing config, config priority, direct detectStaticExport, static/non-static wrangler schema, regression guards

Test plan

  • 240/240 deploy tests pass
  • TypeScript type check passes (no errors)
  • Related suites pass: build-report (76), init (59), static-export, prerender
  • Security: block comment false positive eliminated
  • Backward compat: non-static output byte-identical to original

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/cloudflare/vinext/pull/733 **Author:** [@raed04](https://github.com/raed04) **Created:** 4/1/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `claude/objective-torvalds` --- ### 📝 Commits (1) - [`00a2724`](https://github.com/cloudflare/vinext/commit/00a2724e5de1d1b712493f2af080fb31201cb265) feat: lightweight worker for static exports (#566) ### 📊 Changes **3 files changed** (+273 additions, -15 deletions) <details> <summary>View changed files</summary> 📝 `packages/vinext/src/deploy.ts` (+58 -14) 📝 `packages/vinext/src/index.ts` (+2 -1) 📝 `tests/deploy.test.ts` (+213 -0) </details> ### 📄 Description ## Summary Closes #566 — strips the full worker from static export builds. - When `next.config` sets `output: "export"`, `vinext deploy` now generates a wrangler config that serves pre-rendered files directly via Cloudflare's built-in asset serving — no worker entry, no ASSETS/IMAGES bindings, no KV namespace - Adds `isStaticExport` detection to `ProjectInfo` (heuristic: reads next.config, strips `//` and `/* */` comments, matches `output: "export"`) - Relaxes the Cloudflare plugin guard so static export projects don't need `@cloudflare/vite-plugin` - 24 new tests covering detection edge cases, config generation, and file generation ## Changes | File | What | |------|------| | `packages/vinext/src/deploy.ts` | `detectStaticExport()`, `isStaticExport` on `ProjectInfo`, static branch in `generateWranglerConfig`, skip worker in `getFilesToGenerate` | | `packages/vinext/src/index.ts` | Guard uses `nextConfig.output !== "export"` (already-loaded config) | | `tests/deploy.test.ts` | 24 new tests: comment stripping, `.cjs`/`.ts`/`.mjs` detection, block comments, standalone negative, empty/missing config, config priority, direct `detectStaticExport`, static/non-static wrangler schema, regression guards | ## Test plan - [x] 240/240 deploy tests pass - [x] TypeScript type check passes (no errors) - [x] Related suites pass: build-report (76), init (59), static-export, prerender - [x] Security: block comment false positive eliminated - [x] Backward compat: non-static output byte-identical to original --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/vinext#804
No description provided.