Skip to content

Commit 5968d90

Browse files
authored
chore: update to Next.js 16 (#1170)
1 parent 82923da commit 5968d90

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+1854
-1438
lines changed

.github/workflows/ci-cd.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ jobs:
109109
- name: Build docs
110110
run: pnpm run build --filter docs
111111
env:
112+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
112113
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
113114
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
114115
- uses: 47ng/actions-slack-notify@main

packages/docs/content/docs/community-adapters/inertia-adapter-source.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { CodeBlock } from '@/src/components/code-block'
22
import { SiTypescript } from '@icons-pack/react-simple-icons'
33

44
export async function InertiaAdapterSource() {
5+
'use cache'
56
const source = await fetch(
67
'https://raw.githubusercontent.com/47ng/nuqs-inertia-pingcrm/refs/heads/with-nuqs/resources/js/lib/nuqs-inertia-adapter.ts'
78
).then(res => res.text())

packages/docs/content/docs/installation.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ npm install nuqs
2222

2323
`nuqs@^2` supports the following frameworks and their respective versions:
2424

25-
- <NextJS className='inline mr-1.5' role="presentation"/> [Next.js](/docs/adapters#nextjs): `next@^14.2.0 || ^15` <small className='text-muted-foreground'>(app & pages routers)</small>
25+
- <NextJS className='inline mr-1.5' role="presentation"/> [Next.js](/docs/adapters#nextjs): `next@>=14.2.0` <small className='text-muted-foreground'>(app & pages routers)</small>
2626
- <ReactSPA className='inline mr-1.5' role="presentation" /> [React SPA](/docs/adapters#react-spa): `react@^18.3 || ^19`
2727
- <Remix className='inline mr-1.5' role="presentation" /> [Remix](/docs/adapters#remix): `@remix-run/react@^2`
2828
- <ReactRouter className='inline mr-1.5' role="presentation" /> [React Router v6](/docs/adapters#react-router-v6): `react-router-dom@^6`

packages/docs/content/docs/parsers/community/zod-codecs.source.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
import { CodeBlock } from '@/src/components/code-block'
2+
import { cacheLife } from 'next/cache'
23
import { readFile } from 'node:fs/promises'
34

45
export async function ZodCodecsSource() {
6+
'use cache'
7+
cacheLife('static')
58
const filePath =
69
process.cwd() + '/content/docs/parsers/community/zod-codecs.lib.ts'
710
const source = await readFile(filePath, 'utf8')

packages/docs/content/docs/parsers/demos.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ export function IndexParserDemo() {
228228
</PaginationContent>
229229
</Pagination>
230230
<CodeBlock
231-
className="-mx-1 my-0 -mb-1 flex-1 border-none"
231+
className="my-0 h-10 flex-1 rounded-sm border-none [&>div]:py-2"
232232
code={`pageIndex: ${pageIndex} // internal state is zero-indexed`}
233233
allowCopy={false}
234234
/>

packages/docs/next.config.mjs

Lines changed: 48 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,39 @@ import { createMDX } from 'fumadocs-mdx/next'
55

66
const withFumadocsMDX = createMDX()
77

8+
const enableSentry =
9+
Boolean(process.env.NEXT_PUBLIC_SENTRY_DSN) &&
10+
Boolean(process.env.SENTRY_AUTH_TOKEN) &&
11+
['production', 'preview'].includes(process.env.VERCEL_ENV ?? '')
12+
813
/** @type {import('next').NextConfig} */
914
const config = {
1015
outputFileTracingIncludes: {
1116
'/playground/pagination': [
12-
'./src/app/playground/(demos)/pagination/searchParams.ts',
17+
'./src/app/playground/(demos)/pagination/search-params.ts',
1318
'./src/app/playground/(demos)/pagination/page.tsx',
1419
'./src/app/playground/(demos)/pagination/pagination-controls.server.tsx',
1520
'./src/app/playground/(demos)/pagination/pagination-controls.client.tsx'
1621
]
1722
},
23+
reactCompiler: true,
24+
cacheComponents: true,
1825
reactStrictMode: true,
26+
cacheLife: {
27+
static: {
28+
// Only changes on new deploys, assuming we at least deploy once a year
29+
stale: 300, // 5 minutes for the client cache
30+
revalidate: 365 * 24 * 60 * 60, // 1 year
31+
expire: 366 * 24 * 60 * 60 // 1 year + 1 day (has to be greater than revalidate)
32+
}
33+
},
34+
turbopack: {
35+
debugIds: enableSentry
36+
},
37+
experimental: {
38+
isolatedDevBuild: true
39+
},
40+
productionBrowserSourceMaps: enableSentry,
1941
redirects: async () => {
2042
return [
2143
{
@@ -65,45 +87,52 @@ const config = {
6587
}
6688
}
6789

90+
/**
91+
* @type {import('@sentry/nextjs').SentryBuildOptions}
92+
*/
6893
const sentryConfig = {
6994
// For all available options, see:
7095
// https://github.com/getsentry/sentry-webpack-plugin#options
7196

72-
// Suppresses source map uploading logs during build
7397
silent: true,
7498
org: process.env.SENTRY_ORG,
7599
project: process.env.SENTRY_PROJECT,
76-
authToken: process.env.SENTRY_AUTH_TOKEN
77-
}
78-
79-
const sentryOptions = {
80-
// For all available options, see:
81-
// https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/
100+
authToken: process.env.SENTRY_AUTH_TOKEN,
82101

83102
// Upload a larger set of source maps for prettier stack traces (increases build time)
84-
widenClientFileUpload: false,
103+
widenClientFileUpload: true,
85104

86-
// Transpiles SDK to be compatible with IE11 (increases bundle size)
87-
transpileClientSDK: false,
105+
release: {
106+
setCommits: process.env.VERCEL_GIT_COMMIT_SHA
107+
? {
108+
// https://github.com/getsentry/sentry-javascript-bundler-plugins/issues/443#issuecomment-1815988709
109+
repo: '47ng/nuqs',
110+
commit: process.env.VERCEL_GIT_COMMIT_SHA
111+
}
112+
: { auto: true }
113+
},
88114

89115
// Routes browser requests to Sentry through a Next.js rewrite to circumvent ad-blockers. (increases server load)
90116
// Note: Check that the configured route will not match with your Next.js middleware, otherwise reporting of client-
91117
// side errors will fail.
92118
// tunnelRoute: '/sentry',
93119

94-
hideSourceMaps: false,
95-
96120
// Automatically tree-shake Sentry logger statements to reduce bundle size
97-
disableLogger: true,
121+
// disableLogger: true,
98122

99123
// Enables automatic instrumentation of Vercel Cron Monitors.
100124
// See the following for more information:
101125
// https://docs.sentry.io/product/crons/
102126
// https://vercel.com/docs/cron-jobs
103-
automaticVercelMonitors: true
127+
automaticVercelMonitors: true,
128+
129+
debug: false
130+
}
131+
132+
if (enableSentry) {
133+
console.info('Sentry is enabled for this build.')
104134
}
105135

106-
export default withSentryConfig(withFumadocsMDX(config), {
107-
...sentryConfig,
108-
...sentryOptions
109-
})
136+
export default enableSentry
137+
? withSentryConfig(withFumadocsMDX(config), sentryConfig)
138+
: withFumadocsMDX(config)

packages/docs/package.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"directory": "packages/docs"
1515
},
1616
"scripts": {
17-
"dev": "next dev --turbo",
17+
"dev": "next dev",
1818
"build": "pnpm run build:registry && pnpm run build:next",
1919
"build:next": "next build",
2020
"build:registry": "shadcn build",
@@ -23,8 +23,8 @@
2323
"test": "tsc"
2424
},
2525
"dependencies": {
26-
"@faker-js/faker": "^9.9.0",
27-
"@headlessui/react": "2.2.7",
26+
"@faker-js/faker": "^10.1.0",
27+
"@headlessui/react": "2.2.9",
2828
"@headlessui/tailwindcss": "^0.2.2",
2929
"@icons-pack/react-simple-icons": "^13.7.0",
3030
"@number-flow/react": "^0.5.10",
@@ -40,18 +40,18 @@
4040
"@radix-ui/react-toggle": "^1.1.10",
4141
"@radix-ui/react-toggle-group": "^1.1.11",
4242
"@radix-ui/react-tooltip": "^1.2.8",
43-
"@sentry/nextjs": "^8.55.0",
43+
"@sentry/nextjs": "^10.20.0",
4444
"@tailwindcss/container-queries": "^0.1.1",
4545
"@tailwindcss/postcss": "^4.1.12",
4646
"class-variance-authority": "^0.7.1",
4747
"clsx": "^2.1.1",
4848
"dayjs": "^1.11.13",
4949
"effect": "^3.17.8",
50-
"fumadocs-core": "^15.6.12",
51-
"fumadocs-mdx": "^11.7.5",
52-
"fumadocs-ui": "^15.6.12",
53-
"lucide-react": "^0.540.0",
54-
"next": "15.5.0",
50+
"fumadocs-core": "^16.0.4",
51+
"fumadocs-mdx": "^13.0.2",
52+
"fumadocs-ui": "^16.0.4",
53+
"lucide-react": "^0.548.0",
54+
"next": "16.0.1",
5555
"nuqs": "workspace:*",
5656
"react": "catalog:react19",
5757
"react-dom": "catalog:react19",
@@ -71,10 +71,10 @@
7171
"@types/react": "catalog:react19",
7272
"@types/react-dom": "catalog:react19",
7373
"hast-util-to-jsx-runtime": "^2.3.6",
74-
"import-in-the-middle": "^1.14.2",
74+
"import-in-the-middle": "^2.0.0",
7575
"postcss": "^8.5.6",
76-
"prettier-plugin-tailwindcss": "^0.6.14",
77-
"require-in-the-middle": "^7.5.2",
76+
"prettier-plugin-tailwindcss": "^0.7.1",
77+
"require-in-the-middle": "^8.0.1",
7878
"shadcn": "^3.4.2",
7979
"shiki": "^3.11.0",
8080
"typescript": "^5.9.2"
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// This file configures the initialization of Sentry for edge features (middleware, edge routes, and so on).
2+
// The config you add here will be used whenever one of the edge features is loaded.
3+
// Note that this config is unrelated to the Vercel Edge Runtime and is also required when running locally.
4+
// https://docs.sentry.io/platforms/javascript/guides/nextjs/
5+
6+
import * as Sentry from '@sentry/nextjs'
7+
8+
const enabled =
9+
Boolean(process.env.NEXT_PUBLIC_SENTRY_DSN) &&
10+
Boolean(process.env.SENTRY_AUTH_TOKEN) &&
11+
['production', 'preview'].includes(process.env.VERCEL_ENV ?? '')
12+
13+
Sentry.init({
14+
dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
15+
enabled,
16+
17+
// Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.
18+
tracesSampleRate: 1,
19+
20+
// Setting this option to true will print useful information to the console while you're setting up Sentry.
21+
debug: false
22+
})
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// This file configures the initialization of Sentry on the server.
2+
// The config you add here will be used whenever the server handles a request.
3+
// https://docs.sentry.io/platforms/javascript/guides/nextjs/
4+
5+
import * as Sentry from '@sentry/nextjs'
6+
7+
const enabled =
8+
Boolean(process.env.NEXT_PUBLIC_SENTRY_DSN) &&
9+
Boolean(process.env.SENTRY_AUTH_TOKEN) &&
10+
['production', 'preview'].includes(process.env.VERCEL_ENV ?? '')
11+
12+
Sentry.init({
13+
dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
14+
enabled,
15+
16+
// Define how likely traces are sampled. Adjust this value in production, or use tracesSampler for greater control.
17+
tracesSampleRate: 1,
18+
19+
// Setting this option to true will print useful information to the console while you're setting up Sentry.
20+
debug: false
21+
})

packages/docs/src/app/(pages)/_landing/bundle-size.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { cacheLife } from 'next/cache'
12
import fs from 'node:fs/promises'
23
import path from 'node:path'
34

@@ -13,6 +14,8 @@ function prettyBytes(size: number) {
1314
}
1415

1516
export async function BundleSize() {
17+
'use cache'
18+
cacheLife('static') // Only changes on new deploys
1619
const filePath = path.resolve(process.cwd(), '../../packages/nuqs/size.json')
1720
try {
1821
const json = await fs.readFile(filePath, 'utf8')

0 commit comments

Comments
 (0)