From 57cc5020cea270273b8659f2ea313548d47bca91 Mon Sep 17 00:00:00 2001 From: teukuamru Date: Wed, 27 Nov 2024 17:30:57 +0700 Subject: [PATCH 01/13] chore: install react-router v7 --- packages/nuqs/package.json | 6 +++++- pnpm-lock.yaml | 35 ++++++++++++++++++++++++++++++++--- 2 files changed, 37 insertions(+), 4 deletions(-) diff --git a/packages/nuqs/package.json b/packages/nuqs/package.json index 5bb464f5d..38aae049f 100644 --- a/packages/nuqs/package.json +++ b/packages/nuqs/package.json @@ -117,7 +117,8 @@ "@remix-run/react": ">=2", "next": ">=14.2.0", "react": ">=18.2.0 || ^19.0.0-0", - "react-router-dom": ">=6" + "react-router-dom": ">=6", + "react-router": ">=7" }, "peerDependenciesMeta": { "@remix-run/react": { @@ -128,6 +129,9 @@ }, "react-router-dom": { "optional": true + }, + "react-router": { + "optional": true } }, "devDependencies": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6502d3105..36bb242a9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -435,6 +435,9 @@ importers: mitt: specifier: ^3.0.1 version: 3.0.1 + react-router: + specifier: '>=7' + version: 7.0.1(react-dom@19.0.0-rc.1(react@19.0.0-rc.1))(react@19.0.0-rc.1) devDependencies: '@microsoft/api-extractor': specifier: ^7.47.11 @@ -4177,6 +4180,10 @@ packages: resolution: {integrity: sha512-6DnInpx7SJ2AK3+CTUE/ZM0vWTUboZCegxhC2xiIydHR9jNuTAASBrfEpHhiGOZw/nX51bHt6YQl8jsGo4y/0w==} engines: {node: '>= 0.6'} + cookie@1.0.2: + resolution: {integrity: sha512-9Kr/j4O16ISv8zBBhJoi4bXOYNTkFLOqSL3UDB0njXxCXNezjeyVrJyGOWtgfs/q2km1gwBcfH8q1yEGoMYunA==} + engines: {node: '>=18'} + core-util-is@1.0.2: resolution: {integrity: sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==} @@ -7483,6 +7490,16 @@ packages: peerDependencies: react: '>=16.8' + react-router@7.0.1: + resolution: {integrity: sha512-WVAhv9oWCNsja5AkK6KLpXJDSJCQizOIyOd4vvB/+eHGbYx5vkhcmcmwWjQ9yqkRClogi+xjEg9fNEOd5EX/tw==} + engines: {node: '>=20.0.0'} + peerDependencies: + react: '>=18' + react-dom: '>=18' + peerDependenciesMeta: + react-dom: + optional: true + react-smooth@4.0.1: resolution: {integrity: sha512-OE4hm7XqR0jNOq3Qmk9mFLyd6p2+j6bvbPJ7qlB7+oo0eNcL2l7WQzG6MBnT3EXY6xzkLMUBec3AfewJdA0J8w==} peerDependencies: @@ -12931,6 +12948,8 @@ snapshots: cookie@0.7.1: {} + cookie@1.0.2: {} + core-util-is@1.0.2: {} core-util-is@1.0.3: {} @@ -13590,7 +13609,7 @@ snapshots: debug: 4.3.7(supports-color@8.1.1) enhanced-resolve: 5.17.1 eslint: 9.14.0(jiti@2.3.3) - eslint-module-utils: 2.12.0(@typescript-eslint/parser@8.14.0(eslint@9.14.0(jiti@2.3.3))(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3)(eslint@9.14.0(jiti@2.3.3)) + eslint-module-utils: 2.12.0(@typescript-eslint/parser@8.14.0(eslint@9.14.0(jiti@2.3.3))(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@8.14.0(eslint@9.14.0(jiti@2.3.3))(typescript@5.6.3))(eslint-plugin-import@2.31.0)(eslint@9.14.0(jiti@2.3.3)))(eslint@9.14.0(jiti@2.3.3)) fast-glob: 3.3.2 get-tsconfig: 4.8.1 is-bun-module: 1.2.1 @@ -13603,7 +13622,7 @@ snapshots: - eslint-import-resolver-webpack - supports-color - eslint-module-utils@2.12.0(@typescript-eslint/parser@8.14.0(eslint@9.14.0(jiti@2.3.3))(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3)(eslint@9.14.0(jiti@2.3.3)): + eslint-module-utils@2.12.0(@typescript-eslint/parser@8.14.0(eslint@9.14.0(jiti@2.3.3))(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@8.14.0(eslint@9.14.0(jiti@2.3.3))(typescript@5.6.3))(eslint-plugin-import@2.31.0)(eslint@9.14.0(jiti@2.3.3)))(eslint@9.14.0(jiti@2.3.3)): dependencies: debug: 3.2.7(supports-color@8.1.1) optionalDependencies: @@ -13625,7 +13644,7 @@ snapshots: doctrine: 2.1.0 eslint: 9.14.0(jiti@2.3.3) eslint-import-resolver-node: 0.3.9 - eslint-module-utils: 2.12.0(@typescript-eslint/parser@8.14.0(eslint@9.14.0(jiti@2.3.3))(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3)(eslint@9.14.0(jiti@2.3.3)) + eslint-module-utils: 2.12.0(@typescript-eslint/parser@8.14.0(eslint@9.14.0(jiti@2.3.3))(typescript@5.6.3))(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.3(@typescript-eslint/parser@8.14.0(eslint@9.14.0(jiti@2.3.3))(typescript@5.6.3))(eslint-plugin-import@2.31.0)(eslint@9.14.0(jiti@2.3.3)))(eslint@9.14.0(jiti@2.3.3)) hasown: 2.0.2 is-core-module: 2.15.1 is-glob: 4.0.3 @@ -16886,6 +16905,16 @@ snapshots: '@remix-run/router': 1.21.0 react: 19.0.0-rc.1 + react-router@7.0.1(react-dom@19.0.0-rc.1(react@19.0.0-rc.1))(react@19.0.0-rc.1): + dependencies: + '@types/cookie': 0.6.0 + cookie: 1.0.2 + react: 19.0.0-rc.1 + set-cookie-parser: 2.7.0 + turbo-stream: 2.4.0 + optionalDependencies: + react-dom: 19.0.0-rc.1(react@19.0.0-rc.1) + react-smooth@4.0.1(react-dom@19.0.0-rc.1(react@19.0.0-rc.1))(react@19.0.0-rc.1): dependencies: fast-equals: 5.0.1 From e467149eeb7bc7ce2fe41295fe463a000fad661e Mon Sep 17 00:00:00 2001 From: teukuamru Date: Wed, 27 Nov 2024 17:44:31 +0700 Subject: [PATCH 02/13] ref: adding react-router v6 and v7 --- packages/nuqs/adapters/react-router/v6.d.ts | 7 +++++ packages/nuqs/adapters/react-router/v7.d.ts | 7 +++++ packages/nuqs/src/adapters/react-router/v6.ts | 26 +++++++++++++++++++ packages/nuqs/src/adapters/react-router/v7.ts | 26 +++++++++++++++++++ 4 files changed, 66 insertions(+) create mode 100644 packages/nuqs/adapters/react-router/v6.d.ts create mode 100644 packages/nuqs/adapters/react-router/v7.d.ts create mode 100644 packages/nuqs/src/adapters/react-router/v6.ts create mode 100644 packages/nuqs/src/adapters/react-router/v7.ts diff --git a/packages/nuqs/adapters/react-router/v6.d.ts b/packages/nuqs/adapters/react-router/v6.d.ts new file mode 100644 index 000000000..0e5167b74 --- /dev/null +++ b/packages/nuqs/adapters/react-router/v6.d.ts @@ -0,0 +1,7 @@ +// This file is needed for projects that have `moduleResolution` set to `node` +// in their tsconfig.json to be able to `import {} from 'nuqs/adapters/react-router'`. +// Other module resolutions strategies will look for the `exports` in `package.json`, +// but with `node`, TypeScript will look for a .d.ts file with that name at the +// root of the package. + +export * from '../../dist/adapters/react-router/v6' diff --git a/packages/nuqs/adapters/react-router/v7.d.ts b/packages/nuqs/adapters/react-router/v7.d.ts new file mode 100644 index 000000000..5d4f443fc --- /dev/null +++ b/packages/nuqs/adapters/react-router/v7.d.ts @@ -0,0 +1,7 @@ +// This file is needed for projects that have `moduleResolution` set to `node` +// in their tsconfig.json to be able to `import {} from 'nuqs/adapters/react-router'`. +// Other module resolutions strategies will look for the `exports` in `package.json`, +// but with `node`, TypeScript will look for a .d.ts file with that name at the +// root of the package. + +export * from '../../dist/adapters/react-router/v7' diff --git a/packages/nuqs/src/adapters/react-router/v6.ts b/packages/nuqs/src/adapters/react-router/v6.ts new file mode 100644 index 000000000..14c544c49 --- /dev/null +++ b/packages/nuqs/src/adapters/react-router/v6.ts @@ -0,0 +1,26 @@ +import { useNavigate, useSearchParams } from 'react-router-dom' +import { renderQueryString } from '../../url-encoding' +import type { AdapterOptions } from '../defs' +import { createAdapterProvider } from '../internal.context' + +function useNuqsReactRouterV6Adapter() { + const navigate = useNavigate() + const [searchParams] = useSearchParams() + const updateUrl = (search: URLSearchParams, options: AdapterOptions) => { + navigate( + { + search: renderQueryString(search) + }, + { + replace: options.history === 'replace', + preventScrollReset: !options.scroll + } + ) + } + return { + searchParams, + updateUrl + } +} + +export const NuqsAdapter = createAdapterProvider(useNuqsReactRouterV6Adapter) diff --git a/packages/nuqs/src/adapters/react-router/v7.ts b/packages/nuqs/src/adapters/react-router/v7.ts new file mode 100644 index 000000000..cb5d2bae8 --- /dev/null +++ b/packages/nuqs/src/adapters/react-router/v7.ts @@ -0,0 +1,26 @@ +import { useNavigate, useSearchParams } from 'react-router' +import { renderQueryString } from '../../url-encoding' +import type { AdapterOptions } from '../defs' +import { createAdapterProvider } from '../internal.context' + +function useNuqsReactRouterV7Adapter() { + const navigate = useNavigate() + const [searchParams] = useSearchParams() + const updateUrl = (search: URLSearchParams, options: AdapterOptions) => { + navigate( + { + search: renderQueryString(search) + }, + { + replace: options.history === 'replace', + preventScrollReset: !options.scroll + } + ) + } + return { + searchParams, + updateUrl + } +} + +export const NuqsAdapter = createAdapterProvider(useNuqsReactRouterV7Adapter) From 0ebd63d6ccda404dfcbe89484776f2982223cefc Mon Sep 17 00:00:00 2001 From: teukuamru Date: Wed, 27 Nov 2024 18:50:10 +0700 Subject: [PATCH 03/13] build: add react-router v6 v7 in commonConfig, entrypoint, and package.json --- packages/nuqs/package.json | 10 ++++++++++ packages/nuqs/tsup.config.ts | 4 +++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/packages/nuqs/package.json b/packages/nuqs/package.json index 38aae049f..617aed01a 100644 --- a/packages/nuqs/package.json +++ b/packages/nuqs/package.json @@ -88,6 +88,16 @@ "import": "./dist/adapters/react-router.js", "require": "./esm-only.cjs" }, + "./adapters/react-router/v6": { + "types": "./dist/adapters/react-router/v6.d.ts", + "import": "./dist/adapters/react-router/v6.js", + "require": "./esm-only.cjs" + }, + "./adapters/react-router/v7": { + "types": "./dist/adapters/react-router/v7.d.ts", + "import": "./dist/adapters/react-router/v7.js", + "require": "./esm-only.cjs" + }, "./adapters/custom": { "types": "./dist/adapters/custom.d.ts", "import": "./dist/adapters/custom.js", diff --git a/packages/nuqs/tsup.config.ts b/packages/nuqs/tsup.config.ts index f2374ff9b..63f87c016 100644 --- a/packages/nuqs/tsup.config.ts +++ b/packages/nuqs/tsup.config.ts @@ -7,7 +7,7 @@ const commonConfig = { format: ['esm'], experimentalDts: true, outDir: 'dist', - external: ['next', 'react', '@remix-run/react', 'react-router-dom'], + external: ['next', 'react', '@remix-run/react', 'react-router-dom', 'react-router'], splitting: true, treeshake: true, tsconfig: 'tsconfig.build.json' @@ -22,6 +22,8 @@ const entrypoints = { 'adapters/next/pages': 'src/adapters/next/pages.ts', 'adapters/remix': 'src/adapters/remix.ts', 'adapters/react-router': 'src/adapters/react-router.ts', + 'adapters/react-router/v6': 'src/adapters/react-router/v6.ts', + 'adapters/react-router/v7': 'src/adapters/react-router/v7.ts', 'adapters/custom': 'src/adapters/custom.ts', 'adapters/testing': 'src/adapters/testing.ts' }, From 2d4987cf2ea649ae7fd6c1237cfdf3b5d82fff27 Mon Sep 17 00:00:00 2001 From: teukuamru Date: Thu, 28 Nov 2024 13:40:13 +0700 Subject: [PATCH 04/13] doc: update comment path in react-router d.ts related files --- packages/nuqs/adapters/react-router.d.ts | 2 ++ packages/nuqs/adapters/react-router/v6.d.ts | 2 +- packages/nuqs/adapters/react-router/v7.d.ts | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/nuqs/adapters/react-router.d.ts b/packages/nuqs/adapters/react-router.d.ts index 2d6d92809..c38df8098 100644 --- a/packages/nuqs/adapters/react-router.d.ts +++ b/packages/nuqs/adapters/react-router.d.ts @@ -3,5 +3,7 @@ // Other module resolutions strategies will look for the `exports` in `package.json`, // but with `node`, TypeScript will look for a .d.ts file with that name at the // root of the package. +// This default react-router adapter is for react-router v6. If you are using +// react-router v7, please use adapters/react-router/v7 export * from '../dist/adapters/react-router' diff --git a/packages/nuqs/adapters/react-router/v6.d.ts b/packages/nuqs/adapters/react-router/v6.d.ts index 0e5167b74..4986652a7 100644 --- a/packages/nuqs/adapters/react-router/v6.d.ts +++ b/packages/nuqs/adapters/react-router/v6.d.ts @@ -1,5 +1,5 @@ // This file is needed for projects that have `moduleResolution` set to `node` -// in their tsconfig.json to be able to `import {} from 'nuqs/adapters/react-router'`. +// in their tsconfig.json to be able to `import {} from 'nuqs/adapters/react-router/v6'`. // Other module resolutions strategies will look for the `exports` in `package.json`, // but with `node`, TypeScript will look for a .d.ts file with that name at the // root of the package. diff --git a/packages/nuqs/adapters/react-router/v7.d.ts b/packages/nuqs/adapters/react-router/v7.d.ts index 5d4f443fc..4bce83e91 100644 --- a/packages/nuqs/adapters/react-router/v7.d.ts +++ b/packages/nuqs/adapters/react-router/v7.d.ts @@ -1,5 +1,5 @@ // This file is needed for projects that have `moduleResolution` set to `node` -// in their tsconfig.json to be able to `import {} from 'nuqs/adapters/react-router'`. +// in their tsconfig.json to be able to `import {} from 'nuqs/adapters/react-router/v7'`. // Other module resolutions strategies will look for the `exports` in `package.json`, // but with `node`, TypeScript will look for a .d.ts file with that name at the // root of the package. From 450442fe954f6d8b5e1348af3b18faf86629d9d8 Mon Sep 17 00:00:00 2001 From: teukuamru Date: Thu, 28 Nov 2024 13:47:48 +0700 Subject: [PATCH 05/13] doc: add a note for react-router in docs --- packages/docs/content/docs/adapters.mdx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/docs/content/docs/adapters.mdx b/packages/docs/content/docs/adapters.mdx index eef47619e..0e69f30df 100644 --- a/packages/docs/content/docs/adapters.mdx +++ b/packages/docs/content/docs/adapters.mdx @@ -126,6 +126,8 @@ export function ReactRouter() { } ``` +**Note**: If you are using react-router v7, please import the `NuqsAdapter{:ts}` from `nuqs/adapters/react-router/v7` + ## Testing From 22d69e1acb1ebcfdc7019426c4289741a2ab734c Mon Sep 17 00:00:00 2001 From: Francois Best Date: Sun, 8 Dec 2024 20:05:15 +0100 Subject: [PATCH 06/13] chore: Fix sherif --- packages/nuqs/package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/nuqs/package.json b/packages/nuqs/package.json index 617aed01a..72ba9c7f0 100644 --- a/packages/nuqs/package.json +++ b/packages/nuqs/package.json @@ -127,8 +127,8 @@ "@remix-run/react": ">=2", "next": ">=14.2.0", "react": ">=18.2.0 || ^19.0.0-0", - "react-router-dom": ">=6", - "react-router": ">=7" + "react-router": ">=7", + "react-router-dom": ">=6" }, "peerDependenciesMeta": { "@remix-run/react": { @@ -137,10 +137,10 @@ "next": { "optional": true }, - "react-router-dom": { + "react-router": { "optional": true }, - "react-router": { + "react-router-dom": { "optional": true } }, From 732399b1fab473d55d05c194a4a9e46aaf9d790d Mon Sep 17 00:00:00 2001 From: Francois Best Date: Sun, 8 Dec 2024 16:12:54 +0100 Subject: [PATCH 07/13] test: Split RRv6 & RRv7 e2e test benches --- .github/workflows/ci-cd.yml | 16 +- packages/e2e/react-router/package.json | 32 +-- packages/e2e/react-router/{ => v6}/.gitignore | 0 packages/e2e/react-router/{ => v6}/README.md | 0 packages/e2e/react-router/{ => v6}/index.html | 0 packages/e2e/react-router/v6/package.json | 35 +++ .../e2e/react-router/{ => v6}/src/App.tsx | 0 .../src/components/counter-button.test.tsx | 0 .../src/components/counter-button.tsx | 0 .../src/components/search-input.test.tsx | 0 .../{ => v6}/src/components/search-input.tsx | 0 .../e2e/react-router/{ => v6}/src/main.tsx | 0 .../{ => v6}/src/react-router.tsx | 0 .../react-router/{ => v6}/src/vite-env.d.ts | 0 .../react-router/{ => v6}/tsconfig.app.json | 0 .../e2e/react-router/{ => v6}/tsconfig.json | 0 .../react-router/{ => v6}/tsconfig.node.json | 0 .../e2e/react-router/{ => v6}/vite.config.ts | 0 .../e2e/react-router/{ => v6}/vitest.setup.ts | 0 packages/e2e/react-router/v7/.gitignore | 6 + packages/e2e/react-router/v7/README.md | 100 +++++++ packages/e2e/react-router/v7/app/root.tsx | 61 ++++ packages/e2e/react-router/v7/app/routes.ts | 3 + .../e2e/react-router/v7/app/routes/home.tsx | 12 + packages/e2e/react-router/v7/package.json | 28 ++ .../e2e/react-router/v7/public/favicon.ico | Bin 0 -> 16958 bytes .../react-router/v7/react-router.config.ts | 7 + packages/e2e/react-router/v7/tsconfig.json | 27 ++ packages/e2e/react-router/v7/vite.config.ts | 7 + pnpm-lock.yaml | 260 +++++++++++++++++- turbo.json | 13 +- 31 files changed, 567 insertions(+), 40 deletions(-) rename packages/e2e/react-router/{ => v6}/.gitignore (100%) rename packages/e2e/react-router/{ => v6}/README.md (100%) rename packages/e2e/react-router/{ => v6}/index.html (100%) create mode 100644 packages/e2e/react-router/v6/package.json rename packages/e2e/react-router/{ => v6}/src/App.tsx (100%) rename packages/e2e/react-router/{ => v6}/src/components/counter-button.test.tsx (100%) rename packages/e2e/react-router/{ => v6}/src/components/counter-button.tsx (100%) rename packages/e2e/react-router/{ => v6}/src/components/search-input.test.tsx (100%) rename packages/e2e/react-router/{ => v6}/src/components/search-input.tsx (100%) rename packages/e2e/react-router/{ => v6}/src/main.tsx (100%) rename packages/e2e/react-router/{ => v6}/src/react-router.tsx (100%) rename packages/e2e/react-router/{ => v6}/src/vite-env.d.ts (100%) rename packages/e2e/react-router/{ => v6}/tsconfig.app.json (100%) rename packages/e2e/react-router/{ => v6}/tsconfig.json (100%) rename packages/e2e/react-router/{ => v6}/tsconfig.node.json (100%) rename packages/e2e/react-router/{ => v6}/vite.config.ts (100%) rename packages/e2e/react-router/{ => v6}/vitest.setup.ts (100%) create mode 100644 packages/e2e/react-router/v7/.gitignore create mode 100644 packages/e2e/react-router/v7/README.md create mode 100644 packages/e2e/react-router/v7/app/root.tsx create mode 100644 packages/e2e/react-router/v7/app/routes.ts create mode 100644 packages/e2e/react-router/v7/app/routes/home.tsx create mode 100644 packages/e2e/react-router/v7/package.json create mode 100644 packages/e2e/react-router/v7/public/favicon.ico create mode 100644 packages/e2e/react-router/v7/react-router.config.ts create mode 100644 packages/e2e/react-router/v7/tsconfig.json create mode 100644 packages/e2e/react-router/v7/vite.config.ts diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index 62dce2e51..a4af3bf28 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -155,9 +155,15 @@ jobs: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} e2e-react-router: - name: E2E (react-router) + name: E2E (react-router @${{ matrix.react-router-version }}) runs-on: ubuntu-24.04 needs: [ci-core] + strategy: + fail-fast: false + matrix: + react-router-version: + - 'v6' + - 'v7' steps: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 - uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 @@ -168,7 +174,7 @@ jobs: - name: Install dependencies run: pnpm install - name: Run tests - run: pnpm run test ${{ github.event_name == 'workflow_dispatch' && '--force' || '' }} --filter e2e-react-router + run: pnpm run test ${{ github.event_name == 'workflow_dispatch' && '--force' || '' }} --filter e2e-react-router-${{ matrix.react-router-version }} env: TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} TURBO_TEAM: ${{ secrets.TURBO_TEAM }} @@ -177,14 +183,14 @@ jobs: uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 if: failure() with: - path: packages/e2e/react-router/cypress/screenshots - name: ci-react-router + path: packages/e2e/react-router/${{ matrix.react-router-version }}/cypress/screenshots + name: ci-react-router-${{ matrix.react-router-version }} - uses: 47ng/actions-slack-notify@main name: Notify on Slack if: always() with: status: ${{ job.status }} - jobName: react-router + jobName: react-router-${{ matrix.react-router-version }} env: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} diff --git a/packages/e2e/react-router/package.json b/packages/e2e/react-router/package.json index 6b14cedbd..94f4e755d 100644 --- a/packages/e2e/react-router/package.json +++ b/packages/e2e/react-router/package.json @@ -1,35 +1,5 @@ { "name": "e2e-react-router", - "private": true, "version": "0.0.0", - "type": "module", - "scripts": { - "dev": "vite --port 4000", - "build": "tsc -b && vite build", - "preview": "vite preview", - "test": "pnpm run '/^test:/'", - "test:unit": "vitest", - "test:e2e": "echo 'todo: Implement e2e tests'" - }, - "dependencies": { - "nuqs": "workspace:*", - "react": "catalog:react19", - "react-dom": "catalog:react19", - "react-router-dom": "^6.28.0" - }, - "devDependencies": { - "@testing-library/dom": "^10.4.0", - "@testing-library/jest-dom": "^6.6.3", - "@testing-library/react": "^16.0.1", - "@testing-library/user-event": "^14.5.2", - "@types/node": "^22.9.0", - "@types/react": "catalog:react19", - "@types/react-dom": "catalog:react19", - "@vitejs/plugin-react": "^4.3.3", - "globals": "^15.12.0", - "jsdom": "^25.0.1", - "typescript": "^5.6.3", - "vite": "^5.4.11", - "vitest": "^2.1.5" - } + "private": true } diff --git a/packages/e2e/react-router/.gitignore b/packages/e2e/react-router/v6/.gitignore similarity index 100% rename from packages/e2e/react-router/.gitignore rename to packages/e2e/react-router/v6/.gitignore diff --git a/packages/e2e/react-router/README.md b/packages/e2e/react-router/v6/README.md similarity index 100% rename from packages/e2e/react-router/README.md rename to packages/e2e/react-router/v6/README.md diff --git a/packages/e2e/react-router/index.html b/packages/e2e/react-router/v6/index.html similarity index 100% rename from packages/e2e/react-router/index.html rename to packages/e2e/react-router/v6/index.html diff --git a/packages/e2e/react-router/v6/package.json b/packages/e2e/react-router/v6/package.json new file mode 100644 index 000000000..f37402338 --- /dev/null +++ b/packages/e2e/react-router/v6/package.json @@ -0,0 +1,35 @@ +{ + "name": "e2e-react-router-v6", + "private": true, + "version": "0.0.0", + "type": "module", + "scripts": { + "dev": "vite --port 3006", + "build": "tsc -b && vite build", + "preview": "vite preview", + "test": "pnpm run '/^test:/'", + "test:unit": "vitest", + "test:e2e": "echo 'todo: Implement e2e tests'" + }, + "dependencies": { + "nuqs": "workspace:*", + "react": "catalog:react19", + "react-dom": "catalog:react19", + "react-router-dom": "^6.28.0" + }, + "devDependencies": { + "@testing-library/dom": "^10.4.0", + "@testing-library/jest-dom": "^6.6.3", + "@testing-library/react": "^16.0.1", + "@testing-library/user-event": "^14.5.2", + "@types/node": "^22.9.0", + "@types/react": "catalog:react19", + "@types/react-dom": "catalog:react19", + "@vitejs/plugin-react": "^4.3.3", + "globals": "^15.12.0", + "jsdom": "^25.0.1", + "typescript": "^5.6.3", + "vite": "^5.4.11", + "vitest": "^2.1.5" + } +} diff --git a/packages/e2e/react-router/src/App.tsx b/packages/e2e/react-router/v6/src/App.tsx similarity index 100% rename from packages/e2e/react-router/src/App.tsx rename to packages/e2e/react-router/v6/src/App.tsx diff --git a/packages/e2e/react-router/src/components/counter-button.test.tsx b/packages/e2e/react-router/v6/src/components/counter-button.test.tsx similarity index 100% rename from packages/e2e/react-router/src/components/counter-button.test.tsx rename to packages/e2e/react-router/v6/src/components/counter-button.test.tsx diff --git a/packages/e2e/react-router/src/components/counter-button.tsx b/packages/e2e/react-router/v6/src/components/counter-button.tsx similarity index 100% rename from packages/e2e/react-router/src/components/counter-button.tsx rename to packages/e2e/react-router/v6/src/components/counter-button.tsx diff --git a/packages/e2e/react-router/src/components/search-input.test.tsx b/packages/e2e/react-router/v6/src/components/search-input.test.tsx similarity index 100% rename from packages/e2e/react-router/src/components/search-input.test.tsx rename to packages/e2e/react-router/v6/src/components/search-input.test.tsx diff --git a/packages/e2e/react-router/src/components/search-input.tsx b/packages/e2e/react-router/v6/src/components/search-input.tsx similarity index 100% rename from packages/e2e/react-router/src/components/search-input.tsx rename to packages/e2e/react-router/v6/src/components/search-input.tsx diff --git a/packages/e2e/react-router/src/main.tsx b/packages/e2e/react-router/v6/src/main.tsx similarity index 100% rename from packages/e2e/react-router/src/main.tsx rename to packages/e2e/react-router/v6/src/main.tsx diff --git a/packages/e2e/react-router/src/react-router.tsx b/packages/e2e/react-router/v6/src/react-router.tsx similarity index 100% rename from packages/e2e/react-router/src/react-router.tsx rename to packages/e2e/react-router/v6/src/react-router.tsx diff --git a/packages/e2e/react-router/src/vite-env.d.ts b/packages/e2e/react-router/v6/src/vite-env.d.ts similarity index 100% rename from packages/e2e/react-router/src/vite-env.d.ts rename to packages/e2e/react-router/v6/src/vite-env.d.ts diff --git a/packages/e2e/react-router/tsconfig.app.json b/packages/e2e/react-router/v6/tsconfig.app.json similarity index 100% rename from packages/e2e/react-router/tsconfig.app.json rename to packages/e2e/react-router/v6/tsconfig.app.json diff --git a/packages/e2e/react-router/tsconfig.json b/packages/e2e/react-router/v6/tsconfig.json similarity index 100% rename from packages/e2e/react-router/tsconfig.json rename to packages/e2e/react-router/v6/tsconfig.json diff --git a/packages/e2e/react-router/tsconfig.node.json b/packages/e2e/react-router/v6/tsconfig.node.json similarity index 100% rename from packages/e2e/react-router/tsconfig.node.json rename to packages/e2e/react-router/v6/tsconfig.node.json diff --git a/packages/e2e/react-router/vite.config.ts b/packages/e2e/react-router/v6/vite.config.ts similarity index 100% rename from packages/e2e/react-router/vite.config.ts rename to packages/e2e/react-router/v6/vite.config.ts diff --git a/packages/e2e/react-router/vitest.setup.ts b/packages/e2e/react-router/v6/vitest.setup.ts similarity index 100% rename from packages/e2e/react-router/vitest.setup.ts rename to packages/e2e/react-router/v6/vitest.setup.ts diff --git a/packages/e2e/react-router/v7/.gitignore b/packages/e2e/react-router/v7/.gitignore new file mode 100644 index 000000000..9b7c041f9 --- /dev/null +++ b/packages/e2e/react-router/v7/.gitignore @@ -0,0 +1,6 @@ +.DS_Store +/node_modules/ + +# React Router +/.react-router/ +/build/ diff --git a/packages/e2e/react-router/v7/README.md b/packages/e2e/react-router/v7/README.md new file mode 100644 index 000000000..e0d20664e --- /dev/null +++ b/packages/e2e/react-router/v7/README.md @@ -0,0 +1,100 @@ +# Welcome to React Router! + +A modern, production-ready template for building full-stack React applications using React Router. + +[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/remix-run/react-router-templates/tree/main/default) + +## Features + +- 🚀 Server-side rendering +- ⚡️ Hot Module Replacement (HMR) +- 📦 Asset bundling and optimization +- 🔄 Data loading and mutations +- 🔒 TypeScript by default +- 🎉 TailwindCSS for styling +- 📖 [React Router docs](https://reactrouter.com/) + +## Getting Started + +### Installation + +Install the dependencies: + +```bash +npm install +``` + +### Development + +Start the development server with HMR: + +```bash +npm run dev +``` + +Your application will be available at `http://localhost:5173`. + +## Building for Production + +Create a production build: + +```bash +npm run build +``` + +## Deployment + +### Docker Deployment + +This template includes three Dockerfiles optimized for different package managers: + +- `Dockerfile` - for npm +- `Dockerfile.pnpm` - for pnpm +- `Dockerfile.bun` - for bun + +To build and run using Docker: + +```bash +# For npm +docker build -t my-app . + +# For pnpm +docker build -f Dockerfile.pnpm -t my-app . + +# For bun +docker build -f Dockerfile.bun -t my-app . + +# Run the container +docker run -p 3000:3000 my-app +``` + +The containerized application can be deployed to any platform that supports Docker, including: + +- AWS ECS +- Google Cloud Run +- Azure Container Apps +- Digital Ocean App Platform +- Fly.io +- Railway + +### DIY Deployment + +If you're familiar with deploying Node applications, the built-in app server is production-ready. + +Make sure to deploy the output of `npm run build` + +``` +├── package.json +├── package-lock.json (or pnpm-lock.yaml, or bun.lockb) +├── build/ +│ ├── client/ # Static assets +│ └── server/ # Server-side code +``` + +## Styling + +This template comes with [Tailwind CSS](https://tailwindcss.com/) already configured for a simple default starting experience. You can use whatever CSS framework you prefer. + +--- + +Built with ❤️ using React Router. diff --git a/packages/e2e/react-router/v7/app/root.tsx b/packages/e2e/react-router/v7/app/root.tsx new file mode 100644 index 000000000..f7ee4c0db --- /dev/null +++ b/packages/e2e/react-router/v7/app/root.tsx @@ -0,0 +1,61 @@ +import { + isRouteErrorResponse, + Links, + Meta, + Outlet, + Scripts, + ScrollRestoration +} from 'react-router' + +import type { Route } from './+types/root' + +export function Layout({ children }: { children: React.ReactNode }) { + return ( + + + + + + + + + {children} + + + + + ) +} + +export default function App() { + return +} + +export function ErrorBoundary({ error }: Route.ErrorBoundaryProps) { + let message = 'Oops!' + let details = 'An unexpected error occurred.' + let stack: string | undefined + + if (isRouteErrorResponse(error)) { + message = error.status === 404 ? '404' : 'Error' + details = + error.status === 404 + ? 'The requested page could not be found.' + : error.statusText || details + } else if (import.meta.env.DEV && error && error instanceof Error) { + details = error.message + stack = error.stack + } + + return ( +
+

{message}

+

{details}

+ {stack && ( +
+          {stack}
+        
+ )} +
+ ) +} diff --git a/packages/e2e/react-router/v7/app/routes.ts b/packages/e2e/react-router/v7/app/routes.ts new file mode 100644 index 000000000..102b40258 --- /dev/null +++ b/packages/e2e/react-router/v7/app/routes.ts @@ -0,0 +1,3 @@ +import { type RouteConfig, index } from "@react-router/dev/routes"; + +export default [index("routes/home.tsx")] satisfies RouteConfig; diff --git a/packages/e2e/react-router/v7/app/routes/home.tsx b/packages/e2e/react-router/v7/app/routes/home.tsx new file mode 100644 index 000000000..a584b0153 --- /dev/null +++ b/packages/e2e/react-router/v7/app/routes/home.tsx @@ -0,0 +1,12 @@ +import type { Route } from './+types/home' + +export function meta({}: Route.MetaArgs) { + return [ + { title: 'New React Router App' }, + { name: 'description', content: 'Welcome to React Router!' } + ] +} + +export default function Home() { + return

Hello, RRv7

+} diff --git a/packages/e2e/react-router/v7/package.json b/packages/e2e/react-router/v7/package.json new file mode 100644 index 000000000..ecef08e10 --- /dev/null +++ b/packages/e2e/react-router/v7/package.json @@ -0,0 +1,28 @@ +{ + "name": "e2e-react-router-v7", + "private": true, + "type": "module", + "scripts": { + "build": "react-router build", + "dev": "react-router dev --port 3007", + "start": "react-router-serve ./build/server/index.js", + "typecheck": "react-router typegen && tsc" + }, + "dependencies": { + "@react-router/node": "^7.0.2", + "@react-router/serve": "^7.0.2", + "isbot": "^5.1.17", + "react": "catalog:react19", + "react-dom": "catalog:react19", + "react-router": "^7.0.2" + }, + "devDependencies": { + "@react-router/dev": "^7.0.2", + "@types/node": "^20", + "@types/react": "catalog:react19", + "@types/react-dom": "catalog:react19", + "typescript": "^5.6.3", + "vite": "^5.4.11", + "vite-tsconfig-paths": "^5.1.2" + } +} diff --git a/packages/e2e/react-router/v7/public/favicon.ico b/packages/e2e/react-router/v7/public/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..8830cf6821b354114848e6354889b8ecf6d2bc61 GIT binary patch literal 16958 zcmeI3+jCXb9mnJN2h^uNlXH@jlam{_a8F3W{T}Wih>9YJpaf7TUbu)A5fv|h7OMfR zR;q$lr&D!wv|c)`wcw1?>4QT1(&|jdsrI2h`Rn)dTW5t$8pz=s3_5L?#oBxAowe8R z_WfPfN?F+@`q$D@rvC?(W!uWieppskmQ~YG*>*L?{img@tWpnYXZslxeh#TSUS3{q z1Ju6JcfQSbQuORq69@YK(X-3c9vC2c2a2z~zw=F=50@pm0PUiCAm!bAT?2jpM`(^b zC|2&Ngngt^<>oCv#?P(AZ`5_84x#QBPulix)TpkIAUp=(KgGo4CVS~Sxt zVoR4>r5g9%bDh7hi0|v$={zr>CHd`?-l4^Ld(Z9PNz9piFY+llUw_x4ou7Vf-q%$g z)&)J4>6Ft~RZ(uV>dJD|`nxI1^x{X@Z5S<=vf;V3w_(*O-7}W<=e$=}CB9_R;)m9)d7`d_xx+nl^Bg|%ew=?uoKO8w zeQU7h;~8s!@9-k>7Cx}1SDQ7m(&miH zs8!l*wOJ!GHbdh)pD--&W3+w`9YJ=;m^FtMY=`mTq8pyV!-@L6smwp3(q?G>=_4v^ zn(ikLue7!y70#2uhqUVpb7fp!=xu2{aM^1P^pts#+feZv8d~)2sf`sjXLQCEj;pdI z%~f`JOO;*KnziMv^i_6+?mL?^wrE_&=IT9o1i!}Sd4Sx4O@w~1bi1)8(sXvYR-1?7~Zr<=SJ1Cw!i~yfi=4h6o3O~(-Sb2Ilwq%g$+V` z>(C&N1!FV5rWF&iwt8~b)=jIn4b!XbrWrZgIHTISrdHcpjjx=TwJXI7_%Ks4oFLl9 zNT;!%!P4~xH85njXdfqgnIxIFOOKW`W$fxU%{{5wZkVF^G=JB$oUNU5dQSL&ZnR1s z*ckJ$R`eCUJsWL>j6*+|2S1TL_J|Fl&kt=~XZF=+=iT0Xq1*KU-NuH%NAQff$LJp3 zU_*a;@7I0K{mqwux87~vwsp<}@P>KNDb}3U+6$rcZ114|QTMUSk+rhPA(b{$>pQTc zIQri{+U>GMzsCy0Mo4BfWXJlkk;RhfpWpAB{=Rtr*d1MNC+H3Oi5+3D$gUI&AjV-1 z=0ZOox+bGyHe=yk-yu%=+{~&46C$ut^ZN+ysx$NH}*F43)3bKkMsxGyIl#>7Yb8W zO{}&LUO8Ow{7>!bvSq?X{15&Y|4}0w2=o_^0ZzYgB+4HhZ4>s*mW&?RQ6&AY|CPcx z$*LjftNS|H)ePYnIKNg{ck*|y7EJ&Co0ho0K`!{ENPkASeKy-JWE}dF_%}j)Z5a&q zXAI2gPu6`s-@baW=*+keiE$ALIs5G6_X_6kgKK8n3jH2-H9`6bo)Qn1 zZ2x)xPt1=`9V|bE4*;j9$X20+xQCc$rEK|9OwH-O+Q*k`ZNw}K##SkY z3u}aCV%V|j@!gL5(*5fuWo>JFjeU9Qqk`$bdwH8(qZovE2tA7WUpoCE=VKm^eZ|vZ z(k<+j*mGJVah>8CkAsMD6#I$RtF;#57Wi`c_^k5?+KCmX$;Ky2*6|Q^bJ8+s%2MB}OH-g$Ev^ zO3uqfGjuN%CZiu<`aCuKCh{kK!dDZ+CcwgIeU2dsDfz+V>V3BDb~)~ zO!2l!_)m;ZepR~sL+-~sHS7;5ZB|~uUM&&5vDda2b z)CW8S6GI*oF><|ZeY5D^+Mcsri)!tmrM33qvwI4r9o@(GlW!u2R>>sB|E#%W`c*@5 z|0iA|`{6aA7D4Q?vc1{vT-#yytn07`H!QIO^1+X7?zG3%y0gPdIPUJ#s*DNAwd}m1_IMN1^T&be~+E z_z%1W^9~dl|Me9U6+3oNyuMDkF*z_;dOG(Baa*yq;TRiw{EO~O_S6>e*L(+Cdu(TM z@o%xTCV%hi&p)x3_inIF!b|W4|AF5p?y1j)cr9RG@v%QVaN8&LaorC-kJz_ExfVHB za!mtuee#Vb?dh&bwrfGHYAiX&&|v$}U*UBM;#F!N=x>x|G5s0zOa9{(`=k4v^6iK3 z8d&=O@xhDs{;v7JQ%eO;!Bt`&*MH&d zp^K#dkq;jnJz%%bsqwlaKA5?fy zS5JDbO#BgSAdi8NM zDo2SifX6^Z;vn>cBh-?~r_n9qYvP|3ihrnqq6deS-#>l#dV4mX|G%L8|EL;$U+w69 z;rTK3FW$ewUfH|R-Z;3;jvpfiDm?Fvyu9PeR>wi|E8>&j2Z@2h`U}|$>2d`BPV3pz#ViIzH8v6pP^L-p!GbLv<;(p>}_6u&E6XO5- zJ8JEvJ1)0>{iSd|kOQn#?0rTYL=KSmgMHCf$Qbm;7|8d(goD&T-~oCDuZf57iP#_Y zmxaoOSjQsm*^u+m$L9AMqwi=6bpdiAY6k3akjGN{xOZ`_J<~Puyzpi7yhhKrLmXV; z@ftONPy;Uw1F#{_fyGbk04yLE01v=i_5`RqQP+SUH0nb=O?l!J)qCSTdsbmjFJrTm zx4^ef@qt{B+TV_OHOhtR?XT}1Etm(f21;#qyyW6FpnM+S7*M1iME?9fe8d-`Q#InN z?^y{C_|8bxgUE@!o+Z72C)BrS&5D`gb-X8kq*1G7Uld-z19V}HY~mK#!o9MC-*#^+ znEsdc-|jj0+%cgBMy(cEkq4IQ1D*b;17Lyp>Utnsz%LRTfjQKL*vo(yJxwtw^)l|! z7jhIDdtLB}mpkOIG&4@F+9cYkS5r%%jz}I0R#F4oBMf-|Jmmk* zk^OEzF%}%5{a~kGYbFjV1n>HKC+a`;&-n*v_kD2DPP~n5(QE3C;30L<32GB*qV2z$ zWR1Kh=^1-q)P37WS6YWKlUSDe=eD^u_CV+P)q!3^{=$#b^auGS7m8zFfFS<>(e~)TG z&uwWhSoetoe!1^%)O}=6{SUcw-UQmw+i8lokRASPsbT=H|4D|( zk^P7>TUEFho!3qXSWn$m2{lHXw zD>eN6-;wwq9(?@f^F4L2Ny5_6!d~iiA^s~(|B*lbZir-$&%)l>%Q(36yOIAu|326K ztmBWz|MLA{Kj(H_{w2gd*nZ6a@ma(w==~EHIscEk|C=NGJa%Ruh4_+~f|%rt{I5v* zIX@F?|KJID56-ivb+PLo(9hn_CdK{irOcL15>JNQFY112^$+}JPyI{uQ~$&E*=ri; z`d^fH?4f=8vKHT4!p9O*fX(brB75Y9?e>T9=X#Fc@V#%@5^)~#zu5I(=>LQA-EGTS zecy*#6gG+8lapch#Hh%vl(+}J;Q!hC1OKoo;#h3#V%5Js)tQ)|>pTT@1ojd+F9Gey zg`B)zm`|Mo%tH31s4=<+`Pu|B3orXwNyIcNN>;fBkIj^X8P}RXhF= zXQK1u5RLN7k#_Q(KznJrALtMM13!vhfr025ar?@-%{l|uWt@NEd<$~n>RQL{ z+o;->n)+~0tt(u|o_9h!T`%M8%)w2awpV9b*xz9Pl-daUJm3y-HT%xg`^mFd6LBeL z!0~s;zEr)Bn9x)I(wx`;JVwvRcc^io2XX(Nn3vr3dgbrr@YJ?K3w18P*52^ieBCQP z=Up1V$N2~5ppJHRTeY8QfM(7Yv&RG7oWJAyv?c3g(29)P)u;_o&w|&)HGDIinXT~p z3;S|e$=&Tek9Wn!`cdY+d-w@o`37}x{(hl>ykB|%9yB$CGdIcl7Z?d&lJ%}QHck77 zJPR%C+s2w1_Dl_pxu6$Zi!`HmoD-%7OD@7%lKLL^Ixd9VlRSW*o&$^iQ2z+}hTgH) z#91TO#+jH<`w4L}XWOt(`gqM*uTUcky`O(mEyU|4dJoy6*UZJ7%*}ajuos%~>&P2j zk23f5<@GeV?(?`l=ih+D8t`d72xrUjv0wsg;%s1@*2p?TQ;n2$pV7h?_T%sL>iL@w zZ{lmc<|B7!e&o!zs6RW+u8+aDyUdG>ZS(v&rT$QVymB7sEC@VsK1dg^3F@K90-wYB zX!we79qx`(6LA>F$~{{xE8-3Wzyfe`+Lsce(?uj{k@lb97YTJt#>l*Z&LyKX@zjmu?UJC9w~;|NsB{%7G}y*uNDBxirfC EKbET!0{{R3 literal 0 HcmV?d00001 diff --git a/packages/e2e/react-router/v7/react-router.config.ts b/packages/e2e/react-router/v7/react-router.config.ts new file mode 100644 index 000000000..6ff16f917 --- /dev/null +++ b/packages/e2e/react-router/v7/react-router.config.ts @@ -0,0 +1,7 @@ +import type { Config } from "@react-router/dev/config"; + +export default { + // Config options... + // Server-side render by default, to enable SPA mode set this to `false` + ssr: true, +} satisfies Config; diff --git a/packages/e2e/react-router/v7/tsconfig.json b/packages/e2e/react-router/v7/tsconfig.json new file mode 100644 index 000000000..dc391a45f --- /dev/null +++ b/packages/e2e/react-router/v7/tsconfig.json @@ -0,0 +1,27 @@ +{ + "include": [ + "**/*", + "**/.server/**/*", + "**/.client/**/*", + ".react-router/types/**/*" + ], + "compilerOptions": { + "lib": ["DOM", "DOM.Iterable", "ES2022"], + "types": ["node", "vite/client"], + "target": "ES2022", + "module": "ES2022", + "moduleResolution": "bundler", + "jsx": "react-jsx", + "rootDirs": [".", "./.react-router/types"], + "baseUrl": ".", + "paths": { + "~/*": ["./app/*"] + }, + "esModuleInterop": true, + "verbatimModuleSyntax": true, + "noEmit": true, + "resolveJsonModule": true, + "skipLibCheck": true, + "strict": true + } +} diff --git a/packages/e2e/react-router/v7/vite.config.ts b/packages/e2e/react-router/v7/vite.config.ts new file mode 100644 index 000000000..bb848d388 --- /dev/null +++ b/packages/e2e/react-router/v7/vite.config.ts @@ -0,0 +1,7 @@ +import { reactRouter } from '@react-router/dev/vite' +import { defineConfig } from 'vite' +import tsconfigPaths from 'vite-tsconfig-paths' + +export default defineConfig({ + plugins: [reactRouter(), tsconfigPaths()] +}) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0da42f176..d15dcd7a1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -305,11 +305,13 @@ importers: specifier: ^2.1.5 version: 2.1.5(@types/node@22.9.0)(jsdom@25.0.1)(lightningcss@1.27.0)(terser@5.34.1) - packages/e2e/react-router: + packages/e2e/react-router: {} + + packages/e2e/react-router/v6: dependencies: nuqs: specifier: workspace:* - version: link:../../nuqs + version: link:../../../nuqs react: specifier: catalog:react19 version: 19.0.0 @@ -360,6 +362,49 @@ importers: specifier: ^2.1.5 version: 2.1.5(@types/node@22.9.0)(jsdom@25.0.1)(lightningcss@1.27.0)(terser@5.34.1) + packages/e2e/react-router/v7: + dependencies: + '@react-router/node': + specifier: ^7.0.2 + version: 7.0.2(react-router@7.0.2(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(typescript@5.6.3) + '@react-router/serve': + specifier: ^7.0.2 + version: 7.0.2(react-router@7.0.2(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(typescript@5.6.3) + isbot: + specifier: ^5.1.17 + version: 5.1.17 + react: + specifier: catalog:react19 + version: 19.0.0 + react-dom: + specifier: catalog:react19 + version: 19.0.0(react@19.0.0) + react-router: + specifier: ^7.0.2 + version: 7.0.2(react-dom@19.0.0(react@19.0.0))(react@19.0.0) + devDependencies: + '@react-router/dev': + specifier: ^7.0.2 + version: 7.0.2(@react-router/serve@7.0.2(react-router@7.0.2(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(typescript@5.6.3))(@types/node@20.17.9)(lightningcss@1.27.0)(react-router@7.0.2(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(terser@5.34.1)(typescript@5.6.3)(vite@5.4.11(@types/node@20.17.9)(lightningcss@1.27.0)(terser@5.34.1)) + '@types/node': + specifier: ^20 + version: 20.17.9 + '@types/react': + specifier: catalog:react19 + version: 19.0.0 + '@types/react-dom': + specifier: catalog:react19 + version: 19.0.0 + typescript: + specifier: ^5.6.3 + version: 5.6.3 + vite: + specifier: ^5.4.11 + version: 5.4.11(@types/node@20.17.9)(lightningcss@1.27.0)(terser@5.34.1) + vite-tsconfig-paths: + specifier: ^5.1.2 + version: 5.1.2(typescript@5.6.3)(vite@5.4.11(@types/node@20.17.9)(lightningcss@1.27.0)(terser@5.34.1)) + packages/e2e/remix: dependencies: '@remix-run/node': @@ -1768,6 +1813,9 @@ packages: '@microsoft/tsdoc@0.15.0': resolution: {integrity: sha512-HZpPoABogPvjeJOdzCOSJsXeL/SMCBgBZMVC3X3d7YYp2gf31MfxhUoYUNwf1ERPJOnQc0wkFn9trqI6ZEdZuA==} + '@mjackson/node-fetch-server@0.2.0': + resolution: {integrity: sha512-EMlH1e30yzmTpGLQjlFmaDAjyOeZhng1/XCd7DExR8PNAnG/G1tyruZxEoUe11ClnwGhGrtsdnyyUx1frSzjng==} + '@next/env@15.0.3': resolution: {integrity: sha512-t9Xy32pjNOvVn2AS+Utt6VmyrshbpfUMhIjFO60gI58deSo/KgLOp31XZ4O+kY/Is8WAGYwA5gR7kOb1eORDBA==} @@ -2619,6 +2667,52 @@ packages: peerDependencies: react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0 + '@react-router/dev@7.0.2': + resolution: {integrity: sha512-uT9OVTGJAtOHGSvAlES4Y2HLqLQ7pENffUhlS7Is7eEVWQeTfZei/1RXTnNwpLbwAuDEf7DHbINDeVLDdjP92w==} + engines: {node: '>=20.0.0'} + hasBin: true + peerDependencies: + '@react-router/serve': ^7.0.2 + react-router: ^7.0.2 + typescript: ^5.1.0 + vite: ^5.1.0 + wrangler: ^3.28.2 + peerDependenciesMeta: + '@react-router/serve': + optional: true + typescript: + optional: true + wrangler: + optional: true + + '@react-router/express@7.0.2': + resolution: {integrity: sha512-rhKt/bylEdZNHKzOI8NzP6b27fiJ2zjf59b/boWWOwjuDk6ZEdV1iLa2Nvm55qN1mj2zSx3H/9Tx/ZPHgrGEgw==} + engines: {node: '>=20.0.0'} + peerDependencies: + express: ^4.17.1 + react-router: 7.0.2 + typescript: ^5.1.0 + peerDependenciesMeta: + typescript: + optional: true + + '@react-router/node@7.0.2': + resolution: {integrity: sha512-6Of5M2wP9QgYlR+boR0ptPjh3UyfaNvPMKQihowTGjAjUZIoNqz4iBn8ClNsLFbT3KQewcnNTHi2p+Ou7S4ZyQ==} + engines: {node: '>=20.0.0'} + peerDependencies: + react-router: 7.0.2 + typescript: ^5.1.0 + peerDependenciesMeta: + typescript: + optional: true + + '@react-router/serve@7.0.2': + resolution: {integrity: sha512-kVoU2aeCRJ7rMWXtzJaFw52DgGhk8SqbgGpVQXIOj2QFN2rqrDz7L/WyIhCeOEztTSBgZxID0qDE7DPdbnHkkQ==} + engines: {node: '>=20.0.0'} + hasBin: true + peerDependencies: + react-router: 7.0.2 + '@react-stately/utils@3.10.4': resolution: {integrity: sha512-gBEQEIMRh5f60KCm7QKQ2WfvhB2gLUr9b72sqUdIZ2EG+xuPgaIlCBeSicvjmjBvYZwOjoOEnmIkcx2GHp/HWw==} peerDependencies: @@ -3301,6 +3395,9 @@ packages: '@types/node@14.18.63': resolution: {integrity: sha512-fAtCfv4jJg+ExtXhvCkCqUKZ+4ok/JQk01qDKhL5BDDoS3AxKXhV5/MAVUZyQnSEd2GT92fkgZl0pz0Q0AzcIQ==} + '@types/node@20.17.9': + resolution: {integrity: sha512-0JOXkRyLanfGPE2QRCwgxhzlBAvaRdCNMcvbd7jFfpmD4eEXll7LRwy5ymJmyeZqk7Nh7eD2LeUyQ68BbndmXw==} + '@types/node@22.9.0': resolution: {integrity: sha512-vuyHg81vvWA1Z1ELfvLko2c8f34gyA0zaic0+Rllc5lbCnbSyuvb2Oxpm6TAUAC/2xZN3QGqxBNggD1nNR2AfQ==} @@ -3770,6 +3867,9 @@ packages: resolution: {integrity: sha512-qIj0G9wZbMGNLjLmg1PT6v2mE9AH2zlnADJD/2tC6E00hgmhUOfEB6greHPAfLRSufHqROIUTkw6E+M3lH0PTQ==} engines: {node: '>= 0.4'} + babel-dead-code-elimination@1.0.6: + resolution: {integrity: sha512-JxFi9qyRJpN0LjEbbjbN8g0ux71Qppn9R8Qe3k6QzHg2CaKsbUQtbn307LQGiDLGjV6JCtEFqfxzVig9MyDCHQ==} + babel-plugin-react-compiler@19.0.0-beta-a7bf2bd-20241110: resolution: {integrity: sha512-WdxXtLxsV4gh/GlEK4fuFDGkcED0Wb9UJEBB6Uc1SFqRFEmJNFKboW+Z4NUS5gYrPImqrjh4IwHAmgS6ZBg4Cg==} @@ -7503,6 +7603,16 @@ packages: react-dom: optional: true + react-router@7.0.2: + resolution: {integrity: sha512-m5AcPfTRUcjwmhBzOJGEl6Y7+Crqyju0+TgTQxoS4SO+BkWbhOrcfZNq6wSWdl2BBbJbsAoBUb8ZacOFT+/JlA==} + engines: {node: '>=20.0.0'} + peerDependencies: + react: '>=18' + react-dom: '>=18' + peerDependenciesMeta: + react-dom: + optional: true + react-smooth@4.0.1: resolution: {integrity: sha512-OE4hm7XqR0jNOq3Qmk9mFLyd6p2+j6bvbPJ7qlB7+oo0eNcL2l7WQzG6MBnT3EXY6xzkLMUBec3AfewJdA0J8w==} peerDependencies: @@ -10081,6 +10191,8 @@ snapshots: '@microsoft/tsdoc@0.15.0': {} + '@mjackson/node-fetch-server@0.2.0': {} + '@next/env@15.0.3': {} '@next/swc-darwin-arm64@15.0.3': @@ -11025,6 +11137,87 @@ snapshots: clsx: 2.1.1 react: 19.0.0 + '@react-router/dev@7.0.2(@react-router/serve@7.0.2(react-router@7.0.2(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(typescript@5.6.3))(@types/node@20.17.9)(lightningcss@1.27.0)(react-router@7.0.2(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(terser@5.34.1)(typescript@5.6.3)(vite@5.4.11(@types/node@20.17.9)(lightningcss@1.27.0)(terser@5.34.1))': + dependencies: + '@babel/core': 7.25.7 + '@babel/generator': 7.25.7 + '@babel/parser': 7.25.7 + '@babel/plugin-syntax-decorators': 7.25.7(@babel/core@7.25.7) + '@babel/plugin-syntax-jsx': 7.25.7(@babel/core@7.25.7) + '@babel/preset-typescript': 7.25.7(@babel/core@7.25.7) + '@babel/traverse': 7.25.7 + '@babel/types': 7.25.7 + '@npmcli/package-json': 4.0.1 + '@react-router/node': 7.0.2(react-router@7.0.2(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(typescript@5.6.3) + arg: 5.0.2 + babel-dead-code-elimination: 1.0.6 + chokidar: 4.0.1 + dedent: 1.5.3 + es-module-lexer: 1.5.4 + exit-hook: 2.2.1 + fs-extra: 10.1.0 + gunzip-maybe: 1.4.2 + jsesc: 3.0.2 + lodash: 4.17.21 + pathe: 1.1.2 + picocolors: 1.1.1 + picomatch: 2.3.1 + prettier: 2.8.8 + react-refresh: 0.14.2 + react-router: 7.0.2(react-dom@19.0.0(react@19.0.0))(react@19.0.0) + semver: 7.6.3 + set-cookie-parser: 2.7.0 + valibot: 0.41.0(typescript@5.6.3) + vite: 5.4.11(@types/node@20.17.9)(lightningcss@1.27.0)(terser@5.34.1) + vite-node: 1.6.0(@types/node@20.17.9)(lightningcss@1.27.0)(terser@5.34.1) + optionalDependencies: + '@react-router/serve': 7.0.2(react-router@7.0.2(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(typescript@5.6.3) + typescript: 5.6.3 + transitivePeerDependencies: + - '@types/node' + - babel-plugin-macros + - bluebird + - less + - lightningcss + - sass + - sass-embedded + - stylus + - sugarss + - supports-color + - terser + + '@react-router/express@7.0.2(express@4.21.1)(react-router@7.0.2(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(typescript@5.6.3)': + dependencies: + '@react-router/node': 7.0.2(react-router@7.0.2(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(typescript@5.6.3) + express: 4.21.1 + react-router: 7.0.2(react-dom@19.0.0(react@19.0.0))(react@19.0.0) + optionalDependencies: + typescript: 5.6.3 + + '@react-router/node@7.0.2(react-router@7.0.2(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(typescript@5.6.3)': + dependencies: + '@mjackson/node-fetch-server': 0.2.0 + react-router: 7.0.2(react-dom@19.0.0(react@19.0.0))(react@19.0.0) + source-map-support: 0.5.21 + stream-slice: 0.1.2 + undici: 6.20.0 + optionalDependencies: + typescript: 5.6.3 + + '@react-router/serve@7.0.2(react-router@7.0.2(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(typescript@5.6.3)': + dependencies: + '@react-router/express': 7.0.2(express@4.21.1)(react-router@7.0.2(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(typescript@5.6.3) + '@react-router/node': 7.0.2(react-router@7.0.2(react-dom@19.0.0(react@19.0.0))(react@19.0.0))(typescript@5.6.3) + compression: 1.7.4 + express: 4.21.1 + get-port: 5.1.1 + morgan: 1.10.0 + react-router: 7.0.2(react-dom@19.0.0(react@19.0.0))(react@19.0.0) + source-map-support: 0.5.21 + transitivePeerDependencies: + - supports-color + - typescript + '@react-stately/utils@3.10.4(react@19.0.0)': dependencies: '@swc/helpers': 0.5.13 @@ -11921,6 +12114,10 @@ snapshots: '@types/node@14.18.63': {} + '@types/node@20.17.9': + dependencies: + undici-types: 6.19.8 + '@types/node@22.9.0': dependencies: undici-types: 6.19.8 @@ -12522,6 +12719,15 @@ snapshots: axobject-query@4.1.0: {} + babel-dead-code-elimination@1.0.6: + dependencies: + '@babel/core': 7.25.7 + '@babel/parser': 7.25.7 + '@babel/traverse': 7.25.7 + '@babel/types': 7.25.7 + transitivePeerDependencies: + - supports-color + babel-plugin-react-compiler@19.0.0-beta-a7bf2bd-20241110: dependencies: '@babel/types': 7.25.7 @@ -16915,6 +17121,16 @@ snapshots: optionalDependencies: react-dom: 19.0.0(react@19.0.0) + react-router@7.0.2(react-dom@19.0.0(react@19.0.0))(react@19.0.0): + dependencies: + '@types/cookie': 0.6.0 + cookie: 1.0.2 + react: 19.0.0 + set-cookie-parser: 2.7.0 + turbo-stream: 2.4.0 + optionalDependencies: + react-dom: 19.0.0(react@19.0.0) + react-smooth@4.0.1(react-dom@19.0.0(react@19.0.0))(react@19.0.0): dependencies: fast-equals: 5.0.1 @@ -18422,6 +18638,24 @@ snapshots: d3-time: 3.1.0 d3-timer: 3.0.1 + vite-node@1.6.0(@types/node@20.17.9)(lightningcss@1.27.0)(terser@5.34.1): + dependencies: + cac: 6.7.14 + debug: 4.3.7(supports-color@8.1.1) + pathe: 1.1.2 + picocolors: 1.1.1 + vite: 5.4.11(@types/node@20.17.9)(lightningcss@1.27.0)(terser@5.34.1) + transitivePeerDependencies: + - '@types/node' + - less + - lightningcss + - sass + - sass-embedded + - stylus + - sugarss + - supports-color + - terser + vite-node@1.6.0(@types/node@22.9.0)(lightningcss@1.27.0)(terser@5.34.1): dependencies: cac: 6.7.14 @@ -18458,6 +18692,17 @@ snapshots: - supports-color - terser + vite-tsconfig-paths@5.1.2(typescript@5.6.3)(vite@5.4.11(@types/node@20.17.9)(lightningcss@1.27.0)(terser@5.34.1)): + dependencies: + debug: 4.3.7(supports-color@8.1.1) + globrex: 0.1.2 + tsconfck: 3.1.3(typescript@5.6.3) + optionalDependencies: + vite: 5.4.11(@types/node@20.17.9)(lightningcss@1.27.0)(terser@5.34.1) + transitivePeerDependencies: + - supports-color + - typescript + vite-tsconfig-paths@5.1.2(typescript@5.6.3)(vite@5.4.11(@types/node@22.9.0)(lightningcss@1.27.0)(terser@5.34.1)): dependencies: debug: 4.3.7(supports-color@8.1.1) @@ -18469,6 +18714,17 @@ snapshots: - supports-color - typescript + vite@5.4.11(@types/node@20.17.9)(lightningcss@1.27.0)(terser@5.34.1): + dependencies: + esbuild: 0.21.5 + postcss: 8.4.49 + rollup: 4.24.0 + optionalDependencies: + '@types/node': 20.17.9 + fsevents: 2.3.3 + lightningcss: 1.27.0 + terser: 5.34.1 + vite@5.4.11(@types/node@22.9.0)(lightningcss@1.27.0)(terser@5.34.1): dependencies: esbuild: 0.21.5 diff --git a/turbo.json b/turbo.json index 129c8bad9..00d74effc 100644 --- a/turbo.json +++ b/turbo.json @@ -21,7 +21,12 @@ "dependsOn": ["^build"], "env": ["REACT_COMPILER", "E2E_NO_CACHE_ON_RERUN"] }, - "e2e-react-router#build": { + "e2e-react-router-v6#build": { + "outputs": ["dist/**", "cypress/**"], + "dependsOn": ["^build"], + "env": ["REACT_COMPILER", "E2E_NO_CACHE_ON_RERUN"] + }, + "e2e-react-router-v7#build": { "outputs": ["dist/**", "cypress/**"], "dependsOn": ["^build"], "env": ["REACT_COMPILER", "E2E_NO_CACHE_ON_RERUN"] @@ -58,7 +63,11 @@ "dependsOn": ["build"], "env": ["REACT_COMPILER", "E2E_NO_CACHE_ON_RERUN"] }, - "e2e-react-router#test": { + "e2e-react-router-v6#test": { + "dependsOn": ["build"], + "env": ["REACT_COMPILER", "E2E_NO_CACHE_ON_RERUN"] + }, + "e2e-react-router-v7#test": { "dependsOn": ["build"], "env": ["REACT_COMPILER", "E2E_NO_CACHE_ON_RERUN"] }, From b310dfcbdf86f1ec0f9d4db3c689a5a3365adbe1 Mon Sep 17 00:00:00 2001 From: Francois Best Date: Mon, 9 Dec 2024 07:08:31 +0100 Subject: [PATCH 08/13] chore: Formatting --- packages/nuqs/tsup.config.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/nuqs/tsup.config.ts b/packages/nuqs/tsup.config.ts index 63f87c016..2120fa7fc 100644 --- a/packages/nuqs/tsup.config.ts +++ b/packages/nuqs/tsup.config.ts @@ -7,7 +7,13 @@ const commonConfig = { format: ['esm'], experimentalDts: true, outDir: 'dist', - external: ['next', 'react', '@remix-run/react', 'react-router-dom', 'react-router'], + external: [ + 'next', + 'react', + '@remix-run/react', + 'react-router-dom', + 'react-router' + ], splitting: true, treeshake: true, tsconfig: 'tsconfig.build.json' From d3bf0d8a0aa7477377df609e3e94f50233812fe5 Mon Sep 17 00:00:00 2001 From: Francois Best Date: Sun, 8 Dec 2024 16:12:26 +0100 Subject: [PATCH 09/13] chore: Normalise ports --- CONTRIBUTING.md | 9 +++++---- packages/e2e/react/package.json | 2 +- packages/e2e/remix/package.json | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index dfc8bcb13..b46a034f2 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -21,10 +21,11 @@ When running `next dev`, this will: - Build the library and watch for changes using [`tsup`](https://tsup.egoist.dev/) - Start the docs app, which will be available at . - Start the end-to-end test benches: - - Next.js: http://localhost:3001 - - Remix: http://localhost:3002 - - React Router: http://localhost:3003 - - React SPA: http://localhost:3004 + - http://localhost:3001 - Next.js + - http://localhost:3002 - React SPA + - http://localhost:3003 - Remix + - http://localhost:3006 - React Router v6 + - http://localhost:3007 - React Router v7 ## Testing diff --git a/packages/e2e/react/package.json b/packages/e2e/react/package.json index cb54c99fc..3cc77dd11 100644 --- a/packages/e2e/react/package.json +++ b/packages/e2e/react/package.json @@ -4,7 +4,7 @@ "version": "0.0.0", "type": "module", "scripts": { - "dev": "vite --port 4000", + "dev": "vite --port 3002", "build": "tsc -b && vite build", "preview": "vite preview", "test": "pnpm run '/^test:/'", diff --git a/packages/e2e/remix/package.json b/packages/e2e/remix/package.json index 8d4e4db8d..972726899 100644 --- a/packages/e2e/remix/package.json +++ b/packages/e2e/remix/package.json @@ -5,7 +5,7 @@ "type": "module", "scripts": { "build": "remix vite:build", - "dev": "remix vite:dev --port 4001", + "dev": "remix vite:dev --port 3003", "lint": "eslint --ignore-path .gitignore --cache --cache-location ./node_modules/.cache/eslint .", "start": "remix-serve ./build/server/index.js", "test": "pnpm run '/^test:/'", From 85572c4ced7dd6f678da08f7529212499038e942 Mon Sep 17 00:00:00 2001 From: Francois Best Date: Mon, 9 Dec 2024 07:12:47 +0100 Subject: [PATCH 10/13] chore: CI name formatting --- .github/workflows/ci-cd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index a4af3bf28..722abda94 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -155,7 +155,7 @@ jobs: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} e2e-react-router: - name: E2E (react-router @${{ matrix.react-router-version }}) + name: E2E (react-router ${{ matrix.react-router-version }}) runs-on: ubuntu-24.04 needs: [ci-core] strategy: From 5db4d544960a35c4588ddd75df7396a4cf5a5f0a Mon Sep 17 00:00:00 2001 From: Francois Best Date: Tue, 10 Dec 2024 09:49:15 +0100 Subject: [PATCH 11/13] chore: Use explicit RRv6 adapter in e2e test bench --- packages/e2e/react-router/v6/src/react-router.tsx | 2 +- packages/nuqs/src/adapters/react-router.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/e2e/react-router/v6/src/react-router.tsx b/packages/e2e/react-router/v6/src/react-router.tsx index 6b8d285eb..e374cb59d 100644 --- a/packages/e2e/react-router/v6/src/react-router.tsx +++ b/packages/e2e/react-router/v6/src/react-router.tsx @@ -1,4 +1,4 @@ -import { NuqsAdapter } from 'nuqs/adapters/react-router' +import { NuqsAdapter } from 'nuqs/adapters/react-router/v6' import { createBrowserRouter, RouterProvider } from 'react-router-dom' import App from './App' diff --git a/packages/nuqs/src/adapters/react-router.ts b/packages/nuqs/src/adapters/react-router.ts index 2f4ac2f4e..330d9da41 100644 --- a/packages/nuqs/src/adapters/react-router.ts +++ b/packages/nuqs/src/adapters/react-router.ts @@ -3,7 +3,7 @@ import { renderQueryString } from '../url-encoding' import type { AdapterOptions } from './defs' import { createAdapterProvider } from './internal.context' -function useNuqsReactRouterAdapter() { +function useNuqsReactRouterV6Adapter() { const navigate = useNavigate() const [searchParams] = useSearchParams() const updateUrl = (search: URLSearchParams, options: AdapterOptions) => { @@ -23,4 +23,4 @@ function useNuqsReactRouterAdapter() { } } -export const NuqsAdapter = createAdapterProvider(useNuqsReactRouterAdapter) +export const NuqsAdapter = createAdapterProvider(useNuqsReactRouterV6Adapter) From a64020a8c1b48c62f9e402c7e487a3016ccf2ce1 Mon Sep 17 00:00:00 2001 From: Francois Best Date: Tue, 10 Dec 2024 09:51:35 +0100 Subject: [PATCH 12/13] chore: Add nuqs to RRv7 e2e test bench --- packages/e2e/react-router/v7/app/root.tsx | 7 ++++++- packages/e2e/react-router/v7/package.json | 1 + pnpm-lock.yaml | 3 +++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/e2e/react-router/v7/app/root.tsx b/packages/e2e/react-router/v7/app/root.tsx index f7ee4c0db..9344e74ae 100644 --- a/packages/e2e/react-router/v7/app/root.tsx +++ b/packages/e2e/react-router/v7/app/root.tsx @@ -1,3 +1,4 @@ +import { NuqsAdapter } from 'nuqs/adapters/react-router/v7' import { isRouteErrorResponse, Links, @@ -28,7 +29,11 @@ export function Layout({ children }: { children: React.ReactNode }) { } export default function App() { - return + return ( + + + + ) } export function ErrorBoundary({ error }: Route.ErrorBoundaryProps) { diff --git a/packages/e2e/react-router/v7/package.json b/packages/e2e/react-router/v7/package.json index ecef08e10..74c80fd61 100644 --- a/packages/e2e/react-router/v7/package.json +++ b/packages/e2e/react-router/v7/package.json @@ -12,6 +12,7 @@ "@react-router/node": "^7.0.2", "@react-router/serve": "^7.0.2", "isbot": "^5.1.17", + "nuqs": "workspace:*", "react": "catalog:react19", "react-dom": "catalog:react19", "react-router": "^7.0.2" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d15dcd7a1..59676037d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -373,6 +373,9 @@ importers: isbot: specifier: ^5.1.17 version: 5.1.17 + nuqs: + specifier: workspace:* + version: link:../../../nuqs react: specifier: catalog:react19 version: 19.0.0 From d000ca8db65a027e11960c4b99736017c2a5ddaa Mon Sep 17 00:00:00 2001 From: Francois Best Date: Tue, 10 Dec 2024 09:55:13 +0100 Subject: [PATCH 13/13] doc: Update message in react-router shorthand adapter --- packages/nuqs/adapters/react-router.d.ts | 5 +++-- packages/nuqs/src/adapters/react-router.ts | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/nuqs/adapters/react-router.d.ts b/packages/nuqs/adapters/react-router.d.ts index c38df8098..c69e44506 100644 --- a/packages/nuqs/adapters/react-router.d.ts +++ b/packages/nuqs/adapters/react-router.d.ts @@ -3,7 +3,8 @@ // Other module resolutions strategies will look for the `exports` in `package.json`, // but with `node`, TypeScript will look for a .d.ts file with that name at the // root of the package. -// This default react-router adapter is for react-router v6. If you are using -// react-router v7, please use adapters/react-router/v7 +// +// Note: this default react-router adapter is for react-router v6. +// If you are using react-router v7, please import from `nuqs/adapters/react-router/v7` export * from '../dist/adapters/react-router' diff --git a/packages/nuqs/src/adapters/react-router.ts b/packages/nuqs/src/adapters/react-router.ts index 330d9da41..a2c9041d8 100644 --- a/packages/nuqs/src/adapters/react-router.ts +++ b/packages/nuqs/src/adapters/react-router.ts @@ -1,3 +1,6 @@ +// Note: this default react-router adapter is for react-router v6. +// If you are using react-router v7, please import from `nuqs/adapters/react-router/v7` + import { useNavigate, useSearchParams } from 'react-router-dom' import { renderQueryString } from '../url-encoding' import type { AdapterOptions } from './defs'