@vercel/remix-builder 5.9.3 → 5.9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +20 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2655,6 +2655,20 @@ function shouldRegisterSsrForPrerenderedRoute(path) {
|
|
|
2655
2655
|
function getReactRouterCatchAllDest() {
|
|
2656
2656
|
return "index";
|
|
2657
2657
|
}
|
|
2658
|
+
function getSkewProtectionRoute(env = process.env) {
|
|
2659
|
+
const deploymentId = env.VERCEL_DEPLOYMENT_ID;
|
|
2660
|
+
if (env.VERCEL_SKEW_PROTECTION_ENABLED !== "1" || !deploymentId) {
|
|
2661
|
+
return void 0;
|
|
2662
|
+
}
|
|
2663
|
+
return {
|
|
2664
|
+
src: "/(.*)",
|
|
2665
|
+
has: [{ type: "header", key: "Sec-Fetch-Dest", value: "document" }],
|
|
2666
|
+
headers: {
|
|
2667
|
+
"Set-Cookie": `__vdpl=${deploymentId}; Path=/; SameSite=Strict; Secure; HttpOnly`
|
|
2668
|
+
},
|
|
2669
|
+
continue: true
|
|
2670
|
+
};
|
|
2671
|
+
}
|
|
2658
2672
|
async function chdirAndReadConfig(remixRunDevPath, dir, packageJsonPath) {
|
|
2659
2673
|
const { readConfig } = await import((0, import_path.join)(remixRunDevPath, "dist/config.js"));
|
|
2660
2674
|
const originalCwd = process.cwd();
|
|
@@ -3249,6 +3263,12 @@ var build = async ({
|
|
|
3249
3263
|
}
|
|
3250
3264
|
}
|
|
3251
3265
|
routes.unshift(...prerenderRewrites, { handle: "filesystem" });
|
|
3266
|
+
if (isReactRouter) {
|
|
3267
|
+
const skewProtectionRoute = getSkewProtectionRoute();
|
|
3268
|
+
if (skewProtectionRoute) {
|
|
3269
|
+
routes.unshift(skewProtectionRoute);
|
|
3270
|
+
}
|
|
3271
|
+
}
|
|
3252
3272
|
routes.push({
|
|
3253
3273
|
src: "/(.*)",
|
|
3254
3274
|
dest: isReactRouter && hasReactRouterIndexFunction ? getReactRouterCatchAllDest() : "/"
|