diff --git a/client/jest-setup.ts b/client/jest-setup.ts new file mode 100644 index 000000000000..18800eabfb8b --- /dev/null +++ b/client/jest-setup.ts @@ -0,0 +1,8 @@ +//globalThis.IS_REACT_ACT_ENVIRONMENT = true; + +if (!globalThis.TextEncoder || !globalThis.TextDecoder) { + // eslint-disable-next-line @typescript-eslint/no-var-requires + const { TextDecoder, TextEncoder } = require("node:util"); + globalThis.TextEncoder = TextEncoder; + globalThis.TextDecoder = TextDecoder; +} diff --git a/client/package.json b/client/package.json index 7c3de7313cea..87fcd41de3fd 100644 --- a/client/package.json +++ b/client/package.json @@ -58,7 +58,9 @@ "setupFiles": [ "react-app-polyfill/jsdom" ], - "setupFilesAfterEnv": [], + "setupFilesAfterEnv": [ + "/jest-setup.ts" + ], "testEnvironment": "jsdom", "testMatch": [ "/src/**/__tests__/**/*.{js,jsx,ts,tsx}", diff --git a/package.json b/package.json index ff54b4e02b49..98754dd409c8 100644 --- a/package.json +++ b/package.json @@ -240,8 +240,8 @@ "react-dom": "^18.3.1", "react-is": "^18.3.1", "react-refresh": "^0.14", - "react-router": "^6.17.0", - "react-router-dom": "^6.28.0", + "react-router": "^7.0.2", + "react-router-dom": "^7.0.2", "remark-prettier": "^2.0.0", "resolve": "^1.22.8", "resolve-url-loader": "^5.0.0", diff --git a/ssr/index.ts b/ssr/index.ts index 60b1b81623bf..3ab09243c0cd 100644 --- a/ssr/index.ts +++ b/ssr/index.ts @@ -1,5 +1,5 @@ import React from "react"; -import { StaticRouter } from "react-router-dom/server"; +import { StaticRouter } from "react-router-dom"; import { App } from "../client/src/app"; import render from "./render"; diff --git a/yarn.lock b/yarn.lock index a43053fbb357..864db60a889e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2722,11 +2722,6 @@ "@opentelemetry/instrumentation" "^0.49 || ^0.50 || ^0.51 || ^0.52.0" "@opentelemetry/sdk-trace-base" "^1.22" -"@remix-run/router@1.21.0": - version "1.21.0" - resolved "https://registry.yarnpkg.com/@remix-run/router/-/router-1.21.0.tgz#c65ae4262bdcfe415dbd4f64ec87676e4a56e2b5" - integrity sha512-xfSkCAchbdG5PnbrKqFWwia4Bi61nH+wm8wLEqfHDyp7Y3dZzgqS2itV8i4gAq9pC2HsTpwyBC6Ds8VHZ96JlA== - "@rtsao/scc@^1.1.0": version "1.1.0" resolved "https://registry.yarnpkg.com/@rtsao/scc/-/scc-1.1.0.tgz#927dd2fae9bc3361403ac2c7a00c32ddce9ad7e8" @@ -3190,6 +3185,11 @@ dependencies: "@types/node" "*" +"@types/cookie@^0.6.0": + version "0.6.0" + resolved "https://registry.yarnpkg.com/@types/cookie/-/cookie-0.6.0.tgz#eac397f28bf1d6ae0ae081363eca2f425bedf0d5" + integrity sha512-4Kh9a6B2bQciAhf7FSuMRRkUWecJgJu9nPnx3yzpsfXX/c50REIqpHY4C82bXP90qrLtXtkDxTZosYO3UpOwlA== + "@types/debug@^4.0.0": version "4.1.12" resolved "https://registry.yarnpkg.com/@types/debug/-/debug-4.1.12.tgz#a155f21690871953410df4b6b6f53187f0500917" @@ -5376,6 +5376,11 @@ cookie@0.7.2, cookie@^0.7.2: resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.7.2.tgz#556369c472a2ba910f2979891b526b3436237ed7" integrity sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w== +cookie@^1.0.1: + version "1.0.2" + resolved "https://registry.yarnpkg.com/cookie/-/cookie-1.0.2.tgz#27360701532116bd3f1f9416929d176afe1e4610" + integrity sha512-9Kr/j4O16ISv8zBBhJoi4bXOYNTkFLOqSL3UDB0njXxCXNezjeyVrJyGOWtgfs/q2km1gwBcfH8q1yEGoMYunA== + core-js-compat@^3.38.0, core-js-compat@^3.38.1: version "3.39.0" resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.39.0.tgz#b12dccb495f2601dc860bdbe7b4e3ffa8ba63f61" @@ -12665,20 +12670,22 @@ react-refresh@^0.14: resolved "https://registry.yarnpkg.com/react-refresh/-/react-refresh-0.14.2.tgz#3833da01ce32da470f1f936b9d477da5c7028bf9" integrity sha512-jCvmsr+1IUSMUyzOkRcvnVbX3ZYC6g9TDrDbFuFmRDq7PD4yaGbLKNQL6k2jnArV8hjYxh7hVhAZB6s9HDGpZA== -react-router-dom@^6.28.0: - version "6.28.0" - resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-6.28.0.tgz#f73ebb3490e59ac9f299377062ad1d10a9f579e6" - integrity sha512-kQ7Unsl5YdyOltsPGl31zOjLrDv+m2VcIEcIHqYYD3Lp0UppLjrzcfJqDJwXxFw3TH/yvapbnUvPlAj7Kx5nbg== +react-router-dom@^7.0.2: + version "7.0.2" + resolved "https://registry.yarnpkg.com/react-router-dom/-/react-router-dom-7.0.2.tgz#cbd7ce2db7112f1bc3e9eee3657ad32d7515a913" + integrity sha512-VJOQ+CDWFDGaWdrG12Nl+d7yHtLaurNgAQZVgaIy7/Xd+DojgmYLosFfZdGz1wpxmjJIAkAMVTKWcvkx1oggAw== dependencies: - "@remix-run/router" "1.21.0" - react-router "6.28.0" + react-router "7.0.2" -react-router@6.28.0, react-router@^6.17.0: - version "6.28.0" - resolved "https://registry.yarnpkg.com/react-router/-/react-router-6.28.0.tgz#29247c86d7ba901d7e5a13aa79a96723c3e59d0d" - integrity sha512-HrYdIFqdrnhDw0PqG/AKjAqEqM7AvxCz0DQ4h2W8k6nqmc5uRBYDag0SBxx9iYz5G8gnuNVLzUe13wl9eAsXXg== +react-router@7.0.2, react-router@^7.0.2: + version "7.0.2" + resolved "https://registry.yarnpkg.com/react-router/-/react-router-7.0.2.tgz#2820e107cb8cec8acc5db15a17470c056ea86022" + integrity sha512-m5AcPfTRUcjwmhBzOJGEl6Y7+Crqyju0+TgTQxoS4SO+BkWbhOrcfZNq6wSWdl2BBbJbsAoBUb8ZacOFT+/JlA== dependencies: - "@remix-run/router" "1.21.0" + "@types/cookie" "^0.6.0" + cookie "^1.0.1" + set-cookie-parser "^2.6.0" + turbo-stream "2.4.0" react@^18.3.1: version "18.3.1" @@ -13414,6 +13421,11 @@ serve-static@1.16.2: parseurl "~1.3.3" send "0.19.0" +set-cookie-parser@^2.6.0: + version "2.7.1" + resolved "https://registry.yarnpkg.com/set-cookie-parser/-/set-cookie-parser-2.7.1.tgz#3016f150072202dfbe90fadee053573cc89d2943" + integrity sha512-IOc8uWeOZgnb3ptbCURJWNjWUPcO3ZnTTdzsurqERrP6nPyv+paC55vJM0LpOlT2ne+Ix+9+CRG1MNLlyZ4GjQ== + set-function-length@^1.2.1: version "1.2.2" resolved "https://registry.yarnpkg.com/set-function-length/-/set-function-length-1.2.2.tgz#aac72314198eaed975cf77b2c3b6b880695e5449" @@ -14692,6 +14704,11 @@ tunnel-agent@^0.6.0: dependencies: safe-buffer "^5.0.1" +turbo-stream@2.4.0: + version "2.4.0" + resolved "https://registry.yarnpkg.com/turbo-stream/-/turbo-stream-2.4.0.tgz#1e4fca6725e90fa14ac4adb782f2d3759a5695f0" + integrity sha512-FHncC10WpBd2eOmGwpmQsWLDoK4cqsA/UT/GqNoaKOQnT8uzhtCbg3EoUDMvqpOSAI0S26mr0rkjzbOO6S3v1g== + type-check@^0.4.0, type-check@~0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.4.0.tgz#07b8203bfa7056c0657050e3ccd2c37730bab8f1"