Skip to content

Commit 357d06e

Browse files
committed
fix: regenerate @astrojs/vercel patch for v9.0.4
The deps update in #382 bumped @astrojs/vercel from 9.0.2 to 9.0.4, which changed dist/index.js enough that the cspMode patch no longer applied. The .d.ts hunk still matched so TypeScript accepted the config, but the runtime JS was unpatched — every static page got its own CSP route entry in config.json, exceeding Vercel's 5MB body limit. Regenerated the patch against 9.0.4 so the global cspMode collapses all per-route CSP headers into a single catch-all route. Made-with: Cursor
1 parent 2c6ba4b commit 357d06e

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

patches/@astrojs__vercel.patch

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,15 @@ index 2f2ec366c9816a861d1ee145923a32f46070af32..1e3c569cacaa8b345c7d27358d80859d
1919
interface VercelISRConfig {
2020
/**
2121
diff --git a/dist/index.js b/dist/index.js
22-
index d54b7b9b013b96e2a9dba1328b412260f2c295ac..f3ae10b373aa599f8de67597c8e98ae53ad1d0a0 100644
22+
index 77a4965d20328c3f0fb89547719eb0c73ecd9f66..c3ce83904f299b10def203fc3c1c2cde620b0d82 100644
2323
--- a/dist/index.js
2424
+++ b/dist/index.js
25-
@@ -418,8 +418,20 @@ function vercelAdapter({
25+
@@ -421,8 +421,19 @@ function vercelAdapter({
2626
if (!normalized.routes) {
2727
normalized.routes = [];
2828
}
2929
- if (experimentalStaticHeaders) {
3030
- const routesWithConfigHeaders = createRoutesWithStaticHeaders(_routeToHeaders, _config);
31-
+ // Normalize `experimentalStaticHeaders` into flags we can use.
3231
+ const _staticHeadersEnabled =
3332
+ experimentalStaticHeaders === true || typeof experimentalStaticHeaders === 'object';
3433
+ const _cspMode =
@@ -45,16 +44,15 @@ index d54b7b9b013b96e2a9dba1328b412260f2c295ac..f3ae10b373aa599f8de67597c8e98ae5
4544
const fileSystemRouteIndex = normalized.routes.findIndex(
4645
(r) => "handle" in r && r.handle === "filesystem"
4746
);
48-
@@ -560,20 +572,31 @@ function getRuntime(process2, logger) {
47+
@@ -563,20 +574,29 @@ function getRuntime(process2, logger) {
4948
}
50-
return "nodejs22.x";
49+
return "nodejs24.x";
5150
}
5251
-function createRoutesWithStaticHeaders(staticHeaders, config) {
5352
+function createRoutesWithStaticHeaders(staticHeaders, config, cspMode = 'per-route') {
5453
const vercelHeaders = [];
5554
+ if (!config.experimental.csp) return vercelHeaders;
5655
+
57-
+ // GLOBAL MODE — collapse to a single catch-all CSP header
5856
+ if (cspMode === 'global') {
5957
+ let csp;
6058
+ for (const { headers } of staticHeaders.values()) {
@@ -67,7 +65,6 @@ index d54b7b9b013b96e2a9dba1328b412260f2c295ac..f3ae10b373aa599f8de67597c8e98ae5
6765
+ return vercelHeaders;
6866
+ }
6967
+
70-
+ // PER-ROUTE MODE — existing behavior
7168
for (const [pathname, { headers }] of staticHeaders.entries()) {
7269
- if (config.experimental.csp) {
7370
- const csp = headers.get("Content-Security-Policy");

pnpm-lock.yaml

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)