@vercel/remix-builder 5.9.2 → 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.
Files changed (2) hide show
  1. package/dist/index.js +20 -0
  2. package/package.json +6 -7
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() : "/"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/remix-builder",
3
- "version": "5.9.2",
3
+ "version": "5.9.4",
4
4
  "license": "Apache-2.0",
5
5
  "main": "./dist/index.js",
6
6
  "homepage": "https://vercel.com/docs",
@@ -27,16 +27,15 @@
27
27
  "@types/semver": "7.3.13",
28
28
  "glob": "10.3.16",
29
29
  "semver": "7.5.2",
30
- "vitest": "2.0.1",
31
- "@vercel/build-utils": "14.0.1"
30
+ "vitest": "4.1.10",
31
+ "@vercel/build-utils": "14.0.5"
32
32
  },
33
33
  "VERCEL_REMIX_RUN_DEV_MAX_VERSION": "2.16.6",
34
34
  "scripts": {
35
35
  "build": "node ../../utils/build-builder.mjs",
36
36
  "test": "vitest run --config ../../vitest.config.mts",
37
- "vitest-run": "vitest -c ../../vitest.config.mts",
38
- "vitest-unit": "glob --absolute 'test/unit.*.test.ts'",
39
- "vitest-e2e": "glob --absolute 'test/integration-*.test.ts'",
40
- "type-check": "tsc --noEmit"
37
+ "test-e2e": "vitest run --config ../../vitest.config.mts test/integration-",
38
+ "type-check": "tsc --noEmit",
39
+ "test-unit": "vitest run --config ../../vitest.config.mts test/unit."
41
40
  }
42
41
  }